import{r as _,u as p,j as e,L as g,a as x,I as j,dp as N,dq as k,dr as y,ds as w,M as S,S as $,A as z,dt as E,du as L,dv as R,b2 as A}from"./index-a36IMXuN.js";import{s as U}from"./snakeCase-BMb4_GjJ.js";import"./envs-CRUy-_iG.js";import"./_createCompounder-BuXEc9F7.js";import"./isObjectLike-BQssIl0N.js";const M="2.11.2",f={version:M};function v({name:i,data:r}){const s=[];for(const n in r){const l=r[n];s.push(e.jsx("li",{children:e.jsxs(g,{to:"#",children:[n,": ",l]})},n))}return e.jsx("li",{children:e.jsxs("details",{children:[e.jsx("summary",{children:i}),e.jsx("ul",{children:s})]})})}const T=_.memo(i=>{const{devices:r}=i,{t:s}=p(["stats","zigbee"]),n=_.useMemo(()=>{const l={},o={},d={},m={};for(const a of r){if(a.type==="Coordinator")continue;const h=s(c=>c[a.type],{ns:"zigbee"}),t=a.model_id||s(c=>c.unknown,{ns:"zigbee"}),b=a.manufacturer||s(c=>c.unknown,{ns:"zigbee"}),u=s(c=>c[U(a.power_source||"unknown")],{ns:"zigbee"});l[h]=(l[h]||0)+1,o[u]=(o[u]||0)+1,d[t]=(d[t]||0)+1,m[b]=(m[b]||0)+1}return e.jsxs(e.Fragment,{children:[e.jsx(v,{name:s(a=>a.byType),data:l}),e.jsx(v,{name:s(a=>a.byPowerSource),data:o}),e.jsx(v,{name:s(a=>a.byModel),data:d}),e.jsx(v,{name:s(a=>a.byVendor),data:m})]})},[r,s]);return e.jsxs("ul",{children:[e.jsx("li",{children:e.jsxs(g,{to:"#",children:[s(l=>l.total)," ",r.length-1]})}),n]})}),q=_.memo(({sourceIdx:i})=>{const{t:r}=p("zigbee"),s=x(j(o=>o.bridgeInfo[i])),n=x(j(o=>o.bridgeHealth[i])),l={template:"problem_report.yaml",z2m_version:`${s.version} (${s.commit})`,adapter_fwversion:JSON.stringify(s.coordinator.meta),adapter:s.coordinator.type,setup:`os: \`${s.os.version}\`
node: \`${s.os.node_version}\`
ha: \`${s.config.homeassistant.enabled}\``,notes:n.response_time>0?`
#### Last health check
time: \`${new Date(n.response_time)}\`
os.load_average: \`${n.os.load_average.join(", ")}\`
os.memory_percent: \`${n.os.memory_percent}\`
process.memory_percent: \`${n.process.memory_percent}\`
process.uptime_sec: \`${Math.round(n.process.uptime_sec)}\`
`:""};return e.jsx(g,{target:"_blank",rel:"noopener noreferrer",to:`${A}?${new URLSearchParams(l).toString()}`,className:"btn btn-ghost",children:r(o=>o.report_problem)})});function D({sourceIdx:i}){const{t:r}=p(["settings","common","zigbee"]),s=x(j(t=>t.bridgeInfo[i])),n=x(j(t=>t.devices[i])),o=s.version.match(/^\d+\.\d+\.\d+$/)===null?e.jsx("a",{className:"link link-hover text-secondary",target:"_blank",rel:"noopener noreferrer",href:`${N}dev/`,children:s.version}):e.jsx("a",{className:"link link-hover",target:"_blank",rel:"noopener noreferrer",href:`${k}${s.version}`,children:s.version}),d=s.commit?e.jsxs(e.Fragment,{children:["commit:"," ",e.jsx("a",{className:"link",target:"_blank",rel:"noopener noreferrer",href:`${N}${s.commit}`,children:s.commit})]}):null,m=e.jsx("a",{className:"link link-hover",target:"_blank",rel:"noopener noreferrer",href:`${R}${f.version}`,children:f.version}),a=e.jsx("a",{className:"link link-hover",target:"_blank",rel:"noopener noreferrer",href:`${y}${s.zigbee_herdsman_converters.version}`,children:s.zigbee_herdsman_converters.version}),h=e.jsx("a",{className:"link link-hover",target:"_blank",rel:"noopener noreferrer",href:`${w}${s.zigbee_herdsman.version}`,children:s.zigbee_herdsman.version});return e.jsxs("div",{className:"flex flex-col gap-3 items-center text-center w-full",children:[e.jsx(q,{sourceIdx:i}),e.jsxs("div",{className:"stats stats-vertical lg:stats-horizontal shadow",children:[S&&e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.source,{ns:"common"})}),e.jsx("div",{className:"stat-value text-xl",children:e.jsx($,{idx:i,alwaysShowName:!0})}),e.jsx("div",{className:"stat-desc max-w-md whitespace-normal",children:z[i]})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.zigbee2mqtt_version)}),e.jsx("div",{className:"stat-value text-lg",children:o}),e.jsx("div",{className:"stat-desc",children:d})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.frontend_version)}),e.jsx("div",{className:"stat-value text-lg",children:m})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.zigbee_herdsman_converters_version)}),e.jsx("div",{className:"stat-value text-lg",children:a})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.zigbee_herdsman_version)}),e.jsx("div",{className:"stat-value text-lg",children:h})]})]}),e.jsxs("div",{className:"stats stats-vertical lg:stats-horizontal shadow",children:[e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.machine)}),e.jsx("div",{className:"stat-value text-lg max-w-md whitespace-normal",children:s.os.version}),e.jsxs("div",{className:"stat-desc",children:["CPU: ",s.os.cpus]}),e.jsxs("div",{className:"stat-desc",children:["RAM: ",s.os.memory_mb," MB"]})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.mqtt)}),e.jsx("div",{className:"stat-value text-lg",children:s.mqtt.server}),e.jsx("div",{className:"stat-desc",children:e.jsxs("a",{href:E,target:"_blank",rel:"noreferrer",className:"link link-hover",children:[r(t=>t.version),": ",s.mqtt.version]})})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.node_version)}),e.jsx("div",{className:"stat-value text-lg",children:e.jsx("a",{href:L,target:"_blank",rel:"noreferrer",className:"link link-hover",children:s.os.node_version})})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:r(t=>t.coordinator)}),e.jsx("div",{className:"stat-value text-lg",children:s.coordinator.type}),e.jsx("div",{className:"stat-desc",children:e.jsx("span",{className:"badge badge-sm badge-primary",title:r(t=>t.coordinator_ieee_address),children:s.coordinator.ieee_address})}),e.jsxs("div",{className:"stat-desc",children:[r(t=>t.revision),": ",s.coordinator.meta.revision||r(t=>t.unknown,{ns:"zigbee"})]})]})]}),e.jsx("ul",{className:"menu bg-base-100 rounded-box shadow min-w-sm",children:e.jsx("li",{children:e.jsxs("details",{open:!0,children:[e.jsx("summary",{children:r(t=>t.stats)}),e.jsx(T,{devices:n})]})})})]})}export{D as default};
