import{r as j,u as g,j as a,F as c,k as B,a_ as k,by as E,h as P,bz as u,bA as v,bB as x,bC as C,bD as p}from"./index-VJpwYvBU.js";import{s as w}from"./snakeCase-BPMTuOlK.js";const L=j.memo(h=>{const{device:m,batteryPercent:s,batteryState:y,batteryLow:f,showLevel:d,...l}=h,{t:n}=g("zigbee");let r;switch(m?.power_source&&(r=m.power_source),r){case"Battery":{let t=n(b=>b.battery),i="",e=u,o=!1;if(s!=null)i=`${s}%`,s>=85?e=u:s>=65?e=v:s>=40?e=x:s>=20?e=C:(e=p,o=!0);else if(y!=null)switch(i=y,y){case"high":e=u;break;case"medium":e=x;break;case"low":e=p,o=!0;break}else f!=null&&(i=f?"low":"ok",e=f?p:u);return f===!0&&(o=!0),i!==""&&(t+=`, ${n(b=>b.power_level)}: ${i}`),a.jsxs("span",{className:o?"text-error":"",children:[a.jsx(c,{icon:e,fade:o,title:t,...l}),d&&a.jsx("span",{className:"ps-2",children:i})]})}case"Mains (single phase)":case"Mains (3 phase)":case"DC Source":return a.jsx(c,{icon:P,title:n(t=>t[w(r)]),...l});case"Emergency mains and transfer switch":case"Emergency mains constantly powered":return a.jsx(c,{icon:E,title:n(t=>t[w(r)]),...l});default:return m?.type==="GreenPower"?a.jsx(c,{icon:B,title:"Green",...l}):a.jsx(c,{icon:k,title:r?n(t=>t[w(r)]):void 0,...l})}});export{L as P};
