forked from gka/chroma.js
-
Notifications
You must be signed in to change notification settings - Fork 2
/
chroma.min.js
86 lines (85 loc) · 53.8 KB
/
chroma.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2023, Regorxxx
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Regorxxx may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -------------------------------------------------------
* Copyright (c) 2011-2019, Gregor Aisch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -------------------------------------------------------
*
* chroma.js includes colors from colorbrewer2.org, which are released under
* the following license:
*
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
* and The Pennsylvania State University.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* ------------------------------------------------------
*
* Named colors are taken from X11 Color Names.
* http://www.w3.org/TR/css3-color/#svg-color
*
* @preserve
*/
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r="undefined"!=typeof globalThis?globalThis:r||self).chroma=n()}(this,(function(){"use strict";for(var r=function(r,n,e){return void 0===n&&(n=0),void 0===e&&(e=1),r<n?n:r>e?e:r},n=r,e={},t=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];t<a.length;t+=1){var f=a[t];e["[object "+f+"]"]=f.toLowerCase()}var o=function(r){return e[Object.prototype.toString.call(r)]||"object"},u=o,c=o,i=Math.PI,l={clip_rgb:function(r){r._clipped=!1,r._unclipped=r.slice(0);for(var e=0;e<=3;e++)e<3?((r[e]<0||r[e]>255)&&(r._clipped=!0),r[e]=n(r[e],0,255)):3===e&&(r[e]=n(r[e],0,1));return r},limit:r,type:o,unpack:function(r,n){return void 0===n&&(n=null),r.length>=3?Array.prototype.slice.call(r):"object"==u(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0]},last:function(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null},PI:i,TWOPI:2*i,PITHIRD:i/3,DEG2RAD:i/180,RAD2DEG:180/i},h={format:{},autodetect:[]},s=l.last,d=l.clip_rgb,b=l.type,p=h,g=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===b(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];"array"===b(r[0])&&1===r.length&&(r=[].concat(r[0]));var t=s(r),a=!1;if(!t){a=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,n){return n.p-r.p})),p.sorted=!0);for(var f=0,o=p.autodetect;f<o.length;f+=1){var u=o[f];if(t=u.test.apply(u,r))break}}if(!p.format[t])throw new Error("unknown format: "+r);var c=p.format[t].apply(null,a?r:r.slice(0,-1));e._rgb=d(c),3===e._rgb.length&&e._rgb.push(1)};g.prototype.toString=function(){return"function"==b(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var v=g,m=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(m.Color,[null].concat(r)))};m.Color=v,m.version="2.7.0",m.hueNaN=!0;var y=m,k=l.unpack,w=Math.max,N=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=k(r,"rgb"),t=e[0],a=e[1],f=e[2],o=1-w(t/=255,w(a/=255,f/=255)),u=o<1?1/(1-o):0;return[(1-t-o)*u,(1-a-o)*u,(1-f-o)*u,o]},M=l.unpack,_=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=M(r,"cmyk"))[0],t=r[1],a=r[2],f=r[3],o=r.length>4?r[4]:1;return 1===f?[0,0,0,o]:[e>=1?0:255*(1-e)*(1-f),t>=1?0:255*(1-t)*(1-f),a>=1?0:255*(1-a)*(1-f),o]},A=y,P=v,x=h,E=l.unpack,O=l.type,G=N;P.prototype.cmyk=function(){return G(this._rgb)},A.cmyk=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(P,[null].concat(r,["cmyk"])))},x.format.cmyk=_,x.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=E(r,"cmyk"),"array"===O(r)&&4===r.length)return"cmyk"}});var R=l.unpack,j=l.last,B=function(r){return Math.round(100*r)/100},F=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=R(r,"hsla"),t=j(r)||"lsa";return e[0]=B(e[0]||0),e[1]=B(100*e[1])+"%",e[2]=B(100*e[2])+"%","hsla"===t||e.length>3&&e[3]<1?(e[3]=e.length>3?e[3]:1,t="hsla"):e.length=3,t+"("+e.join(",")+")"},q=l.unpack,L=y,Y=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=q(r,"rgba"))[0],t=r[1],a=r[2];e/=255,t/=255,a/=255;var f,o,u=Math.min(e,t,a),c=Math.max(e,t,a),i=(c+u)/2;return c===u?(f=0,o=L.hueNaN?Number.NaN:0):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),e==c?o=(t-a)/(c-u):t==c?o=2+(a-e)/(c-u):a==c&&(o=4+(e-t)/(c-u)),(o*=60)<0?o+=360:!L.hueNaN&&isNaN(o)&&(o=0),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},D=l.unpack,S=l.last,C=function(r){return Math.round(100*r)/100},I=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=D(r,"lch"),t=S(r)||"lch";return e[0]=C(e[0])+"%",e[1]=C(e[1])+"%",e[2]=C(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"},$={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},z=$,T=l.unpack,W=Math.pow,X=function(r){return(r/=255)<=.04045?r/12.92:W((r+.055)/1.055,2.4)},V=function(r){return r>z.t3?W(r,1/3):r/z.t2+z.t0},U=function(r,n,e){return r=X(r),n=X(n),e=X(e),[V((.4124564*r+.3575761*n+.1804375*e)/z.Xn),V((.2126729*r+.7151522*n+.072175*e)/z.Yn),V((.0193339*r+.119192*n+.9503041*e)/z.Zn)]},Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=T(r,"rgb"),t=e[0],a=e[1],f=e[2],o=U(t,a,f),u=o[0],c=o[1],i=116*c-16;return[i<0?0:i,500*(u-c),200*(c-o[2])]},H=l.unpack,K=l.RAD2DEG,Q=Math.sqrt,J=Math.atan2,rr=Math.round,nr=y,er=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=H(r,"lab"),t=e[0],a=e[1],f=e[2],o=Q(a*a+f*f),u=(J(f,a)*K+360)%360;return 0===rr(1e4*o)&&(u=nr.hueNaN?Number.NaN:0),[t,o,u]},tr=l.unpack,ar=Z,fr=er,or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=tr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=ar(t,a,f),u=o[0],c=o[1],i=o[2];return fr(u,c,i)},ur=l.unpack,cr=l.last,ir=function(r){return Math.round(100*r)/100},lr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ur(r,"lab"),t=cr(r)||"lab";return e[0]=ir(e[0])+"%",e[1]=ir(e[1])+"%",e[2]=ir(e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"},hr=l.unpack,sr=l.last,dr=function(r){return Math.round(100*r)/100},br=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=hr(r,"lab"),t=sr(r)||"lab";return e[0]=dr(100*e[0])+"%",e[1]=dr(100*e[1])+"%",e[2]=dr(100*e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"},pr=l.unpack,gr=Math.cbrt,vr=Math.pow,mr=Math.sign,yr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=[kr(t/255),kr(a/255),kr(f/255)],u=o[0],c=o[1],i=o[2],l=gr(.4122214708*u+.5363325363*c+.0514459929*i),h=gr(.2119034982*u+.6806995451*c+.1073969566*i),s=gr(.0883024619*u+.2817188376*c+.6299787005*i);return[.2104542553*l+.793617785*h-.0040720468*s,1.9779984951*l-2.428592205*h+.4505937099*s,.0259040371*l+.7827717662*h-.808675766*s]};function kr(r){var n=Math.abs(r);return n<.04045?r/12.92:(mr(r)||1)*vr((n+.055)/1.055,2.4)}var wr=l.unpack,Nr=l.last,Mr=function(r){return Math.round(100*r)/100},_r=Math.min,Ar=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=wr(r,"lch"),t=Nr(r)||"lch";return e[0]=Mr(100*e[0])+"%",e[1]=_r(Mr(e[1]/.4*100),100)+"%",e[2]=Mr(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"},Pr=l.unpack,xr=yr,Er=er,Or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=xr(t,a,f),u=o[0],c=o[1],i=o[2];return Er(u,c,i)},Gr=l.unpack,Rr=l.last,jr=F,Br=Y,Fr=I,qr=or,Lr=lr,Yr=Z,Dr=br,Sr=yr,Cr=Ar,Ir=Or,$r=Math.round,zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Gr(r,"rgba"),t=Rr(r)||"rgb";return"hsl"==t.substring(0,3)?jr(Br(e),t):"lch"==t.substring(0,3)?Fr(qr(e),t):"lab"==t.substring(0,3)?Lr(Yr(e).concat([e.length>3?e[3]:1]),t):"oklab"==t.substring(0,5)?Dr(Sr(e).concat([e.length>3?e[3]:1]),"lab"):"oklch"==t.substring(0,5)?Cr(Ir(e).concat([e.length>3?e[3]:1]),"lch"):(e[0]=$r(e[0]),e[1]=$r(e[1]),e[2]=$r(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]=e.length>3?e[3]:1,t="rgba"),t+"("+e.slice(0,"rgb"===t?3:4).join(",")+")")},Tr=l.unpack,Wr=Math.round,Xr=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=Tr(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var i=[0,0,0],l=[0,0,0],h=c<.5?c*(1+u):c+u-c*u,s=2*c-h,d=o/360;i[0]=d+1/3,i[1]=d,i[2]=d-1/3;for(var b=0;b<3;b++)i[b]<0&&(i[b]+=1),i[b]>1&&(i[b]-=1),6*i[b]<1?l[b]=s+6*(h-s)*i[b]:2*i[b]<1?l[b]=h:3*i[b]<2?l[b]=s+(h-s)*(2/3-i[b])*6:l[b]=s;t=(r=[Wr(255*l[0]),Wr(255*l[1]),Wr(255*l[2])])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},Vr=$,Ur=l.unpack,Zr=Math.pow,Hr=function(r){return 255*(r<=.00304?12.92*r:1.055*Zr(r,1/2.4)-.055)},Kr=function(r){return r>Vr.t1?r*r*r:Vr.t2*(r-Vr.t0)},Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ur(r,"lab"))[0],o=r[1],u=r[2];return t=(f+16)/116,e=isNaN(o)?t:t+o/500,a=isNaN(u)?t:t-u/200,t=Vr.Yn*Kr(t),e=Vr.Xn*Kr(e),a=Vr.Zn*Kr(a),[Hr(3.2404542*e-1.5371385*t-.4985314*a),Hr(-.969266*e+1.8760108*t+.041556*a),Hr(.0556434*e-.2040259*t+1.0572252*a),r.length>3?r[3]:1]},Jr=l.unpack,rn=l.DEG2RAD,nn=Math.sin,en=Math.cos,tn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Jr(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,en(f*=rn)*a,nn(f)*a]},an=l.unpack,fn=tn,on=Qr,un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=an(r,"lch"))[0],t=r[1],a=r[2],f=fn(e,t,a),o=f[0],u=f[1],c=f[2],i=on(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},cn=l.unpack,ln=Math.pow,hn=Math.sign,sn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=cn(r,"lab"))[0],t=r[1],a=r[2],f=ln(e+.3963377774*t+.2158037573*a,3),o=ln(e-.1055613458*t-.0638541728*a,3),u=ln(e-.0894841775*t-1.291485548*a,3);return[255*dn(4.0767416621*f-3.3077115913*o+.2309699292*u),255*dn(-1.2684380046*f+2.6097574011*o-.3413193965*u),255*dn(-.0041960863*f-.7034186147*o+1.707614701*u),r.length>3?r[3]:1]};function dn(r){var n=Math.abs(r);return n>.0031308?(hn(r)||1)*(1.055*ln(n,1/2.4)-.055):12.92*r}var bn=l.unpack,pn=tn,gn=sn,vn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=bn(r,"lch"))[0],t=r[1],a=r[2],f=pn(e,t,a),o=f[0],u=f[1],c=f[2],i=gn(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},mn=Xr,yn=Qr,kn=un,wn=sn,Nn=vn,Mn=h,_n=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,An=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Pn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,xn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,En=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,On=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=/^lab\(\s*(\d+(?:\.\d+)?)%?\s* (-?\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)%?\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Rn=/^lch\(\s*(\d+(?:\.\d+)?)%?\s* (\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,jn=/^oklab\(\s*(\d+(?:\.\d+)?%?)\s* (-?\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Bn=/^oklch\(\s*(\d+(?:\.\d+)?%?)\s* (\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Fn=Math.round,qn=Math.abs,Ln=function(r){var n;if(r=r.toLowerCase().trim(),Mn.format.named)try{return Mn.format.named(r)}catch(r){}if(n=r.match(_n)){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=Number(e[t]);return e[3]=1,e}if(n=r.match(An)){for(var a=n.slice(1,5),f=0;f<4;f++)a[f]=Number(a[f]);return a}if(n=r.match(Pn)){for(var o=n.slice(1,4),u=0;u<3;u++)o[u]=Fn(2.55*Number(o[u]));return o[3]=1,o}if(n=r.match(xn)){for(var c=n.slice(1,5),i=0;i<3;i++)c[i]=Fn(2.55*Number(c[i]));return c[3]=Number(c[3]),c}if(n=r.match(En)){for(var l=n.slice(1,4),h=0;h<=2;h++)l[h]=Number(l[h]);l[1]*=.01,l[2]*=.01;var s=mn(l);return s[3]=1,s}if(n=r.match(On)){for(var d=n.slice(1,4),b=0;b<=2;b++)d[b]=Number(d[b]);d[1]*=.01,d[2]*=.01;var p=mn(d);return p[3]=Number(n[4]),p}if(n=r.match(Gn)){for(var g=n.slice(1,4),v=0;v<=2;v++)g[v]=Number(g[v]);var m=yn(g).map((function(r){return qn(Fn(r))}));return m[3]=Number(n[4]),m[3]||0===m[3]||(m[3]=1),m}if(n=r.match(Rn)){for(var y=n.slice(1,4),k=0;k<=2;k++)y[k]=Number(y[k]);var w=kn(y).map((function(r){return qn(Fn(r))}));return w[3]=Number(n[4]),w[3]||0===w[3]||(w[3]=1),w}if(n=r.match(jn)){for(var N=n.slice(1,4),M=0;M<=2;M++)N[M].endsWith("%")?N[M]=.01*Number(N[M].replace("%","")):N[M]=Number(N[M]);var _=wn(N).map((function(r){return qn(Fn(r))}));return _[3]=Number(n[4]),_[3]||0===_[3]||(_[3]=1),_}if(n=r.match(Bn)){for(var A=n.slice(1,4),P=0;P<=1;P++)A[P].endsWith("%")?(A[P]=.01*Number(A[P].replace("%","")),1===P&&(A[P]*=.4)):A[P]=Number(A[P]);var x=Nn(A).map((function(r){return qn(Fn(r))}));return x[3]=Number(n[4]),x[3]||0===x[3]||(x[3]=1),x}};Ln.test=function(r){return _n.test(r)||An.test(r)||Pn.test(r)||xn.test(r)||En.test(r)||On.test(r)||Gn.test(r)||Rn.test(r)||jn.test(r)||Bn.test(r)};var Yn=y,Dn=v,Sn=h,Cn=l.type,In=zr,$n=Ln;Dn.prototype.css=function(r){return In(this._rgb,r)},Yn.css=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Dn,[null].concat(r,["css"])))},Sn.format.css=$n,Sn.autodetect.push({p:5,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===Cn(r)&&$n.test(r))return"css"}});var zn=v,Tn=y,Wn=l.unpack;h.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Wn(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},Tn.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(zn,[null].concat(r,["gl"])))},zn.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var Xn=l.unpack,Vn=y,Un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=Xn(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Math.min(a,f,o),c=Math.max(a,f,o),i=c-u,l=100*i/255,h=u/(255-i)*100;return 0===i?e=Vn.hueNaN?Number.NaN:0:(a===c&&(e=(f-o)/i),f===c&&(e=2+(o-a)/i),o===c&&(e=4+(a-f)/i),(e*=60)<0?e+=360:!Vn.hueNaN&&isNaN(e)&&(e=0)),[e,l,h]},Zn=l.unpack,Hn=Math.floor,Kn=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Zn(o,"hcg"))[0],s=o[1],d=o[2];d*=255;var b=255*s;if(0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var p=Hn(h/=60),g=h-p,v=d*(1-s),m=v+b*(1-g),y=v+b*g,k=v+b;switch(p){case 0:c=(r=[k,y,v])[0],i=r[1],l=r[2];break;case 1:c=(n=[m,k,v])[0],i=n[1],l=n[2];break;case 2:c=(e=[v,k,y])[0],i=e[1],l=e[2];break;case 3:c=(t=[v,m,k])[0],i=t[1],l=t[2];break;case 4:c=(a=[y,v,k])[0],i=a[1],l=a[2];break;case 5:c=(f=[k,v,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Qn=l.unpack,Jn=l.type,re=y,ne=v,ee=h,te=Un;ne.prototype.hcg=function(){return te(this._rgb)},re.hcg=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ne,[null].concat(r,["hcg"])))},ee.format.hcg=Kn,ee.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Qn(r,"hcg"),"array"===Jn(r)&&3===r.length)return"hcg"}});var ae=l.unpack,fe=l.last,oe=Math.round,ue=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ae(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=fe(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=oe(t))<<16|(a=oe(a))<<8|(f=oe(f))).toString(16);c=c.substring(c.length-6);var i="0"+oe(255*o).toString(16);switch(i=i.substring(i.length-2),u.toLowerCase()){case"rgba":return"#"+c+i;case"argb":return"#"+i+c;default:return"#"+c}},ce=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ie=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,le=function(r){if(r.match(ce)){4!==r.length&&7!==r.length||(r=r.substring(1)),3===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]);var n=parseInt(r,16);return[n>>16,n>>8&255,255&n,1]}if(r.match(ie)){5!==r.length&&9!==r.length||(r=r.substring(1)),4===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]);var e=parseInt(r,16);return[e>>24&255,e>>16&255,e>>8&255,Math.round((255&e)/255*100)/100]}throw new Error("unknown hex color: "+r)},he=y,se=v,de=l.type,be=h,pe=ue;se.prototype.hex=function(r){return pe(this._rgb,r)},he.hex=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(se,[null].concat(r,["hex"])))},be.format.hex=le,be.autodetect.push({p:4,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===de(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var ge=l.unpack,ve=l.TWOPI,me=Math.min,ye=Math.sqrt,ke=Math.acos,we=y,Ne=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=ge(r,"rgb"),a=t[0],f=t[1],o=t[2],u=me(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?e=we.hueNaN?Number.NaN:0:(e=(a-f+(a-o))/2,e/=ye((a-f)*(a-f)+(a-o)*(f-o)),e=ke(e),o>f&&(e=ve-e),e/=ve,!we.hueNaN&&isNaN(e)&&(e=0)),[360*e,i,c]},Me=l.unpack,_e=l.limit,Ae=l.TWOPI,Pe=l.PITHIRD,xe=Math.cos,Ee=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Me(r,"hsi"))[0],o=r[1],u=r[2];return isNaN(f)&&(f=0),isNaN(o)&&(o=0),f>360&&(f-=360),f<0&&(f+=360),(f/=360)<1/3?t=1-((a=(1-o)/3)+(e=(1+o*xe(Ae*f)/xe(Pe-Ae*f))/3)):f<2/3?a=1-((e=(1-o)/3)+(t=(1+o*xe(Ae*(f-=1/3))/xe(Pe-Ae*f))/3)):e=1-((t=(1-o)/3)+(a=(1+o*xe(Ae*(f-=2/3))/xe(Pe-Ae*f))/3)),[255*(e=_e(u*e*3)),255*(t=_e(u*t*3)),255*(a=_e(u*a*3)),r.length>3?r[3]:1]},Oe=l.unpack,Ge=l.type,Re=y,je=v,Be=h,Fe=Ne;je.prototype.hsi=function(){return Fe(this._rgb)},Re.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(je,[null].concat(r,["hsi"])))},Be.format.hsi=Ee,Be.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Oe(r,"hsi"),"array"===Ge(r)&&3===r.length)return"hsi"}});var qe=l.unpack,Le=l.type,Ye=y,De=v,Se=h,Ce=Y;De.prototype.hsl=function(){return Ce(this._rgb)},Ye.hsl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(De,[null].concat(r,["hsl"])))},Se.format.hsl=Xr,Se.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=qe(r,"hsl"),"array"===Le(r)&&3===r.length)return"hsl"}});var Ie=l.unpack,$e=Math.min,ze=Math.max,Te=y,We=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ie(r,"rgb"))[0],o=r[1],u=r[2],c=$e(f,o,u),i=ze(f,o,u),l=i-c;return a=i/255,0===i?(e=Te.hueNaN?Number.NaN:0,t=0):(t=l/i,f===i&&(e=(o-u)/l),o===i&&(e=2+(u-f)/l),u===i&&(e=4+(f-o)/l),(e*=60)<0?e+=360:!Te.hueNaN&&isNaN(e)&&(e=0)),[e,t,a]},Xe=l.unpack,Ve=Math.floor,Ue=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Xe(o,"hsv"))[0],s=o[1],d=o[2];if(d*=255,0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var b=Ve(h/=60),p=h-b,g=d*(1-s),v=d*(1-s*p),m=d*(1-s*(1-p));switch(b){case 0:c=(r=[d,m,g])[0],i=r[1],l=r[2];break;case 1:c=(n=[v,d,g])[0],i=n[1],l=n[2];break;case 2:c=(e=[g,d,m])[0],i=e[1],l=e[2];break;case 3:c=(t=[g,v,d])[0],i=t[1],l=t[2];break;case 4:c=(a=[m,g,d])[0],i=a[1],l=a[2];break;case 5:c=(f=[d,g,v])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Ze=l.unpack,He=l.type,Ke=y,Qe=v,Je=h,rt=We;Qe.prototype.hsv=function(){return rt(this._rgb)},Ke.hsv=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Qe,[null].concat(r,["hsv"])))},Je.format.hsv=Ue,Je.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ze(r,"hsv"),"array"===He(r)&&3===r.length)return"hsv"}});var nt=l.unpack,et=l.type,tt=y,at=v,ft=h,ot=Z;at.prototype.lab=function(){return ot(this._rgb)},tt.lab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(at,[null].concat(r,["lab"])))},ft.format.lab=Qr,ft.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=nt(r,"lab"),"array"===et(r)&&3===r.length)return"lab"}});var ut=l.unpack,ct=un,it=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ut(r,"hcl").reverse();return ct.apply(void 0,e)},lt=l.unpack,ht=l.type,st=y,dt=v,bt=h,pt=or;dt.prototype.lch=function(){return pt(this._rgb)},dt.prototype.hcl=function(){return pt(this._rgb).reverse()},st.lch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["lch"])))},st.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["hcl"])))},bt.format.lch=un,bt.format.hcl=it,["lch","hcl"].forEach((function(r){return bt.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if(n=lt(n,r),"array"===ht(n)&&3===n.length)return r}})}));var gt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},vt=h,mt=l.type,yt=gt,kt=le,wt=ue;v.prototype.name=function(){for(var r=wt(this._rgb,"rgb"),n=0,e=Object.keys(yt);n<e.length;n+=1){var t=e[n];if(yt[t]===r)return t.toLowerCase()}return r},vt.format.named=function(r){if(r=r.toLowerCase(),yt[r])return kt(yt[r]);throw new Error("unknown color name: "+r)},vt.autodetect.push({p:5,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===mt(r)&&yt[r.toLowerCase()])return"named"}});var Nt=l.unpack,Mt=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Nt(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]},_t=l.type,At=function(r){if("number"==_t(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Pt=y,xt=v,Et=h,Ot=l.type,Gt=Mt;xt.prototype.num=function(){return Gt(this._rgb)},Pt.num=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(xt,[null].concat(r,["num"])))},Et.format.num=At,Et.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===Ot(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Rt=y,jt=v,Bt=h,Ft=l.unpack,qt=l.type,Lt=Math.round;jt.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Lt)},jt.prototype.rgba=function(r){return void 0===r&&(r=!0),this._rgb.slice(0,4).map((function(n,e){return e<3?!1===r?n:Lt(n):n}))},Rt.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(jt,[null].concat(r,["rgb"])))},Bt.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Ft(r,"rgba");return void 0===e[3]&&(e[3]=1),e},Bt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ft(r,"rgba"),"array"===qt(r)&&(3===r.length||4===r.length&&"number"==qt(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Yt=Math.log,Dt=function(r){var n,e,t,a=r/100;return a<66?(n=255,e=a<6?0:-155.25485562709179-.44596950469579133*(e=a-2)+104.49216199393888*Yt(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Yt(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Yt(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Yt(e),t=255),[n,e,t,1]},St=Dt,Ct=l.unpack,It=Math.round,$t=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=Ct(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=St(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return It(e)},zt=y,Tt=v,Wt=h,Xt=$t;Tt.prototype.temp=Tt.prototype.kelvin=Tt.prototype.temperature=function(){return Xt(this._rgb)},zt.temp=zt.kelvin=zt.temperature=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Tt,[null].concat(r,["temp"])))},Wt.format.temp=Wt.format.kelvin=Wt.format.temperature=Dt;var Vt=l.unpack,Ut=l.type,Zt=y,Ht=v,Kt=h,Qt=yr;Ht.prototype.oklab=function(){return Qt(this._rgb)},Zt.oklab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Ht,[null].concat(r,["oklab"])))},Kt.format.oklab=sn,Kt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Vt(r,"oklab"),"array"===Ut(r)&&3===r.length)return"oklab"}});var Jt=l.unpack,ra=l.type,na=y,ea=v,ta=h,aa=Or;ea.prototype.oklch=function(){return aa(this._rgb)},na.oklch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ea,[null].concat(r,["oklch"])))},ta.format.oklch=vn,ta.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Jt(r,"oklch"),"array"===ra(r)&&3===r.length)return"oklch"}});var fa=l.unpack,oa=l.last,ua=Math.round,ca=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=fa(r,"rgba"),t=(1!==e[3]?oa(r):"rgb")||"rgb";return e[0]=ua(e[0]),e[1]=ua(e[1]),e[2]=ua(e[2]),("rgba"===t||e.length>3&&e[3]<1&&"rgb"!==oa(r))&&(e[3]=e.length>3?e[3]:1,t="rgba"),"rgba"===t?e[3]<<24|e[0]<<16|e[1]<<8|e[2]:4278190080|e[0]<<16|e[1]<<8|e[2]},ia=l.type,la=function(r){if("number"==ia(r)){var n=(r>>24&255)/255;if(n>=0&&n<=1){var e=r-4278190080;return[e>>16&255,e>>8&255,255&e,n]}}throw new Error("unknown android color: "+r)},ha=y,sa=v,da=h,ba=l.type,pa=ca;sa.prototype.android=function(r){return pa(this._rgb,r)},ha.android=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(sa,[null].concat(r,["android"])))},da.format.android=la,da.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===ba(r[0])){var e=(r[0]>>24&255)/255;if(e>=0&&e<=1){var t=r[0]-4278190080;if([t>>16&255,t>>8&255,255&t].every((function(r){return r>=0&&r<=255})))return"android"}}}});var ga=v,va=l.type;ga.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===va(r)?n?(this._rgb[3]=r,this):new ga([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},v.prototype.clipped=function(){return this._rgb._clipped||!1};var ma=v,ya=$;ma.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=ya.Kn*r,new ma(n,"lab").alpha(this.alpha(),!0)},ma.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},ma.prototype.darker=ma.prototype.darken,ma.prototype.brighter=ma.prototype.brighten,v.prototype.get=function(r){var n=r.split("."),e=n[0],t=n[1],a=this[e]();if(t){var f=e.indexOf(t)-("ok"===e.substring(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var ka=v,wa=l.type,Na=Math.pow;ka.prototype.luminance=function(r){if(void 0!==r&&"number"===wa(r)){if(0===r)return new ka([0,0,0,this._rgb[3]],"rgb");if(1===r)return new ka([255,255,255,this._rgb[3]],"rgb");var n=this.luminance(),e=20,t=function(n,a){var f=n.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!e--?f:o>r?t(n,f):t(f,a)},a=(n>r?t(new ka([0,0,0]),this):t(this,new ka([255,255,255]))).rgb();return new ka(a.concat([this._rgb[3]]))}return Ma.apply(void 0,this._rgb.slice(0,3))};var Ma=function(r,n,e){return.2126*(r=_a(r))+.7152*(n=_a(n))+.0722*(e=_a(e))},_a=function(r){return(r/=255)<=.03928?r/12.92:Na((r+.055)/1.055,2.4)},Aa={},Pa=v,xa=l.type,Ea=Aa,Oa=function(r,n,e){void 0===e&&(e=.5);for(var t=[],a=arguments.length-3;a-- >0;)t[a]=arguments[a+3];var f=t[0]||"lrgb";if(Ea[f]||t.length||(f=Object.keys(Ea)[0]),!Ea[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==xa(r)&&(r=new Pa(r)),"object"!==xa(n)&&(n=new Pa(n)),Ea[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))},Ga=v,Ra=Oa;Ga.prototype.mix=Ga.prototype.interpolate=function(r,n){void 0===n&&(n=.5);for(var e=[],t=arguments.length-2;t-- >0;)e[t]=arguments[t+2];return Ra.apply(void 0,[this,r,n].concat(e))};var ja=v;ja.prototype.premultiply=function(r){void 0===r&&(r=!1);var n=this._rgb,e=n[3];return r?(this._rgb=[n[0]*e,n[1]*e,n[2]*e,e],this):new ja([n[0]*e,n[1]*e,n[2]*e,e],"rgb")};var Ba=v,Fa=$;Ba.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=Fa.Kn*r,n[1]<0&&(n[1]=0),new Ba(n,"lch").alpha(this.alpha(),!0)},Ba.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var qa=v,La=l.type;qa.prototype.set=function(r,n,e){void 0===e&&(e=!1);var t=r.split("."),a=t[0],f=t[1],o=this[a]();if(f){var u=a.indexOf(f)-("ok"===a.substring(0,2)?2:0);if(u>-1){if("string"==La(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substring(1);break;case"/":o[u]/=+n.substring(1);break;default:o[u]=+n}else{if("number"!==La(n))throw new Error("unsupported value for Color.set");o[u]=n}var c=new qa(o,a);return e?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o};var Ya=v;Aa.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new Ya(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var Da=v,Sa=Math.sqrt,Ca=Math.pow;Aa.lrgb=function(r,n,e){var t=r._rgb,a=t[0],f=t[1],o=t[2],u=n._rgb,c=u[0],i=u[1],l=u[2];return new Da(Sa(Ca(a,2)*(1-e)+Ca(c,2)*e),Sa(Ca(f,2)*(1-e)+Ca(i,2)*e),Sa(Ca(o,2)*(1-e)+Ca(l,2)*e),"rgb")};var Ia=v;Aa.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new Ia(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var $a=v,za=function(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,p,g;return"hsl"===t?(o=r.hsl(),u=n.hsl()):"hsv"===t?(o=r.hsv(),u=n.hsv()):"hcg"===t?(o=r.hcg(),u=n.hcg()):"hsi"===t?(o=r.hsi(),u=n.hsi()):"lch"===t||"hcl"===t?(t="hcl",o=r.hcl(),u=n.hcl()):"oklch"===t&&(o=r.oklch().reverse(),u=n.oklch().reverse()),"h"!==t.substring(0,1)&&"oklch"!==t||(c=(a=o)[0],l=a[1],s=a[2],i=(f=u)[0],h=f[1],d=f[2]),isNaN(c)||isNaN(i)?isNaN(c)?isNaN(i)?p=Number.NaN:(p=i,1!=s&&0!=s||"hsv"==t||(b=h)):(p=c,1!=d&&0!=d||"hsv"==t||(b=l)):p=c+e*(i>c&&i-c>180?i-(c+360):i<c&&c-i>180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),g=s+e*(d-s),new $a("oklch"===t?[g,b,p]:[p,b,g],t)},Ta=za,Wa=function(r,n,e){return Ta(r,n,e,"lch")};Aa.lch=Wa,Aa.hcl=Wa;var Xa=v;Aa.num=function(r,n,e){var t=r.num(),a=n.num();return new Xa(t+e*(a-t),"num")};var Va=za;Aa.hcg=function(r,n,e){return Va(r,n,e,"hcg")};var Ua=za;Aa.hsi=function(r,n,e){return Ua(r,n,e,"hsi")};var Za=za;Aa.hsl=function(r,n,e){return Za(r,n,e,"hsl")};var Ha=za;Aa.hsv=function(r,n,e){return Ha(r,n,e,"hsv")};var Ka=v;Aa.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new Ka(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};var Qa=za;Aa.oklch=function(r,n,e){return Qa(r,n,e,"oklch")};var Ja=v,rf=l.clip_rgb,nf=Math.pow,ef=Math.sqrt,tf=Math.PI,af=Math.cos,ff=Math.sin,of=Math.atan2,uf=function(r,n){for(var e=r.length,t=[0,0,0,0],a=0;a<r.length;a++){var f=r[a],o=n[a]/e,u=f._rgb;t[0]+=nf(u[0],2)*o,t[1]+=nf(u[1],2)*o,t[2]+=nf(u[2],2)*o,t[3]+=u[3]*o}return t[0]=ef(t[0]),t[1]=ef(t[1]),t[2]=ef(t[2]),t[3]>.9999999&&(t[3]=1),new Ja(rf(t))},cf=y,lf=l.type,hf=Math.pow,sf=function(r){var n="rgb",e=cf("#ccc"),t=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,h=1,s=!1,d={},b=!0,p=1,g=function(r){if((r=r||["#fff","#000"])&&"string"===lf(r)&&cf.brewer&&cf.brewer.hasOwnProperty(r.toLowerCase())&&"palettes"!==r&&(r=cf.brewer[r.toLowerCase()]),"array"===lf(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n<r.length;n++)r[n]=cf(r[n]);f.length=0;for(var e=0;e<r.length;e++)f.push(e/(r.length-1))}return k(),c=r},v=function(r){return r},m=function(r){return r},y=function(r,t){var a,i;if(null==t&&(t=!1),isNaN(r)||null===r)return e;if(t)i=r;else if(u&&u.length>2){var s=function(r){if(null!=u){for(var n=u.length-1,e=0;e<n&&r>=u[e];)e++;return e-1}return 0}(r);i=s/(u.length-2)}else i=h!==l?(r-l)/(h-l):1;i=m(i),t||(i=v(i)),i>1?i=1:i<0?i=0:1!==p&&(i=hf(i,p)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var g=Math.floor(1e4*i);if(b&&d[g])a=d[g];else{if("array"===lf(c))for(var y=0;y<f.length;y++){var k=f[y];if(i<=k){a=c[y];break}if(i>=k&&y===f.length-1){a=c[y];break}if(i>k&&i<f[y+1]){i=(i-k)/(f[y+1]-k),a=cf.interpolate(c[y],c[y+1],i,n);break}}else"function"===lf(c)&&(a=c(i));b&&(d[g]=a)}return a},k=function(){return d={}};g(r);var w=function(r){var n=cf(y(r));return i&&n[i]?n[i]():n};return w.classes=function(r){if(null!=r){if("array"===lf(r))u=r,a=[r[0],r[r.length-1]];else{var n=cf.analyze(a);u=0===r?[n.min,n.max]:cf.limits(n,"e",r)}return w}return u},w.domain=function(r){if(!arguments.length)return a;l=r[0],h=r[r.length-1],f=[];var n=c.length;if(r.length===n&&l!==h)for(var e=0,t=Array.from(r);e<t.length;e+=1){var o=t[e];f.push((o-l)/(h-l))}else{for(var u=0;u<n;u++)f.push(u/(n-1));if(r.length>2){var i=r.map((function(n,e){return e/(r.length-1)})),s=r.map((function(r){return(r-l)/(h-l)}));s.every((function(r,n){return i[n]===r}))||(m=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=s[n+1];)n++;var e=(r-s[n])/(s[n+1]-s[n]);return i[n]+e*(i[n+1]-i[n])})}}return a=[l,h],w},w.mode=function(r){return arguments.length?(n=r,k(),w):n},w.range=function(r,n){return g(r),w},w.out=function(r){return i=r,w},w.spread=function(r){return arguments.length?(t=r,w):t},w.correctLightness=function(r){return null==r&&(r=!0),s=r,k(),v=s?function(r){for(var n=y(0,!0).lab()[0],e=y(1,!0).lab()[0],t=n>e,a=y(r,!0).lab()[0],f=n+(e-n)*r,o=a-f,u=0,c=1,i=20;Math.abs(o)>.01&&i-- >0;)t&&(o*=-1),o<0?(u=r,r+=.5*(c-r)):(c=r,r+=.5*(u-r)),a=y(r,!0).lab()[0],o=a-f;return r}:function(r){return r},w},w.padding=function(r){return null!=r?("number"===lf(r)&&(r=[r,r]),o=r,w):o},w.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=c.slice(0);else if(1===n)t=[w(.5)];else if(n>1){var f=a[0],o=a[1]-f;t=function(r,n,e){for(var t=[],a=r<n,f=e?a?n+1:n-1:n,o=r;a?o<f:o>f;a?o++:o--)t.push(o);return t}(0,n,!1).map((function(r){return w(f+r/(n-1)*o)}))}else{r=[];var i=[];if(u&&u.length>2)for(var l=1,h=u.length,s=1<=h;s?l<h:l>h;s?l++:l--)i.push(.5*(u[l-1]+u[l]));else i=a;t=i.map((function(r){return w(r)}))}return cf[e]&&(t=t.map((function(r){return r[e]()}))),t},w.cache=function(r){return null!=r?(b=r,w):b},w.gamma=function(r){return null!=r?(p=r,w):p},w.nodata=function(r){return null!=r?(e=cf(r),w):e},w};var df=v,bf=sf,pf=y,gf=function(r,n,e){if(!gf[e])throw new Error("unknown blend mode "+e);return gf[e](r,n)},vf=function(r){return function(n,e){var t=pf(e).rgb(),a=pf(n).rgb();return pf.rgb(r(t,a))}},mf=function(r){return function(n,e){var t=[];return t[0]=r(n[0],e[0]),t[1]=r(n[1],e[1]),t[2]=r(n[2],e[2]),t}};gf.normal=vf(mf((function(r){return r}))),gf.multiply=vf(mf((function(r,n){return r*n/255}))),gf.screen=vf(mf((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),gf.overlay=vf(mf((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),gf.darken=vf(mf((function(r,n){return r>n?n:r}))),gf.lighten=vf(mf((function(r,n){return r>n?r:n}))),gf.dodge=vf(mf((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),gf.burn=vf(mf((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var yf=gf,kf=l.type,wf=l.clip_rgb,Nf=l.TWOPI,Mf=Math.pow,_f=Math.sin,Af=Math.cos,Pf=y,xf=v,Ef=Math.floor,Of=Math.random,Gf=o,Rf=Math.log,jf=Math.pow,Bf=Math.floor,Ff=Math.abs,qf=function(r,n){void 0===n&&(n=null);var e={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===Gf(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===Gf(r)&&(r=r[n]),null==r||isNaN(r)||(e.values.push(r),e.sum+=r,r<e.min&&(e.min=r),r>e.max&&(e.max=r),e.count+=1)})),e.domain=[e.min,e.max],e.limits=function(r,n){return Lf(e,r,n)},e},Lf=function(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==Gf(r)&&(r=qf(r));var t=r.min,a=r.max,f=r.values.sort((function(r,n){return r-n}));if(1===e)return[t,a];var o=[];if("c"===n.substring(0,1)&&(o.push(t),o.push(a)),"e"===n.substring(0,1)){o.push(t);for(var u=1;u<e;u++)o.push(t+u/e*(a-t));o.push(a)}else if("l"===n.substring(0,1)){if(t<=0)throw new Error("Logarithmic scales are only possible for values > 0");var c=Math.LOG10E*Rf(t),i=Math.LOG10E*Rf(a);o.push(t);for(var l=1;l<e;l++)o.push(jf(10,c+l/e*(i-c)));o.push(a)}else if("q"===n.substring(0,1)){o.push(t);for(var h=1;h<e;h++){var s=(f.length-1)*h/e,d=Bf(s);if(d===s)o.push(f[d]);else{var b=s-d;o.push(f[d]*(1-b)+f[d+1]*b)}}o.push(a)}else if("k"===n.substring(0,1)){var p,g=f.length,v=new Array(g),m=new Array(e),y=!0,k=0,w=null;(w=[]).push(t);for(var N=1;N<e;N++)w.push(t+N/e*(a-t));for(w.push(a);y;){for(var M=0;M<e;M++)m[M]=0;for(var _=0;_<g;_++)for(var A=f[_],P=Number.MAX_VALUE,x=void 0,E=0;E<e;E++){var O=Ff(w[E]-A);O<P&&(P=O,x=E),m[x]++,v[_]=x}for(var G=new Array(e),R=0;R<e;R++)G[R]=null;for(var j=0;j<g;j++)null===G[p=v[j]]?G[p]=f[j]:G[p]+=f[j];for(var B=0;B<e;B++)G[B]*=1/m[B];y=!1;for(var F=0;F<e;F++)if(G[F]!==w[F]){y=!0;break}w=G,++k>200&&(y=!1)}for(var q={},L=0;L<e;L++)q[L]=[];for(var Y=0;Y<g;Y++)q[p=v[Y]].push(f[Y]);for(var D=[],S=0;S<e;S++)D.push(q[S][0]),D.push(q[S][q[S].length-1]);D=D.sort((function(r,n){return r-n})),o.push(D[0]);for(var C=1;C<D.length;C+=2){var I=D[C];isNaN(I)||-1!==o.indexOf(I)||o.push(I)}}return o},Yf={analyze:qf,limits:Lf},Df=v,Sf=v,Cf=Math.sqrt,If=Math.pow,$f=Math.min,zf=Math.max,Tf=Math.atan2,Wf=Math.abs,Xf=Math.cos,Vf=Math.sin,Uf=Math.exp,Zf=Math.PI,Hf=v,Kf=v,Qf=y,Jf=v,ro=Math.round;for(var no=v,eo=y,to=y,ao=sf,fo={cool:function(){return ao([to.hsl(180,1,.9),to.hsl(250,.7,.4)])},hot:function(){return ao(["#000","#f00","#ff0","#fff"]).mode("rgb")}},oo={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},uo=0,co=Object.keys(oo);uo<co.length;uo+=1){var io=co[uo];Object.freeze(oo[io]),oo[io.toLowerCase()]=oo[io]}Object.defineProperty(oo,"palettes",{configurable:!1,enumerable:!0,get:function(){return["Sequential","Diverging","Qualitative"]}}),Object.defineProperty(oo,"getPalette",{configurable:!1,enumerable:!0,writable:!1,value:function(r){if("string"!=typeof r)throw new Error("key is not a string");switch((r||"").toLowerCase()){case"sequential":return["OrRd","PuBu","Oranges","BuPu","BuGn","YlOrBr","YlGn","Reds","RdPu","Greens","YlGnBu","Purples","GnBu","Greys","YlOrRd","PuRd","Blues","PuBuGn","Viridis"];case"diverging":return["Spectral","RdYlGn","Set1","RdBu","PiYG","PRGn","RdYlBu","BrBG","RdGy","PuOr"];case"qualitative":return["Set2","Accent","Set1","Set3","Dark2","Paired","Pastel2","Pastel1"];default:return null}}}),["diverging","Diverging","qualitative","Qualitative","sequential","Sequential"].forEach((function(r){Object.defineProperty(oo,r,{configurable:!1,enumerable:!0,get:function(){var n=this.getPalette(r);return this[n[Math.floor(Math.random()*n.length)]]}})})),Object.freeze(oo);var lo=oo,ho=y;return ho.average=function(r,n,e){void 0===n&&(n="lrgb"),void 0===e&&(e=null);var t=r.length;e||(e=new Array(t).fill(1));var a=t/e.reduce((function(r,n){return r+n}));if(e.forEach((function(r,n){e[n]*=a})),r=r.map((function(r){return new Ja(r)})),"lrgb"===n)return uf(r,e);for(var f=n.replace(/(^ok)/gi,""),o=r.shift(),u=o.get(n),c=[],i=0,l=0,h=0;h<u.length;h++)if(u[h]=(u[h]||0)*e[0],c.push(isNaN(u[h])?0:e[0]),"h"===f.charAt(h)&&!isNaN(u[h])){var s=u[h]/180*tf;i+=af(s)*e[0],l+=ff(s)*e[0]}var d=o.alpha()*e[0];r.forEach((function(r,t){var a=r.get(n);d+=r.alpha()*e[t+1];for(var o=0;o<u.length;o++)if(!isNaN(a[o]))if(c[o]+=e[t+1],"h"===f.charAt(o)){var h=a[o]/180*tf;i+=af(h)*e[t+1],l+=ff(h)*e[t+1]}else u[o]+=a[o]*e[t+1]}));for(var b=0;b<u.length;b++)if("h"===f.charAt(b)){for(var p=of(l/c[b],i/c[b])/tf*180;p<0;)p+=360;for(;p>=360;)p-=360;u[b]=p}else u[b]=u[b]/c[b];return d/=t,new Ja(u,n).alpha(d>.99999?1:d,!0)},ho.bezier=function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new df(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(n){var e=function(r,e){return r+n*(e-r)},t=[0,1,2].map((function(r){return e(f[r],o[r])})),a=e(r[0].alpha(),r[1].alpha());return new df(t,"lab").alpha(a)};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(n){var e=function(r,e,t){return(1-n)*(1-n)*r+2*(1-n)*n*e+n*n*t},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha());return new df(t,"lab").alpha(a)};else if(4===r.length){var c;t=r.map((function(r){return r.lab()})),f=t[0],o=t[1],u=t[2],c=t[3],a=function(n){var e=function(r,e,t,a){return(1-n)*(1-n)*(1-n)*r+3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*t+n*n*n*a},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r],c[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha(),r[3].alpha());return new df(t,"lab").alpha(a)}}else{if(!(r.length>=5))throw new RangeError("No point in running bezier with only one color.");var i,l,h;i=r.map((function(r){return r.lab()})),h=r.length-1,l=function(r){for(var n=[1,1],e=1;e<r;e++){for(var t=[1],a=1;a<=n.length;a++)t[a]=(n[a]||0)+n[a-1];n=t}return n}(h),a=function(n){var e=1-n,t=function(r,t){return t.reduce((function(t,a,f){return t+l[f]*Math.pow(e,h-f)*Math.pow(n,f)*a[r]}),0)},a=[0,1,2].map((function(r){return t(r,i)})),f=t(0,r.map((function(r){return[r.alpha()]})));return new df(a,"lab").alpha(f)}}return a}(r);return n.scale=function(){return bf(n)},n},ho.blend=yf,ho.cubehelix=function(r,n,e,t,a){void 0===r&&(r=300),void 0===n&&(n=-1.5),void 0===e&&(e=1),void 0===t&&(t=1),void 0===a&&(a=[0,1]);var f,o=0;"array"===kf(a)?f=a[1]-a[0]:(f=0,a=[a,a]);var u=function(u){var c=Nf*((r+120)/360+n*u),i=Mf(a[0]+f*u,t),l=(0!==o?e[0]+u*o:e)*i*(1-i)/2,h=Af(c),s=_f(c);return Pf(wf([255*(i+l*(-.14861*h+1.78277*s)),255*(i+l*(-.29227*h-.90649*s)),255*(i+l*(1.97294*h)),1]))};return u.start=function(n){return null==n?r:(r=n,u)},u.rotations=function(r){return null==r?n:(n=r,u)},u.gamma=function(r){return null==r?t:(t=r,u)},u.hue=function(r){return null==r?e:("array"===kf(e=r)?0===(o=e[1]-e[0])&&(e=e[1]):o=0,u)},u.lightness=function(r){return null==r?a:("array"===kf(r)?(a=r,f=r[1]-r[0]):(a=[r,r],f=0),u)},u.scale=function(){return Pf.scale(u)},u.hue(e),u},ho.mix=ho.interpolate=Oa,ho.random=function(){for(var r="#",n=0;n<6;n++)r+="0123456789abcdef".charAt(Ef(16*Of()));return new xf(r,"hex")},ho.scale=sf,ho.analyze=Yf.analyze,ho.contrast=function(r,n){r=new Df(r),n=new Df(n);var e=r.luminance(),t=n.luminance();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},ho.deltaE=function(r,n,e,t,a){void 0===e&&(e=1),void 0===t&&(t=1),void 0===a&&(a=1);var f=function(r){return 360*r/(2*Zf)},o=function(r){return 2*Zf*r/360};r=new Sf(r),n=new Sf(n);var u=Array.from(r.lab()),c=u[0],i=u[1],l=u[2],h=Array.from(n.lab()),s=h[0],d=h[1],b=h[2],p=(c+s)/2,g=(Cf(If(i,2)+If(l,2))+Cf(If(d,2)+If(b,2)))/2,v=.5*(1-Cf(If(g,7)/(If(g,7)+If(25,7)))),m=i*(1+v),y=d*(1+v),k=Cf(If(m,2)+If(l,2)),w=Cf(If(y,2)+If(b,2)),N=(k+w)/2,M=f(Tf(l,m)),_=f(Tf(b,y)),A=M>=0?M:M+360,P=_>=0?_:_+360,x=Wf(A-P)>180?(A+P+360)/2:(A+P)/2,E=1-.17*Xf(o(x-30))+.24*Xf(o(2*x))+.32*Xf(o(3*x+6))-.2*Xf(o(4*x-63)),O=P-A;O=Wf(O)<=180?O:P<=A?O+360:O-360,O=2*Cf(k*w)*Vf(o(O)/2);var G=s-c,R=w-k,j=1+.015*If(p-50,2)/Cf(20+If(p-50,2)),B=1+.045*N,F=1+.015*N*E,q=30*Uf(-If((x-275)/25,2)),L=-(2*Cf(If(N,7)/(If(N,7)+If(25,7))))*Vf(2*o(q)),Y=Cf(If(G/(e*j),2)+If(R/(t*B),2)+If(O/(a*F),2)+L*(R/(t*B))*(O/(a*F)));return zf(0,$f(100,Y))},ho.distance=function(r,n,e,t){if(void 0===e&&(e="lab"),void 0===t&&(t=null),t){var a=t;t=new Array(4).fill(1),a.slice(0,4).forEach((function(r,n){isNaN(r)||(t[n]=r)}))}else t=Array(4).fill(1);r=new Hf(r),n=new Hf(n);var f,o=r.get(e),u=n.get(e),c=e.replace(/(^ok)/gi,""),i=0;for(var l in o){if("h"===c.charAt(l)){var h=(o[l]||0)-(u[l]||0);f=Math.abs(h+180)%360-180}else f=(o[l]||0)-(u[l]||0);i+=f*f*t[l]*t[l]}return Math.sqrt(i)},ho.stdDeviation=function(r){var n=(r=[].concat(r).map((function(r){return new Kf(r).rgba()}))).length;Array.from(Array(n),(function(){return new Array(n)}));for(var e=[0,0,0,0],t=0;t<n;t++)r[t].forEach((function(r,n){return e[n]+=3===n?255*r:r}));e.forEach((function(r,t){return e[t]/=n}));for(var a=0,f=0;f<n;f++)a+=r[f].reduce((function(r,n,t){return r+Math.pow(n-e[t],2)}),0);return a/=4*Math.max(n-1,1),a=Math.round(Math.pow(a,.5))},ho.palette=function(r,n,e){var t="";switch(n.toLowerCase()){case"c":case"contrast":t=Qf.contrast;break;case"d":case"distance":t=chrom.distance;break;default:t=Qf.deltaE}return function(r,n){for(var e=[].concat(r).map((function(r){return new Jf(r).rgba()})),t=r.length,a=Array.from(Array(t),(function(){return new Array(t)})),f=0;f<t;f++){a[f][f]=0;for(var o=f+1;o<t;o++)a[o][f]=a[f][o]=ro(n(e[f],e[o]))}return a.forEach((function(r,n){return a[n]=r.reduce((function(r,n){return r+n}),0)})),a}(r,t).map((function(n,e){return{var:n,color:r[e]}})).sort((function(r,n){return n.var-r.var})).slice(0,e).map((function(r){return r.color}))},ho.limits=Yf.limits,ho.valid=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return new(Function.prototype.bind.apply(no,[null].concat(r))),!0}catch(r){return!1}},ho.noHueAsZero=function(r){return void 0===r&&(r=!1),eo.hueNaN=!r,!eo.hueNaN},ho.scales=fo,ho.colors=gt,ho.brewer=lo,ho}));