"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[984],{7514:function(t,e,n){n.d(e,{Z:function(){return v}});var i=n(6252),o=n(3577),a=n(9963);const s=t=>((0,i.dD)("data-v-eff375b6"),t=t(),(0,i.Cn)(),t),l=["checked","id"],c=s((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),d={class:"label"};function u(t,e,n,s,u,r){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:n.disabled}]),onClick:e[0]||(e[0]=(0,a.iM)(((...t)=>r.onInput&&r.onInput(...t)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value,id:n.id},null,8,l),(0,i._)("label",null,[c,(0,i._)("span",d,[(0,i.WI)(t.$slots,"default",{},void 0,!0)])])],2)}var r={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)}}},p=n(3744);const h=(0,p.Z)(r,[["render",u],["__scopeId","data-v-eff375b6"]]);var v=h},984:function(t,e,n){n.r(e),n.d(e,{default:function(){return m}});var i=n(6252),o=n(3577),a=n(9963);const s={class:"entity bluetooth-service-container"},l={class:"head"},c={class:"col-1 icon"},d={class:"col-9 label"},u=["textContent"],r={class:"col-2 connector pull-right"};function p(t,e,n,p,h,v){const f=(0,i.up)("EntityIcon"),g=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",s,[(0,i._)("div",l,[(0,i._)("div",c,[(0,i.Wm)(f,{entity:t.value,loading:t.loading,error:t.error},null,8,["entity","loading","error"])]),(0,i._)("div",d,[(0,i._)("div",{class:"name",textContent:(0,o.zw)(t.value.name)},null,8,u)]),(0,i._)("div",r,[(0,i.Wm)(g,{value:t.value.connected,disabled:t.loading,onInput:v.connect,onClick:e[0]||(e[0]=(0,a.iM)((()=>{}),["stop"]))},null,8,["value","disabled","onInput"])])])])}var h=n(7514),v=n(4967),f=n(847),g={name:"BluetoothService",components:{ToggleSwitch:h.Z,EntityIcon:v["default"]},mixins:[f["default"]],methods:{async connect(t){t.stopPropagation(),this.$emit("loading",!0);const e="bluetooth."+(this.value.connected?"disconnect":"connect");try{await this.request(e,{device:this.parent.address,service_uuid:this.uuid})}finally{this.$emit("loading",!1)}},async disconnect(t){t.stopPropagation(),this.$emit("loading",!0);try{await this.request("bluetooth.disconnect",{device:this.parent.address})}finally{this.$emit("loading",!1)}}}},b=n(3744);const y=(0,b.Z)(g,[["render",p],["__scopeId","data-v-5c801a06"]]);var m=y}}]);
//# sourceMappingURL=984.50a15617.js.map