forked from gka/chroma.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chroma.min.js
58 lines (57 loc) · 50.9 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
/**
* chroma.js - JavaScript library for color conversions
*
* 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,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r="undefined"!=typeof globalThis?globalThis:r||self).chroma=t()}(this,(function(){"use strict";for(var r=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r<t?t:r>n?n:r},t=r,n={},e=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];e<a.length;e+=1){var f=a[e];n["[object "+f+"]"]=f.toLowerCase()}var o=function(r){return n[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 n=0;n<=3;n++)n<3?((r[n]<0||r[n]>255)&&(r._clipped=!0),r[n]=t(r[n],0,255)):3===n&&(r[n]=t(r[n],0,1));return r},limit:r,type:o,unpack:function(r,t){return void 0===t&&(t=null),r.length>=3?Array.prototype.slice.call(r):"object"==u(r[0])&&t?t.split("").filter((function(t){return void 0!==r[0][t]})).map((function(t){return r[0][t]})):r[0]},last:function(r){if(r.length<2)return null;var t=r.length-1;return"string"==c(r[t])?r[t].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,v=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=this;if("object"===b(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];var e=s(r),a=!1;if(!e){a=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,t){return t.p-r.p})),p.sorted=!0);for(var f=0,o=p.autodetect;f<o.length;f+=1){var u=o[f];if(e=u.test.apply(u,r))break}}if(!p.format[e])throw new Error("unknown format: "+r);var c=p.format[e].apply(null,a?r:r.slice(0,-1));n._rgb=d(c),3===n._rgb.length&&n._rgb.push(1)};v.prototype.toString=function(){return"function"==b(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var g=v,m=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(m.Color,[null].concat(r)))};m.Color=g,m.version="2.4.2";var y=m,k=l.unpack,w=Math.max,M=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=k(r,"rgb"),e=n[0],a=n[1],f=n[2],o=1-w(e/=255,w(a/=255,f/=255)),u=o<1?1/(1-o):0,c=(1-e-o)*u,i=(1-a-o)*u,l=(1-f-o)*u;return[c,i,l,o]},_=l.unpack,N=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=_(r,"cmyk"))[0],e=r[1],a=r[2],f=r[3],o=r.length>4?r[4]:1;return 1===f?[0,0,0,o]:[n>=1?0:255*(1-n)*(1-f),e>=1?0:255*(1-e)*(1-f),a>=1?0:255*(1-a)*(1-f),o]},x=y,A=g,P=h,E=l.unpack,F=l.type,q=M;A.prototype.cmyk=function(){return q(this._rgb)},x.cmyk=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(A,[null].concat(r,["cmyk"])))},P.format.cmyk=N,P.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=E(r,"cmyk"),"array"===F(r)&&4===r.length)return"cmyk"}});var I=l.unpack,O=l.last,j=function(r){return Math.round(100*r)/100},G=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=I(r,"hsla"),e=O(r)||"lsa";return n[0]=j(n[0]||0),n[1]=j(100*n[1])+"%",n[2]=j(100*n[2])+"%","hsla"===e||n.length>3&&n[3]<1?(n[3]=n.length>3?n[3]:1,e="hsla"):n.length=3,e+"("+n.join(",")+")"},R=l.unpack,L=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=R(r,"rgba"))[0],e=r[1],a=r[2];n/=255,e/=255,a/=255;var f,o,u=Math.min(n,e,a),c=Math.max(n,e,a),i=(c+u)/2;return c===u?(f=0,o=Number.NaN):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),n==c?o=(e-a)/(c-u):e==c?o=2+(a-n)/(c-u):a==c&&(o=4+(n-e)/(c-u)),(o*=60)<0&&(o+=360),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},B=l.unpack,C=l.last,D=G,Y=L,S=Math.round,T=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=B(r,"rgba"),e=C(r)||"rgb";return"hsl"==e.substr(0,3)?D(Y(n),e):(n[0]=S(n[0]),n[1]=S(n[1]),n[2]=S(n[2]),("rgba"===e||n.length>3&&n[3]<1)&&(n[3]=n.length>3?n[3]:1,e="rgba"),e+"("+n.slice(0,"rgb"===e?3:4).join(",")+")")},$=l.unpack,z=Math.round,X=function(){for(var r,t=[],n=arguments.length;n--;)t[n]=arguments[n];var e,a,f,o=(t=$(t,"hsl"))[0],u=t[1],c=t[2];if(0===u)e=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;e=(r=[z(255*l[0]),z(255*l[1]),z(255*l[2])])[0],a=r[1],f=r[2]}return t.length>3?[e,a,f,t[3]]:[e,a,f,1]},U=X,V=h,W=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,K=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Z=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,H=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,J=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Q=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,rr=Math.round,tr=function(r){var t;if(r=r.toLowerCase().trim(),V.format.named)try{return V.format.named(r)}catch(r){}if(t=r.match(W)){for(var n=t.slice(1,4),e=0;e<3;e++)n[e]=+n[e];return n[3]=1,n}if(t=r.match(K)){for(var a=t.slice(1,5),f=0;f<4;f++)a[f]=+a[f];return a}if(t=r.match(Z)){for(var o=t.slice(1,4),u=0;u<3;u++)o[u]=rr(2.55*o[u]);return o[3]=1,o}if(t=r.match(H)){for(var c=t.slice(1,5),i=0;i<3;i++)c[i]=rr(2.55*c[i]);return c[3]=+c[3],c}if(t=r.match(J)){var l=t.slice(1,4);l[1]*=.01,l[2]*=.01;var h=U(l);return h[3]=1,h}if(t=r.match(Q)){var s=t.slice(1,4);s[1]*=.01,s[2]*=.01;var d=U(s);return d[3]=+t[4],d}};tr.test=function(r){return W.test(r)||K.test(r)||Z.test(r)||H.test(r)||J.test(r)||Q.test(r)};var nr=y,er=g,ar=h,fr=l.type,or=T,ur=tr;er.prototype.css=function(r){return or(this._rgb,r)},nr.css=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(er,[null].concat(r,["css"])))},ar.format.css=ur,ar.autodetect.push({p:5,test:function(r){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];if(!t.length&&"string"===fr(r)&&ur.test(r))return"css"}});var cr=g,ir=y,lr=l.unpack;h.format.gl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=lr(r,"rgba");return n[0]*=255,n[1]*=255,n[2]*=255,n},ir.gl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(cr,[null].concat(r,["gl"])))},cr.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var hr=l.unpack,sr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e=hr(r,"rgb"),a=e[0],f=e[1],o=e[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?n=Number.NaN:(a===c&&(n=(f-o)/i),f===c&&(n=2+(o-a)/i),o===c&&(n=4+(a-f)/i),(n*=60)<0&&(n+=360)),[n,l,h]},dr=l.unpack,br=Math.floor,pr=function(){for(var r,t,n,e,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=dr(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=br(h/=60),v=h-p,g=d*(1-s),m=g+b*(1-v),y=g+b*v,k=g+b;switch(p){case 0:c=(r=[k,y,g])[0],i=r[1],l=r[2];break;case 1:c=(t=[m,k,g])[0],i=t[1],l=t[2];break;case 2:c=(n=[g,k,y])[0],i=n[1],l=n[2];break;case 3:c=(e=[g,m,k])[0],i=e[1],l=e[2];break;case 4:c=(a=[y,g,k])[0],i=a[1],l=a[2];break;case 5:c=(f=[k,g,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},vr=l.unpack,gr=l.type,mr=y,yr=g,kr=h,wr=sr;yr.prototype.hcg=function(){return wr(this._rgb)},mr.hcg=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(yr,[null].concat(r,["hcg"])))},kr.format.hcg=pr,kr.autodetect.push({p:1,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=vr(r,"hcg"),"array"===gr(r)&&3===r.length)return"hcg"}});var Mr=l.unpack,_r=l.last,Nr=Math.round,xr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=Mr(r,"rgba"),e=n[0],a=n[1],f=n[2],o=n[3],u=_r(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c=(e=Nr(e))<<16|(a=Nr(a))<<8|(f=Nr(f)),i="000000"+c.toString(16);i=i.substr(i.length-6);var l="0"+Nr(255*o).toString(16);switch(l=l.substr(l.length-2),u.toLowerCase()){case"rgba":return"#"+i+l;case"argb":return"#"+l+i;default:return"#"+i}},Ar=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Pr=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Er=function(r){if(r.match(Ar)){4!==r.length&&7!==r.length||(r=r.substr(1)),3===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]);var t=parseInt(r,16);return[t>>16,t>>8&255,255&t,1]}if(r.match(Pr)){5!==r.length&&9!==r.length||(r=r.substr(1)),4===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]);var n=parseInt(r,16);return[n>>24&255,n>>16&255,n>>8&255,Math.round((255&n)/255*100)/100]}throw new Error("unknown hex color: "+r)},Fr=y,qr=g,Ir=l.type,Or=h,jr=xr;qr.prototype.hex=function(r){return jr(this._rgb,r)},Fr.hex=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(qr,[null].concat(r,["hex"])))},Or.format.hex=Er,Or.autodetect.push({p:4,test:function(r){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];if(!t.length&&"string"===Ir(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var Gr=l.unpack,Rr=l.TWOPI,Lr=Math.min,Br=Math.sqrt,Cr=Math.acos,Dr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e=Gr(r,"rgb"),a=e[0],f=e[1],o=e[2],u=Lr(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?n=NaN:(n=(a-f+(a-o))/2,n/=Br((a-f)*(a-f)+(a-o)*(f-o)),n=Cr(n),o>f&&(n=Rr-n),n/=Rr),[360*n,i,c]},Yr=l.unpack,Sr=l.limit,Tr=l.TWOPI,$r=l.PITHIRD,zr=Math.cos,Xr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e,a,f=(r=Yr(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?e=1-((a=(1-o)/3)+(n=(1+o*zr(Tr*f)/zr($r-Tr*f))/3)):f<2/3?a=1-((n=(1-o)/3)+(e=(1+o*zr(Tr*(f-=1/3))/zr($r-Tr*f))/3)):n=1-((e=(1-o)/3)+(a=(1+o*zr(Tr*(f-=2/3))/zr($r-Tr*f))/3)),[255*(n=Sr(u*n*3)),255*(e=Sr(u*e*3)),255*(a=Sr(u*a*3)),r.length>3?r[3]:1]},Ur=l.unpack,Vr=l.type,Wr=y,Kr=g,Zr=h,Hr=Dr;Kr.prototype.hsi=function(){return Hr(this._rgb)},Wr.hsi=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Kr,[null].concat(r,["hsi"])))},Zr.format.hsi=Xr,Zr.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=Ur(r,"hsi"),"array"===Vr(r)&&3===r.length)return"hsi"}});var Jr=l.unpack,Qr=l.type,rt=y,tt=g,nt=h,et=L;tt.prototype.hsl=function(){return et(this._rgb)},rt.hsl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(tt,[null].concat(r,["hsl"])))},nt.format.hsl=X,nt.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=Jr(r,"hsl"),"array"===Qr(r)&&3===r.length)return"hsl"}});var at=l.unpack,ft=Math.min,ot=Math.max,ut=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e,a,f=(r=at(r,"rgb"))[0],o=r[1],u=r[2],c=ft(f,o,u),i=ot(f,o,u),l=i-c;return a=i/255,0===i?(n=Number.NaN,e=0):(e=l/i,f===i&&(n=(o-u)/l),o===i&&(n=2+(u-f)/l),u===i&&(n=4+(f-o)/l),(n*=60)<0&&(n+=360)),[n,e,a]},ct=l.unpack,it=Math.floor,lt=function(){for(var r,t,n,e,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=ct(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=it(h/=60),p=h-b,v=d*(1-s),g=d*(1-s*p),m=d*(1-s*(1-p));switch(b){case 0:c=(r=[d,m,v])[0],i=r[1],l=r[2];break;case 1:c=(t=[g,d,v])[0],i=t[1],l=t[2];break;case 2:c=(n=[v,d,m])[0],i=n[1],l=n[2];break;case 3:c=(e=[v,g,d])[0],i=e[1],l=e[2];break;case 4:c=(a=[m,v,d])[0],i=a[1],l=a[2];break;case 5:c=(f=[d,v,g])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},ht=l.unpack,st=l.type,dt=y,bt=g,pt=h,vt=ut;bt.prototype.hsv=function(){return vt(this._rgb)},dt.hsv=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(bt,[null].concat(r,["hsv"])))},pt.format.hsv=lt,pt.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=ht(r,"hsv"),"array"===st(r)&&3===r.length)return"hsv"}});var gt={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},mt=gt,yt=l.unpack,kt=Math.pow,wt=function(r){return(r/=255)<=.04045?r/12.92:kt((r+.055)/1.055,2.4)},Mt=function(r){return r>mt.t3?kt(r,1/3):r/mt.t2+mt.t0},_t=function(r,t,n){return r=wt(r),t=wt(t),n=wt(n),[Mt((.4124564*r+.3575761*t+.1804375*n)/mt.Xn),Mt((.2126729*r+.7151522*t+.072175*n)/mt.Yn),Mt((.0193339*r+.119192*t+.9503041*n)/mt.Zn)]},Nt=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=yt(r,"rgb"),e=n[0],a=n[1],f=n[2],o=_t(e,a,f),u=o[0],c=o[1],i=o[2],l=116*c-16;return[l<0?0:l,500*(u-c),200*(c-i)]},xt=gt,At=l.unpack,Pt=Math.pow,Et=function(r){return 255*(r<=.00304?12.92*r:1.055*Pt(r,1/2.4)-.055)},Ft=function(r){return r>xt.t1?r*r*r:xt.t2*(r-xt.t0)},qt=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e,a,f=(r=At(r,"lab"))[0],o=r[1],u=r[2];return e=(f+16)/116,n=isNaN(o)?e:e+o/500,a=isNaN(u)?e:e-u/200,e=xt.Yn*Ft(e),n=xt.Xn*Ft(n),a=xt.Zn*Ft(a),[Et(3.2404542*n-1.5371385*e-.4985314*a),Et(-.969266*n+1.8760108*e+.041556*a),Et(.0556434*n-.2040259*e+1.0572252*a),r.length>3?r[3]:1]},It=l.unpack,Ot=l.type,jt=y,Gt=g,Rt=h,Lt=Nt;Gt.prototype.lab=function(){return Lt(this._rgb)},jt.lab=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Gt,[null].concat(r,["lab"])))},Rt.format.lab=qt,Rt.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=It(r,"lab"),"array"===Ot(r)&&3===r.length)return"lab"}});var Bt=l.unpack,Ct=l.RAD2DEG,Dt=Math.sqrt,Yt=Math.atan2,St=Math.round,Tt=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=Bt(r,"lab"),e=n[0],a=n[1],f=n[2],o=Dt(a*a+f*f),u=(Yt(f,a)*Ct+360)%360;return 0===St(1e4*o)&&(u=Number.NaN),[e,o,u]},$t=l.unpack,zt=Nt,Xt=Tt,Ut=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=$t(r,"rgb"),e=n[0],a=n[1],f=n[2],o=zt(e,a,f),u=o[0],c=o[1],i=o[2];return Xt(u,c,i)},Vt=l.unpack,Wt=l.DEG2RAD,Kt=Math.sin,Zt=Math.cos,Ht=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=Vt(r,"lch"),e=n[0],a=n[1],f=n[2];return isNaN(f)&&(f=0),[e,Zt(f*=Wt)*a,Kt(f)*a]},Jt=l.unpack,Qt=Ht,rn=qt,tn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=Jt(r,"lch"))[0],e=r[1],a=r[2],f=Qt(n,e,a),o=f[0],u=f[1],c=f[2],i=rn(o,u,c),l=i[0],h=i[1],s=i[2];return[l,h,s,r.length>3?r[3]:1]},nn=l.unpack,en=tn,an=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=nn(r,"hcl").reverse();return en.apply(void 0,n)},fn=l.unpack,on=l.type,un=y,cn=g,ln=h,hn=Ut;cn.prototype.lch=function(){return hn(this._rgb)},cn.prototype.hcl=function(){return hn(this._rgb).reverse()},un.lch=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(cn,[null].concat(r,["lch"])))},un.hcl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(cn,[null].concat(r,["hcl"])))},ln.format.lch=tn,ln.format.hcl=an,["lch","hcl"].forEach((function(r){return ln.autodetect.push({p:2,test:function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];if(t=fn(t,r),"array"===on(t)&&3===t.length)return r}})}));var sn={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"},dn=h,bn=l.type,pn=sn,vn=Er,gn=xr;g.prototype.name=function(){for(var r=gn(this._rgb,"rgb"),t=0,n=Object.keys(pn);t<n.length;t+=1){var e=n[t];if(pn[e]===r)return e.toLowerCase()}return r},dn.format.named=function(r){if(r=r.toLowerCase(),pn[r])return vn(pn[r]);throw new Error("unknown color name: "+r)},dn.autodetect.push({p:5,test:function(r){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];if(!t.length&&"string"===bn(r)&&pn[r.toLowerCase()])return"named"}});var mn=l.unpack,yn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=mn(r,"rgb"),e=n[0],a=n[1],f=n[2];return(e<<16)+(a<<8)+f},kn=l.type,wn=function(r){if("number"==kn(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Mn=y,_n=g,Nn=h,xn=l.type,An=yn;_n.prototype.num=function(){return An(this._rgb)},Mn.num=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(_n,[null].concat(r,["num"])))},Nn.format.num=wn,Nn.autodetect.push({p:5,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(1===r.length&&"number"===xn(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Pn=y,En=g,Fn=h,qn=l.unpack,In=l.type,On=Math.round;En.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(On)},En.prototype.rgba=function(r){return void 0===r&&(r=!0),this._rgb.slice(0,4).map((function(t,n){return n<3?!1===r?t:On(t):t}))},Pn.rgb=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(En,[null].concat(r,["rgb"])))},Fn.format.rgb=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=qn(r,"rgba");return void 0===n[3]&&(n[3]=1),n},Fn.autodetect.push({p:3,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=qn(r,"rgba"),"array"===In(r)&&(3===r.length||4===r.length&&"number"==In(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var jn=Math.log,Gn=function(r){var t,n,e,a=r/100;return a<66?(t=255,n=a<6?0:-155.25485562709179-.44596950469579133*(n=a-2)+104.49216199393888*jn(n),e=a<20?0:.8274096064007395*(e=a-10)-254.76935184120902+115.67994401066147*jn(e)):(t=351.97690566805693+.114206453784165*(t=a-55)-40.25366309332127*jn(t),n=325.4494125711974+.07943456536662342*(n=a-50)-28.0852963507957*jn(n),e=255),[t,n,e,1]},Rn=Gn,Ln=l.unpack,Bn=Math.round,Cn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];for(var n,e=Ln(r,"rgb"),a=e[0],f=e[2],o=1e3,u=4e4,c=.4;u-o>c;){var i=Rn(n=.5*(u+o));i[2]/i[0]>=f/a?u=n:o=n}return Bn(n)},Dn=y,Yn=g,Sn=h,Tn=Cn;Yn.prototype.temp=Yn.prototype.kelvin=Yn.prototype.temperature=function(){return Tn(this._rgb)},Dn.temp=Dn.kelvin=Dn.temperature=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Yn,[null].concat(r,["temp"])))},Sn.format.temp=Sn.format.kelvin=Sn.format.temperature=Gn;var $n=l.unpack,zn=Math.cbrt,Xn=Math.pow,Un=Math.sign,Vn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=$n(r,"rgb"),e=n[0],a=n[1],f=n[2],o=[Wn(e/255),Wn(a/255),Wn(f/255)],u=o[0],c=o[1],i=o[2],l=zn(.4122214708*u+.5363325363*c+.0514459929*i),h=zn(.2119034982*u+.6806995451*c+.1073969566*i),s=zn(.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 Wn(r){var t=Math.abs(r);return t<.04045?r/12.92:(Un(r)||1)*Xn((t+.055)/1.055,2.4)}var Kn=l.unpack,Zn=Math.pow,Hn=Math.sign,Jn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=Kn(r,"lab"))[0],e=r[1],a=r[2],f=Zn(n+.3963377774*e+.2158037573*a,3),o=Zn(n-.1055613458*e-.0638541728*a,3),u=Zn(n-.0894841775*e-1.291485548*a,3);return[255*Qn(4.0767416621*f-3.3077115913*o+.2309699292*u),255*Qn(-1.2684380046*f+2.6097574011*o-.3413193965*u),255*Qn(-.0041960863*f-.7034186147*o+1.707614701*u),r.length>3?r[3]:1]};function Qn(r){var t=Math.abs(r);return t>.0031308?(Hn(r)||1)*(1.055*Zn(t,1/2.4)-.055):12.92*r}var re=l.unpack,te=l.type,ne=y,ee=g,ae=h,fe=Vn;ee.prototype.oklab=function(){return fe(this._rgb)},ne.oklab=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(ee,[null].concat(r,["oklab"])))},ae.format.oklab=Jn,ae.autodetect.push({p:3,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=re(r,"oklab"),"array"===te(r)&&3===r.length)return"oklab"}});var oe=l.unpack,ue=Vn,ce=Tt,ie=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=oe(r,"rgb"),e=n[0],a=n[1],f=n[2],o=ue(e,a,f),u=o[0],c=o[1],i=o[2];return ce(u,c,i)},le=l.unpack,he=Ht,se=Jn,de=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=le(r,"lch"))[0],e=r[1],a=r[2],f=he(n,e,a),o=f[0],u=f[1],c=f[2],i=se(o,u,c),l=i[0],h=i[1],s=i[2];return[l,h,s,r.length>3?r[3]:1]},be=l.unpack,pe=l.type,ve=y,ge=g,me=h,ye=ie;ge.prototype.oklch=function(){return ye(this._rgb)},ve.oklch=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(ge,[null].concat(r,["oklch"])))},me.format.oklch=de,me.autodetect.push({p:3,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=be(r,"oklch"),"array"===pe(r)&&3===r.length)return"oklch"}});var ke={};function we(r){return.0031308>=r?12.92*r:1.055*Math.pow(r,.4166666666666667)-.055}function Me(r){return.04045<r?Math.pow((r+.055)/1.055,2.4):r/12.92}function _e(r,t,n){var e=.4122214708*r+.5363325363*t+.0514459929*n,a=.2119034982*r+.6806995451*t+.1073969566*n,f=.0883024619*r+.2817188376*t+.6299787005*n,o=Math.cbrt(e),u=Math.cbrt(a),c=Math.cbrt(f);return[.2104542553*o+.793617785*u-.0040720468*c,1.9779984951*o-2.428592205*u+.4505937099*c,.0259040371*o+.7827717662*u-.808675766*c]}function Ne(r,t,n){var e=r+.3963377774*t+.2158037573*n,a=r-.1055613458*t-.0638541728*n,f=r-.0894841775*t-1.291485548*n,o=e*e*e,u=a*a*a,c=f*f*f;return[4.0767416621*o-3.3077115913*u+.2309699292*c,-1.2684380046*o+2.6097574011*u-.3413193965*c,-.0041960863*o-.7034186147*u+1.707614701*c]}function xe(r){var t=.206,n=1.206/1.03;return.5*(n*r-t+Math.sqrt((n*r-t)*(n*r-t)+.12*n*r))}function Ae(r){return(r*r+.206*r)/(1.170873786407767*(r+.03))}function Pe(r,t){var n=function(r,t){var n,e,a,f,o,u,c,i;-1.88170328*r-.80936493*t>1?(n=1.19086277,e=1.76576728,a=.59662641,f=.75515197,o=.56771245,u=4.0767416621,c=-3.3077115913,i=.2309699292):1.81444104*r-1.19445276*t>1?(n=.73956515,e=-.45954404,a=.08285427,f=.1254107,o=.14503204,u=-1.2684380046,c=2.6097574011,i=-.3413193965):(n=1.35733652,e=-.00915799,a=-1.1513021,f=-.50559606,o=.00692167,u=-.0041960863,c=-.7034186147,i=1.707614701);var l=n+e*r+a*t+f*r*r+o*r*t,h=.3963377774*r+.2158037573*t,s=-.1055613458*r-.0638541728*t,d=-.0894841775*r-1.291485548*t,b=1+l*h,p=1+l*s,v=1+l*d,g=u*(b*b*b)+c*(p*p*p)+i*(v*v*v),m=u*(3*h*b*b)+c*(3*s*p*p)+i*(3*d*v*v);return l-g*m/(m*m-.5*g*(u*(6*h*h*b)+c*(6*s*s*p)+i*(6*d*d*v)))}(r,t),e=Ne(1,n*r,n*t),a=Math.cbrt(1/Math.max(Math.max(e[0],e[1]),e[2]));return[a,a*n]}function Ee(r,t,n){void 0===n&&(n=null),n||(n=Pe(r,t));var e=n[0],a=n[1];return[a/e,a/(1-e)]}function Fe(r,t,n){var e,a=Pe(t,n),f=function(r,t,n,e,a,f){var o;if(void 0===f&&(f=null),f||(f=Pe(r,t)),(n-a)*f[1]-(f[0]-a)*e<=0)o=f[1]*a/(e*f[0]+f[1]*(a-n));else{var u=n-a,c=.3963377774*r+.2158037573*t,i=-.1055613458*r-.0638541728*t,l=-.0894841775*r-1.291485548*t,h=u+e*c,s=u+e*i,d=u+e*l,b=a*(1-(o=f[1]*(a-1)/(e*(f[0]-1)+f[1]*(a-n))))+o*n,p=o*e,v=b+p*c,g=b+p*i,m=b+p*l,y=v*v*v,k=g*g*g,w=m*m*m,M=3*h*v*v,_=3*s*g*g,N=3*d*m*m,x=6*h*h*v,A=6*s*s*g,P=6*d*d*m,E=4.0767416621*y-3.3077115913*k+.2309699292*w-1,F=4.0767416621*M-3.3077115913*_+.2309699292*N,q=F/(F*F-.5*E*(4.0767416621*x-3.3077115913*A+.2309699292*P)),I=-E*q,O=-1.2684380046*y+2.6097574011*k-.3413193965*w-1,j=-1.2684380046*M+2.6097574011*_-.3413193965*N,G=j/(j*j-.5*O*(-1.2684380046*x+2.6097574011*A-.3413193965*P)),R=-O*G,L=-.0041960863*y-.7034186147*k+1.707614701*w-1,B=-.0041960863*M-.7034186147*_+1.707614701*N,C=B/(B*B-.5*L*(-.0041960863*x-.7034186147*A+1.707614701*P)),D=-L*C;I=q>=0?I:1e6,R=G>=0?R:1e6,D=C>=0?D:1e6,o+=Math.min(I,Math.min(R,D))}return o}(t,n,r,1,r,a),o=Ee(t,n,a),u=r*(.11516993+1/(7.4477897+4.1590124*n+t*(1.75198401*n-2.19557347+t*(-2.13704948-10.02301043*n+t*(5.38770819*n-4.24894561+4.69891013*t))))),c=(1-r)*(.11239642+1/(1.6132032-.68124379*n+t*(.40370612+.90148123*n+t*(.6122399*n-.27087943+t*(.00299215-.45399568*n-.14661872*t)))));e=.9*(f/Math.min(r*o[0],(1-r)*o[1]))*Math.sqrt(Math.sqrt(1/(1/(u*u*u*u)+1/(c*c*c*c))));var i=.4*r,l=.8*(1-r);return[Math.sqrt(1/(1/(i*i)+1/(l*l))),e,f]}ke.srgb_to_okhsl=function(r,t,n){var e=_e(Me(r/255),Me(t/255),Me(n/255));console.log({r:r,g:t,b:n,lab:e});var a,f=Math.sqrt(e[1]*e[1]+e[2]*e[2]),o=e[1]/f,u=e[2]/f,c=e[0],i=.5+.5*Math.atan2(-e[2],-e[1])/Math.PI,l=Fe(c,o,u),h=l[0],s=l[1],d=l[2];if(f<s){var b=.8*h;a=.8*((f-0)/(b+(1-b/s)*(f-0)))}else{var p=.2*s*s*1.25*1.25/h;a=.8+.2*((f-s)/(p+(1-p/(d-s))*(f-s)))}return[i,a,xe(c)]},ke.srgb_to_okhsv=function(r,t,n){var e=_e(Me(r/255),Me(t/255),Me(n/255)),a=Math.sqrt(e[1]*e[1]+e[2]*e[2]),f=e[1]/a,o=e[2]/a,u=e[0],c=.5+.5*Math.atan2(-e[2],-e[1])/Math.PI,i=Ee(f,o),l=i[0],h=i[1],s=1-.5/l,d=h/(a+u*h),b=d*u,p=d*a,v=Ae(b),g=p*v/b,m=Ne(v,f*g,o*g),y=Math.cbrt(1/Math.max(m[0],m[1],m[2],0));return a=(a/=y)*xe(u/=y)/u,[c,(.5+h)*p/(.5*h+h*s*p),(u=xe(u))/b]},ke.okhsl_to_srgb=function(r,t,n){if(1==n)return[255,255,255];if(0==n)return[0,0,0];var e,a,f,o,u,c=Math.cos(2*Math.PI*r),i=Math.sin(2*Math.PI*r),l=Ae(n),h=Fe(l,c,i),s=h[0],d=h[1],b=h[2];t<.8?(a=1.25*t,f=0,u=1-(o=.8*s)/d):(a=5*(t-.8),f=d,u=1-(o=.2*d*d*1.25*1.25/s)/(b-d));var p=Ne(l,(e=f+a*o/(1-u*a))*c,e*i);return[255*we(p[0]),255*we(p[1]),255*we(p[2])]},ke.okhsv_to_srgb=function(r,t,n){var e=Math.cos(2*Math.PI*r),a=Math.sin(2*Math.PI*r),f=Ee(e,a),o=f[0],u=.5,c=f[1],i=1-u/o,l=1-t*u/(u+c-c*i*t),h=t*c*u/(u+c-c*i*t),s=n*l,d=n*h,b=Ae(l),p=h*b/l,v=Ae(s);d=d*v/s,s=v;var g=Ne(b,e*p,a*p),m=Math.cbrt(1/Math.max(g[0],g[1],g[2],0)),y=Ne(s*=m,(d*=m)*e,d*a);return[255*we(y[0]),255*we(y[1]),255*we(y[2])]};var qe=l.unpack,Ie=l.type,Oe=y,je=g,Ge=h,Re=ke.srgb_to_okhsl,Le=ke.okhsl_to_srgb;je.prototype.okhsl=function(){var r=Re.apply(void 0,this._rgb);return r[0]=180*r[0],r[1]=Math.min(r[1],1),r[2]=Math.min(r[2],1),r},Oe.okhsl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(je,[null].concat(r,["okhsl"])))},Ge.format.okhsl=function(r){return Le(r[0]/180,r[1],r[2])},Ge.autodetect.push({p:3,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=qe(r,"okhsl"),"array"===Ie(r)&&3===r.length)return"okhsl"}});var Be=l.unpack,Ce=l.type,De=y,Ye=g,Se=h,Te=ke.srgb_to_okhsv,$e=ke.okhsv_to_srgb;Ye.prototype.okhsv=function(){var r=Te.apply(void 0,this._rgb);return r[0]=180*r[0],r[1]=Math.min(r[1],1),r[2]=Math.min(r[2],1),r},De.okhsv=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Ye,[null].concat(r,["okhsv"])))},Se.format.okhsv=function(r){return $e(r[0]/180,r[1],r[2])},Se.autodetect.push({p:3,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=Be(r,"okhsv"),"array"===Ce(r)&&3===r.length)return"okhsv"}});var ze=g,Xe=l.type;ze.prototype.alpha=function(r,t){return void 0===t&&(t=!1),void 0!==r&&"number"===Xe(r)?t?(this._rgb[3]=r,this):new ze([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},g.prototype.clipped=function(){return this._rgb._clipped||!1};var Ue=g,Ve=gt;Ue.prototype.darken=function(r){void 0===r&&(r=1);var t=this.lab();return t[0]-=Ve.Kn*r,new Ue(t,"lab").alpha(this.alpha(),!0)},Ue.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},Ue.prototype.darker=Ue.prototype.darken,Ue.prototype.brighter=Ue.prototype.brighten,g.prototype.get=function(r){var t=r.split("."),n=t[0],e=t[1],a=this[n]();if(e){var f=n.indexOf(e)-("ok"===n.substr(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+e+" in mode "+n)}return a};var We=g,Ke=l.type,Ze=Math.pow;We.prototype.luminance=function(r){if(void 0!==r&&"number"===Ke(r)){if(0===r)return new We([0,0,0,this._rgb[3]],"rgb");if(1===r)return new We([255,255,255,this._rgb[3]],"rgb");var t=this.luminance(),n=20,e=function(t,a){var f=t.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!n--?f:o>r?e(t,f):e(f,a)},a=(t>r?e(new We([0,0,0]),this):e(this,new We([255,255,255]))).rgb();return new We(a.concat([this._rgb[3]]))}return He.apply(void 0,this._rgb.slice(0,3))};var He=function(r,t,n){return.2126*(r=Je(r))+.7152*(t=Je(t))+.0722*(n=Je(n))},Je=function(r){return(r/=255)<=.03928?r/12.92:Ze((r+.055)/1.055,2.4)},Qe={},ra=g,ta=l.type,na=Qe,ea=function(r,t,n){void 0===n&&(n=.5);for(var e=[],a=arguments.length-3;a-- >0;)e[a]=arguments[a+3];var f=e[0]||"lrgb";if(na[f]||e.length||(f=Object.keys(na)[0]),!na[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==ta(r)&&(r=new ra(r)),"object"!==ta(t)&&(t=new ra(t)),na[f](r,t,n).alpha(r.alpha()+n*(t.alpha()-r.alpha()))},aa=g,fa=ea;aa.prototype.mix=aa.prototype.interpolate=function(r,t){void 0===t&&(t=.5);for(var n=[],e=arguments.length-2;e-- >0;)n[e]=arguments[e+2];return fa.apply(void 0,[this,r,t].concat(n))};var oa=g;oa.prototype.premultiply=function(r){void 0===r&&(r=!1);var t=this._rgb,n=t[3];return r?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new oa([t[0]*n,t[1]*n,t[2]*n,n],"rgb")};var ua=g,ca=gt;ua.prototype.saturate=function(r){void 0===r&&(r=1);var t=this.lch();return t[1]+=ca.Kn*r,t[1]<0&&(t[1]=0),new ua(t,"lch").alpha(this.alpha(),!0)},ua.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var ia=g,la=l.type;ia.prototype.set=function(r,t,n){void 0===n&&(n=!1);var e=r.split("."),a=e[0],f=e[1],o=this[a]();if(f){var u=a.indexOf(f)-("ok"===a.substr(0,2)?2:0);if(u>-1){if("string"==la(t))switch(t.charAt(0)){case"+":case"-":o[u]+=+t;break;case"*":o[u]*=+t.substr(1);break;case"/":o[u]/=+t.substr(1);break;default:o[u]=+t}else{if("number"!==la(t))throw new Error("unsupported value for Color.set");o[u]=t}var c=new ia(o,a);return n?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o};var ha=g;Qe.rgb=function(r,t,n){var e=r._rgb,a=t._rgb;return new ha(e[0]+n*(a[0]-e[0]),e[1]+n*(a[1]-e[1]),e[2]+n*(a[2]-e[2]),"rgb")};var sa=g,da=Math.sqrt,ba=Math.pow;Qe.lrgb=function(r,t,n){var e=r._rgb,a=e[0],f=e[1],o=e[2],u=t._rgb,c=u[0],i=u[1],l=u[2];return new sa(da(ba(a,2)*(1-n)+ba(c,2)*n),da(ba(f,2)*(1-n)+ba(i,2)*n),da(ba(o,2)*(1-n)+ba(l,2)*n),"rgb")};var pa=g;Qe.lab=function(r,t,n){var e=r.lab(),a=t.lab();return new pa(e[0]+n*(a[0]-e[0]),e[1]+n*(a[1]-e[1]),e[2]+n*(a[2]-e[2]),"lab")};var va=g,ga=function(r,t,n,e){var a,f,o,u,c,i,l,h,s,d,b,p,v;return"hsl"===e?(o=r.hsl(),u=t.hsl()):"hsv"===e?(o=r.hsv(),u=t.hsv()):"hcg"===e?(o=r.hcg(),u=t.hcg()):"hsi"===e?(o=r.hsi(),u=t.hsi()):"lch"===e||"hcl"===e?(e="hcl",o=r.hcl(),u=t.hcl()):"oklch"===e&&(o=r.oklch().reverse(),u=t.oklch().reverse()),"h"!==e.substr(0,1)&&"oklch"!==e||(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"==e||(b=h)):(p=c,1!=d&&0!=d||"hsv"==e||(b=l)):p=c+n*(i>c&&i-c>180?i-(c+360):i<c&&c-i>180?i+360-c:i-c),void 0===b&&(b=l+n*(h-l)),v=s+n*(d-s),new va("oklch"===e?[v,b,p]:[p,b,v],e)},ma=ga,ya=function(r,t,n){return ma(r,t,n,"lch")};Qe.lch=ya,Qe.hcl=ya;var ka=g;Qe.num=function(r,t,n){var e=r.num(),a=t.num();return new ka(e+n*(a-e),"num")};var wa=ga;Qe.hcg=function(r,t,n){return wa(r,t,n,"hcg")};var Ma=ga;Qe.hsi=function(r,t,n){return Ma(r,t,n,"hsi")};var _a=ga;Qe.hsl=function(r,t,n){return _a(r,t,n,"hsl")};var Na=ga;Qe.hsv=function(r,t,n){return Na(r,t,n,"hsv")};var xa=g;Qe.oklab=function(r,t,n){var e=r.oklab(),a=t.oklab();return new xa(e[0]+n*(a[0]-e[0]),e[1]+n*(a[1]-e[1]),e[2]+n*(a[2]-e[2]),"oklab")};var Aa=ga;Qe.oklch=function(r,t,n){return Aa(r,t,n,"oklch")};var Pa=g,Ea=l.clip_rgb,Fa=Math.pow,qa=Math.sqrt,Ia=Math.PI,Oa=Math.cos,ja=Math.sin,Ga=Math.atan2,Ra=function(r,t){for(var n=r.length,e=[0,0,0,0],a=0;a<r.length;a++){var f=r[a],o=t[a]/n,u=f._rgb;e[0]+=Fa(u[0],2)*o,e[1]+=Fa(u[1],2)*o,e[2]+=Fa(u[2],2)*o,e[3]+=u[3]*o}return e[0]=qa(e[0]),e[1]=qa(e[1]),e[2]=qa(e[2]),e[3]>.9999999&&(e[3]=1),new Pa(Ea(e))},La=y,Ba=l.type,Ca=Math.pow,Da=function(r){var t="rgb",n=La("#ccc"),e=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,h=1,s=!1,d={},b=!0,p=1,v=function(r){if((r=r||["#fff","#000"])&&"string"===Ba(r)&&La.brewer&&La.brewer[r.toLowerCase()]&&(r=La.brewer[r.toLowerCase()]),"array"===Ba(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var t=0;t<r.length;t++)r[t]=La(r[t]);f.length=0;for(var n=0;n<r.length;n++)f.push(n/(r.length-1))}return k(),c=r},g=function(r){return r},m=function(r){return r},y=function(r,e){var a,i;if(null==e&&(e=!1),isNaN(r)||null===r)return n;if(e)i=r;else if(u&&u.length>2){var s=function(r){if(null!=u){for(var t=u.length-1,n=0;n<t&&r>=u[n];)n++;return n-1}return 0}(r);i=s/(u.length-2)}else i=h!==l?(r-l)/(h-l):1;i=m(i),e||(i=g(i)),1!==p&&(i=Ca(i,p)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var v=Math.floor(1e4*i);if(b&&d[v])a=d[v];else{if("array"===Ba(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=La.interpolate(c[y],c[y+1],i,t);break}}else"function"===Ba(c)&&(a=c(i));b&&(d[v]=a)}return a},k=function(){return d={}};v(r);var w=function(r){var t=La(y(r));return i&&t[i]?t[i]():t};return w.classes=function(r){if(null!=r){if("array"===Ba(r))u=r,a=[r[0],r[r.length-1]];else{var t=La.analyze(a);u=0===r?[t.min,t.max]:La.limits(t,"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 t=c.length;if(r.length===t&&l!==h)for(var n=0,e=Array.from(r);n<e.length;n+=1){var o=e[n];f.push((o-l)/(h-l))}else{for(var u=0;u<t;u++)f.push(u/(t-1));if(r.length>2){var i=r.map((function(t,n){return n/(r.length-1)})),s=r.map((function(r){return(r-l)/(h-l)}));s.every((function(r,t){return i[t]===r}))||(m=function(r){if(r<=0||r>=1)return r;for(var t=0;r>=s[t+1];)t++;var n=(r-s[t])/(s[t+1]-s[t]);return i[t]+n*(i[t+1]-i[t])})}}return a=[l,h],w},w.mode=function(r){return arguments.length?(t=r,k(),w):t},w.range=function(r,t){return v(r),w},w.out=function(r){return i=r,w},w.spread=function(r){return arguments.length?(e=r,w):e},w.correctLightness=function(r){return null==r&&(r=!0),s=r,k(),g=s?function(r){for(var t=y(0,!0).lab()[0],n=y(1,!0).lab()[0],e=t>n,a=y(r,!0).lab()[0],f=t+(n-t)*r,o=a-f,u=0,c=1,i=20;Math.abs(o)>.01&&i-- >0;)e&&(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"===Ba(r)&&(r=[r,r]),o=r,w):o},w.colors=function(t,n){arguments.length<2&&(n="hex");var e=[];if(0===arguments.length)e=c.slice(0);else if(1===t)e=[w(.5)];else if(t>1){var f=a[0],o=a[1]-f;e=Ya(0,t,!1).map((function(r){return w(f+r/(t-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;e=i.map((function(r){return w(r)}))}return La[n]&&(e=e.map((function(r){return r[n]()}))),e},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?(n=La(r),w):n},w};function Ya(r,t,n){for(var e=[],a=r<t,f=n?a?t+1:t-1:t,o=r;a?o<f:o>f;a?o++:o--)e.push(o);return e}var Sa=g,Ta=Da,$a=y,za=function(r,t,n){if(!za[n])throw new Error("unknown blend mode "+n);return za[n](r,t)},Xa=function(r){return function(t,n){var e=$a(n).rgb(),a=$a(t).rgb();return $a.rgb(r(e,a))}},Ua=function(r){return function(t,n){var e=[];return e[0]=r(t[0],n[0]),e[1]=r(t[1],n[1]),e[2]=r(t[2],n[2]),e}};za.normal=Xa(Ua((function(r){return r}))),za.multiply=Xa(Ua((function(r,t){return r*t/255}))),za.screen=Xa(Ua((function(r,t){return 255*(1-(1-r/255)*(1-t/255))}))),za.overlay=Xa(Ua((function(r,t){return t<128?2*r*t/255:255*(1-2*(1-r/255)*(1-t/255))}))),za.darken=Xa(Ua((function(r,t){return r>t?t:r}))),za.lighten=Xa(Ua((function(r,t){return r>t?r:t}))),za.dodge=Xa(Ua((function(r,t){return 255===r||(r=t/255*255/(1-r/255))>255?255:r}))),za.burn=Xa(Ua((function(r,t){return 255*(1-(1-t/255)/(r/255))})));for(var Va=za,Wa=l.type,Ka=l.clip_rgb,Za=l.TWOPI,Ha=Math.pow,Ja=Math.sin,Qa=Math.cos,rf=y,tf=g,nf=Math.floor,ef=Math.random,af=o,ff=Math.log,of=Math.pow,uf=Math.floor,cf=Math.abs,lf=function(r,t){void 0===t&&(t=null);var n={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===af(r)&&(r=Object.values(r)),r.forEach((function(r){t&&"object"===af(r)&&(r=r[t]),null==r||isNaN(r)||(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)})),n.domain=[n.min,n.max],n.limits=function(r,t){return hf(n,r,t)},n},hf=function(r,t,n){void 0===t&&(t="equal"),void 0===n&&(n=7),"array"==af(r)&&(r=lf(r));var e=r.min,a=r.max,f=r.values.sort((function(r,t){return r-t}));if(1===n)return[e,a];var o=[];if("c"===t.substr(0,1)&&(o.push(e),o.push(a)),"e"===t.substr(0,1)){o.push(e);for(var u=1;u<n;u++)o.push(e+u/n*(a-e));o.push(a)}else if("l"===t.substr(0,1)){if(e<=0)throw new Error("Logarithmic scales are only possible for values > 0");var c=Math.LOG10E*ff(e),i=Math.LOG10E*ff(a);o.push(e);for(var l=1;l<n;l++)o.push(of(10,c+l/n*(i-c)));o.push(a)}else if("q"===t.substr(0,1)){o.push(e);for(var h=1;h<n;h++){var s=(f.length-1)*h/n,d=uf(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"===t.substr(0,1)){var p,v=f.length,g=new Array(v),m=new Array(n),y=!0,k=0,w=null;(w=[]).push(e);for(var M=1;M<n;M++)w.push(e+M/n*(a-e));for(w.push(a);y;){for(var _=0;_<n;_++)m[_]=0;for(var N=0;N<v;N++)for(var x=f[N],A=Number.MAX_VALUE,P=void 0,E=0;E<n;E++){var F=cf(w[E]-x);F<A&&(A=F,P=E),m[P]++,g[N]=P}for(var q=new Array(n),I=0;I<n;I++)q[I]=null;for(var O=0;O<v;O++)null===q[p=g[O]]?q[p]=f[O]:q[p]+=f[O];for(var j=0;j<n;j++)q[j]*=1/m[j];y=!1;for(var G=0;G<n;G++)if(q[G]!==w[G]){y=!0;break}w=q,++k>200&&(y=!1)}for(var R={},L=0;L<n;L++)R[L]=[];for(var B=0;B<v;B++)R[p=g[B]].push(f[B]);for(var C=[],D=0;D<n;D++)C.push(R[D][0]),C.push(R[D][R[D].length-1]);C=C.sort((function(r,t){return r-t})),o.push(C[0]);for(var Y=1;Y<C.length;Y+=2){var S=C[Y];isNaN(S)||-1!==o.indexOf(S)||o.push(S)}}return o},sf={analyze:lf,limits:hf},df=g,bf=g,pf=Math.sqrt,vf=Math.pow,gf=Math.min,mf=Math.max,yf=Math.atan2,kf=Math.abs,wf=Math.cos,Mf=Math.sin,_f=Math.exp,Nf=Math.PI,xf=g,Af=g,Pf=y,Ef=Da,Ff={cool:function(){return Ef([Pf.hsl(180,1,.9),Pf.hsl(250,.7,.4)])},hot:function(){return Ef(["#000","#f00","#ff0","#fff"]).mode("rgb")}},qf={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"]},If=0,Of=Object.keys(qf);If<Of.length;If+=1){var jf=Of[If];qf[jf.toLowerCase()]=qf[jf]}var Gf=qf,Rf=y;return Rf.average=function(r,t,n){void 0===t&&(t="lrgb"),void 0===n&&(n=null);var e=r.length;n||(n=Array.from(new Array(e)).map((function(){return 1})));var a=e/n.reduce((function(r,t){return r+t}));if(n.forEach((function(r,t){n[t]*=a})),r=r.map((function(r){return new Pa(r)})),"lrgb"===t)return Ra(r,n);for(var f=r.shift(),o=f.get(t),u=[],c=0,i=0,l=0;l<o.length;l++)if(o[l]=(o[l]||0)*n[0],u.push(isNaN(o[l])?0:n[0]),"h"===t.charAt(l)&&!isNaN(o[l])){var h=o[l]/180*Ia;c+=Oa(h)*n[0],i+=ja(h)*n[0]}var s=f.alpha()*n[0];r.forEach((function(r,e){var a=r.get(t);s+=r.alpha()*n[e+1];for(var f=0;f<o.length;f++)if(!isNaN(a[f]))if(u[f]+=n[e+1],"h"===t.charAt(f)){var l=a[f]/180*Ia;c+=Oa(l)*n[e+1],i+=ja(l)*n[e+1]}else o[f]+=a[f]*n[e+1]}));for(var d=0;d<o.length;d++)if("h"===t.charAt(d)){for(var b=Ga(i/u[d],c/u[d])/Ia*180;b<0;)b+=360;for(;b>=360;)b-=360;o[d]=b}else o[d]=o[d]/u[d];return s/=e,new Pa(o,t).alpha(s>.99999?1:s,!0)},Rf.bezier=function(r){var t=function(r){var t,n,e,a,f,o,u;if(2===(r=r.map((function(r){return new Sa(r)}))).length)t=r.map((function(r){return r.lab()})),f=t[0],o=t[1],a=function(r){var t=[0,1,2].map((function(t){return f[t]+r*(o[t]-f[t])}));return new Sa(t,"lab")};else if(3===r.length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],u=n[2],a=function(r){var t=[0,1,2].map((function(t){return(1-r)*(1-r)*f[t]+2*(1-r)*r*o[t]+r*r*u[t]}));return new Sa(t,"lab")};else if(4===r.length){var c;e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],c=e[3],a=function(r){var t=[0,1,2].map((function(t){return(1-r)*(1-r)*(1-r)*f[t]+3*(1-r)*(1-r)*r*o[t]+3*(1-r)*r*r*u[t]+r*r*r*c[t]}));return new Sa(t,"lab")}}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 t=[1,1],n=1;n<r;n++){for(var e=[1],a=1;a<=t.length;a++)e[a]=(t[a]||0)+t[a-1];t=e}return t}(h),a=function(r){var t=1-r,n=[0,1,2].map((function(n){return i.reduce((function(e,a,f){return e+l[f]*Math.pow(t,h-f)*Math.pow(r,f)*a[n]}),0)}));return new Sa(n,"lab")}}return a}(r);return t.scale=function(){return Ta(t)},t},Rf.blend=Va,Rf.cubehelix=function(r,t,n,e,a){void 0===r&&(r=300),void 0===t&&(t=-1.5),void 0===n&&(n=1),void 0===e&&(e=1),void 0===a&&(a=[0,1]);var f,o=0;"array"===Wa(a)?f=a[1]-a[0]:(f=0,a=[a,a]);var u=function(u){var c=Za*((r+120)/360+t*u),i=Ha(a[0]+f*u,e),l=(0!==o?n[0]+u*o:n)*i*(1-i)/2,h=Qa(c),s=Ja(c);return rf(Ka([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(t){return null==t?r:(r=t,u)},u.rotations=function(r){return null==r?t:(t=r,u)},u.gamma=function(r){return null==r?e:(e=r,u)},u.hue=function(r){return null==r?n:("array"===Wa(n=r)?0===(o=n[1]-n[0])&&(n=n[1]):o=0,u)},u.lightness=function(r){return null==r?a:("array"===Wa(r)?(a=r,f=r[1]-r[0]):(a=[r,r],f=0),u)},u.scale=function(){return rf.scale(u)},u.hue(n),u},Rf.mix=Rf.interpolate=ea,Rf.random=function(){for(var r="#",t=0;t<6;t++)r+="0123456789abcdef".charAt(nf(16*ef()));return new tf(r,"hex")},Rf.scale=Da,Rf.analyze=sf.analyze,Rf.contrast=function(r,t){r=new df(r),t=new df(t);var n=r.luminance(),e=t.luminance();return n>e?(n+.05)/(e+.05):(e+.05)/(n+.05)},Rf.deltaE=function(r,t,n,e,a){void 0===n&&(n=1),void 0===e&&(e=1),void 0===a&&(a=1);var f=function(r){return 360*r/(2*Nf)},o=function(r){return 2*Nf*r/360};r=new bf(r),t=new bf(t);var u=Array.from(r.lab()),c=u[0],i=u[1],l=u[2],h=Array.from(t.lab()),s=h[0],d=h[1],b=h[2],p=(c+s)/2,v=(pf(vf(i,2)+vf(l,2))+pf(vf(d,2)+vf(b,2)))/2,g=.5*(1-pf(vf(v,7)/(vf(v,7)+vf(25,7)))),m=i*(1+g),y=d*(1+g),k=pf(vf(m,2)+vf(l,2)),w=pf(vf(y,2)+vf(b,2)),M=(k+w)/2,_=f(yf(l,m)),N=f(yf(b,y)),x=_>=0?_:_+360,A=N>=0?N:N+360,P=kf(x-A)>180?(x+A+360)/2:(x+A)/2,E=1-.17*wf(o(P-30))+.24*wf(o(2*P))+.32*wf(o(3*P+6))-.2*wf(o(4*P-63)),F=A-x;F=kf(F)<=180?F:A<=x?F+360:F-360,F=2*pf(k*w)*Mf(o(F)/2);var q=s-c,I=w-k,O=1+.015*vf(p-50,2)/pf(20+vf(p-50,2)),j=1+.045*M,G=1+.015*M*E,R=30*_f(-vf((P-275)/25,2)),L=-(2*pf(vf(M,7)/(vf(M,7)+vf(25,7))))*Mf(2*o(R)),B=pf(vf(q/(n*O),2)+vf(I/(e*j),2)+vf(F/(a*G),2)+L*(I/(e*j))*(F/(a*G)));return mf(0,gf(100,B))},Rf.distance=function(r,t,n){void 0===n&&(n="lab"),r=new xf(r),t=new xf(t);var e=r.get(n),a=t.get(n),f=0;for(var o in e){var u=(e[o]||0)-(a[o]||0);f+=u*u}return Math.sqrt(f)},Rf.limits=sf.limits,Rf.valid=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];try{return new(Function.prototype.bind.apply(Af,[null].concat(r))),!0}catch(r){return!1}},Rf.scales=Ff,Rf.colors=sn,Rf.brewer=Gf,Rf}));