(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[4276],{4276:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return R}});t(7941);var i=t(6252),r=t(3577),s=t(9963),u=function(e){return(0,i.dD)("data-v-eac2ea44"),e=e(),(0,i.Cn)(),e},c={class:"switches-container"},l={class:"switch-plugins"},o={key:0,class:"no-content"},a=["onClick"],d=["textContent"],p={key:0,class:"refresh col-2"},f=["onClick","disabled"],g=u((function(){return(0,i._)("i",{class:"fa fa-sync"},null,-1)})),h=[g],w={class:"refresh-button"},v=["disabled"],m=u((function(){return(0,i._)("i",{class:"fa fa-sync"},null,-1)})),k=[m];function b(e,n,t,u,g,m){var b=(0,i.up)("Loading");return(0,i.wg)(),(0,i.iD)("div",c,[g.loading?((0,i.wg)(),(0,i.j4)(b,{key:0})):(0,i.kq)("",!0),(0,i._)("div",l,[Object.keys(g.plugins).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",o,"No switch plugins configured")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(Object.keys(g.plugins),(function(e){return(0,i.wg)(),(0,i.iD)("div",{class:"switch-plugin",key:e,onClick:function(n){return g.selectedPlugin=g.selectedPlugin===e?null:e}},[(0,i._)("div",{class:(0,r.C_)(["header",{selected:g.selectedPlugin===e}])},[(0,i._)("div",{class:"name col-10",textContent:(0,r.zw)(e)},null,8,d),g.selectedPlugin===e?((0,i.wg)(),(0,i.iD)("div",p,[(0,i._)("button",{onClick:(0,s.iM)((function(n){return g.bus.emit("refresh",e)}),["stop"]),title:"Refresh plugin",disabled:g.loading},h,8,f)])):(0,i.kq)("",!0)],2),(0,i._)("div",{class:(0,r.C_)(["body",{hidden:g.selectedPlugin!==e}])},[((0,i.wg)(),(0,i.j4)((0,i.LL)(g.components[e]),{config:g.plugins[e],"plugin-name":e,selected:g.selectedPlugin===e,bus:g.bus},null,8,["config","plugin-name","selected","bus"]))],2)],8,a)})),128))]),(0,i._)("div",w,[(0,i._)("button",{onClick:n[0]||(n[0]=function(){return m.refresh&&m.refresh.apply(m,arguments)}),disabled:g.loading,title:"Refresh plugins"},k,8,v)])])}var x=t(8534),_=(t(5666),t(1539),t(4747),t(9600),t(1249),t(4916),t(3123),t(7042),t(8783),t(3948),t(1232)),y=t(2628),C=t(9652),I={name:"Switches",components:{Loading:_.Z},mixins:[y.Z],data:function(){return{loading:!1,plugins:{},components:{},selectedPlugin:null,bus:(0,C.Z)()}},methods:{initPanels:function(){var e=this;this.components={},Object.keys(this.plugins).forEach(function(){var n=(0,x.Z)(regeneratorRuntime.mark((function n(r){var s,u,c;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return s=r.split(".").map((function(e){return e[0].toUpperCase()+e.slice(1)})).join(""),u=null,n.prev=2,n.next=5,t(6371)("./".concat(s,"/Index"));case 5:u=n.sent,n.next=11;break;case 8:return n.prev=8,n.t0=n["catch"](2),n.abrupt("return");case 11:c=(0,i.RC)((0,x.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",u);case 1:case"end":return e.stop()}}),e)})))),e.$options.components[r]=c,e.components[r]=c;case 14:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e){return n.apply(this,arguments)}}())},refresh:function(){var e=this;return(0,x.Z)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,n.prev=1,n.next=4,e.request("utils.get_switch_plugins");case 4:e.plugins=n.sent,e.initPanels();case 6:return n.prev=6,e.loading=!1,n.finish(6);case 9:case"end":return n.stop()}}),n,null,[[1,,6,9]])})))()}},mounted:function(){this.refresh()}},P=t(3744);const Z=(0,P.Z)(I,[["render",b],["__scopeId","data-v-eac2ea44"]]);var R=Z},6371:function(e,n,t){var i={"./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 r(e){if(!t.o(i,e))return Promise.resolve().then((function(){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=i[e],r=n[0];return Promise.all(n.slice(1).map(t.e)).then((function(){return t(r)}))}r.keys=function(){return Object.keys(i)},r.id=6371,e.exports=r}}]);
//# sourceMappingURL=4276-legacy.9ed76a69.js.map