UNPKG

use-material-you

Version:

React hook to create dynamic schemes and variants based on M3/material-color-utilities

1 lines 98.8 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react");var Re=typeof document<"u"?document.currentScript:null;function et(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const Fe=et(Ze);function q(a){return a<0?-1:a===0?0:1}function he(a,e,t){return(1-t)*a+t*e}function tt(a,e,t){return t<a?a:t>e?e:t}function G(a,e,t){return t<a?a:t>e?e:t}function Se(a){return a=a%360,a<0&&(a=a+360),a}function W(a){return a=a%360,a<0&&(a=a+360),a}function rt(a,e){return 180-Math.abs(Math.abs(a-e)-180)}function ve(a,e){const t=a[0]*e[0][0]+a[1]*e[0][1]+a[2]*e[0][2],r=a[0]*e[1][0]+a[1]*e[1][1]+a[2]*e[1][2],n=a[0]*e[2][0]+a[1]*e[2][1]+a[2]*e[2][2];return[t,r,n]}const ze=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],nt=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Le=[95.047,100,108.883];function Ae(a,e,t){return(255<<24|(a&255)<<16|(e&255)<<8|t&255)>>>0}function Ve(a){const e=ie(a[0]),t=ie(a[1]),r=ie(a[2]);return Ae(e,t,r)}function at(a){return a>>24&255}function ke(a){return a>>16&255}function Ce(a){return a>>8&255}function be(a){return a&255}function Ge(a,e,t){const r=nt,n=r[0][0]*a+r[0][1]*e+r[0][2]*t,o=r[1][0]*a+r[1][1]*e+r[1][2]*t,i=r[2][0]*a+r[2][1]*e+r[2][2]*t,c=ie(n),f=ie(o),p=ie(i);return Ae(c,f,p)}function ot(a){const e=te(ke(a)),t=te(Ce(a)),r=te(be(a));return ve([e,t,r],ze)}function it(a,e,t){const r=Le,n=(a+16)/116,o=e/500+n,i=n-t/200,c=Te(o),f=Te(n),p=Te(i),h=c*r[0],y=f*r[1],P=p*r[2];return Ge(h,y,P)}function Ye(a){const e=te(ke(a)),t=te(Ce(a)),r=te(be(a)),n=ze,o=n[0][0]*e+n[0][1]*t+n[0][2]*r,i=n[1][0]*e+n[1][1]*t+n[1][2]*r,c=n[2][0]*e+n[2][1]*t+n[2][2]*r,f=Le,p=o/f[0],h=i/f[1],y=c/f[2],P=fe(p),g=fe(h),m=fe(y),d=116*g-16,T=500*(P-g),D=200*(g-m);return[d,T,D]}function st(a){const e=ae(a),t=ie(e);return Ae(t,t,t)}function _e(a){const e=ot(a)[1];return 116*fe(e/100)-16}function ae(a){return 100*Te((a+16)/116)}function Be(a){return fe(a/100)*116-16}function te(a){const e=a/255;return e<=.040449936?e/12.92*100:Math.pow((e+.055)/1.055,2.4)*100}function ie(a){const e=a/100;let t=0;return e<=.0031308?t=e*12.92:t=1.055*Math.pow(e,1/2.4)-.055,tt(0,255,Math.round(t*255))}function ct(){return Le}function fe(a){const e=.008856451679035631,t=24389/27;return a>e?Math.pow(a,1/3):(t*a+16)/116}function Te(a){const e=.008856451679035631,t=24389/27,r=a*a*a;return r>e?r:(116*a-16)/t}class Z{static make(e=ct(),t=200/Math.PI*ae(50)/100,r=50,n=2,o=!1){const i=e,c=i[0]*.401288+i[1]*.650173+i[2]*-.051461,f=i[0]*-.250268+i[1]*1.204414+i[2]*.045854,p=i[0]*-.002079+i[1]*.048952+i[2]*.953127,h=.8+n/10,y=h>=.9?he(.59,.69,(h-.9)*10):he(.525,.59,(h-.8)*10);let P=o?1:h*(1-1/3.6*Math.exp((-t-42)/92));P=P>1?1:P<0?0:P;const g=h,m=[P*(100/c)+1-P,P*(100/f)+1-P,P*(100/p)+1-P],d=1/(5*t+1),T=d*d*d*d,D=1-T,S=T*t+.1*D*D*Math.cbrt(5*t),C=ae(r)/e[1],v=1.48+Math.sqrt(C),M=.725/Math.pow(C,.2),O=M,k=[Math.pow(S*m[0]*c/100,.42),Math.pow(S*m[1]*f/100,.42),Math.pow(S*m[2]*p/100,.42)],R=[400*k[0]/(k[0]+27.13),400*k[1]/(k[1]+27.13),400*k[2]/(k[2]+27.13)],N=(2*R[0]+R[1]+.05*R[2])*M;return new Z(C,N,M,O,y,g,m,S,Math.pow(S,.25),v)}constructor(e,t,r,n,o,i,c,f,p,h){this.n=e,this.aw=t,this.nbb=r,this.ncb=n,this.c=o,this.nc=i,this.rgbD=c,this.fl=f,this.fLRoot=p,this.z=h}}Z.DEFAULT=Z.make();class X{constructor(e,t,r,n,o,i,c,f,p){this.hue=e,this.chroma=t,this.j=r,this.q=n,this.m=o,this.s=i,this.jstar=c,this.astar=f,this.bstar=p}distance(e){const t=this.jstar-e.jstar,r=this.astar-e.astar,n=this.bstar-e.bstar,o=Math.sqrt(t*t+r*r+n*n);return 1.41*Math.pow(o,.63)}static fromInt(e){return X.fromIntInViewingConditions(e,Z.DEFAULT)}static fromIntInViewingConditions(e,t){const r=(e&16711680)>>16,n=(e&65280)>>8,o=e&255,i=te(r),c=te(n),f=te(o),p=.41233895*i+.35762064*c+.18051042*f,h=.2126*i+.7152*c+.0722*f,y=.01932141*i+.11916382*c+.95034478*f,P=.401288*p+.650173*h-.051461*y,g=-.250268*p+1.204414*h+.045854*y,m=-.002079*p+.048952*h+.953127*y,d=t.rgbD[0]*P,T=t.rgbD[1]*g,D=t.rgbD[2]*m,S=Math.pow(t.fl*Math.abs(d)/100,.42),C=Math.pow(t.fl*Math.abs(T)/100,.42),v=Math.pow(t.fl*Math.abs(D)/100,.42),M=q(d)*400*S/(S+27.13),O=q(T)*400*C/(C+27.13),k=q(D)*400*v/(v+27.13),R=(11*M+-12*O+k)/11,N=(M+O-2*k)/9,L=(20*M+20*O+21*k)/20,U=(40*M+20*O+k)/20,Q=Math.atan2(N,R)*180/Math.PI,z=W(Q),oe=z*Math.PI/180,me=U*t.nbb,re=100*Math.pow(me/t.aw,t.c*t.z),pe=4/t.c*Math.sqrt(re/100)*(t.aw+4)*t.fLRoot,we=z<20.14?z+360:z,xe=.25*(Math.cos(we*Math.PI/180+2)+3.8),De=5e4/13*xe*t.nc*t.ncb*Math.sqrt(R*R+N*N)/(L+.305),ge=Math.pow(De,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),Me=ge*Math.sqrt(re/100),Oe=Me*t.fLRoot,je=50*Math.sqrt(ge*t.c/(t.aw+4)),$e=(1+100*.007)*re/(1+.007*re),Ne=1/.0228*Math.log(1+.0228*Oe),Je=Ne*Math.cos(oe),Qe=Ne*Math.sin(oe);return new X(z,Me,re,pe,Oe,je,$e,Je,Qe)}static fromJch(e,t,r){return X.fromJchInViewingConditions(e,t,r,Z.DEFAULT)}static fromJchInViewingConditions(e,t,r,n){const o=4/n.c*Math.sqrt(e/100)*(n.aw+4)*n.fLRoot,i=t*n.fLRoot,c=t/Math.sqrt(e/100),f=50*Math.sqrt(c*n.c/(n.aw+4)),p=r*Math.PI/180,h=(1+100*.007)*e/(1+.007*e),y=1/.0228*Math.log(1+.0228*i),P=y*Math.cos(p),g=y*Math.sin(p);return new X(r,t,e,o,i,f,h,P,g)}static fromUcs(e,t,r){return X.fromUcsInViewingConditions(e,t,r,Z.DEFAULT)}static fromUcsInViewingConditions(e,t,r,n){const o=t,i=r,c=Math.sqrt(o*o+i*i),p=(Math.exp(c*.0228)-1)/.0228/n.fLRoot;let h=Math.atan2(i,o)*(180/Math.PI);h<0&&(h+=360);const y=e/(1-(e-100)*.007);return X.fromJchInViewingConditions(y,p,h,n)}toInt(){return this.viewed(Z.DEFAULT)}viewed(e){const t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),n=this.hue*Math.PI/180,o=.25*(Math.cos(n+2)+3.8),i=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=o*(5e4/13)*e.nc*e.ncb,f=i/e.nbb,p=Math.sin(n),h=Math.cos(n),y=23*(f+.305)*r/(23*c+11*r*h+108*r*p),P=y*h,g=y*p,m=(460*f+451*P+288*g)/1403,d=(460*f-891*P-261*g)/1403,T=(460*f-220*P-6300*g)/1403,D=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),S=q(m)*(100/e.fl)*Math.pow(D,1/.42),C=Math.max(0,27.13*Math.abs(d)/(400-Math.abs(d))),v=q(d)*(100/e.fl)*Math.pow(C,1/.42),M=Math.max(0,27.13*Math.abs(T)/(400-Math.abs(T))),O=q(T)*(100/e.fl)*Math.pow(M,1/.42),k=S/e.rgbD[0],R=v/e.rgbD[1],N=O/e.rgbD[2],L=1.86206786*k-1.01125463*R+.14918677*N,U=.38752654*k+.62144744*R-.00897398*N,j=-.0158415*k-.03412294*R+1.04996444*N;return Ge(L,U,j)}static fromXyzInViewingConditions(e,t,r,n){const o=.401288*e+.650173*t-.051461*r,i=-.250268*e+1.204414*t+.045854*r,c=-.002079*e+.048952*t+.953127*r,f=n.rgbD[0]*o,p=n.rgbD[1]*i,h=n.rgbD[2]*c,y=Math.pow(n.fl*Math.abs(f)/100,.42),P=Math.pow(n.fl*Math.abs(p)/100,.42),g=Math.pow(n.fl*Math.abs(h)/100,.42),m=q(f)*400*y/(y+27.13),d=q(p)*400*P/(P+27.13),T=q(h)*400*g/(g+27.13),D=(11*m+-12*d+T)/11,S=(m+d-2*T)/9,C=(20*m+20*d+21*T)/20,v=(40*m+20*d+T)/20,O=Math.atan2(S,D)*180/Math.PI,k=O<0?O+360:O>=360?O-360:O,R=k*Math.PI/180,N=v*n.nbb,L=100*Math.pow(N/n.aw,n.c*n.z),U=4/n.c*Math.sqrt(L/100)*(n.aw+4)*n.fLRoot,j=k<20.14?k+360:k,Q=1/4*(Math.cos(j*Math.PI/180+2)+3.8),oe=5e4/13*Q*n.nc*n.ncb*Math.sqrt(D*D+S*S)/(C+.305),me=Math.pow(oe,.9)*Math.pow(1.64-Math.pow(.29,n.n),.73),re=me*Math.sqrt(L/100),pe=re*n.fLRoot,we=50*Math.sqrt(me*n.c/(n.aw+4)),xe=(1+100*.007)*L/(1+.007*L),Ee=Math.log(1+.0228*pe)/.0228,De=Ee*Math.cos(R),ge=Ee*Math.sin(R);return new X(k,re,L,U,pe,we,xe,De,ge)}xyzInViewingConditions(e){const t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),n=this.hue*Math.PI/180,o=.25*(Math.cos(n+2)+3.8),i=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=o*(5e4/13)*e.nc*e.ncb,f=i/e.nbb,p=Math.sin(n),h=Math.cos(n),y=23*(f+.305)*r/(23*c+11*r*h+108*r*p),P=y*h,g=y*p,m=(460*f+451*P+288*g)/1403,d=(460*f-891*P-261*g)/1403,T=(460*f-220*P-6300*g)/1403,D=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),S=q(m)*(100/e.fl)*Math.pow(D,1/.42),C=Math.max(0,27.13*Math.abs(d)/(400-Math.abs(d))),v=q(d)*(100/e.fl)*Math.pow(C,1/.42),M=Math.max(0,27.13*Math.abs(T)/(400-Math.abs(T))),O=q(T)*(100/e.fl)*Math.pow(M,1/.42),k=S/e.rgbD[0],R=v/e.rgbD[1],N=O/e.rgbD[2],L=1.86206786*k-1.01125463*R+.14918677*N,U=.38752654*k+.62144744*R-.00897398*N,j=-.0158415*k-.03412294*R+1.04996444*N;return[L,U,j]}}class x{static sanitizeRadians(e){return(e+Math.PI*8)%(Math.PI*2)}static trueDelinearized(e){const t=e/100;let r=0;return t<=.0031308?r=t*12.92:r=1.055*Math.pow(t,1/2.4)-.055,r*255}static chromaticAdaptation(e){const t=Math.pow(Math.abs(e),.42);return q(e)*400*t/(t+27.13)}static hueOf(e){const t=ve(e,x.SCALED_DISCOUNT_FROM_LINRGB),r=x.chromaticAdaptation(t[0]),n=x.chromaticAdaptation(t[1]),o=x.chromaticAdaptation(t[2]),i=(11*r+-12*n+o)/11,c=(r+n-2*o)/9;return Math.atan2(c,i)}static areInCyclicOrder(e,t,r){const n=x.sanitizeRadians(t-e),o=x.sanitizeRadians(r-e);return n<o}static intercept(e,t,r){return(t-e)/(r-e)}static lerpPoint(e,t,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t,e[2]+(r[2]-e[2])*t]}static setCoordinate(e,t,r,n){const o=x.intercept(e[n],t,r[n]);return x.lerpPoint(e,o,r)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,t){const r=x.Y_FROM_LINRGB[0],n=x.Y_FROM_LINRGB[1],o=x.Y_FROM_LINRGB[2],i=t%4<=1?0:100,c=t%2===0?0:100;if(t<4){const f=i,p=c,h=(e-f*n-p*o)/r;return x.isBounded(h)?[h,f,p]:[-1,-1,-1]}else if(t<8){const f=i,p=c,h=(e-p*r-f*o)/n;return x.isBounded(h)?[p,h,f]:[-1,-1,-1]}else{const f=i,p=c,h=(e-f*r-p*n)/o;return x.isBounded(h)?[f,p,h]:[-1,-1,-1]}}static bisectToSegment(e,t){let r=[-1,-1,-1],n=r,o=0,i=0,c=!1,f=!0;for(let p=0;p<12;p++){const h=x.nthVertex(e,p);if(h[0]<0)continue;const y=x.hueOf(h);if(!c){r=h,n=h,o=y,i=y,c=!0;continue}(f||x.areInCyclicOrder(o,y,i))&&(f=!1,x.areInCyclicOrder(o,t,y)?(n=h,i=y):(r=h,o=y))}return[r,n]}static midpoint(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2]}static criticalPlaneBelow(e){return Math.floor(e-.5)}static criticalPlaneAbove(e){return Math.ceil(e-.5)}static bisectToLimit(e,t){const r=x.bisectToSegment(e,t);let n=r[0],o=x.hueOf(n),i=r[1];for(let c=0;c<3;c++)if(n[c]!==i[c]){let f=-1,p=255;n[c]<i[c]?(f=x.criticalPlaneBelow(x.trueDelinearized(n[c])),p=x.criticalPlaneAbove(x.trueDelinearized(i[c]))):(f=x.criticalPlaneAbove(x.trueDelinearized(n[c])),p=x.criticalPlaneBelow(x.trueDelinearized(i[c])));for(let h=0;h<8&&!(Math.abs(p-f)<=1);h++){const y=Math.floor((f+p)/2),P=x.CRITICAL_PLANES[y],g=x.setCoordinate(n,P,i,c),m=x.hueOf(g);x.areInCyclicOrder(o,t,m)?(i=g,p=y):(n=g,o=m,f=y)}}return x.midpoint(n,i)}static inverseChromaticAdaptation(e){const t=Math.abs(e),r=Math.max(0,27.13*t/(400-t));return q(e)*Math.pow(r,1/.42)}static findResultByJ(e,t,r){let n=Math.sqrt(r)*11;const o=Z.DEFAULT,i=1/Math.pow(1.64-Math.pow(.29,o.n),.73),f=.25*(Math.cos(e+2)+3.8)*(5e4/13)*o.nc*o.ncb,p=Math.sin(e),h=Math.cos(e);for(let y=0;y<5;y++){const P=n/100,g=t===0||n===0?0:t/Math.sqrt(P),m=Math.pow(g*i,1/.9),T=o.aw*Math.pow(P,1/o.c/o.z)/o.nbb,D=23*(T+.305)*m/(23*f+11*m*h+108*m*p),S=D*h,C=D*p,v=(460*T+451*S+288*C)/1403,M=(460*T-891*S-261*C)/1403,O=(460*T-220*S-6300*C)/1403,k=x.inverseChromaticAdaptation(v),R=x.inverseChromaticAdaptation(M),N=x.inverseChromaticAdaptation(O),L=ve([k,R,N],x.LINRGB_FROM_SCALED_DISCOUNT);if(L[0]<0||L[1]<0||L[2]<0)return 0;const U=x.Y_FROM_LINRGB[0],j=x.Y_FROM_LINRGB[1],Q=x.Y_FROM_LINRGB[2],z=U*L[0]+j*L[1]+Q*L[2];if(z<=0)return 0;if(y===4||Math.abs(z-r)<.002)return L[0]>100.01||L[1]>100.01||L[2]>100.01?0:Ve(L);n=n-(z-r)*n/(2*z)}return 0}static solveToInt(e,t,r){if(t<1e-4||r<1e-4||r>99.9999)return st(r);e=W(e);const n=e/180*Math.PI,o=ae(r),i=x.findResultByJ(n,t,o);if(i!==0)return i;const c=x.bisectToLimit(o,n);return Ve(c)}static solveToCam(e,t,r){return X.fromInt(x.solveToInt(e,t,r))}}x.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];x.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];x.Y_FROM_LINRGB=[.2126,.7152,.0722];x.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];class E{static from(e,t,r){return new E(x.solveToInt(e,t,r))}static fromInt(e){return new E(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(x.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(x.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(x.solveToInt(this.internalHue,this.internalChroma,e))}setValue(e,t){this[e]=t}toString(){return`HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`}static isBlue(e){return e>=250&&e<270}static isYellow(e){return e>=105&&e<125}static isCyan(e){return e>=170&&e<207}constructor(e){this.argb=e;const t=X.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=_e(e),this.argb=e}setInternalState(e){const t=X.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=_e(e),this.argb=e}inViewingConditions(e){const r=X.fromInt(this.toInt()).xyzInViewingConditions(e),n=X.fromXyzInViewingConditions(r[0],r[1],r[2],Z.make());return E.from(n.hue,n.chroma,Be(r[1]))}}class _{static ratioOfTones(e,t){return e=G(0,100,e),t=G(0,100,t),_.ratioOfYs(ae(e),ae(t))}static ratioOfYs(e,t){const r=e>t?e:t,n=r===t?e:t;return(r+5)/(n+5)}static lighter(e,t){if(e<0||e>100)return-1;const r=ae(e),n=t*(r+5)-5,o=_.ratioOfYs(n,r),i=Math.abs(o-t);if(o<t&&i>.04)return-1;const c=Be(n)+.4;return c<0||c>100?-1:c}static darker(e,t){if(e<0||e>100)return-1;const r=ae(e),n=(r+5)/t-5,o=_.ratioOfYs(r,n),i=Math.abs(o-t);if(o<t&&i>.04)return-1;const c=Be(n)-.4;return c<0||c>100?-1:c}static lighterUnsafe(e,t){const r=_.lighter(e,t);return r<0?100:r}static darkerUnsafe(e,t){const r=_.darker(e,t);return r<0?0:r}}class de{static isDisliked(e){const t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,r=Math.round(e.chroma)>16,n=Math.round(e.tone)<65;return t&&r&&n}static fixIfDisliked(e){return de.isDisliked(e)?E.from(e.hue,e.chroma,70):e}}function ut(a,e,t){if(a.name!==t.name)throw new Error(`Attempting to extend color ${a.name} with color ${t.name} of different name for spec version ${e}.`);if(a.isBackground!==t.isBackground)throw new Error(`Attempting to extend color ${a.name} as a ${a.isBackground?"background":"foreground"} with color ${t.name} as a ${t.isBackground?"background":"foreground"} for spec version ${e}.`)}function F(a,e,t){return ut(a,e,t),l.fromPalette({name:a.name,palette:r=>r.specVersion===e?t.palette(r):a.palette(r),tone:r=>r.specVersion===e?t.tone(r):a.tone(r),isBackground:a.isBackground,chromaMultiplier:r=>{const n=r.specVersion===e?t.chromaMultiplier:a.chromaMultiplier;return n!==void 0?n(r):1},background:r=>{const n=r.specVersion===e?t.background:a.background;return n!==void 0?n(r):void 0},secondBackground:r=>{const n=r.specVersion===e?t.secondBackground:a.secondBackground;return n!==void 0?n(r):void 0},contrastCurve:r=>{const n=r.specVersion===e?t.contrastCurve:a.contrastCurve;return n!==void 0?n(r):void 0},toneDeltaPair:r=>{const n=r.specVersion===e?t.toneDeltaPair:a.toneDeltaPair;return n!==void 0?n(r):void 0}})}class l{static fromPalette(e){return new l(e.name??"",e.palette,e.tone??l.getInitialToneFromBackground(e.background),e.isBackground??!1,e.chromaMultiplier,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}static getInitialToneFromBackground(e){return e===void 0?t=>50:t=>e(t)?e(t).getTone(t):50}constructor(e,t,r,n,o,i,c,f,p){if(this.name=e,this.palette=t,this.tone=r,this.isBackground=n,this.chromaMultiplier=o,this.background=i,this.secondBackground=c,this.contrastCurve=f,this.toneDeltaPair=p,this.hctCache=new Map,!i&&c)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!i&&f)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(i&&!f)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}clone(){return l.fromPalette({name:this.name,palette:this.palette,tone:this.tone,isBackground:this.isBackground,chromaMultiplier:this.chromaMultiplier,background:this.background,secondBackground:this.secondBackground,contrastCurve:this.contrastCurve,toneDeltaPair:this.toneDeltaPair})}clearCache(){this.hctCache.clear()}getArgb(e){return this.getHct(e).toInt()}getHct(e){const t=this.hctCache.get(e);if(t!=null)return t;const r=He(e.specVersion).getHct(e,this);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,r),r}getTone(e){return He(e.specVersion).getTone(e,this)}static foregroundTone(e,t){const r=_.lighterUnsafe(e,t),n=_.darkerUnsafe(e,t),o=_.ratioOfTones(r,e),i=_.ratioOfTones(n,e);if(l.tonePrefersLightForeground(e)){const f=Math.abs(o-i)<.1&&o<t&&i<t;return o>=t||o>=i||f?r:n}else return i>=t||i>=o?n:r}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return l.tonePrefersLightForeground(e)&&!l.toneAllowsLightForeground(e)?49:e}}class lt{getHct(e,t){const r=t.getTone(e);return t.palette(e).getHct(r)}getTone(e,t){const r=e.contrastLevel<0,n=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(n){const o=n.roleA,i=n.roleB,c=n.delta,f=n.polarity,p=n.stayTogether,h=f==="nearer"||f==="lighter"&&!e.isDark||f==="darker"&&e.isDark,y=h?o:i,P=h?i:o,g=t.name===y.name,m=e.isDark?1:-1;let d=y.tone(e),T=P.tone(e);if(t.background&&y.contrastCurve&&P.contrastCurve){const D=t.background(e),S=y.contrastCurve(e),C=P.contrastCurve(e);if(D&&S&&C){const v=D.getTone(e),M=S.get(e.contrastLevel),O=C.get(e.contrastLevel);_.ratioOfTones(v,d)<M&&(d=l.foregroundTone(v,M)),_.ratioOfTones(v,T)<O&&(T=l.foregroundTone(v,O)),r&&(d=l.foregroundTone(v,M),T=l.foregroundTone(v,O))}}return(T-d)*m<c&&(T=G(0,100,d+c*m),(T-d)*m>=c||(d=G(0,100,T-c*m))),50<=d&&d<60?m>0?(d=60,T=Math.max(T,d+c*m)):(d=49,T=Math.min(T,d+c*m)):50<=T&&T<60&&(p?m>0?(d=60,T=Math.max(T,d+c*m)):(d=49,T=Math.min(T,d+c*m)):m>0?T=60:T=49),g?d:T}else{let o=t.tone(e);if(t.background==null||t.background(e)===void 0||t.contrastCurve==null||t.contrastCurve(e)===void 0)return o;const i=t.background(e).getTone(e),c=t.contrastCurve(e).get(e.contrastLevel);if(_.ratioOfTones(i,o)>=c||(o=l.foregroundTone(i,c)),r&&(o=l.foregroundTone(i,c)),t.isBackground&&50<=o&&o<60&&(_.ratioOfTones(49,i)>=c?o=49:o=60),t.secondBackground==null||t.secondBackground(e)===void 0)return o;const[f,p]=[t.background,t.secondBackground],[h,y]=[f(e).getTone(e),p(e).getTone(e)],[P,g]=[Math.max(h,y),Math.min(h,y)];if(_.ratioOfTones(P,o)>=c&&_.ratioOfTones(g,o)>=c)return o;const m=_.lighter(P,c),d=_.darker(g,c),T=[];return m!==-1&&T.push(m),d!==-1&&T.push(d),l.tonePrefersLightForeground(h)||l.tonePrefersLightForeground(y)?m<0?100:m:T.length===1?T[0]:d<0?0:d}}}class ht{getHct(e,t){const r=t.palette(e),n=t.getTone(e),o=r.hue,i=r.chroma*(t.chromaMultiplier?t.chromaMultiplier(e):1);return E.from(o,i,n)}getTone(e,t){const r=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(r){const n=r.roleA,o=r.roleB,i=r.polarity,c=r.constraint,f=i==="darker"||i==="relative_lighter"&&e.isDark||i==="relative_darker"&&!e.isDark?-r.delta:r.delta,p=t.name===n.name,h=p?n:o,y=p?o:n;let P=h.tone(e),g=y.getTone(e);const m=f*(p?1:-1);if(c==="exact"?P=G(0,100,g+m):c==="nearer"?m>0?P=G(0,100,G(g,g+m,P)):P=G(0,100,G(g+m,g,P)):c==="farther"&&(m>0?P=G(g+m,100,P):P=G(0,g+m,P)),t.background&&t.contrastCurve){const d=t.background(e),T=t.contrastCurve(e);if(d&&T){const D=d.getTone(e),S=T.get(e.contrastLevel);P=_.ratioOfTones(D,P)>=S&&e.contrastLevel>=0?P:l.foregroundTone(D,S)}}return t.isBackground&&!t.name.endsWith("_fixed_dim")&&(P>=57?P=G(65,100,P):P=G(0,49,P)),P}else{let n=t.tone(e);if(t.background==null||t.background(e)===void 0||t.contrastCurve==null||t.contrastCurve(e)===void 0)return n;const o=t.background(e).getTone(e),i=t.contrastCurve(e).get(e.contrastLevel);if(n=_.ratioOfTones(o,n)>=i&&e.contrastLevel>=0?n:l.foregroundTone(o,i),t.isBackground&&!t.name.endsWith("_fixed_dim")&&(n>=57?n=G(65,100,n):n=G(0,49,n)),t.secondBackground==null||t.secondBackground(e)===void 0)return n;const[c,f]=[t.background,t.secondBackground],[p,h]=[c(e).getTone(e),f(e).getTone(e)],[y,P]=[Math.max(p,h),Math.min(p,h)];if(_.ratioOfTones(y,n)>=i&&_.ratioOfTones(P,n)>=i)return n;const g=_.lighter(y,i),m=_.darker(P,i),d=[];return g!==-1&&d.push(g),m!==-1&&d.push(m),l.tonePrefersLightForeground(p)||l.tonePrefersLightForeground(h)?g<0?100:g:d.length===1?d[0]:m<0?0:m}}}const ft=new lt,dt=new ht;function He(a){return a==="2025"?dt:ft}class A{static fromInt(e){const t=E.fromInt(e);return A.fromHct(t)}static fromHct(e){return new A(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){const r=new mt(e,t).create();return new A(e,t,r)}constructor(e,t,r){this.hue=e,this.chroma=t,this.keyColor=r,this.cache=new Map}tone(e){let t=this.cache.get(e);return t===void 0&&(e==99&&E.isYellow(this.hue)?t=this.averageArgb(this.tone(98),this.tone(100)):t=E.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,t)),t}getHct(e){return E.fromInt(this.tone(e))}averageArgb(e,t){const r=e>>>16&255,n=e>>>8&255,o=e&255,i=t>>>16&255,c=t>>>8&255,f=t&255,p=Math.round((r+i)/2),h=Math.round((n+c)/2),y=Math.round((o+f)/2);return(255<<24|(p&255)<<16|(h&255)<<8|y&255)>>>0}}class mt{constructor(e,t){this.hue=e,this.requestedChroma=t,this.chromaCache=new Map,this.maxChromaValue=200}create(){let n=0,o=100;for(;n<o;){const i=Math.floor((n+o)/2),c=this.maxChroma(i)<this.maxChroma(i+1);if(this.maxChroma(i)>=this.requestedChroma-.01)if(Math.abs(n-50)<Math.abs(o-50))o=i;else{if(n===i)return E.from(this.hue,this.requestedChroma,n);n=i}else c?n=i+1:o=i}return E.from(this.hue,this.requestedChroma,n)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);const t=E.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,t),t}}class ue{constructor(e){this.input=e,this.hctsByTempCache=[],this.hctsByHueCache=[],this.tempsByHctCache=new Map,this.inputRelativeTemperatureCache=-1,this.complementCache=null}get hctsByTemp(){if(this.hctsByTempCache.length>0)return this.hctsByTempCache;const e=this.hctsByHue.concat([this.input]),t=this.tempsByHct;return e.sort((r,n)=>t.get(r)-t.get(n)),this.hctsByTempCache=e,e}get warmest(){return this.hctsByTemp[this.hctsByTemp.length-1]}get coldest(){return this.hctsByTemp[0]}analogous(e=5,t=12){const r=Math.round(this.input.hue),n=this.hctsByHue[r];let o=this.relativeTemperature(n);const i=[n];let c=0;for(let m=0;m<360;m++){const d=Se(r+m),T=this.hctsByHue[d],D=this.relativeTemperature(T),S=Math.abs(D-o);o=D,c+=S}let f=1;const p=c/t;let h=0;for(o=this.relativeTemperature(n);i.length<t;){const m=Se(r+f),d=this.hctsByHue[m],T=this.relativeTemperature(d),D=Math.abs(T-o);h+=D;const S=i.length*p;let C=h>=S,v=1;for(;C&&i.length<t;){i.push(d);const M=(i.length+v)*p;C=h>=M,v++}if(o=T,f++,f>360){for(;i.length<t;)i.push(d);break}}const y=[this.input],P=Math.floor((e-1)/2);for(let m=1;m<P+1;m++){let d=0-m;for(;d<0;)d=i.length+d;d>=i.length&&(d=d%i.length),y.splice(0,0,i[d])}const g=e-P-1;for(let m=1;m<g+1;m++){let d=m;for(;d<0;)d=i.length+d;d>=i.length&&(d=d%i.length),y.push(i[d])}return y}get complement(){if(this.complementCache!=null)return this.complementCache;const e=this.coldest.hue,t=this.tempsByHct.get(this.coldest),r=this.warmest.hue,o=this.tempsByHct.get(this.warmest)-t,i=ue.isBetween(this.input.hue,e,r),c=i?r:e,f=i?e:r,p=1;let h=1e3,y=this.hctsByHue[Math.round(this.input.hue)];const P=1-this.inputRelativeTemperature;for(let g=0;g<=360;g+=1){const m=W(c+p*g);if(!ue.isBetween(m,c,f))continue;const d=this.hctsByHue[Math.round(m)],T=(this.tempsByHct.get(d)-t)/o,D=Math.abs(P-T);D<h&&(h=D,y=d)}return this.complementCache=y,this.complementCache}relativeTemperature(e){const t=this.tempsByHct.get(this.warmest)-this.tempsByHct.get(this.coldest),r=this.tempsByHct.get(e)-this.tempsByHct.get(this.coldest);return t===0?.5:r/t}get inputRelativeTemperature(){return this.inputRelativeTemperatureCache>=0?this.inputRelativeTemperatureCache:(this.inputRelativeTemperatureCache=this.relativeTemperature(this.input),this.inputRelativeTemperatureCache)}get tempsByHct(){if(this.tempsByHctCache.size>0)return this.tempsByHctCache;const e=this.hctsByHue.concat([this.input]),t=new Map;for(const r of e)t.set(r,ue.rawTemperature(r));return this.tempsByHctCache=t,t}get hctsByHue(){if(this.hctsByHueCache.length>0)return this.hctsByHueCache;const e=[];for(let t=0;t<=360;t+=1){const r=E.from(t,this.input.chroma,this.input.tone);e.push(r)}return this.hctsByHueCache=e,this.hctsByHueCache}static isBetween(e,t,r){return t<r?t<=e&&e<=r:t<=e||e<=r}static rawTemperature(e){const t=Ye(e.toInt()),r=W(Math.atan2(t[2],t[1])*180/Math.PI),n=Math.sqrt(t[1]*t[1]+t[2]*t[2]);return-.5+.02*Math.pow(n,1.07)*Math.cos(W(r-50)*Math.PI/180)}}class b{constructor(e,t,r,n){this.low=e,this.normal=t,this.medium=r,this.high=n}get(e){return e<=-1?this.low:e<0?he(this.low,this.normal,(e- -1)/1):e<.5?he(this.normal,this.medium,(e-0)/.5):e<1?he(this.medium,this.high,(e-.5)/.5):this.high}}class V{constructor(e,t,r,n,o,i){this.roleA=e,this.roleB=t,this.delta=r,this.polarity=n,this.stayTogether=o,this.constraint=i,this.constraint=i??"exact"}}var u;(function(a){a[a.MONOCHROME=0]="MONOCHROME",a[a.NEUTRAL=1]="NEUTRAL",a[a.TONAL_SPOT=2]="TONAL_SPOT",a[a.VIBRANT=3]="VIBRANT",a[a.EXPRESSIVE=4]="EXPRESSIVE",a[a.FIDELITY=5]="FIDELITY",a[a.CONTENT=6]="CONTENT",a[a.RAINBOW=7]="RAINBOW",a[a.FRUIT_SALAD=8]="FRUIT_SALAD"})(u||(u={}));function se(a){return a.variant===u.FIDELITY||a.variant===u.CONTENT}function H(a){return a.variant===u.MONOCHROME}function pt(a,e,t,r){let n=t,o=E.from(a,e,t);if(o.chroma<e){let i=o.chroma;for(;o.chroma<e;){n+=r?-1:1;const c=E.from(a,e,n);if(i>c.chroma||Math.abs(c.chroma-e)<.4)break;const f=Math.abs(c.chroma-e),p=Math.abs(o.chroma-e);f<p&&(o=c),i=Math.max(i,c.chroma)}}return n}class gt{primaryPaletteKeyColor(){return l.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone})}secondaryPaletteKeyColor(){return l.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone})}tertiaryPaletteKeyColor(){return l.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone})}neutralPaletteKeyColor(){return l.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone})}neutralVariantPaletteKeyColor(){return l.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone})}errorPaletteKeyColor(){return l.fromPalette({name:"error_palette_key_color",palette:e=>e.errorPalette,tone:e=>e.errorPalette.keyColor.tone})}background(){return l.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}onBackground(){return l.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.background(),contrastCurve:e=>new b(3,3,4.5,7)})}surface(){return l.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}surfaceDim(){return l.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new b(87,87,80,75).get(e.contrastLevel),isBackground:!0})}surfaceBright(){return l.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new b(24,24,29,34).get(e.contrastLevel):98,isBackground:!0})}surfaceContainerLowest(){return l.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new b(4,4,2,0).get(e.contrastLevel):100,isBackground:!0})}surfaceContainerLow(){return l.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new b(10,10,11,12).get(e.contrastLevel):new b(96,96,96,95).get(e.contrastLevel),isBackground:!0})}surfaceContainer(){return l.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new b(12,12,16,20).get(e.contrastLevel):new b(94,94,92,90).get(e.contrastLevel),isBackground:!0})}surfaceContainerHigh(){return l.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new b(17,17,21,25).get(e.contrastLevel):new b(92,92,88,85).get(e.contrastLevel),isBackground:!0})}surfaceContainerHighest(){return l.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new b(22,22,26,30).get(e.contrastLevel):new b(90,90,84,80).get(e.contrastLevel),isBackground:!0})}onSurface(){return l.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.highestSurface(e),contrastCurve:e=>new b(4.5,7,11,21)})}surfaceVariant(){return l.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0})}onSurfaceVariant(){return l.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>this.highestSurface(e),contrastCurve:e=>new b(3,4.5,7,11)})}inverseSurface(){return l.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20,isBackground:!0})}inverseOnSurface(){return l.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>this.inverseSurface(),contrastCurve:e=>new b(4.5,7,11,21)})}outline(){return l.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1.5,3,4.5,7)})}outlineVariant(){return l.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5)})}shadow(){return l.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0})}scrim(){return l.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0})}surfaceTint(){return l.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0})}primary(){return l.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>H(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(3,4.5,7,7),toneDeltaPair:e=>new V(this.primaryContainer(),this.primary(),10,"nearer",!1)})}primaryDim(){}onPrimary(){return l.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>H(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.primary(),contrastCurve:e=>new b(4.5,7,11,21)})}primaryContainer(){return l.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>se(e)?e.sourceColorHct.tone:H(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.primaryContainer(),this.primary(),10,"nearer",!1)})}onPrimaryContainer(){return l.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>se(e)?l.foregroundTone(this.primaryContainer().tone(e),4.5):H(e)?e.isDark?0:100:e.isDark?90:30,background:e=>this.primaryContainer(),contrastCurve:e=>new b(3,4.5,7,11)})}inversePrimary(){return l.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>this.inverseSurface(),contrastCurve:e=>new b(3,4.5,7,7)})}secondary(){return l.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(3,4.5,7,7),toneDeltaPair:e=>new V(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}secondaryDim(){}onSecondary(){return l.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>H(e)?e.isDark?10:100:e.isDark?20:100,background:e=>this.secondary(),contrastCurve:e=>new b(4.5,7,11,21)})}secondaryContainer(){return l.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;return H(e)?e.isDark?30:85:se(e)?pt(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark):t},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}onSecondaryContainer(){return l.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>H(e)?e.isDark?90:10:se(e)?l.foregroundTone(this.secondaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.secondaryContainer(),contrastCurve:e=>new b(3,4.5,7,11)})}tertiary(){return l.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>H(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(3,4.5,7,7),toneDeltaPair:e=>new V(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}tertiaryDim(){}onTertiary(){return l.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>H(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.tertiary(),contrastCurve:e=>new b(4.5,7,11,21)})}tertiaryContainer(){return l.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(H(e))return e.isDark?60:49;if(!se(e))return e.isDark?30:90;const t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return de.fixIfDisliked(t).tone},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}onTertiaryContainer(){return l.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>H(e)?e.isDark?0:100:se(e)?l.foregroundTone(this.tertiaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.tertiaryContainer(),contrastCurve:e=>new b(3,4.5,7,11)})}error(){return l.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(3,4.5,7,7),toneDeltaPair:e=>new V(this.errorContainer(),this.error(),10,"nearer",!1)})}errorDim(){}onError(){return l.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>this.error(),contrastCurve:e=>new b(4.5,7,11,21)})}errorContainer(){return l.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.errorContainer(),this.error(),10,"nearer",!1)})}onErrorContainer(){return l.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>H(e)?e.isDark?90:10:e.isDark?90:30,background:e=>this.errorContainer(),contrastCurve:e=>new b(3,4.5,7,11)})}primaryFixed(){return l.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>H(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}primaryFixedDim(){return l.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>H(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}onPrimaryFixed(){return l.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>H(e)?100:10,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new b(4.5,7,11,21)})}onPrimaryFixedVariant(){return l.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>H(e)?90:30,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new b(3,4.5,7,11)})}secondaryFixed(){return l.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>H(e)?80:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}secondaryFixedDim(){return l.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>H(e)?70:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}onSecondaryFixed(){return l.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new b(4.5,7,11,21)})}onSecondaryFixedVariant(){return l.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>H(e)?25:30,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new b(3,4.5,7,11)})}tertiaryFixed(){return l.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>H(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}tertiaryFixedDim(){return l.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>H(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new b(1,1,3,4.5),toneDeltaPair:e=>new V(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}onTertiaryFixed(){return l.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>H(e)?100:10,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new b(4.5,7,11,21)})}onTertiaryFixedVariant(){return l.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>H(e)?90:30,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new b(3,4.5,7,11)})}highestSurface(e){return e.isDark?this.surfaceBright():this.surfaceDim()}}function B(a,e=0,t=100,r=1){let n=Ke(a.hue,a.chroma*r,100,!0);return G(e,t,n)}function ne(a,e=0,t=100){let r=Ke(a.hue,a.chroma,0,!1);return G(e,t,r)}function Ke(a,e,t,r){let n=t,o=E.from(a,e,n);for(;o.chroma<e&&!(t<0||t>100);){t+=r?-1:1;const i=E.from(a,e,t);o.chroma<i.chroma&&(o=i,n=t)}return n}function w(a){return a===1.5?new b(1.5,1.5,3,5.5):a===3?new b(3,3,4.5,7):a===4.5?new b(4.5,4.5,7,11):a===6?new b(6,6,7,11):a===7?new b(7,7,11,21):a===9?new b(9,9,11,21):a===11?new b(11,11,21,21):a===21?new b(21,21,21,21):new b(a,a,7,21)}class yt extends gt{surface(){const e=l.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>(super.surface().tone(t),t.platform==="phone"?t.isDark?4:E.isYellow(t.neutralPalette.hue)?99:t.variant===u.VIBRANT?97:98:0),isBackground:!0});return F(super.surface(),"2025",e)}surfaceDim(){const e=l.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?4:E.isYellow(t.neutralPalette.hue)?90:t.variant===u.VIBRANT?85:87,isBackground:!0,chromaMultiplier:t=>{if(!t.isDark){if(t.variant===u.NEUTRAL)return 2.5;if(t.variant===u.TONAL_SPOT)return 1.7;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?2.7:1.75;if(t.variant===u.VIBRANT)return 1.36}return 1}});return F(super.surfaceDim(),"2025",e)}surfaceBright(){const e=l.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?18:E.isYellow(t.neutralPalette.hue)?99:t.variant===u.VIBRANT?97:98,isBackground:!0,chromaMultiplier:t=>{if(t.isDark){if(t.variant===u.NEUTRAL)return 2.5;if(t.variant===u.TONAL_SPOT)return 1.7;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?2.7:1.75;if(t.variant===u.VIBRANT)return 1.36}return 1}});return F(super.surfaceBright(),"2025",e)}surfaceContainerLowest(){const e=l.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?0:100,isBackground:!0});return F(super.surfaceContainerLowest(),"2025",e)}surfaceContainerLow(){const e=l.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.platform==="phone"?t.isDark?6:E.isYellow(t.neutralPalette.hue)?98:t.variant===u.VIBRANT?95:96:15,isBackground:!0,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 1.3;if(t.variant===u.TONAL_SPOT)return 1.25;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?1.3:1.15;if(t.variant===u.VIBRANT)return 1.08}return 1}});return F(super.surfaceContainerLow(),"2025",e)}surfaceContainer(){const e=l.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.platform==="phone"?t.isDark?9:E.isYellow(t.neutralPalette.hue)?96:t.variant===u.VIBRANT?92:94:20,isBackground:!0,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 1.6;if(t.variant===u.TONAL_SPOT)return 1.4;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?1.6:1.3;if(t.variant===u.VIBRANT)return 1.15}return 1}});return F(super.surfaceContainer(),"2025",e)}surfaceContainerHigh(){const e=l.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.platform==="phone"?t.isDark?12:E.isYellow(t.neutralPalette.hue)?94:t.variant===u.VIBRANT?90:92:25,isBackground:!0,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 1.9;if(t.variant===u.TONAL_SPOT)return 1.5;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?1.95:1.45;if(t.variant===u.VIBRANT)return 1.22}return 1}});return F(super.surfaceContainerHigh(),"2025",e)}surfaceContainerHighest(){const e=l.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?15:E.isYellow(t.neutralPalette.hue)?92:t.variant===u.VIBRANT?88:90,isBackground:!0,chromaMultiplier:t=>t.variant===u.NEUTRAL?2.2:t.variant===u.TONAL_SPOT?1.7:t.variant===u.EXPRESSIVE?E.isYellow(t.neutralPalette.hue)?2.3:1.6:t.variant===u.VIBRANT?1.29:1});return F(super.surfaceContainerHighest(),"2025",e)}onSurface(){const e=l.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.variant===u.VIBRANT?B(t.neutralPalette,0,100,1.1):l.getInitialToneFromBackground(r=>r.platform==="phone"?this.highestSurface(r):this.surfaceContainerHigh())(t),chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 2.2;if(t.variant===u.TONAL_SPOT)return 1.7;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?t.isDark?3:2.3:1.6}return 1},background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.isDark&&t.platform==="phone"?w(11):w(9)});return F(super.onSurface(),"2025",e)}onSurfaceVariant(){const e=l.fromPalette({name:"on_surface_variant",palette:t=>t.neutralPalette,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 2.2;if(t.variant===u.TONAL_SPOT)return 1.7;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?t.isDark?3:2.3:1.6}return 1},background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?t.isDark?w(6):w(4.5):w(7)});return F(super.onSurfaceVariant(),"2025",e)}outline(){const e=l.fromPalette({name:"outline",palette:t=>t.neutralPalette,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 2.2;if(t.variant===u.TONAL_SPOT)return 1.7;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?t.isDark?3:2.3:1.6}return 1},background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?w(3):w(4.5)});return F(super.outline(),"2025",e)}outlineVariant(){const e=l.fromPalette({name:"outline_variant",palette:t=>t.neutralPalette,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===u.NEUTRAL)return 2.2;if(t.variant===u.TONAL_SPOT)return 1.7;if(t.variant===u.EXPRESSIVE)return E.isYellow(t.neutralPalette.hue)?t.isDark?3:2.3:1.6}return 1},background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?w(1.5):w(3)});return F(super.outlineVariant(),"2025",e)}inverseSurface(){const e=l.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?98:4,isBackground:!0});return F(super.inverseSurface(),"2025",e)}inverseOnSurface(){const e=l.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,background:t=>this.inverseSurface(),contrastCurve:t=>w(7)});return F(super.inverseOnSurface(),"2025",e)}primary(){const e=l.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>t.variant===u.NEUTRAL?t.platform==="phone"?t.isDark?80:40:90:t.variant===u.TONAL_SPOT?t.platform==="phone"?t.isDark?80:B(t.primaryPalette):B(t.primaryPalette,0,90):t.variant===u.EXPRESSIVE?t.platform==="phone"?B(t.primaryPalette,0,E.isYellow(t.primaryPalette.hue)?25:E.isCyan(t.primaryPalette.hue)?88:98):B(t.primaryPalette):t.platform==="phone"?B(t.primaryPalette,0,E.isCyan(t.primaryPalette.hue)?88:98):B(t.primaryPalette),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?w(4.5):w(7),toneDeltaPai