"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[7590],{7590:function(e,t,n){n.r(t),n.d(t,{default:function(){return b}});var l=n(6252),a=n(3577);const o={class:"entity battery-container"},s={class:"head"},r={class:"icon"},c={class:"label"},u=["textContent"],i={class:"value-container"},v=["textContent"];function d(e,t,n,d,f,p){const C=(0,l.up)("EntityIcon");return(0,l.wg)(),(0,l.iD)("div",o,[(0,l._)("div",s,[(0,l._)("div",r,[(0,l.Wm)(C,{entity:e.value,icon:p.icon,loading:e.loading,error:e.error},null,8,["entity","icon","loading","error"])]),(0,l._)("div",c,[(0,l._)("div",{class:"name",textContent:(0,a.zw)(e.value.name)},null,8,u)]),(0,l._)("div",i,[null!=p.valuePercent?((0,l.wg)(),(0,l.iD)("span",{key:0,class:"value",textContent:(0,a.zw)(p.valuePercent+"%")},null,8,v)):(0,l.kq)("",!0)])])])}var f=n(847),p=n(4967);const C=[{iconClass:"full",color:"#157145",value:.9},{iconClass:"three-quarters",color:"#94C595",value:.825},{iconClass:"half",color:"#F0B67F",value:.625},{iconClass:"quarter",color:"#FE5F55",value:.375},{iconClass:"low",color:"#CC444B",value:.15},{iconClass:"empty",color:"#EC0B43",value:.05}];var h={name:"Battery",components:{EntityIcon:p["default"]},mixins:[f["default"]],computed:{valuePercent(){if(null==this.value?.value)return null;const e=this.value.min||0,t=this.value.max||100;return(100*this.value.value/(t-e)).toFixed(0)},icon(){const e={...this.value.meta?.icon||{}};let t=this.valuePercent,n=C[0];if(null!=t){t=parseFloat(t)/100;for(const e of C){if(t>e.value)break;n=e}}return e["class"]=`fas fa-battery-${n.iconClass}`,e["color"]=n.color,e}},methods:{prevent(e){return e.stopPropagation(),!1}}},m=n(3744);const y=(0,m.Z)(h,[["render",d],["__scopeId","data-v-4b2ced66"]]);var b=y}}]);
//# sourceMappingURL=7590.ebe62444.js.map