"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[1340],{634:function(e,t,n){n.d(t,{N:function(){return a}});var i=n(9584);n(1703);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n.5?s/(2-r-l):s/(r+l),r){case e:i=(t-n)/s+(tu&&a>s&&a>1?(s/=a,u/=a,a=1):s>u&&s>a&&s>1?(a/=s,u/=s,s=1):u>a&&u>s&&u>1&&(a/=u,s/=u,u=1),a=a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055,s=s<=.0031308?12.92*s:1.055*Math.pow(s,1/2.4)-.055,u=u<=.0031308?12.92*u:1.055*Math.pow(u,1/2.4)-.055,a=Math.round(255*a),s=Math.round(255*s),u=Math.round(255*u),isNaN(a)&&(a=0),isNaN(s)&&(s=0),isNaN(u)&&(u=0),[a,s,u].map((function(e){return Math.min(Math.max(0,e),255)}))}},{key:"rgbToXY",value:function(e,t,n){e>1&&(e/=255),t>1&&(t/=255),n>1&&(n/=255),e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=.664511*e+.154324*t+.162028*n,o=.283881*e+.668433*t+.047685*n,r=88e-6*e+.07231*t+.986039*n,l=parseFloat((i/(i+o+r)).toFixed(4)),a=parseFloat((o/(i+o+r)).toFixed(4));return isNaN(l)&&(l=0),isNaN(a)&&(a=0),[l,a]}},{key:"rgbToBri",value:function(e,t,n){return Math.min(2*this.rgbToHsl(e,t,n)[2],this.ranges.bri[1])}},{key:"getRGB",value:function(e){return null!=e.red&&null!=e.green&&null!=e.blue?[e.red,e.green,e.blue]:null!=e.r&&null!=e.g&&null!=e.b?[e.r,e.g,e.b]:e.rgb?e.rgb:void 0}},{key:"getXY",value:function(e){return null!=e.x&&null!=e.y?[e.x,e.y]:e.xy?e.xy:void 0}},{key:"toRGB",value:function(e){var t=this.getRGB(e);if(t)return t;var n=this.getXY(e);return n&&e.bri?this.xyToRgb.apply(this,(0,i.Z)(n).concat([e.bri])):e.hue&&e.sat&&e.bri?this.hslToRgb(e.hue,e.sat,e.bri):(console.debug("Could not determine color space"),void console.debug(e))}},{key:"toXY",value:function(e){var t=this.getXY(e);if(t&&e.bri)return[t[0],t[1],e.bri];var n=this.getRGB(e);if(n)return this.rgbToXY.apply(this,(0,i.Z)(n));if(e.hue&&e.sat&&e.bri){var o=this.hslToRgb(e.hue,e.sat,e.bri);return this.rgbToXY.apply(this,(0,i.Z)(o))}console.debug("Could not determine color space"),console.debug(e)}},{key:"toHSL",value:function(e){if(e.hue&&e.sat&&e.bri)return[e.hue,e.sat,e.bri];var t=this.getRGB(e);if(t)return this.rgbToHsl.apply(this,(0,i.Z)(t));var n=this.getXY(e);if(n&&e.bri){var o=this.xyToRgb.apply(this,(0,i.Z)(n).concat([e.bri]));return this.rgbToHsl.apply(this,(0,i.Z)(o))}console.debug("Could not determine color space"),console.debug(e)}}]),e}()},542:function(e,t,n){n.d(t,{Z:function(){return g}});var i=n(6252),o=n(3577),r=["min","max","value","disabled"],l=["textContent"];function a(e,t,n,a,s,u){return(0,i.wg)(),(0,i.iD)("label",null,[(0,i._)("input",{class:"slider",type:"range",min:n.range[0],max:n.range[1],value:n.value,disabled:n.disabled,onChange:t[0]||(t[0]=function(t){return e.$emit("input",t)}),onMouseup:t[1]||(t[1]=function(t){return e.$emit("mouseup",t)}),onInput:t[2]||(t[2]=function(t){return e.$emit("input",t)}),onMousedown:t[3]||(t[3]=function(t){return e.$emit("mousedown",t)}),onTouch:t[4]||(t[4]=function(t){return e.$emit("input",t)}),onTouchstart:t[5]||(t[5]=function(t){return e.$emit("mousedown",t)}),onTouchend:t[6]||(t[6]=function(t){return e.$emit("mouseup",t)})},null,40,r),n.withLabel?((0,i.wg)(),(0,i.iD)("span",{key:0,class:"label",textContent:(0,o.zw)(n.value)},null,8,l)):(0,i.kq)("",!0)])}n(9653);var s={name:"Slider",emits:["input","mouseup","mousedown"],props:{value:{type:Number},disabled:{type:Boolean,default:!1},range:{type:Array,default:function(){return[0,100]}},withLabel:{type:Boolean,default:!1}}},u=n(3744);const c=(0,u.Z)(s,[["render",a],["__scopeId","data-v-1a18952e"]]);var g=c},3567:function(e,t,n){n.d(t,{Z:function(){return p}});var i=n(6252),o=n(3577),r=function(e){return(0,i.dD)("data-v-8fae7678"),e=e(),(0,i.Cn)(),e},l=["checked"],a=r((function(){return(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1)})),s={class:"label"};function u(e,t,n,r,u,c){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=function(){return c.onInput&&c.onInput.apply(c,arguments)})},[(0,i._)("input",{type:"checkbox",checked:n.value},null,8,l),(0,i._)("label",null,[a,(0,i._)("span",s,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var c={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput:function(e){if(e.stopPropagation(),this.disabled)return!1;this.$emit("input",e)}}},g=n(3744);const d=(0,g.Z)(c,[["render",u],["__scopeId","data-v-8fae7678"]]);var p=d},5100:function(e,t,n){n.r(t),n.d(t,{default:function(){return Rt}});n(7941);var i=n(6252),o={class:"plugin lights-plugin"},r={key:0,class:"panel"},l={key:1,class:"panel"};function a(e,t,n,a,s,u){var c=(0,i.up)("Groups"),g=(0,i.up)("Group");return(0,i.wg)(),(0,i.iD)("div",o,[null==s.selectedGroup&&n.groups&&Object.keys(n.groups).length?((0,i.wg)(),(0,i.iD)("div",r,[(0,i.Wm)(c,{groups:n.groups,"loading-groups":n.loadingGroups,"color-converter":n.colorConverter,onSelect:t[0]||(t[0]=function(e){return s.selectedGroup=e}),onToggle:t[1]||(t[1]=function(t){return e.$emit("group-toggle",t)})},null,8,["groups","loading-groups","color-converter"])])):((0,i.wg)(),(0,i.iD)("div",l,[(0,i.Wm)(g,{group:n.groups[s.selectedGroup],lights:u.displayedLights,scenes:u.scenesByGroup[s.selectedGroup],"color-converter":n.colorConverter,animations:u.animationsByGroup[s.selectedGroup],onClose:t[2]||(t[2]=function(e){return s.selectedGroup=null}),onLightToggle:t[3]||(t[3]=function(t){return e.$emit("light-toggle",t)}),onGroupToggle:t[4]||(t[4]=function(t){return e.$emit("group-toggle",t)}),onSetLight:t[5]||(t[5]=function(t){return e.$emit("set-light",t)}),onSetGroup:t[6]||(t[6]=function(t){return e.$emit("set-group",{groupId:s.selectedGroup,value:t})}),onSelectScene:t[7]||(t[7]=function(t){return e.$emit("select-scene",{groupId:s.selectedGroup,sceneId:t})}),onStartAnimation:t[8]||(t[8]=function(t){return e.$emit("start-animation",t)}),onStopAnimation:t[9]||(t[9]=function(t){return e.$emit("stop-animation",t)})},null,8,["group","lights","scenes","color-converter","animations"])]))])}var s=n(4648),u=n(6084),c=(n(9653),n(1539),n(9720),n(4747),n(2479),n(2628)),g={name:"Panel",emits:["mounted"],props:{config:{type:Object,default:function(){}},pluginName:{type:String,required:!0}},data:function(){return{loading:!1}},mounted:function(){this.$emit("mounted",this)}};const d=g;var p=d,h=(n(8309),n(3577)),v=function(e){return(0,i.dD)("data-v-42318a2b"),e=e(),(0,i.Cn)(),e},f={class:"panel-row header"},m=v((function(){return(0,i._)("div",{class:"col-3"},[(0,i._)("i",{class:"icon fas fa-home"})],-1)})),b=v((function(){return(0,i._)("div",{class:"col-6 name"}," Rooms ",-1)})),y={class:"col-3 pull-right"},_=["onClick"],w={class:"name col-9"},k={class:"controls col-3 pull-right"};function C(e,t,n,o,r,l){var a=(0,i.up)("ToggleSwitch"),s=(0,i.up)("MenuPanel");return(0,i.wg)(),(0,i.j4)(s,null,{default:(0,i.w5)((function(){return[(0,i._)("div",f,[m,b,(0,i._)("div",y,[(0,i.Wm)(a,{value:l.anyLightsOn,onInput:t[0]||(t[0]=function(t){return e.$emit("toggle")})},null,8,["value"])])]),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(l.groupsSorted,(function(t){return(0,i.wg)(),(0,i.iD)("div",{class:"panel-row row group",key:t.id,onClick:function(n){return e.$emit("select",t.id)}},[(0,i._)("span",w,(0,h.zw)(t.name||"[Group ".concat(t.id,"]")),1),(0,i._)("span",k,[(0,i.Wm)(a,{value:t.state.any_on,disabled:t.id in(n.loadingGroups||{}),onInput:function(n){return e.$emit("toggle",t)}},null,8,["value","disabled","onInput"])])],8,_)})),128))]})),_:1})}n(1249),n(2707);var S={class:"menu-panel"},j={class:"content"};function O(e,t,n,o,r,l){return(0,i.wg)(),(0,i.iD)("div",S,[(0,i._)("div",j,[(0,i.WI)(e.$slots,"default")])])}var Z={name:"MenuPanel"},L=n(3744);const $=(0,L.Z)(Z,[["render",O]]);var D=$,G=n(3567),I=n(634),T={name:"Groups",components:{ToggleSwitch:G.Z,MenuPanel:D},emits:["select","toggle"],props:{groups:{type:Object,default:function(){}},loadingGroups:{type:Object,default:function(){}},colorConverter:{type:Object,default:function(){return new I.N}}},computed:{groupsSorted:function(){return Object.entries(this.groups).sort((function(e,t){return e[1].name.localeCompare(t[1].name)})).map((function(e){var t=(0,u.Z)(e,2),n=t[0],i=t[1];return(0,s.Z)((0,s.Z)({},i),{},{id:n})}))},anyLightsOn:function(){for(var e=0,t=Object.values(this.groups);e0}},methods:{toggleSelectAll:function(){var e=this,t=Object.values(this.selectedLights).filter((function(e){return e})).length