"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[8131],{11:function(t,e,n){n.d(e,{A:function(){return v}});var i=n(641),l=n(33),a=n(3751);const s=["checked","id"],o={class:"label"};function d(t,e,n,d,u,c){return(0,i.uX)(),(0,i.CE)("div",{class:(0,l.C4)(["power-switch",{disabled:n.disabled}]),onClick:e[0]||(e[0]=(0,a.D$)(((...t)=>c.onInput&&c.onInput(...t)),["stop"]))},[(0,i.Lk)("input",{type:"checkbox",checked:n.value,id:n.id},null,8,s),(0,i.Lk)("label",null,[e[1]||(e[1]=(0,i.Lk)("div",{class:"switch"},[(0,i.Lk)("div",{class:"dot"})],-1)),(0,i.Lk)("span",o,[(0,i.RG)(t.$slots,"default",{},void 0,!0)])])],2)}var u={name:"ToggleSwitch",emits:["input"],props:{id:{type:String},value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(t){if(this.disabled)return!1;this.$emit("input",t)}}},c=n(6262);const r=(0,c.A)(u,[["render",d],["__scopeId","data-v-eff375b6"]]);var v=r},8131:function(t,e,n){n.r(e),n.d(e,{default:function(){return b}});var i=n(641),l=n(33),a=n(3751);const s={class:"entity switch-container"},o={class:"head"},d={class:"col-1 icon"},u={class:"col-9 label"},c=["textContent"],r={class:"col-2 switch pull-right"};function v(t,e,n,v,p,h){const g=(0,i.g2)("EntityIcon"),f=(0,i.g2)("ToggleSwitch");return(0,i.uX)(),(0,i.CE)("div",s,[(0,i.Lk)("div",o,[(0,i.Lk)("div",d,[(0,i.bF)(g,{entity:t.value,loading:t.loading,error:t.error},null,8,["entity","loading","error"])]),(0,i.Lk)("div",u,[(0,i.Lk)("div",{class:"name",textContent:(0,l.v_)(t.value.name)},null,8,c)]),(0,i.Lk)("div",r,[(0,i.bF)(f,{value:!t.value.is_write_only&&t.value.state,disabled:t.loading||t.value.is_read_only,onInput:h.toggle,onClick:e[0]||(e[0]=(0,a.D$)((()=>{}),["stop"]))},null,8,["value","disabled","onInput"])])])])}var p=n(11),h=n(1029),g=n(4897),f={name:"Switch",components:{ToggleSwitch:p.A,EntityIcon:h["default"]},mixins:[g["default"]],methods:{async toggle(t){t.stopPropagation(),this.$emit("loading",!0);try{if(await this.request("entities.execute",{id:this.value.id,action:"toggle"}),this.value.is_write_only){const t=this;t.value.state=!0,setTimeout((()=>t.value.state=!1),250)}}finally{this.$emit("loading",!1)}}}},k=n(6262);const y=(0,k.A)(f,[["render",v],["__scopeId","data-v-2aaabd26"]]);var b=y}}]);
//# sourceMappingURL=8131.347c5b61.js.map