platypush/platypush/backend/http/webapp/dist/static/js/1155.1d3f7c87.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2022-10-07 02:23:12 +02:00
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[1155,3499],{4212:function(e,t,a){a.d(t,{N:function(){return n}});class n{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,a){return a[0]+(e-t[0])*(a[1]-a[0])/(t[1]-t[0])}hslToRgb(e,t,a){[e,t,a]=[this.normalize(e,this.ranges.hue,[0,360]),this.normalize(t,this.ranges.sat,[0,100]),this.normalize(a,this.ranges.bri,[0,100])],a/=100;const n=t*Math.min(a,1-a)/100,s=t=>{const s=(t+e/30)%12,o=a-n*Math.max(Math.min(s-3,9-s,1),-1);return Math.round(255*o)};return[s(0),s(8),s(4)]}rgbToHsl(e,t,a){e/=255,t/=255,a/=255;const n=Math.max(e,t,a),s=Math.min(e,t,a);let o,i,l=(n+s)/2;if(n===s)o=i=0;else{const r=n-s;switch(i=l>.5?r/(2-n-s):r/(n+s),n){case e:o=(t-a)/r+(t<a?6:0);break;case t:o=(a-e)/r+2;break;case a:o=(e-t)/r+4;break}o/=6}return[parseInt(this.normalize(o,[0,1],this.ranges.hue)),parseInt(this.normalize(i,[0,1],this.ranges.sat)),parseInt(this.normalize(l,[0,1],this.ranges.bri))]}xyToRgb(e,t,a){null==a&&(a=this.ranges.bri[1]);const n=1-e-t,s=(a/(this.ranges.bri[1]-1)).toFixed(2),o=s/t*e,i=s/t*n;let l=1.656492*o-.354851*s-.255038*i,r=.707196*-o+1.655397*s+.036152*i,u=.051713*o-.121364*s+1.01153*i;return l>u&&l>r&&l>1?(r/=l,u/=l,l=1):r>u&&r>l&&r>1?(l/=r,u/=r,r=1):u>l&&u>r&&u>1&&(l/=u,r/=u,u=1),l=l<=.0031308?12.92*l:1.055*Math.pow(l,1/2.4)-.055,r=r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055,u=u<=.0031308?12.92*u:1.055*Math.pow(u,1/2.4)-.055,l=Math.round(255*l),r=Math.round(255*r),u=Math.round(255*u),isNaN(l)&&(l=0),isNaN(r)&&(r=0),isNaN(u)&&(u=0),[l,r,u].map((e=>Math.min(Math.max(0,e),255)))}rgbToXY(e,t,a){e>1&&(e/=255),t>1&&(t/=255),a>1&&(a/=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,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92;const n=.664511*e+.154324*t+.162028*a,s=.283881*e+.668433*t+.047685*a,o=88e-6*e+.07231*t+.986039*a;let i=parseFloat((n/(n+s+o)).toFixed(4)),l=parseFloat((s/(n+s+o)).toFixed(4));return isNaN(i)&&(i=0),isNaN(l)&&(l=0),[i,l]}rgbToBri(e,t,a){return Math.min(2*this.rgbToHsl(e,t,a)[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 a=this.getXY(e);return a&&e.bri?this.xyToRgb(...a,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 a=this.getRGB(e);if(a)return this.rgbToXY(...a);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 a=this.getXY(e);if(a&&e.bri){const t=this.xyToRgb(...a,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("")}}},376:function(e,t,a){a.d(t,{Z:function(){return b}});var n=a(6252),s=a(9963),o=a(3577);const i={class:"slider-wrapper"},l=["min","max","step","disabled","value"],r={class:"track"},u={class:"track-inner",ref:"track"},c={class:"thumb",ref:"thumb"},h=["textContent"];function d(e,t,a,d,p,g){return(0,n.wg)(),(0,n.iD)("label",i,[(0,n._)("input",{class:"slider",type:"range",ref:"range",min:a.range[0],max:a.range[1],step:a.step,disabled:a.disabled,value:a.value,onInput:t[0]||(t[0]=(0,s.iM)(((...e)=>g.onUpdate&&g.onUpdate(...e)),["stop"])),onChange:t[1]||(t[1]=(0,s.iM)(((...e)=>g.onUpdate&&g.onUpdate(...e)),["stop"])),onMouseup:t[2]||(t[2]=(0,s.iM)(((...e)=>g.onUpdate&&g.onUpdate(...e)),["stop"])),onMouse
//# sourceMappingURL=1155.1d3f7c87.js.map