platypush/platypush/backend/http/webapp/dist/static/js/chunk-37779247.14062d6c.js

2 lines
49 KiB
JavaScript
Raw Normal View History

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-37779247"],{"0cb2":function(e,t,n){var r=n("7b0b"),a=Math.floor,i="".replace,s=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,c=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,o,l,u){var d=n+e.length,v=o.length,b=c;return void 0!==l&&(l=r(l),b=s),i.call(u,b,(function(r,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(d);case"<":s=l[i.slice(1,-1)];break;default:var c=+i;if(0===c)return r;if(c>v){var u=a(c/10);return 0===u?r:u<=v?void 0===o[u-1]?i.charAt(1):o[u-1]+i.charAt(1):r}s=o[c-1]}return void 0===s?"":s}))}},1804:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n("2909");function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}n("b64b"),n("b680"),n("d81d"),n("99af");var c=function(){function e(t){if(a(this,e),this.ranges={hue:[0,360],sat:[0,100],bri:[0,100],ct:[154,500]},t)for(var n=0,r=Object.keys(this.ranges);n<r.length;n++){var i=r[n];t[i]&&(this.ranges[i]=t[i])}}return s(e,[{key:"normalize",value:function(e,t,n){return n[0]+(e-t[0])*(n[1]-n[0])/(t[1]-t[0])}},{key:"hslToRgb",value:function(e,t,n){var r=[this.normalize(e,this.ranges.hue,[0,360]),this.normalize(t,this.ranges.sat,[0,100]),this.normalize(n,this.ranges.bri,[0,100])];e=r[0],t=r[1],n=r[2],n/=100;var a=t*Math.min(n,1-n)/100,i=function(t){var r=(t+e/30)%12,i=n-a*Math.max(Math.min(r-3,9-r,1),-1);return Math.round(255*i)};return[i(0),i(8),i(4)]}},{key:"rgbToHsl",value:function(e,t,n){e/=255,t/=255,n/=255;var r,a,i=Math.max(e,t,n),s=Math.min(e,t,n),c=(i+s)/2;if(i===s)r=a=0;else{var o=i-s;switch(a=c>.5?o/(2-i-s):o/(i+s),i){case e:r=(t-n)/o+(t<n?6:0);break;case t:r=(n-e)/o+2;break;case n:r=(e-t)/o+4;break}r/=6}return[parseInt(this.normalize(r,[0,1],this.ranges.hue)),parseInt(this.normalize(a,[0,1],this.ranges.sat)),parseInt(this.normalize(c,[0,1],this.ranges.bri))]}},{key:"xyToRgb",value:function(e,t,n){null==n&&(n=this.ranges.bri[1]);var r=1-e-t,a=(n/(this.ranges.bri[1]-1)).toFixed(2),i=a/t*e,s=a/t*r,c=1.656492*i-.354851*a-.255038*s,o=.707196*-i+1.655397*a+.036152*s,l=.051713*i-.121364*a+1.01153*s;return c>l&&c>o&&c>1?(o/=c,l/=c,c=1):o>l&&o>c&&o>1?(c/=o,l/=o,o=1):l>c&&l>o&&l>1&&(c/=l,o/=l,l=1),c=c<=.0031308?12.92*c:1.055*Math.pow(c,1/2.4)-.055,o=o<=.0031308?12.92*o:1.055*Math.pow(o,1/2.4)-.055,l=l<=.0031308?12.92*l:1.055*Math.pow(l,1/2.4)-.055,c=Math.round(255*c),o=Math.round(255*o),l=Math.round(255*l),isNaN(c)&&(c=0),isNaN(o)&&(o=0),isNaN(l)&&(l=0),[c,o,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 r=.664511*e+.154324*t+.162028*n,a=.283881*e+.668433*t+.047685*n,i=88e-6*e+.07231*t+.986039*n,s=parseFloat((r/(r+a+i)).toFixed(4)),c=parseFloat((a/(r+a+i)).toFixed(4));return isNaN(s)&&(s=0),isNaN(c)&&(c=0),[s,c]}},{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(r["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(r["a"])(n));if(e.hue&&e.sat&&e.bri){var a=th
//# sourceMappingURL=chunk-37779247.14062d6c.js.map