2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
|
"use strict";(("undefined"!=typeof self?self:global).webpackChunkopen=("undefined"!=typeof self?self:global).webpackChunkopen||[]).push([[1005],{1005:(t,n,r)=>{r.d(n,{extractColors:()=>f});var s=r(84120);const o="https://local-image.spotify.com";let i=function(t){return t[t.ARRAY_BUFFER=0]="ARRAY_BUFFER",t[t.IMAGE_BITMAP=1]="IMAGE_BITMAP",t}({});var e=r(84624),a=r.n(e);var h=r(40332);const u=new function(){return a()('(()=>{"use strict";let t=function(t){return t[t.HEX=0]="HEX",t[t.HEXA=1]="HEXA",t[t.RGB=2]="RGB",t[t.RGBA=3]="RGBA",t[t.HSL=4]="HSL",t[t.HSLA=5]="HSLA",t}({});function n(t,n,r=1e-6){return Math.abs(t-n)<r}function r(t){return t.toString(16).padStart(2,"0")}function s(t){return`${parseFloat((100*t).toFixed(1))}%`}function o(t){t=t.replace(/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i,(function(t,n,r,s){return n+n+r+r+s+s}));const n=/^#?(?<r>[a-f\\d]{2})(?<g>[a-f\\d]{2})(?<b>[a-f\\d]{2})(?<a>[a-f\\d]{2})?$/i.exec(t),r=n?.groups?.r,s=n?.groups?.g,o=n?.groups?.b,i=n?.groups?.a;if(void 0===r||void 0===s||void 0===o)throw new Error(`Invalid hex color code "${t}"`);return{r,g:s,b:o,a:i}}function i(t){const{a:n}=o(t);if(!n)return 1;return function(t,n,r){const s=t.toLocaleString("en",{useGrouping:!1,minimumFractionDigits:n,maximumFractionDigits:r});return Number(s)}(parseInt(n,16)/255,0,2)}const e=.07,a=.02;function h(t){return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function u({rgb:{r:t,g:n,b:r}}){return.2126*h(t/255)+.7152*h(n/255)+.0722*h(r/255)}function c(t,n){const r=u(t),s=u(n);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}class l{constructor(t,n,r,s=1){this.rgb=t,this.hsl=n,this.hsv=r,this.a=s}static BLACK=l.fromRGB({r:0,g:0,b:0});static WHITE=l.fromRGB({r:255,g:255,b:255});static fromRGB(t,r){if(t.r<0||t.g<0||t.b<0||t.r>255||t.g>255||t.b>255||r&&r<0||r&&r>1)throw Error(`Invalid RGB color: ${JSON.stringify(t)}, alpha: ${r}`);const s=function({r:t,g:r,b:s}){const o=t/255,i=r/255,e=s/255,a=Math.max(o,i,e),h=Math.min(o,i,e),u=a-h;let c;const l=(a+h)/2,f=a;c=n(u,0)?0:n(f,o)?60*(0+(i-e)/u):n(f,i)?60*(2+(e-o)/u):60*(4+(o-i)/u),c%=360,c<0&&(c+=360);const g=0===l||1===l?0:(f-l)/Math.min(l,1-l);return{h:Math.round(c),s:g,l}}(t),o=function({r:t,g:r,b:s}){const o=t/255,i=r/255,e=s/255,a=Math.max(o,i,e),h=a-Math.min(o,i,e);let u;const c=a;u=n(h,0)?0:n(c,o)?60*(0+(i-e)/h):n(c,i)?60*(2+(e-o)/h):60*(4+(o-i)/h),u%=360,u<0&&(u+=360);const l=0===c?0:h/c;return{h:Math.round(u),s:l,v:c}}(t);return new l(t,s,o,r)}static fromHex(t,n){const r=function(t){const{r:n,g:r,b:s}=o(t);return{r:parseInt(n,16),g:parseInt(r,16),b:parseInt(s,16)}}(t),s=i(t);return l.fromRGB(r,n??s)}static fromHSV(t,n){const r=function({h:t,s:n,v:r}){const s=r*n,o=t/60,i=s*(1-Math.abs(o%2-1));let e;e=o>=0&&o<=1?[s,i,0]:o>1&&o<=2?[i,s,0]:o>2&&o<=3?[0,s,i]:o>3&&o<=4?[0,i,s]:o>4&&o<=5?[i,0,s]:o>5&&o<=6?[s,0,i]:[0,0,0];const a=r-s;return{r:Math.round(255*(e[0]+a)),g:Math.round(255*(e[1]+a)),b:Math.round(255*(e[2]+a))}}(t);return l.fromRGB(r,n)}static fromHSL(t,n){const r=function({h:t,s:n,l:r}){const s=(1-Math.abs(2*r-1))*n,o=t/60,i=s*(1-Math.abs(o%2-1));let e;e=o>=0&&o<=1?[s,i,0]:o>1&&o<=2?[i,s,0]:o>2&&o<=3?[0,s,i]:o>3&&o<=4?[0,i,s]:o>4&&o<=5?[i,0,s]:o>5&&o<=6?[s,0,i]:[0,0,0];const a=r-s/2;return{r:Math.round(255*(e[0]+a)),g:Math.round(255*(e[1]+a)),b:Math.round(255*(e[2]+a))}}(t);return l.fromRGB(r,n)}static fromCSS(t,n){const r=function(t,n){const r=t.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/);if(r){const[t,s,o,i]=r.slice(1),e=n??parseFloat(i);return l.fromRGB({r:parseInt(t,10),g:parseInt(s,10),b:parseInt(o,10)},Number.isNaN(e)?void 0:e)}return null}(t,n);if(r)return r;const s=function(t,n){const r=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);if(r){const t=r[1];return l.fromHex(t,n)}return null}(t,n);if(s)return s;const o=function(t,n){const r=t.match(/^hsla?\\((\\d+),\\s*(\\d+)%,\\s*(\\d+)%(?:,\\s*(\\d*(?:\\.\\d+)?))?\\)$/);if(r){const[t,s,o,i]=r.slice(1),e=n??parseFloat(i);return l.fromHSL({h:parseInt(t,10),s:parseInt(s,10)/100,l:parseInt(o,10)/100},Number.isNaN(e)?void 0:e)}return null}(t,n);if(o)return o;throw ne
|
||
|
//# sourceMappingURL=1005.js.map
|