platypush/platypush/backend/http/webapp/dist/static/js/747.2d2a23ac.js

2 lines
30 KiB
JavaScript
Raw Normal View History

2022-11-12 16:31:35 +01:00
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[747],{4212:function(e,t,n){n.d(t,{N:function(){return s}});class s{constructor(e){if(this.ranges={hue:[0,360],sat:[0,100],bri:[0,100],ct:[154,500]},e)for(const t of Object.keys(this.ranges))e[t]&&(this.ranges[t]=e[t])}normalize(e,t,n){return n[0]+(e-t[0])*(n[1]-n[0])/(t[1]-t[0])}hslToRgb(e,t,n){[e,t,n]=[this.normalize(e,this.ranges.hue,[0,360]),this.normalize(t,this.ranges.sat,[0,100]),this.normalize(n,this.ranges.bri,[0,100])],n/=100;const s=t*Math.min(n,1-n)/100,o=t=>{const o=(t+e/30)%12,i=n-s*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i)};return[o(0),o(8),o(4)]}rgbToHsl(e,t,n){e/=255,t/=255,n/=255;const s=Math.max(e,t,n),o=Math.min(e,t,n);let i,l,a=(s+o)/2;if(s===o)i=l=0;else{const r=s-o;switch(l=a>.5?r/(2-s-o):r/(s+o),s){case e:i=(t-n)/r+(t<n?6:0);break;case t:i=(n-e)/r+2;break;case n:i=(e-t)/r+4;break}i/=6}return[parseInt(this.normalize(i,[0,1],this.ranges.hue)),parseInt(this.normalize(l,[0,1],this.ranges.sat)),parseInt(this.normalize(a,[0,1],this.ranges.bri))]}xyToRgb(e,t,n){null==n&&(n=this.ranges.bri[1]);const s=1-e-t,o=(n/(this.ranges.bri[1]-1)).toFixed(2),i=o/t*e,l=o/t*s;let a=1.656492*i-.354851*o-.255038*l,r=.707196*-i+1.655397*o+.036152*l,c=.051713*i-.121364*o+1.01153*l;return a>c&&a>r&&a>1?(r/=a,c/=a,a=1):r>c&&r>a&&r>1?(a/=r,c/=r,r=1):c>a&&c>r&&c>1&&(a/=c,r/=c,c=1),a=a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055,r=r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055,c=c<=.0031308?12.92*c:1.055*Math.pow(c,1/2.4)-.055,a=Math.round(255*a),r=Math.round(255*r),c=Math.round(255*c),isNaN(a)&&(a=0),isNaN(r)&&(r=0),isNaN(c)&&(c=0),[a,r,c].map((e=>Math.min(Math.max(0,e),255)))}rgbToXY(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;const s=.664511*e+.154324*t+.162028*n,o=.283881*e+.668433*t+.047685*n,i=88e-6*e+.07231*t+.986039*n;let l=parseFloat((s/(s+o+i)).toFixed(4)),a=parseFloat((o/(s+o+i)).toFixed(4));return isNaN(l)&&(l=0),isNaN(a)&&(a=0),[l,a]}rgbToBri(e,t,n){return Math.min(2*this.rgbToHsl(e,t,n)[2],this.ranges.bri[1])}getRGB(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}getXY(e){return null!=e.x&&null!=e.y?[e.x,e.y]:e.xy?e.xy:void 0}toRGB(e){const t=this.getRGB(e);if(t)return t;const n=this.getXY(e);return n&&e.bri?this.xyToRgb(...n,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))}toXY(e){const t=this.getXY(e);if(t&&e.bri)return[t[0],t[1],e.bri];const n=this.getRGB(e);if(n)return this.rgbToXY(...n);if(e.hue&&e.sat&&e.bri){const t=this.hslToRgb(e.hue,e.sat,e.bri);return this.rgbToXY(...t)}console.debug("Could not determine color space"),console.debug(e)}toHSL(e){if(e.hue&&e.sat&&e.bri)return[e.hue,e.sat,e.bri];const t=this.getRGB(e);if(t)return this.rgbToHsl(...t);const n=this.getXY(e);if(n&&e.bri){const t=this.xyToRgb(...n,e.bri);return this.rgbToHsl(...t)}console.debug("Could not determine color space"),console.debug(e)}hexToRgb(e){return[e.slice(1,3),e.slice(3,5),e.slice(5,7)].map((e=>parseInt(e,16)))}rgbToHex(e){return"#"+e.map((e=>{let t=e.toString(16);return t.length<2&&(t="0"+t),t})).join("")}}},6237:function(e,t,n){n.d(t,{Z:function(){return m}});var s=n(6252),o=n(3577),i=n(9963);const l={class:"slider-wrapper"},a=["min","max","step","disabled","value"],r={class:"track-inner",ref:"track"},c={class:"thumb",ref:"thumb"},u=["textContent"];function g(e,t,n,g,d,p){return(0,s.wg)(),(0,s.iD)("label",l,[(0,s._)("input",{class:(0,o.C_)(["slider",{"with-label":n.withLabel}]),type:"range",min:n.range[0],max:n.range[1],step:n.step,disabled:n.disabled,value:n.value,ref:"range",onInput:t[0]||(t[0]=(0,i.iM)(((...e)=>p.onUpdate&&p.onUpdate(...e)),["stop"])),onChange:t[1]||(t[1]=(0,i.iM)(((...e)=>p.onUpdate&&p.onUpdate(...e)),["stop"]))},null,42,a),(0,s._)("div",{class:(0,o.C_)(["track",{"with-label":n.withL
//# sourceMappingURL=747.2d2a23ac.js.map