"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[868],{72607:function(e,a,l){l.d(a,{A:function(){return C}});var t=l(20641),n=l(90033),u=l(53751);const s={class:"slider-wrapper"},i=["textContent"],r=["textContent"],o={class:"slider-container"},v=["min","max","step","disabled","value"],d=["textContent"];function c(e,a,l,c,p,g){return(0,t.uX)(),(0,t.CE)("label",s,[l.withRange?((0,t.uX)(),(0,t.CE)("span",{key:0,class:(0,n.C4)(["range-labels",{"with-label":l.withLabel}])},[l.withRange?((0,t.uX)(),(0,t.CE)("span",{key:0,class:"label left",textContent:(0,n.v_)(l.range[0])},null,8,i)):(0,t.Q3)("",!0),l.withRange?((0,t.uX)(),(0,t.CE)("span",{key:1,class:"label right",textContent:(0,n.v_)(l.range[1])},null,8,r)):(0,t.Q3)("",!0)],2)):(0,t.Q3)("",!0),(0,t.Lk)("span",o,[(0,t.Lk)("input",{class:(0,n.C4)(["slider",{"with-label":l.withLabel}]),type:"range",min:l.range[0],max:l.range[1],step:l.step,disabled:l.disabled,value:l.value,ref:"range",onInput:a[0]||(a[0]=(0,u.D$)(a=>e.$emit("input",a),["stop"])),onChange:a[1]||(a[1]=(0,u.D$)(a=>e.$emit("change",a),["stop"]))},null,42,v),l.withLabel?((0,t.uX)(),(0,t.CE)("span",{key:0,class:"label",textContent:(0,n.v_)(l.value),ref:"label"},null,8,d)):(0,t.Q3)("",!0)])])}var p={emits:["input","change"],props:{value:{type:Number},disabled:{type:Boolean,default:!1},range:{type:Array,default:()=>[0,100]},step:{type:Number,default:1},withLabel:{type:Boolean,default:!1},withRange:{type:Boolean,default:!1}}},g=l(66262);const h=(0,g.A)(p,[["render",c],["__scopeId","data-v-d90e850c"]]);var C=h},868:function(e,a,l){l.r(a),l.d(a,{default:function(){return X}});var t=l(20641),n=l(90033),u=l(53751);const s={class:"entity dimmer-container"},i={class:"icon"},r={class:"label"},o=["textContent"],v={class:"value-container pull-right"},d=["textContent"],c={class:"row"},p={key:0,class:"input"},g={class:"col-10"},h={class:"col-2 value"},C=["value"],y={key:1,class:"input"},k={class:"col-12 value"},m=["value"];function b(e,a,l,b,f,L){const w=(0,t.g2)("EntityIcon"),x=(0,t.g2)("Slider");return(0,t.uX)(),(0,t.CE)("div",s,[(0,t.Lk)("div",{class:(0,n.C4)(["head",{collapsed:e.collapsed}])},[(0,t.Lk)("div",i,[(0,t.bF)(w,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,t.Lk)("div",r,[(0,t.Lk)("div",{class:"name",textContent:(0,n.v_)(e.value.name)},null,8,o)]),(0,t.Lk)("div",v,[null!=L.parsedValue?((0,t.uX)(),(0,t.CE)("span",{key:0,class:"value",textContent:(0,n.v_)(L.parsedValue)},null,8,d)):(0,t.Q3)("",!0),(0,t.Lk)("button",{onClick:a[0]||(a[0]=(0,u.D$)(a=>e.collapsed=!e.collapsed,["stop"]))},[(0,t.Lk)("i",{class:(0,n.C4)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)])])],2),e.collapsed?(0,t.Q3)("",!0):((0,t.uX)(),(0,t.CE)("div",{key:0,class:"body",onClick:a[3]||(a[3]=(0,u.D$)((...e)=>L.prevent&&L.prevent(...e),["stop"]))},[(0,t.Lk)("div",c,[null!=e.value?.min&&null!=e.value?.max?((0,t.uX)(),(0,t.CE)("div",p,[(0,t.Lk)("div",g,[(0,t.bF)(x,{range:[e.value.min,e.value.max],"with-range":"",value:e.value.value,onChange:L.setValue},null,8,["range","value","onChange"])]),(0,t.Lk)("div",h,[(0,t.Lk)("input",{type:"number",value:e.value.value,onChange:a[1]||(a[1]=(...e)=>L.setValue&&L.setValue(...e))},null,40,C)])])):((0,t.uX)(),(0,t.CE)("div",y,[(0,t.Lk)("div",k,[(0,t.Lk)("input",{type:"number",value:e.value.value,onChange:a[2]||(a[2]=(...e)=>L.setValue&&L.setValue(...e))},null,40,m)])]))])]))])}var f=l(72607),L=l(14897),w=l(73818),x={name:"Dimmer",components:{Slider:f.A,EntityIcon:w["default"]},mixins:[L["default"]],computed:{parsedValue(){if(this.value?.is_write_only||null==this.value?.value)return null;let e=this.value.value;return this.value.unit&&(e=`${e} ${this.value.unit}`),e}},methods:{prevent(e){return e.stopPropagation(),!1},async setValue(e){if(e.target.value?.length){this.$emit("loading",!0);try{await this.request("entities.execute",{id:this.value.id,action:"set",value:+e.target.value})}finally{this.$emit("loading",!1)}}}}},E=l(66262);const _=(0,E.A)(x,[["render",b],["__scopeId","data-v-05503f62"]]);var X=_}}]);
//# sourceMappingURL=868.8c6ed19c.js.map