(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-cc8a6536"],{"084e":function(e,t,n){"use strict";n("1015")},1015:function(e,t,n){},1804:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));n("99af"),n("d81d"),n("b680"),n("b64b");var i=n("2909");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-c):s/(r+c),r){case e:i=(t-n)/s+(tl&&a>s&&a>1?(s/=a,l/=a,a=1):s>l&&s>a&&s>1?(a/=s,l/=s,s=1):l>a&&l>s&&l>1&&(a/=l,s/=l,l=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,l=l<=.0031308?12.92*l:1.055*Math.pow(l,1/2.4)-.055,a=Math.round(255*a),s=Math.round(255*s),l=Math.round(255*l),isNaN(a)&&(a=0),isNaN(s)&&(s=0),isNaN(l)&&(l=0),[a,s,l].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,c=parseFloat((i/(i+o+r)).toFixed(4)),a=parseFloat((o/(i+o+r)).toFixed(4));return isNaN(c)&&(c=0),isNaN(a)&&(a=0),[c,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,Object(i["a"])(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,Object(i["a"])(n));if(e.hue&&e.sat&&e.bri){var o=this.hslToRgb(e.hue,e.sat,e.bri);return this.rgbToXY.apply(this,Object(i["a"])(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,Object(i["a"])(t));var n=this.getXY(e);if(n&&e.bri){var o=this.xyToRgb.apply(this,Object(i["a"])(n).concat([e.bri]));return this.rgbToHsl.apply(this,Object(i["a"])(o))}console.debug("Could not determine color space"),console.debug(e)}}]),e}()},"1e15":function(e,t,n){"use strict";n("428e")},4022:function(e,t,n){"use strict";n("a132")},"406a":function(e,t,n){"use strict";n("965d")},"428e":function(e,t,n){},"538b":function(e,t,n){},"5a65":function(e,t,n){},6055:function(e,t,n){},"73e5":function(e,t,n){"use strict";n("538b")},"74ae":function(e,t,n){},"7e57":function(e,t,n){"use strict";n("e3f0")},"876b":function(e,t,n){"use strict";n("5a65")},"8dcb":function(e,t,n){"use strict";n("d28c")},"93d8":function(e,t,n){"use strict";n("6055")},"965d":function(e,t,n){},a132:function(e,t,n){},b322:function(e,t,n){"use strict";n("74ae")},bf6b:function(e,t,n){"use strict";n("fda1")},cf99:function(e,t,n){"use strict";n.r(t);n("b64b");var i=n("7a23"),o=Object(i["K"])("data-v-781dd72c");Object(i["u"])("data-v-781dd72c");var r={class:"plugin lights-plugin"},c={key:0,class:"panel"},a={key:1,class:"panel"};Object(i["s"])();var s=o((function(e,t,n,o,s,l){var u=Object(i["z"])("Groups"),b=Object(i["z"])("Group");return Object(i["r"])(),Object(i["e"])("div",r,[null==s.selectedGroup&&n.groups&&Object.keys(n.groups).length?(Object(i["r"])(),Object(i["e"])("div",c,[Object(i["h"])(u,{groups:n.groups,"loading-groups":n.loadingGroups,"color-converter":n.colorConverter,onSelect:t[1]||(t[1]=function(e){return s.selectedGroup=e}),onToggle:t[2]||(t[2]=function(t){return e.$emit("group-toggle",t)})},null,8,["groups","loading-groups","color-converter"])])):(Object(i["r"])(),Object(i["e"])("div",a,[Object(i["h"])(b,{group:n.groups[s.selectedGroup],lights:l.displayedLights,scenes:l.scenesByGroup[s.selectedGroup],"color-converter":n.colorConverter,animations:l.animationsByGroup[s.selectedGroup],onClose:t[3]||(t[3]=function(e){return s.selectedGroup=null}),onLightToggle:t[4]||(t[4]=function(t){return e.$emit("light-toggle",t)}),onGroupToggle:t[5]||(t[5]=function(t){return e.$emit("group-toggle",t)}),onSetLight:t[6]||(t[6]=function(t){return e.$emit("set-light",t)}),onSetGroup:t[7]||(t[7]=function(t){return e.$emit("set-group",{groupId:s.selectedGroup,value:t})}),onSelectScene:t[8]||(t[8]=function(t){return e.$emit("select-scene",{groupId:s.selectedGroup,sceneId:t})}),onStartAnimation:t[9]||(t[9]=function(t){return e.$emit("start-animation",t)}),onStopAnimation:t[10]||(t[10]=function(t){return e.$emit("stop-animation",t)})},null,8,["group","lights","scenes","color-converter","animations"])]))])})),l=(n("4160"),n("13d5"),n("a9e3"),n("4fad"),n("07ac"),n("159b"),n("5530")),u=n("3835"),b=n("3e54"),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)}},d=g,h=(n("b0c0"),Object(i["K"])("data-v-42318a2b"));Object(i["u"])("data-v-42318a2b");var p={class:"panel-row header"},O=Object(i["h"])("div",{class:"col-3"},[Object(i["h"])("i",{class:"icon fas fa-home"})],-1),j=Object(i["h"])("div",{class:"col-6 name"}," Rooms ",-1),v={class:"col-3 pull-right"},f={class:"name col-9"},m={class:"controls col-3 pull-right"};Object(i["s"])();var y=h((function(e,t,n,o,r,c){var a=Object(i["z"])("ToggleSwitch"),s=Object(i["z"])("MenuPanel");return Object(i["r"])(),Object(i["e"])(s,null,{default:h((function(){return[Object(i["h"])("div",p,[O,j,Object(i["h"])("div",v,[Object(i["h"])(a,{value:c.anyLightsOn,onInput:t[1]||(t[1]=function(t){return e.$emit("toggle")})},null,8,["value"])])]),(Object(i["r"])(!0),Object(i["e"])(i["a"],null,Object(i["x"])(c.groupsSorted,(function(t){return Object(i["r"])(),Object(i["e"])("div",{class:"panel-row row group",key:t.id,onClick:function(n){return e.$emit("select",t.id)}},[Object(i["h"])("span",f,Object(i["C"])(t.name||"[Group ".concat(t.id,"]")),1),Object(i["h"])("span",m,[Object(i["h"])(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,["onClick"])})),128))]})),_:1})})),C=(n("d81d"),{class:"menu-panel"}),w={class:"content"};function k(e,t,n,o,r,c){return Object(i["r"])(),Object(i["e"])("div",C,[Object(i["h"])("div",w,[Object(i["y"])(e.$slots,"default")])])}var _={name:"MenuPanel"};n("4022");_.render=k;var S=_,L=n("0279"),G=n("1804"),$={name:"Groups",components:{ToggleSwitch:L["a"],MenuPanel:S},emits:["select","toggle"],props:{groups:{type:Object,default:function(){}},loadingGroups:{type:Object,default:function(){}},colorConverter:{type:Object,default:function(){return new G["a"]}}},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=Object(u["a"])(e,2),n=t[0],i=t[1];return Object(l["a"])(Object(l["a"])({},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