platypush/platypush/backend/http/webapp/dist/static/js/3674-legacy.c0844108.js

2 lines
9.4 KiB
JavaScript
Raw Normal View History

2022-03-29 23:45:57 +02:00
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3674],{3674:function(e,t,n){n.r(t),n.d(t,{default:function(){return L}});var r=n(6252);function i(e,t,n,i,u,s){var o=(0,r.up)("Loading"),a=(0,r.up)("LightPlugin");return(0,r.wg)(),(0,r.iD)(r.HY,null,[u.loading?((0,r.wg)(),(0,r.j4)(o,{key:0})):(0,r.kq)("",!0),(0,r.Wm)(a,{"plugin-name":"light.hue",config:n.config,lights:e.lights,groups:e.groups,scenes:e.scenes,animations:e.animations,"initial-group":s.initialGroup,"loading-groups":e.loadingGroups,"color-converter":u.colorConverter,onGroupToggle:s.toggleGroup,onLightChanged:s.onLightChanged,onLightToggle:s.toggleLight,onSetLight:s.setLight,onSetGroup:s.setGroup,onSelectScene:s.setScene,onStartAnimation:s.startAnimation,onStopAnimation:s.stopAnimation,onRefresh:t[0]||(t[0]=function(e){return s.refresh(!0)})},null,8,["config","lights","groups","scenes","animations","initial-group","loading-groups","color-converter","onGroupToggle","onLightChanged","onLightToggle","onSetLight","onSetGroup","onSelectScene","onStartAnimation","onStopAnimation"])],64)}var u=n(4648),s=n(9584),o=n(6084),a=n(8534),c=(n(5666),n(7941),n(1539),n(7327),n(9720),n(3948),n(2479),n(1249),n(8309),n(2222),n(8783),n(1406)),g=(n(4747),{name:"Utils",data:function(){return{lights:{},groups:{},scenes:{},animations:{},loadingLights:{},loadingGroups:{}}},computed:{groupsByName:function(){return this.groups?Object.entries(this.groups).reduce((function(e,t){var n=(0,o.Z)(t,2),r=n[0],i=n[1];return e[i.name||r]=(0,u.Z)((0,u.Z)({},i),{},{id:r}),e}),{}):{}}},methods:{_getGroups:function(e){var t=e.filter((function(e){return null!=e}));if(!t.length)return Object.values(this.groups);var n=this;return t.map((function(e){return e instanceof Object?e:n.groups[e]}))},_getLights:function(e){var t=e.filter((function(e){return null!=e}));if(!t.length)return Object.values(this.lights);var n=this;return t.map((function(e){return e instanceof Object?e:n.lights[e]}))},setGroupsLoading:function(e){var t=this;this._getGroups(e).forEach((function(e){t.loadingGroups[e.id]=!0,e.lights&&t.setLightsLoading(e.lights)}))},unsetGroupsLoading:function(e){var t=this;this._getGroups(e).forEach((function(e){e.id in t.loadingGroups&&delete t.loadingGroups[e.id],e.lights&&t.setLightsLoading(e.lights)}))},setLightsLoading:function(e){var t=this;this._getLights(e).forEach((function(e){t.loadingLights[e.id]=!0}))},unsetLightsLoading:function(e){var t=this;this._getLights(e).forEach((function(e){e.id in t.loadingLights&&delete t.loadingLights[e.id]}))},groupAction:function(e,t){var n=arguments,r=this;return(0,a.Z)(regeneratorRuntime.mark((function i(){var u,s,o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:for(u=n.length,s=new Array(u>2?u-2:0),o=2;o<u;o++)s[o-2]=n[o];return r.setGroupsLoading(s),i.prev=2,i.next=5,r.request(e,t);case 5:return i.abrupt("return",i.sent);case 6:return i.prev=6,r.unsetGroupsLoading(s),i.finish(6);case 9:case"end":return i.stop()}}),i,null,[[2,,6,9]])})))()},lightAction:function(e,t){var n=arguments,r=this;return(0,a.Z)(regeneratorRuntime.mark((function i(){var u,s,o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:for(u=n.length,s=new Array(u>2?u-2:0),o=2;o<u;o++)s[o-2]=n[o];return r.setLightsLoading(s),i.prev=2,i.next=5,r.request(e,t);case 5:return i.abrupt("return",i.sent);case 6:return i.prev=6,r.unsetLightsLoading(s),i.finish(6);case 9:case"end":return i.stop()}}),i,null,[[2,,6,9]])})))()}}});const h=g;var l=h,p=n(634),f=n(2628),m=n(1232),d={name:"LightHue",components:{Loading:m.Z,LightPlugin:c["default"]},mixins:[f.Z,l],props:{config:{type:Object,default:function(){}}},data:function(){return{loading:!1,colorConverter:new p.N({hue:[0,65535],sat:[0,255],bri:[0,255],ct:[150,500]})}},computed:{initialGroup:function(){if(!this.config.groups||!Object.keys(this.config.groups).length)return null;var e=this.config.groups[0];return e in this.groups?this.groups[e].id:e in this.groupsByName?this.groupsByName[e].id:null}},methods:{getLights:function(){var e=this;return(0,a.Z)(regene
//# sourceMappingURL=3674-legacy.c0844108.js.map