"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3303],{6:function(e,t,n){n.d(t,{Z:function(){return h}});var a=n(6252),i=n(3577),l=n(9963),o=function(e){return(0,a.dD)("data-v-a6396ae8"),e=e(),(0,a.Cn)(),e},u=["checked"],s=o((function(){return(0,a._)("div",{class:"switch"},[(0,a._)("div",{class:"dot"})],-1)})),r={class:"label"};function c(e,t,n,o,c,d){return(0,a.wg)(),(0,a.iD)("div",{class:(0,i.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,l.iM)((function(){return d.onInput&&d.onInput.apply(d,arguments)}),["stop"]))},[(0,a._)("input",{type:"checkbox",checked:n.value},null,8,u),(0,a._)("label",null,[s,(0,a._)("span",r,[(0,a.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var d={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput:function(e){if(this.disabled)return!1;this.$emit("input",e)}}},p=n(3744);const v=(0,p.Z)(d,[["render",c],["__scopeId","data-v-a6396ae8"]]);var h=v},3303:function(e,t,n){n.r(t),n.d(t,{default:function(){return y}});n(8309);var a=n(6252),i=n(3577),l=n(9963),o={class:"entity switch-container"},u={class:"head"},s={class:"col-1 icon"},r={class:"col-9 label"},c=["textContent"],d={class:"col-2 switch pull-right"};function p(e,t,n,p,v,h){var f=(0,a.up)("EntityIcon"),g=(0,a.up)("ToggleSwitch");return(0,a.wg)(),(0,a.iD)("div",o,[(0,a._)("div",u,[(0,a._)("div",s,[(0,a.Wm)(f,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,a._)("div",r,[(0,a._)("div",{class:"name",textContent:(0,i.zw)(e.value.name)},null,8,c)]),(0,a._)("div",d,[(0,a.Wm)(g,{value:!e.value.is_write_only&&e.value.state,disabled:e.loading||e.value.is_read_only,onInput:h.toggle,onClick:t[0]||(t[0]=(0,l.iM)((function(){}),["stop"]))},null,8,["value","disabled","onInput"])])])])}var v=n(8534),h=(n(5666),n(6)),f=n(1706),g=n(7909),_={name:"Switch",components:{ToggleSwitch:h.Z,EntityIcon:f["default"]},mixins:[g["default"]],methods:{toggle:function(e){var t=this;return(0,v.Z)(regeneratorRuntime.mark((function n(){var a;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.stopPropagation(),t.$emit("loading",!0),n.prev=2,n.next=5,t.request("entities.execute",{id:t.value.id,action:"toggle"});case 5:t.value.is_write_only&&(a=t,a.value.state=!0,setTimeout((function(){return a.value.state=!1}),250));case 6:return n.prev=6,t.$emit("loading",!1),n.finish(6);case 9:case"end":return n.stop()}}),n,null,[[2,,6,9]])})))()}}},w=n(3744);const m=(0,w.Z)(_,[["render",p],["__scopeId","data-v-2aaabd26"]]);var y=m}}]);
//# sourceMappingURL=3303-legacy.337cf4d7.js.map