import{dq as _,dG as p,dm as e,x as g,dB as x,dF as j,a5 as u,a7 as k,a8 as y,a9 as w,J as S,a0 as $,a as z,y as E,Q as R,X as L,a6 as U}from"./index-D_pphaE2.js";import{s as A}from"./snakeCase-DwtuZqse.js";import"./envs-CRUy-_iG.js";import"./_createCompounder-DD7kMWdY.js";import"./isObjectLike-DDO0-ybB.js";const M="2.12.0",f={version:M};function v({name:i,data:a}){const s=[];for(const n in a){const l=a[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:a}=i,{t:s}=p(["stats","zigbee"]),n=_.useMemo(()=>{const l={},o={},d={},m={};for(const r of a){if(r.type==="Coordinator")continue;const h=s(c=>c[r.type],{ns:"zigbee"}),t=r.model_id||s(c=>c.unknown,{ns:"zigbee"}),b=r.manufacturer||s(c=>c.unknown,{ns:"zigbee"}),N=s(c=>c[A(r.power_source||"unknown")],{ns:"zigbee"});l[h]=(l[h]||0)+1,o[N]=(o[N]||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(r=>r.byType),data:l}),e.jsx(v,{name:s(r=>r.byPowerSource),data:o}),e.jsx(v,{name:s(r=>r.byModel),data:d}),e.jsx(v,{name:s(r=>r.byVendor),data:m})]})},[a,s]);return e.jsxs("ul",{children:[e.jsx("li",{children:e.jsxs(g,{to:"#",children:[s(l=>l.total)," ",a.length-1]})}),n]})}),q=_.memo(({sourceIdx:i})=>{const{t:a}=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:`${U}?${new URLSearchParams(l).toString()}`,className:"btn btn-ghost",children:a(o=>o.report_problem)})});function I({sourceIdx:i}){const{t:a}=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:`${u}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:`${u}${s.commit}`,children:s.commit})]}):null,m=e.jsx("a",{className:"link link-hover",target:"_blank",rel:"noopener noreferrer",href:`${L}${f.version}`,children:f.version}),r=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:a(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:a(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:a(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:a(t=>t.zigbee_herdsman_converters_version)}),e.jsx("div",{className:"stat-value text-lg",children:r})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:a(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:a(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:a(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:[a(t=>t.version),": ",s.mqtt.version]})})]}),e.jsxs("div",{className:"stat place-items-center",children:[e.jsx("div",{className:"stat-title",children:a(t=>t.node_version)}),e.jsx("div",{className:"stat-value text-lg",children:e.jsx("a",{href:R,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:a(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:a(t=>t.coordinator_ieee_address),children:s.coordinator.ieee_address})}),e.jsxs("div",{className:"stat-desc",children:[a(t=>t.revision),": ",s.coordinator.meta.revision||a(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:a(t=>t.stats)}),e.jsx(T,{devices:n})]})})})]})}export{I as default};
