(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[4276],{4276:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return D}});var s=t(6252),i=t(3577),l=t(9963);const c=e=>((0,s.dD)("data-v-eac2ea44"),e=e(),(0,s.Cn)(),e),o={class:"switches-container"},a={class:"switch-plugins"},u={key:0,class:"no-content"},d=["onClick"],r=["textContent"],h={key:0,class:"refresh col-2"},g=["onClick","disabled"],p=c((()=>(0,s._)("i",{class:"fa fa-sync"},null,-1))),f=[p],w={class:"refresh-button"},b=["disabled"],k=c((()=>(0,s._)("i",{class:"fa fa-sync"},null,-1))),m=[k];function v(e,n,t,c,p,k){const v=(0,s.up)("Loading");return(0,s.wg)(),(0,s.iD)("div",o,[p.loading?((0,s.wg)(),(0,s.j4)(v,{key:0})):(0,s.kq)("",!0),(0,s._)("div",a,[Object.keys(p.plugins).length?(0,s.kq)("",!0):((0,s.wg)(),(0,s.iD)("div",u,"No switch plugins configured")),((0,s.wg)(!0),(0,s.iD)(s.HY,null,(0,s.Ko)(Object.keys(p.plugins),(e=>((0,s.wg)(),(0,s.iD)("div",{class:"switch-plugin",key:e,onClick:n=>p.selectedPlugin=p.selectedPlugin===e?null:e},[(0,s._)("div",{class:(0,i.C_)(["header",{selected:p.selectedPlugin===e}])},[(0,s._)("div",{class:"name col-10",textContent:(0,i.zw)(e)},null,8,r),p.selectedPlugin===e?((0,s.wg)(),(0,s.iD)("div",h,[(0,s._)("button",{onClick:(0,l.iM)((n=>p.bus.emit("refresh",e)),["stop"]),title:"Refresh plugin",disabled:p.loading},f,8,g)])):(0,s.kq)("",!0)],2),(0,s._)("div",{class:(0,i.C_)(["body",{hidden:p.selectedPlugin!==e}])},[((0,s.wg)(),(0,s.j4)((0,s.LL)(p.components[e]),{config:p.plugins[e],"plugin-name":e,selected:p.selectedPlugin===e,bus:p.bus},null,8,["config","plugin-name","selected","bus"]))],2)],8,d)))),128))]),(0,s._)("div",w,[(0,s._)("button",{onClick:n[0]||(n[0]=(...e)=>k.refresh&&k.refresh(...e)),disabled:p.loading,title:"Refresh plugins"},m,8,b)])])}var y=t(1232),_=t(2628),C=t(9652),x={name:"Switches",components:{Loading:y.Z},mixins:[_.Z],data(){return{loading:!1,plugins:{},components:{},selectedPlugin:null,bus:(0,C.Z)()}},methods:{initPanels(){this.components={},Object.keys(this.plugins).forEach((async e=>{const n=e.split(".").map((e=>e[0].toUpperCase()+e.slice(1))).join("");let i=null;try{i=await t(6371)(`./${n}/Index`)}catch(c){return}const l=(0,s.RC)((async()=>i));this.$options.components[e]=l,this.components[e]=l}))},async refresh(){this.loading=!0;try{this.plugins=await this.request("utils.get_switch_plugins"),this.initPanels()}finally{this.loading=!1}}},mounted(){this.refresh()}},I=t(3744);const P=(0,I.Z)(x,[["render",v],["__scopeId","data-v-eac2ea44"]]);var D=P},6371:function(e,n,t){var s={"./LightHue/Index":[2844,1474,6590,2844],"./Smartthings/Index":[9196,1474,6590,9196],"./SwitchTplink/Index":[3785,1474,6590,3785],"./SwitchWemo/Index":[5210,1474,6590,5210],"./Switchbot/Index":[9694,1474,6590,9694],"./SwitchbotBluetooth/Index":[9694,1474,6590,9694],"./ZigbeeMqtt/Index":[5466,1474,6590,5466],"./Zwave/Index":[7262,1474,6590,7262],"./ZwaveMqtt/Index":[2380,1474,6590,2380]};function i(e){if(!t.o(s,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=s[e],i=n[0];return Promise.all(n.slice(1).map(t.e)).then((function(){return t(i)}))}i.keys=function(){return Object.keys(s)},i.id=6371,e.exports=i}}]);
//# sourceMappingURL=4276.728421b8.js.map