"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[9651,3459],{9651:function(t,e,o){o.r(e),o.d(e,{default:function(){return b}});o(8309);var n=o(6252),l=o(3577),r={class:"entity battery-container"},a={class:"head"},i={class:"col-1 icon"},c={class:"col-s-8 col-m-9 label"},u=["textContent"],s={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"];function v(t,e,o,v,f,p){var h=(0,n.up)("EntityIcon");return(0,n.wg)(),(0,n.iD)("div",r,[(0,n._)("div",a,[(0,n._)("div",i,[(0,n.Wm)(h,{entity:t.value,icon:p.icon,loading:t.loading,error:t.error},null,8,["entity","icon","loading","error"])]),(0,n._)("div",c,[(0,n._)("div",{class:"name",textContent:(0,l.zw)(t.value.name)},null,8,u)]),(0,n._)("div",s,[null!=p.valuePercent?((0,n.wg)(),(0,n.iD)("span",{key:0,class:"value-percent",textContent:(0,l.zw)(p.valuePercent+"%")},null,8,d)):(0,n.kq)("",!0)])])])}var f=o(6347),p=o(4648),h=(o(6977),o(7909)),y=o(3459),m=[{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}],C={name:"Battery",components:{EntityIcon:y["default"]},mixins:[h["default"]],computed:{valuePercent:function(){var t;if(null==(null===(t=this.value)||void 0===t?void 0:t.value))return null;var e=this.value.min||0,o=this.value.max||100;return(100*this.value.value/(o-e)).toFixed(0)},icon:function(){var t,e=(0,p.Z)({},(null===(t=this.value.meta)||void 0===t?void 0:t.icon)||{}),o=this.valuePercent,n=m[0];if(null!=o){o=parseFloat(o)/100;var l,r=(0,f.Z)(m);try{for(r.s();!(l=r.n()).done;){var a=l.value;if(o>a.value)break;n=a}}catch(i){r.e(i)}finally{r.f()}}return e["class"]="fas fa-battery-".concat(n.iconClass),e["color"]=n.color,e}},methods:{prevent:function(t){return t.stopPropagation(),!1}}},g=o(3744);const F=(0,g.Z)(C,[["render",v],["__scopeId","data-v-fb9c9926"]]);var b=F},3459:function(t,e,o){o.r(e),o.d(e,{default:function(){return p}});var n=o(6252),l=o(3577),r=o(3540),a={key:0,src:r,class:"loading"},i={key:1,class:"fas fa-circle-exclamation error"};function c(t,e,o,r,c,u){var s=(0,n.up)("Icon");return(0,n.wg)(),(0,n.iD)("div",{class:(0,l.C_)(["entity-icon-container",{"with-color-fill":!!u.colorFill}]),style:(0,l.j5)(u.colorFillStyle)},[o.loading?((0,n.wg)(),(0,n.iD)("img",a)):o.error?((0,n.wg)(),(0,n.iD)("i",i)):((0,n.wg)(),(0,n.j4)(s,(0,l.vs)((0,n.dG)({key:2},u.computedIconNormalized)),null,16))],6)}var u=o(4648),s=(o(7941),o(7042),o(1478)),d={name:"EntityIcon",components:{Icon:s.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},entity:{type:Object,required:!0},icon:{type:Object,default:function(){}},hasColorFill:{type:Boolean,default:!1}},data:function(){return{component:null,modalVisible:!1}},computed:{computedIcon:function(){var t,e,o=(0,u.Z)({},(null===(t=this.entity)||void 0===t||null===(e=t.meta)||void 0===e?void 0:e.icon)||{});return Object.keys(this.icon||{}).length&&(o=this.icon),(0,u.Z)({},o)},colorFill:function(){return this.hasColorFill&&this.computedIcon.color},colorFillStyle:function(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIconNormalized:function(){var t=(0,u.Z)({},this.computedIcon);return this.colorFill&&delete t.color,t},type:function(){var t=this.entity.type||"";return t.charAt(0).toUpperCase()+t.slice(1)}}},v=o(3744);const f=(0,v.Z)(d,[["render",c],["__scopeId","data-v-4fad24e6"]]);var p=f},3540:function(t,e,o){t.exports=o.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=9651-legacy.fc7ada5d.js.map