@gradient-ui/core 0.4.0 → 0.5.0-rc.0
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/README.md +58 -2
- package/dist/GLoading.vue_vue_type_style_index_0_lang-Bv3dWEq8.cjs +1 -0
- package/dist/GLoading.vue_vue_type_style_index_0_lang-CBB_GocW.js +466 -0
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BS6bb1XY.cjs +1 -0
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-UTBNFP5X.js +7015 -0
- package/dist/{default-585QCoXx.js → camelToKebabCase-6qY6WHvl.js} +987 -1194
- package/dist/camelToKebabCase-BQDotaQm.cjs +316 -0
- package/dist/components.cjs +1 -1
- package/dist/components.mjs +56 -53
- package/dist/default-BhuY-A3o.cjs +4 -0
- package/dist/default-OTmCd0Aq.js +131 -0
- package/dist/directives.cjs +1 -1
- package/dist/directives.mjs +6 -5
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +183 -113
- package/dist/mask-BbofdFd4.cjs +1 -0
- package/dist/mask-CZX-I_iy.js +936 -0
- package/dist/material-Ca7ZZAiO.cjs +194 -0
- package/dist/material-okvXHenb.js +1162 -0
- package/dist/materialSurface-BBrP9ltj.js +591 -0
- package/dist/materialSurface-CK8LN_dU.cjs +1 -0
- package/dist/services.cjs +1 -1
- package/dist/services.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/surface-8z3gR7vF.cjs +1 -0
- package/dist/surface-BKu4KfkY.js +288 -0
- package/dist/theme.cjs +1 -1
- package/dist/theme.mjs +55 -9
- package/dist/types/components/index.d.ts +3 -1
- package/dist/types/components/ui/BaseOverlay/BaseOverlay.vue.d.ts +1 -1
- package/dist/types/components/ui/GAlert/GAlert.vue.d.ts +675 -9
- package/dist/types/components/ui/GAlert/types.d.ts +352 -4
- package/dist/types/components/ui/GAside/GAside.vue.d.ts +7 -5
- package/dist/types/components/ui/GAside/types.d.ts +17 -6
- package/dist/types/components/ui/GBadge/GBadge.vue.d.ts +679 -13
- package/dist/types/components/ui/GBadge/types.d.ts +350 -3
- package/dist/types/components/ui/GButton/GButton.vue.d.ts +295 -25
- package/dist/types/components/ui/GButton/types.d.ts +194 -49
- package/dist/types/components/ui/GCheckControl/GCheckControl.vue.d.ts +24 -24
- package/dist/types/components/ui/GCheckControl/GCheckGroup.vue.d.ts +24 -24
- package/dist/types/components/ui/GCheckbox/GCheckbox.vue.d.ts +24 -24
- package/dist/types/components/ui/GChip/GChip.vue.d.ts +295 -25
- package/dist/types/components/ui/GChip/types.d.ts +188 -43
- package/dist/types/components/ui/GDrawer/GDrawer.vue.d.ts +1 -1
- package/dist/types/components/ui/GExpansion/GExpansion.vue.d.ts +47 -13
- package/dist/types/components/ui/GExpansion/types.d.ts +284 -22
- package/dist/types/components/ui/GFAB/GFAB.vue.d.ts +220 -7
- package/dist/types/components/ui/GFAB/types.d.ts +122 -3
- package/dist/types/components/ui/GFieldBase/GFieldBase.vue.d.ts +15 -15
- package/dist/types/components/ui/GFieldBase/props.d.ts +10 -10
- package/dist/types/components/ui/GForm/GForm.vue.d.ts +156 -0
- package/dist/types/components/ui/GForm/index.d.ts +2 -0
- package/dist/types/components/ui/GForm/types.d.ts +107 -0
- package/dist/types/components/ui/GGradient/GGradient.vue.d.ts +165 -66
- package/dist/types/components/ui/GGradient/GGradientBorderLayer.vue.d.ts +11 -0
- package/dist/types/components/ui/GGradient/index.d.ts +1 -0
- package/dist/types/components/ui/GGradient/types.d.ts +10 -1
- package/dist/types/components/ui/GGradientMaterial/GGradientMaterial.vue.d.ts +257 -0
- package/dist/types/components/ui/GGradientMaterial/index.d.ts +2 -0
- package/dist/types/components/ui/GGradientMaterial/types.d.ts +140 -0
- package/dist/types/components/ui/GInput/GInput.vue.d.ts +15 -15
- package/dist/types/components/ui/GLoading/GLoading.vue.d.ts +5 -5
- package/dist/types/components/ui/GLoading/types.d.ts +3 -2
- package/dist/types/components/ui/GMenu/GSubmenu.vue.d.ts +14 -14
- package/dist/types/components/ui/GMenuItem/GMenuItem.vue.d.ts +11 -11
- package/dist/types/components/ui/GMenuItem/types.d.ts +4 -4
- package/dist/types/components/ui/GModal/GModal.vue.d.ts +1 -1
- package/dist/types/components/ui/GNavList/GNavList.vue.d.ts +7 -5
- package/dist/types/components/ui/GNavList/types.d.ts +17 -6
- package/dist/types/components/ui/GNavbar/GNavbar.vue.d.ts +4 -4
- package/dist/types/components/ui/GNavbar/types.d.ts +6 -6
- package/dist/types/components/ui/GProgress/GProgress.vue.d.ts +41 -20
- package/dist/types/components/ui/GProgress/types.d.ts +23 -10
- package/dist/types/components/ui/GQuickActions/GQuickActions.vue.d.ts +1 -1
- package/dist/types/components/ui/GSelectItem.vue.d.ts +5 -3
- package/dist/types/components/ui/GSnackbar/GSnackbar.vue.d.ts +681 -15
- package/dist/types/components/ui/GSnackbar/types.d.ts +350 -3
- package/dist/types/components/ui/GSquircle/GSquircle.vue.d.ts +2 -2
- package/dist/types/components/ui/GSquircle/types.d.ts +8 -2
- package/dist/types/components/ui/GSwitch/GSwitch.vue.d.ts +24 -24
- package/dist/types/components/ui/GTable/GTable.vue.d.ts +51 -3
- package/dist/types/components/ui/GTable/types.d.ts +351 -3
- package/dist/types/components/ui/GTabs/GTabs.vue.d.ts +4 -4
- package/dist/types/components/ui/GTabs/types.d.ts +6 -6
- package/dist/types/components/ui/GTextarea/GTextarea.vue.d.ts +15 -15
- package/dist/types/components/ui/GToggleButton/GToggleButton.vue.d.ts +490 -16
- package/dist/types/components/ui/GToggleButton/types.d.ts +284 -32
- package/dist/types/directives/index.d.ts +2 -0
- package/dist/types/directives/ripple.d.ts +1 -1
- package/dist/types/directives/specular.d.ts +34 -0
- package/dist/types/theme/color.d.ts +11 -0
- package/dist/types/theme/colorSeeds.d.ts +21 -20
- package/dist/types/theme/colorSystem.d.ts +12 -0
- package/dist/types/theme/cssTokens.d.ts +7 -0
- package/dist/types/theme/default.d.ts +26 -80
- package/dist/types/theme/gradient/animation/css.d.ts +12 -0
- package/dist/types/theme/gradient/animation/index.d.ts +1 -0
- package/dist/types/theme/gradient/colorMath.d.ts +3 -0
- package/dist/types/theme/gradient/constants.d.ts +3 -0
- package/dist/types/theme/gradient/core.d.ts +1 -0
- package/dist/types/theme/gradient/effects/index.d.ts +1 -0
- package/dist/types/theme/gradient/effects/morph.d.ts +5 -0
- package/dist/types/theme/gradient/effects/shadow.d.ts +3 -0
- package/dist/types/theme/gradient/formatters/canvas.d.ts +2 -0
- package/dist/types/theme/gradient/formatters/css.d.ts +3 -0
- package/dist/types/theme/gradient/formatters/index.d.ts +1 -0
- package/dist/types/theme/gradient/formatters/svg.d.ts +5 -0
- package/dist/types/theme/gradient/index.d.ts +1 -0
- package/dist/types/theme/gradient/material.d.ts +1 -0
- package/dist/types/theme/gradient/model.d.ts +5 -0
- package/dist/types/theme/gradient/presets.d.ts +158 -0
- package/dist/types/theme/gradient/recipes.d.ts +14 -0
- package/dist/types/theme/gradient/tokens.d.ts +72 -0
- package/dist/types/theme/gradient/types.d.ts +117 -0
- package/dist/types/theme/gradient/utils.d.ts +10 -0
- package/dist/types/theme/gradient.d.ts +1 -0
- package/dist/types/theme/index.d.ts +12 -1
- package/dist/types/theme/palette.d.ts +13 -0
- package/dist/types/theme/scheme.d.ts +2 -0
- package/dist/types/theme/types.d.ts +11 -0
- package/dist/types/use/actionSurface.d.ts +1742 -20
- package/dist/types/use/check/booleanControl.d.ts +9 -9
- package/dist/types/use/check/optionGroup.d.ts +9 -7
- package/dist/types/use/check/types.d.ts +26 -26
- package/dist/types/use/color.d.ts +2 -2
- package/dist/types/use/colorResolver.d.ts +15 -5
- package/dist/types/use/form/context.d.ts +8 -0
- package/dist/types/use/form/control.d.ts +4 -0
- package/dist/types/use/form/props.d.ts +4 -4
- package/dist/types/use/form/textFieldControl.d.ts +1 -1
- package/dist/types/use/glass.d.ts +24 -0
- package/dist/types/use/gradient.d.ts +1759 -43
- package/dist/types/use/gradientGlow.d.ts +4 -4
- package/dist/types/use/gradientMaterial.d.ts +21 -0
- package/dist/types/use/gradientRuntime.d.ts +11 -0
- package/dist/types/use/gradientRuntimeRegistry.d.ts +8 -0
- package/dist/types/use/gradientSurface.d.ts +31 -4
- package/dist/types/use/index.d.ts +8 -0
- package/dist/types/use/input/props.d.ts +11 -11
- package/dist/types/use/material.d.ts +112 -0
- package/dist/types/use/materialSurface.d.ts +376 -0
- package/dist/types/use/surface.d.ts +67 -19
- package/dist/types/use/surfaceColor.d.ts +1 -1
- package/dist/types/use/textarea/props.d.ts +11 -11
- package/dist/types/use/variant.d.ts +1 -1
- package/dist/use.cjs +1 -1
- package/dist/use.mjs +42 -22
- package/dist/useSnackbar-BHQshEZ8.cjs +1 -0
- package/dist/useSnackbar-DeNHZH8v.js +908 -0
- package/package.json +11 -4
- package/dist/GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js +0 -680
- package/dist/GLoading.vue_vue_type_style_index_0_lang-cokm-HBh.cjs +0 -1
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BmbKqNgm.js +0 -6421
- package/dist/GSwitch.vue_vue_type_script_setup_true_lang-By_7hZOW.cjs +0 -4
- package/dist/camelToKebabCase-BAESShJ1.cjs +0 -1
- package/dist/camelToKebabCase-KgkZ7-1F.js +0 -28
- package/dist/default-BcPApP1Q.cjs +0 -318
- package/dist/mask-Bu8cjwwH.js +0 -817
- package/dist/mask-D1vJj5Hl.cjs +0 -1
- package/dist/propsFactory-DyyboUaC.cjs +0 -1
- package/dist/propsFactory-UhcvubZJ.js +0 -13
- package/dist/tagName-CYG1CUfd.js +0 -103
- package/dist/tagName-CbsvFHGg.cjs +0 -1
- package/dist/types/theme/changeTone.d.ts +0 -1
- package/dist/types/theme/colorPallete.d.ts +0 -2
- package/dist/types/theme/generateColors.d.ts +0 -1
- package/dist/types/theme/generateGradient.d.ts +0 -9
- package/dist/types/theme/getComplementaryColor.d.ts +0 -1
- package/dist/types/utils/color.d.ts +0 -3
- package/dist/types/utils/colors/normaliseColor.d.ts +0 -5
- package/dist/useSnackbar-2iJU4bdd.js +0 -769
- package/dist/useSnackbar-3QuH25xm.cjs +0 -1
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
"use strict";const Se=require("./camelToKebabCase-BAESShJ1.cjs"),de=require("vue");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/function j(r){return r<0?-1:r===0?0:1}function pe(r,e,t){return(1-t)*r+t*e}function Pt(r,e,t){return t<r?r:t>e?e:t}function U(r,e,t){return t<r?r:t>e?e:t}function Ce(r){return r=r%360,r<0&&(r=r+360),r}function kt(r,e){return Ce(e-r)<=180?1:-1}function bt(r,e){return 180-Math.abs(Math.abs(r-e)-180)}function Re(r,e){const t=r[0]*e[0][0]+r[1]*e[0][1]+r[2]*e[0][2],n=r[0]*e[1][0]+r[1]*e[1][1]+r[2]*e[1][2],a=r[0]*e[2][0]+r[1]*e[2][1]+r[2]*e[2][2];return[t,n,a]}/**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2021 Google LLC
|
|
19
|
-
*
|
|
20
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License.
|
|
22
|
-
* You may obtain a copy of the License at
|
|
23
|
-
*
|
|
24
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
-
* See the License for the specific language governing permissions and
|
|
30
|
-
* limitations under the License.
|
|
31
|
-
*/const St=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],Ct=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Tt=[95.047,100,108.883];function Te(r,e,t){return(255<<24|(r&255)<<16|(e&255)<<8|t&255)>>>0}function Ke(r){const e=ie(r[0]),t=ie(r[1]),n=ie(r[2]);return Te(e,t,n)}function at(r){return r>>16&255}function ot(r){return r>>8&255}function it(r){return r&255}function vt(r,e,t){const n=Ct,a=n[0][0]*r+n[0][1]*e+n[0][2]*t,o=n[1][0]*r+n[1][1]*e+n[1][2]*t,i=n[2][0]*r+n[2][1]*e+n[2][2]*t,u=ie(a),l=ie(o),h=ie(i);return Te(u,l,h)}function Dt(r){const e=le(at(r)),t=le(ot(r)),n=le(it(r));return Re([e,t,n],St)}function wt(r){const e=ae(r),t=ie(e);return Te(t,t,t)}function Ve(r){const e=Dt(r)[1];return 116*st(e/100)-16}function ae(r){return 100*xt((r+16)/116)}function Ne(r){return st(r/100)*116-16}function le(r){const e=r/255;return e<=.040449936?e/12.92*100:Math.pow((e+.055)/1.055,2.4)*100}function ie(r){const e=r/100;let t=0;return e<=.0031308?t=e*12.92:t=1.055*Math.pow(e,1/2.4)-.055,Pt(0,255,Math.round(t*255))}function Ft(){return Tt}function st(r){const e=.008856451679035631,t=24389/27;return r>e?Math.pow(r,1/3):(t*r+16)/116}function xt(r){const e=.008856451679035631,t=24389/27,n=r*r*r;return n>e?n:(116*r-16)/t}/**
|
|
32
|
-
* @license
|
|
33
|
-
* Copyright 2021 Google LLC
|
|
34
|
-
*
|
|
35
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
-
* you may not use this file except in compliance with the License.
|
|
37
|
-
* You may obtain a copy of the License at
|
|
38
|
-
*
|
|
39
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
-
*
|
|
41
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
-
* See the License for the specific language governing permissions and
|
|
45
|
-
* limitations under the License.
|
|
46
|
-
*/class J{static make(e=Ft(),t=200/Math.PI*ae(50)/100,n=50,a=2,o=!1){const i=e,u=i[0]*.401288+i[1]*.650173+i[2]*-.051461,l=i[0]*-.250268+i[1]*1.204414+i[2]*.045854,h=i[0]*-.002079+i[1]*.048952+i[2]*.953127,f=.8+a/10,g=f>=.9?pe(.59,.69,(f-.9)*10):pe(.525,.59,(f-.8)*10);let p=o?1:f*(1-1/3.6*Math.exp((-t-42)/92));p=p>1?1:p<0?0:p;const v=f,m=[p*(100/u)+1-p,p*(100/l)+1-p,p*(100/h)+1-p],P=1/(5*t+1),k=P*P*P*P,B=1-k,x=k*t+.1*B*B*Math.cbrt(5*t),O=ae(n)/e[1],R=1.48+Math.sqrt(O),V=.725/Math.pow(O,.2),I=V,F=[Math.pow(x*m[0]*u/100,.42),Math.pow(x*m[1]*l/100,.42),Math.pow(x*m[2]*h/100,.42)],L=[400*F[0]/(F[0]+27.13),400*F[1]/(F[1]+27.13),400*F[2]/(F[2]+27.13)],z=(2*L[0]+L[1]+.05*L[2])*V;return new J(O,z,V,I,g,v,m,x,Math.pow(x,.25),R)}constructor(e,t,n,a,o,i,u,l,h,f){this.n=e,this.aw=t,this.nbb=n,this.ncb=a,this.c=o,this.nc=i,this.rgbD=u,this.fl=l,this.fLRoot=h,this.z=f}}J.DEFAULT=J.make();/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2021 Google LLC
|
|
49
|
-
*
|
|
50
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
51
|
-
* you may not use this file except in compliance with the License.
|
|
52
|
-
* You may obtain a copy of the License at
|
|
53
|
-
*
|
|
54
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
-
*
|
|
56
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
58
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
-
* See the License for the specific language governing permissions and
|
|
60
|
-
* limitations under the License.
|
|
61
|
-
*/class H{constructor(e,t,n,a,o,i,u,l,h){this.hue=e,this.chroma=t,this.j=n,this.q=a,this.m=o,this.s=i,this.jstar=u,this.astar=l,this.bstar=h}distance(e){const t=this.jstar-e.jstar,n=this.astar-e.astar,a=this.bstar-e.bstar,o=Math.sqrt(t*t+n*n+a*a);return 1.41*Math.pow(o,.63)}static fromInt(e){return H.fromIntInViewingConditions(e,J.DEFAULT)}static fromIntInViewingConditions(e,t){const n=(e&16711680)>>16,a=(e&65280)>>8,o=e&255,i=le(n),u=le(a),l=le(o),h=.41233895*i+.35762064*u+.18051042*l,f=.2126*i+.7152*u+.0722*l,g=.01932141*i+.11916382*u+.95034478*l,p=.401288*h+.650173*f-.051461*g,v=-.250268*h+1.204414*f+.045854*g,m=-.002079*h+.048952*f+.953127*g,P=t.rgbD[0]*p,k=t.rgbD[1]*v,B=t.rgbD[2]*m,x=Math.pow(t.fl*Math.abs(P)/100,.42),O=Math.pow(t.fl*Math.abs(k)/100,.42),R=Math.pow(t.fl*Math.abs(B)/100,.42),V=j(P)*400*x/(x+27.13),I=j(k)*400*O/(O+27.13),F=j(B)*400*R/(R+27.13),L=(11*V+-12*I+F)/11,z=(V+I-2*F)/9,E=(20*V+20*I+21*F)/20,W=(40*V+20*I+F)/20,ce=Math.atan2(z,L)*180/Math.PI,q=Ce(ce),ge=q*Math.PI/180,ye=W*t.nbb,re=100*Math.pow(ye/t.aw,t.c*t.z),Pe=4/t.c*Math.sqrt(re/100)*(t.aw+4)*t.fLRoot,we=q<20.14?q+360:q,Fe=.25*(Math.cos(we*Math.PI/180+2)+3.8),Me=5e4/13*Fe*t.nc*t.ncb*Math.sqrt(L*L+z*z)/(E+.305),ke=Math.pow(Me,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),$e=ke*Math.sqrt(re/100),Ye=$e*t.fLRoot,pt=50*Math.sqrt(ke*t.c/(t.aw+4)),mt=(1+100*.007)*re/(1+.007*re),je=1/.0228*Math.log(1+.0228*Ye),gt=je*Math.cos(ge),yt=je*Math.sin(ge);return new H(q,$e,re,Pe,Ye,pt,mt,gt,yt)}static fromJch(e,t,n){return H.fromJchInViewingConditions(e,t,n,J.DEFAULT)}static fromJchInViewingConditions(e,t,n,a){const o=4/a.c*Math.sqrt(e/100)*(a.aw+4)*a.fLRoot,i=t*a.fLRoot,u=t/Math.sqrt(e/100),l=50*Math.sqrt(u*a.c/(a.aw+4)),h=n*Math.PI/180,f=(1+100*.007)*e/(1+.007*e),g=1/.0228*Math.log(1+.0228*i),p=g*Math.cos(h),v=g*Math.sin(h);return new H(n,t,e,o,i,l,f,p,v)}static fromUcs(e,t,n){return H.fromUcsInViewingConditions(e,t,n,J.DEFAULT)}static fromUcsInViewingConditions(e,t,n,a){const o=t,i=n,u=Math.sqrt(o*o+i*i),h=(Math.exp(u*.0228)-1)/.0228/a.fLRoot;let f=Math.atan2(i,o)*(180/Math.PI);f<0&&(f+=360);const g=e/(1-(e-100)*.007);return H.fromJchInViewingConditions(g,h,f,a)}toInt(){return this.viewed(J.DEFAULT)}viewed(e){const t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),n=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),a=this.hue*Math.PI/180,o=.25*(Math.cos(a+2)+3.8),i=e.aw*Math.pow(this.j/100,1/e.c/e.z),u=o*(5e4/13)*e.nc*e.ncb,l=i/e.nbb,h=Math.sin(a),f=Math.cos(a),g=23*(l+.305)*n/(23*u+11*n*f+108*n*h),p=g*f,v=g*h,m=(460*l+451*p+288*v)/1403,P=(460*l-891*p-261*v)/1403,k=(460*l-220*p-6300*v)/1403,B=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),x=j(m)*(100/e.fl)*Math.pow(B,1/.42),O=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),R=j(P)*(100/e.fl)*Math.pow(O,1/.42),V=Math.max(0,27.13*Math.abs(k)/(400-Math.abs(k))),I=j(k)*(100/e.fl)*Math.pow(V,1/.42),F=x/e.rgbD[0],L=R/e.rgbD[1],z=I/e.rgbD[2],E=1.86206786*F-1.01125463*L+.14918677*z,W=.38752654*F+.62144744*L-.00897398*z,te=-.0158415*F-.03412294*L+1.04996444*z;return vt(E,W,te)}static fromXyzInViewingConditions(e,t,n,a){const o=.401288*e+.650173*t-.051461*n,i=-.250268*e+1.204414*t+.045854*n,u=-.002079*e+.048952*t+.953127*n,l=a.rgbD[0]*o,h=a.rgbD[1]*i,f=a.rgbD[2]*u,g=Math.pow(a.fl*Math.abs(l)/100,.42),p=Math.pow(a.fl*Math.abs(h)/100,.42),v=Math.pow(a.fl*Math.abs(f)/100,.42),m=j(l)*400*g/(g+27.13),P=j(h)*400*p/(p+27.13),k=j(f)*400*v/(v+27.13),B=(11*m+-12*P+k)/11,x=(m+P-2*k)/9,O=(20*m+20*P+21*k)/20,R=(40*m+20*P+k)/20,I=Math.atan2(x,B)*180/Math.PI,F=I<0?I+360:I>=360?I-360:I,L=F*Math.PI/180,z=R*a.nbb,E=100*Math.pow(z/a.aw,a.c*a.z),W=4/a.c*Math.sqrt(E/100)*(a.aw+4)*a.fLRoot,te=F<20.14?F+360:F,ce=1/4*(Math.cos(te*Math.PI/180+2)+3.8),ge=5e4/13*ce*a.nc*a.ncb*Math.sqrt(B*B+x*x)/(O+.305),ye=Math.pow(ge,.9)*Math.pow(1.64-Math.pow(.29,a.n),.73),re=ye*Math.sqrt(E/100),Pe=re*a.fLRoot,we=50*Math.sqrt(ye*a.c/(a.aw+4)),Fe=(1+100*.007)*E/(1+.007*E),xe=Math.log(1+.0228*Pe)/.0228,Me=xe*Math.cos(L),ke=xe*Math.sin(L);return new H(F,re,E,W,Pe,we,Fe,Me,ke)}xyzInViewingConditions(e){const t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),n=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),a=this.hue*Math.PI/180,o=.25*(Math.cos(a+2)+3.8),i=e.aw*Math.pow(this.j/100,1/e.c/e.z),u=o*(5e4/13)*e.nc*e.ncb,l=i/e.nbb,h=Math.sin(a),f=Math.cos(a),g=23*(l+.305)*n/(23*u+11*n*f+108*n*h),p=g*f,v=g*h,m=(460*l+451*p+288*v)/1403,P=(460*l-891*p-261*v)/1403,k=(460*l-220*p-6300*v)/1403,B=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),x=j(m)*(100/e.fl)*Math.pow(B,1/.42),O=Math.max(0,27.13*Math.abs(P)/(400-Math.abs(P))),R=j(P)*(100/e.fl)*Math.pow(O,1/.42),V=Math.max(0,27.13*Math.abs(k)/(400-Math.abs(k))),I=j(k)*(100/e.fl)*Math.pow(V,1/.42),F=x/e.rgbD[0],L=R/e.rgbD[1],z=I/e.rgbD[2],E=1.86206786*F-1.01125463*L+.14918677*z,W=.38752654*F+.62144744*L-.00897398*z,te=-.0158415*F-.03412294*L+1.04996444*z;return[E,W,te]}}/**
|
|
62
|
-
* @license
|
|
63
|
-
* Copyright 2021 Google LLC
|
|
64
|
-
*
|
|
65
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
66
|
-
* you may not use this file except in compliance with the License.
|
|
67
|
-
* You may obtain a copy of the License at
|
|
68
|
-
*
|
|
69
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
-
*
|
|
71
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
72
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
73
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
|
-
* See the License for the specific language governing permissions and
|
|
75
|
-
* limitations under the License.
|
|
76
|
-
*/class S{static sanitizeRadians(e){return(e+Math.PI*8)%(Math.PI*2)}static trueDelinearized(e){const t=e/100;let n=0;return t<=.0031308?n=t*12.92:n=1.055*Math.pow(t,1/2.4)-.055,n*255}static chromaticAdaptation(e){const t=Math.pow(Math.abs(e),.42);return j(e)*400*t/(t+27.13)}static hueOf(e){const t=Re(e,S.SCALED_DISCOUNT_FROM_LINRGB),n=S.chromaticAdaptation(t[0]),a=S.chromaticAdaptation(t[1]),o=S.chromaticAdaptation(t[2]),i=(11*n+-12*a+o)/11,u=(n+a-2*o)/9;return Math.atan2(u,i)}static areInCyclicOrder(e,t,n){const a=S.sanitizeRadians(t-e),o=S.sanitizeRadians(n-e);return a<o}static intercept(e,t,n){return(t-e)/(n-e)}static lerpPoint(e,t,n){return[e[0]+(n[0]-e[0])*t,e[1]+(n[1]-e[1])*t,e[2]+(n[2]-e[2])*t]}static setCoordinate(e,t,n,a){const o=S.intercept(e[a],t,n[a]);return S.lerpPoint(e,o,n)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,t){const n=S.Y_FROM_LINRGB[0],a=S.Y_FROM_LINRGB[1],o=S.Y_FROM_LINRGB[2],i=t%4<=1?0:100,u=t%2===0?0:100;if(t<4){const l=i,h=u,f=(e-l*a-h*o)/n;return S.isBounded(f)?[f,l,h]:[-1,-1,-1]}else if(t<8){const l=i,h=u,f=(e-h*n-l*o)/a;return S.isBounded(f)?[h,f,l]:[-1,-1,-1]}else{const l=i,h=u,f=(e-l*n-h*a)/o;return S.isBounded(f)?[l,h,f]:[-1,-1,-1]}}static bisectToSegment(e,t){let n=[-1,-1,-1],a=n,o=0,i=0,u=!1,l=!0;for(let h=0;h<12;h++){const f=S.nthVertex(e,h);if(f[0]<0)continue;const g=S.hueOf(f);if(!u){n=f,a=f,o=g,i=g,u=!0;continue}(l||S.areInCyclicOrder(o,g,i))&&(l=!1,S.areInCyclicOrder(o,t,g)?(a=f,i=g):(n=f,o=g))}return[n,a]}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 n=S.bisectToSegment(e,t);let a=n[0],o=S.hueOf(a),i=n[1];for(let u=0;u<3;u++)if(a[u]!==i[u]){let l=-1,h=255;a[u]<i[u]?(l=S.criticalPlaneBelow(S.trueDelinearized(a[u])),h=S.criticalPlaneAbove(S.trueDelinearized(i[u]))):(l=S.criticalPlaneAbove(S.trueDelinearized(a[u])),h=S.criticalPlaneBelow(S.trueDelinearized(i[u])));for(let f=0;f<8&&!(Math.abs(h-l)<=1);f++){const g=Math.floor((l+h)/2),p=S.CRITICAL_PLANES[g],v=S.setCoordinate(a,p,i,u),m=S.hueOf(v);S.areInCyclicOrder(o,t,m)?(i=v,h=g):(a=v,o=m,l=g)}}return S.midpoint(a,i)}static inverseChromaticAdaptation(e){const t=Math.abs(e),n=Math.max(0,27.13*t/(400-t));return j(e)*Math.pow(n,1/.42)}static findResultByJ(e,t,n){let a=Math.sqrt(n)*11;const o=J.DEFAULT,i=1/Math.pow(1.64-Math.pow(.29,o.n),.73),l=.25*(Math.cos(e+2)+3.8)*(5e4/13)*o.nc*o.ncb,h=Math.sin(e),f=Math.cos(e);for(let g=0;g<5;g++){const p=a/100,v=t===0||a===0?0:t/Math.sqrt(p),m=Math.pow(v*i,1/.9),k=o.aw*Math.pow(p,1/o.c/o.z)/o.nbb,B=23*(k+.305)*m/(23*l+11*m*f+108*m*h),x=B*f,O=B*h,R=(460*k+451*x+288*O)/1403,V=(460*k-891*x-261*O)/1403,I=(460*k-220*x-6300*O)/1403,F=S.inverseChromaticAdaptation(R),L=S.inverseChromaticAdaptation(V),z=S.inverseChromaticAdaptation(I),E=Re([F,L,z],S.LINRGB_FROM_SCALED_DISCOUNT);if(E[0]<0||E[1]<0||E[2]<0)return 0;const W=S.Y_FROM_LINRGB[0],te=S.Y_FROM_LINRGB[1],ce=S.Y_FROM_LINRGB[2],q=W*E[0]+te*E[1]+ce*E[2];if(q<=0)return 0;if(g===4||Math.abs(q-n)<.002)return E[0]>100.01||E[1]>100.01||E[2]>100.01?0:Ke(E);a=a-(q-n)*a/(2*q)}return 0}static solveToInt(e,t,n){if(t<1e-4||n<1e-4||n>99.9999)return wt(n);e=Ce(e);const a=e/180*Math.PI,o=ae(n),i=S.findResultByJ(a,t,o);if(i!==0)return i;const u=S.bisectToLimit(o,a);return Ke(u)}static solveToCam(e,t,n){return H.fromInt(S.solveToInt(e,t,n))}}S.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]];S.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]];S.Y_FROM_LINRGB=[.2126,.7152,.0722];S.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];/**
|
|
77
|
-
* @license
|
|
78
|
-
* Copyright 2021 Google LLC
|
|
79
|
-
*
|
|
80
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
|
-
* you may not use this file except in compliance with the License.
|
|
82
|
-
* You may obtain a copy of the License at
|
|
83
|
-
*
|
|
84
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
85
|
-
*
|
|
86
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
87
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
88
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
|
-
* See the License for the specific language governing permissions and
|
|
90
|
-
* limitations under the License.
|
|
91
|
-
*/class C{static from(e,t,n){return new C(S.solveToInt(e,t,n))}static fromInt(e){return new C(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(S.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(S.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(S.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=H.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=Ve(e),this.argb=e}setInternalState(e){const t=H.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=Ve(e),this.argb=e}inViewingConditions(e){const n=H.fromInt(this.toInt()).xyzInViewingConditions(e),a=H.fromXyzInViewingConditions(n[0],n[1],n[2],J.make());return C.from(a.hue,a.chroma,Ne(n[1]))}}/**
|
|
92
|
-
* @license
|
|
93
|
-
* Copyright 2021 Google LLC
|
|
94
|
-
*
|
|
95
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
96
|
-
* you may not use this file except in compliance with the License.
|
|
97
|
-
* You may obtain a copy of the License at
|
|
98
|
-
*
|
|
99
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
100
|
-
*
|
|
101
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
102
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
103
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
104
|
-
* See the License for the specific language governing permissions and
|
|
105
|
-
* limitations under the License.
|
|
106
|
-
*/class _e{static harmonize(e,t){const n=C.fromInt(e),a=C.fromInt(t),o=bt(n.hue,a.hue),i=Math.min(o*.5,15),u=Ce(n.hue+i*kt(n.hue,a.hue));return C.from(u,n.chroma,n.tone).toInt()}static hctHue(e,t,n){const a=_e.cam16Ucs(e,t,n),o=H.fromInt(a),i=H.fromInt(e);return C.from(o.hue,i.chroma,Ve(e)).toInt()}static cam16Ucs(e,t,n){const a=H.fromInt(e),o=H.fromInt(t),i=a.jstar,u=a.astar,l=a.bstar,h=o.jstar,f=o.astar,g=o.bstar,p=i+(h-i)*n,v=u+(f-u)*n,m=l+(g-l)*n;return H.fromUcs(p,v,m).toInt()}}/**
|
|
107
|
-
* @license
|
|
108
|
-
* Copyright 2022 Google LLC
|
|
109
|
-
*
|
|
110
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
-
* you may not use this file except in compliance with the License.
|
|
112
|
-
* You may obtain a copy of the License at
|
|
113
|
-
*
|
|
114
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
-
*
|
|
116
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
-
* See the License for the specific language governing permissions and
|
|
120
|
-
* limitations under the License.
|
|
121
|
-
*/class M{static ratioOfTones(e,t){return e=U(0,100,e),t=U(0,100,t),M.ratioOfYs(ae(e),ae(t))}static ratioOfYs(e,t){const n=e>t?e:t,a=n===t?e:t;return(n+5)/(a+5)}static lighter(e,t){if(e<0||e>100)return-1;const n=ae(e),a=t*(n+5)-5,o=M.ratioOfYs(a,n),i=Math.abs(o-t);if(o<t&&i>.04)return-1;const u=Ne(a)+.4;return u<0||u>100?-1:u}static darker(e,t){if(e<0||e>100)return-1;const n=ae(e),a=(n+5)/t-5,o=M.ratioOfYs(n,a),i=Math.abs(o-t);if(o<t&&i>.04)return-1;const u=Ne(a)-.4;return u<0||u>100?-1:u}static lighterUnsafe(e,t){const n=M.lighter(e,t);return n<0?100:n}static darkerUnsafe(e,t){const n=M.darker(e,t);return n<0?0:n}}/**
|
|
122
|
-
* @license
|
|
123
|
-
* Copyright 2023 Google LLC
|
|
124
|
-
*
|
|
125
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
126
|
-
* you may not use this file except in compliance with the License.
|
|
127
|
-
* You may obtain a copy of the License at
|
|
128
|
-
*
|
|
129
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
130
|
-
*
|
|
131
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
132
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
133
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
|
-
* See the License for the specific language governing permissions and
|
|
135
|
-
* limitations under the License.
|
|
136
|
-
*/class He{static isDisliked(e){const t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,n=Math.round(e.chroma)>16,a=Math.round(e.tone)<65;return t&&n&&a}static fixIfDisliked(e){return He.isDisliked(e)?C.from(e.hue,e.chroma,70):e}}/**
|
|
137
|
-
* @license
|
|
138
|
-
* Copyright 2022 Google LLC
|
|
139
|
-
*
|
|
140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
-
* you may not use this file except in compliance with the License.
|
|
142
|
-
* You may obtain a copy of the License at
|
|
143
|
-
*
|
|
144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
-
*
|
|
146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
-
* See the License for the specific language governing permissions and
|
|
150
|
-
* limitations under the License.
|
|
151
|
-
*/function Mt(r,e,t){if(r.name!==t.name)throw new Error(`Attempting to extend color ${r.name} with color ${t.name} of different name for spec version ${e}.`);if(r.isBackground!==t.isBackground)throw new Error(`Attempting to extend color ${r.name} as a ${r.isBackground?"background":"foreground"} with color ${t.name} as a ${t.isBackground?"background":"foreground"} for spec version ${e}.`)}function T(r,e,t){return Mt(r,e,t),c.fromPalette({name:r.name,palette:n=>n.specVersion===e?t.palette(n):r.palette(n),tone:n=>n.specVersion===e?t.tone(n):r.tone(n),isBackground:r.isBackground,chromaMultiplier:n=>{const a=n.specVersion===e?t.chromaMultiplier:r.chromaMultiplier;return a!==void 0?a(n):1},background:n=>{const a=n.specVersion===e?t.background:r.background;return a!==void 0?a(n):void 0},secondBackground:n=>{const a=n.specVersion===e?t.secondBackground:r.secondBackground;return a!==void 0?a(n):void 0},contrastCurve:n=>{const a=n.specVersion===e?t.contrastCurve:r.contrastCurve;return a!==void 0?a(n):void 0},toneDeltaPair:n=>{const a=n.specVersion===e?t.toneDeltaPair:r.toneDeltaPair;return a!==void 0?a(n):void 0}})}class c{static fromPalette(e){return new c(e.name??"",e.palette,e.tone??c.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,n,a,o,i,u,l,h){if(this.name=e,this.palette=t,this.tone=n,this.isBackground=a,this.chromaMultiplier=o,this.background=i,this.secondBackground=u,this.contrastCurve=l,this.toneDeltaPair=h,this.hctCache=new Map,!i&&u)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!i&&l)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(i&&!l)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}clone(){return c.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 n=qe(e.specVersion).getHct(e,this);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,n),n}getTone(e){return qe(e.specVersion).getTone(e,this)}static foregroundTone(e,t){const n=M.lighterUnsafe(e,t),a=M.darkerUnsafe(e,t),o=M.ratioOfTones(n,e),i=M.ratioOfTones(a,e);if(c.tonePrefersLightForeground(e)){const l=Math.abs(o-i)<.1&&o<t&&i<t;return o>=t||o>=i||l?n:a}else return i>=t||i>=o?a:n}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return c.tonePrefersLightForeground(e)&&!c.toneAllowsLightForeground(e)?49:e}}class Bt{getHct(e,t){const n=t.getTone(e);return t.palette(e).getHct(n)}getTone(e,t){const n=e.contrastLevel<0,a=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(a){const o=a.roleA,i=a.roleB,u=a.delta,l=a.polarity,h=a.stayTogether,f=l==="nearer"||l==="lighter"&&!e.isDark||l==="darker"&&e.isDark,g=f?o:i,p=f?i:o,v=t.name===g.name,m=e.isDark?1:-1;let P=g.tone(e),k=p.tone(e);if(t.background&&g.contrastCurve&&p.contrastCurve){const B=t.background(e),x=g.contrastCurve(e),O=p.contrastCurve(e);if(B&&x&&O){const R=B.getTone(e),V=x.get(e.contrastLevel),I=O.get(e.contrastLevel);M.ratioOfTones(R,P)<V&&(P=c.foregroundTone(R,V)),M.ratioOfTones(R,k)<I&&(k=c.foregroundTone(R,I)),n&&(P=c.foregroundTone(R,V),k=c.foregroundTone(R,I))}}return(k-P)*m<u&&(k=U(0,100,P+u*m),(k-P)*m>=u||(P=U(0,100,k-u*m))),50<=P&&P<60?m>0?(P=60,k=Math.max(k,P+u*m)):(P=49,k=Math.min(k,P+u*m)):50<=k&&k<60&&(h?m>0?(P=60,k=Math.max(k,P+u*m)):(P=49,k=Math.min(k,P+u*m)):m>0?k=60:k=49),v?P:k}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),u=t.contrastCurve(e).get(e.contrastLevel);if(M.ratioOfTones(i,o)>=u||(o=c.foregroundTone(i,u)),n&&(o=c.foregroundTone(i,u)),t.isBackground&&50<=o&&o<60&&(M.ratioOfTones(49,i)>=u?o=49:o=60),t.secondBackground==null||t.secondBackground(e)===void 0)return o;const[l,h]=[t.background,t.secondBackground],[f,g]=[l(e).getTone(e),h(e).getTone(e)],[p,v]=[Math.max(f,g),Math.min(f,g)];if(M.ratioOfTones(p,o)>=u&&M.ratioOfTones(v,o)>=u)return o;const m=M.lighter(p,u),P=M.darker(v,u),k=[];return m!==-1&&k.push(m),P!==-1&&k.push(P),c.tonePrefersLightForeground(f)||c.tonePrefersLightForeground(g)?m<0?100:m:k.length===1?k[0]:P<0?0:P}}}class At{getHct(e,t){const n=t.palette(e),a=t.getTone(e),o=n.hue,i=n.chroma*(t.chromaMultiplier?t.chromaMultiplier(e):1);return C.from(o,i,a)}getTone(e,t){const n=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(n){const a=n.roleA,o=n.roleB,i=n.polarity,u=n.constraint,l=i==="darker"||i==="relative_lighter"&&e.isDark||i==="relative_darker"&&!e.isDark?-n.delta:n.delta,h=t.name===a.name,f=h?a:o,g=h?o:a;let p=f.tone(e),v=g.getTone(e);const m=l*(h?1:-1);if(u==="exact"?p=U(0,100,v+m):u==="nearer"?m>0?p=U(0,100,U(v,v+m,p)):p=U(0,100,U(v+m,v,p)):u==="farther"&&(m>0?p=U(v+m,100,p):p=U(0,v+m,p)),t.background&&t.contrastCurve){const P=t.background(e),k=t.contrastCurve(e);if(P&&k){const B=P.getTone(e),x=k.get(e.contrastLevel);p=M.ratioOfTones(B,p)>=x&&e.contrastLevel>=0?p:c.foregroundTone(B,x)}}return t.isBackground&&!t.name.endsWith("_fixed_dim")&&(p>=57?p=U(65,100,p):p=U(0,49,p)),p}else{let a=t.tone(e);if(t.background==null||t.background(e)===void 0||t.contrastCurve==null||t.contrastCurve(e)===void 0)return a;const o=t.background(e).getTone(e),i=t.contrastCurve(e).get(e.contrastLevel);if(a=M.ratioOfTones(o,a)>=i&&e.contrastLevel>=0?a:c.foregroundTone(o,i),t.isBackground&&!t.name.endsWith("_fixed_dim")&&(a>=57?a=U(65,100,a):a=U(0,49,a)),t.secondBackground==null||t.secondBackground(e)===void 0)return a;const[u,l]=[t.background,t.secondBackground],[h,f]=[u(e).getTone(e),l(e).getTone(e)],[g,p]=[Math.max(h,f),Math.min(h,f)];if(M.ratioOfTones(g,a)>=i&&M.ratioOfTones(p,a)>=i)return a;const v=M.lighter(g,i),m=M.darker(p,i),P=[];return v!==-1&&P.push(v),m!==-1&&P.push(m),c.tonePrefersLightForeground(h)||c.tonePrefersLightForeground(f)?v<0?100:v:P.length===1?P[0]:m<0?0:m}}}const It=new Bt,Et=new At;function qe(r){return r==="2025"?Et:It}/**
|
|
152
|
-
* @license
|
|
153
|
-
* Copyright 2021 Google LLC
|
|
154
|
-
*
|
|
155
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
156
|
-
* you may not use this file except in compliance with the License.
|
|
157
|
-
* You may obtain a copy of the License at
|
|
158
|
-
*
|
|
159
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
160
|
-
*
|
|
161
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
163
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
-
* See the License for the specific language governing permissions and
|
|
165
|
-
* limitations under the License.
|
|
166
|
-
*/class Y{static fromInt(e){const t=C.fromInt(e);return Y.fromHct(t)}static fromHct(e){return new Y(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){const n=new Lt(e,t).create();return new Y(e,t,n)}constructor(e,t,n){this.hue=e,this.chroma=t,this.keyColor=n,this.cache=new Map}tone(e){let t=this.cache.get(e);return t===void 0&&(e==99&&C.isYellow(this.hue)?t=this.averageArgb(this.tone(98),this.tone(100)):t=C.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,t)),t}getHct(e){return C.fromInt(this.tone(e))}averageArgb(e,t){const n=e>>>16&255,a=e>>>8&255,o=e&255,i=t>>>16&255,u=t>>>8&255,l=t&255,h=Math.round((n+i)/2),f=Math.round((a+u)/2),g=Math.round((o+l)/2);return(255<<24|(h&255)<<16|(f&255)<<8|g&255)>>>0}}class Lt{constructor(e,t){this.hue=e,this.requestedChroma=t,this.chromaCache=new Map,this.maxChromaValue=200}create(){let a=0,o=100;for(;a<o;){const i=Math.floor((a+o)/2),u=this.maxChroma(i)<this.maxChroma(i+1);if(this.maxChroma(i)>=this.requestedChroma-.01)if(Math.abs(a-50)<Math.abs(o-50))o=i;else{if(a===i)return C.from(this.hue,this.requestedChroma,a);a=i}else u?a=i+1:o=i}return C.from(this.hue,this.requestedChroma,a)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);const t=C.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,t),t}}/**
|
|
167
|
-
* @license
|
|
168
|
-
* Copyright 2023 Google LLC
|
|
169
|
-
*
|
|
170
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
-
* you may not use this file except in compliance with the License.
|
|
172
|
-
* You may obtain a copy of the License at
|
|
173
|
-
*
|
|
174
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
-
*
|
|
176
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
178
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
-
* See the License for the specific language governing permissions and
|
|
180
|
-
* limitations under the License.
|
|
181
|
-
*/class y{constructor(e,t,n,a){this.low=e,this.normal=t,this.medium=n,this.high=a}get(e){return e<=-1?this.low:e<0?pe(this.low,this.normal,(e- -1)/1):e<.5?pe(this.normal,this.medium,(e-0)/.5):e<1?pe(this.medium,this.high,(e-.5)/.5):this.high}}/**
|
|
182
|
-
* @license
|
|
183
|
-
* Copyright 2023 Google LLC
|
|
184
|
-
*
|
|
185
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
186
|
-
* you may not use this file except in compliance with the License.
|
|
187
|
-
* You may obtain a copy of the License at
|
|
188
|
-
*
|
|
189
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
190
|
-
*
|
|
191
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
192
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
193
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
194
|
-
* See the License for the specific language governing permissions and
|
|
195
|
-
* limitations under the License.
|
|
196
|
-
*/class w{constructor(e,t,n,a,o,i){this.roleA=e,this.roleB=t,this.delta=n,this.polarity=a,this.stayTogether=o,this.constraint=i,this.constraint=i??"exact"}}/**
|
|
197
|
-
* @license
|
|
198
|
-
* Copyright 2022 Google LLC
|
|
199
|
-
*
|
|
200
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
201
|
-
* you may not use this file except in compliance with the License.
|
|
202
|
-
* You may obtain a copy of the License at
|
|
203
|
-
*
|
|
204
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
205
|
-
*
|
|
206
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
207
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
208
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
|
-
* See the License for the specific language governing permissions and
|
|
210
|
-
* limitations under the License.
|
|
211
|
-
*/var d;(function(r){r[r.MONOCHROME=0]="MONOCHROME",r[r.NEUTRAL=1]="NEUTRAL",r[r.TONAL_SPOT=2]="TONAL_SPOT",r[r.VIBRANT=3]="VIBRANT",r[r.EXPRESSIVE=4]="EXPRESSIVE",r[r.FIDELITY=5]="FIDELITY",r[r.CONTENT=6]="CONTENT",r[r.RAINBOW=7]="RAINBOW",r[r.FRUIT_SALAD=8]="FRUIT_SALAD"})(d||(d={}));/**
|
|
212
|
-
* @license
|
|
213
|
-
* Copyright 2025 Google LLC
|
|
214
|
-
*
|
|
215
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
-
* you may not use this file except in compliance with the License.
|
|
217
|
-
* You may obtain a copy of the License at
|
|
218
|
-
*
|
|
219
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
-
*
|
|
221
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
-
* See the License for the specific language governing permissions and
|
|
225
|
-
* limitations under the License.
|
|
226
|
-
*/function ue(r){return r.variant===d.FIDELITY||r.variant===d.CONTENT}function A(r){return r.variant===d.MONOCHROME}function Ot(r,e,t,n){let a=t,o=C.from(r,e,t);if(o.chroma<e){let i=o.chroma;for(;o.chroma<e;){a+=n?-1:1;const u=C.from(r,e,a);if(i>u.chroma||Math.abs(u.chroma-e)<.4)break;const l=Math.abs(u.chroma-e),h=Math.abs(o.chroma-e);l<h&&(o=u),i=Math.max(i,u.chroma)}}return a}class Rt{primaryPaletteKeyColor(){return c.fromPalette({name:"primary_palette_key_color",palette:e=>e.primaryPalette,tone:e=>e.primaryPalette.keyColor.tone})}secondaryPaletteKeyColor(){return c.fromPalette({name:"secondary_palette_key_color",palette:e=>e.secondaryPalette,tone:e=>e.secondaryPalette.keyColor.tone})}tertiaryPaletteKeyColor(){return c.fromPalette({name:"tertiary_palette_key_color",palette:e=>e.tertiaryPalette,tone:e=>e.tertiaryPalette.keyColor.tone})}neutralPaletteKeyColor(){return c.fromPalette({name:"neutral_palette_key_color",palette:e=>e.neutralPalette,tone:e=>e.neutralPalette.keyColor.tone})}neutralVariantPaletteKeyColor(){return c.fromPalette({name:"neutral_variant_palette_key_color",palette:e=>e.neutralVariantPalette,tone:e=>e.neutralVariantPalette.keyColor.tone})}errorPaletteKeyColor(){return c.fromPalette({name:"error_palette_key_color",palette:e=>e.errorPalette,tone:e=>e.errorPalette.keyColor.tone})}background(){return c.fromPalette({name:"background",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}onBackground(){return c.fromPalette({name:"on_background",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.background(),contrastCurve:e=>new y(3,3,4.5,7)})}surface(){return c.fromPalette({name:"surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:98,isBackground:!0})}surfaceDim(){return c.fromPalette({name:"surface_dim",palette:e=>e.neutralPalette,tone:e=>e.isDark?6:new y(87,87,80,75).get(e.contrastLevel),isBackground:!0})}surfaceBright(){return c.fromPalette({name:"surface_bright",palette:e=>e.neutralPalette,tone:e=>e.isDark?new y(24,24,29,34).get(e.contrastLevel):98,isBackground:!0})}surfaceContainerLowest(){return c.fromPalette({name:"surface_container_lowest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new y(4,4,2,0).get(e.contrastLevel):100,isBackground:!0})}surfaceContainerLow(){return c.fromPalette({name:"surface_container_low",palette:e=>e.neutralPalette,tone:e=>e.isDark?new y(10,10,11,12).get(e.contrastLevel):new y(96,96,96,95).get(e.contrastLevel),isBackground:!0})}surfaceContainer(){return c.fromPalette({name:"surface_container",palette:e=>e.neutralPalette,tone:e=>e.isDark?new y(12,12,16,20).get(e.contrastLevel):new y(94,94,92,90).get(e.contrastLevel),isBackground:!0})}surfaceContainerHigh(){return c.fromPalette({name:"surface_container_high",palette:e=>e.neutralPalette,tone:e=>e.isDark?new y(17,17,21,25).get(e.contrastLevel):new y(92,92,88,85).get(e.contrastLevel),isBackground:!0})}surfaceContainerHighest(){return c.fromPalette({name:"surface_container_highest",palette:e=>e.neutralPalette,tone:e=>e.isDark?new y(22,22,26,30).get(e.contrastLevel):new y(90,90,84,80).get(e.contrastLevel),isBackground:!0})}onSurface(){return c.fromPalette({name:"on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:10,background:e=>this.highestSurface(e),contrastCurve:e=>new y(4.5,7,11,21)})}surfaceVariant(){return c.fromPalette({name:"surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:90,isBackground:!0})}onSurfaceVariant(){return c.fromPalette({name:"on_surface_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?80:30,background:e=>this.highestSurface(e),contrastCurve:e=>new y(3,4.5,7,11)})}inverseSurface(){return c.fromPalette({name:"inverse_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?90:20,isBackground:!0})}inverseOnSurface(){return c.fromPalette({name:"inverse_on_surface",palette:e=>e.neutralPalette,tone:e=>e.isDark?20:95,background:e=>this.inverseSurface(),contrastCurve:e=>new y(4.5,7,11,21)})}outline(){return c.fromPalette({name:"outline",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?60:50,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1.5,3,4.5,7)})}outlineVariant(){return c.fromPalette({name:"outline_variant",palette:e=>e.neutralVariantPalette,tone:e=>e.isDark?30:80,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5)})}shadow(){return c.fromPalette({name:"shadow",palette:e=>e.neutralPalette,tone:e=>0})}scrim(){return c.fromPalette({name:"scrim",palette:e=>e.neutralPalette,tone:e=>0})}surfaceTint(){return c.fromPalette({name:"surface_tint",palette:e=>e.primaryPalette,tone:e=>e.isDark?80:40,isBackground:!0})}primary(){return c.fromPalette({name:"primary",palette:e=>e.primaryPalette,tone:e=>A(e)?e.isDark?100:0:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(3,4.5,7,7),toneDeltaPair:e=>new w(this.primaryContainer(),this.primary(),10,"nearer",!1)})}primaryDim(){}onPrimary(){return c.fromPalette({name:"on_primary",palette:e=>e.primaryPalette,tone:e=>A(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.primary(),contrastCurve:e=>new y(4.5,7,11,21)})}primaryContainer(){return c.fromPalette({name:"primary_container",palette:e=>e.primaryPalette,tone:e=>ue(e)?e.sourceColorHct.tone:A(e)?e.isDark?85:25:e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.primaryContainer(),this.primary(),10,"nearer",!1)})}onPrimaryContainer(){return c.fromPalette({name:"on_primary_container",palette:e=>e.primaryPalette,tone:e=>ue(e)?c.foregroundTone(this.primaryContainer().tone(e),4.5):A(e)?e.isDark?0:100:e.isDark?90:30,background:e=>this.primaryContainer(),contrastCurve:e=>new y(3,4.5,7,11)})}inversePrimary(){return c.fromPalette({name:"inverse_primary",palette:e=>e.primaryPalette,tone:e=>e.isDark?40:80,background:e=>this.inverseSurface(),contrastCurve:e=>new y(3,4.5,7,7)})}secondary(){return c.fromPalette({name:"secondary",palette:e=>e.secondaryPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(3,4.5,7,7),toneDeltaPair:e=>new w(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}secondaryDim(){}onSecondary(){return c.fromPalette({name:"on_secondary",palette:e=>e.secondaryPalette,tone:e=>A(e)?e.isDark?10:100:e.isDark?20:100,background:e=>this.secondary(),contrastCurve:e=>new y(4.5,7,11,21)})}secondaryContainer(){return c.fromPalette({name:"secondary_container",palette:e=>e.secondaryPalette,tone:e=>{const t=e.isDark?30:90;return A(e)?e.isDark?30:85:ue(e)?Ot(e.secondaryPalette.hue,e.secondaryPalette.chroma,t,!e.isDark):t},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.secondaryContainer(),this.secondary(),10,"nearer",!1)})}onSecondaryContainer(){return c.fromPalette({name:"on_secondary_container",palette:e=>e.secondaryPalette,tone:e=>A(e)?e.isDark?90:10:ue(e)?c.foregroundTone(this.secondaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.secondaryContainer(),contrastCurve:e=>new y(3,4.5,7,11)})}tertiary(){return c.fromPalette({name:"tertiary",palette:e=>e.tertiaryPalette,tone:e=>A(e)?e.isDark?90:25:e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(3,4.5,7,7),toneDeltaPair:e=>new w(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}tertiaryDim(){}onTertiary(){return c.fromPalette({name:"on_tertiary",palette:e=>e.tertiaryPalette,tone:e=>A(e)?e.isDark?10:90:e.isDark?20:100,background:e=>this.tertiary(),contrastCurve:e=>new y(4.5,7,11,21)})}tertiaryContainer(){return c.fromPalette({name:"tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>{if(A(e))return e.isDark?60:49;if(!ue(e))return e.isDark?30:90;const t=e.tertiaryPalette.getHct(e.sourceColorHct.tone);return He.fixIfDisliked(t).tone},isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.tertiaryContainer(),this.tertiary(),10,"nearer",!1)})}onTertiaryContainer(){return c.fromPalette({name:"on_tertiary_container",palette:e=>e.tertiaryPalette,tone:e=>A(e)?e.isDark?0:100:ue(e)?c.foregroundTone(this.tertiaryContainer().tone(e),4.5):e.isDark?90:30,background:e=>this.tertiaryContainer(),contrastCurve:e=>new y(3,4.5,7,11)})}error(){return c.fromPalette({name:"error",palette:e=>e.errorPalette,tone:e=>e.isDark?80:40,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(3,4.5,7,7),toneDeltaPair:e=>new w(this.errorContainer(),this.error(),10,"nearer",!1)})}errorDim(){}onError(){return c.fromPalette({name:"on_error",palette:e=>e.errorPalette,tone:e=>e.isDark?20:100,background:e=>this.error(),contrastCurve:e=>new y(4.5,7,11,21)})}errorContainer(){return c.fromPalette({name:"error_container",palette:e=>e.errorPalette,tone:e=>e.isDark?30:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.errorContainer(),this.error(),10,"nearer",!1)})}onErrorContainer(){return c.fromPalette({name:"on_error_container",palette:e=>e.errorPalette,tone:e=>A(e)?e.isDark?90:10:e.isDark?90:30,background:e=>this.errorContainer(),contrastCurve:e=>new y(3,4.5,7,11)})}primaryFixed(){return c.fromPalette({name:"primary_fixed",palette:e=>e.primaryPalette,tone:e=>A(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}primaryFixedDim(){return c.fromPalette({name:"primary_fixed_dim",palette:e=>e.primaryPalette,tone:e=>A(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.primaryFixed(),this.primaryFixedDim(),10,"lighter",!0)})}onPrimaryFixed(){return c.fromPalette({name:"on_primary_fixed",palette:e=>e.primaryPalette,tone:e=>A(e)?100:10,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new y(4.5,7,11,21)})}onPrimaryFixedVariant(){return c.fromPalette({name:"on_primary_fixed_variant",palette:e=>e.primaryPalette,tone:e=>A(e)?90:30,background:e=>this.primaryFixedDim(),secondBackground:e=>this.primaryFixed(),contrastCurve:e=>new y(3,4.5,7,11)})}secondaryFixed(){return c.fromPalette({name:"secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>A(e)?80:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}secondaryFixedDim(){return c.fromPalette({name:"secondary_fixed_dim",palette:e=>e.secondaryPalette,tone:e=>A(e)?70:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.secondaryFixed(),this.secondaryFixedDim(),10,"lighter",!0)})}onSecondaryFixed(){return c.fromPalette({name:"on_secondary_fixed",palette:e=>e.secondaryPalette,tone:e=>10,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new y(4.5,7,11,21)})}onSecondaryFixedVariant(){return c.fromPalette({name:"on_secondary_fixed_variant",palette:e=>e.secondaryPalette,tone:e=>A(e)?25:30,background:e=>this.secondaryFixedDim(),secondBackground:e=>this.secondaryFixed(),contrastCurve:e=>new y(3,4.5,7,11)})}tertiaryFixed(){return c.fromPalette({name:"tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>A(e)?40:90,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}tertiaryFixedDim(){return c.fromPalette({name:"tertiary_fixed_dim",palette:e=>e.tertiaryPalette,tone:e=>A(e)?30:80,isBackground:!0,background:e=>this.highestSurface(e),contrastCurve:e=>new y(1,1,3,4.5),toneDeltaPair:e=>new w(this.tertiaryFixed(),this.tertiaryFixedDim(),10,"lighter",!0)})}onTertiaryFixed(){return c.fromPalette({name:"on_tertiary_fixed",palette:e=>e.tertiaryPalette,tone:e=>A(e)?100:10,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new y(4.5,7,11,21)})}onTertiaryFixedVariant(){return c.fromPalette({name:"on_tertiary_fixed_variant",palette:e=>e.tertiaryPalette,tone:e=>A(e)?90:30,background:e=>this.tertiaryFixedDim(),secondBackground:e=>this.tertiaryFixed(),contrastCurve:e=>new y(3,4.5,7,11)})}highestSurface(e){return e.isDark?this.surfaceBright():this.surfaceDim()}}/**
|
|
227
|
-
* @license
|
|
228
|
-
* Copyright 2025 Google LLC
|
|
229
|
-
*
|
|
230
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
231
|
-
* you may not use this file except in compliance with the License.
|
|
232
|
-
* You may obtain a copy of the License at
|
|
233
|
-
*
|
|
234
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
-
*
|
|
236
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
237
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
238
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
239
|
-
* See the License for the specific language governing permissions and
|
|
240
|
-
* limitations under the License.
|
|
241
|
-
*/function D(r,e=0,t=100,n=1){let a=ct(r.hue,r.chroma*n,100,!0);return U(e,t,a)}function ne(r,e=0,t=100){let n=ct(r.hue,r.chroma,0,!1);return U(e,t,n)}function ct(r,e,t,n){let a=t,o=C.from(r,e,a);for(;o.chroma<e&&!(t<0||t>100);){t+=n?-1:1;const i=C.from(r,e,t);o.chroma<i.chroma&&(o=i,a=t)}return a}function b(r){return r===1.5?new y(1.5,1.5,3,5.5):r===3?new y(3,3,4.5,7):r===4.5?new y(4.5,4.5,7,11):r===6?new y(6,6,7,11):r===7?new y(7,7,11,21):r===9?new y(9,9,11,21):r===11?new y(11,11,21,21):r===21?new y(21,21,21,21):new y(r,r,7,21)}class Vt extends Rt{surface(){const e=c.fromPalette({name:"surface",palette:t=>t.neutralPalette,tone:t=>(super.surface().tone(t),t.platform==="phone"?t.isDark?4:C.isYellow(t.neutralPalette.hue)?99:t.variant===d.VIBRANT?97:98:0),isBackground:!0});return T(super.surface(),"2025",e)}surfaceDim(){const e=c.fromPalette({name:"surface_dim",palette:t=>t.neutralPalette,tone:t=>t.isDark?4:C.isYellow(t.neutralPalette.hue)?90:t.variant===d.VIBRANT?85:87,isBackground:!0,chromaMultiplier:t=>{if(!t.isDark){if(t.variant===d.NEUTRAL)return 2.5;if(t.variant===d.TONAL_SPOT)return 1.7;if(t.variant===d.EXPRESSIVE)return C.isYellow(t.neutralPalette.hue)?2.7:1.75;if(t.variant===d.VIBRANT)return 1.36}return 1}});return T(super.surfaceDim(),"2025",e)}surfaceBright(){const e=c.fromPalette({name:"surface_bright",palette:t=>t.neutralPalette,tone:t=>t.isDark?18:C.isYellow(t.neutralPalette.hue)?99:t.variant===d.VIBRANT?97:98,isBackground:!0,chromaMultiplier:t=>{if(t.isDark){if(t.variant===d.NEUTRAL)return 2.5;if(t.variant===d.TONAL_SPOT)return 1.7;if(t.variant===d.EXPRESSIVE)return C.isYellow(t.neutralPalette.hue)?2.7:1.75;if(t.variant===d.VIBRANT)return 1.36}return 1}});return T(super.surfaceBright(),"2025",e)}surfaceContainerLowest(){const e=c.fromPalette({name:"surface_container_lowest",palette:t=>t.neutralPalette,tone:t=>t.isDark?0:100,isBackground:!0});return T(super.surfaceContainerLowest(),"2025",e)}surfaceContainerLow(){const e=c.fromPalette({name:"surface_container_low",palette:t=>t.neutralPalette,tone:t=>t.platform==="phone"?t.isDark?6:C.isYellow(t.neutralPalette.hue)?98:t.variant===d.VIBRANT?95:96:15,isBackground:!0,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 1.3;if(t.variant===d.TONAL_SPOT)return 1.25;if(t.variant===d.EXPRESSIVE)return C.isYellow(t.neutralPalette.hue)?1.3:1.15;if(t.variant===d.VIBRANT)return 1.08}return 1}});return T(super.surfaceContainerLow(),"2025",e)}surfaceContainer(){const e=c.fromPalette({name:"surface_container",palette:t=>t.neutralPalette,tone:t=>t.platform==="phone"?t.isDark?9:C.isYellow(t.neutralPalette.hue)?96:t.variant===d.VIBRANT?92:94:20,isBackground:!0,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 1.6;if(t.variant===d.TONAL_SPOT)return 1.4;if(t.variant===d.EXPRESSIVE)return C.isYellow(t.neutralPalette.hue)?1.6:1.3;if(t.variant===d.VIBRANT)return 1.15}return 1}});return T(super.surfaceContainer(),"2025",e)}surfaceContainerHigh(){const e=c.fromPalette({name:"surface_container_high",palette:t=>t.neutralPalette,tone:t=>t.platform==="phone"?t.isDark?12:C.isYellow(t.neutralPalette.hue)?94:t.variant===d.VIBRANT?90:92:25,isBackground:!0,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 1.9;if(t.variant===d.TONAL_SPOT)return 1.5;if(t.variant===d.EXPRESSIVE)return C.isYellow(t.neutralPalette.hue)?1.95:1.45;if(t.variant===d.VIBRANT)return 1.22}return 1}});return T(super.surfaceContainerHigh(),"2025",e)}surfaceContainerHighest(){const e=c.fromPalette({name:"surface_container_highest",palette:t=>t.neutralPalette,tone:t=>t.isDark?15:C.isYellow(t.neutralPalette.hue)?92:t.variant===d.VIBRANT?88:90,isBackground:!0,chromaMultiplier:t=>t.variant===d.NEUTRAL?2.2:t.variant===d.TONAL_SPOT?1.7:t.variant===d.EXPRESSIVE?C.isYellow(t.neutralPalette.hue)?2.3:1.6:t.variant===d.VIBRANT?1.29:1});return T(super.surfaceContainerHighest(),"2025",e)}onSurface(){const e=c.fromPalette({name:"on_surface",palette:t=>t.neutralPalette,tone:t=>t.variant===d.VIBRANT?D(t.neutralPalette,0,100,1.1):c.getInitialToneFromBackground(n=>n.platform==="phone"?this.highestSurface(n):this.surfaceContainerHigh())(t),chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 2.2;if(t.variant===d.TONAL_SPOT)return 1.7;if(t.variant===d.EXPRESSIVE)return C.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"?b(11):b(9)});return T(super.onSurface(),"2025",e)}onSurfaceVariant(){const e=c.fromPalette({name:"on_surface_variant",palette:t=>t.neutralPalette,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 2.2;if(t.variant===d.TONAL_SPOT)return 1.7;if(t.variant===d.EXPRESSIVE)return C.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?b(6):b(4.5):b(7)});return T(super.onSurfaceVariant(),"2025",e)}outline(){const e=c.fromPalette({name:"outline",palette:t=>t.neutralPalette,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 2.2;if(t.variant===d.TONAL_SPOT)return 1.7;if(t.variant===d.EXPRESSIVE)return C.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"?b(3):b(4.5)});return T(super.outline(),"2025",e)}outlineVariant(){const e=c.fromPalette({name:"outline_variant",palette:t=>t.neutralPalette,chromaMultiplier:t=>{if(t.platform==="phone"){if(t.variant===d.NEUTRAL)return 2.2;if(t.variant===d.TONAL_SPOT)return 1.7;if(t.variant===d.EXPRESSIVE)return C.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"?b(1.5):b(3)});return T(super.outlineVariant(),"2025",e)}inverseSurface(){const e=c.fromPalette({name:"inverse_surface",palette:t=>t.neutralPalette,tone:t=>t.isDark?98:4,isBackground:!0});return T(super.inverseSurface(),"2025",e)}inverseOnSurface(){const e=c.fromPalette({name:"inverse_on_surface",palette:t=>t.neutralPalette,background:t=>this.inverseSurface(),contrastCurve:t=>b(7)});return T(super.inverseOnSurface(),"2025",e)}primary(){const e=c.fromPalette({name:"primary",palette:t=>t.primaryPalette,tone:t=>t.variant===d.NEUTRAL?t.platform==="phone"?t.isDark?80:40:90:t.variant===d.TONAL_SPOT?t.platform==="phone"?t.isDark?80:D(t.primaryPalette):D(t.primaryPalette,0,90):t.variant===d.EXPRESSIVE?t.platform==="phone"?D(t.primaryPalette,0,C.isYellow(t.primaryPalette.hue)?25:C.isCyan(t.primaryPalette.hue)?88:98):D(t.primaryPalette):t.platform==="phone"?D(t.primaryPalette,0,C.isCyan(t.primaryPalette.hue)?88:98):D(t.primaryPalette),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?b(4.5):b(7),toneDeltaPair:t=>t.platform==="phone"?new w(this.primaryContainer(),this.primary(),5,"relative_lighter",!0,"farther"):void 0});return T(super.primary(),"2025",e)}primaryDim(){return c.fromPalette({name:"primary_dim",palette:e=>e.primaryPalette,tone:e=>e.variant===d.NEUTRAL?85:e.variant===d.TONAL_SPOT?D(e.primaryPalette,0,90):D(e.primaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>b(4.5),toneDeltaPair:e=>new w(this.primaryDim(),this.primary(),5,"darker",!0,"farther")})}onPrimary(){const e=c.fromPalette({name:"on_primary",palette:t=>t.primaryPalette,background:t=>t.platform==="phone"?this.primary():this.primaryDim(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onPrimary(),"2025",e)}primaryContainer(){const e=c.fromPalette({name:"primary_container",palette:t=>t.primaryPalette,tone:t=>t.platform==="watch"?30:t.variant===d.NEUTRAL?t.isDark?30:90:t.variant===d.TONAL_SPOT?t.isDark?ne(t.primaryPalette,35,93):D(t.primaryPalette,0,90):t.variant===d.EXPRESSIVE?t.isDark?D(t.primaryPalette,30,93):D(t.primaryPalette,78,C.isCyan(t.primaryPalette.hue)?88:90):t.isDark?ne(t.primaryPalette,66,93):D(t.primaryPalette,66,C.isCyan(t.primaryPalette.hue)?88:93),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,toneDeltaPair:t=>t.platform==="phone"?void 0:new w(this.primaryContainer(),this.primaryDim(),10,"darker",!0,"farther"),contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.primaryContainer(),"2025",e)}onPrimaryContainer(){const e=c.fromPalette({name:"on_primary_container",palette:t=>t.primaryPalette,background:t=>this.primaryContainer(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onPrimaryContainer(),"2025",e)}primaryFixed(){const e=c.fromPalette({name:"primary_fixed",palette:t=>t.primaryPalette,tone:t=>{let n=Object.assign({},t,{isDark:!1,contrastLevel:0});return this.primaryContainer().getTone(n)},isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.primaryFixed(),"2025",e)}primaryFixedDim(){const e=c.fromPalette({name:"primary_fixed_dim",palette:t=>t.primaryPalette,tone:t=>this.primaryFixed().getTone(t),isBackground:!0,toneDeltaPair:t=>new w(this.primaryFixedDim(),this.primaryFixed(),5,"darker",!0,"exact")});return T(super.primaryFixedDim(),"2025",e)}onPrimaryFixed(){const e=c.fromPalette({name:"on_primary_fixed",palette:t=>t.primaryPalette,background:t=>this.primaryFixedDim(),contrastCurve:t=>b(7)});return T(super.onPrimaryFixed(),"2025",e)}onPrimaryFixedVariant(){const e=c.fromPalette({name:"on_primary_fixed_variant",palette:t=>t.primaryPalette,background:t=>this.primaryFixedDim(),contrastCurve:t=>b(4.5)});return T(super.onPrimaryFixedVariant(),"2025",e)}inversePrimary(){const e=c.fromPalette({name:"inverse_primary",palette:t=>t.primaryPalette,tone:t=>D(t.primaryPalette),background:t=>this.inverseSurface(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.inversePrimary(),"2025",e)}secondary(){const e=c.fromPalette({name:"secondary",palette:t=>t.secondaryPalette,tone:t=>t.platform==="watch"?t.variant===d.NEUTRAL?90:D(t.secondaryPalette,0,90):t.variant===d.NEUTRAL?t.isDark?ne(t.secondaryPalette,0,98):D(t.secondaryPalette):t.variant===d.VIBRANT?D(t.secondaryPalette,0,t.isDark?90:98):t.isDark?80:D(t.secondaryPalette),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?b(4.5):b(7),toneDeltaPair:t=>t.platform==="phone"?new w(this.secondaryContainer(),this.secondary(),5,"relative_lighter",!0,"farther"):void 0});return T(super.secondary(),"2025",e)}secondaryDim(){return c.fromPalette({name:"secondary_dim",palette:e=>e.secondaryPalette,tone:e=>e.variant===d.NEUTRAL?85:D(e.secondaryPalette,0,90),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>b(4.5),toneDeltaPair:e=>new w(this.secondaryDim(),this.secondary(),5,"darker",!0,"farther")})}onSecondary(){const e=c.fromPalette({name:"on_secondary",palette:t=>t.secondaryPalette,background:t=>t.platform==="phone"?this.secondary():this.secondaryDim(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onSecondary(),"2025",e)}secondaryContainer(){const e=c.fromPalette({name:"secondary_container",palette:t=>t.secondaryPalette,tone:t=>t.platform==="watch"?30:t.variant===d.VIBRANT?t.isDark?ne(t.secondaryPalette,30,40):D(t.secondaryPalette,84,90):t.variant===d.EXPRESSIVE?t.isDark?15:D(t.secondaryPalette,90,95):t.isDark?25:90,isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,toneDeltaPair:t=>t.platform==="watch"?new w(this.secondaryContainer(),this.secondaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.secondaryContainer(),"2025",e)}onSecondaryContainer(){const e=c.fromPalette({name:"on_secondary_container",palette:t=>t.secondaryPalette,background:t=>this.secondaryContainer(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onSecondaryContainer(),"2025",e)}secondaryFixed(){const e=c.fromPalette({name:"secondary_fixed",palette:t=>t.secondaryPalette,tone:t=>{let n=Object.assign({},t,{isDark:!1,contrastLevel:0});return this.secondaryContainer().getTone(n)},isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.secondaryFixed(),"2025",e)}secondaryFixedDim(){const e=c.fromPalette({name:"secondary_fixed_dim",palette:t=>t.secondaryPalette,tone:t=>this.secondaryFixed().getTone(t),isBackground:!0,toneDeltaPair:t=>new w(this.secondaryFixedDim(),this.secondaryFixed(),5,"darker",!0,"exact")});return T(super.secondaryFixedDim(),"2025",e)}onSecondaryFixed(){const e=c.fromPalette({name:"on_secondary_fixed",palette:t=>t.secondaryPalette,background:t=>this.secondaryFixedDim(),contrastCurve:t=>b(7)});return T(super.onSecondaryFixed(),"2025",e)}onSecondaryFixedVariant(){const e=c.fromPalette({name:"on_secondary_fixed_variant",palette:t=>t.secondaryPalette,background:t=>this.secondaryFixedDim(),contrastCurve:t=>b(4.5)});return T(super.onSecondaryFixedVariant(),"2025",e)}tertiary(){const e=c.fromPalette({name:"tertiary",palette:t=>t.tertiaryPalette,tone:t=>t.platform==="watch"?t.variant===d.TONAL_SPOT?D(t.tertiaryPalette,0,90):D(t.tertiaryPalette):t.variant===d.EXPRESSIVE||t.variant===d.VIBRANT?D(t.tertiaryPalette,0,C.isCyan(t.tertiaryPalette.hue)?88:t.isDark?98:100):t.isDark?D(t.tertiaryPalette,0,98):D(t.tertiaryPalette),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?b(4.5):b(7),toneDeltaPair:t=>t.platform==="phone"?new w(this.tertiaryContainer(),this.tertiary(),5,"relative_lighter",!0,"farther"):void 0});return T(super.tertiary(),"2025",e)}tertiaryDim(){return c.fromPalette({name:"tertiary_dim",palette:e=>e.tertiaryPalette,tone:e=>e.variant===d.TONAL_SPOT?D(e.tertiaryPalette,0,90):D(e.tertiaryPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>b(4.5),toneDeltaPair:e=>new w(this.tertiaryDim(),this.tertiary(),5,"darker",!0,"farther")})}onTertiary(){const e=c.fromPalette({name:"on_tertiary",palette:t=>t.tertiaryPalette,background:t=>t.platform==="phone"?this.tertiary():this.tertiaryDim(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onTertiary(),"2025",e)}tertiaryContainer(){const e=c.fromPalette({name:"tertiary_container",palette:t=>t.tertiaryPalette,tone:t=>t.platform==="watch"?t.variant===d.TONAL_SPOT?D(t.tertiaryPalette,0,90):D(t.tertiaryPalette):t.variant===d.NEUTRAL?t.isDark?D(t.tertiaryPalette,0,93):D(t.tertiaryPalette,0,96):t.variant===d.TONAL_SPOT?D(t.tertiaryPalette,0,t.isDark?93:100):t.variant===d.EXPRESSIVE?D(t.tertiaryPalette,75,C.isCyan(t.tertiaryPalette.hue)?88:t.isDark?93:100):t.isDark?D(t.tertiaryPalette,0,93):D(t.tertiaryPalette,72,100),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,toneDeltaPair:t=>t.platform==="watch"?new w(this.tertiaryContainer(),this.tertiaryDim(),10,"darker",!0,"farther"):void 0,contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.tertiaryContainer(),"2025",e)}onTertiaryContainer(){const e=c.fromPalette({name:"on_tertiary_container",palette:t=>t.tertiaryPalette,background:t=>this.tertiaryContainer(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onTertiaryContainer(),"2025",e)}tertiaryFixed(){const e=c.fromPalette({name:"tertiary_fixed",palette:t=>t.tertiaryPalette,tone:t=>{let n=Object.assign({},t,{isDark:!1,contrastLevel:0});return this.tertiaryContainer().getTone(n)},isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.tertiaryFixed(),"2025",e)}tertiaryFixedDim(){const e=c.fromPalette({name:"tertiary_fixed_dim",palette:t=>t.tertiaryPalette,tone:t=>this.tertiaryFixed().getTone(t),isBackground:!0,toneDeltaPair:t=>new w(this.tertiaryFixedDim(),this.tertiaryFixed(),5,"darker",!0,"exact")});return T(super.tertiaryFixedDim(),"2025",e)}onTertiaryFixed(){const e=c.fromPalette({name:"on_tertiary_fixed",palette:t=>t.tertiaryPalette,background:t=>this.tertiaryFixedDim(),contrastCurve:t=>b(7)});return T(super.onTertiaryFixed(),"2025",e)}onTertiaryFixedVariant(){const e=c.fromPalette({name:"on_tertiary_fixed_variant",palette:t=>t.tertiaryPalette,background:t=>this.tertiaryFixedDim(),contrastCurve:t=>b(4.5)});return T(super.onTertiaryFixedVariant(),"2025",e)}error(){const e=c.fromPalette({name:"error",palette:t=>t.errorPalette,tone:t=>t.platform==="phone"?t.isDark?ne(t.errorPalette,0,98):D(t.errorPalette):ne(t.errorPalette),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):this.surfaceContainerHigh(),contrastCurve:t=>t.platform==="phone"?b(4.5):b(7),toneDeltaPair:t=>t.platform==="phone"?new w(this.errorContainer(),this.error(),5,"relative_lighter",!0,"farther"):void 0});return T(super.error(),"2025",e)}errorDim(){return c.fromPalette({name:"error_dim",palette:e=>e.errorPalette,tone:e=>ne(e.errorPalette),isBackground:!0,background:e=>this.surfaceContainerHigh(),contrastCurve:e=>b(4.5),toneDeltaPair:e=>new w(this.errorDim(),this.error(),5,"darker",!0,"farther")})}onError(){const e=c.fromPalette({name:"on_error",palette:t=>t.errorPalette,background:t=>t.platform==="phone"?this.error():this.errorDim(),contrastCurve:t=>t.platform==="phone"?b(6):b(7)});return T(super.onError(),"2025",e)}errorContainer(){const e=c.fromPalette({name:"error_container",palette:t=>t.errorPalette,tone:t=>t.platform==="watch"?30:t.isDark?ne(t.errorPalette,30,93):D(t.errorPalette,0,90),isBackground:!0,background:t=>t.platform==="phone"?this.highestSurface(t):void 0,toneDeltaPair:t=>t.platform==="watch"?new w(this.errorContainer(),this.errorDim(),10,"darker",!0,"farther"):void 0,contrastCurve:t=>t.platform==="phone"&&t.contrastLevel>0?b(1.5):void 0});return T(super.errorContainer(),"2025",e)}onErrorContainer(){const e=c.fromPalette({name:"on_error_container",palette:t=>t.errorPalette,background:t=>this.errorContainer(),contrastCurve:t=>t.platform==="phone"?b(4.5):b(7)});return T(super.onErrorContainer(),"2025",e)}surfaceVariant(){const e=Object.assign(this.surfaceContainerHighest().clone(),{name:"surface_variant"});return T(super.surfaceVariant(),"2025",e)}surfaceTint(){const e=Object.assign(this.primary().clone(),{name:"surface_tint"});return T(super.surfaceTint(),"2025",e)}background(){const e=Object.assign(this.surface().clone(),{name:"background"});return T(super.background(),"2025",e)}onBackground(){const e=Object.assign(this.onSurface().clone(),{name:"on_background",tone:t=>t.platform==="watch"?100:this.onSurface().getTone(t)});return T(super.onBackground(),"2025",e)}}/**
|
|
242
|
-
* @license
|
|
243
|
-
* Copyright 2022 Google LLC
|
|
244
|
-
*
|
|
245
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
246
|
-
* you may not use this file except in compliance with the License.
|
|
247
|
-
* You may obtain a copy of the License at
|
|
248
|
-
*
|
|
249
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
250
|
-
*
|
|
251
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
252
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
253
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
254
|
-
* See the License for the specific language governing permissions and
|
|
255
|
-
* limitations under the License.
|
|
256
|
-
*/class s{constructor(){this.allColors=[this.background(),this.onBackground(),this.surface(),this.surfaceDim(),this.surfaceBright(),this.surfaceContainerLowest(),this.surfaceContainerLow(),this.surfaceContainer(),this.surfaceContainerHigh(),this.surfaceContainerHighest(),this.onSurface(),this.onSurfaceVariant(),this.outline(),this.outlineVariant(),this.inverseSurface(),this.inverseOnSurface(),this.primary(),this.primaryDim(),this.onPrimary(),this.primaryContainer(),this.onPrimaryContainer(),this.primaryFixed(),this.primaryFixedDim(),this.onPrimaryFixed(),this.onPrimaryFixedVariant(),this.inversePrimary(),this.secondary(),this.secondaryDim(),this.onSecondary(),this.secondaryContainer(),this.onSecondaryContainer(),this.secondaryFixed(),this.secondaryFixedDim(),this.onSecondaryFixed(),this.onSecondaryFixedVariant(),this.tertiary(),this.tertiaryDim(),this.onTertiary(),this.tertiaryContainer(),this.onTertiaryContainer(),this.tertiaryFixed(),this.tertiaryFixedDim(),this.onTertiaryFixed(),this.onTertiaryFixedVariant(),this.error(),this.errorDim(),this.onError(),this.errorContainer(),this.onErrorContainer()].filter(e=>e!==void 0)}highestSurface(e){return s.colorSpec.highestSurface(e)}primaryPaletteKeyColor(){return s.colorSpec.primaryPaletteKeyColor()}secondaryPaletteKeyColor(){return s.colorSpec.secondaryPaletteKeyColor()}tertiaryPaletteKeyColor(){return s.colorSpec.tertiaryPaletteKeyColor()}neutralPaletteKeyColor(){return s.colorSpec.neutralPaletteKeyColor()}neutralVariantPaletteKeyColor(){return s.colorSpec.neutralVariantPaletteKeyColor()}errorPaletteKeyColor(){return s.colorSpec.errorPaletteKeyColor()}background(){return s.colorSpec.background()}onBackground(){return s.colorSpec.onBackground()}surface(){return s.colorSpec.surface()}surfaceDim(){return s.colorSpec.surfaceDim()}surfaceBright(){return s.colorSpec.surfaceBright()}surfaceContainerLowest(){return s.colorSpec.surfaceContainerLowest()}surfaceContainerLow(){return s.colorSpec.surfaceContainerLow()}surfaceContainer(){return s.colorSpec.surfaceContainer()}surfaceContainerHigh(){return s.colorSpec.surfaceContainerHigh()}surfaceContainerHighest(){return s.colorSpec.surfaceContainerHighest()}onSurface(){return s.colorSpec.onSurface()}surfaceVariant(){return s.colorSpec.surfaceVariant()}onSurfaceVariant(){return s.colorSpec.onSurfaceVariant()}outline(){return s.colorSpec.outline()}outlineVariant(){return s.colorSpec.outlineVariant()}inverseSurface(){return s.colorSpec.inverseSurface()}inverseOnSurface(){return s.colorSpec.inverseOnSurface()}shadow(){return s.colorSpec.shadow()}scrim(){return s.colorSpec.scrim()}surfaceTint(){return s.colorSpec.surfaceTint()}primary(){return s.colorSpec.primary()}primaryDim(){return s.colorSpec.primaryDim()}onPrimary(){return s.colorSpec.onPrimary()}primaryContainer(){return s.colorSpec.primaryContainer()}onPrimaryContainer(){return s.colorSpec.onPrimaryContainer()}inversePrimary(){return s.colorSpec.inversePrimary()}primaryFixed(){return s.colorSpec.primaryFixed()}primaryFixedDim(){return s.colorSpec.primaryFixedDim()}onPrimaryFixed(){return s.colorSpec.onPrimaryFixed()}onPrimaryFixedVariant(){return s.colorSpec.onPrimaryFixedVariant()}secondary(){return s.colorSpec.secondary()}secondaryDim(){return s.colorSpec.secondaryDim()}onSecondary(){return s.colorSpec.onSecondary()}secondaryContainer(){return s.colorSpec.secondaryContainer()}onSecondaryContainer(){return s.colorSpec.onSecondaryContainer()}secondaryFixed(){return s.colorSpec.secondaryFixed()}secondaryFixedDim(){return s.colorSpec.secondaryFixedDim()}onSecondaryFixed(){return s.colorSpec.onSecondaryFixed()}onSecondaryFixedVariant(){return s.colorSpec.onSecondaryFixedVariant()}tertiary(){return s.colorSpec.tertiary()}tertiaryDim(){return s.colorSpec.tertiaryDim()}onTertiary(){return s.colorSpec.onTertiary()}tertiaryContainer(){return s.colorSpec.tertiaryContainer()}onTertiaryContainer(){return s.colorSpec.onTertiaryContainer()}tertiaryFixed(){return s.colorSpec.tertiaryFixed()}tertiaryFixedDim(){return s.colorSpec.tertiaryFixedDim()}onTertiaryFixed(){return s.colorSpec.onTertiaryFixed()}onTertiaryFixedVariant(){return s.colorSpec.onTertiaryFixedVariant()}error(){return s.colorSpec.error()}errorDim(){return s.colorSpec.errorDim()}onError(){return s.colorSpec.onError()}errorContainer(){return s.colorSpec.errorContainer()}onErrorContainer(){return s.colorSpec.onErrorContainer()}static highestSurface(e){return s.colorSpec.highestSurface(e)}}s.contentAccentToneDelta=15;s.colorSpec=new Vt;s.primaryPaletteKeyColor=s.colorSpec.primaryPaletteKeyColor();s.secondaryPaletteKeyColor=s.colorSpec.secondaryPaletteKeyColor();s.tertiaryPaletteKeyColor=s.colorSpec.tertiaryPaletteKeyColor();s.neutralPaletteKeyColor=s.colorSpec.neutralPaletteKeyColor();s.neutralVariantPaletteKeyColor=s.colorSpec.neutralVariantPaletteKeyColor();s.background=s.colorSpec.background();s.onBackground=s.colorSpec.onBackground();s.surface=s.colorSpec.surface();s.surfaceDim=s.colorSpec.surfaceDim();s.surfaceBright=s.colorSpec.surfaceBright();s.surfaceContainerLowest=s.colorSpec.surfaceContainerLowest();s.surfaceContainerLow=s.colorSpec.surfaceContainerLow();s.surfaceContainer=s.colorSpec.surfaceContainer();s.surfaceContainerHigh=s.colorSpec.surfaceContainerHigh();s.surfaceContainerHighest=s.colorSpec.surfaceContainerHighest();s.onSurface=s.colorSpec.onSurface();s.surfaceVariant=s.colorSpec.surfaceVariant();s.onSurfaceVariant=s.colorSpec.onSurfaceVariant();s.inverseSurface=s.colorSpec.inverseSurface();s.inverseOnSurface=s.colorSpec.inverseOnSurface();s.outline=s.colorSpec.outline();s.outlineVariant=s.colorSpec.outlineVariant();s.shadow=s.colorSpec.shadow();s.scrim=s.colorSpec.scrim();s.surfaceTint=s.colorSpec.surfaceTint();s.primary=s.colorSpec.primary();s.onPrimary=s.colorSpec.onPrimary();s.primaryContainer=s.colorSpec.primaryContainer();s.onPrimaryContainer=s.colorSpec.onPrimaryContainer();s.inversePrimary=s.colorSpec.inversePrimary();s.secondary=s.colorSpec.secondary();s.onSecondary=s.colorSpec.onSecondary();s.secondaryContainer=s.colorSpec.secondaryContainer();s.onSecondaryContainer=s.colorSpec.onSecondaryContainer();s.tertiary=s.colorSpec.tertiary();s.onTertiary=s.colorSpec.onTertiary();s.tertiaryContainer=s.colorSpec.tertiaryContainer();s.onTertiaryContainer=s.colorSpec.onTertiaryContainer();s.error=s.colorSpec.error();s.onError=s.colorSpec.onError();s.errorContainer=s.colorSpec.errorContainer();s.onErrorContainer=s.colorSpec.onErrorContainer();s.primaryFixed=s.colorSpec.primaryFixed();s.primaryFixedDim=s.colorSpec.primaryFixedDim();s.onPrimaryFixed=s.colorSpec.onPrimaryFixed();s.onPrimaryFixedVariant=s.colorSpec.onPrimaryFixedVariant();s.secondaryFixed=s.colorSpec.secondaryFixed();s.secondaryFixedDim=s.colorSpec.secondaryFixedDim();s.onSecondaryFixed=s.colorSpec.onSecondaryFixed();s.onSecondaryFixedVariant=s.colorSpec.onSecondaryFixedVariant();s.tertiaryFixed=s.colorSpec.tertiaryFixed();s.tertiaryFixedDim=s.colorSpec.tertiaryFixedDim();s.onTertiaryFixed=s.colorSpec.onTertiaryFixed();s.onTertiaryFixedVariant=s.colorSpec.onTertiaryFixedVariant();/**
|
|
257
|
-
* @license
|
|
258
|
-
* Copyright 2021 Google LLC
|
|
259
|
-
*
|
|
260
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
261
|
-
* you may not use this file except in compliance with the License.
|
|
262
|
-
* You may obtain a copy of the License at
|
|
263
|
-
*
|
|
264
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
265
|
-
*
|
|
266
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
267
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
268
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
269
|
-
* See the License for the specific language governing permissions and
|
|
270
|
-
* limitations under the License.
|
|
271
|
-
*/class ${static of(e){return new $(e,!1)}static contentOf(e){return new $(e,!0)}static fromColors(e){return $.createPaletteFromColors(!1,e)}static contentFromColors(e){return $.createPaletteFromColors(!0,e)}static createPaletteFromColors(e,t){const n=new $(t.primary,e);if(t.secondary){const a=new $(t.secondary,e);n.a2=a.a1}if(t.tertiary){const a=new $(t.tertiary,e);n.a3=a.a1}if(t.error){const a=new $(t.error,e);n.error=a.a1}if(t.neutral){const a=new $(t.neutral,e);n.n1=a.n1}if(t.neutralVariant){const a=new $(t.neutralVariant,e);n.n2=a.n2}return n}constructor(e,t){const n=C.fromInt(e),a=n.hue,o=n.chroma;t?(this.a1=Y.fromHueAndChroma(a,o),this.a2=Y.fromHueAndChroma(a,o/3),this.a3=Y.fromHueAndChroma(a+60,o/2),this.n1=Y.fromHueAndChroma(a,Math.min(o/12,4)),this.n2=Y.fromHueAndChroma(a,Math.min(o/6,8))):(this.a1=Y.fromHueAndChroma(a,Math.max(48,o)),this.a2=Y.fromHueAndChroma(a,16),this.a3=Y.fromHueAndChroma(a+60,24),this.n1=Y.fromHueAndChroma(a,4),this.n2=Y.fromHueAndChroma(a,8)),this.error=Y.fromHueAndChroma(25,84)}}/**
|
|
272
|
-
* @license
|
|
273
|
-
* Copyright 2021 Google LLC
|
|
274
|
-
*
|
|
275
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
276
|
-
* you may not use this file except in compliance with the License.
|
|
277
|
-
* You may obtain a copy of the License at
|
|
278
|
-
*
|
|
279
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
280
|
-
*
|
|
281
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
282
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
283
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
|
-
* See the License for the specific language governing permissions and
|
|
285
|
-
* limitations under the License.
|
|
286
|
-
*/class ee{get primary(){return this.props.primary}get onPrimary(){return this.props.onPrimary}get primaryContainer(){return this.props.primaryContainer}get onPrimaryContainer(){return this.props.onPrimaryContainer}get secondary(){return this.props.secondary}get onSecondary(){return this.props.onSecondary}get secondaryContainer(){return this.props.secondaryContainer}get onSecondaryContainer(){return this.props.onSecondaryContainer}get tertiary(){return this.props.tertiary}get onTertiary(){return this.props.onTertiary}get tertiaryContainer(){return this.props.tertiaryContainer}get onTertiaryContainer(){return this.props.onTertiaryContainer}get error(){return this.props.error}get onError(){return this.props.onError}get errorContainer(){return this.props.errorContainer}get onErrorContainer(){return this.props.onErrorContainer}get background(){return this.props.background}get onBackground(){return this.props.onBackground}get surface(){return this.props.surface}get onSurface(){return this.props.onSurface}get surfaceVariant(){return this.props.surfaceVariant}get onSurfaceVariant(){return this.props.onSurfaceVariant}get outline(){return this.props.outline}get outlineVariant(){return this.props.outlineVariant}get shadow(){return this.props.shadow}get scrim(){return this.props.scrim}get inverseSurface(){return this.props.inverseSurface}get inverseOnSurface(){return this.props.inverseOnSurface}get inversePrimary(){return this.props.inversePrimary}static light(e){return ee.lightFromCorePalette($.of(e))}static dark(e){return ee.darkFromCorePalette($.of(e))}static lightContent(e){return ee.lightFromCorePalette($.contentOf(e))}static darkContent(e){return ee.darkFromCorePalette($.contentOf(e))}static lightFromCorePalette(e){return new ee({primary:e.a1.tone(40),onPrimary:e.a1.tone(100),primaryContainer:e.a1.tone(90),onPrimaryContainer:e.a1.tone(10),secondary:e.a2.tone(40),onSecondary:e.a2.tone(100),secondaryContainer:e.a2.tone(90),onSecondaryContainer:e.a2.tone(10),tertiary:e.a3.tone(40),onTertiary:e.a3.tone(100),tertiaryContainer:e.a3.tone(90),onTertiaryContainer:e.a3.tone(10),error:e.error.tone(40),onError:e.error.tone(100),errorContainer:e.error.tone(90),onErrorContainer:e.error.tone(10),background:e.n1.tone(99),onBackground:e.n1.tone(10),surface:e.n1.tone(99),onSurface:e.n1.tone(10),surfaceVariant:e.n2.tone(90),onSurfaceVariant:e.n2.tone(30),outline:e.n2.tone(50),outlineVariant:e.n2.tone(80),shadow:e.n1.tone(0),scrim:e.n1.tone(0),inverseSurface:e.n1.tone(20),inverseOnSurface:e.n1.tone(95),inversePrimary:e.a1.tone(80)})}static darkFromCorePalette(e){return new ee({primary:e.a1.tone(80),onPrimary:e.a1.tone(20),primaryContainer:e.a1.tone(30),onPrimaryContainer:e.a1.tone(90),secondary:e.a2.tone(80),onSecondary:e.a2.tone(20),secondaryContainer:e.a2.tone(30),onSecondaryContainer:e.a2.tone(90),tertiary:e.a3.tone(80),onTertiary:e.a3.tone(20),tertiaryContainer:e.a3.tone(30),onTertiaryContainer:e.a3.tone(90),error:e.error.tone(80),onError:e.error.tone(20),errorContainer:e.error.tone(30),onErrorContainer:e.error.tone(80),background:e.n1.tone(10),onBackground:e.n1.tone(90),surface:e.n1.tone(10),onSurface:e.n1.tone(90),surfaceVariant:e.n2.tone(30),onSurfaceVariant:e.n2.tone(80),outline:e.n2.tone(60),outlineVariant:e.n2.tone(30),shadow:e.n1.tone(0),scrim:e.n1.tone(0),inverseSurface:e.n1.tone(90),inverseOnSurface:e.n1.tone(20),inversePrimary:e.a1.tone(40)})}constructor(e){this.props=e}toJSON(){return{...this.props}}}/**
|
|
287
|
-
* @license
|
|
288
|
-
* Copyright 2021 Google LLC
|
|
289
|
-
*
|
|
290
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
291
|
-
* you may not use this file except in compliance with the License.
|
|
292
|
-
* You may obtain a copy of the License at
|
|
293
|
-
*
|
|
294
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
295
|
-
*
|
|
296
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
297
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
298
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
299
|
-
* See the License for the specific language governing permissions and
|
|
300
|
-
* limitations under the License.
|
|
301
|
-
*/function N(r){const e=at(r),t=ot(r),n=it(r),a=[e.toString(16),t.toString(16),n.toString(16)];for(const[o,i]of a.entries())i.length===1&&(a[o]="0"+i);return"#"+a.join("")}function ve(r){r=r.replace("#","");const e=r.length===3,t=r.length===6,n=r.length===8;if(!e&&!t&&!n)throw new Error("unexpected hex "+r);let a=0,o=0,i=0;return e?(a=Z(r.slice(0,1).repeat(2)),o=Z(r.slice(1,2).repeat(2)),i=Z(r.slice(2,3).repeat(2))):t?(a=Z(r.slice(0,2)),o=Z(r.slice(2,4)),i=Z(r.slice(4,6))):n&&(a=Z(r.slice(2,4)),o=Z(r.slice(4,6)),i=Z(r.slice(6,8))),(255<<24|(a&255)<<16|(o&255)<<8|i&255)>>>0}function Z(r){return parseInt(r,16)}/**
|
|
302
|
-
* @license
|
|
303
|
-
* Copyright 2021 Google LLC
|
|
304
|
-
*
|
|
305
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
306
|
-
* you may not use this file except in compliance with the License.
|
|
307
|
-
* You may obtain a copy of the License at
|
|
308
|
-
*
|
|
309
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
310
|
-
*
|
|
311
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
312
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
313
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
314
|
-
* See the License for the specific language governing permissions and
|
|
315
|
-
* limitations under the License.
|
|
316
|
-
*/function oe(r,e=[]){const t=$.of(r);return{source:r,schemes:{light:ee.light(r),dark:ee.dark(r)},palettes:{primary:t.a1,secondary:t.a2,tertiary:t.a3,neutral:t.n1,neutralVariant:t.n2,error:t.error},customColors:e.map(n=>Nt(r,n))}}function Nt(r,e){let t=e.value;const n=t,a=r;e.blend&&(t=_e.harmonize(n,a));const i=$.of(t).a1;return{color:e,value:t,light:{color:i.tone(40),onColor:i.tone(100),colorContainer:i.tone(90),onColorContainer:i.tone(10)},dark:{color:i.tone(80),onColor:i.tone(20),colorContainer:i.tone(30),onColorContainer:i.tone(90)}}}function Be(r,e){const t=C.fromInt(ve(r)),n=C.from(t.hue,t.chroma,e);return N(n.toInt())}function _t(r){const e=C.fromInt(ve(r)),t=(e.hue+110)%360,n=Math.min(e.chroma*1.2,100),a=e.tone<50?65:Math.min(e.tone+10,75);return N(C.from(t,n,a).toInt())}function Ht(r){const e=_t(r);return{0:Be(e,95),25:e,50:r,75:Be(r,80),100:Be(r,20)}}function fe(r,e){const t=Ht(r);let n=`linear-gradient(${e}deg, `;for(const a of Object.keys(t))n+=`${t[a]} ${a}%, `;return n.slice(0,-2)+")"}function zt(r,e=135){const t={};return Xe(t,"source",r,e),Object.entries(Se.MaterialSeeds).forEach(([n,a])=>{Xe(t,n,a,e)}),t}function Xe(r,e,t,n){const o=oe(ve(t)).palettes.primary;for(let i=10;i<=100;i+=10){const u=N(o.tone(i));r[`${e}${i}`]=fe(u,n)}}function X(r){const e=parseInt(r.slice(1,3),16),t=parseInt(r.slice(3,5),16),n=parseInt(r.slice(5,7),16);return`${e}, ${t}, ${n}`}function Ut(r){const e={};return Ge(e,"source",r),Object.entries(Se.MaterialSeeds).forEach(([t])=>{Ge(e,t,Se.MaterialSeeds[t])}),e}function Ge(r,e,t){const a=oe(ve(t)).palettes.primary;for(let o=10;o<=100;o+=10){const i=N(a.tone(o)),u=o>=60?10:100,l=N(a.tone(u)),h=X(i),f=X(l);r[`${e}${o}`]=h,r[`on${$t(e)}${o}`]=f}}function $t(r){return r.charAt(0).toUpperCase()+r.slice(1)}var Yt={grad:.9,turn:360,rad:360/(2*Math.PI)},Q=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},_=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},K=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},ut=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Je=function(r){return{r:K(r.r,0,255),g:K(r.g,0,255),b:K(r.b,0,255),a:K(r.a)}},Ae=function(r){return{r:_(r.r),g:_(r.g),b:_(r.b),a:_(r.a,3)}},jt=/^#([0-9a-f]{3,8})$/i,be=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},lt=function(r){var e=r.r,t=r.g,n=r.b,a=r.a,o=Math.max(e,t,n),i=o-Math.min(e,t,n),u=i?o===e?(t-n)/i:o===t?2+(n-e)/i:4+(e-t)/i:0;return{h:60*(u<0?u+6:u),s:o?i/o*100:0,v:o/255*100,a}},ht=function(r){var e=r.h,t=r.s,n=r.v,a=r.a;e=e/360*6,t/=100,n/=100;var o=Math.floor(e),i=n*(1-t),u=n*(1-(e-o)*t),l=n*(1-(1-e+o)*t),h=o%6;return{r:255*[n,u,i,i,l,n][h],g:255*[l,n,n,u,i,i][h],b:255*[i,i,l,n,n,u][h],a}},We=function(r){return{h:ut(r.h),s:K(r.s,0,100),l:K(r.l,0,100),a:K(r.a)}},Ze=function(r){return{h:_(r.h),s:_(r.s),l:_(r.l),a:_(r.a,3)}},Qe=function(r){return ht((t=(e=r).s,{h:e.h,s:(t*=((n=e.l)<50?n:100-n)/100)>0?2*t/(n+t)*100:0,v:n+t,a:e.a}));var e,t,n},me=function(r){return{h:(e=lt(r)).h,s:(a=(200-(t=e.s))*(n=e.v)/100)>0&&a<200?t*n/100/(a<=100?a:200-a)*100:0,l:a/2,a:e.a};var e,t,n,a},Kt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,qt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,et={string:[[function(r){var e=jt.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?_(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?_(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=Xt.exec(r)||Gt.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Je({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(r){var e=Kt.exec(r)||qt.exec(r);if(!e)return null;var t,n,a=We({h:(t=e[1],n=e[2],n===void 0&&(n="deg"),Number(t)*(Yt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Qe(a)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,n=r.b,a=r.a,o=a===void 0?1:a;return Q(e)&&Q(t)&&Q(n)?Je({r:Number(e),g:Number(t),b:Number(n),a:Number(o)}):null},"rgb"],[function(r){var e=r.h,t=r.s,n=r.l,a=r.a,o=a===void 0?1:a;if(!Q(e)||!Q(t)||!Q(n))return null;var i=We({h:Number(e),s:Number(t),l:Number(n),a:Number(o)});return Qe(i)},"hsl"],[function(r){var e=r.h,t=r.s,n=r.v,a=r.a,o=a===void 0?1:a;if(!Q(e)||!Q(t)||!Q(n))return null;var i=function(u){return{h:ut(u.h),s:K(u.s,0,100),v:K(u.v,0,100),a:K(u.a)}}({h:Number(e),s:Number(t),v:Number(n),a:Number(o)});return ht(i)},"hsv"]]},tt=function(r,e){for(var t=0;t<e.length;t++){var n=e[t][0](r);if(n)return[n,e[t][1]]}return[null,void 0]},Jt=function(r){return typeof r=="string"?tt(r.trim(),et.string):typeof r=="object"&&r!==null?tt(r,et.object):[null,void 0]},Ie=function(r,e){var t=me(r);return{h:t.h,s:K(t.s+100*e,0,100),l:t.l,a:t.a}},Ee=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},rt=function(r,e){var t=me(r);return{h:t.h,s:t.s,l:K(t.l+100*e,0,100),a:t.a}},nt=function(){function r(e){this.parsed=Jt(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return _(Ee(this.rgba),2)},r.prototype.isDark=function(){return Ee(this.rgba)<.5},r.prototype.isLight=function(){return Ee(this.rgba)>=.5},r.prototype.toHex=function(){return e=Ae(this.rgba),t=e.r,n=e.g,a=e.b,i=(o=e.a)<1?be(_(255*o)):"","#"+be(t)+be(n)+be(a)+i;var e,t,n,a,o,i},r.prototype.toRgb=function(){return Ae(this.rgba)},r.prototype.toRgbString=function(){return e=Ae(this.rgba),t=e.r,n=e.g,a=e.b,(o=e.a)<1?"rgba("+t+", "+n+", "+a+", "+o+")":"rgb("+t+", "+n+", "+a+")";var e,t,n,a,o},r.prototype.toHsl=function(){return Ze(me(this.rgba))},r.prototype.toHslString=function(){return e=Ze(me(this.rgba)),t=e.h,n=e.s,a=e.l,(o=e.a)<1?"hsla("+t+", "+n+"%, "+a+"%, "+o+")":"hsl("+t+", "+n+"%, "+a+"%)";var e,t,n,a,o},r.prototype.toHsv=function(){return e=lt(this.rgba),{h:_(e.h),s:_(e.s),v:_(e.v),a:_(e.a,3)};var e},r.prototype.invert=function(){return G({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),G(Ie(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),G(Ie(this.rgba,-e))},r.prototype.grayscale=function(){return G(Ie(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),G(rt(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),G(rt(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?G({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):_(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=me(this.rgba);return typeof e=="number"?G({h:e,s:t.s,l:t.l,a:t.a}):_(t.h)},r.prototype.isEqual=function(e){return this.toHex()===G(e).toHex()},r}(),G=function(r){return r instanceof nt?r:new nt(r)};function se(r,e){if(typeof r=="number")return r>16777215?r:4278190080|r;const t=r.trim();if(t==="currentColor")return null;if(t.startsWith("var("))return t.slice(4,-1).trim(),null;const n=G(t);if(n.isValid()){const{r:a,g:o,b:i}=n.toRgb();return Te(a,o,i)}return null}const he="#4e51ff",ft="g-theme--material",Le="g-theme--",ze=Symbol("gradient-theme");function Wt(r){const e=se("#FFC107"),t=se("#4CAF50");if(e==null||t==null)throw new Error("Failed to normalize semantic seed color.");const n=r==="dark"?"dark":"light",a=oe(e).schemes[n].toJSON(),o=oe(t).schemes[n].toJSON();return{warning:X(N(a.primary)),onWarning:X(N(a.onPrimary)),warningContainer:X(N(a.primaryContainer)),onWarningContainer:X(N(a.onPrimaryContainer)),success:X(N(o.primary)),onSuccess:X(N(o.onPrimary)),successContainer:X(N(o.primaryContainer)),onSuccessContainer:X(N(o.onPrimaryContainer))}}function Zt(r,e){const t=Ue(r),n=se(t);if(n==null)throw new Error("Failed to normalize seed color.");const a=oe(n),o=e==="dark"?"dark":"light",i=a.schemes[o].toJSON(),u={};return Object.entries(i).forEach(([l,h])=>{const f=N(h),g=X(f);u[l]=g}),{...u,...Wt(e)}}function Qt(r){const e=Ue(r),t=se(e),n=se("#FFC107"),a=se("#4CAF50");if(t==null||n==null||a==null)throw new Error("Failed to normalize gradient seed color.");const o=oe(t),i=oe(n),u=oe(a),l=o.schemes.light.toJSON(),h=i.schemes.light.toJSON(),f=u.schemes.light.toJSON(),g=N(l.error),p=N(h.primary),v=N(f.primary);return{...zt(e,135),main:fe(e,135),error:fe(g,135),warning:fe(p,135),success:fe(v,135)}}function Ue(r){const e=se(r);return e==null?he:N(e)}function Oe(r,e){let t=`.${ft} {
|
|
317
|
-
`;for(const[a,o]of Object.entries(r))t+=` --g-${e}-${Se.camelToKebabCase(a)}: ${o};
|
|
318
|
-
`;t+="}";let n=document.getElementById(`g-${e}-style`);return n||(n=document.createElement("style"),n.id=`g-${e}-style`,document.head.appendChild(n)),n.textContent=t,n}function er(r=he){return De(r,"light")}function tr(r=he){return De(r,"dark")}function De(r=he,e="light"){const t=document.documentElement;t.classList.add(ft),t.classList.remove(`${Le}light`,`${Le}dark`),t.classList.add(`${Le}${e}`);const n=Ue(r),a={theme:Zt(n,e),colors:Ut(n),gradient:Qt(n)};return{tokens:a,themeCSS:Oe(a.theme,"theme"),colorsCSS:Oe(a.colors,"color"),gradientCSS:Oe(a.gradient,"gradient")}}function dt(r={}){const e=de.ref(r.seed??he),t=de.ref(r.mode??"light"),n=de.shallowRef(null),a=()=>typeof window>"u"?null:(n.value=De(e.value,t.value),n.value),o=l=>(e.value=l,a()),i=l=>(t.value=l,a()),u=()=>(t.value=t.value==="dark"?"light":"dark",a());return r.autoApply!==!1&&a(),{seed:e,mode:t,result:n,apply:a,setSeed:o,setMode:i,toggleMode:u}}function rr(r=dt()){return de.provide(ze,r),r}function nr(r,e){r.provide(ze,e)}function ar(){return de.inject(ze,null)}exports.DEFAULT_SEED=he;exports.createDefaultDarkTheme=tr;exports.createDefaultLightTheme=er;exports.createDefaultTheme=De;exports.createTheme=dt;exports.installTheme=nr;exports.provideTheme=rr;exports.useTheme=ar;
|