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