tailwind-material-colors
Version:
TailwindCSS Plugin to use the Material 3 Color System with Tailwind
195 lines • 99.8 kB
JavaScript
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/
function r(r){return r<0?-1:0===r?0:1}function t(r,t,n){return(1-n)*r+n*t}function n(r){return(r%=360)<0&&(r+=360),r}function e(r,t){return[r[0]*t[0][0]+r[1]*t[0][1]+r[2]*t[0][2],r[0]*t[1][0]+r[1]*t[1][1]+r[2]*t[1][2],r[0]*t[2][0]+r[1]*t[2][1]+r[2]*t[2][2]]}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/const a=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],o=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],i=[95.047,100,108.883];function c(r,t,n){return(255<<24|(255&r)<<16|(255&t)<<8|255&n)>>>0}function s(r){return c(b(r[0]),b(r[1]),b(r[2]))}function u(r){return r>>16&255}function l(r){return r>>8&255}function f(r){return 255&r}function h(r){const t=function(r){return e([p(u(r)),p(l(r)),p(f(r))],a)}(r)[1];return 116*function(r){const t=24389/27;return r>216/24389?Math.pow(r,1/3):(t*r+16)/116}(t/100)-16}function d(r){return 100*function(r){const t=24389/27,n=r*r*r;return n>216/24389?n:(116*r-16)/t}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/((r+16)/116)}function p(r){const t=r/255;return t<=.040449936?t/12.92*100:100*Math.pow((t+.055)/1.055,2.4)}function b(r){const t=r/100;let n=0;return n=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,e=0,a=255,(o=Math.round(255*n))<e?e:o>a?a:o;var e,a,o}class g{constructor(r,t,n,e,a,o,i,c,s,u){this.n=r,this.aw=t,this.nbb=n,this.ncb=e,this.c=a,this.nc=o,this.rgbD=i,this.fl=c,this.fLRoot=s,this.z=u}static make(r=function(){return i}(),n=200/Math.PI*d(50)/100,e=50,a=2,o=!1){const c=r,s=.401288*c[0]+.650173*c[1]+-.051461*c[2],u=-.250268*c[0]+1.204414*c[1]+.045854*c[2],l=-.002079*c[0]+.048952*c[1]+.953127*c[2],f=.8+a/10,h=f>=.9?t(.59,.69,10*(f-.9)):t(.525,.59,10*(f-.8));let p=o?1:f*(1-1/3.6*Math.exp((-n-42)/92));p=p>1?1:p<0?0:p;const b=f,v=[p*(100/s)+1-p,p*(100/u)+1-p,p*(100/l)+1-p],m=1/(5*n+1),y=m*m*m*m,w=1-y,M=y*n+.1*w*w*Math.cbrt(5*n),k=d(e)/r[1],C=1.48+Math.sqrt(k),I=.725/Math.pow(k,.2),x=I,A=[Math.pow(M*v[0]*s/100,.42),Math.pow(M*v[1]*u/100,.42),Math.pow(M*v[2]*l/100,.42)],O=[400*A[0]/(A[0]+27.13),400*A[1]/(A[1]+27.13),400*A[2]/(A[2]+27.13)];return new g(k,(2*O[0]+O[1]+.05*O[2])*I,I,x,h,b,v,M,Math.pow(M,.25),C)}}g.DEFAULT=g.make();
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/
class v{constructor(r,t,n,e,a,o,i,c,s){this.hue=r,this.chroma=t,this.j=n,this.q=e,this.m=a,this.s=o,this.jstar=i,this.astar=c,this.bstar=s}distance(r){const t=this.jstar-r.jstar,n=this.astar-r.astar,e=this.bstar-r.bstar,a=Math.sqrt(t*t+n*n+e*e);return 1.41*Math.pow(a,.63)}static fromInt(r){return v.fromIntInViewingConditions(r,g.DEFAULT)}static fromIntInViewingConditions(t,n){const e=(65280&t)>>8,a=255&t,o=p((16711680&t)>>16),i=p(e),c=p(a),s=.41233895*o+.35762064*i+.18051042*c,u=.2126*o+.7152*i+.0722*c,l=.01932141*o+.11916382*i+.95034478*c,f=.401288*s+.650173*u-.051461*l,h=-.250268*s+1.204414*u+.045854*l,d=-.002079*s+.048952*u+.953127*l,b=n.rgbD[0]*f,g=n.rgbD[1]*h,m=n.rgbD[2]*d,y=Math.pow(n.fl*Math.abs(b)/100,.42),w=Math.pow(n.fl*Math.abs(g)/100,.42),M=Math.pow(n.fl*Math.abs(m)/100,.42),k=400*r(b)*y/(y+27.13),C=400*r(g)*w/(w+27.13),I=400*r(m)*M/(M+27.13),x=(11*k+-12*C+I)/11,A=(k+C-2*I)/9,O=(20*k+20*C+21*I)/20,N=(40*k+20*C+I)/20,_=180*Math.atan2(A,x)/Math.PI,j=_<0?_+360:_>=360?_-360:_,S=j*Math.PI/180,F=N*n.nbb,P=100*Math.pow(F/n.aw,n.c*n.z),E=4/n.c*Math.sqrt(P/100)*(n.aw+4)*n.fLRoot,$=j<20.14?j+360:j,R=5e4/13*(.25*(Math.cos($*Math.PI/180+2)+3.8))*n.nc*n.ncb*Math.sqrt(x*x+A*A)/(O+.305),L=Math.pow(R,.9)*Math.pow(1.64-Math.pow(.29,n.n),.73),T=L*Math.sqrt(P/100),q=T*n.fLRoot,D=50*Math.sqrt(L*n.c/(n.aw+4)),B=(1+100*.007)*P/(1+.007*P),z=1/.0228*Math.log(1+.0228*q),G=z*Math.cos(S),U=z*Math.sin(S);return new v(j,T,P,E,q,D,B,G,U)}static fromJch(r,t,n){return v.fromJchInViewingConditions(r,t,n,g.DEFAULT)}static fromJchInViewingConditions(r,t,n,e){const a=4/e.c*Math.sqrt(r/100)*(e.aw+4)*e.fLRoot,o=t*e.fLRoot,i=t/Math.sqrt(r/100),c=50*Math.sqrt(i*e.c/(e.aw+4)),s=n*Math.PI/180,u=(1+100*.007)*r/(1+.007*r),l=1/.0228*Math.log(1+.0228*o),f=l*Math.cos(s),h=l*Math.sin(s);return new v(n,t,r,a,o,c,u,f,h)}static fromUcs(r,t,n){return v.fromUcsInViewingConditions(r,t,n,g.DEFAULT)}static fromUcsInViewingConditions(r,t,n,e){const a=t,o=n,i=Math.sqrt(a*a+o*o),c=(Math.exp(.0228*i)-1)/.0228/e.fLRoot;let s=Math.atan2(o,a)*(180/Math.PI);s<0&&(s+=360);const u=r/(1-.007*(r-100));return v.fromJchInViewingConditions(u,c,s,e)}toInt(){return this.viewed(g.DEFAULT)}viewed(t){const n=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),e=Math.pow(n/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),a=this.hue*Math.PI/180,i=.25*(Math.cos(a+2)+3.8),s=t.aw*Math.pow(this.j/100,1/t.c/t.z),u=i*(5e4/13)*t.nc*t.ncb,l=s/t.nbb,f=Math.sin(a),h=Math.cos(a),d=23*(l+.305)*e/(23*u+11*e*h+108*e*f),p=d*h,g=d*f,v=(460*l+451*p+288*g)/1403,m=(460*l-891*p-261*g)/1403,y=(460*l-220*p-6300*g)/1403,w=Math.max(0,27.13*Math.abs(v)/(400-Math.abs(v))),M=r(v)*(100/t.fl)*Math.pow(w,1/.42),k=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),C=r(m)*(100/t.fl)*Math.pow(k,1/.42),I=Math.max(0,27.13*Math.abs(y)/(400-Math.abs(y))),x=r(y)*(100/t.fl)*Math.pow(I,1/.42),A=M/t.rgbD[0],O=C/t.rgbD[1],N=x/t.rgbD[2],_=function(r,t,n){const e=o,a=e[0][0]*r+e[0][1]*t+e[0][2]*n,i=e[1][0]*r+e[1][1]*t+e[1][2]*n,s=e[2][0]*r+e[2][1]*t+e[2][2]*n;return c(b(a),b(i),b(s))}(1.86206786*A-1.01125463*O+.14918677*N,.38752654*A+.62144744*O-.00897398*N,-.0158415*A-.03412294*O+1.04996444*N);return _}}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/class m{static sanitizeRadians(r){return(r+8*Math.PI)%(2*Math.PI)}static trueDelinearized(r){const t=r/100;let n=0;return n=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,255*n}static chromaticAdaptation(t){const n=Math.pow(Math.abs(t),.42);return 400*r(t)*n/(n+27.13)}static hueOf(r){const t=e(r,m.SCALED_DISCOUNT_FROM_LINRGB),n=m.chromaticAdaptation(t[0]),a=m.chromaticAdaptation(t[1]),o=m.chromaticAdaptation(t[2]),i=(11*n+-12*a+o)/11,c=(n+a-2*o)/9;return Math.atan2(c,i)}static areInCyclicOrder(r,t,n){return m.sanitizeRadians(t-r)<m.sanitizeRadians(n-r)}static intercept(r,t,n){return(t-r)/(n-r)}static lerpPoint(r,t,n){return[r[0]+(n[0]-r[0])*t,r[1]+(n[1]-r[1])*t,r[2]+(n[2]-r[2])*t]}static setCoordinate(r,t,n,e){const a=m.intercept(r[e],t,n[e]);return m.lerpPoint(r,a,n)}static isBounded(r){return 0<=r&&r<=100}static nthVertex(r,t){const n=m.Y_FROM_LINRGB[0],e=m.Y_FROM_LINRGB[1],a=m.Y_FROM_LINRGB[2],o=t%4<=1?0:100,i=t%2==0?0:100;if(t<4){const t=o,c=i,s=(r-t*e-c*a)/n;return m.isBounded(s)?[s,t,c]:[-1,-1,-1]}if(t<8){const t=o,c=i,s=(r-c*n-t*a)/e;return m.isBounded(s)?[c,s,t]:[-1,-1,-1]}{const t=o,c=i,s=(r-t*n-c*e)/a;return m.isBounded(s)?[t,c,s]:[-1,-1,-1]}}static bisectToSegment(r,t){let n=[-1,-1,-1],e=n,a=0,o=0,i=!1,c=!0;for(let s=0;s<12;s++){const u=m.nthVertex(r,s);if(u[0]<0)continue;const l=m.hueOf(u);i?(c||m.areInCyclicOrder(a,l,o))&&(c=!1,m.areInCyclicOrder(a,t,l)?(e=u,o=l):(n=u,a=l)):(n=u,e=u,a=l,o=l,i=!0)}return[n,e]}static midpoint(r,t){return[(r[0]+t[0])/2,(r[1]+t[1])/2,(r[2]+t[2])/2]}static criticalPlaneBelow(r){return Math.floor(r-.5)}static criticalPlaneAbove(r){return Math.ceil(r-.5)}static bisectToLimit(r,t){const n=m.bisectToSegment(r,t);let e=n[0],a=m.hueOf(e),o=n[1];for(let r=0;r<3;r++)if(e[r]!==o[r]){let n=-1,i=255;e[r]<o[r]?(n=m.criticalPlaneBelow(m.trueDelinearized(e[r])),i=m.criticalPlaneAbove(m.trueDelinearized(o[r]))):(n=m.criticalPlaneAbove(m.trueDelinearized(e[r])),i=m.criticalPlaneBelow(m.trueDelinearized(o[r])));for(let c=0;c<8&&!(Math.abs(i-n)<=1);c++){const c=Math.floor((n+i)/2),s=m.CRITICAL_PLANES[c],u=m.setCoordinate(e,s,o,r),l=m.hueOf(u);m.areInCyclicOrder(a,t,l)?(o=u,i=c):(e=u,a=l,n=c)}}return m.midpoint(e,o)}static inverseChromaticAdaptation(t){const n=Math.abs(t),e=Math.max(0,27.13*n/(400-n));return r(t)*Math.pow(e,1/.42)}static findResultByJ(r,t,n){let a=11*Math.sqrt(n);const o=g.DEFAULT,i=1/Math.pow(1.64-Math.pow(.29,o.n),.73),c=.25*(Math.cos(r+2)+3.8)*(5e4/13)*o.nc*o.ncb,u=Math.sin(r),l=Math.cos(r);for(let r=0;r<5;r++){const f=a/100,h=0===t||0===a?0:t/Math.sqrt(f),d=Math.pow(h*i,1/.9),p=o.aw*Math.pow(f,1/o.c/o.z)/o.nbb,b=23*(p+.305)*d/(23*c+11*d*l+108*d*u),g=b*l,v=b*u,y=(460*p+451*g+288*v)/1403,w=(460*p-891*g-261*v)/1403,M=(460*p-220*g-6300*v)/1403,k=e([m.inverseChromaticAdaptation(y),m.inverseChromaticAdaptation(w),m.inverseChromaticAdaptation(M)],m.LINRGB_FROM_SCALED_DISCOUNT);if(k[0]<0||k[1]<0||k[2]<0)return 0;const C=m.Y_FROM_LINRGB[0],I=m.Y_FROM_LINRGB[1],x=m.Y_FROM_LINRGB[2],A=C*k[0]+I*k[1]+x*k[2];if(A<=0)return 0;if(4===r||Math.abs(A-n)<.002)return k[0]>100.01||k[1]>100.01||k[2]>100.01?0:s(k);a-=(A-n)*a/(2*A)}return 0}static solveToInt(r,t,e){if(t<1e-4||e<1e-4||e>99.9999)return function(r){const t=b(d(r));return c(t,t,t)}(e);const a=(r=n(r))/180*Math.PI,o=d(e),i=m.findResultByJ(a,t,o);if(0!==i)return i;return s(m.bisectToLimit(o,a))}static solveToCam(r,t,n){return v.fromInt(m.solveToInt(r,t,n))}}m.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],m.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],m.Y_FROM_LINRGB=[.2126,.7152,.0722],m.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/
class y{constructor(r){this.argb=r;const t=v.fromInt(r);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=h(r),this.argb=r}static from(r,t,n){return new y(m.solveToInt(r,t,n))}static fromInt(r){return new y(r)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(r){this.setInternalState(m.solveToInt(r,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(r){this.setInternalState(m.solveToInt(this.internalHue,r,this.internalTone))}get tone(){return this.internalTone}set tone(r){this.setInternalState(m.solveToInt(this.internalHue,this.internalChroma,r))}setInternalState(r){const t=v.fromInt(r);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=h(r),this.argb=r}}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/class w{static harmonize(r,t){const e=y.fromInt(r),a=y.fromInt(t),o=(i=e.hue,c=a.hue,180-Math.abs(Math.abs(i-c)-180));var i,c;const s=Math.min(.5*o,15),u=n(e.hue+s*(l=e.hue,n(a.hue-l)<=180?1:-1));var l;return y.from(u,e.chroma,e.tone).toInt()}static hctHue(r,t,n){const e=w.cam16Ucs(r,t,n),a=v.fromInt(e),o=v.fromInt(r);return y.from(a.hue,o.chroma,h(r)).toInt()}static cam16Ucs(r,t,n){const e=v.fromInt(r),a=v.fromInt(t),o=e.jstar,i=e.astar,c=e.bstar,s=o+(a.jstar-o)*n,u=i+(a.astar-i)*n,l=c+(a.bstar-c)*n;return v.fromUcs(s,u,l).toInt()}}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/class M{constructor(r,t){this.hue=r,this.chroma=t,this.cache=new Map}static fromInt(r){const t=y.fromInt(r);return M.fromHueAndChroma(t.hue,t.chroma)}static fromHueAndChroma(r,t){return new M(r,t)}tone(r){let t=this.cache.get(r);return void 0===t&&(t=y.from(this.hue,this.chroma,r).toInt(),this.cache.set(r,t)),t}}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/class k{constructor(r,t){const n=y.fromInt(r),e=n.hue,a=n.chroma;t?(this.a1=M.fromHueAndChroma(e,a),this.a2=M.fromHueAndChroma(e,a/3),this.a3=M.fromHueAndChroma(e+60,a/2),this.n1=M.fromHueAndChroma(e,Math.min(a/12,4)),this.n2=M.fromHueAndChroma(e,Math.min(a/6,8))):(this.a1=M.fromHueAndChroma(e,Math.max(48,a)),this.a2=M.fromHueAndChroma(e,16),this.a3=M.fromHueAndChroma(e+60,24),this.n1=M.fromHueAndChroma(e,4),this.n2=M.fromHueAndChroma(e,8)),this.error=M.fromHueAndChroma(25,84)}static of(r){return new k(r,!1)}static contentOf(r){return new k(r,!0)}}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/class C{constructor(r){this.props=r}get primary(){return this.props.primary}get onPrimary(){return this.props.onPrimary}get primaryContainer(){return this.props.primaryContainer}get onPrimaryContainer(){return this.props.onPrimaryContainer}get secondary(){return this.props.secondary}get onSecondary(){return this.props.onSecondary}get secondaryContainer(){return this.props.secondaryContainer}get onSecondaryContainer(){return this.props.onSecondaryContainer}get tertiary(){return this.props.tertiary}get onTertiary(){return this.props.onTertiary}get tertiaryContainer(){return this.props.tertiaryContainer}get onTertiaryContainer(){return this.props.onTertiaryContainer}get error(){return this.props.error}get onError(){return this.props.onError}get errorContainer(){return this.props.errorContainer}get onErrorContainer(){return this.props.onErrorContainer}get background(){return this.props.background}get onBackground(){return this.props.onBackground}get surface(){return this.props.surface}get onSurface(){return this.props.onSurface}get surfaceVariant(){return this.props.surfaceVariant}get onSurfaceVariant(){return this.props.onSurfaceVariant}get outline(){return this.props.outline}get outlineVariant(){return this.props.outlineVariant}get shadow(){return this.props.shadow}get scrim(){return this.props.scrim}get inverseSurface(){return this.props.inverseSurface}get inverseOnSurface(){return this.props.inverseOnSurface}get inversePrimary(){return this.props.inversePrimary}static light(r){return C.lightFromCorePalette(k.of(r))}static dark(r){return C.darkFromCorePalette(k.of(r))}static lightContent(r){return C.lightFromCorePalette(k.contentOf(r))}static darkContent(r){return C.darkFromCorePalette(k.contentOf(r))}static lightFromCorePalette(r){return new C({primary:r.a1.tone(40),onPrimary:r.a1.tone(100),primaryContainer:r.a1.tone(90),onPrimaryContainer:r.a1.tone(10),secondary:r.a2.tone(40),onSecondary:r.a2.tone(100),secondaryContainer:r.a2.tone(90),onSecondaryContainer:r.a2.tone(10),tertiary:r.a3.tone(40),onTertiary:r.a3.tone(100),tertiaryContainer:r.a3.tone(90),onTertiaryContainer:r.a3.tone(10),error:r.error.tone(40),onError:r.error.tone(100),errorContainer:r.error.tone(90),onErrorContainer:r.error.tone(10),background:r.n1.tone(99),onBackground:r.n1.tone(10),surface:r.n1.tone(99),onSurface:r.n1.tone(10),surfaceVariant:r.n2.tone(90),onSurfaceVariant:r.n2.tone(30),outline:r.n2.tone(50),outlineVariant:r.n2.tone(80),shadow:r.n1.tone(0),scrim:r.n1.tone(0),inverseSurface:r.n1.tone(20),inverseOnSurface:r.n1.tone(95),inversePrimary:r.a1.tone(80)})}static darkFromCorePalette(r){return new C({primary:r.a1.tone(80),onPrimary:r.a1.tone(20),primaryContainer:r.a1.tone(30),onPrimaryContainer:r.a1.tone(90),secondary:r.a2.tone(80),onSecondary:r.a2.tone(20),secondaryContainer:r.a2.tone(30),onSecondaryContainer:r.a2.tone(90),tertiary:r.a3.tone(80),onTertiary:r.a3.tone(20),tertiaryContainer:r.a3.tone(30),onTertiaryContainer:r.a3.tone(90),error:r.error.tone(80),onError:r.error.tone(20),errorContainer:r.error.tone(30),onErrorContainer:r.error.tone(80),background:r.n1.tone(10),onBackground:r.n1.tone(90),surface:r.n1.tone(10),onSurface:r.n1.tone(90),surfaceVariant:r.n2.tone(30),onSurfaceVariant:r.n2.tone(80),outline:r.n2.tone(60),outlineVariant:r.n2.tone(30),shadow:r.n1.tone(0),scrim:r.n1.tone(0),inverseSurface:r.n1.tone(90),inverseOnSurface:r.n1.tone(20),inversePrimary:r.a1.tone(40)})}toJSON(){return Object.assign({},this.props)}}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/const I=r=>{const t=u(r),n=l(r),e=f(r),a=[t.toString(16),n.toString(16),e.toString(16)];for(const[r,t]of a.entries())1===t.length&&(a[r]="0"+t);return"#"+a.join("")},x=r=>{const t=3===(r=r.replace("#","")).length,n=6===r.length,e=8===r.length;if(!t&&!n&&!e)throw new Error("unexpected hex "+r);let a=0,o=0,i=0;return t?(a=A(r.slice(0,1).repeat(2)),o=A(r.slice(1,2).repeat(2)),i=A(r.slice(2,3).repeat(2))):n?(a=A(r.slice(0,2)),o=A(r.slice(2,4)),i=A(r.slice(4,6))):e&&(a=A(r.slice(2,4)),o=A(r.slice(4,6)),i=A(r.slice(6,8))),(255<<24|(255&a)<<16|(255&o)<<8|255&i)>>>0};function A(r){return parseInt(r,16)}
/**
* @license
* Copyright 2021 Google LLC
*
* 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.
*/const O=r=>r.split("").map(((r,t)=>r.toUpperCase()===r?`${0!==t?"-":""}${r.toLowerCase()}`:r)).join(""),N=r=>{const{primary:t,...n}=r,e=x(t),a=C.light(e),o=C.dark(e);a.props.onInverseSurface=a.props.inverseOnSurface,delete a.props.inverseOnSurface,o.onInverseSurface=o.props.inverseOnSurface,delete o.props.inverseOnSurface;const i={transparent:"transparent",current:"currentColor",black:"#000000",white:"#ffffff"};return Object.keys(a.props).forEach((r=>{if(!["shadow","scrim"].includes(r)){const t=O(r);i[`${t}-light`]=I(a.props[r]),i[`${t}-dark`]=I(o.props[r])}})),Object.keys(n).forEach((r=>{const t=n[r],a="string"==typeof t?t:t.hex,o=t===a||t.harmonize,{light:c,dark:s}=function(r,t){let n=t.value;const e=n,a=r;t.blend&&(n=w.harmonize(e,a));const o=k.of(n).a1;return{color:t,value:n,light:{color:o.tone(40),onColor:o.tone(100),colorContainer:o.tone(90),onColorContainer:o.tone(10)},dark:{color:o.tone(80),onColor:o.tone(20),colorContainer:o.tone(30),onColorContainer:o.tone(90)}}}(e,{value:x(a),blend:o}),u=O(r);i[`${u}-light`]=I(c.color),i[`on-${u}-light`]=I(c.onColor),i[`${u}-container-light`]=I(c.colorContainer),i[`on-${u}-container-light`]=I(c.onColorContainer),i[`${u}-dark`]=I(s.color),i[`on-${u}-dark`]=I(s.onColor),i[`${u}-container-dark`]=I(s.colorContainer),i[`on-${u}-container-dark`]=I(s.onColorContainer)})),i};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var _={exports:{}};_.exports=function(){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=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},e={},a=0,o=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];a<o.length;a+=1){var i=o[a];e["[object "+i+"]"]=i.toLowerCase()}var c=function(r){return e[Object.prototype.toString.call(r)]||"object"},s=c,u=function(r,t){return void 0===t&&(t=null),r.length>=3?Array.prototype.slice.call(r):"object"==s(r[0])&&t?t.split("").filter((function(t){return void 0!==r[0][t]})).map((function(t){return r[0][t]})):r[0]},l=c,f=function(r){if(r.length<2)return null;var t=r.length-1;return"string"==l(r[t])?r[t].toLowerCase():null},h=Math.PI,d={clip_rgb:n,limit:r,type:c,unpack:u,last:f,PI:h,TWOPI:2*h,PITHIRD:h/3,DEG2RAD:h/180,RAD2DEG:180/h},p={format:{},autodetect:[]},b=d.last,g=d.clip_rgb,v=d.type,m=p,y=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=this;if("object"===v(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];var e=b(r),a=!1;if(!e){a=!0,m.sorted||(m.autodetect=m.autodetect.sort((function(r,t){return t.p-r.p})),m.sorted=!0);for(var o=0,i=m.autodetect;o<i.length;o+=1){var c=i[o];if(e=c.test.apply(c,r))break}}if(!m.format[e])throw new Error("unknown format: "+r);var s=m.format[e].apply(null,a?r:r.slice(0,-1));n._rgb=g(s),3===n._rgb.length&&n._rgb.push(1)};y.prototype.toString=function(){return"function"==v(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var w=y,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=w,M.version="2.4.2";var k=M,C=d.unpack,I=Math.max,x=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=C(r,"rgb"),e=n[0],a=n[1],o=n[2],i=1-I(e/=255,I(a/=255,o/=255)),c=i<1?1/(1-i):0;return[(1-e-i)*c,(1-a-i)*c,(1-o-i)*c,i]},A=x,O=d.unpack,N=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=O(r,"cmyk"))[0],e=r[1],a=r[2],o=r[3],i=r.length>4?r[4]:1;return 1===o?[0,0,0,i]:[n>=1?0:255*(1-n)*(1-o),e>=1?0:255*(1-e)*(1-o),a>=1?0:255*(1-a)*(1-o),i]},_=N,j=k,S=w,F=p,P=d.unpack,E=d.type,$=A;S.prototype.cmyk=function(){return $(this._rgb)},j.cmyk=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(S,[null].concat(r,["cmyk"])))},F.format.cmyk=_,F.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=P(r,"cmyk"),"array"===E(r)&&4===r.length)return"cmyk"}});var R=d.unpack,L=d.last,T=function(r){return Math.round(100*r)/100},q=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=R(r,"hsla"),e=L(r)||"lsa";return n[0]=T(n[0]||0),n[1]=T(100*n[1])+"%",n[2]=T(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(",")+")"},D=q,B=d.unpack,z=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=B(r,"rgba"))[0],e=r[1],a=r[2];n/=255,e/=255,a/=255;var o,i,c=Math.min(n,e,a),s=Math.max(n,e,a),u=(s+c)/2;return s===c?(o=0,i=Number.NaN):o=u<.5?(s-c)/(s+c):(s-c)/(2-s-c),n==s?i=(e-a)/(s-c):e==s?i=2+(a-n)/(s-c):a==s&&(i=4+(n-e)/(s-c)),(i*=60)<0&&(i+=360),r.length>3&&void 0!==r[3]?[i,o,u,r[3]]:[i,o,u]},G=z,U=d.unpack,V=d.last,H=D,Y=G,J=Math.round,X=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=U(r,"rgba"),e=V(r)||"rgb";return"hsl"==e.substr(0,3)?H(Y(n),e):(n[0]=J(n[0]),n[1]=J(n[1]),n[2]=J(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(",")+")")},W=X,K=d.unpack,Z=Math.round,Q=function(){for(var r,t=[],n=arguments.length;n--;)t[n]=arguments[n];var e,a,o,i=(t=K(t,"hsl"))[0],c=t[1],s=t[2];if(0===c)e=a=o=255*s;else{var u=[0,0,0],l=[0,0,0],f=s<.5?s*(1+c):s+c-s*c,h=2*s-f,d=i/360;u[0]=d+1/3,u[1]=d,u[2]=d-1/3;for(var p=0;p<3;p++)u[p]<0&&(u[p]+=1),u[p]>1&&(u[p]-=1),6*u[p]<1?l[p]=h+6*(f-h)*u[p]:2*u[p]<1?l[p]=f:3*u[p]<2?l[p]=h+(f-h)*(2/3-u[p])*6:l[p]=h;e=(r=[Z(255*l[0]),Z(255*l[1]),Z(255*l[2])])[0],a=r[1],o=r[2]}return t.length>3?[e,a,o,t[3]]:[e,a,o,1]},rr=Q,tr=rr,nr=p,er=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,ar=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,or=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ir=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,cr=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,sr=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ur=Math.round,lr=function(r){var t;if(r=r.toLowerCase().trim(),nr.format.named)try{return nr.format.named(r)}catch(r){}if(t=r.match(er)){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(ar)){for(var a=t.slice(1,5),o=0;o<4;o++)a[o]=+a[o];return a}if(t=r.match(or)){for(var i=t.slice(1,4),c=0;c<3;c++)i[c]=ur(2.55*i[c]);return i[3]=1,i}if(t=r.match(ir)){for(var s=t.slice(1,5),u=0;u<3;u++)s[u]=ur(2.55*s[u]);return s[3]=+s[3],s}if(t=r.match(cr)){var l=t.slice(1,4);l[1]*=.01,l[2]*=.01;var f=tr(l);return f[3]=1,f}if(t=r.match(sr)){var h=t.slice(1,4);h[1]*=.01,h[2]*=.01;var d=tr(h);return d[3]=+t[4],d}};lr.test=function(r){return er.test(r)||ar.test(r)||or.test(r)||ir.test(r)||cr.test(r)||sr.test(r)};var fr=lr,hr=k,dr=w,pr=p,br=d.type,gr=W,vr=fr;dr.prototype.css=function(r){return gr(this._rgb,r)},hr.css=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(dr,[null].concat(r,["css"])))},pr.format.css=vr,pr.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"===br(r)&&vr.test(r))return"css"}});var mr=w,yr=k,wr=p,Mr=d.unpack;wr.format.gl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=Mr(r,"rgba");return n[0]*=255,n[1]*=255,n[2]*=255,n},yr.gl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(mr,[null].concat(r,["gl"])))},mr.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var kr=d.unpack,Cr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e=kr(r,"rgb"),a=e[0],o=e[1],i=e[2],c=Math.min(a,o,i),s=Math.max(a,o,i),u=s-c,l=100*u/255,f=c/(255-u)*100;return 0===u?n=Number.NaN:(a===s&&(n=(o-i)/u),o===s&&(n=2+(i-a)/u),i===s&&(n=4+(a-o)/u),(n*=60)<0&&(n+=360)),[n,l,f]},Ir=Cr,xr=d.unpack,Ar=Math.floor,Or=function(){for(var r,t,n,e,a,o,i=[],c=arguments.length;c--;)i[c]=arguments[c];var s,u,l,f=(i=xr(i,"hcg"))[0],h=i[1],d=i[2];d*=255;var p=255*h;if(0===h)s=u=l=d;else{360===f&&(f=0),f>360&&(f-=360),f<0&&(f+=360);var b=Ar(f/=60),g=f-b,v=d*(1-h),m=v+p*(1-g),y=v+p*g,w=v+p;switch(b){case 0:s=(r=[w,y,v])[0],u=r[1],l=r[2];break;case 1:s=(t=[m,w,v])[0],u=t[1],l=t[2];break;case 2:s=(n=[v,w,y])[0],u=n[1],l=n[2];break;case 3:s=(e=[v,m,w])[0],u=e[1],l=e[2];break;case 4:s=(a=[y,v,w])[0],u=a[1],l=a[2];break;case 5:s=(o=[w,v,m])[0],u=o[1],l=o[2]}}return[s,u,l,i.length>3?i[3]:1]},Nr=Or,_r=d.unpack,jr=d.type,Sr=k,Fr=w,Pr=p,Er=Ir;Fr.prototype.hcg=function(){return Er(this._rgb)},Sr.hcg=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Fr,[null].concat(r,["hcg"])))},Pr.format.hcg=Nr,Pr.autodetect.push({p:1,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=_r(r,"hcg"),"array"===jr(r)&&3===r.length)return"hcg"}});var $r=d.unpack,Rr=d.last,Lr=Math.round,Tr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=$r(r,"rgba"),e=n[0],a=n[1],o=n[2],i=n[3],c=Rr(r)||"auto";void 0===i&&(i=1),"auto"===c&&(c=i<1?"rgba":"rgb");var s="000000"+((e=Lr(e))<<16|(a=Lr(a))<<8|(o=Lr(o))).toString(16);s=s.substr(s.length-6);var u="0"+Lr(255*i).toString(16);switch(u=u.substr(u.length-2),c.toLowerCase()){case"rgba":return"#"+s+u;case"argb":return"#"+u+s;default:return"#"+s}},qr=Tr,Dr=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Br=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,zr=function(r){if(r.match(Dr)){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(Br)){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)},Gr=k,Ur=w,Vr=d.type,Hr=p,Yr=qr;Ur.prototype.hex=function(r){return Yr(this._rgb,r)},Gr.hex=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Ur,[null].concat(r,["hex"])))},Hr.format.hex=zr,Hr.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"===Vr(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var Jr=d.unpack,Xr=d.TWOPI,Wr=Math.min,Kr=Math.sqrt,Zr=Math.acos,Qr=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e=Jr(r,"rgb"),a=e[0],o=e[1],i=e[2],c=Wr(a/=255,o/=255,i/=255),s=(a+o+i)/3,u=s>0?1-c/s:0;return 0===u?n=NaN:(n=(a-o+(a-i))/2,n/=Kr((a-o)*(a-o)+(a-i)*(o-i)),n=Zr(n),i>o&&(n=Xr-n),n/=Xr),[360*n,u,s]},rt=Qr,tt=d.unpack,nt=d.limit,et=d.TWOPI,at=d.PITHIRD,ot=Math.cos,it=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e,a,o=(r=tt(r,"hsi"))[0],i=r[1],c=r[2];return isNaN(o)&&(o=0),isNaN(i)&&(i=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?e=1-((a=(1-i)/3)+(n=(1+i*ot(et*o)/ot(at-et*o))/3)):o<2/3?a=1-((n=(1-i)/3)+(e=(1+i*ot(et*(o-=1/3))/ot(at-et*o))/3)):n=1-((e=(1-i)/3)+(a=(1+i*ot(et*(o-=2/3))/ot(at-et*o))/3)),[255*(n=nt(c*n*3)),255*(e=nt(c*e*3)),255*(a=nt(c*a*3)),r.length>3?r[3]:1]},ct=it,st=d.unpack,ut=d.type,lt=k,ft=w,ht=p,dt=rt;ft.prototype.hsi=function(){return dt(this._rgb)},lt.hsi=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(ft,[null].concat(r,["hsi"])))},ht.format.hsi=ct,ht.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=st(r,"hsi"),"array"===ut(r)&&3===r.length)return"hsi"}});var pt=d.unpack,bt=d.type,gt=k,vt=w,mt=p,yt=G;vt.prototype.hsl=function(){return yt(this._rgb)},gt.hsl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(vt,[null].concat(r,["hsl"])))},mt.format.hsl=rr,mt.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=pt(r,"hsl"),"array"===bt(r)&&3===r.length)return"hsl"}});var wt=d.unpack,Mt=Math.min,kt=Math.max,Ct=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e,a,o=(r=wt(r,"rgb"))[0],i=r[1],c=r[2],s=Mt(o,i,c),u=kt(o,i,c),l=u-s;return a=u/255,0===u?(n=Number.NaN,e=0):(e=l/u,o===u&&(n=(i-c)/l),i===u&&(n=2+(c-o)/l),c===u&&(n=4+(o-i)/l),(n*=60)<0&&(n+=360)),[n,e,a]},It=Ct,xt=d.unpack,At=Math.floor,Ot=function(){for(var r,t,n,e,a,o,i=[],c=arguments.length;c--;)i[c]=arguments[c];var s,u,l,f=(i=xt(i,"hsv"))[0],h=i[1],d=i[2];if(d*=255,0===h)s=u=l=d;else{360===f&&(f=0),f>360&&(f-=360),f<0&&(f+=360);var p=At(f/=60),b=f-p,g=d*(1-h),v=d*(1-h*b),m=d*(1-h*(1-b));switch(p){case 0:s=(r=[d,m,g])[0],u=r[1],l=r[2];break;case 1:s=(t=[v,d,g])[0],u=t[1],l=t[2];break;case 2:s=(n=[g,d,m])[0],u=n[1],l=n[2];break;case 3:s=(e=[g,v,d])[0],u=e[1],l=e[2];break;case 4:s=(a=[m,g,d])[0],u=a[1],l=a[2];break;case 5:s=(o=[d,g,v])[0],u=o[1],l=o[2]}}return[s,u,l,i.length>3?i[3]:1]},Nt=Ot,_t=d.unpack,jt=d.type,St=k,Ft=w,Pt=p,Et=It;Ft.prototype.hsv=function(){return Et(this._rgb)},St.hsv=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Ft,[null].concat(r,["hsv"])))},Pt.format.hsv=Nt,Pt.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=_t(r,"hsv"),"array"===jt(r)&&3===r.length)return"hsv"}});var $t={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Rt=$t,Lt=d.unpack,Tt=Math.pow,qt=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=Lt(r,"rgb"),e=n[0],a=n[1],o=n[2],i=zt(e,a,o),c=i[0],s=i[1],u=116*s-16;return[u<0?0:u,500*(c-s),200*(s-i[2])]},Dt=function(r){return(r/=255)<=.04045?r/12.92:Tt((r+.055)/1.055,2.4)},Bt=function(r){return r>Rt.t3?Tt(r,1/3):r/Rt.t2+Rt.t0},zt=function(r,t,n){return r=Dt(r),t=Dt(t),n=Dt(n),[Bt((.4124564*r+.3575761*t+.1804375*n)/Rt.Xn),Bt((.2126729*r+.7151522*t+.072175*n)/Rt.Yn),Bt((.0193339*r+.119192*t+.9503041*n)/Rt.Zn)]},Gt=qt,Ut=$t,Vt=d.unpack,Ht=Math.pow,Yt=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n,e,a,o=(r=Vt(r,"lab"))[0],i=r[1],c=r[2];return e=(o+16)/116,n=isNaN(i)?e:e+i/500,a=isNaN(c)?e:e-c/200,e=Ut.Yn*Xt(e),n=Ut.Xn*Xt(n),a=Ut.Zn*Xt(a),[Jt(3.2404542*n-1.5371385*e-.4985314*a),Jt(-.969266*n+1.8760108*e+.041556*a),Jt(.0556434*n-.2040259*e+1.0572252*a),r.length>3?r[3]:1]},Jt=function(r){return 255*(r<=.00304?12.92*r:1.055*Ht(r,1/2.4)-.055)},Xt=function(r){return r>Ut.t1?r*r*r:Ut.t2*(r-Ut.t0)},Wt=Yt,Kt=d.unpack,Zt=d.type,Qt=k,rn=w,tn=p,nn=Gt;rn.prototype.lab=function(){return nn(this._rgb)},Qt.lab=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(rn,[null].concat(r,["lab"])))},tn.format.lab=Wt,tn.autodetect.push({p:2,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=Kt(r,"lab"),"array"===Zt(r)&&3===r.length)return"lab"}});var en=d.unpack,an=d.RAD2DEG,on=Math.sqrt,cn=Math.atan2,sn=Math.round,un=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=en(r,"lab"),e=n[0],a=n[1],o=n[2],i=on(a*a+o*o),c=(cn(o,a)*an+360)%360;return 0===sn(1e4*i)&&(c=Number.NaN),[e,i,c]},ln=un,fn=d.unpack,hn=Gt,dn=ln,pn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=fn(r,"rgb"),e=n[0],a=n[1],o=n[2],i=hn(e,a,o),c=i[0],s=i[1],u=i[2];return dn(c,s,u)},bn=pn,gn=d.unpack,vn=d.DEG2RAD,mn=Math.sin,yn=Math.cos,wn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=gn(r,"lch"),e=n[0],a=n[1],o=n[2];return isNaN(o)&&(o=0),[e,yn(o*=vn)*a,mn(o)*a]},Mn=wn,kn=d.unpack,Cn=Mn,In=Wt,xn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=(r=kn(r,"lch"))[0],e=r[1],a=r[2],o=Cn(n,e,a),i=o[0],c=o[1],s=o[2],u=In(i,c,s);return[u[0],u[1],u[2],r.length>3?r[3]:1]},An=xn,On=d.unpack,Nn=An,_n=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=On(r,"hcl").reverse();return Nn.apply(void 0,n)},jn=_n,Sn=d.unpack,Fn=d.type,Pn=k,En=w,$n=p,Rn=bn;En.prototype.lch=function(){return Rn(this._rgb)},En.prototype.hcl=function(){return Rn(this._rgb).reverse()},Pn.lch=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(En,[null].concat(r,["lch"])))},Pn.hcl=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(En,[null].concat(r,["hcl"])))},$n.format.lch=An,$n.format.hcl=jn,["lch","hcl"].forEach((function(r){return $n.autodetect.push({p:2,test:function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];if(t=Sn(t,r),"array"===Fn(t)&&3===t.length)return r}})}));var Ln={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"},Tn=w,qn=p,Dn=d.type,Bn=Ln,zn=zr,Gn=qr;Tn.prototype.name=function(){for(var r=Gn(this._rgb,"rgb"),t=0,n=Object.keys(Bn);t<n.length;t+=1){var e=n[t];if(Bn[e]===r)return e.toLowerCase()}return r},qn.format.named=function(r){if(r=r.toLowerCase(),Bn[r])return zn(Bn[r]);throw new Error("unknown color name: "+r)},qn.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"===Dn(r)&&Bn[r.toLowerCase()])return"named"}});var Un=d.unpack,Vn=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=Un(r,"rgb");return(n[0]<<16)+(n[1]<<8)+n[2]},Hn=Vn,Yn=d.type,Jn=function(r){if("number"==Yn(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Xn=Jn,Wn=k,Kn=w,Zn=p,Qn=d.type,re=Hn;Kn.prototype.num=function(){return re(this._rgb)},Wn.num=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(Kn,[null].concat(r,["num"])))},Zn.format.num=Xn,Zn.autodetect.push({p:5,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(1===r.length&&"number"===Qn(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var te=k,ne=w,ee=p,ae=d.unpack,oe=d.type,ie=Math.round;ne.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(ie)},ne.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:ie(t):t}))},te.rgb=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return new(Function.prototype.bind.apply(ne,[null].concat(r,["rgb"])))},ee.format.rgb=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=ae(r,"rgba");return void 0===n[3]&&(n[3]=1),n},ee.autodetect.push({p:3,test:function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];if(r=ae(r,"rgba"),"array"===oe(r)&&(3===r.length||4===r.length&&"number"==oe(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var ce=Math.log,se=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*ce(n),e=a<20?0:.8274096064007395*(e=a-10)-254.76935184120902+115.67994401066147*ce(e)):(t=351.97690566805693+.114206453784165*(t=a-55)-40.25366309332127*ce(t),n=325.4494125711974+.07943456536662342*(n=a-50)-28.0852963507957*ce(n),e=255),[t,n,e,1]},ue=se,le=d.unpack,fe=Math.round,he=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];for(var n,e=le(r,"rgb"),a=e[0],o=e[2],i=1e3,c=4e4,s=.4;c-i>s;){var u=ue(n=.5*(c+i));u[2]/u[0]>=o/a?c=n:i=n}return fe(n)},de=k,pe=w,be=p,ge=he;pe.prototype.t