@m3e/web 2.5.6 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +224 -27
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +28 -28
- package/dist/all.min.js.map +1 -1
- package/dist/css-custom-data.json +354 -354
- package/dist/custom-elements.json +5151 -4998
- package/dist/html-custom-data.json +271 -271
- package/dist/slide-group.js +6 -1
- package/dist/slide-group.js.map +1 -1
- package/dist/slide-group.min.js +1 -1
- package/dist/slide-group.min.js.map +1 -1
- package/dist/src/slide-group/SlideGroupElement.d.ts.map +1 -1
- package/dist/src/tabs/TabsElement.d.ts +2 -1
- package/dist/src/tabs/TabsElement.d.ts.map +1 -1
- package/dist/src/theme/ThemeElement.d.ts.map +1 -1
- package/dist/tabs.js +186 -15
- package/dist/tabs.js.map +1 -1
- package/dist/tabs.min.js +1 -1
- package/dist/tabs.min.js.map +1 -1
- package/dist/theme.js +34 -13
- package/dist/theme.js.map +1 -1
- package/dist/theme.min.js +23 -23
- package/dist/theme.min.js.map +1 -1
- package/package.json +1 -1
package/dist/theme.min.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2025–2026 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as r}from"tslib";import{css as n,LitElement as a,html as o}from"lit";import{property as i}from"lit/decorators.js";import{
|
|
6
|
+
import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as r}from"tslib";import{css as n,LitElement as a,html as o}from"lit";import{property as i}from"lit/decorators.js";import{customElement as s,DesignToken as c}from"@m3e/web/core";
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2021 Google LLC
|
|
@@ -20,7 +20,7 @@ import{__decorate as t,__classPrivateFieldGet as e,__classPrivateFieldSet as r}f
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License.
|
|
22
22
|
*/
|
|
23
|
-
function h(t){return t<0?-1:0===t?0:1}function
|
|
23
|
+
function h(t){return t<0?-1:0===t?0:1}function u(t,e,r){return(1-r)*t+r*e}function l(t,e,r){return r<t?t:r>e?e:r}function m(t){return(t%=360)<0&&(t+=360),t}function d(t){return(t%=360)<0&&(t+=360),t}function g(t,e){return[t[0]*e[0][0]+t[1]*e[0][1]+t[2]*e[0][2],t[0]*e[1][0]+t[1]*e[1][1]+t[2]*e[1][2],t[0]*e[2][0]+t[1]*e[2][1]+t[2]*e[2][2]]}
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2021 Google LLC
|
|
@@ -36,7 +36,7 @@ function h(t){return t<0?-1:0===t?0:1}function l(t,e,r){return(1-r)*t+r*e}functi
|
|
|
36
36
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
37
37
|
* See the License for the specific language governing permissions and
|
|
38
38
|
* limitations under the License.
|
|
39
|
-
*/const f=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],y=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],b=[95.047,100,108.883];function p(t,e,r){return(255<<24|(255&t)<<16|(255&e)<<8|255&r)>>>0}function w(t){return p(_(t[0]),_(t[1]),_(t[2]))}function C(t){return t>>24&255}function P(t){return t>>16&255}function M(t){return t>>8&255}function k(t){return 255&t}function A(t,e,r){const n=y,a=n[0][0]*t+n[0][1]*e+n[0][2]*r,o=n[1][0]*t+n[1][1]*e+n[1][2]*r,i=n[2][0]*t+n[2][1]*e+n[2][2]*r;return p(_(a),_(o),_(i))}function x(t){const e=function(t){return
|
|
39
|
+
*/const f=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],y=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],b=[95.047,100,108.883];function p(t,e,r){return(255<<24|(255&t)<<16|(255&e)<<8|255&r)>>>0}function w(t){return p(_(t[0]),_(t[1]),_(t[2]))}function C(t){return t>>24&255}function P(t){return t>>16&255}function M(t){return t>>8&255}function k(t){return 255&t}function A(t,e,r){const n=y,a=n[0][0]*t+n[0][1]*e+n[0][2]*r,o=n[1][0]*t+n[1][1]*e+n[1][2]*r,i=n[2][0]*t+n[2][1]*e+n[2][2]*r;return p(_(a),_(o),_(i))}function x(t){const e=function(t){return g([D(P(t)),D(M(t)),D(k(t))],f)}(t)[1];return 116*S(e/100)-16}function I(t){return 100*T((t+16)/116)}function v(t){return 116*S(t/100)-16}function D(t){const e=t/255;return e<=.040449936?e/12.92*100:100*Math.pow((e+.055)/1.055,2.4)}function _(t){const e=t/100;let r=0;return r=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,n=0,a=255,(o=Math.round(255*r))<n?n:o>a?a:o;var n,a,o}function S(t){const e=24389/27;return t>216/24389?Math.pow(t,1/3):(e*t+16)/116}function T(t){const e=t*t*t;return e>216/24389?e:(116*t-16)/(24389/27)}
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2021 Google LLC
|
|
@@ -52,7 +52,7 @@ function h(t){return t<0?-1:0===t?0:1}function l(t,e,r){return(1-r)*t+r*e}functi
|
|
|
52
52
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
53
|
* See the License for the specific language governing permissions and
|
|
54
54
|
* limitations under the License.
|
|
55
|
-
*/class R{static make(t=function(){return b}(),e=200/Math.PI*I(50)/100,r=50,n=2,a=!1){const o=t,i=.401288*o[0]+.650173*o[1]+-.051461*o[2],s=-.250268*o[0]+1.204414*o[1]+.045854*o[2],c=-.002079*o[0]+.048952*o[1]+.953127*o[2],h=.8+n/10,
|
|
55
|
+
*/class R{static make(t=function(){return b}(),e=200/Math.PI*I(50)/100,r=50,n=2,a=!1){const o=t,i=.401288*o[0]+.650173*o[1]+-.051461*o[2],s=-.250268*o[0]+1.204414*o[1]+.045854*o[2],c=-.002079*o[0]+.048952*o[1]+.953127*o[2],h=.8+n/10,l=h>=.9?u(.59,.69,10*(h-.9)):u(.525,.59,10*(h-.8));let m=a?1:h*(1-1/3.6*Math.exp((-e-42)/92));m=m>1?1:m<0?0:m;const d=h,g=[m*(100/i)+1-m,m*(100/s)+1-m,m*(100/c)+1-m],f=1/(5*e+1),y=f*f*f*f,p=1-y,w=y*e+.1*p*p*Math.cbrt(5*e),C=I(r)/t[1],P=1.48+Math.sqrt(C),M=.725/Math.pow(C,.2),k=M,A=[Math.pow(w*g[0]*i/100,.42),Math.pow(w*g[1]*s/100,.42),Math.pow(w*g[2]*c/100,.42)],x=[400*A[0]/(A[0]+27.13),400*A[1]/(A[1]+27.13),400*A[2]/(A[2]+27.13)];return new R(C,(2*x[0]+x[1]+.05*x[2])*M,M,k,l,d,g,w,Math.pow(w,.25),P)}constructor(t,e,r,n,a,o,i,s,c,h){this.n=t,this.aw=e,this.nbb=r,this.ncb=n,this.c=a,this.nc=o,this.rgbD=i,this.fl=s,this.fLRoot=c,this.z=h}}R.DEFAULT=R.make();
|
|
56
56
|
/**
|
|
57
57
|
* @license
|
|
58
58
|
* Copyright 2021 Google LLC
|
|
@@ -69,7 +69,7 @@ function h(t){return t<0?-1:0===t?0:1}function l(t,e,r){return(1-r)*t+r*e}functi
|
|
|
69
69
|
* See the License for the specific language governing permissions and
|
|
70
70
|
* limitations under the License.
|
|
71
71
|
*/
|
|
72
|
-
class
|
|
72
|
+
class F{constructor(t,e,r,n,a,o,i,s,c){this.hue=t,this.chroma=e,this.j=r,this.q=n,this.m=a,this.s=o,this.jstar=i,this.astar=s,this.bstar=c}distance(t){const e=this.jstar-t.jstar,r=this.astar-t.astar,n=this.bstar-t.bstar,a=Math.sqrt(e*e+r*r+n*n);return 1.41*Math.pow(a,.63)}static fromInt(t){return F.fromIntInViewingConditions(t,R.DEFAULT)}static fromIntInViewingConditions(t,e){const r=(65280&t)>>8,n=255&t,a=D((16711680&t)>>16),o=D(r),i=D(n),s=.41233895*a+.35762064*o+.18051042*i,c=.2126*a+.7152*o+.0722*i,u=.01932141*a+.11916382*o+.95034478*i,l=.401288*s+.650173*c-.051461*u,m=-.250268*s+1.204414*c+.045854*u,d=-.002079*s+.048952*c+.953127*u,g=e.rgbD[0]*l,f=e.rgbD[1]*m,y=e.rgbD[2]*d,b=Math.pow(e.fl*Math.abs(g)/100,.42),p=Math.pow(e.fl*Math.abs(f)/100,.42),w=Math.pow(e.fl*Math.abs(y)/100,.42),C=400*h(g)*b/(b+27.13),P=400*h(f)*p/(p+27.13),M=400*h(y)*w/(w+27.13),k=(11*C+-12*P+M)/11,A=(C+P-2*M)/9,x=(20*C+20*P+21*M)/20,I=(40*C+20*P+M)/20,v=180*Math.atan2(A,k)/Math.PI,_=v<0?v+360:v>=360?v-360:v,S=_*Math.PI/180,T=I*e.nbb,R=100*Math.pow(T/e.aw,e.c*e.z),B=4/e.c*Math.sqrt(R/100)*(e.aw+4)*e.fLRoot,L=_<20.14?_+360:_,O=5e4/13*(.25*(Math.cos(L*Math.PI/180+2)+3.8))*e.nc*e.ncb*Math.sqrt(k*k+A*A)/(x+.305),E=Math.pow(O,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),H=E*Math.sqrt(R/100),V=H*e.fLRoot,z=50*Math.sqrt(E*e.c/(e.aw+4)),N=(1+100*.007)*R/(1+.007*R),q=1/.0228*Math.log(1+.0228*V),G=q*Math.cos(S),U=q*Math.sin(S);return new F(_,H,R,B,V,z,N,G,U)}static fromJch(t,e,r){return F.fromJchInViewingConditions(t,e,r,R.DEFAULT)}static fromJchInViewingConditions(t,e,r,n){const a=4/n.c*Math.sqrt(t/100)*(n.aw+4)*n.fLRoot,o=e*n.fLRoot,i=e/Math.sqrt(t/100),s=50*Math.sqrt(i*n.c/(n.aw+4)),c=r*Math.PI/180,h=(1+100*.007)*t/(1+.007*t),u=1/.0228*Math.log(1+.0228*o),l=u*Math.cos(c),m=u*Math.sin(c);return new F(r,e,t,a,o,s,h,l,m)}static fromUcs(t,e,r){return F.fromUcsInViewingConditions(t,e,r,R.DEFAULT)}static fromUcsInViewingConditions(t,e,r,n){const a=e,o=r,i=Math.sqrt(a*a+o*o),s=(Math.exp(.0228*i)-1)/.0228/n.fLRoot;let c=Math.atan2(o,a)*(180/Math.PI);c<0&&(c+=360);const h=t/(1-.007*(t-100));return F.fromJchInViewingConditions(h,s,c,n)}toInt(){return this.viewed(R.DEFAULT)}viewed(t){const e=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(e/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),n=this.hue*Math.PI/180,a=.25*(Math.cos(n+2)+3.8),o=t.aw*Math.pow(this.j/100,1/t.c/t.z),i=a*(5e4/13)*t.nc*t.ncb,s=o/t.nbb,c=Math.sin(n),u=Math.cos(n),l=23*(s+.305)*r/(23*i+11*r*u+108*r*c),m=l*u,d=l*c,g=(460*s+451*m+288*d)/1403,f=(460*s-891*m-261*d)/1403,y=(460*s-220*m-6300*d)/1403,b=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),p=h(g)*(100/t.fl)*Math.pow(b,1/.42),w=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=h(f)*(100/t.fl)*Math.pow(w,1/.42),P=Math.max(0,27.13*Math.abs(y)/(400-Math.abs(y))),M=h(y)*(100/t.fl)*Math.pow(P,1/.42),k=p/t.rgbD[0],x=C/t.rgbD[1],I=M/t.rgbD[2];return A(1.86206786*k-1.01125463*x+.14918677*I,.38752654*k+.62144744*x-.00897398*I,-.0158415*k-.03412294*x+1.04996444*I)}static fromXyzInViewingConditions(t,e,r,n){const a=.401288*t+.650173*e-.051461*r,o=-.250268*t+1.204414*e+.045854*r,i=-.002079*t+.048952*e+.953127*r,s=n.rgbD[0]*a,c=n.rgbD[1]*o,u=n.rgbD[2]*i,l=Math.pow(n.fl*Math.abs(s)/100,.42),m=Math.pow(n.fl*Math.abs(c)/100,.42),d=Math.pow(n.fl*Math.abs(u)/100,.42),g=400*h(s)*l/(l+27.13),f=400*h(c)*m/(m+27.13),y=400*h(u)*d/(d+27.13),b=(11*g+-12*f+y)/11,p=(g+f-2*y)/9,w=(20*g+20*f+21*y)/20,C=(40*g+20*f+y)/20,P=180*Math.atan2(p,b)/Math.PI,M=P<0?P+360:P>=360?P-360:P,k=M*Math.PI/180,A=C*n.nbb,x=100*Math.pow(A/n.aw,n.c*n.z),I=4/n.c*Math.sqrt(x/100)*(n.aw+4)*n.fLRoot,v=M<20.14?M+360:M,D=5e4/13*(1/4*(Math.cos(v*Math.PI/180+2)+3.8))*n.nc*n.ncb*Math.sqrt(b*b+p*p)/(w+.305),_=Math.pow(D,.9)*Math.pow(1.64-Math.pow(.29,n.n),.73),S=_*Math.sqrt(x/100),T=S*n.fLRoot,R=50*Math.sqrt(_*n.c/(n.aw+4)),B=(1+100*.007)*x/(1+.007*x),L=Math.log(1+.0228*T)/.0228,O=L*Math.cos(k),E=L*Math.sin(k);return new F(M,S,x,I,T,R,B,O,E)}xyzInViewingConditions(t){const e=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(e/Math.pow(1.64-Math.pow(.29,t.n),.73),1/.9),n=this.hue*Math.PI/180,a=.25*(Math.cos(n+2)+3.8),o=t.aw*Math.pow(this.j/100,1/t.c/t.z),i=a*(5e4/13)*t.nc*t.ncb,s=o/t.nbb,c=Math.sin(n),u=Math.cos(n),l=23*(s+.305)*r/(23*i+11*r*u+108*r*c),m=l*u,d=l*c,g=(460*s+451*m+288*d)/1403,f=(460*s-891*m-261*d)/1403,y=(460*s-220*m-6300*d)/1403,b=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),p=h(g)*(100/t.fl)*Math.pow(b,1/.42),w=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=h(f)*(100/t.fl)*Math.pow(w,1/.42),P=Math.max(0,27.13*Math.abs(y)/(400-Math.abs(y))),M=h(y)*(100/t.fl)*Math.pow(P,1/.42),k=p/t.rgbD[0],A=C/t.rgbD[1],x=M/t.rgbD[2];return[1.86206786*k-1.01125463*A+.14918677*x,.38752654*k+.62144744*A-.00897398*x,-.0158415*k-.03412294*A+1.04996444*x]}}
|
|
73
73
|
/**
|
|
74
74
|
* @license
|
|
75
75
|
* Copyright 2021 Google LLC
|
|
@@ -85,7 +85,7 @@ class B{constructor(t,e,r,n,a,o,i,s,c){this.hue=t,this.chroma=e,this.j=r,this.q=
|
|
|
85
85
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
86
|
* See the License for the specific language governing permissions and
|
|
87
87
|
* limitations under the License.
|
|
88
|
-
*/class
|
|
88
|
+
*/class B{static sanitizeRadians(t){return(t+8*Math.PI)%(2*Math.PI)}static trueDelinearized(t){const e=t/100;let r=0;return r=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,255*r}static chromaticAdaptation(t){const e=Math.pow(Math.abs(t),.42);return 400*h(t)*e/(e+27.13)}static hueOf(t){const e=g(t,B.SCALED_DISCOUNT_FROM_LINRGB),r=B.chromaticAdaptation(e[0]),n=B.chromaticAdaptation(e[1]),a=B.chromaticAdaptation(e[2]),o=(11*r+-12*n+a)/11,i=(r+n-2*a)/9;return Math.atan2(i,o)}static areInCyclicOrder(t,e,r){return B.sanitizeRadians(e-t)<B.sanitizeRadians(r-t)}static intercept(t,e,r){return(e-t)/(r-t)}static lerpPoint(t,e,r){return[t[0]+(r[0]-t[0])*e,t[1]+(r[1]-t[1])*e,t[2]+(r[2]-t[2])*e]}static setCoordinate(t,e,r,n){const a=B.intercept(t[n],e,r[n]);return B.lerpPoint(t,a,r)}static isBounded(t){return 0<=t&&t<=100}static nthVertex(t,e){const r=B.Y_FROM_LINRGB[0],n=B.Y_FROM_LINRGB[1],a=B.Y_FROM_LINRGB[2],o=e%4<=1?0:100,i=e%2==0?0:100;if(e<4){const e=o,s=i,c=(t-e*n-s*a)/r;return B.isBounded(c)?[c,e,s]:[-1,-1,-1]}if(e<8){const e=o,s=i,c=(t-s*r-e*a)/n;return B.isBounded(c)?[s,c,e]:[-1,-1,-1]}{const e=o,s=i,c=(t-e*r-s*n)/a;return B.isBounded(c)?[e,s,c]:[-1,-1,-1]}}static bisectToSegment(t,e){let r=[-1,-1,-1],n=r,a=0,o=0,i=!1,s=!0;for(let c=0;c<12;c++){const h=B.nthVertex(t,c);if(h[0]<0)continue;const u=B.hueOf(h);i?(s||B.areInCyclicOrder(a,u,o))&&(s=!1,B.areInCyclicOrder(a,e,u)?(n=h,o=u):(r=h,a=u)):(r=h,n=h,a=u,o=u,i=!0)}return[r,n]}static midpoint(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2,(t[2]+e[2])/2]}static criticalPlaneBelow(t){return Math.floor(t-.5)}static criticalPlaneAbove(t){return Math.ceil(t-.5)}static bisectToLimit(t,e){const r=B.bisectToSegment(t,e);let n=r[0],a=B.hueOf(n),o=r[1];for(let t=0;t<3;t++)if(n[t]!==o[t]){let r=-1,i=255;n[t]<o[t]?(r=B.criticalPlaneBelow(B.trueDelinearized(n[t])),i=B.criticalPlaneAbove(B.trueDelinearized(o[t]))):(r=B.criticalPlaneAbove(B.trueDelinearized(n[t])),i=B.criticalPlaneBelow(B.trueDelinearized(o[t])));for(let s=0;s<8&&!(Math.abs(i-r)<=1);s++){const s=Math.floor((r+i)/2),c=B.CRITICAL_PLANES[s],h=B.setCoordinate(n,c,o,t),u=B.hueOf(h);B.areInCyclicOrder(a,e,u)?(o=h,i=s):(n=h,a=u,r=s)}}return B.midpoint(n,o)}static inverseChromaticAdaptation(t){const e=Math.abs(t),r=Math.max(0,27.13*e/(400-e));return h(t)*Math.pow(r,1/.42)}static findResultByJ(t,e,r){let n=11*Math.sqrt(r);const a=R.DEFAULT,o=1/Math.pow(1.64-Math.pow(.29,a.n),.73),i=.25*(Math.cos(t+2)+3.8)*(5e4/13)*a.nc*a.ncb,s=Math.sin(t),c=Math.cos(t);for(let t=0;t<5;t++){const h=n/100,u=0===e||0===n?0:e/Math.sqrt(h),l=Math.pow(u*o,1/.9),m=a.aw*Math.pow(h,1/a.c/a.z)/a.nbb,d=23*(m+.305)*l/(23*i+11*l*c+108*l*s),f=d*c,y=d*s,b=(460*m+451*f+288*y)/1403,p=(460*m-891*f-261*y)/1403,C=(460*m-220*f-6300*y)/1403,P=g([B.inverseChromaticAdaptation(b),B.inverseChromaticAdaptation(p),B.inverseChromaticAdaptation(C)],B.LINRGB_FROM_SCALED_DISCOUNT);if(P[0]<0||P[1]<0||P[2]<0)return 0;const M=B.Y_FROM_LINRGB[0],k=B.Y_FROM_LINRGB[1],A=B.Y_FROM_LINRGB[2],x=M*P[0]+k*P[1]+A*P[2];if(x<=0)return 0;if(4===t||Math.abs(x-r)<.002)return P[0]>100.01||P[1]>100.01||P[2]>100.01?0:w(P);n-=(x-r)*n/(2*x)}return 0}static solveToInt(t,e,r){if(e<1e-4||r<1e-4||r>99.9999)return function(t){const e=_(I(t));return p(e,e,e)}(r);const n=(t=d(t))/180*Math.PI,a=I(r),o=B.findResultByJ(n,e,a);if(0!==o)return o;return w(B.bisectToLimit(a,n))}static solveToCam(t,e,r){return F.fromInt(B.solveToInt(t,e,r))}}B.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],B.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],B.Y_FROM_LINRGB=[.2126,.7152,.0722],B.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];
|
|
89
89
|
/**
|
|
90
90
|
* @license
|
|
91
91
|
* Copyright 2021 Google LLC
|
|
@@ -102,7 +102,7 @@ class B{constructor(t,e,r,n,a,o,i,s,c){this.hue=t,this.chroma=e,this.j=r,this.q=
|
|
|
102
102
|
* See the License for the specific language governing permissions and
|
|
103
103
|
* limitations under the License.
|
|
104
104
|
*/
|
|
105
|
-
class
|
|
105
|
+
class L{static from(t,e,r){return new L(B.solveToInt(t,e,r))}static fromInt(t){return new L(t)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(t){this.setInternalState(B.solveToInt(t,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(t){this.setInternalState(B.solveToInt(this.internalHue,t,this.internalTone))}get tone(){return this.internalTone}set tone(t){this.setInternalState(B.solveToInt(this.internalHue,this.internalChroma,t))}constructor(t){this.argb=t;const e=F.fromInt(t);this.internalHue=e.hue,this.internalChroma=e.chroma,this.internalTone=x(t),this.argb=t}setInternalState(t){const e=F.fromInt(t);this.internalHue=e.hue,this.internalChroma=e.chroma,this.internalTone=x(t),this.argb=t}inViewingConditions(t){const e=F.fromInt(this.toInt()).xyzInViewingConditions(t),r=F.fromXyzInViewingConditions(e[0],e[1],e[2],R.make());return L.from(r.hue,r.chroma,v(e[1]))}}
|
|
106
106
|
/**
|
|
107
107
|
* @license
|
|
108
108
|
* Copyright 2022 Google LLC
|
|
@@ -118,7 +118,7 @@ class E{static from(t,e,r){return new E(S.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
118
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
119
|
* See the License for the specific language governing permissions and
|
|
120
120
|
* limitations under the License.
|
|
121
|
-
*/class
|
|
121
|
+
*/class O{static ratioOfTones(t,e){return t=l(0,100,t),e=l(0,100,e),O.ratioOfYs(I(t),I(e))}static ratioOfYs(t,e){const r=t>e?t:e;return(r+5)/((r===e?t:e)+5)}static lighter(t,e){if(t<0||t>100)return-1;const r=I(t),n=e*(r+5)-5,a=O.ratioOfYs(n,r),o=Math.abs(a-e);if(a<e&&o>.04)return-1;const i=v(n)+.4;return i<0||i>100?-1:i}static darker(t,e){if(t<0||t>100)return-1;const r=I(t),n=(r+5)/e-5,a=O.ratioOfYs(r,n),o=Math.abs(a-e);if(a<e&&o>.04)return-1;const i=v(n)-.4;return i<0||i>100?-1:i}static lighterUnsafe(t,e){const r=O.lighter(t,e);return r<0?100:r}static darkerUnsafe(t,e){const r=O.darker(t,e);return r<0?0:r}}
|
|
122
122
|
/**
|
|
123
123
|
* @license
|
|
124
124
|
* Copyright 2023 Google LLC
|
|
@@ -134,7 +134,7 @@ class E{static from(t,e,r){return new E(S.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
134
134
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
135
|
* See the License for the specific language governing permissions and
|
|
136
136
|
* limitations under the License.
|
|
137
|
-
*/class
|
|
137
|
+
*/class E{static isDisliked(t){const e=Math.round(t.hue)>=90&&Math.round(t.hue)<=111,r=Math.round(t.chroma)>16,n=Math.round(t.tone)<65;return e&&r&&n}static fixIfDisliked(t){return E.isDisliked(t)?L.from(t.hue,t.chroma,70):t}}
|
|
138
138
|
/**
|
|
139
139
|
* @license
|
|
140
140
|
* Copyright 2022 Google LLC
|
|
@@ -150,7 +150,7 @@ class E{static from(t,e,r){return new E(S.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
150
150
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
151
151
|
* See the License for the specific language governing permissions and
|
|
152
152
|
* limitations under the License.
|
|
153
|
-
*/class H{static fromPalette(t){return new H(t.name??"",t.palette,t.tone,t.isBackground??!1,t.background,t.secondBackground,t.contrastCurve,t.toneDeltaPair)}constructor(t,e,r,n,a,o,i,s){if(this.name=t,this.palette=e,this.tone=r,this.isBackground=n,this.background=a,this.secondBackground=o,this.contrastCurve=i,this.toneDeltaPair=s,this.hctCache=new Map,!a&&o)throw new Error(`Color ${t} has secondBackgrounddefined, but background is not defined.`);if(!a&&i)throw new Error(`Color ${t} has contrastCurvedefined, but background is not defined.`);if(a&&!i)throw new Error(`Color ${t} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(t){return this.getHct(t).toInt()}getHct(t){const e=this.hctCache.get(t);if(null!=e)return e;const r=this.getTone(t),n=this.palette(t).getHct(r);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,n),n}getTone(t){const e=t.contrastLevel<0;if(this.toneDeltaPair){const r=this.toneDeltaPair(t),n=r.roleA,a=r.roleB,o=r.delta,i=r.polarity,s=r.stayTogether,c=this.background(t).getTone(t),h="nearer"===i||"lighter"===i&&!t.isDark||"darker"===i&&t.isDark,
|
|
153
|
+
*/class H{static fromPalette(t){return new H(t.name??"",t.palette,t.tone,t.isBackground??!1,t.background,t.secondBackground,t.contrastCurve,t.toneDeltaPair)}constructor(t,e,r,n,a,o,i,s){if(this.name=t,this.palette=e,this.tone=r,this.isBackground=n,this.background=a,this.secondBackground=o,this.contrastCurve=i,this.toneDeltaPair=s,this.hctCache=new Map,!a&&o)throw new Error(`Color ${t} has secondBackgrounddefined, but background is not defined.`);if(!a&&i)throw new Error(`Color ${t} has contrastCurvedefined, but background is not defined.`);if(a&&!i)throw new Error(`Color ${t} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(t){return this.getHct(t).toInt()}getHct(t){const e=this.hctCache.get(t);if(null!=e)return e;const r=this.getTone(t),n=this.palette(t).getHct(r);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(t,n),n}getTone(t){const e=t.contrastLevel<0;if(this.toneDeltaPair){const r=this.toneDeltaPair(t),n=r.roleA,a=r.roleB,o=r.delta,i=r.polarity,s=r.stayTogether,c=this.background(t).getTone(t),h="nearer"===i||"lighter"===i&&!t.isDark||"darker"===i&&t.isDark,u=h?n:a,m=h?a:n,d=this.name===u.name,g=t.isDark?1:-1,f=u.contrastCurve.get(t.contrastLevel),y=m.contrastCurve.get(t.contrastLevel),b=u.tone(t);let p=O.ratioOfTones(c,b)>=f?b:H.foregroundTone(c,f);const w=m.tone(t);let C=O.ratioOfTones(c,w)>=y?w:H.foregroundTone(c,y);return e&&(p=H.foregroundTone(c,f),C=H.foregroundTone(c,y)),(C-p)*g>=o||(C=l(0,100,p+o*g),(C-p)*g>=o||(p=l(0,100,C-o*g))),50<=p&&p<60?g>0?(p=60,C=Math.max(C,p+o*g)):(p=49,C=Math.min(C,p+o*g)):50<=C&&C<60&&(s?g>0?(p=60,C=Math.max(C,p+o*g)):(p=49,C=Math.min(C,p+o*g)):C=g>0?60:49),d?p:C}{let r=this.tone(t);if(null==this.background)return r;const n=this.background(t).getTone(t),a=this.contrastCurve.get(t.contrastLevel);if(O.ratioOfTones(n,r)>=a||(r=H.foregroundTone(n,a)),e&&(r=H.foregroundTone(n,a)),this.isBackground&&50<=r&&r<60&&(r=O.ratioOfTones(49,n)>=a?49:60),this.secondBackground){const[e,n]=[this.background,this.secondBackground],[o,i]=[e(t).getTone(t),n(t).getTone(t)],[s,c]=[Math.max(o,i),Math.min(o,i)];if(O.ratioOfTones(s,r)>=a&&O.ratioOfTones(c,r)>=a)return r;const h=O.lighter(s,a),u=O.darker(c,a),l=[];-1!==h&&l.push(h),-1!==u&&l.push(u);return H.tonePrefersLightForeground(o)||H.tonePrefersLightForeground(i)?h<0?100:h:1===l.length?l[0]:u<0?0:u}return r}}static foregroundTone(t,e){const r=O.lighterUnsafe(t,e),n=O.darkerUnsafe(t,e),a=O.ratioOfTones(r,t),o=O.ratioOfTones(n,t);if(H.tonePrefersLightForeground(t)){const t=Math.abs(a-o)<.1&&a<e&&o<e;return a>=e||a>=o||t?r:n}return o>=e||o>=a?n:r}static tonePrefersLightForeground(t){return Math.round(t)<60}static toneAllowsLightForeground(t){return Math.round(t)<=49}static enableLightForeground(t){return H.tonePrefersLightForeground(t)&&!H.toneAllowsLightForeground(t)?49:t}}
|
|
154
154
|
/**
|
|
155
155
|
* @license
|
|
156
156
|
* Copyright 2021 Google LLC
|
|
@@ -166,7 +166,7 @@ class E{static from(t,e,r){return new E(S.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
166
166
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
167
167
|
* See the License for the specific language governing permissions and
|
|
168
168
|
* limitations under the License.
|
|
169
|
-
*/class V{static fromInt(t){const e=
|
|
169
|
+
*/class V{static fromInt(t){const e=L.fromInt(t);return V.fromHct(e)}static fromHct(t){return new V(t.hue,t.chroma,t)}static fromHueAndChroma(t,e){const r=new z(t,e).create();return new V(t,e,r)}constructor(t,e,r){this.hue=t,this.chroma=e,this.keyColor=r,this.cache=new Map}tone(t){let e=this.cache.get(t);return void 0===e&&(e=L.from(this.hue,this.chroma,t).toInt(),this.cache.set(t,e)),e}getHct(t){return L.fromInt(this.tone(t))}}class z{constructor(t,e){this.hue=t,this.requestedChroma=e,this.chromaCache=new Map,this.maxChromaValue=200}create(){let t=0,e=100;for(;t<e;){const r=Math.floor((t+e)/2),n=this.maxChroma(r)<this.maxChroma(r+1);if(this.maxChroma(r)>=this.requestedChroma-.01)if(Math.abs(t-50)<Math.abs(e-50))e=r;else{if(t===r)return L.from(this.hue,this.requestedChroma,t);t=r}else n?t=r+1:e=r}return L.from(this.hue,this.requestedChroma,t)}maxChroma(t){if(this.chromaCache.has(t))return this.chromaCache.get(t);const e=L.from(this.hue,this.maxChromaValue,t).chroma;return this.chromaCache.set(t,e),e}}
|
|
170
170
|
/**
|
|
171
171
|
* @license
|
|
172
172
|
* Copyright 2023 Google LLC
|
|
@@ -182,7 +182,7 @@ class E{static from(t,e,r){return new E(S.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
182
182
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
183
|
* See the License for the specific language governing permissions and
|
|
184
184
|
* limitations under the License.
|
|
185
|
-
*/class N{constructor(t,e,r,n){this.low=t,this.normal=e,this.medium=r,this.high=n}get(t){return t<=-1?this.low:t<0?
|
|
185
|
+
*/class N{constructor(t,e,r,n){this.low=t,this.normal=e,this.medium=r,this.high=n}get(t){return t<=-1?this.low:t<0?u(this.low,this.normal,(t- -1)/1):t<.5?u(this.normal,this.medium,(t-0)/.5):t<1?u(this.medium,this.high,(t-.5)/.5):this.high}}
|
|
186
186
|
/**
|
|
187
187
|
* @license
|
|
188
188
|
* Copyright 2023 Google LLC
|
|
@@ -231,7 +231,7 @@ class E{static from(t,e,r){return new E(S.solveToInt(t,e,r))}static fromInt(t){r
|
|
|
231
231
|
* See the License for the specific language governing permissions and
|
|
232
232
|
* limitations under the License.
|
|
233
233
|
*/
|
|
234
|
-
function U(t){return t.variant===G.FIDELITY||t.variant===G.CONTENT}function $(t){return t.variant===G.MONOCHROME}!function(t){t[t.MONOCHROME=0]="MONOCHROME",t[t.NEUTRAL=1]="NEUTRAL",t[t.TONAL_SPOT=2]="TONAL_SPOT",t[t.VIBRANT=3]="VIBRANT",t[t.EXPRESSIVE=4]="EXPRESSIVE",t[t.FIDELITY=5]="FIDELITY",t[t.CONTENT=6]="CONTENT",t[t.RAINBOW=7]="RAINBOW",t[t.FRUIT_SALAD=8]="FRUIT_SALAD"}(G||(G={}));class W{static highestSurface(t){return t.isDark?W.surfaceBright:W.surfaceDim}}W.contentAccentToneDelta=15,W.primaryPaletteKeyColor=H.fromPalette({name:"primary_palette_key_color",palette:t=>t.primaryPalette,tone:t=>t.primaryPalette.keyColor.tone}),W.secondaryPaletteKeyColor=H.fromPalette({name:"secondary_palette_key_color",palette:t=>t.secondaryPalette,tone:t=>t.secondaryPalette.keyColor.tone}),W.tertiaryPaletteKeyColor=H.fromPalette({name:"tertiary_palette_key_color",palette:t=>t.tertiaryPalette,tone:t=>t.tertiaryPalette.keyColor.tone}),W.neutralPaletteKeyColor=H.fromPalette({name:"neutral_palette_key_color",palette:t=>t.neutralPalette,tone:t=>t.neutralPalette.keyColor.tone}),W.neutralVariantPaletteKeyColor=H.fromPalette({name:"neutral_variant_palette_key_color",palette:t=>t.neutralVariantPalette,tone:t=>t.neutralVariantPalette.keyColor.tone}),W.background=H.fromPalette({name:"background",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0}),W.onBackground=H.fromPalette({name:"on_background",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>W.background,contrastCurve:new N(3,3,4.5,7)}),W.surface=H.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0}),W.surfaceDim=H.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:new N(87,87,80,75).get(t.contrastLevel),isBackground:!0}),W.surfaceBright=H.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(24,24,29,34).get(t.contrastLevel):98,isBackground:!0}),W.surfaceContainerLowest=H.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(4,4,2,0).get(t.contrastLevel):100,isBackground:!0}),W.surfaceContainerLow=H.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(10,10,11,12).get(t.contrastLevel):new N(96,96,96,95).get(t.contrastLevel),isBackground:!0}),W.surfaceContainer=H.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(12,12,16,20).get(t.contrastLevel):new N(94,94,92,90).get(t.contrastLevel),isBackground:!0}),W.surfaceContainerHigh=H.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(17,17,21,25).get(t.contrastLevel):new N(92,92,88,85).get(t.contrastLevel),isBackground:!0}),W.surfaceContainerHighest=H.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(22,22,26,30).get(t.contrastLevel):new N(90,90,84,80).get(t.contrastLevel),isBackground:!0}),W.onSurface=H.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>W.highestSurface(t),contrastCurve:new N(4.5,7,11,21)}),W.surfaceVariant=H.fromPalette({name:"surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:90,isBackground:!0}),W.onSurfaceVariant=H.fromPalette({name:"on_surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?80:30,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,11)}),W.inverseSurface=H.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:20}),W.inverseOnSurface=H.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?20:95,background:t=>W.inverseSurface,contrastCurve:new N(4.5,7,11,21)}),W.outline=H.fromPalette({name:"outline",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?60:50,background:t=>W.highestSurface(t),contrastCurve:new N(1.5,3,4.5,7)}),W.outlineVariant=H.fromPalette({name:"outline_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:80,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5)}),W.shadow=H.fromPalette({name:"shadow",palette:t=>t.neutralPalette,tone:t=>0}),W.scrim=H.fromPalette({name:"scrim",palette:t=>t.neutralPalette,tone:t=>0}),W.surfaceTint=H.fromPalette({name:"surface_tint",palette:t=>t.primaryPalette,tone:t=>t.isDark?80:40,isBackground:!0}),W.primary=H.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?100:0:t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.primaryContainer,W.primary,10,"nearer",!1)}),W.onPrimary=H.fromPalette({name:"on_primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>W.primary,contrastCurve:new N(4.5,7,11,21)}),W.primaryContainer=H.fromPalette({name:"primary_container",palette:t=>t.primaryPalette,tone:t=>U(t)?t.sourceColorHct.tone:$(t)?t.isDark?85:25:t.isDark?30:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryContainer,W.primary,10,"nearer",!1)}),W.onPrimaryContainer=H.fromPalette({name:"on_primary_container",palette:t=>t.primaryPalette,tone:t=>U(t)?H.foregroundTone(W.primaryContainer.tone(t),4.5):$(t)?t.isDark?0:100:t.isDark?90:30,background:t=>W.primaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.inversePrimary=H.fromPalette({name:"inverse_primary",palette:t=>t.primaryPalette,tone:t=>t.isDark?40:80,background:t=>W.inverseSurface,contrastCurve:new N(3,4.5,7,7)}),W.secondary=H.fromPalette({name:"secondary",palette:t=>t.secondaryPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.secondaryContainer,W.secondary,10,"nearer",!1)}),W.onSecondary=H.fromPalette({name:"on_secondary",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?10:100:t.isDark?20:100,background:t=>W.secondary,contrastCurve:new N(4.5,7,11,21)}),W.secondaryContainer=H.fromPalette({name:"secondary_container",palette:t=>t.secondaryPalette,tone:t=>{const e=t.isDark?30:90;return $(t)?t.isDark?30:85:U(t)?function(t,e,r,n){let a=r,o=E.from(t,e,r);if(o.chroma<e){let r=o.chroma;for(;o.chroma<e;){a+=n?-1:1;const i=E.from(t,e,a);if(r>i.chroma)break;if(Math.abs(i.chroma-e)<.4)break;Math.abs(i.chroma-e)<Math.abs(o.chroma-e)&&(o=i),r=Math.max(r,i.chroma)}}return a}(t.secondaryPalette.hue,t.secondaryPalette.chroma,e,!t.isDark):e},isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryContainer,W.secondary,10,"nearer",!1)}),W.onSecondaryContainer=H.fromPalette({name:"on_secondary_container",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?90:10:U(t)?H.foregroundTone(W.secondaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>W.secondaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.tertiary=H.fromPalette({name:"tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?90:25:t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.tertiaryContainer,W.tertiary,10,"nearer",!1)}),W.onTertiary=H.fromPalette({name:"on_tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>W.tertiary,contrastCurve:new N(4.5,7,11,21)}),W.tertiaryContainer=H.fromPalette({name:"tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>{if($(t))return t.isDark?60:49;if(!U(t))return t.isDark?30:90;const e=t.tertiaryPalette.getHct(t.sourceColorHct.tone);return O.fixIfDisliked(e).tone},isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryContainer,W.tertiary,10,"nearer",!1)}),W.onTertiaryContainer=H.fromPalette({name:"on_tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?0:100:U(t)?H.foregroundTone(W.tertiaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>W.tertiaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.error=H.fromPalette({name:"error",palette:t=>t.errorPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.errorContainer,W.error,10,"nearer",!1)}),W.onError=H.fromPalette({name:"on_error",palette:t=>t.errorPalette,tone:t=>t.isDark?20:100,background:t=>W.error,contrastCurve:new N(4.5,7,11,21)}),W.errorContainer=H.fromPalette({name:"error_container",palette:t=>t.errorPalette,tone:t=>t.isDark?30:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.errorContainer,W.error,10,"nearer",!1)}),W.onErrorContainer=H.fromPalette({name:"on_error_container",palette:t=>t.errorPalette,tone:t=>$(t)?t.isDark?90:10:t.isDark?90:30,background:t=>W.errorContainer,contrastCurve:new N(3,4.5,7,11)}),W.primaryFixed=H.fromPalette({name:"primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.primaryFixedDim=H.fromPalette({name:"primary_fixed_dim",palette:t=>t.primaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.onPrimaryFixed=H.fromPalette({name:"on_primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?100:10,background:t=>W.primaryFixedDim,secondBackground:t=>W.primaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onPrimaryFixedVariant=H.fromPalette({name:"on_primary_fixed_variant",palette:t=>t.primaryPalette,tone:t=>$(t)?90:30,background:t=>W.primaryFixedDim,secondBackground:t=>W.primaryFixed,contrastCurve:new N(3,4.5,7,11)}),W.secondaryFixed=H.fromPalette({name:"secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>$(t)?80:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.secondaryFixedDim=H.fromPalette({name:"secondary_fixed_dim",palette:t=>t.secondaryPalette,tone:t=>$(t)?70:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.onSecondaryFixed=H.fromPalette({name:"on_secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>10,background:t=>W.secondaryFixedDim,secondBackground:t=>W.secondaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onSecondaryFixedVariant=H.fromPalette({name:"on_secondary_fixed_variant",palette:t=>t.secondaryPalette,tone:t=>$(t)?25:30,background:t=>W.secondaryFixedDim,secondBackground:t=>W.secondaryFixed,contrastCurve:new N(3,4.5,7,11)}),W.tertiaryFixed=H.fromPalette({name:"tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.tertiaryFixedDim=H.fromPalette({name:"tertiary_fixed_dim",palette:t=>t.tertiaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.onTertiaryFixed=H.fromPalette({name:"on_tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?100:10,background:t=>W.tertiaryFixedDim,secondBackground:t=>W.tertiaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onTertiaryFixedVariant=H.fromPalette({name:"on_tertiary_fixed_variant",palette:t=>t.tertiaryPalette,tone:t=>$(t)?90:30,background:t=>W.tertiaryFixedDim,secondBackground:t=>W.tertiaryFixed,contrastCurve:new N(3,4.5,7,11)});
|
|
234
|
+
function U(t){return t.variant===G.FIDELITY||t.variant===G.CONTENT}function $(t){return t.variant===G.MONOCHROME}!function(t){t[t.MONOCHROME=0]="MONOCHROME",t[t.NEUTRAL=1]="NEUTRAL",t[t.TONAL_SPOT=2]="TONAL_SPOT",t[t.VIBRANT=3]="VIBRANT",t[t.EXPRESSIVE=4]="EXPRESSIVE",t[t.FIDELITY=5]="FIDELITY",t[t.CONTENT=6]="CONTENT",t[t.RAINBOW=7]="RAINBOW",t[t.FRUIT_SALAD=8]="FRUIT_SALAD"}(G||(G={}));class W{static highestSurface(t){return t.isDark?W.surfaceBright:W.surfaceDim}}W.contentAccentToneDelta=15,W.primaryPaletteKeyColor=H.fromPalette({name:"primary_palette_key_color",palette:t=>t.primaryPalette,tone:t=>t.primaryPalette.keyColor.tone}),W.secondaryPaletteKeyColor=H.fromPalette({name:"secondary_palette_key_color",palette:t=>t.secondaryPalette,tone:t=>t.secondaryPalette.keyColor.tone}),W.tertiaryPaletteKeyColor=H.fromPalette({name:"tertiary_palette_key_color",palette:t=>t.tertiaryPalette,tone:t=>t.tertiaryPalette.keyColor.tone}),W.neutralPaletteKeyColor=H.fromPalette({name:"neutral_palette_key_color",palette:t=>t.neutralPalette,tone:t=>t.neutralPalette.keyColor.tone}),W.neutralVariantPaletteKeyColor=H.fromPalette({name:"neutral_variant_palette_key_color",palette:t=>t.neutralVariantPalette,tone:t=>t.neutralVariantPalette.keyColor.tone}),W.background=H.fromPalette({name:"background",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0}),W.onBackground=H.fromPalette({name:"on_background",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>W.background,contrastCurve:new N(3,3,4.5,7)}),W.surface=H.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:98,isBackground:!0}),W.surfaceDim=H.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?6:new N(87,87,80,75).get(t.contrastLevel),isBackground:!0}),W.surfaceBright=H.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(24,24,29,34).get(t.contrastLevel):98,isBackground:!0}),W.surfaceContainerLowest=H.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(4,4,2,0).get(t.contrastLevel):100,isBackground:!0}),W.surfaceContainerLow=H.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(10,10,11,12).get(t.contrastLevel):new N(96,96,96,95).get(t.contrastLevel),isBackground:!0}),W.surfaceContainer=H.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(12,12,16,20).get(t.contrastLevel):new N(94,94,92,90).get(t.contrastLevel),isBackground:!0}),W.surfaceContainerHigh=H.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(17,17,21,25).get(t.contrastLevel):new N(92,92,88,85).get(t.contrastLevel),isBackground:!0}),W.surfaceContainerHighest=H.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?new N(22,22,26,30).get(t.contrastLevel):new N(90,90,84,80).get(t.contrastLevel),isBackground:!0}),W.onSurface=H.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:10,background:t=>W.highestSurface(t),contrastCurve:new N(4.5,7,11,21)}),W.surfaceVariant=H.fromPalette({name:"surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:90,isBackground:!0}),W.onSurfaceVariant=H.fromPalette({name:"on_surface_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?80:30,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,11)}),W.inverseSurface=H.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?90:20}),W.inverseOnSurface=H.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?20:95,background:t=>W.inverseSurface,contrastCurve:new N(4.5,7,11,21)}),W.outline=H.fromPalette({name:"outline",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?60:50,background:t=>W.highestSurface(t),contrastCurve:new N(1.5,3,4.5,7)}),W.outlineVariant=H.fromPalette({name:"outline_variant",palette:t=>t.neutralVariantPalette,tone:t=>t.isDark?30:80,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5)}),W.shadow=H.fromPalette({name:"shadow",palette:t=>t.neutralPalette,tone:t=>0}),W.scrim=H.fromPalette({name:"scrim",palette:t=>t.neutralPalette,tone:t=>0}),W.surfaceTint=H.fromPalette({name:"surface_tint",palette:t=>t.primaryPalette,tone:t=>t.isDark?80:40,isBackground:!0}),W.primary=H.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?100:0:t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.primaryContainer,W.primary,10,"nearer",!1)}),W.onPrimary=H.fromPalette({name:"on_primary",palette:t=>t.primaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>W.primary,contrastCurve:new N(4.5,7,11,21)}),W.primaryContainer=H.fromPalette({name:"primary_container",palette:t=>t.primaryPalette,tone:t=>U(t)?t.sourceColorHct.tone:$(t)?t.isDark?85:25:t.isDark?30:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryContainer,W.primary,10,"nearer",!1)}),W.onPrimaryContainer=H.fromPalette({name:"on_primary_container",palette:t=>t.primaryPalette,tone:t=>U(t)?H.foregroundTone(W.primaryContainer.tone(t),4.5):$(t)?t.isDark?0:100:t.isDark?90:30,background:t=>W.primaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.inversePrimary=H.fromPalette({name:"inverse_primary",palette:t=>t.primaryPalette,tone:t=>t.isDark?40:80,background:t=>W.inverseSurface,contrastCurve:new N(3,4.5,7,7)}),W.secondary=H.fromPalette({name:"secondary",palette:t=>t.secondaryPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.secondaryContainer,W.secondary,10,"nearer",!1)}),W.onSecondary=H.fromPalette({name:"on_secondary",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?10:100:t.isDark?20:100,background:t=>W.secondary,contrastCurve:new N(4.5,7,11,21)}),W.secondaryContainer=H.fromPalette({name:"secondary_container",palette:t=>t.secondaryPalette,tone:t=>{const e=t.isDark?30:90;return $(t)?t.isDark?30:85:U(t)?function(t,e,r,n){let a=r,o=L.from(t,e,r);if(o.chroma<e){let r=o.chroma;for(;o.chroma<e;){a+=n?-1:1;const i=L.from(t,e,a);if(r>i.chroma)break;if(Math.abs(i.chroma-e)<.4)break;Math.abs(i.chroma-e)<Math.abs(o.chroma-e)&&(o=i),r=Math.max(r,i.chroma)}}return a}(t.secondaryPalette.hue,t.secondaryPalette.chroma,e,!t.isDark):e},isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryContainer,W.secondary,10,"nearer",!1)}),W.onSecondaryContainer=H.fromPalette({name:"on_secondary_container",palette:t=>t.secondaryPalette,tone:t=>$(t)?t.isDark?90:10:U(t)?H.foregroundTone(W.secondaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>W.secondaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.tertiary=H.fromPalette({name:"tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?90:25:t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.tertiaryContainer,W.tertiary,10,"nearer",!1)}),W.onTertiary=H.fromPalette({name:"on_tertiary",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?10:90:t.isDark?20:100,background:t=>W.tertiary,contrastCurve:new N(4.5,7,11,21)}),W.tertiaryContainer=H.fromPalette({name:"tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>{if($(t))return t.isDark?60:49;if(!U(t))return t.isDark?30:90;const e=t.tertiaryPalette.getHct(t.sourceColorHct.tone);return E.fixIfDisliked(e).tone},isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryContainer,W.tertiary,10,"nearer",!1)}),W.onTertiaryContainer=H.fromPalette({name:"on_tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>$(t)?t.isDark?0:100:U(t)?H.foregroundTone(W.tertiaryContainer.tone(t),4.5):t.isDark?90:30,background:t=>W.tertiaryContainer,contrastCurve:new N(3,4.5,7,11)}),W.error=H.fromPalette({name:"error",palette:t=>t.errorPalette,tone:t=>t.isDark?80:40,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(3,4.5,7,7),toneDeltaPair:t=>new q(W.errorContainer,W.error,10,"nearer",!1)}),W.onError=H.fromPalette({name:"on_error",palette:t=>t.errorPalette,tone:t=>t.isDark?20:100,background:t=>W.error,contrastCurve:new N(4.5,7,11,21)}),W.errorContainer=H.fromPalette({name:"error_container",palette:t=>t.errorPalette,tone:t=>t.isDark?30:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.errorContainer,W.error,10,"nearer",!1)}),W.onErrorContainer=H.fromPalette({name:"on_error_container",palette:t=>t.errorPalette,tone:t=>$(t)?t.isDark?90:10:t.isDark?90:30,background:t=>W.errorContainer,contrastCurve:new N(3,4.5,7,11)}),W.primaryFixed=H.fromPalette({name:"primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.primaryFixedDim=H.fromPalette({name:"primary_fixed_dim",palette:t=>t.primaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.onPrimaryFixed=H.fromPalette({name:"on_primary_fixed",palette:t=>t.primaryPalette,tone:t=>$(t)?100:10,background:t=>W.primaryFixedDim,secondBackground:t=>W.primaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onPrimaryFixedVariant=H.fromPalette({name:"on_primary_fixed_variant",palette:t=>t.primaryPalette,tone:t=>$(t)?90:30,background:t=>W.primaryFixedDim,secondBackground:t=>W.primaryFixed,contrastCurve:new N(3,4.5,7,11)}),W.secondaryFixed=H.fromPalette({name:"secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>$(t)?80:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.secondaryFixedDim=H.fromPalette({name:"secondary_fixed_dim",palette:t=>t.secondaryPalette,tone:t=>$(t)?70:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.onSecondaryFixed=H.fromPalette({name:"on_secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>10,background:t=>W.secondaryFixedDim,secondBackground:t=>W.secondaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onSecondaryFixedVariant=H.fromPalette({name:"on_secondary_fixed_variant",palette:t=>t.secondaryPalette,tone:t=>$(t)?25:30,background:t=>W.secondaryFixedDim,secondBackground:t=>W.secondaryFixed,contrastCurve:new N(3,4.5,7,11)}),W.tertiaryFixed=H.fromPalette({name:"tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?40:90,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.tertiaryFixedDim=H.fromPalette({name:"tertiary_fixed_dim",palette:t=>t.tertiaryPalette,tone:t=>$(t)?30:80,isBackground:!0,background:t=>W.highestSurface(t),contrastCurve:new N(1,1,3,4.5),toneDeltaPair:t=>new q(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.onTertiaryFixed=H.fromPalette({name:"on_tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>$(t)?100:10,background:t=>W.tertiaryFixedDim,secondBackground:t=>W.tertiaryFixed,contrastCurve:new N(4.5,7,11,21)}),W.onTertiaryFixedVariant=H.fromPalette({name:"on_tertiary_fixed_variant",palette:t=>t.tertiaryPalette,tone:t=>$(t)?90:30,background:t=>W.tertiaryFixedDim,secondBackground:t=>W.tertiaryFixed,contrastCurve:new N(3,4.5,7,11)});
|
|
235
235
|
/**
|
|
236
236
|
* @license
|
|
237
237
|
* Copyright 2022 Google LLC
|
|
@@ -248,7 +248,7 @@ function U(t){return t.variant===G.FIDELITY||t.variant===G.CONTENT}function $(t)
|
|
|
248
248
|
* See the License for the specific language governing permissions and
|
|
249
249
|
* limitations under the License.
|
|
250
250
|
*/
|
|
251
|
-
class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.variant,this.contrastLevel=t.contrastLevel,this.isDark=t.isDark,this.sourceColorHct=
|
|
251
|
+
class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.variant,this.contrastLevel=t.contrastLevel,this.isDark=t.isDark,this.sourceColorHct=L.fromInt(t.sourceColorArgb),this.primaryPalette=t.primaryPalette,this.secondaryPalette=t.secondaryPalette,this.tertiaryPalette=t.tertiaryPalette,this.neutralPalette=t.neutralPalette,this.neutralVariantPalette=t.neutralVariantPalette,this.errorPalette=V.fromHueAndChroma(25,84)}static getRotatedHue(t,e,r){const n=t.hue;if(e.length!==r.length)throw new Error(`mismatch between hue length ${e.length} & rotations ${r.length}`);if(1===r.length)return d(t.hue+r[0]);const a=e.length;for(let t=0;t<=a-2;t++){const a=e[t],o=e[t+1];if(a<n&&n<o)return d(n+r[t])}return n}getArgb(t){return t.getArgb(this)}getHct(t){return t.getHct(this)}get primaryPaletteKeyColor(){return this.getArgb(W.primaryPaletteKeyColor)}get secondaryPaletteKeyColor(){return this.getArgb(W.secondaryPaletteKeyColor)}get tertiaryPaletteKeyColor(){return this.getArgb(W.tertiaryPaletteKeyColor)}get neutralPaletteKeyColor(){return this.getArgb(W.neutralPaletteKeyColor)}get neutralVariantPaletteKeyColor(){return this.getArgb(W.neutralVariantPaletteKeyColor)}get background(){return this.getArgb(W.background)}get onBackground(){return this.getArgb(W.onBackground)}get surface(){return this.getArgb(W.surface)}get surfaceDim(){return this.getArgb(W.surfaceDim)}get surfaceBright(){return this.getArgb(W.surfaceBright)}get surfaceContainerLowest(){return this.getArgb(W.surfaceContainerLowest)}get surfaceContainerLow(){return this.getArgb(W.surfaceContainerLow)}get surfaceContainer(){return this.getArgb(W.surfaceContainer)}get surfaceContainerHigh(){return this.getArgb(W.surfaceContainerHigh)}get surfaceContainerHighest(){return this.getArgb(W.surfaceContainerHighest)}get onSurface(){return this.getArgb(W.onSurface)}get surfaceVariant(){return this.getArgb(W.surfaceVariant)}get onSurfaceVariant(){return this.getArgb(W.onSurfaceVariant)}get inverseSurface(){return this.getArgb(W.inverseSurface)}get inverseOnSurface(){return this.getArgb(W.inverseOnSurface)}get outline(){return this.getArgb(W.outline)}get outlineVariant(){return this.getArgb(W.outlineVariant)}get shadow(){return this.getArgb(W.shadow)}get scrim(){return this.getArgb(W.scrim)}get surfaceTint(){return this.getArgb(W.surfaceTint)}get primary(){return this.getArgb(W.primary)}get onPrimary(){return this.getArgb(W.onPrimary)}get primaryContainer(){return this.getArgb(W.primaryContainer)}get onPrimaryContainer(){return this.getArgb(W.onPrimaryContainer)}get inversePrimary(){return this.getArgb(W.inversePrimary)}get secondary(){return this.getArgb(W.secondary)}get onSecondary(){return this.getArgb(W.onSecondary)}get secondaryContainer(){return this.getArgb(W.secondaryContainer)}get onSecondaryContainer(){return this.getArgb(W.onSecondaryContainer)}get tertiary(){return this.getArgb(W.tertiary)}get onTertiary(){return this.getArgb(W.onTertiary)}get tertiaryContainer(){return this.getArgb(W.tertiaryContainer)}get onTertiaryContainer(){return this.getArgb(W.onTertiaryContainer)}get error(){return this.getArgb(W.error)}get onError(){return this.getArgb(W.onError)}get errorContainer(){return this.getArgb(W.errorContainer)}get onErrorContainer(){return this.getArgb(W.onErrorContainer)}get primaryFixed(){return this.getArgb(W.primaryFixed)}get primaryFixedDim(){return this.getArgb(W.primaryFixedDim)}get onPrimaryFixed(){return this.getArgb(W.onPrimaryFixed)}get onPrimaryFixedVariant(){return this.getArgb(W.onPrimaryFixedVariant)}get secondaryFixed(){return this.getArgb(W.secondaryFixed)}get secondaryFixedDim(){return this.getArgb(W.secondaryFixedDim)}get onSecondaryFixed(){return this.getArgb(W.onSecondaryFixed)}get onSecondaryFixedVariant(){return this.getArgb(W.onSecondaryFixedVariant)}get tertiaryFixed(){return this.getArgb(W.tertiaryFixed)}get tertiaryFixedDim(){return this.getArgb(W.tertiaryFixedDim)}get onTertiaryFixed(){return this.getArgb(W.onTertiaryFixed)}get onTertiaryFixedVariant(){return this.getArgb(W.onTertiaryFixedVariant)}}
|
|
252
252
|
/**
|
|
253
253
|
* @license
|
|
254
254
|
* Copyright 2021 Google LLC
|
|
@@ -264,7 +264,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
264
264
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
265
265
|
* See the License for the specific language governing permissions and
|
|
266
266
|
* limitations under the License.
|
|
267
|
-
*/class Y{static of(t){return new Y(t,!1)}static contentOf(t){return new Y(t,!0)}static fromColors(t){return Y.createPaletteFromColors(!1,t)}static contentFromColors(t){return Y.createPaletteFromColors(!0,t)}static createPaletteFromColors(t,e){const r=new Y(e.primary,t);if(e.secondary){const n=new Y(e.secondary,t);r.a2=n.a1}if(e.tertiary){const n=new Y(e.tertiary,t);r.a3=n.a1}if(e.error){const n=new Y(e.error,t);r.error=n.a1}if(e.neutral){const n=new Y(e.neutral,t);r.n1=n.n1}if(e.neutralVariant){const n=new Y(e.neutralVariant,t);r.n2=n.n2}return r}constructor(t,e){const r=
|
|
267
|
+
*/class Y{static of(t){return new Y(t,!1)}static contentOf(t){return new Y(t,!0)}static fromColors(t){return Y.createPaletteFromColors(!1,t)}static contentFromColors(t){return Y.createPaletteFromColors(!0,t)}static createPaletteFromColors(t,e){const r=new Y(e.primary,t);if(e.secondary){const n=new Y(e.secondary,t);r.a2=n.a1}if(e.tertiary){const n=new Y(e.tertiary,t);r.a3=n.a1}if(e.error){const n=new Y(e.error,t);r.error=n.a1}if(e.neutral){const n=new Y(e.neutral,t);r.n1=n.n1}if(e.neutralVariant){const n=new Y(e.neutralVariant,t);r.n2=n.n2}return r}constructor(t,e){const r=L.fromInt(t),n=r.hue,a=r.chroma;e?(this.a1=V.fromHueAndChroma(n,a),this.a2=V.fromHueAndChroma(n,a/3),this.a3=V.fromHueAndChroma(n+60,a/2),this.n1=V.fromHueAndChroma(n,Math.min(a/12,4)),this.n2=V.fromHueAndChroma(n,Math.min(a/6,8))):(this.a1=V.fromHueAndChroma(n,Math.max(48,a)),this.a2=V.fromHueAndChroma(n,16),this.a3=V.fromHueAndChroma(n+60,24),this.n1=V.fromHueAndChroma(n,4),this.n2=V.fromHueAndChroma(n,8)),this.error=V.fromHueAndChroma(25,84)}}
|
|
268
268
|
/**
|
|
269
269
|
* @license
|
|
270
270
|
* Copyright 2021 Google LLC
|
|
@@ -280,7 +280,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
280
280
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
281
281
|
* See the License for the specific language governing permissions and
|
|
282
282
|
* limitations under the License.
|
|
283
|
-
*/class j{fromInt(t){return function(t){const e=D(P(t)),r=D(M(t)),n=D(k(t)),a=f,o=a[0][0]*e+a[0][1]*r+a[0][2]*n,i=a[1][0]*e+a[1][1]*r+a[1][2]*n,s=a[2][0]*e+a[2][1]*r+a[2][2]*n,c=i/b[1],h=s/b[2],
|
|
283
|
+
*/class j{fromInt(t){return function(t){const e=D(P(t)),r=D(M(t)),n=D(k(t)),a=f,o=a[0][0]*e+a[0][1]*r+a[0][2]*n,i=a[1][0]*e+a[1][1]*r+a[1][2]*n,s=a[2][0]*e+a[2][1]*r+a[2][2]*n,c=i/b[1],h=s/b[2],u=S(o/b[0]),l=S(c);return[116*l-16,500*(u-l),200*(l-S(h))]}(t)}toInt(t){return function(t,e,r){const n=b,a=(t+16)/116,o=a-r/200,i=T(e/500+a),s=T(a),c=T(o);return A(i*n[0],s*n[1],c*n[2])}(t[0],t[1],t[2])}distance(t,e){const r=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return r*r+n*n+a*a}}
|
|
284
284
|
/**
|
|
285
285
|
* @license
|
|
286
286
|
* Copyright 2021 Google LLC
|
|
@@ -296,7 +296,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
296
296
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
297
297
|
* See the License for the specific language governing permissions and
|
|
298
298
|
* limitations under the License.
|
|
299
|
-
*/class X{static quantize(t,e,r){const n=new Map,a=new Array,o=new Array,i=new j;let s=0;for(let e=0;e<t.length;e++){const r=t[e],c=n.get(r);void 0===c?(s++,a.push(i.fromInt(r)),o.push(r),n.set(r,1)):n.set(r,c+1)}const c=new Array;for(let t=0;t<s;t++){const e=o[t],r=n.get(e);void 0!==r&&(c[t]=r)}let h=Math.min(r,s);e.length>0&&(h=Math.min(h,e.length));const
|
|
299
|
+
*/class X{static quantize(t,e,r){const n=new Map,a=new Array,o=new Array,i=new j;let s=0;for(let e=0;e<t.length;e++){const r=t[e],c=n.get(r);void 0===c?(s++,a.push(i.fromInt(r)),o.push(r),n.set(r,1)):n.set(r,c+1)}const c=new Array;for(let t=0;t<s;t++){const e=o[t],r=n.get(e);void 0!==r&&(c[t]=r)}let h=Math.min(r,s);e.length>0&&(h=Math.min(h,e.length));const u=new Array;for(let t=0;t<e.length;t++)u.push(i.fromInt(e[t]));const l=h-u.length;if(0===e.length&&l>0)for(let t=0;t<l;t++){const t=100*Math.random(),e=201*Math.random()-100,r=201*Math.random()-100;u.push(new Array(t,e,r))}const m=new Array;for(let t=0;t<s;t++)m.push(Math.floor(Math.random()*h));const d=new Array;for(let t=0;t<h;t++){d.push(new Array);for(let e=0;e<h;e++)d[t].push(0)}const g=new Array;for(let t=0;t<h;t++){g.push(new Array);for(let e=0;e<h;e++)g[t].push(new J)}const f=new Array;for(let t=0;t<h;t++)f.push(0);for(let t=0;t<10;t++){for(let t=0;t<h;t++){for(let e=t+1;e<h;e++){const r=i.distance(u[t],u[e]);g[e][t].distance=r,g[e][t].index=t,g[t][e].distance=r,g[t][e].index=e}g[t].sort();for(let e=0;e<h;e++)d[t][e]=g[t][e].index}let e=0;for(let t=0;t<s;t++){const r=a[t],n=m[t],o=u[n],s=i.distance(r,o);let c=s,l=-1;for(let t=0;t<h;t++){if(g[n][t].distance>=4*s)continue;const e=i.distance(r,u[t]);e<c&&(c=e,l=t)}if(-1!==l){Math.abs(Math.sqrt(c)-Math.sqrt(s))>3&&(e++,m[t]=l)}}if(0===e&&0!==t)break;const r=new Array(h).fill(0),n=new Array(h).fill(0),o=new Array(h).fill(0);for(let t=0;t<h;t++)f[t]=0;for(let t=0;t<s;t++){const e=m[t],i=a[t],s=c[t];f[e]+=s,r[e]+=i[0]*s,n[e]+=i[1]*s,o[e]+=i[2]*s}for(let t=0;t<h;t++){const e=f[t];if(0===e){u[t]=[0,0,0];continue}const a=r[t]/e,i=n[t]/e,s=o[t]/e;u[t]=[a,i,s]}}const y=new Map;for(let t=0;t<h;t++){const e=f[t];if(0===e)continue;const r=i.toInt(u[t]);y.has(r)||y.set(r,e)}return y}}class J{constructor(){this.distance=-1,this.index=-1}}
|
|
300
300
|
/**
|
|
301
301
|
* @license
|
|
302
302
|
* Copyright 2021 Google LLC
|
|
@@ -328,7 +328,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
328
328
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
329
|
* See the License for the specific language governing permissions and
|
|
330
330
|
* limitations under the License.
|
|
331
|
-
*/const Q=33,tt=35937,et="red",rt="green",nt="blue";class at{constructor(t=[],e=[],r=[],n=[],a=[],o=[]){this.weights=t,this.momentsR=e,this.momentsG=r,this.momentsB=n,this.moments=a,this.cubes=o}quantize(t,e){this.constructHistogram(t),this.computeMoments();const r=this.createBoxes(e);return this.createResult(r.resultCount)}constructHistogram(t){this.weights=Array.from({length:tt}).fill(0),this.momentsR=Array.from({length:tt}).fill(0),this.momentsG=Array.from({length:tt}).fill(0),this.momentsB=Array.from({length:tt}).fill(0),this.moments=Array.from({length:tt}).fill(0);const e=Z.quantize(t);for(const[t,r]of e.entries()){const e=P(t),n=M(t),a=k(t),o=3,i=1+(e>>o),s=1+(n>>o),c=1+(a>>o),h=this.getIndex(i,s,c);this.weights[h]=(this.weights[h]??0)+r,this.momentsR[h]+=r*e,this.momentsG[h]+=r*n,this.momentsB[h]+=r*a,this.moments[h]+=r*(e*e+n*n+a*a)}}computeMoments(){for(let t=1;t<Q;t++){const e=Array.from({length:Q}).fill(0),r=Array.from({length:Q}).fill(0),n=Array.from({length:Q}).fill(0),a=Array.from({length:Q}).fill(0),o=Array.from({length:Q}).fill(0);for(let i=1;i<Q;i++){let s=0,c=0,h=0,
|
|
331
|
+
*/const Q=33,tt=35937,et="red",rt="green",nt="blue";class at{constructor(t=[],e=[],r=[],n=[],a=[],o=[]){this.weights=t,this.momentsR=e,this.momentsG=r,this.momentsB=n,this.moments=a,this.cubes=o}quantize(t,e){this.constructHistogram(t),this.computeMoments();const r=this.createBoxes(e);return this.createResult(r.resultCount)}constructHistogram(t){this.weights=Array.from({length:tt}).fill(0),this.momentsR=Array.from({length:tt}).fill(0),this.momentsG=Array.from({length:tt}).fill(0),this.momentsB=Array.from({length:tt}).fill(0),this.moments=Array.from({length:tt}).fill(0);const e=Z.quantize(t);for(const[t,r]of e.entries()){const e=P(t),n=M(t),a=k(t),o=3,i=1+(e>>o),s=1+(n>>o),c=1+(a>>o),h=this.getIndex(i,s,c);this.weights[h]=(this.weights[h]??0)+r,this.momentsR[h]+=r*e,this.momentsG[h]+=r*n,this.momentsB[h]+=r*a,this.moments[h]+=r*(e*e+n*n+a*a)}}computeMoments(){for(let t=1;t<Q;t++){const e=Array.from({length:Q}).fill(0),r=Array.from({length:Q}).fill(0),n=Array.from({length:Q}).fill(0),a=Array.from({length:Q}).fill(0),o=Array.from({length:Q}).fill(0);for(let i=1;i<Q;i++){let s=0,c=0,h=0,u=0,l=0;for(let m=1;m<Q;m++){const d=this.getIndex(t,i,m);s+=this.weights[d],c+=this.momentsR[d],h+=this.momentsG[d],u+=this.momentsB[d],l+=this.moments[d],e[m]+=s,r[m]+=c,n[m]+=h,a[m]+=u,o[m]+=l;const g=this.getIndex(t-1,i,m);this.weights[d]=this.weights[g]+e[m],this.momentsR[d]=this.momentsR[g]+r[m],this.momentsG[d]=this.momentsG[g]+n[m],this.momentsB[d]=this.momentsB[g]+a[m],this.moments[d]=this.moments[g]+o[m]}}}}createBoxes(t){this.cubes=Array.from({length:t}).fill(0).map(()=>new ot);const e=Array.from({length:t}).fill(0);this.cubes[0].r0=0,this.cubes[0].g0=0,this.cubes[0].b0=0,this.cubes[0].r1=32,this.cubes[0].g1=32,this.cubes[0].b1=32;let r=t,n=0;for(let a=1;a<t;a++){this.cut(this.cubes[n],this.cubes[a])?(e[n]=this.cubes[n].vol>1?this.variance(this.cubes[n]):0,e[a]=this.cubes[a].vol>1?this.variance(this.cubes[a]):0):(e[n]=0,a--),n=0;let t=e[0];for(let r=1;r<=a;r++)e[r]>t&&(t=e[r],n=r);if(t<=0){r=a+1;break}}return new it(t,r)}createResult(t){const e=[];for(let r=0;r<t;++r){const t=this.cubes[r],n=this.volume(t,this.weights);if(n>0){const r=255<<24|(255&Math.round(this.volume(t,this.momentsR)/n))<<16|(255&Math.round(this.volume(t,this.momentsG)/n))<<8|255&Math.round(this.volume(t,this.momentsB)/n);e.push(r)}}return e}variance(t){const e=this.volume(t,this.momentsR),r=this.volume(t,this.momentsG),n=this.volume(t,this.momentsB);return this.moments[this.getIndex(t.r1,t.g1,t.b1)]-this.moments[this.getIndex(t.r1,t.g1,t.b0)]-this.moments[this.getIndex(t.r1,t.g0,t.b1)]+this.moments[this.getIndex(t.r1,t.g0,t.b0)]-this.moments[this.getIndex(t.r0,t.g1,t.b1)]+this.moments[this.getIndex(t.r0,t.g1,t.b0)]+this.moments[this.getIndex(t.r0,t.g0,t.b1)]-this.moments[this.getIndex(t.r0,t.g0,t.b0)]-(e*e+r*r+n*n)/this.volume(t,this.weights)}cut(t,e){const r=this.volume(t,this.momentsR),n=this.volume(t,this.momentsG),a=this.volume(t,this.momentsB),o=this.volume(t,this.weights),i=this.maximize(t,et,t.r0+1,t.r1,r,n,a,o),s=this.maximize(t,rt,t.g0+1,t.g1,r,n,a,o),c=this.maximize(t,nt,t.b0+1,t.b1,r,n,a,o);let h;const u=i.maximum,l=s.maximum,m=c.maximum;if(u>=l&&u>=m){if(i.cutLocation<0)return!1;h=et}else h=l>=u&&l>=m?rt:nt;switch(e.r1=t.r1,e.g1=t.g1,e.b1=t.b1,h){case et:t.r1=i.cutLocation,e.r0=t.r1,e.g0=t.g0,e.b0=t.b0;break;case rt:t.g1=s.cutLocation,e.r0=t.r0,e.g0=t.g1,e.b0=t.b0;break;case nt:t.b1=c.cutLocation,e.r0=t.r0,e.g0=t.g0,e.b0=t.b1;break;default:throw new Error("unexpected direction "+h)}return t.vol=(t.r1-t.r0)*(t.g1-t.g0)*(t.b1-t.b0),e.vol=(e.r1-e.r0)*(e.g1-e.g0)*(e.b1-e.b0),!0}maximize(t,e,r,n,a,o,i,s){const c=this.bottom(t,e,this.momentsR),h=this.bottom(t,e,this.momentsG),u=this.bottom(t,e,this.momentsB),l=this.bottom(t,e,this.weights);let m=0,d=-1,g=0,f=0,y=0,b=0;for(let p=r;p<n;p++){if(g=c+this.top(t,e,p,this.momentsR),f=h+this.top(t,e,p,this.momentsG),y=u+this.top(t,e,p,this.momentsB),b=l+this.top(t,e,p,this.weights),0===b)continue;let r=1*(g*g+f*f+y*y),n=1*b,w=r/n;g=a-g,f=o-f,y=i-y,b=s-b,0!==b&&(r=1*(g*g+f*f+y*y),n=1*b,w+=r/n,w>m&&(m=w,d=p))}return new st(d,m)}volume(t,e){return e[this.getIndex(t.r1,t.g1,t.b1)]-e[this.getIndex(t.r1,t.g1,t.b0)]-e[this.getIndex(t.r1,t.g0,t.b1)]+e[this.getIndex(t.r1,t.g0,t.b0)]-e[this.getIndex(t.r0,t.g1,t.b1)]+e[this.getIndex(t.r0,t.g1,t.b0)]+e[this.getIndex(t.r0,t.g0,t.b1)]-e[this.getIndex(t.r0,t.g0,t.b0)]}bottom(t,e,r){switch(e){case et:return-r[this.getIndex(t.r0,t.g1,t.b1)]+r[this.getIndex(t.r0,t.g1,t.b0)]+r[this.getIndex(t.r0,t.g0,t.b1)]-r[this.getIndex(t.r0,t.g0,t.b0)];case rt:return-r[this.getIndex(t.r1,t.g0,t.b1)]+r[this.getIndex(t.r1,t.g0,t.b0)]+r[this.getIndex(t.r0,t.g0,t.b1)]-r[this.getIndex(t.r0,t.g0,t.b0)];case nt:return-r[this.getIndex(t.r1,t.g1,t.b0)]+r[this.getIndex(t.r1,t.g0,t.b0)]+r[this.getIndex(t.r0,t.g1,t.b0)]-r[this.getIndex(t.r0,t.g0,t.b0)];default:throw new Error("unexpected direction $direction")}}top(t,e,r,n){switch(e){case et:return n[this.getIndex(r,t.g1,t.b1)]-n[this.getIndex(r,t.g1,t.b0)]-n[this.getIndex(r,t.g0,t.b1)]+n[this.getIndex(r,t.g0,t.b0)];case rt:return n[this.getIndex(t.r1,r,t.b1)]-n[this.getIndex(t.r1,r,t.b0)]-n[this.getIndex(t.r0,r,t.b1)]+n[this.getIndex(t.r0,r,t.b0)];case nt:return n[this.getIndex(t.r1,t.g1,r)]-n[this.getIndex(t.r1,t.g0,r)]-n[this.getIndex(t.r0,t.g1,r)]+n[this.getIndex(t.r0,t.g0,r)];default:throw new Error("unexpected direction $direction")}}getIndex(t,e,r){return(t<<10)+(t<<6)+t+(e<<5)+e+r}}class ot{constructor(t=0,e=0,r=0,n=0,a=0,o=0,i=0){this.r0=t,this.r1=e,this.g0=r,this.g1=n,this.b0=a,this.b1=o,this.vol=i}}class it{constructor(t,e){this.requestedCount=t,this.resultCount=e}}class st{constructor(t,e){this.cutLocation=t,this.maximum=e}}
|
|
332
332
|
/**
|
|
333
333
|
* @license
|
|
334
334
|
* Copyright 2021 Google LLC
|
|
@@ -360,7 +360,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
360
360
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
361
361
|
* See the License for the specific language governing permissions and
|
|
362
362
|
* limitations under the License.
|
|
363
|
-
*/class ht extends K{constructor(t,e,r){super({sourceColorArgb:t.toInt(),variant:G.EXPRESSIVE,contrastLevel:r,isDark:e,primaryPalette:V.fromHueAndChroma(
|
|
363
|
+
*/class ht extends K{constructor(t,e,r){super({sourceColorArgb:t.toInt(),variant:G.EXPRESSIVE,contrastLevel:r,isDark:e,primaryPalette:V.fromHueAndChroma(d(t.hue+240),40),secondaryPalette:V.fromHueAndChroma(K.getRotatedHue(t,ht.hues,ht.secondaryRotations),24),tertiaryPalette:V.fromHueAndChroma(K.getRotatedHue(t,ht.hues,ht.tertiaryRotations),32),neutralPalette:V.fromHueAndChroma(t.hue+15,8),neutralVariantPalette:V.fromHueAndChroma(t.hue+15,12)})}}ht.hues=[0,21,51,121,151,191,271,321,360],ht.secondaryRotations=[45,95,45,20,45,90,45,45,45],ht.tertiaryRotations=[120,120,20,45,20,15,20,120,120];
|
|
364
364
|
/**
|
|
365
365
|
* @license
|
|
366
366
|
* Copyright 2022 Google LLC
|
|
@@ -377,7 +377,7 @@ class K{constructor(t){this.sourceColorArgb=t.sourceColorArgb,this.variant=t.var
|
|
|
377
377
|
* See the License for the specific language governing permissions and
|
|
378
378
|
* limitations under the License.
|
|
379
379
|
*/
|
|
380
|
-
class
|
|
380
|
+
class ut extends K{constructor(t,e,r){super({sourceColorArgb:t.toInt(),variant:G.VIBRANT,contrastLevel:r,isDark:e,primaryPalette:V.fromHueAndChroma(t.hue,200),secondaryPalette:V.fromHueAndChroma(K.getRotatedHue(t,ut.hues,ut.secondaryRotations),24),tertiaryPalette:V.fromHueAndChroma(K.getRotatedHue(t,ut.hues,ut.tertiaryRotations),32),neutralPalette:V.fromHueAndChroma(t.hue,10),neutralVariantPalette:V.fromHueAndChroma(t.hue,12)})}}ut.hues=[0,41,61,101,131,181,251,301,360],ut.secondaryRotations=[18,15,10,12,15,18,15,12,12],ut.tertiaryRotations=[35,30,20,25,30,35,30,25,25];
|
|
381
381
|
/**
|
|
382
382
|
* @license
|
|
383
383
|
* Copyright 2021 Google LLC
|
|
@@ -394,7 +394,7 @@ class lt extends K{constructor(t,e,r){super({sourceColorArgb:t.toInt(),variant:G
|
|
|
394
394
|
* See the License for the specific language governing permissions and
|
|
395
395
|
* limitations under the License.
|
|
396
396
|
*/
|
|
397
|
-
const
|
|
397
|
+
const lt={desired:4,fallbackColorARGB:4282549748,filter:!0};function mt(t,e){return t.score>e.score?-1:t.score<e.score?1:0}class dt{constructor(){}static score(t,e){const{desired:r,fallbackColorARGB:n,filter:a}={...lt,...e},o=[],i=new Array(360).fill(0);let s=0;for(const[e,r]of t.entries()){const t=L.fromInt(e);o.push(t);i[Math.floor(t.hue)]+=r,s+=r}const c=new Array(360).fill(0);for(let t=0;t<360;t++){const e=i[t]/s;for(let r=t-14;r<t+16;r++){c[m(r)]+=e}}const h=new Array;for(const t of o){const e=c[m(Math.round(t.hue))];if(a&&(t.chroma<dt.CUTOFF_CHROMA||e<=dt.CUTOFF_EXCITED_PROPORTION))continue;const r=100*e*dt.WEIGHT_PROPORTION,n=t.chroma<dt.TARGET_CHROMA?dt.WEIGHT_CHROMA_BELOW:dt.WEIGHT_CHROMA_ABOVE,o=r+(t.chroma-dt.TARGET_CHROMA)*n;h.push({hct:t,score:o})}h.sort(mt);const u=[];for(let t=90;t>=15;t--){u.length=0;for(const{hct:e}of h){if(u.find(r=>{return n=e.hue,a=r.hue,180-Math.abs(Math.abs(n-a)-180)<t;var n,a})||u.push(e),u.length>=r)break}if(u.length>=r)break}const l=[];0===u.length&&l.push(n);for(const t of u)l.push(t.toInt());return l}}
|
|
398
398
|
/**
|
|
399
399
|
* @license
|
|
400
400
|
* Copyright 2021 Google LLC
|
|
@@ -411,7 +411,7 @@ const ut={desired:4,fallbackColorARGB:4282549748,filter:!0};function mt(t,e){ret
|
|
|
411
411
|
* See the License for the specific language governing permissions and
|
|
412
412
|
* limitations under the License.
|
|
413
413
|
*/
|
|
414
|
-
function
|
|
414
|
+
function gt(t){const e=P(t),r=M(t),n=k(t),a=[e.toString(16),r.toString(16),n.toString(16)];for(const[t,e]of a.entries())1===e.length&&(a[t]="0"+e);return"#"+a.join("")}function ft(t){return parseInt(t,16)}
|
|
415
415
|
/**
|
|
416
416
|
* @license
|
|
417
417
|
* Copyright 2021 Google LLC
|
|
@@ -427,5 +427,5 @@ function dt(t){const e=P(t),r=M(t),n=k(t),a=[e.toString(16),r.toString(16),n.toS
|
|
|
427
427
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
428
428
|
* See the License for the specific language governing permissions and
|
|
429
429
|
* limitations under the License.
|
|
430
|
-
*/async function yt(t){return
|
|
430
|
+
*/async function yt(t){return gt(await async function(t){const e=await new Promise((e,r)=>{const n=document.createElement("canvas"),a=n.getContext("2d");if(!a)return void r(new Error("Could not get canvas context"));const o=()=>{n.width=t.width,n.height=t.height,a.drawImage(t,0,0);let r=[0,0,t.width,t.height];const o=t.dataset.area;o&&/^\d+(\s*,\s*\d+){3}$/.test(o)&&(r=o.split(/\s*,\s*/).map(t=>parseInt(t,10)));const[i,s,c,h]=r;e(a.getImageData(i,s,c,h).data)},i=()=>{r(new Error("Image load failed"))};t.complete?o():(t.onload=o,t.onerror=i)}),r=[];for(let t=0;t<e.length;t+=4){const n=e[t],a=e[t+1],o=e[t+2];if(e[t+3]<255)continue;const i=p(n,a,o);r.push(i)}const n=ct.quantize(r,128);return dt.score(n)[0]}(t))}var bt,pt,wt,Ct,Pt,Mt,kt,At,xt;dt.TARGET_CHROMA=48,dt.WEIGHT_PROPORTION=.7,dt.WEIGHT_CHROMA_ABOVE=.3,dt.WEIGHT_CHROMA_BELOW=.1,dt.CUTOFF_CHROMA=5,dt.CUTOFF_EXCITED_PROPORTION=.01;let It=class extends a{constructor(){super(...arguments),bt.add(this),pt.set(this,new CSSStyleSheet),wt.set(this,!1),Ct.set(this,void 0),Pt.set(this,void 0),Mt.set(this,void 0),kt.set(this,()=>e(this,bt,"m",At).call(this,!0)),this.color="#6750A4",this.scheme="auto",this.contrast="standard",this.strongFocus=!1,this.density=0,this.motion="standard"}get isDark(){switch(this.scheme){case"light":return!1;case"dark":return!0;default:if(this.parentElement instanceof HTMLBodyElement)switch(document.documentElement.style.colorScheme){case"light":return!1;case"dark":return!0}return e(this,Pt,"f")?.matches??!1}}connectedCallback(){super.connectedCallback(),this.parentElement instanceof HTMLBodyElement?(this.shadowRoot?.adoptedStyleSheets.includes(e(this,pt,"f"))&&(this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.filter(t=>t!==e(this,pt,"f"))),document.adoptedStyleSheets.includes(e(this,pt,"f"))||(document.adoptedStyleSheets=[e(this,pt,"f"),...document.adoptedStyleSheets])):(document.adoptedStyleSheets.includes(e(this,pt,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==e(this,pt,"f"))),this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(e(this,pt,"f"))&&(this.shadowRoot.adoptedStyleSheets=[e(this,pt,"f"),...this.shadowRoot.adoptedStyleSheets])),r(this,Ct,matchMedia("(prefers-color-scheme: light)"),"f"),r(this,Pt,matchMedia("(prefers-color-scheme: dark)"),"f"),r(this,Mt,matchMedia("(forced-colors: active)"),"f"),[e(this,Ct,"f"),e(this,Pt,"f"),e(this,Mt,"f")].forEach(t=>t.addEventListener("change",e(this,kt,"f")))}disconnectedCallback(){super.disconnectedCallback(),[e(this,Ct,"f"),e(this,Pt,"f"),e(this,Mt,"f")].forEach(t=>t?.removeEventListener("change",e(this,kt,"f"))),r(this,Ct,r(this,Pt,r(this,Mt,void 0,"f"),"f"),"f"),document.adoptedStyleSheets.includes(e(this,pt,"f"))&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==e(this,pt,"f")))}updated(t){super.updated(t),e(this,bt,"m",At).call(this,e(this,wt,"f")&&["color","scheme","contrast"].some(e=>t.has(e)))}firstUpdated(t){super.firstUpdated(t),r(this,wt,!0,"f")}render(){return o`<slot></slot>`}};pt=new WeakMap,wt=new WeakMap,Ct=new WeakMap,Pt=new WeakMap,Mt=new WeakMap,kt=new WeakMap,bt=new WeakSet,At=function(t){const r=function(t){const e=3===(t=t.replace("#","")).length,r=6===t.length,n=8===t.length;if(!e&&!r&&!n)throw new Error("unexpected hex "+t);let a=0,o=0,i=0;return e?(a=ft(t.slice(0,1).repeat(2)),o=ft(t.slice(1,2).repeat(2)),i=ft(t.slice(2,3).repeat(2))):r?(a=ft(t.slice(0,2)),o=ft(t.slice(2,4)),i=ft(t.slice(4,6))):n&&(a=ft(t.slice(2,4)),o=ft(t.slice(4,6)),i=ft(t.slice(6,8))),(255<<24|(255&a)<<16|(255&o)<<8|255&i)>>>0}(this.color),n=Y.of(r),a=new K({sourceColorArgb:r,variant:1,contrastLevel:e(this,bt,"m",xt).call(this),isDark:this.isDark,primaryPalette:n.a1,secondaryPalette:n.a2,tertiaryPalette:n.a3,neutralPalette:n.n1,neutralVariantPalette:n.n2});let o="";for(const t in W)if(!t.endsWith("PaletteKeyColor")){const e=W[t];e instanceof H&&(o+=`--md-sys-color-${t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}: ${gt(e.getArgb(a))};`)}if("expressive"===this.motion&&(o+="--md-sys-motion-spring-fast-spatial: 350ms cubic-bezier(0.42, 1.67, 0.21, 0.90);",o+="--md-sys-motion-spring-default-spatial: 500ms cubic-bezier(0.38, 1.21, 0.22, 1.00);",o+="--md-sys-motion-spring-slow-spatial: 650ms cubic-bezier(0.39, 1.29, 0.35, 0.98);",o+="--md-sys-motion-spring-fast-effects: 150ms cubic-bezier(0.31, 0.94, 0.34, 1.00);",o+="--md-sys-motion-spring-default-effects: 200ms cubic-bezier(0.34, 0.80, 0.34, 1.00);",o+="--md-sys-motion-spring-slow-effects: 300ms cubic-bezier(0.34, 0.88, 0.34, 1.00);"),o+=`--md-sys-density-scale: ${this.density};`,o+=`--m3e-scrollbar-thumb-color: ${gt(a.neutralPalette.tone(60))};`,o+=`--m3e-focus-ring-visibility: ${this.strongFocus?"visible":"hidden"};`,o+=`font-size: ${c.typescale.standard.body.large.fontSize};`,o+=`font-weight: ${c.typescale.standard.body.large.fontWeight};`,o+=`line-height: ${c.typescale.standard.body.large.lineHeight};`,o+=`letter-spacing: ${c.typescale.standard.body.large.tracking};`,this.parentElement instanceof HTMLBodyElement)switch(e(this,pt,"f").replaceSync(`\n html { ${o} }\n @media not (forced-colors: active) {\n body { \n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n scrollbar-color: ${c.scrollbar.color};\n }\n }`),this.scheme){case"light":document.documentElement.style.colorScheme="light";break;case"dark":document.documentElement.style.colorScheme="dark";break;default:switch(document.documentElement.style.colorScheme){case"light":case"dark":document.documentElement.style.colorScheme="light dark"}}else e(this,pt,"f").replaceSync(`:host { ${o} }`);e(this,wt,"f")&&this.dispatchEvent(new Event("change",{bubbles:!0})),t&&document.body.offsetHeight},xt=function(){switch(this.contrast){case"high":return 1;case"medium":return.5;default:return 0}},It.styles=n`:host { display: contents; }`,t([i()],It.prototype,"color",void 0),t([i()],It.prototype,"scheme",void 0),t([i()],It.prototype,"contrast",void 0),t([i({attribute:"strong-focus",type:Boolean})],It.prototype,"strongFocus",void 0),t([i({type:Number})],It.prototype,"density",void 0),t([i()],It.prototype,"motion",void 0),It=t([s("m3e-theme")],It);export{It as M3eThemeElement,yt as getColorFromImage};
|
|
431
431
|
//# sourceMappingURL=theme.min.js.map
|