sitcod3 commited on
Commit
3887d38
·
verified ·
1 Parent(s): 70c8e0d

Upload folder using huggingface_hub (part 6)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. node_modules/@csstools/color-helpers/CHANGELOG.md +9 -0
  3. node_modules/@csstools/color-helpers/LICENSE.md +18 -0
  4. node_modules/@csstools/color-helpers/README.md +32 -0
  5. node_modules/@csstools/color-helpers/dist/index.d.ts +711 -0
  6. node_modules/@csstools/color-helpers/dist/index.mjs +261 -0
  7. node_modules/@csstools/color-helpers/package.json +55 -0
  8. node_modules/@csstools/css-calc/CHANGELOG.md +10 -0
  9. node_modules/@csstools/css-calc/LICENSE.md +20 -0
  10. node_modules/@csstools/css-calc/README.md +132 -0
  11. node_modules/@csstools/css-calc/dist/index.d.ts +106 -0
  12. node_modules/@csstools/css-calc/dist/index.mjs +1 -0
  13. node_modules/@csstools/css-calc/package.json +59 -0
  14. node_modules/@csstools/css-color-parser/CHANGELOG.md +11 -0
  15. node_modules/@csstools/css-color-parser/LICENSE.md +20 -0
  16. node_modules/@csstools/css-color-parser/README.md +37 -0
  17. node_modules/@csstools/css-color-parser/dist/index.d.ts +170 -0
  18. node_modules/@csstools/css-color-parser/dist/index.mjs +1 -0
  19. node_modules/@csstools/css-color-parser/package.json +64 -0
  20. node_modules/@csstools/css-parser-algorithms/CHANGELOG.md +11 -0
  21. node_modules/@csstools/css-parser-algorithms/LICENSE.md +20 -0
  22. node_modules/@csstools/css-parser-algorithms/README.md +119 -0
  23. node_modules/@csstools/css-parser-algorithms/dist/index.d.ts +604 -0
  24. node_modules/@csstools/css-parser-algorithms/dist/index.mjs +1 -0
  25. node_modules/@csstools/css-parser-algorithms/package.json +58 -0
  26. node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md +9 -0
  27. node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md +18 -0
  28. node_modules/@csstools/css-syntax-patches-for-csstree/README.md +43 -0
  29. node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts +5 -0
  30. node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json +802 -0
  31. node_modules/@csstools/css-syntax-patches-for-csstree/package.json +56 -0
  32. node_modules/@csstools/css-tokenizer/CHANGELOG.md +10 -0
  33. node_modules/@csstools/css-tokenizer/LICENSE.md +20 -0
  34. node_modules/@csstools/css-tokenizer/README.md +111 -0
  35. node_modules/@csstools/css-tokenizer/dist/index.d.ts +593 -0
  36. node_modules/@csstools/css-tokenizer/dist/index.mjs +1 -0
  37. node_modules/@csstools/css-tokenizer/package.json +55 -0
  38. node_modules/@esbuild/win32-x64/README.md +3 -0
  39. node_modules/@esbuild/win32-x64/esbuild.exe +3 -0
  40. node_modules/@esbuild/win32-x64/package.json +20 -0
  41. node_modules/@exodus/bytes/LICENSE +21 -0
  42. node_modules/@exodus/bytes/README.md +818 -0
  43. node_modules/@exodus/bytes/array.d.ts +89 -0
  44. node_modules/@exodus/bytes/array.js +35 -0
  45. node_modules/@exodus/bytes/assert.js +26 -0
  46. node_modules/@exodus/bytes/base32.d.ts +112 -0
  47. node_modules/@exodus/bytes/base32.js +37 -0
  48. node_modules/@exodus/bytes/base58.d.ts +64 -0
  49. node_modules/@exodus/bytes/base58.js +219 -0
  50. node_modules/@exodus/bytes/base58check.d.ts +135 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ node_modules/@esbuild/win32-x64/esbuild.exe filter=lfs diff=lfs merge=lfs -text
node_modules/@csstools/color-helpers/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Changes to Color Helpers
2
+
3
+ ### 6.1.1
4
+
5
+ _August 15, 2026_
6
+
7
+ - Updated: gamut mapping algorithm
8
+
9
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md)
node_modules/@csstools/color-helpers/LICENSE.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT No Attribution (MIT-0)
2
+
3
+ Copyright © CSSTools Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so.
11
+
12
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
node_modules/@csstools/color-helpers/README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Color Helpers <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
2
+
3
+ [<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/color-helpers.svg" height="20">][npm-url]
4
+ [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
5
+ [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
6
+
7
+ ## Usage
8
+
9
+ Add [Color Helpers] to your project:
10
+
11
+ ```bash
12
+ npm install @csstools/color-helpers --save-dev
13
+ ```
14
+
15
+ This package exists to join all the different color functions scattered among the Colors 4 and Colors 5 plugins we maintain such as:
16
+
17
+ * [PostCSS Color Function]
18
+ * [PostCSS Lab Function]
19
+ * [PostCSS OKLab Function]
20
+
21
+ ## Copyright
22
+
23
+ This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/tree/main/css-color-4. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
24
+
25
+ [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
26
+ [discord]: https://discord.gg/bUadyRwkJS
27
+ [npm-url]: https://www.npmjs.com/package/@csstools/color-helpers
28
+
29
+ [Color Helpers]: https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers
30
+ [PostCSS Color Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-color-function
31
+ [PostCSS Lab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-lab-functionw
32
+ [PostCSS OKLab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-oklab-function
node_modules/@csstools/color-helpers/dist/index.d.ts ADDED
@@ -0,0 +1,711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @param {Color} color [r, g, b]
3
+ * - Red as number 0..1;
4
+ * - Green as number 0..1;
5
+ * - Blue as number 0..1;
6
+ * @return {Color} D50 XYZ [x, y, z]
7
+ */
8
+ export declare function a98_RGB_to_XYZ_D50(x: Color): Color;
9
+
10
+ /**
11
+ * @param {Color} color [r, g, b]
12
+ * - Red as number 0..1;
13
+ * - Green as number 0..1;
14
+ * - Blue as number 0..1;
15
+ * @return {Color} D50 XYZ [x, y, z]
16
+ */
17
+ export declare function a98_RGB_to_XYZ_D65(x: Color): Color;
18
+
19
+ export declare function clip(color: Color): Color;
20
+
21
+ export declare type Color = [number, number, number];
22
+
23
+ /**
24
+ * WCAG 2.1 contrast ratio
25
+ */
26
+ export declare function contrast_ratio_wcag_2_1(color1: Color, color2: Color): number;
27
+
28
+ /**
29
+ * Convert an array of linear-light display-p3 RGB in the range 0.0-1.0
30
+ * to gamma corrected form
31
+ *
32
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
33
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
34
+ */
35
+ export declare function gam_P3(RGB: Color): Color;
36
+
37
+ /**
38
+ * Convert an array of linear-light sRGB values in the range 0.0-1.0 to gamma corrected form
39
+ * Extended transfer function:
40
+ * For negative values, linear portion extends on reflection
41
+ * of axis, then uses reflected pow below that
42
+ *
43
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
44
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
45
+ * @see https://en.wikipedia.org/wiki/SRGB
46
+ */
47
+ export declare function gam_sRGB(RGB: Color): Color;
48
+
49
+ /**
50
+ * @param {Color} color [h, s, l]
51
+ * - Hue as degrees 0..360;
52
+ * - Saturation as number 0..100;
53
+ * - Lightness as number 0..100;
54
+ * @return {Color} D50 XYZ [x, y, z]
55
+ */
56
+ export declare function HSL_to_XYZ_D50(x: Color): Color;
57
+
58
+ /**
59
+ * @param {Color} color [h, s, l]
60
+ * - Hue as degrees 0..360;
61
+ * - Saturation as number 0..100;
62
+ * - Lightness as number 0..100;
63
+ * @return {Color} D50 XYZ [x, y, z]
64
+ */
65
+ export declare function HSL_to_XYZ_D65(x: Color): Color;
66
+
67
+ /**
68
+ * @param {Color} color [h, w, b]
69
+ * - Hue as degrees 0..360;
70
+ * - Whiteness as number 0..100;
71
+ * - Blackness as number 0..100;
72
+ * @return {Color} D50 XYZ [x, y, z]
73
+ */
74
+ export declare function HWB_to_XYZ_D50(x: Color): Color;
75
+
76
+ /**
77
+ * @param {Color} color [h, w, b]
78
+ * - Hue as degrees 0..360;
79
+ * - Whiteness as number 0..100;
80
+ * - Blackness as number 0..100;
81
+ * @return {Color} D50 XYZ [x, y, z]
82
+ */
83
+ export declare function HWB_to_XYZ_D65(x: Color): Color;
84
+
85
+ export declare function inGamut(x: Color): boolean;
86
+
87
+ /**
88
+ * @param {Color} color [l, a, b]
89
+ * - Lightness as number 0..100;
90
+ * - a as number -160..160;
91
+ * - b as number -160..160;
92
+ * @return {Color} D50 XYZ [x, y, z]
93
+ */
94
+ export declare function Lab_to_XYZ_D50(x: Color): Color;
95
+
96
+ /**
97
+ * @param {Color} color [l, a, b]
98
+ * - Lightness as number 0..100;
99
+ * - a as number -160..160;
100
+ * - b as number -160..160;
101
+ * @return {Color} D50 XYZ [x, y, z]
102
+ */
103
+ export declare function Lab_to_XYZ_D65(x: Color): Color;
104
+
105
+ /**
106
+ * @param {Color} color [l, c, h]
107
+ * - Lightness as number 0..100;
108
+ * - Chroma as number 0..230;
109
+ * - Hue as degrees 0..360;
110
+ * @return {Color} D50 XYZ [x, y, z]
111
+ */
112
+ export declare function LCH_to_XYZ_D50(x: Color): Color;
113
+
114
+ /**
115
+ * @param {Color} color [l, c, h]
116
+ * - Lightness as number 0..100;
117
+ * - Chroma as number 0..230;
118
+ * - Hue as degrees 0..360;
119
+ * @return {Color} D50 XYZ [x, y, z]
120
+ */
121
+ export declare function LCH_to_XYZ_D65(x: Color): Color;
122
+
123
+ /**
124
+ * Convert an array of display-p3 RGB values in the range 0.0 - 1.0
125
+ * to linear light (un-companded) form.
126
+ *
127
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
128
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
129
+ */
130
+ export declare function lin_P3(RGB: Color): Color;
131
+
132
+ /**
133
+ * Convert an array of linear-light display-p3 values to CIE XYZ
134
+ * using D65 (no chromatic adaptation)
135
+ *
136
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
137
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
138
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
139
+ */
140
+ export declare function lin_P3_to_XYZ(rgb: Color): Color;
141
+
142
+ /**
143
+ * @param {Color} color [r, g, b]
144
+ * - Red as number 0..1;
145
+ * - Green as number 0..1;
146
+ * - Blue as number 0..1;
147
+ * @return {Color} D50 XYZ [x, y, z]
148
+ */
149
+ export declare function lin_P3_to_XYZ_D50(x: Color): Color;
150
+
151
+ /**
152
+ * @param {Color} color [r, g, b]
153
+ * - Red as number 0..1;
154
+ * - Green as number 0..1;
155
+ * - Blue as number 0..1;
156
+ * @return {Color} D50 XYZ [x, y, z]
157
+ */
158
+ export declare function lin_P3_to_XYZ_D65(x: Color): Color;
159
+
160
+ /**
161
+ * Convert an array of of sRGB values where in-gamut values are in the range
162
+ * [0 - 1] to linear light (un-companded) form.
163
+ * Extended transfer function:
164
+ * For negative values, linear portion is extended on reflection of axis,
165
+ * then reflected power function is used.
166
+ *
167
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
168
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
169
+ * @see https://en.wikipedia.org/wiki/SRGB
170
+ */
171
+ export declare function lin_sRGB(RGB: Color): Color;
172
+
173
+ /**
174
+ * Convert an array of linear-light sRGB values to CIE XYZ
175
+ * using sRGB's own white, D65 (no chromatic adaptation)
176
+ *
177
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
178
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
179
+ */
180
+ export declare function lin_sRGB_to_XYZ(rgb: Color): Color;
181
+
182
+ /**
183
+ * @param {Color} color [r, g, b]
184
+ * - Red as number 0..1;
185
+ * - Green as number 0..1;
186
+ * - Blue as number 0..1;
187
+ * @return {Color} D50 XYZ [x, y, z]
188
+ */
189
+ export declare function lin_sRGB_to_XYZ_D50(x: Color): Color;
190
+
191
+ /**
192
+ * @param {Color} color [r, g, b]
193
+ * - Red as number 0..1;
194
+ * - Green as number 0..1;
195
+ * - Blue as number 0..1;
196
+ * @return {Color} D50 XYZ [x, y, z]
197
+ */
198
+ export declare function lin_sRGB_to_XYZ_D65(x: Color): Color;
199
+
200
+ export declare function mapGamut(startOKLCH: Color, toDestination: (x: Color) => Color, fromDestination: (x: Color) => Color): Color;
201
+
202
+ /**
203
+ * @license MIT https://github.com/facelessuser/coloraide/blob/main/LICENSE.md
204
+ */
205
+ export declare function mapGamutRayTrace(startOKLCH: Color, toLinear: (x: Color) => Color, fromLinear: (x: Color) => Color): Color;
206
+
207
+ export declare const namedColors: Record<string, Color>;
208
+
209
+ /**
210
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
211
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
212
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
213
+ */
214
+ export declare function OKLab_to_OKLCH(OKLab: Color): Color;
215
+
216
+ /**
217
+ * Given OKLab, convert to XYZ relative to D65
218
+ *
219
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
220
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
221
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
222
+ */
223
+ export declare function OKLab_to_XYZ(OKLab: Color): Color;
224
+
225
+ /**
226
+ * @param {Color} color [l, a, b]
227
+ * - Lightness as number 0..1;
228
+ * - a as number 0..0.5;
229
+ * - b as number 0..0.5;
230
+ * @return {Color} D50 XYZ [x, y, z]
231
+ */
232
+ export declare function OKLab_to_XYZ_D50(x: Color): Color;
233
+
234
+ /**
235
+ * @param {Color} color [l, a, b]
236
+ * - Lightness as number 0..1;
237
+ * - a as number 0..0.5;
238
+ * - b as number 0..0.5;
239
+ * @return {Color} D50 XYZ [x, y, z]
240
+ */
241
+ export declare function OKLab_to_XYZ_D65(x: Color): Color;
242
+
243
+ /**
244
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
245
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
246
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
247
+ */
248
+ export declare function OKLCH_to_OKLab(OKLCH: Color): Color;
249
+
250
+ /**
251
+ * @param {Color} color [l, c, h]
252
+ * - Lightness as number 0..1;
253
+ * - Chroma as number 0..0.5;
254
+ * - Hue as degrees 0..360;
255
+ * @return {Color} D50 XYZ [x, y, z]
256
+ */
257
+ export declare function OKLCH_to_XYZ_D50(x: Color): Color;
258
+
259
+ /**
260
+ * @param {Color} color [l, c, h]
261
+ * - Lightness as number 0..1;
262
+ * - Chroma as number 0..0.5;
263
+ * - Hue as degrees 0..360;
264
+ * @return {Color} D50 XYZ [x, y, z]
265
+ */
266
+ export declare function OKLCH_to_XYZ_D65(x: Color): Color;
267
+
268
+ /**
269
+ * @param {Color} color [r, g, b]
270
+ * - Red as number 0..1;
271
+ * - Green as number 0..1;
272
+ * - Blue as number 0..1;
273
+ * @return {Color} D50 XYZ [x, y, z]
274
+ */
275
+ export declare function P3_to_XYZ_D50(x: Color): Color;
276
+
277
+ /**
278
+ * @param {Color} color [r, g, b]
279
+ * - Red as number 0..1;
280
+ * - Green as number 0..1;
281
+ * - Blue as number 0..1;
282
+ * @return {Color} D50 XYZ [x, y, z]
283
+ */
284
+ export declare function P3_to_XYZ_D65(x: Color): Color;
285
+
286
+ /**
287
+ * @param {Color} color [r, g, b]
288
+ * - Red as number 0..1;
289
+ * - Green as number 0..1;
290
+ * - Blue as number 0..1;
291
+ * @return {Color} D50 XYZ [x, y, z]
292
+ */
293
+ export declare function ProPhoto_RGB_to_XYZ_D50(x: Color): Color;
294
+
295
+ /**
296
+ * @param {Color} color [r, g, b]
297
+ * - Red as number 0..1;
298
+ * - Green as number 0..1;
299
+ * - Blue as number 0..1;
300
+ * @return {Color} D50 XYZ [x, y, z]
301
+ */
302
+ export declare function ProPhoto_RGB_to_XYZ_D65(x: Color): Color;
303
+
304
+ /**
305
+ * @param {Color} color [r, g, b]
306
+ * - Red as number 0..1;
307
+ * - Green as number 0..1;
308
+ * - Blue as number 0..1;
309
+ * @return {Color} D50 XYZ [x, y, z]
310
+ */
311
+ export declare function rec_2020_to_XYZ_D50(x: Color): Color;
312
+
313
+ /**
314
+ * @param {Color} color [r, g, b]
315
+ * - Red as number 0..1;
316
+ * - Green as number 0..1;
317
+ * - Blue as number 0..1;
318
+ * @return {Color} D50 XYZ [x, y, z]
319
+ */
320
+ export declare function rec_2020_to_XYZ_D65(x: Color): Color;
321
+
322
+ /**
323
+ * @param {Color} color [r, g, b]
324
+ * - Red as number 0..1;
325
+ * - Green as number 0..1;
326
+ * - Blue as number 0..1;
327
+ * @return {Color} D50 XYZ [x, y, z]
328
+ */
329
+ export declare function sRGB_to_XYZ_D50(x: Color): Color;
330
+
331
+ /**
332
+ * @param {Color} color [r, g, b]
333
+ * - Red as number 0..1;
334
+ * - Green as number 0..1;
335
+ * - Blue as number 0..1;
336
+ * @return {Color} D50 XYZ [x, y, z]
337
+ */
338
+ export declare function sRGB_to_XYZ_D65(x: Color): Color;
339
+
340
+ /**
341
+ * @param {Color} color [x, y, z]
342
+ * - X as number 0..1;
343
+ * - Y as number 0..1;
344
+ * - Z as number 0..1;
345
+ * @return {Color} a98 sRGB [r, g, b]
346
+ * - Red as number 0..1;
347
+ * - Green as number 0..1;
348
+ * - Blue as number 0..1;
349
+ */
350
+ export declare function XYZ_D50_to_a98_RGB(x: Color): Color;
351
+
352
+ /**
353
+ * @param {Color} color [x, y, z]
354
+ * - X as number 0..1;
355
+ * - Y as number 0..1;
356
+ * - Z as number 0..1;
357
+ * @return {Color} HSL [r, g, b]
358
+ * - Hue as degrees 0..360;
359
+ * - Saturation as number 0..100;
360
+ * - Lightness as number 0..100;
361
+ */
362
+ export declare function XYZ_D50_to_HSL(x: Color): Color;
363
+
364
+ /**
365
+ * @param {Color} color [x, y, z]
366
+ * - X as number 0..1;
367
+ * - Y as number 0..1;
368
+ * - Z as number 0..1;
369
+ * @return {Color} HWB [r, g, b]
370
+ * - Hue as degrees 0..360;
371
+ * - Whiteness as number 0..100;
372
+ * - Blackness as number 0..100;
373
+ */
374
+ export declare function XYZ_D50_to_HWB(x: Color): Color;
375
+
376
+ /**
377
+ * @param {Color} color [x, y, z]
378
+ * - X as number 0..1;
379
+ * - Y as number 0..1;
380
+ * - Z as number 0..1;
381
+ * @return {Color} Lab [r, g, b]
382
+ * - Lightness as number 0..100;
383
+ * - a as number -160..160;
384
+ * - b as number -160..160;
385
+ */
386
+ export declare function XYZ_D50_to_Lab(x: Color): Color;
387
+
388
+ /**
389
+ * @param {Color} color [x, y, z]
390
+ * - X as number 0..1;
391
+ * - Y as number 0..1;
392
+ * - Z as number 0..1;
393
+ * @return {Color} LCH [r, g, b]
394
+ * - Lightness as number 0..100;
395
+ * - Chroma as number 0..230;
396
+ * - Hue as degrees 0..360;
397
+ */
398
+ export declare function XYZ_D50_to_LCH(x: Color): Color;
399
+
400
+ /**
401
+ * @param {Color} color [x, y, z]
402
+ * - X as number 0..1;
403
+ * - Y as number 0..1;
404
+ * - Z as number 0..1;
405
+ * @return {Color} P3 [r, g, b]
406
+ * - R as number 0..1;
407
+ * - G as number 0..1;
408
+ * - B as number 0..1;
409
+ */
410
+ export declare function XYZ_D50_to_lin_P3(x: Color): Color;
411
+
412
+ /**
413
+ * @param {Color} color [x, y, z]
414
+ * - X as number 0..1;
415
+ * - Y as number 0..1;
416
+ * - Z as number 0..1;
417
+ * @return {Color} linear sRGB [r, g, b]
418
+ * - Red as number 0..1;
419
+ * - Green as number 0..1;
420
+ * - Blue as number 0..1;
421
+ */
422
+ export declare function XYZ_D50_to_lin_sRGB(x: Color): Color;
423
+
424
+ /**
425
+ * @param {Color} color [x, y, z]
426
+ * - X as number 0..1;
427
+ * - Y as number 0..1;
428
+ * - Z as number 0..1;
429
+ * @return {Color} OKLab [r, g, b]
430
+ * - Lightness as number 0..1;
431
+ * - a as number 0..0.5;
432
+ * - b as number 0..0.5;
433
+ */
434
+ export declare function XYZ_D50_to_OKLab(x: Color): Color;
435
+
436
+ /**
437
+ * @param {Color} color [x, y, z]
438
+ * - X as number 0..1;
439
+ * - Y as number 0..1;
440
+ * - Z as number 0..1;
441
+ * @return {Color} OKLCH [r, g, b]
442
+ * - Lightness as number 0..1;
443
+ * - Chroma as number 0..0.5;
444
+ * - Hue as degrees 0..360;
445
+ */
446
+ export declare function XYZ_D50_to_OKLCH(x: Color): Color;
447
+
448
+ /**
449
+ * @param {Color} color [x, y, z]
450
+ * - X as number 0..1;
451
+ * - Y as number 0..1;
452
+ * - Z as number 0..1;
453
+ * @return {Color} P3 [r, g, b]
454
+ * - R as number 0..1;
455
+ * - G as number 0..1;
456
+ * - B as number 0..1;
457
+ */
458
+ export declare function XYZ_D50_to_P3(x: Color): Color;
459
+
460
+ /**
461
+ * @param {Color} color [x, y, z]
462
+ * - X as number 0..1;
463
+ * - Y as number 0..1;
464
+ * - Z as number 0..1;
465
+ * @return {Color} ProPhoto [r, g, b]
466
+ * - Red as number 0..1;
467
+ * - Green as number 0..1;
468
+ * - Blue as number 0..1;
469
+ */
470
+ export declare function XYZ_D50_to_ProPhoto(x: Color): Color;
471
+
472
+ /**
473
+ * @param {Color} color [x, y, z]
474
+ * - X as number 0..1;
475
+ * - Y as number 0..1;
476
+ * - Z as number 0..1;
477
+ * @return {Color} rec 2020 [r, g, b]
478
+ * - Red as number 0..1;
479
+ * - Green as number 0..1;
480
+ * - Blue as number 0..1;
481
+ */
482
+ export declare function XYZ_D50_to_rec_2020(x: Color): Color;
483
+
484
+ /**
485
+ * @param {Color} color [x, y, z]
486
+ * - X as number 0..1;
487
+ * - Y as number 0..1;
488
+ * - Z as number 0..1;
489
+ * @return {Color} sRGB [r, g, b]
490
+ * - Red as number 0..1;
491
+ * - Green as number 0..1;
492
+ * - Blue as number 0..1;
493
+ */
494
+ export declare function XYZ_D50_to_sRGB(x: Color): Color;
495
+
496
+ /**
497
+ * @param {Color} color [x, y, z]
498
+ * - X as number 0..1;
499
+ * - Y as number 0..1;
500
+ * - Z as number 0..1;
501
+ * @return {Color} D50 XYZ [x, y, z]
502
+ */
503
+ export declare function XYZ_D50_to_XYZ_D50(x: Color): Color;
504
+
505
+ /**
506
+ * @param {Color} color [x, y, z]
507
+ * - X as number 0..1;
508
+ * - Y as number 0..1;
509
+ * - Z as number 0..1;
510
+ * @return {Color} D65 XYZ [x, y, z]
511
+ */
512
+ export declare function XYZ_D50_to_XYZ_D65(x: Color): Color;
513
+
514
+ /**
515
+ * @param {Color} color [x, y, z]
516
+ * - X as number 0..1;
517
+ * - Y as number 0..1;
518
+ * - Z as number 0..1;
519
+ * @return {Color} a98 sRGB [r, g, b]
520
+ * - Red as number 0..1;
521
+ * - Green as number 0..1;
522
+ * - Blue as number 0..1;
523
+ */
524
+ export declare function XYZ_D65_to_a98_RGB(x: Color): Color;
525
+
526
+ /**
527
+ * @param {Color} color [x, y, z]
528
+ * - X as number 0..1;
529
+ * - Y as number 0..1;
530
+ * - Z as number 0..1;
531
+ * @return {Color} HSL [r, g, b]
532
+ * - Hue as degrees 0..360;
533
+ * - Saturation as number 0..100;
534
+ * - Lightness as number 0..100;
535
+ */
536
+ export declare function XYZ_D65_to_HSL(x: Color): Color;
537
+
538
+ /**
539
+ * @param {Color} color [x, y, z]
540
+ * - X as number 0..1;
541
+ * - Y as number 0..1;
542
+ * - Z as number 0..1;
543
+ * @return {Color} HWB [r, g, b]
544
+ * - Hue as degrees 0..360;
545
+ * - Whiteness as number 0..100;
546
+ * - Blackness as number 0..100;
547
+ */
548
+ export declare function XYZ_D65_to_HWB(x: Color): Color;
549
+
550
+ /**
551
+ * @param {Color} color [x, y, z]
552
+ * - X as number 0..1;
553
+ * - Y as number 0..1;
554
+ * - Z as number 0..1;
555
+ * @return {Color} Lab [r, g, b]
556
+ * - Lightness as number 0..100;
557
+ * - a as number -160..160;
558
+ * - b as number -160..160;
559
+ */
560
+ export declare function XYZ_D65_to_Lab(x: Color): Color;
561
+
562
+ /**
563
+ * @param {Color} color [x, y, z]
564
+ * - X as number 0..1;
565
+ * - Y as number 0..1;
566
+ * - Z as number 0..1;
567
+ * @return {Color} LCH [r, g, b]
568
+ * - Lightness as number 0..100;
569
+ * - Chroma as number 0..230;
570
+ * - Hue as degrees 0..360;
571
+ */
572
+ export declare function XYZ_D65_to_LCH(x: Color): Color;
573
+
574
+ /**
575
+ * @param {Color} color [x, y, z]
576
+ * - X as number 0..1;
577
+ * - Y as number 0..1;
578
+ * - Z as number 0..1;
579
+ * @return {Color} P3 [r, g, b]
580
+ * - R as number 0..1;
581
+ * - G as number 0..1;
582
+ * - B as number 0..1;
583
+ */
584
+ export declare function XYZ_D65_to_lin_P3(x: Color): Color;
585
+
586
+ /**
587
+ * @param {Color} color [x, y, z]
588
+ * - X as number 0..1;
589
+ * - Y as number 0..1;
590
+ * - Z as number 0..1;
591
+ * @return {Color} linear sRGB [r, g, b]
592
+ * - Red as number 0..1;
593
+ * - Green as number 0..1;
594
+ * - Blue as number 0..1;
595
+ */
596
+ export declare function XYZ_D65_to_lin_sRGB(x: Color): Color;
597
+
598
+ /**
599
+ * @param {Color} color [x, y, z]
600
+ * - X as number 0..1;
601
+ * - Y as number 0..1;
602
+ * - Z as number 0..1;
603
+ * @return {Color} OKLab [r, g, b]
604
+ * - Lightness as number 0..1;
605
+ * - a as number 0..0.5;
606
+ * - b as number 0..0.5;
607
+ */
608
+ export declare function XYZ_D65_to_OKLab(x: Color): Color;
609
+
610
+ /**
611
+ * @param {Color} color [x, y, z]
612
+ * - X as number 0..1;
613
+ * - Y as number 0..1;
614
+ * - Z as number 0..1;
615
+ * @return {Color} OKLCH [r, g, b]
616
+ * - Lightness as number 0..1;
617
+ * - Chroma as number 0..0.5;
618
+ * - Hue as degrees 0..360;
619
+ */
620
+ export declare function XYZ_D65_to_OKLCH(x: Color): Color;
621
+
622
+ /**
623
+ * @param {Color} color [x, y, z]
624
+ * - X as number 0..1;
625
+ * - Y as number 0..1;
626
+ * - Z as number 0..1;
627
+ * @return {Color} P3 [r, g, b]
628
+ * - R as number 0..1;
629
+ * - G as number 0..1;
630
+ * - B as number 0..1;
631
+ */
632
+ export declare function XYZ_D65_to_P3(x: Color): Color;
633
+
634
+ /**
635
+ * @param {Color} color [x, y, z]
636
+ * - X as number 0..1;
637
+ * - Y as number 0..1;
638
+ * - Z as number 0..1;
639
+ * @return {Color} ProPhoto [r, g, b]
640
+ * - Red as number 0..1;
641
+ * - Green as number 0..1;
642
+ * - Blue as number 0..1;
643
+ */
644
+ export declare function XYZ_D65_to_ProPhoto(x: Color): Color;
645
+
646
+ /**
647
+ * @param {Color} color [x, y, z]
648
+ * - X as number 0..1;
649
+ * - Y as number 0..1;
650
+ * - Z as number 0..1;
651
+ * @return {Color} rec 2020 [r, g, b]
652
+ * - Red as number 0..1;
653
+ * - Green as number 0..1;
654
+ * - Blue as number 0..1;
655
+ */
656
+ export declare function XYZ_D65_to_rec_2020(x: Color): Color;
657
+
658
+ /**
659
+ * @param {Color} color [x, y, z]
660
+ * - X as number 0..1;
661
+ * - Y as number 0..1;
662
+ * - Z as number 0..1;
663
+ * @return {Color} sRGB [r, g, b]
664
+ * - Red as number 0..1;
665
+ * - Green as number 0..1;
666
+ * - Blue as number 0..1;
667
+ */
668
+ export declare function XYZ_D65_to_sRGB(x: Color): Color;
669
+
670
+ /**
671
+ * @param {Color} color [x, y, z]
672
+ * - X as number 0..1;
673
+ * - Y as number 0..1;
674
+ * - Z as number 0..1;
675
+ * @return {Color} D50 XYZ [x, y, z]
676
+ */
677
+ export declare function XYZ_D65_to_XYZ_D50(x: Color): Color;
678
+
679
+ /**
680
+ * @param {Color} color [x, y, z]
681
+ * - X as number 0..1;
682
+ * - Y as number 0..1;
683
+ * - Z as number 0..1;
684
+ * @return {Color} D50 XYZ [x, y, z]
685
+ */
686
+ export declare function XYZ_D65_to_XYZ_D65(x: Color): Color;
687
+
688
+ /**
689
+ * Convert XYZ to linear-light P3
690
+ *
691
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
692
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
693
+ */
694
+ export declare function XYZ_to_lin_P3(XYZ: Color): Color;
695
+
696
+ /**
697
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
698
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
699
+ */
700
+ export declare function XYZ_to_lin_sRGB(XYZ: Color): Color;
701
+
702
+ /**
703
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
704
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
705
+ *
706
+ * XYZ <-> LMS matrices recalculated for consistent reference white
707
+ * @see https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-943521484
708
+ */
709
+ export declare function XYZ_to_OKLab(XYZ: Color): Color;
710
+
711
+ export { }
node_modules/@csstools/color-helpers/dist/index.mjs ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function multiplyMatrices(_,t){return[_[0]*t[0]+_[1]*t[1]+_[2]*t[2],_[3]*t[0]+_[4]*t[1]+_[5]*t[2],_[6]*t[0]+_[7]*t[1]+_[8]*t[2]]}const _=[.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124];
2
+ /**
3
+ * Bradford chromatic adaptation from D50 to D65
4
+ *
5
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
6
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
7
+ */function D50_to_D65(t){return multiplyMatrices(_,t)}const t=[1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371];
8
+ /**
9
+ * Bradford chromatic adaptation from D65 to D50
10
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
11
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
12
+ * @see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
13
+ */function D65_to_D50(_){return multiplyMatrices(t,_)}
14
+ /**
15
+ * @param {number} hue - Hue as degrees 0..360
16
+ * @param {number} sat - Saturation as percentage 0..100
17
+ * @param {number} light - Lightness as percentage 0..100
18
+ * @return {number[]} Array of sRGB components; in-gamut colors in range [0..1]
19
+ *
20
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
21
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hslToRgb.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
22
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hslToRgb.js
23
+ */function HSL_to_sRGB(_){let t=_[0]%360;const n=_[1]/100,o=_[2]/100;return t<0&&(t+=360),[HSL_to_sRGB_channel(0,t,n,o),HSL_to_sRGB_channel(8,t,n,o),HSL_to_sRGB_channel(4,t,n,o)]}function HSL_to_sRGB_channel(_,t,n,o){const e=(_+t/30)%12;return o-n*Math.min(o,1-o)*Math.max(-1,Math.min(e-3,9-e,1))}
24
+ /**
25
+ * @param {number} hue - Hue as degrees 0..360
26
+ * @param {number} white - Whiteness as percentage 0..100
27
+ * @param {number} black - Blackness as percentage 0..100
28
+ * @return {number[]} Array of RGB components 0..1
29
+ *
30
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
31
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hwbToRgb.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
32
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hwbToRgb.js
33
+ */function HWB_to_sRGB(_){const t=_[0],n=_[1]/100,o=_[2]/100;if(n+o>=1){const _=n/(n+o);return[_,_,_]}const e=HSL_to_sRGB([t,100,50]),r=1-n-o;return[e[0]*r+n,e[1]*r+n,e[2]*r+n]}
34
+ /**
35
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
36
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
37
+ */function LCH_to_Lab(_){const t=_[2]*Math.PI/180;return[_[0],_[1]*Math.cos(t),_[1]*Math.sin(t)]}
38
+ /**
39
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
40
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
41
+ */function Lab_to_LCH(_){const t=Math.sqrt(Math.pow(_[1],2)+Math.pow(_[2],2));let n=180*Math.atan2(_[2],_[1])/Math.PI;return n<0&&(n+=360),t<=.0015&&(n=NaN),[_[0],t,n]}const n=[.3457/.3585,1,.2958/.3585];
42
+ /**
43
+ * Convert Lab to D50-adapted XYZ
44
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
45
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
46
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
47
+ */function Lab_to_XYZ(_){const t=24389/27,o=216/24389,e=(_[0]+16)/116,r=_[1]/500+e,a=e-_[2]/200;return[(Math.pow(r,3)>o?Math.pow(r,3):(116*r-16)/t)*n[0],(_[0]>8?Math.pow((_[0]+16)/116,3):_[0]/t)*n[1],(Math.pow(a,3)>o?Math.pow(a,3):(116*a-16)/t)*n[2]]}
48
+ /**
49
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
50
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
51
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
52
+ */function OKLCH_to_OKLab(_){const t=_[2]*Math.PI/180;return[_[0],_[1]*Math.cos(t),_[1]*Math.sin(t)]}
53
+ /**
54
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
55
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
56
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
57
+ */function OKLab_to_OKLCH(_){const t=Math.sqrt(_[1]**2+_[2]**2);let n=180*Math.atan2(_[2],_[1])/Math.PI;return n<0&&(n+=360),t<=4e-6&&(n=NaN),[_[0],t,n]}const o=[1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],e=[1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092];
58
+ /**
59
+ * Given OKLab, convert to XYZ relative to D65
60
+ *
61
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
62
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
63
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
64
+ */
65
+ function OKLab_to_XYZ(_){const t=multiplyMatrices(e,_);return multiplyMatrices(o,[t[0]**3,t[1]**3,t[2]**3])}
66
+ /**
67
+ * Assuming XYZ is relative to D50, convert to CIE Lab
68
+ * from CIE standard, which now defines these as a rational fraction
69
+ *
70
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
71
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
72
+ */function XYZ_to_Lab(_){const t=compute_f(_[0]/n[0]),o=compute_f(_[1]/n[1]);return[116*o-16,500*(t-o),200*(o-compute_f(_[2]/n[2]))]}const r=216/24389,a=24389/27;function compute_f(_){return _>r?Math.cbrt(_):(a*_+16)/116}const i=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],l=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774];
73
+ /**
74
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
75
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
76
+ *
77
+ * XYZ <-> LMS matrices recalculated for consistent reference white
78
+ * @see https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-943521484
79
+ */
80
+ function XYZ_to_OKLab(_){const t=multiplyMatrices(i,_);return multiplyMatrices(l,[Math.cbrt(t[0]),Math.cbrt(t[1]),Math.cbrt(t[2])])}const u=[30757411/17917100,-6372589/17917100,-4539589/17917100,-.666684351832489,1.616481236634939,467509/29648200,792561/44930125,-1921689/44930125,.942103121235474];
81
+ /**
82
+ * Convert XYZ to linear-light rec2020
83
+ *
84
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
85
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
86
+ */function XYZ_to_lin_2020(_){return multiplyMatrices(u,_)}const c=[446124/178915,-333277/357830,-72051/178915,-14852/17905,63121/35810,423/17905,11844/330415,-50337/660830,316169/330415];
87
+ /**
88
+ * Convert XYZ to linear-light P3
89
+ *
90
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
91
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
92
+ */function XYZ_to_lin_P3(_){return multiplyMatrices(c,_)}const s=[1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452];
93
+ /**
94
+ * Convert D50 XYZ to linear-light prophoto-rgb
95
+ *
96
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
97
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
98
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
99
+ */function XYZ_to_lin_ProPhoto(_){return multiplyMatrices(s,_)}const X=[1829569/896150,-506331/896150,-308931/896150,-851781/878810,1648619/878810,36519/878810,16779/1248040,-147721/1248040,1266979/1248040];
100
+ /**
101
+ * Convert XYZ to linear-light a98-rgb
102
+ *
103
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
104
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
105
+ */function XYZ_to_lin_a98rgb(_){return multiplyMatrices(X,_)}const Y=[12831/3959,-329/214,-1974/3959,-851781/878810,1648619/878810,36519/878810,705/12673,-2585/12673,705/667];
106
+ /**
107
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
108
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
109
+ */function XYZ_to_lin_sRGB(_){return multiplyMatrices(Y,_)}
110
+ /**
111
+ * Convert an array of linear-light rec2020 RGB in the range 0.0-1.0
112
+ * to gamma corrected form ITU-R BT.2020-2 p.4
113
+ *
114
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
115
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
116
+ */function gam_2020(_){return[gam_2020_channel(_[0]),gam_2020_channel(_[1]),gam_2020_channel(_[2])]}function gam_2020_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,1/2.4)}
117
+ /**
118
+ * Convert an array of linear-light sRGB values in the range 0.0-1.0 to gamma corrected form
119
+ * Extended transfer function:
120
+ * For negative values, linear portion extends on reflection
121
+ * of axis, then uses reflected pow below that
122
+ *
123
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
124
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
125
+ * @see https://en.wikipedia.org/wiki/SRGB
126
+ */function gam_sRGB(_){return[gam_sRGB_channel(_[0]),gam_sRGB_channel(_[1]),gam_sRGB_channel(_[2])]}function gam_sRGB_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n>.0031308?t*(1.055*Math.pow(n,1/2.4)-.055):12.92*_}
127
+ /**
128
+ * Convert an array of linear-light display-p3 RGB in the range 0.0-1.0
129
+ * to gamma corrected form
130
+ *
131
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
132
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
133
+ */function gam_P3(_){return gam_sRGB(_)}
134
+ /**
135
+ * Convert an array of linear-light prophoto-rgb in the range 0.0-1.0
136
+ * to gamma corrected form.
137
+ * Transfer curve is gamma 1.8 with a small linear portion.
138
+ *
139
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
140
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
141
+ */function gam_ProPhoto(_){return[gam_ProPhoto_channel(_[0]),gam_ProPhoto_channel(_[1]),gam_ProPhoto_channel(_[2])]}const Z=1/512;function gam_ProPhoto_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n>=Z?t*Math.pow(n,1/1.8):16*_}
142
+ /**
143
+ * Convert an array of linear-light a98-rgb in the range 0.0-1.0
144
+ * to gamma corrected form. Negative values are also now accepted
145
+ *
146
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
147
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
148
+ */function gam_a98rgb(_){return[gam_a98rgb_channel(_[0]),gam_a98rgb_channel(_[1]),gam_a98rgb_channel(_[2])]}function gam_a98rgb_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,256/563)}
149
+ /**
150
+ * Convert an array of rec2020 RGB values in the range 0.0 - 1.0
151
+ * to linear light (un-companded) form.
152
+ * ITU-R BT.2020-2 p.4
153
+ *
154
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
155
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
156
+ */function lin_2020(_){return[lin_2020_channel(_[0]),lin_2020_channel(_[1]),lin_2020_channel(_[2])]}function lin_2020_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,2.4)}const D=[63426534/99577255,20160776/139408157,47086771/278816314,26158966/99577255,.677998071518871,8267143/139408157,0,19567812/697040785,1.0609850577107909];
157
+ /**
158
+ * Convert an array of linear-light rec2020 values to CIE XYZ
159
+ * using D65 (no chromatic adaptation)
160
+ *
161
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
162
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
163
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
164
+ */function lin_2020_to_XYZ(_){return multiplyMatrices(D,_)}
165
+ /**
166
+ * Convert an array of of sRGB values where in-gamut values are in the range
167
+ * [0 - 1] to linear light (un-companded) form.
168
+ * Extended transfer function:
169
+ * For negative values, linear portion is extended on reflection of axis,
170
+ * then reflected power function is used.
171
+ *
172
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
173
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
174
+ * @see https://en.wikipedia.org/wiki/SRGB
175
+ */function lin_sRGB(_){return[lin_sRGB_channel(_[0]),lin_sRGB_channel(_[1]),lin_sRGB_channel(_[2])]}function lin_sRGB_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n<=.04045?_/12.92:t*Math.pow((n+.055)/1.055,2.4)}
176
+ /**
177
+ * Convert an array of display-p3 RGB values in the range 0.0 - 1.0
178
+ * to linear light (un-companded) form.
179
+ *
180
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
181
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
182
+ */function lin_P3(_){return lin_sRGB(_)}const h=[608311/1250200,189793/714400,198249/1000160,35783/156275,247089/357200,198249/2500400,0,32229/714400,5220557/5000800];
183
+ /**
184
+ * Convert an array of linear-light display-p3 values to CIE XYZ
185
+ * using D65 (no chromatic adaptation)
186
+ *
187
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
188
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
189
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
190
+ */function lin_P3_to_XYZ(_){return multiplyMatrices(h,_)}
191
+ /**
192
+ * Convert an array of prophoto-rgb values where in-gamut Colors are in the
193
+ * range [0.0 - 1.0] to linear light (un-companded) form. Transfer curve is
194
+ * gamma 1.8 with a small linear portion. Extended transfer function
195
+ *
196
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
197
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
198
+ */function lin_ProPhoto(_){return[lin_ProPhoto_channel(_[0]),lin_ProPhoto_channel(_[1]),lin_ProPhoto_channel(_[2])]}const f=16/512;function lin_ProPhoto_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n<=f?_/16:t*Math.pow(n,1.8)}const m=[.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602];
199
+ /**
200
+ * Convert an array of linear-light prophoto-rgb values to CIE D50 XYZ.
201
+ * Matrix cannot be expressed in rational form, but is calculated to 64 bit accuracy.
202
+ *
203
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
204
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
205
+ * @see see https://github.com/w3c/csswg-drafts/issues/7675
206
+ */function lin_ProPhoto_to_XYZ(_){return multiplyMatrices(m,_)}
207
+ /**
208
+ * Convert an array of a98-rgb values in the range 0.0 - 1.0
209
+ * to linear light (un-companded) form. Negative values are also now accepted
210
+ *
211
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
212
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
213
+ */function lin_a98rgb(_){return[lin_a98rgb_channel(_[0]),lin_a98rgb_channel(_[1]),lin_a98rgb_channel(_[2])]}function lin_a98rgb_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,563/256)}const b=[573536/994567,263643/1420810,187206/994567,591459/1989134,6239551/9945670,374412/4972835,53769/1989134,351524/4972835,4929758/4972835];
214
+ /**
215
+ * Convert an array of linear-light a98-rgb values to CIE XYZ
216
+ * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
217
+ * has greater numerical precision than section 4.3.5.3 of
218
+ * https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
219
+ * but the values below were calculated from first principles
220
+ * from the chromaticity coordinates of R G B W
221
+ *
222
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
223
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
224
+ * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
225
+ * @see https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
226
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/matrixmaker.html
227
+ */function lin_a98rgb_to_XYZ(_){return multiplyMatrices(b,_)}const g=[506752/1228815,87881/245763,12673/70218,87098/409605,175762/245763,12673/175545,7918/409605,87881/737289,1001167/1053270];
228
+ /**
229
+ * Convert an array of linear-light sRGB values to CIE XYZ
230
+ * using sRGB's own white, D65 (no chromatic adaptation)
231
+ *
232
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
233
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
234
+ */function lin_sRGB_to_XYZ(_){return multiplyMatrices(g,_)}
235
+ /**
236
+ * Convert an array of gamma-corrected sRGB values in the 0.0 to 1.0 range to HSL.
237
+ *
238
+ * @param {Color} RGB [r, g, b]
239
+ * - Red component 0..1
240
+ * - Green component 0..1
241
+ * - Blue component 0..1
242
+ * @return {number[]} Array of HSL values: Hue as degrees 0..360, Saturation and Lightness as percentages 0..100
243
+ *
244
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
245
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
246
+ *
247
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/better-rgbToHsl.js
248
+ */function sRGB_to_HSL(_){const t=_[0],n=_[1],o=_[2],e=Math.max(t,n,o),r=Math.min(t,n,o),a=(r+e)/2,i=e-r;let l=Number.NaN,u=0;if(0!==Math.round(1e5*i)){const _=Math.round(1e5*a);switch(u=0===_||1e5===_?0:(e-a)/Math.min(a,1-a),e){case t:l=(n-o)/i+(n<o?6:0);break;case n:l=(o-t)/i+2;break;case o:l=(t-n)/i+4}l*=60}u<0&&(l+=180,u=Math.abs(u)),l>=360&&(l-=360);return u<=1e-5&&(l=NaN),[l,100*u,100*a]}function sRGB_to_Hue(_){const t=_[0],n=_[1],o=_[2],e=Math.max(t,n,o),r=Math.min(t,n,o);let a=Number.NaN;const i=e-r;if(0!==i){switch(e){case t:a=(n-o)/i+(n<o?6:0);break;case n:a=(o-t)/i+2;break;case o:a=(t-n)/i+4}a*=60}return a>=360&&(a-=360),a}function sRGB_to_XYZ_D50(_){let t=_;return t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_sRGB(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t}function HSL_to_XYZ_D50(_){let t=_;return t=HSL_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_HSL(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t=sRGB_to_HSL(t),t}function HWB_to_XYZ_D50(_){let t=_;return t=HWB_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_HWB(_){let t=_;t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t);const n=gam_sRGB(t),o=Math.min(n[0],n[1],n[2]),e=1-Math.max(n[0],n[1],n[2]);let r=sRGB_to_Hue(n);return o+e>=.99999&&(r=NaN),[r,100*o,100*e]}function Lab_to_XYZ_D50(_){let t=_;return t=Lab_to_XYZ(t),t}function XYZ_D50_to_Lab(_){let t=_;return t=XYZ_to_Lab(t),t}function LCH_to_XYZ_D50(_){let t=_;return t=LCH_to_Lab(t),t=Lab_to_XYZ(t),t}function XYZ_D50_to_LCH(_){let t=_;return t=XYZ_to_Lab(t),t=Lab_to_LCH(t),t}function OKLab_to_XYZ_D50(_){let t=_;return t=OKLab_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_OKLab(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_OKLab(t),t}function OKLCH_to_XYZ_D50(_){let t=_;return t=OKLCH_to_OKLab(t),t=OKLab_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_OKLCH(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_OKLab(t),t=OKLab_to_OKLCH(t),t}function lin_sRGB_to_XYZ_D50(_){let t=_;return t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_lin_sRGB(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t),t}function a98_RGB_to_XYZ_D50(_){let t=_;return t=lin_a98rgb(t),t=lin_a98rgb_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_a98_RGB(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_a98rgb(t),t=gam_a98rgb(t),t}function P3_to_XYZ_D50(_){let t=_;return t=lin_P3(t),t=lin_P3_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_P3(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_P3(t),t=gam_P3(t),t}function lin_P3_to_XYZ_D50(_){let t=_;return t=lin_P3_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_lin_P3(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_P3(t),t}function rec_2020_to_XYZ_D50(_){let t=_;return t=lin_2020(t),t=lin_2020_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_rec_2020(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_2020(t),t=gam_2020(t),t}function ProPhoto_RGB_to_XYZ_D50(_){let t=_;return t=lin_ProPhoto(t),t=lin_ProPhoto_to_XYZ(t),t}function XYZ_D50_to_ProPhoto(_){let t=_;return t=XYZ_to_lin_ProPhoto(t),t=gam_ProPhoto(t),t}function XYZ_D65_to_XYZ_D50(_){let t=_;return t=D65_to_D50(t),t}function XYZ_D50_to_XYZ_D65(_){let t=_;return t=D50_to_D65(t),t}function XYZ_D50_to_XYZ_D50(_){return _}function XYZ_D65_to_XYZ_D65(_){return _}function sRGB_to_XYZ_D65(_){let t=_;return t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_sRGB(_){let t=_;return t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t}function HSL_to_XYZ_D65(_){let t=_;return t=HSL_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_HSL(_){let t=_;return t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t=sRGB_to_HSL(t),t}function HWB_to_XYZ_D65(_){let t=_;return t=HWB_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_HWB(_){let t=_;t=XYZ_to_lin_sRGB(t);const n=gam_sRGB(t),o=Math.min(n[0],n[1],n[2]),e=1-Math.max(n[0],n[1],n[2]);let r=sRGB_to_Hue(n);return o+e>=.99999&&(r=NaN),[r,100*o,100*e]}function Lab_to_XYZ_D65(_){let t=_;return t=Lab_to_XYZ(t),t=D50_to_D65(t),t}function XYZ_D65_to_Lab(_){let t=_;return t=D65_to_D50(t),t=XYZ_to_Lab(t),t}function LCH_to_XYZ_D65(_){let t=_;return t=LCH_to_Lab(t),t=Lab_to_XYZ(t),t=D50_to_D65(t),t}function XYZ_D65_to_LCH(_){let t=_;return t=D65_to_D50(t),t=XYZ_to_Lab(t),t=Lab_to_LCH(t),t}function OKLab_to_XYZ_D65(_){let t=_;return t=OKLab_to_XYZ(t),t}function XYZ_D65_to_OKLab(_){let t=_;return t=XYZ_to_OKLab(t),t}function OKLCH_to_XYZ_D65(_){let t=_;return t=OKLCH_to_OKLab(t),t=OKLab_to_XYZ(t),t}function XYZ_D65_to_OKLCH(_){let t=_;return t=XYZ_to_OKLab(t),t=OKLab_to_OKLCH(t),t}function lin_sRGB_to_XYZ_D65(_){let t=_;return t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_lin_sRGB(_){let t=_;return t=XYZ_to_lin_sRGB(t),t}function a98_RGB_to_XYZ_D65(_){let t=_;return t=lin_a98rgb(t),t=lin_a98rgb_to_XYZ(t),t}function XYZ_D65_to_a98_RGB(_){let t=_;return t=XYZ_to_lin_a98rgb(t),t=gam_a98rgb(t),t}function P3_to_XYZ_D65(_){let t=_;return t=lin_P3(t),t=lin_P3_to_XYZ(t),t}function XYZ_D65_to_P3(_){let t=_;return t=XYZ_to_lin_P3(t),t=gam_P3(t),t}function lin_P3_to_XYZ_D65(_){let t=_;return t=lin_P3_to_XYZ(t),t}function XYZ_D65_to_lin_P3(_){let t=_;return t=XYZ_to_lin_P3(t),t}function rec_2020_to_XYZ_D65(_){let t=_;return t=lin_2020(t),t=lin_2020_to_XYZ(t),t}function XYZ_D65_to_rec_2020(_){let t=_;return t=XYZ_to_lin_2020(t),t=gam_2020(t),t}function ProPhoto_RGB_to_XYZ_D65(_){let t=_;return t=lin_ProPhoto(t),t=lin_ProPhoto_to_XYZ(t),t=D50_to_D65(t),t}function XYZ_D65_to_ProPhoto(_){let t=_;return t=D65_to_D50(t),t=XYZ_to_lin_ProPhoto(t),t=gam_ProPhoto(t),t}function inGamut(_){return _[0]>=-1e-4&&_[0]<=1.0001&&_[1]>=-1e-4&&_[1]<=1.0001&&_[2]>=-1e-4&&_[2]<=1.0001}function clip(_){return[_[0]<0?0:_[0]>1?1:_[0],_[1]<0?0:_[1]>1?1:_[1],_[2]<0?0:_[2]>1?1:_[2]]}
249
+ /**
250
+ * @description Calculate deltaE OK which is the simple root sum of squares
251
+ * @param {number[]} reference - Array of OKLab values: L as 0..1, a and b as -1..1
252
+ * @param {number[]} sample - Array of OKLab values: L as 0..1, a and b as -1..1
253
+ * @return {number} How different a color sample is from reference
254
+ *
255
+ * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
256
+ * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
257
+ * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js
258
+ */function deltaEOK(_,t){const[n,o,e]=_,[r,a,i]=t,l=n-r,u=o-a,c=e-i;return Math.sqrt(l**2+u**2+c**2)}const L=.02,B=1e-4;function mapGamut(_,t,n){const o=_;let e=clip(t(o)),r=deltaEOK(OKLCH_to_OKLab(n(e)),OKLCH_to_OKLab(o));if(r<L)return e;let a=0,i=o[1],l=!0;for(;i-a>B;){const _=(a+i)/2;if(o[1]=_,l&&inGamut(t(o)))a=_;else if(e=clip(t(o)),r=deltaEOK(OKLCH_to_OKLab(n(e)),OKLCH_to_OKLab(o)),r<L){if(L-r<B)return e;l=!1,a=_}else i=_}return clip(t([...o]))}
259
+ /**
260
+ * @license MIT https://github.com/facelessuser/coloraide/blob/main/LICENSE.md
261
+ */function mapGamutRayTrace(_,t,n){const o=_[0],e=_[2];let r=t(_);const a=t([o,0,e]);for(let _=0;_<4;_++){if(_>0){const _=n(r);_[0]=o,_[2]=e,r=t(_)}const i=rayTraceBox(a,r);if(!i)break;r=i}return clip(r)}function rayTraceBox(_,t){let n=1/0,o=-1/0;const e=[0,0,0];for(let r=0;r<3;r++){const a=_[r],i=t[r]-a;e[r]=i;const l=0,u=1;if(Math.abs(i)>1e-12){const _=1/i,t=(l-a)*_,e=(u-a)*_;o=Math.max(Math.min(t,e),o),n=Math.min(Math.max(t,e),n)}else if(a<l||a>u)return!1}return!(o>n||n<0)&&(o<0&&(o=n),!!isFinite(o)&&[_[0]+e[0]*o,_[1]+e[1]*o,_[2]+e[2]*o])}const G={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function luminance(_){const[t,n,o]=_.map(_=>_<=.04045?_/12.92:Math.pow((_+.055)/1.055,2.4));return.2126*t+.7152*n+.0722*o}function contrast_ratio_wcag_2_1(_,t){const n=luminance(_),o=luminance(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}export{HSL_to_XYZ_D50,HSL_to_XYZ_D65,HWB_to_XYZ_D50,HWB_to_XYZ_D65,LCH_to_XYZ_D50,LCH_to_XYZ_D65,Lab_to_XYZ_D50,Lab_to_XYZ_D65,OKLCH_to_OKLab,OKLCH_to_XYZ_D50,OKLCH_to_XYZ_D65,OKLab_to_OKLCH,OKLab_to_XYZ,OKLab_to_XYZ_D50,OKLab_to_XYZ_D65,P3_to_XYZ_D50,P3_to_XYZ_D65,ProPhoto_RGB_to_XYZ_D50,ProPhoto_RGB_to_XYZ_D65,XYZ_D50_to_HSL,XYZ_D50_to_HWB,XYZ_D50_to_LCH,XYZ_D50_to_Lab,XYZ_D50_to_OKLCH,XYZ_D50_to_OKLab,XYZ_D50_to_P3,XYZ_D50_to_ProPhoto,XYZ_D50_to_XYZ_D50,XYZ_D50_to_XYZ_D65,XYZ_D50_to_a98_RGB,XYZ_D50_to_lin_P3,XYZ_D50_to_lin_sRGB,XYZ_D50_to_rec_2020,XYZ_D50_to_sRGB,XYZ_D65_to_HSL,XYZ_D65_to_HWB,XYZ_D65_to_LCH,XYZ_D65_to_Lab,XYZ_D65_to_OKLCH,XYZ_D65_to_OKLab,XYZ_D65_to_P3,XYZ_D65_to_ProPhoto,XYZ_D65_to_XYZ_D50,XYZ_D65_to_XYZ_D65,XYZ_D65_to_a98_RGB,XYZ_D65_to_lin_P3,XYZ_D65_to_lin_sRGB,XYZ_D65_to_rec_2020,XYZ_D65_to_sRGB,XYZ_to_OKLab,XYZ_to_lin_P3,XYZ_to_lin_sRGB,a98_RGB_to_XYZ_D50,a98_RGB_to_XYZ_D65,clip,contrast_ratio_wcag_2_1,gam_P3,gam_sRGB,inGamut,lin_P3,lin_P3_to_XYZ,lin_P3_to_XYZ_D50,lin_P3_to_XYZ_D65,lin_sRGB,lin_sRGB_to_XYZ,lin_sRGB_to_XYZ_D50,lin_sRGB_to_XYZ_D65,mapGamut,mapGamutRayTrace,G as namedColors,rec_2020_to_XYZ_D50,rec_2020_to_XYZ_D65,sRGB_to_XYZ_D50,sRGB_to_XYZ_D65};
node_modules/@csstools/color-helpers/package.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@csstools/color-helpers",
3
+ "description": "Color helpers to ease transformation between formats, gamut, etc",
4
+ "version": "6.1.1",
5
+ "contributors": [
6
+ {
7
+ "name": "Antonio Laguna",
8
+ "email": "antonio@laguna.es",
9
+ "url": "https://antonio.laguna.es"
10
+ },
11
+ {
12
+ "name": "Romain Menke",
13
+ "email": "romainmenke@gmail.com"
14
+ }
15
+ ],
16
+ "license": "MIT-0",
17
+ "funding": [
18
+ {
19
+ "type": "github",
20
+ "url": "https://github.com/sponsors/csstools"
21
+ },
22
+ {
23
+ "type": "opencollective",
24
+ "url": "https://opencollective.com/csstools"
25
+ }
26
+ ],
27
+ "engines": {
28
+ "node": ">=20.19.0"
29
+ },
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.mjs"
35
+ }
36
+ },
37
+ "files": [
38
+ "CHANGELOG.md",
39
+ "LICENSE.md",
40
+ "README.md",
41
+ "dist"
42
+ ],
43
+ "scripts": {},
44
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers#readme",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
48
+ "directory": "packages/color-helpers"
49
+ },
50
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
51
+ "keywords": [
52
+ "colors",
53
+ "css"
54
+ ]
55
+ }
node_modules/@csstools/css-calc/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changes to CSS Calc
2
+
3
+ ### 3.3.0
4
+
5
+ _July 22, 2026_
6
+
7
+ - Add support for `calc-mix()`
8
+ - Update `random()` to match the latest spec
9
+
10
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md)
node_modules/@csstools/css-calc/LICENSE.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
node_modules/@csstools/css-calc/README.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CSS Calc <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
2
+
3
+ [<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-calc.svg" height="20">][npm-url]
4
+ [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
5
+ [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
6
+
7
+ Implemented from : https://drafts.csswg.org/css-values-4/ on 2023-02-17
8
+
9
+ ## Usage
10
+
11
+ Add [CSS calc] to your project:
12
+
13
+ ```bash
14
+ npm install @csstools/css-calc @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
15
+ ```
16
+
17
+ ### With string values :
18
+
19
+ ```mjs
20
+ import { calc } from '@csstools/css-calc';
21
+
22
+ // '20'
23
+ console.log(calc('calc(10 * 2)'));
24
+ ```
25
+
26
+ ### With component values :
27
+
28
+ ```mjs
29
+ import { stringify, tokenizer } from '@csstools/css-tokenizer';
30
+ import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms';
31
+ import { calcFromComponentValues } from '@csstools/css-calc';
32
+
33
+ const t = tokenizer({
34
+ css: 'calc(10 * 2)',
35
+ });
36
+
37
+ const tokens = [];
38
+
39
+ {
40
+ while (!t.endOfFile()) {
41
+ tokens.push(t.nextToken());
42
+ }
43
+
44
+ tokens.push(t.nextToken()); // EOF-token
45
+ }
46
+
47
+ const result = parseCommaSeparatedListOfComponentValues(tokens, {});
48
+
49
+ // filter or mutate the component values
50
+
51
+ const calcResult = calcFromComponentValues(result, { precision: 5, toCanonicalUnits: true });
52
+
53
+ // filter or mutate the component values even further
54
+
55
+ const calcResultStr = calcResult.map((componentValues) => {
56
+ return componentValues.map((x) => stringify(...x.tokens())).join('');
57
+ }).join(',');
58
+
59
+ // '20'
60
+ console.log(calcResultStr);
61
+ ```
62
+
63
+ ### Options
64
+
65
+ #### `precision` :
66
+
67
+ The default precision is fairly high.
68
+ It aims to be high enough to make rounding unnoticeable in the browser.
69
+
70
+ You can set it to a lower number to suit your needs.
71
+
72
+ ```mjs
73
+ import { calc } from '@csstools/css-calc';
74
+
75
+ // '0.3'
76
+ console.log(calc('calc(1 / 3)', { precision: 1 }));
77
+ // '0.33'
78
+ console.log(calc('calc(1 / 3)', { precision: 2 }));
79
+ ```
80
+
81
+ #### `globals` :
82
+
83
+ Pass global values as a map of key value pairs.
84
+
85
+ > Example : Relative color syntax (`lch(from pink calc(l / 2) c h)`) exposes color channel information as ident tokens.
86
+ > By passing globals for `l`, `c` and `h` it is possible to solve nested `calc()`'s.
87
+
88
+ ```mjs
89
+ import { calc } from '@csstools/css-calc';
90
+
91
+ const globals = new Map([
92
+ ['a', '10px'],
93
+ ['b', '2rem'],
94
+ ]);
95
+
96
+ // '20px'
97
+ console.log(calc('calc(a * 2)', { globals: globals }));
98
+ // '6rem'
99
+ console.log(calc('calc(b * 3)', { globals: globals }));
100
+ ```
101
+
102
+ #### `toCanonicalUnits` :
103
+
104
+ By default this package will try to preserve units.
105
+ The heuristic to do this is very simplistic.
106
+ We take the first unit we encounter and try to convert other dimensions to that unit.
107
+
108
+ This better matches what users expect from a CSS dev tool.
109
+
110
+ If you want to have outputs that are closes to CSS serialized values you can pass `toCanonicalUnits: true`.
111
+
112
+ ```mjs
113
+ import { calc } from '@csstools/css-calc';
114
+
115
+ // '20hz'
116
+ console.log(calc('calc(0.01khz + 10hz)', { toCanonicalUnits: true }));
117
+
118
+ // '20hz'
119
+ console.log(calc('calc(10hz + 0.01khz)', { toCanonicalUnits: true }));
120
+
121
+ // '0.02khz' !!!
122
+ console.log(calc('calc(0.01khz + 10hz)', { toCanonicalUnits: false }));
123
+
124
+ // '20hz'
125
+ console.log(calc('calc(10hz + 0.01khz)', { toCanonicalUnits: false }));
126
+ ```
127
+
128
+ [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
129
+ [discord]: https://discord.gg/bUadyRwkJS
130
+ [npm-url]: https://www.npmjs.com/package/@csstools/css-calc
131
+
132
+ [CSS calc]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc
node_modules/@csstools/css-calc/dist/index.d.ts ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { ComponentValue } from '@csstools/css-parser-algorithms';
2
+ import type { TokenDimension } from '@csstools/css-tokenizer';
3
+ import type { TokenNumber } from '@csstools/css-tokenizer';
4
+ import type { TokenPercentage } from '@csstools/css-tokenizer';
5
+
6
+ export declare function calc(css: string, options?: conversionOptions): string;
7
+
8
+ export declare function calcFromComponentValues(componentValuesList: Array<Array<ComponentValue>>, options?: conversionOptions): Array<Array<ComponentValue>>;
9
+
10
+ export declare type conversionOptions = {
11
+ /**
12
+ * If a calc expression can not be solved the parse error might be reported through this callback.
13
+ * Not all cases are covered. Open an issue if you need specific errors reported.
14
+ *
15
+ * Values are recursively visited and at each nesting level an attempt is made to solve the expression.
16
+ * Errors can be reported multiple times as a result of this.
17
+ */
18
+ onParseError?: (error: ParseError) => void;
19
+ /**
20
+ * Pass global values as a map of key value pairs.
21
+ */
22
+ globals?: GlobalsWithStrings;
23
+ /**
24
+ * The default precision is fairly high.
25
+ * It aims to be high enough to make rounding unnoticeable in the browser.
26
+ * You can set it to a lower number to suite your needs.
27
+ */
28
+ precision?: number;
29
+ /**
30
+ * The CSS pixel length of one device pixel.
31
+ * Used when rounding to `line-width` and similar features
32
+ */
33
+ devicePixelLength?: number;
34
+ /**
35
+ * By default this package will try to preserve units.
36
+ * The heuristic to do this is very simplistic.
37
+ * We take the first unit we encounter and try to convert other dimensions to that unit.
38
+ *
39
+ * This better matches what users expect from a CSS dev tool.
40
+ *
41
+ * If you want to have outputs that are closes to CSS serialized values you can set `true`.
42
+ */
43
+ toCanonicalUnits?: boolean;
44
+ /**
45
+ * Convert NaN, Infinity, ... into standard representable values.
46
+ */
47
+ censorIntoStandardRepresentableValues?: boolean;
48
+ /**
49
+ * Some percentages resolve against other values and might be negative or positive depending on context.
50
+ * Raw percentages are more likely to be safe to simplify outside of a browser context
51
+ *
52
+ * @see https://drafts.csswg.org/css-values-4/#calc-simplification
53
+ */
54
+ rawPercentages?: boolean;
55
+ /**
56
+ * The values used to generate random value cache keys.
57
+ */
58
+ randomCaching?: {
59
+ /**
60
+ * The name of the property the random function is used in.
61
+ */
62
+ propertyName: string;
63
+ /**
64
+ * N is the index of the random function among other random functions in the same property value.
65
+ */
66
+ propertyN: number;
67
+ /**
68
+ * An element ID identifying the element the style is being applied to.
69
+ * When omitted any `random()` call will not be computed.
70
+ */
71
+ elementID: string;
72
+ /**
73
+ * A document ID identifying the Document the styles are from.
74
+ * When omitted any `random()` call will not be computed.
75
+ */
76
+ documentID: string;
77
+ };
78
+ };
79
+
80
+ export declare type GlobalsWithStrings = Map<string, TokenDimension | TokenNumber | TokenPercentage | string>;
81
+
82
+ export declare const mathFunctionNames: Set<string>;
83
+
84
+ /**
85
+ * Any errors are reported through the `onParseError` callback.
86
+ */
87
+ export declare class ParseError extends Error {
88
+ /** The index of the start character of the current token. */
89
+ sourceStart: number;
90
+ /** The index of the end character of the current token. */
91
+ sourceEnd: number;
92
+ constructor(message: string, sourceStart: number, sourceEnd: number);
93
+ }
94
+
95
+ export declare const ParseErrorMessage: {
96
+ UnexpectedAdditionOfDimensionOrPercentageWithNumber: string;
97
+ UnexpectedSubtractionOfDimensionOrPercentageWithNumber: string;
98
+ };
99
+
100
+ export declare class ParseErrorWithComponentValues extends ParseError {
101
+ /** The associated component values. */
102
+ componentValues: Array<ComponentValue>;
103
+ constructor(message: string, componentValues: Array<ComponentValue>);
104
+ }
105
+
106
+ export { }
node_modules/@csstools/css-calc/dist/index.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ import{sourceIndices as e,TokenNode as n,isTokenNode as t,isWhitespaceNode as r,isCommentNode as a,isWhiteSpaceOrCommentNode as u,isSimpleBlockNode as o,isFunctionNode as i,FunctionNode as l,WhitespaceNode as c,parseCommaSeparatedListOfComponentValues as s,walk as v}from"@csstools/css-parser-algorithms";import{isTokenDimension as f,TokenType as p,NumberType as m,mutateUnit as d,isTokenNumber as C,isTokenPercentage as g,isTokenIdent as D,isTokenNumeric as h,isTokenOpenParen as N,isTokenDelim as B,isTokenComma as A,isToken as b,tokenizer as F,tokenize as w,stringify as E,isTokenColon as S,isTokenSemicolon as y}from"@csstools/css-tokenizer";class ParseError extends Error{sourceStart;sourceEnd;constructor(e,n,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=t}}class ParseErrorWithComponentValues extends ParseError{componentValues;constructor(n,t){super(n,...e(t)),this.componentValues=t}}const I={UnexpectedAdditionOfDimensionOrPercentageWithNumber:"Unexpected addition of a dimension or percentage with a number.",UnexpectedSubtractionOfDimensionOrPercentageWithNumber:"Unexpected subtraction of a dimension or percentage with a number."},x=/[A-Z]/g;function toLowerCaseAZ(e){return e.replace(x,e=>String.fromCharCode(e.charCodeAt(0)+32))}const M={cm:"px",in:"px",mm:"px",pc:"px",pt:"px",px:"px",q:"px",deg:"deg",grad:"deg",rad:"deg",turn:"deg",ms:"s",s:"s",hz:"hz",khz:"hz"},T=new Map([["cm",e=>e],["mm",e=>10*e],["q",e=>40*e],["in",e=>e/2.54],["pc",e=>e/2.54*6],["pt",e=>e/2.54*72],["px",e=>e/2.54*96]]),P=new Map([["deg",e=>e],["grad",e=>e/.9],["rad",e=>e/180*Math.PI],["turn",e=>e/360]]),k=new Map([["deg",e=>.9*e],["grad",e=>e],["rad",e=>.9*e/180*Math.PI],["turn",e=>.9*e/360]]),W=new Map([["hz",e=>e],["khz",e=>e/1e3]]),O=new Map([["cm",e=>2.54*e],["mm",e=>25.4*e],["q",e=>25.4*e*4],["in",e=>e],["pc",e=>6*e],["pt",e=>72*e],["px",e=>96*e]]),U=new Map([["hz",e=>1e3*e],["khz",e=>e]]),L=new Map([["cm",e=>e/10],["mm",e=>e],["q",e=>4*e],["in",e=>e/25.4],["pc",e=>e/25.4*6],["pt",e=>e/25.4*72],["px",e=>e/25.4*96]]),$=new Map([["ms",e=>e],["s",e=>e/1e3]]),V=new Map([["cm",e=>e/6*2.54],["mm",e=>e/6*25.4],["q",e=>e/6*25.4*4],["in",e=>e/6],["pc",e=>e],["pt",e=>e/6*72],["px",e=>e/6*96]]),Z=new Map([["cm",e=>e/72*2.54],["mm",e=>e/72*25.4],["q",e=>e/72*25.4*4],["in",e=>e/72],["pc",e=>e/72*6],["pt",e=>e],["px",e=>e/72*96]]),z=new Map([["cm",e=>e/96*2.54],["mm",e=>e/96*25.4],["q",e=>e/96*25.4*4],["in",e=>e/96],["pc",e=>e/96*6],["pt",e=>e/96*72],["px",e=>e]]),q=new Map([["cm",e=>e/4/10],["mm",e=>e/4],["q",e=>e],["in",e=>e/4/25.4],["pc",e=>e/4/25.4*6],["pt",e=>e/4/25.4*72],["px",e=>e/4/25.4*96]]),G=new Map([["deg",e=>180*e/Math.PI],["grad",e=>180*e/Math.PI/.9],["rad",e=>e],["turn",e=>180*e/Math.PI/360]]),R=new Map([["ms",e=>1e3*e],["s",e=>e]]),j=new Map([["deg",e=>360*e],["grad",e=>360*e/.9],["rad",e=>360*e/180*Math.PI],["turn",e=>e]]),Y=new Map([["cm",T],["mm",L],["q",q],["in",O],["pc",V],["pt",Z],["px",z],["ms",$],["s",R],["deg",P],["grad",k],["rad",G],["turn",j],["hz",W],["khz",U]]);function convertUnit(e,n){if(!f(e))return n;if(!f(n))return n;const t=toLowerCaseAZ(e[4].unit),r=toLowerCaseAZ(n[4].unit);if(t===r)return n;const a=Y.get(r);if(!a)return n;const u=a.get(t);if(!u)return n;const o=u(n[4].value),i=[p.Dimension,"",n[2],n[3],{...n[4],signCharacter:o<0?"-":void 0,type:Number.isInteger(o)?m.Integer:m.Number,value:o}];return d(i,e[4].unit),i}function toCanonicalUnit(e){if(!f(e))return e;const n=toLowerCaseAZ(e[4].unit),t=M[n];if(n===t)return e;const r=Y.get(n);if(!r)return e;const a=r.get(t);if(!a)return e;const u=a(e[4].value),o=[p.Dimension,"",e[2],e[3],{...e[4],signCharacter:u<0?"-":void 0,type:Number.isInteger(u)?m.Integer:m.Number,value:u}];return d(o,t),o}function addition(e,t){if(2!==e.length)return-1;const r=e[0].value;let a=e[1].value;if(C(r)&&C(a)){const e=r[4].value+a[4].value;return new n([p.Number,e.toString(),r[2],a[3],{value:e,type:r[4].type===m.Integer&&a[4].type===m.Integer?m.Integer:m.Number}])}if(g(r)&&g(a)){const e=r[4].value+a[4].value;return new n([p.Percentage,e.toString()+"%",r[2],a[3],{value:e}])}if(f(r)&&f(a)&&(a=convertUnit(r,a),toLowerCaseAZ(r[4].unit)===toLowerCaseAZ(a[4].unit))){const e=r[4].value+a[4].value;return new n([p.Dimension,e.toString()+r[4].unit,r[2],a[3],{value:e,type:r[4].type===m.Integer&&a[4].type===m.Integer?m.Integer:m.Number,unit:r[4].unit}])}return(C(r)&&(f(a)||g(a))||C(a)&&(f(r)||g(r)))&&t.onParseError?.(new ParseErrorWithComponentValues(I.UnexpectedAdditionOfDimensionOrPercentageWithNumber,e)),-1}function division(e){if(2!==e.length)return-1;const t=e[0].value,r=e[1].value;if(C(t)&&C(r)){const e=t[4].value/r[4].value;return new n([p.Number,e.toString(),t[2],r[3],{value:e,type:Number.isInteger(e)?m.Integer:m.Number}])}if(g(t)&&C(r)){const e=t[4].value/r[4].value;return new n([p.Percentage,e.toString()+"%",t[2],r[3],{value:e}])}if(f(t)&&C(r)){const e=t[4].value/r[4].value;return new n([p.Dimension,e.toString()+t[4].unit,t[2],r[3],{value:e,type:Number.isInteger(e)?m.Integer:m.Number,unit:t[4].unit}])}return-1}function isCalculation(e){return!!e&&"object"==typeof e&&"inputs"in e&&Array.isArray(e.inputs)&&"operation"in e}function solve(e,n){if(-1===e)return-1;const r=[];for(let a=0;a<e.inputs.length;a++){const u=e.inputs[a];if(t(u)){r.push(u);continue}const o=solve(u,n);if(-1===o)return-1;r.push(o)}return e.operation(r,n)}function multiplication(e){if(2!==e.length)return-1;const t=e[0].value,r=e[1].value;if(C(t)&&C(r)){const e=t[4].value*r[4].value;return new n([p.Number,e.toString(),t[2],r[3],{value:e,type:t[4].type===m.Integer&&r[4].type===m.Integer?m.Integer:m.Number}])}if(g(t)&&C(r)){const e=t[4].value*r[4].value;return new n([p.Percentage,e.toString()+"%",t[2],r[3],{value:e}])}if(C(t)&&g(r)){const e=t[4].value*r[4].value;return new n([p.Percentage,e.toString()+"%",t[2],r[3],{value:e}])}if(f(t)&&C(r)){const e=t[4].value*r[4].value;return new n([p.Dimension,e.toString()+t[4].unit,t[2],r[3],{value:e,type:t[4].type===m.Integer&&r[4].type===m.Integer?m.Integer:m.Number,unit:t[4].unit}])}if(C(t)&&f(r)){const e=t[4].value*r[4].value;return new n([p.Dimension,e.toString()+r[4].unit,t[2],r[3],{value:e,type:t[4].type===m.Integer&&r[4].type===m.Integer?m.Integer:m.Number,unit:r[4].unit}])}return-1}function resolveGlobalsAndConstants(e,r){for(let a=0;a<e.length;a++){const u=e[a];if(!t(u))continue;const o=u.value;if(!D(o))continue;const i=toLowerCaseAZ(o[4].value);switch(i){case"e":e.splice(a,1,new n([p.Number,Math.E.toString(),o[2],o[3],{value:Math.E,type:m.Number}]));break;case"pi":e.splice(a,1,new n([p.Number,Math.PI.toString(),o[2],o[3],{value:Math.PI,type:m.Number}]));break;case"infinity":e.splice(a,1,new n([p.Number,"infinity",o[2],o[3],{value:1/0,type:m.Number}]));break;case"-infinity":e.splice(a,1,new n([p.Number,"-infinity",o[2],o[3],{value:-1/0,type:m.Number}]));break;case"nan":e.splice(a,1,new n([p.Number,"NaN",o[2],o[3],{value:Number.NaN,type:m.Number}]));break;default:if(r.has(i)){const t=r.get(i);e.splice(a,1,new n(t))}}}return e}function unary(e){if(1!==e.length)return-1;const n=e[0].value;return h(n)?e[0]:-1}function resultToCalculation(e,n,t){return f(n)?dimensionToCalculation(e,n[4].unit,t):g(n)?percentageToCalculation(e,t):C(n)?numberToCalculation(e,t):-1}function dimensionToCalculation(e,t,r){const a=e.tokens();return{inputs:[new n([p.Dimension,r.toString()+t,a[0][2],a[a.length-1][3],{value:r,type:Number.isInteger(r)?m.Integer:m.Number,unit:t}])],operation:unary}}function percentageToCalculation(e,t){const r=e.tokens();return{inputs:[new n([p.Percentage,t.toString()+"%",r[0][2],r[r.length-1][3],{value:t}])],operation:unary}}function numberToCalculation(e,t){const r=e.tokens();return{inputs:[new n([p.Number,t.toString(),r[0][2],r[r.length-1][3],{value:t,type:Number.isInteger(t)?m.Integer:m.Number}])],operation:unary}}function solveACos(e,n){const t=n.value;if(!C(t))return-1;return dimensionToCalculation(e,"rad",Math.acos(t[4].value))}function solveASin(e,n){const t=n.value;if(!C(t))return-1;return dimensionToCalculation(e,"rad",Math.asin(t[4].value))}function solveATan(e,n){const t=n.value;if(!C(t))return-1;return dimensionToCalculation(e,"rad",Math.atan(t[4].value))}function isDimensionOrNumber(e){return f(e)||C(e)}function arrayOfSameNumeric(e){if(0===e.length)return!0;const n=e[0];if(!h(n))return!1;if(1===e.length)return!0;if(f(n)){const t=toLowerCaseAZ(n[4].unit);for(let r=1;r<e.length;r++){const a=e[r];if(n[0]!==a[0])return!1;if(t!==toLowerCaseAZ(a[4].unit))return!1}return!0}for(let t=1;t<e.length;t++){const r=e[t];if(n[0]!==r[0])return!1}return!0}function twoOfSameNumeric(e,n){return!!h(e)&&(f(e)?e[0]===n[0]&&toLowerCaseAZ(e[4].unit)===toLowerCaseAZ(n[4].unit):e[0]===n[0])}function solveATan2(e,n,t){const r=n.value;if(!isDimensionOrNumber(r))return-1;const a=convertUnit(r,t.value);if(!twoOfSameNumeric(r,a))return-1;return dimensionToCalculation(e,"rad",Math.atan2(r[4].value,a[4].value))}function solveAbs(e,n,t){const r=n.value;if(!h(r))return-1;if(!t.rawPercentages&&g(r))return-1;return resultToCalculation(e,r,Math.abs(r[4].value))}function solveClamp(e,n,r,a,u){if(!t(n)||!t(r)||!t(a))return-1;const o=n.value;if(!h(o))return-1;if(!u.rawPercentages&&g(o))return-1;const i=convertUnit(o,r.value);if(!twoOfSameNumeric(o,i))return-1;const l=convertUnit(o,a.value);if(!twoOfSameNumeric(o,l))return-1;return resultToCalculation(e,o,Math.max(o[4].value,Math.min(i[4].value,l[4].value)))}function solveCos(e,n){const t=n.value;if(!isDimensionOrNumber(t))return-1;let r=t[4].value;if(f(t))switch(t[4].unit.toLowerCase()){case"rad":break;case"deg":r=P.get("rad")(t[4].value);break;case"grad":r=k.get("rad")(t[4].value);break;case"turn":r=j.get("rad")(t[4].value);break;default:return-1}return r=Math.cos(r),numberToCalculation(e,r)}function solveExp(e,n){const t=n.value;if(!C(t))return-1;return numberToCalculation(e,Math.exp(t[4].value))}function solveHypot(e,n,r){if(!n.every(t))return-1;const a=n[0].value;if(!h(a))return-1;if(!r.rawPercentages&&g(a))return-1;const u=n.map(e=>convertUnit(a,e.value));if(!arrayOfSameNumeric(u))return-1;const o=u.map(e=>e[4].value),i=Math.hypot(...o);return resultToCalculation(e,a,i)}function solveMax(e,n,r){if(!n.every(t))return-1;const a=n[0].value;if(!h(a))return-1;if(!r.rawPercentages&&g(a))return-1;const u=n.map(e=>convertUnit(a,e.value));if(!arrayOfSameNumeric(u))return-1;const o=u.map(e=>e[4].value),i=Math.max(...o);return resultToCalculation(e,a,i)}function solveMin(e,n,r){if(!n.every(t))return-1;const a=n[0].value;if(!h(a))return-1;if(!r.rawPercentages&&g(a))return-1;const u=n.map(e=>convertUnit(a,e.value));if(!arrayOfSameNumeric(u))return-1;const o=u.map(e=>e[4].value),i=Math.min(...o);return resultToCalculation(e,a,i)}function solveMod(e,n,t){const r=n.value;if(!h(r))return-1;const a=convertUnit(r,t.value);if(!twoOfSameNumeric(r,a))return-1;let u;return u=0===a[4].value?Number.NaN:Number.isFinite(r[4].value)&&(Number.isFinite(a[4].value)||(a[4].value!==Number.POSITIVE_INFINITY||r[4].value!==Number.NEGATIVE_INFINITY&&!Object.is(0*r[4].value,-0))&&(a[4].value!==Number.NEGATIVE_INFINITY||r[4].value!==Number.POSITIVE_INFINITY&&!Object.is(0*r[4].value,0)))?Number.isFinite(a[4].value)?(r[4].value%a[4].value+a[4].value)%a[4].value:r[4].value:Number.NaN,resultToCalculation(e,r,u)}function solvePow(e,n,t){const r=n.value,a=t.value;if(!C(r))return-1;if(!twoOfSameNumeric(r,a))return-1;return numberToCalculation(e,Math.pow(r[4].value,a[4].value))}function solveRem(e,n,t){const r=n.value;if(!h(r))return-1;const a=convertUnit(r,t.value);if(!twoOfSameNumeric(r,a))return-1;let u;return u=0===a[4].value?Number.NaN:Number.isFinite(r[4].value)?Number.isFinite(a[4].value)?r[4].value%a[4].value:r[4].value:Number.NaN,resultToCalculation(e,r,u)}function snapAsBorderWidth(e,n,t){if(!f(n))return-1;const r=t.devicePixelLength??1,a=[p.Dimension,`${r}px`,n[2],n[3],{value:r,type:m.Integer,unit:"px"}],u=convertUnit(a,n);if(!twoOfSameNumeric(u,a))return-1;if(Number.isInteger(u[4].value/r))return resultToCalculation(e,n,n[4].value);if(u[4].value>0){if(u[4].value<r)return resultToCalculation(e,n,convertUnit(n,a)[4].value);const t=Math.floor(u[4].value/a[4].value)*a[4].value;return u[4].value=t,resultToCalculation(e,n,convertUnit(n,u)[4].value)}if(Math.abs(u[4].value)<r)return resultToCalculation(e,n,-1*convertUnit(n,a)[4].value);const o=Math.ceil(u[4].value/a[4].value)*a[4].value;return u[4].value=o,resultToCalculation(e,n,convertUnit(n,u)[4].value)}function solveRound(e,n,t,r,a){const u=t.value;if(!h(u))return-1;if("line-width"===n&&!f(u))return-1;if(!a.rawPercentages&&g(u))return-1;const o=convertUnit(u,r.value);if(!twoOfSameNumeric(u,o))return-1;let i;if(0===o[4].value)i=Number.NaN;else if(Number.isFinite(u[4].value)||Number.isFinite(o[4].value))if(!Number.isFinite(u[4].value)&&Number.isFinite(o[4].value))i=u[4].value;else if(Number.isFinite(u[4].value)&&!Number.isFinite(o[4].value))switch(n){case"down":i=u[4].value<0?-1/0:Object.is(-0,0*u[4].value)?-0:0;break;case"up":i=u[4].value>0?1/0:Object.is(0,0*u[4].value)?0:-0;break;default:i=Object.is(0,0*u[4].value)?0:-0}else switch(n){case"down":i=Math.floor(u[4].value/o[4].value)*o[4].value;break;case"up":i=Math.ceil(u[4].value/o[4].value)*o[4].value;break;case"to-zero":i=Math.trunc(u[4].value/o[4].value)*o[4].value;break;default:{let t=Math.floor(u[4].value/o[4].value)*o[4].value,r=Math.ceil(u[4].value/o[4].value)*o[4].value;if(t>r){const e=t;t=r,r=e}const l=Math.abs(u[4].value-t),c=Math.abs(u[4].value-r);if(i="line-width"===n&&u[4].value>=0&&(0===r||0===t)?0!==r?r:t:l===c?r:l<c?t:r,"line-width"===n){const n=solve(resultToCalculation(e,u,i),a);return-1===n?-1:snapAsBorderWidth(e,n.value,a)}break}}else i=Number.NaN;return resultToCalculation(e,u,i)}function solveSign(e,n,t){const r=n.value;if(!h(r))return-1;if(!t.rawPercentages&&g(r))return-1;return numberToCalculation(e,Math.sign(r[4].value))}function solveSin(e,n){const t=n.value;if(!isDimensionOrNumber(t))return-1;let r=t[4].value;if(f(t))switch(toLowerCaseAZ(t[4].unit)){case"rad":break;case"deg":r=P.get("rad")(t[4].value);break;case"grad":r=k.get("rad")(t[4].value);break;case"turn":r=j.get("rad")(t[4].value);break;default:return-1}return r=Math.sin(r),numberToCalculation(e,r)}function solveSqrt(e,n){const t=n.value;if(!C(t))return-1;return numberToCalculation(e,Math.sqrt(t[4].value))}function solveTan(e,n){const t=n.value;if(!isDimensionOrNumber(t))return-1;const r=t[4].value;let a=0,u=t[4].value;if(f(t))switch(toLowerCaseAZ(t[4].unit)){case"rad":a=G.get("deg")(r);break;case"deg":a=r,u=P.get("rad")(r);break;case"grad":a=k.get("deg")(r),u=k.get("rad")(r);break;case"turn":a=j.get("deg")(r),u=j.get("rad")(r);break;default:return-1}const o=a/90;return u=a%90==0&&o%2!=0?o>0?1/0:-1/0:Math.tan(u),numberToCalculation(e,u)}function subtraction(e,t){if(2!==e.length)return-1;const r=e[0].value;let a=e[1].value;if(C(r)&&C(a)){const e=r[4].value-a[4].value;return new n([p.Number,e.toString(),r[2],a[3],{value:e,type:r[4].type===m.Integer&&a[4].type===m.Integer?m.Integer:m.Number}])}if(g(r)&&g(a)){const e=r[4].value-a[4].value;return new n([p.Percentage,e.toString()+"%",r[2],a[3],{value:e}])}if(f(r)&&f(a)&&(a=convertUnit(r,a),toLowerCaseAZ(r[4].unit)===toLowerCaseAZ(a[4].unit))){const e=r[4].value-a[4].value;return new n([p.Dimension,e.toString()+r[4].unit,r[2],a[3],{value:e,type:r[4].type===m.Integer&&a[4].type===m.Integer?m.Integer:m.Number,unit:r[4].unit}])}return(C(r)&&(f(a)||g(a))||C(a)&&(f(r)||g(r)))&&t.onParseError?.(new ParseErrorWithComponentValues(I.UnexpectedSubtractionOfDimensionOrPercentageWithNumber,e)),-1}function solveLog(e,n){if(1===n.length){const r=n[0];if(!r||!t(r))return-1;const a=r.value;if(!C(a))return-1;return numberToCalculation(e,Math.log(a[4].value))}if(2===n.length){const r=n[0];if(!r||!t(r))return-1;const a=r.value;if(!C(a))return-1;const u=n[1];if(!u||!t(u))return-1;const o=u.value;if(!C(o))return-1;return numberToCalculation(e,Math.log(a[4].value)/Math.log(o[4].value))}return-1}const _=/^none$/i;function isNone(e){if(Array.isArray(e)){const n=e.filter(e=>!(r(e)&&a(e)));return 1===n.length&&isNone(n[0])}if(!t(e))return!1;const n=e.value;return!!D(n)&&_.test(n[4].value)}const H=String.fromCodePoint(0);function solveRandom(e,n,t,r,a,u){if(-1===n.fixed&&!u.randomCaching)return-1;u.randomCaching||(u.randomCaching={propertyName:"",propertyN:0,elementID:"",documentID:""}),u.randomCaching&&!u.randomCaching.propertyN&&(u.randomCaching.propertyN=0);const o=t.value;if(!h(o))return-1;const i=convertUnit(o,r.value);if(!twoOfSameNumeric(o,i))return-1;let l=null;if(a&&(l=convertUnit(o,a.value),!twoOfSameNumeric(o,l)))return-1;if(!Number.isFinite(o[4].value))return resultToCalculation(e,o,Number.NaN);if(!Number.isFinite(i[4].value))return resultToCalculation(e,o,Number.NaN);if(!Number.isFinite(i[4].value-o[4].value))return resultToCalculation(e,o,Number.NaN);if(l&&!Number.isFinite(l[4].value))return resultToCalculation(e,o,o[4].value);const c=-1===n.fixed?sfc32(crc32([n.dashedIdent?n.dashedIdent:"",n.elementScoped?u.randomCaching.elementID:"",n.propertyScoped||n.propertyIndexScoped?u.randomCaching.propertyName:"",n.propertyIndexScoped?u.randomCaching.propertyN:"",u.randomCaching.documentID].join(H))):()=>n.fixed;let s=o[4].value,v=i[4].value;if(s>v&&([s,v]=[v,s]),l&&(l[4].value<=0||Math.abs(s-v)/l[4].value>1e10)&&(l=null),l){const n=Math.max(l[4].value/1e3,1e-9),t=[s];let r=0;for(;;){r+=l[4].value;const e=s+r;if(!(e+n<v)){t.push(v);break}if(t.push(e),e+l[4].value-n>v)break}const a=c();return resultToCalculation(e,o,Number(t[Math.floor(t.length*a)].toFixed(5)))}const f=c();return resultToCalculation(e,o,Number((f*(v-s)+s).toFixed(5)))}function sfc32(e=.34944106645296036,n=.19228640875738723,t=.8784393832007205,r=.04850964319275053){return()=>{const a=((e|=0)+(n|=0)|0)+(r|=0)|0;return r=r+1|0,e=n^n>>>9,n=(t|=0)+(t<<3)|0,t=(t=t<<21|t>>>11)+a|0,(a>>>0)/4294967296}}function crc32(e){let n,t,r=0;r^=-1;for(let a=0,u=e.length;a<u;a++)t=255&(r^e.charCodeAt(a)),n=Number("0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substring(9*t,9*t+8)),r=r>>>8^n;return(-1^r)>>>0}function solveCalcMix(e,n){const t=n[0].calcSum.value;if(!h(t))return-1;const r=n.map(e=>({calcSum:convertUnit(t,e.calcSum.value),percentage:e.percentage}));if(!arrayOfSameNumeric(r.map(e=>e.calcSum)))return-1;const{items:a}=normalizeMixPercentages(r,!1),u=a.map(e=>e.calcSum[4].value*e.percentage/100);let o=0;for(let e=0;e<u.length;e++)o+=u[e];return resultToCalculation(e,t,o)}function normalizeMixPercentages(e,n=!1){let t=0,r=0;for(const n of e)n.percentage&&(t+=n.percentage),!1===n.percentage&&r++;t=Math.min(100,t);for(const n of e)!1===n.percentage&&(n.percentage=(100-t)/r);const a=e.slice();let u=0;for(const e of a)u+=e.percentage;if(u>100||u>0&&n)for(const e of a)e.percentage=e.percentage*(100/u);let o=0;return u<100&&(o=100-u),{items:a,leftover:o}}const J=new Map([["abs",function abs(e,n,t){return singleNodeSolver(e,n,t,solveAbs)}],["acos",function acos(e,n,t){return singleNodeSolver(e,n,t,solveACos)}],["asin",function asin(e,n,t){return singleNodeSolver(e,n,t,solveASin)}],["atan",function atan(e,n,t){return singleNodeSolver(e,n,t,solveATan)}],["atan2",function atan2(e,n,t){return twoCommaSeparatedNodesSolver(e,n,t,solveATan2)}],["calc",calc$1],["calc-mix",function calcMix(e,n,t){const r=variadicArgumentsCalcMix(e,e.value,n,t);if(-1===r)return-1;return solveCalcMix(e,r)}],["clamp",function clamp(r,a,o){const i=resolveGlobalsAndConstants([...r.value.filter(e=>!u(e))],a),c=[],s=[],v=[];{let e=c;for(let n=0;n<i.length;n++){const r=i[n];if(t(r)&&A(r.value)){if(e===v)return-1;if(e===s){e=v;continue}if(e===c){e=s;continue}return-1}e.push(r)}}const f=isNone(c),m=isNone(v);if(f&&m)return calc$1(calcWrapper(r,s),a,o);const d=solve(calc$1(calcWrapper(r,s),a,o),o);if(-1===d)return-1;if(f){const t=solve(calc$1(calcWrapper(r,v),a,o),o);return-1===t?-1:solveMin((C=r,g=d,D=t,new l([p.Function,"min(",C.name[2],C.name[3],{value:"min"}],[p.CloseParen,")",C.endToken[2],C.endToken[3],void 0],[g,new n([p.Comma,",",...e(g),void 0]),D])),[d,t],o)}if(m){const e=solve(calc$1(calcWrapper(r,c),a,o),o);return-1===e?-1:solveMax(maxWrapper(r,e,d),[e,d],o)}var C,g,D;const h=solve(calc$1(calcWrapper(r,c),a,o),o);if(-1===h)return-1;const N=solve(calc$1(calcWrapper(r,v),a,o),o);if(-1===N)return-1;return solveClamp(r,h,d,N,o)}],["cos",function cos(e,n,t){return singleNodeSolver(e,n,t,solveCos)}],["exp",function exp(e,n,t){return singleNodeSolver(e,n,t,solveExp)}],["hypot",function hypot(e,n,t){return variadicNodesSolver(e,n,t,solveHypot)}],["log",function log(e,n,t){return variadicNodesSolver(e,n,t,solveLog)}],["max",function max(e,n,t){return variadicNodesSolver(e,n,t,solveMax)}],["min",function min(e,n,t){return variadicNodesSolver(e,n,t,solveMin)}],["mod",function mod(e,n,t){return twoCommaSeparatedNodesSolver(e,n,t,solveMod)}],["pow",function pow(e,n,t){return twoCommaSeparatedNodesSolver(e,n,t,solvePow)}],["random",function random(e,n,t){const r=parseRandomValueSharing(e,e.value.filter(e=>!u(e)),n,t);if(-1===r)return-1;const[a,o]=r,i=variadicArguments(e,o,n,t);if(-1===i)return-1;const[l,c,s]=i;if(!l||!c)return-1;return solveRandom(e,a,l,c,s,t)}],["rem",function rem(e,n,t){return twoCommaSeparatedNodesSolver(e,n,t,solveRem)}],["round",function round(e,r,a){const o=resolveGlobalsAndConstants([...e.value.filter(e=>!u(e))],r);let i="",l=!1;const c=[],s=[];{let e=c;for(let n=0;n<o.length;n++){const r=o[n];if(!i&&0===c.length&&0===s.length&&t(r)&&D(r.value)){const e=r.value[4].value.toLowerCase();if(K.has(e)){i=e;continue}}if(t(r)&&A(r.value)){if(e===s)return-1;if(e===c&&i&&0===c.length)continue;if(e===c){l=!0,e=s;continue}return-1}e.push(r)}}const v=solve(calc$1(calcWrapper(e,c),r,a),a);if(-1===v)return-1;if("line-width"===i){const e=convertUnit([p.Dimension,"1px",v.value[2],v.value[3],{value:1,type:m.Integer,unit:"px"}],v.value);if(!f(e)||"px"!==e[4].unit)return-1}if(!l&&0===s.length){if("line-width"===i)return snapAsBorderWidth(e,v.value,a);s.push(new n([p.Number,"1",v.value[2],v.value[3],{value:1,type:m.Integer}]))}const d=solve(calc$1(calcWrapper(e,s),r,a),a);if(-1===d)return-1;i||(i="nearest");return solveRound(e,i,v,d,a)}],["sign",function sign(e,n,t){return singleNodeSolver(e,n,t,solveSign)}],["sin",function sin(e,n,t){return singleNodeSolver(e,n,t,solveSin)}],["sqrt",function sqrt(e,n,t){return singleNodeSolver(e,n,t,solveSqrt)}],["tan",function tan(e,n,t){return singleNodeSolver(e,n,t,solveTan)}]]);function calc$1(e,n,r){const a=resolveGlobalsAndConstants([...e.value.filter(e=>!u(e))],n);if(1===a.length&&t(a[0]))return{inputs:[a[0]],operation:unary};let l=0;for(;l<a.length;){const e=a[l];if(o(e)&&N(e.startToken)){const t=calc$1(e,n,r);if(-1===t)return-1;a.splice(l,1,t);continue}if(i(e)){const t=J.get(e.getName().toLowerCase());if(!t)return-1;const u=t(e,n,r);if(-1===u)return-1;a.splice(l,1,u);continue}l++}if(l=0,1===a.length&&isCalculation(a[0]))return a[0];for(;l<a.length;){const e=a[l];if(!e||!t(e)&&!isCalculation(e)){l++;continue}const n=a[l+1];if(!n||!t(n)){l++;continue}const r=n.value;if(!B(r)||"*"!==r[4].value&&"/"!==r[4].value){l++;continue}const u=a[l+2];if(!u||!t(u)&&!isCalculation(u))return-1;"*"!==r[4].value?"/"!==r[4].value?l++:a.splice(l,3,{inputs:[e,u],operation:division}):a.splice(l,3,{inputs:[e,u],operation:multiplication})}if(l=0,1===a.length&&isCalculation(a[0]))return a[0];for(;l<a.length;){const e=a[l];if(!e||!t(e)&&!isCalculation(e)){l++;continue}const n=a[l+1];if(!n||!t(n)){l++;continue}const r=n.value;if(!B(r)||"+"!==r[4].value&&"-"!==r[4].value){l++;continue}const u=a[l+2];if(!u||!t(u)&&!isCalculation(u))return-1;"+"!==r[4].value?"-"!==r[4].value?l++:a.splice(l,3,{inputs:[e,u],operation:subtraction}):a.splice(l,3,{inputs:[e,u],operation:addition})}return 1===a.length&&isCalculation(a[0])?a[0]:-1}function singleNodeSolver(e,n,t,r){const a=singleArgument(e,n,t);return-1===a?-1:r(e,a,t)}function singleArgument(e,n,t){const r=resolveGlobalsAndConstants([...e.value.filter(e=>!u(e))],n),a=solve(calc$1(calcWrapper(e,r),n,t),t);return-1===a?-1:a}function twoCommaSeparatedNodesSolver(e,n,t,r){const a=twoCommaSeparatedArguments(e,n,t);if(-1===a)return-1;const[u,o]=a;return r(e,u,o,t)}function twoCommaSeparatedArguments(e,n,r){const a=resolveGlobalsAndConstants([...e.value.filter(e=>!u(e))],n),o=[],i=[];{let e=o;for(let n=0;n<a.length;n++){const r=a[n];if(t(r)&&A(r.value)){if(e===i)return-1;if(e===o){e=i;continue}return-1}e.push(r)}}const l=solve(calc$1(calcWrapper(e,o),n,r),r);if(-1===l)return-1;const c=solve(calc$1(calcWrapper(e,i),n,r),r);return-1===c?-1:[l,c]}function variadicNodesSolver(e,n,t,r){const a=variadicArguments(e,e.value,n,t);return-1===a?-1:r(e,a,t)}function variadicArguments(e,n,r,a){const o=resolveGlobalsAndConstants([...n.filter(e=>!u(e))],r),i=[];{const n=[];let u=[];for(let e=0;e<o.length;e++){const r=o[e];t(r)&&A(r.value)?(n.push(u),u=[]):u.push(r)}n.push(u);for(let t=0;t<n.length;t++){if(0===n[t].length)return-1;const u=solve(calc$1(calcWrapper(e,n[t]),r,a),a);if(-1===u)return-1;i.push(u)}}return i}function variadicArgumentsCalcMix(e,n,r,a){const o=resolveGlobalsAndConstants([...n.filter(e=>!u(e))],r),i=[];{const n=[];let l=[];for(let e=0;e<o.length;e++){const r=o[e];t(r)&&A(r.value)?(n.push(l),l=[]):l.push(r)}n.push(l);for(let o=0;o<n.length;o++){if(0===n[o].length)return-1;let l=-1,c=!1;for(let i=n[o].length-1;i>=0;i--){if(u(n[o][i]))continue;if(l=solve(calc$1(calcWrapper(e,n[o].slice(0,i+1)),r,a),a),-1===l)continue;const s=n[o].slice(i+1).filter(e=>!u(e));if(s.length)if(1===s.length&&t(s[0])&&g(s[0].value)){if(c=s[0].value[4].value,c<0||c>100)return-1}else{const n=solve(calc$1(calcWrapper(e,s),r,a),a);if(-1===n)return-1;if(!g(n.value))return-1;c=n.value[4].value,c=Math.min(100,Math.max(0,c))}break}if(-1===l)return-1;i.push({calcSum:l,percentage:c})}}return i}const K=new Set(["nearest","line-width","up","down","to-zero"]);function parseRandomValueSharing(e,n,r,a){const u={dashedIdent:"",fixed:-1,elementScoped:!1,propertyScoped:!1,propertyIndexScoped:!1};let o=!1;const i=n[0];if(!t(i)||!D(i.value))return[u,n];for(let i=0;i<n.length;i++){const l=n[i];if(!t(l))return-1;if(A(l.value))return[u,n.slice(i+1)];if(!D(l.value))return-1;const c=l.value[4].value.toLowerCase();if("element-scoped"!==c)if("property-scoped"!==c)if("property-index-scoped"!==c){if("fixed"===c){if(-1!==u.fixed||o||u.dashedIdent||u.elementScoped||u.propertyScoped||u.propertyIndexScoped)return-1;i++;const t=n[i];if(!t)return-1;const l=solve(calc$1(calcWrapper(e,[t]),r,a),a);if(-1===l)return-1;if(!C(l.value))return-1;if(l.value[4].value<0||l.value[4].value>1)return-1;u.fixed=Math.max(0,Math.min(l.value[4].value,1-1e-9));continue}if("auto"!==c){if(!c.startsWith("--"))return-1;if(-1!==u.fixed||o||u.dashedIdent)return-1;u.dashedIdent=c}else{if(-1!==u.fixed||o||u.dashedIdent||u.elementScoped||u.propertyScoped||u.propertyIndexScoped)return-1;u.elementScoped=!0,u.propertyIndexScoped=!0,o=!0}}else{if(-1!==u.fixed||o||u.propertyScoped||u.propertyIndexScoped)return-1;u.propertyIndexScoped=!0}else{if(-1!==u.fixed||o||u.propertyScoped||u.propertyIndexScoped)return-1;u.propertyScoped=!0}else{if(-1!==u.fixed||o||u.elementScoped)return-1;u.elementScoped=!0}}return-1}function calcWrapper(e,n){return new l([p.Function,"calc(",e.name[2],e.name[3],{value:"calc"}],[p.CloseParen,")",e.endToken[2],e.endToken[3],void 0],n)}function maxWrapper(t,r,a){return new l([p.Function,"max(",t.name[2],t.name[3],{value:"max"}],[p.CloseParen,")",t.endToken[2],t.endToken[3],void 0],[r,new n([p.Comma,",",...e(r),void 0]),a])}function patchNaN(e){if(-1===e)return-1;if(i(e))return e;const t=e.value;return h(t)&&Number.isNaN(t[4].value)?C(t)?new l([p.Function,"calc(",t[2],t[3],{value:"calc"}],[p.CloseParen,")",t[2],t[3],void 0],[new n([p.Ident,"NaN",t[2],t[3],{value:"NaN"}])]):f(t)?new l([p.Function,"calc(",t[2],t[3],{value:"calc"}],[p.CloseParen,")",t[2],t[3],void 0],[new n([p.Ident,"NaN",t[2],t[3],{value:"NaN"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Delim,"*",t[2],t[3],{value:"*"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Dimension,"1"+t[4].unit,t[2],t[3],{value:1,type:m.Integer,unit:t[4].unit}])]):g(t)?new l([p.Function,"calc(",t[2],t[3],{value:"calc"}],[p.CloseParen,")",t[2],t[3],void 0],[new n([p.Ident,"NaN",t[2],t[3],{value:"NaN"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Delim,"*",t[2],t[3],{value:"*"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Percentage,"1%",t[2],t[3],{value:1}])]):-1:e}function patchInfinity(e){if(-1===e)return-1;if(i(e))return e;const t=e.value;if(!h(t))return e;if(Number.isFinite(t[4].value)||Number.isNaN(t[4].value))return e;let r="";return Number.NEGATIVE_INFINITY===t[4].value&&(r="-"),C(t)?new l([p.Function,"calc(",t[2],t[3],{value:"calc"}],[p.CloseParen,")",t[2],t[3],void 0],[new n([p.Ident,r+"infinity",t[2],t[3],{value:r+"infinity"}])]):f(t)?new l([p.Function,"calc(",t[2],t[3],{value:"calc"}],[p.CloseParen,")",t[2],t[3],void 0],[new n([p.Ident,r+"infinity",t[2],t[3],{value:r+"infinity"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Delim,"*",t[2],t[3],{value:"*"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Dimension,"1"+t[4].unit,t[2],t[3],{value:1,type:m.Integer,unit:t[4].unit}])]):new l([p.Function,"calc(",t[2],t[3],{value:"calc"}],[p.CloseParen,")",t[2],t[3],void 0],[new n([p.Ident,r+"infinity",t[2],t[3],{value:r+"infinity"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Delim,"*",t[2],t[3],{value:"*"}]),new c([[p.Whitespace," ",t[2],t[3],void 0]]),new n([p.Percentage,"1%",t[2],t[3],{value:1}])])}function patchMinusZero(e){if(-1===e)return-1;if(i(e))return e;const n=e.value;return h(n)&&Object.is(-0,n[4].value)?("-0"===n[1]||(g(n)?n[1]="-0%":f(n)?n[1]="-0"+n[4].unit:n[1]="-0"),e):e}function patchPrecision(e,n=13){if(-1===e)return-1;if(n<=0)return e;if(i(e))return e;const t=e.value;if(!h(t))return e;if(Number.isInteger(t[4].value))return e;const r=Number(t[4].value.toFixed(n)).toString();return C(t)?t[1]=r:g(t)?t[1]=r+"%":f(t)&&(t[1]=r+t[4].unit),e}function patchCanonicalUnit(e){return-1===e?-1:i(e)?e:f(e.value)?(e.value=toCanonicalUnit(e.value),e):e}function patchCalcResult(e,n){let t=e;return n?.toCanonicalUnits&&(t=patchCanonicalUnit(t)),t=patchPrecision(t,n?.precision),t=patchMinusZero(t),n?.censorIntoStandardRepresentableValues||(t=patchNaN(t),t=patchInfinity(t)),t}function tokenizeGlobals(e){const n=new Map;if(!e)return n;for(const[t,r]of e)if(b(r))n.set(t,r);else if("string"==typeof r){const e=F({css:r}),a=e.nextToken();if(e.nextToken(),!e.endOfFile())continue;if(!h(a))continue;n.set(t,a);continue}return n}function calc(e,n){return calcFromComponentValues(s(w({css:e}),{}),n).map(e=>e.map(e=>E(...e.tokens())).join("")).join(",")}function calcFromComponentValues(e,n){const t=tokenizeGlobals(n?.globals);return replaceComponentValues(e,e=>{if(!i(e))return;const r=J.get(e.getName().toLowerCase());if(!r)return;const a=patchCalcResult(solve(r(e,t,n??{}),n??{}),n);return-1!==a?a:void 0})}function replaceComponentValues(n,r){for(let a=0;a<n.length;a++){const o=n[a];v(o,(n,a)=>{if("number"!=typeof a)return;const o=r(n.node);if(!o)return;const i=[o],l=n.parent.value[a-1];t(l)&&B(l.value)&&("-"===l.value[4].value||"+"===l.value[4].value)&&i.splice(0,0,new c([[p.Whitespace," ",...e(n.node),void 0]]));const s=n.parent.value[a+1];!s||u(s)||t(s)&&(A(s.value)||S(s.value)||y(s.value)||B(s.value)&&"-"!==s.value[4].value&&"+"!==s.value[4].value)||i.push(new c([[p.Whitespace," ",...e(n.node),void 0]])),n.parent.value.splice(a,1,...i)})}return n}const Q=new Set(J.keys());export{ParseError,I as ParseErrorMessage,ParseErrorWithComponentValues,calc,calcFromComponentValues,Q as mathFunctionNames};
node_modules/@csstools/css-calc/package.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@csstools/css-calc",
3
+ "description": "Solve CSS math expressions",
4
+ "version": "3.3.0",
5
+ "contributors": [
6
+ {
7
+ "name": "Antonio Laguna",
8
+ "email": "antonio@laguna.es",
9
+ "url": "https://antonio.laguna.es"
10
+ },
11
+ {
12
+ "name": "Romain Menke",
13
+ "email": "romainmenke@gmail.com"
14
+ }
15
+ ],
16
+ "license": "MIT",
17
+ "funding": [
18
+ {
19
+ "type": "github",
20
+ "url": "https://github.com/sponsors/csstools"
21
+ },
22
+ {
23
+ "type": "opencollective",
24
+ "url": "https://opencollective.com/csstools"
25
+ }
26
+ ],
27
+ "engines": {
28
+ "node": ">=20.19.0"
29
+ },
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.mjs"
35
+ }
36
+ },
37
+ "files": [
38
+ "CHANGELOG.md",
39
+ "LICENSE.md",
40
+ "README.md",
41
+ "dist"
42
+ ],
43
+ "peerDependencies": {
44
+ "@csstools/css-parser-algorithms": "^4.0.0",
45
+ "@csstools/css-tokenizer": "^4.0.0"
46
+ },
47
+ "scripts": {},
48
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc#readme",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
52
+ "directory": "packages/css-calc"
53
+ },
54
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
55
+ "keywords": [
56
+ "calc",
57
+ "css"
58
+ ]
59
+ }
node_modules/@csstools/css-color-parser/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changes to CSS Color Parser
2
+
3
+ ### 4.2.0
4
+
5
+ _August 15, 2026_
6
+
7
+ - Add `computedValue()` serialization function for color data.
8
+ - Mandatory `alpha` in the relative `alpha()` function.
9
+ - Updated [`@csstools/color-helpers`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers) to [`6.1.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md#611) (patch)
10
+
11
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md)
node_modules/@csstools/css-color-parser/LICENSE.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
node_modules/@csstools/css-color-parser/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CSS Color Parser <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
2
+
3
+ [<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-color-parser.svg" height="20">][npm-url]
4
+ [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
5
+ [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
6
+
7
+ ## Usage
8
+
9
+ Add [CSS Color Parser] to your project:
10
+
11
+ ```bash
12
+ npm install @csstools/css-color-parser @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
13
+ ```
14
+
15
+ ```ts
16
+ import { color } from '@csstools/css-color-parser';
17
+ import { isFunctionNode, parseComponentValue } from '@csstools/css-parser-algorithms';
18
+ import { serializeRGB } from '@csstools/css-color-parser';
19
+ import { tokenize } from '@csstools/css-tokenizer';
20
+
21
+ // color() expects a parsed component value.
22
+ const hwbComponentValue = parseComponentValue(tokenize({ css: 'hwb(10deg 10% 20%)' }));
23
+ const colorData = color(hwbComponentValue);
24
+ if (colorData) {
25
+ console.log(colorData);
26
+
27
+ // serializeRGB() returns a component value.
28
+ const rgbComponentValue = serializeRGB(colorData);
29
+ console.log(rgbComponentValue.toString());
30
+ }
31
+ ```
32
+
33
+ [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
34
+ [discord]: https://discord.gg/bUadyRwkJS
35
+ [npm-url]: https://www.npmjs.com/package/@csstools/css-color-parser
36
+
37
+ [CSS Color Parser]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser
node_modules/@csstools/css-color-parser/dist/index.d.ts ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Color } from '@csstools/color-helpers';
2
+ import type { ComponentValue } from '@csstools/css-parser-algorithms';
3
+ import { FunctionNode } from '@csstools/css-parser-algorithms';
4
+
5
+ /**
6
+ * Convert a color function to a `ColorData` object.
7
+ *
8
+ * @param {ComponentValue} colorNode - The color function to be converted.
9
+ * @returns {ColorData|false} The color function as a `ColorData` object or `false` if it could not be converted.
10
+ */
11
+ export declare function color(colorNode: ComponentValue): ColorData | false;
12
+
13
+ /**
14
+ * A color data object.
15
+ * It contains as much information as possible about the color and the original parsed syntax.
16
+ */
17
+ export declare interface ColorData {
18
+ /**
19
+ * The color notation of the color data.
20
+ *
21
+ * We use "color notation" and not "color space" because these represent the original notation and not the actual color space.
22
+ * The actual color space is however always implied by the color notation.
23
+ */
24
+ colorNotation: ColorNotation;
25
+ /**
26
+ * The color channels.
27
+ * This is always an array of three numbers
28
+ * but the channels can only be interpreted by looking at the color notation.
29
+ */
30
+ channels: Color;
31
+ /**
32
+ * The alpha channel.
33
+ * This is either a number between `0` and `1` or a `ComponentValue` object.
34
+ *
35
+ * Since most computations are not dependent on the alpha channel,
36
+ * we allow things like `var(--some-alpha)` as an alpha channel value for most inputs.
37
+ */
38
+ alpha: number | ComponentValue;
39
+ /**
40
+ * Information about the original syntax.
41
+ */
42
+ syntaxFlags: Set<SyntaxFlag>;
43
+ }
44
+
45
+ /**
46
+ * Check if a color data object fits the `display-p3` gamut.
47
+ *
48
+ * @param {ColorData} x - The color data to be checked.
49
+ * @returns {boolean} Whether the color data fits the `display-p3` gamut.
50
+ */
51
+ export declare function colorDataFitsDisplayP3_Gamut(x: ColorData): boolean;
52
+
53
+ /**
54
+ * Check if a color data object fits the `sRGB` gamut.
55
+ *
56
+ * @param {ColorData} x - The color data to be checked.
57
+ * @returns {boolean} Whether the color data fits the `sRGB` gamut.
58
+ */
59
+ export declare function colorDataFitsRGB_Gamut(x: ColorData): boolean;
60
+
61
+ export declare enum ColorNotation {
62
+ /** Adobe 1999, expressed through `color(a98-rgb 0 0 0)` */
63
+ A98_RGB = "a98-rgb",
64
+ /** Display P3, expressed through `color(display-p3 0 0 0)` */
65
+ Display_P3 = "display-p3",
66
+ /** Display P3, expressed through `color(display-p3-linear 0 0 0)` */
67
+ Linear_Display_P3 = "display-p3-linear",
68
+ /** Hex, expressed through `#000` */
69
+ HEX = "hex",
70
+ /** HSL, expressed through `hsl(0 0% 0%)` */
71
+ HSL = "hsl",
72
+ /** HWB, expressed through `hwb(0 0% 0%)` */
73
+ HWB = "hwb",
74
+ /** LCH, expressed through `lch(0 0% 0deg)` */
75
+ LCH = "lch",
76
+ /** Lab, expressed through `lab(0 0 0)` */
77
+ Lab = "lab",
78
+ /** Linear sRGB, expressed through `color(linear-srgb 0 0 0)` */
79
+ Linear_sRGB = "srgb-linear",
80
+ /** Oklch, expressed through `oklch(0 0% 0deg)` */
81
+ OKLCH = "oklch",
82
+ /** Oklab, expressed through `oklab(0 0 0)` */
83
+ OKLab = "oklab",
84
+ /** ProPhoto RGB, expressed through `color(prophoto-rgb 0 0 0)` */
85
+ ProPhoto_RGB = "prophoto-rgb",
86
+ /** RGB, expressed through `rgb(0 0 0)` */
87
+ RGB = "rgb",
88
+ /** sRGB, expressed through `color(srgb 0 0 0)` */
89
+ sRGB = "srgb",
90
+ /** Rec. 2020, expressed through `color(rec2020 0 0 0)` */
91
+ Rec2020 = "rec2020",
92
+ /** XYZ, expressed through `color(xyz-d50 0 0 0)` */
93
+ XYZ_D50 = "xyz-d50",
94
+ /** XYZ, expressed through `color(xyz-d65 0 0 0)` */
95
+ XYZ_D65 = "xyz-d65"
96
+ }
97
+
98
+ export declare function computedValue(color: ColorData, convertHslOrHwbToRGB?: boolean): string;
99
+
100
+ export declare function serializeHSL(color: ColorData, gamutMapping?: boolean): FunctionNode;
101
+
102
+ /**
103
+ * Convert color data to component values in the OKLCH color space.
104
+ * The return value can be converted to a string by calling `toString()` on it.
105
+ *
106
+ * @param {ColorData} color - The color data to be serialized.
107
+ * @returns {FunctionNode} The serialized color data as a FunctionNode object.
108
+ */
109
+ export declare function serializeOKLCH(color: ColorData): FunctionNode;
110
+
111
+ /**
112
+ * Convert color data to component values in the display-p3 color space.
113
+ * The return value can be converted to a string by calling `toString()` on it.
114
+ *
115
+ * @param {ColorData} color - The color data to be serialized.
116
+ * @param {boolean} gamutMapping - Whether to perform gamut mapping, defaults to `true`.
117
+ * @returns {FunctionNode} The serialized color data as a FunctionNode object.
118
+ */
119
+ export declare function serializeP3(color: ColorData, gamutMapping?: boolean): FunctionNode;
120
+
121
+ /**
122
+ * Convert color data to component values in the srgb color space.
123
+ * The return value can be converted to a string by calling `toString()` on it.
124
+ *
125
+ * @param {ColorData} color - The color data to be serialized.
126
+ * @param {boolean} gamutMapping - Whether to perform gamut mapping, defaults to `true`.
127
+ * @returns {FunctionNode} The serialized color data as a FunctionNode object.
128
+ */
129
+ export declare function serializeRGB(color: ColorData, gamutMapping?: boolean): FunctionNode;
130
+
131
+ export declare enum SyntaxFlag {
132
+ /** Is a color keyword, e.g. `transparent`, `currentColor`, ... */
133
+ ColorKeyword = "color-keyword",
134
+ /** Has an explicit alpha channel */
135
+ HasAlpha = "has-alpha",
136
+ /** Has a channel with a dimension value, e.g. `50deg` */
137
+ HasDimensionValues = "has-dimension-values",
138
+ /** Has a channel with the `none` keyword */
139
+ HasNoneKeywords = "has-none-keywords",
140
+ /** Has a channel with a number value */
141
+ HasNumberValues = "has-number-values",
142
+ /** Has an alpha channel with a percentage value */
143
+ HasPercentageAlpha = "has-percentage-alpha",
144
+ /** Has a channel with a percentage value */
145
+ HasPercentageValues = "has-percentage-values",
146
+ /** Has an alpha channel with a `var()` function value */
147
+ HasVariableAlpha = "has-variable-alpha",
148
+ /** Is Hex notation */
149
+ Hex = "hex",
150
+ /** Is legacy HSL, e.g. `hsl(50deg, 0%, 0%)` */
151
+ LegacyHSL = "legacy-hsl",
152
+ /** Is legacy RGB, e.g. `rgb(0, 0, 0)` */
153
+ LegacyRGB = "legacy-rgb",
154
+ /** Is a named color, e.g. `red`, `blue` */
155
+ NamedColor = "named-color",
156
+ /** Is a relative color syntax, e.g. `rgb(from purple r g b)` */
157
+ RelativeColorSyntax = "relative-color-syntax",
158
+ /** Is a mixed color, e.g. `color-mix(in oklch, red, blue)` */
159
+ ColorMix = "color-mix",
160
+ /** Is a variadic mixed color, e.g. `color-mix(in oklch, red)` `color-mix(in oklch, red, blue, green)` */
161
+ ColorMixVariadic = "color-mix-variadic",
162
+ /** Is a contrasting color, e.g. `contrast-color()` */
163
+ ContrastColor = "contrast-color",
164
+ /** Is a relative alpha syntax `alpha(from red / 0.5)` */
165
+ RelativeAlphaSyntax = "relative-alpha-syntax",
166
+ /** Is an experimental color syntax */
167
+ Experimental = "experimental"
168
+ }
169
+
170
+ export { }
node_modules/@csstools/css-color-parser/dist/index.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ import{TokenType as e,NumberType as n,isTokenIdent as a,isTokenPercentage as o,isTokenNumber as r,isTokenDelim as t,isTokenNumeric as l,isTokenComma as s,isTokenDimension as c,isTokenHash as i}from"@csstools/css-tokenizer";import{XYZ_D65_to_XYZ_D65 as u,XYZ_D50_to_XYZ_D65 as h,OKLCH_to_XYZ_D65 as N,LCH_to_XYZ_D65 as m,OKLab_to_XYZ_D65 as p,Lab_to_XYZ_D65 as b,HWB_to_XYZ_D65 as v,HSL_to_XYZ_D65 as g,ProPhoto_RGB_to_XYZ_D65 as f,a98_RGB_to_XYZ_D65 as d,rec_2020_to_XYZ_D65 as y,lin_P3_to_XYZ_D65 as _,P3_to_XYZ_D65 as C,lin_sRGB_to_XYZ_D65 as T,sRGB_to_XYZ_D65 as w,XYZ_D50_to_XYZ_D50 as x,XYZ_D65_to_OKLab as D,XYZ_D65_to_OKLCH as L,XYZ_D50_to_LCH as P,XYZ_D50_to_Lab as Z,XYZ_D65_to_HWB as H,XYZ_D65_to_HSL as M,XYZ_D65_to_a98_RGB as F,XYZ_D50_to_ProPhoto as $,XYZ_D65_to_rec_2020 as S,XYZ_D65_to_lin_P3 as z,XYZ_D65_to_P3 as R,XYZ_D65_to_lin_sRGB as k,XYZ_D65_to_sRGB as B,XYZ_D65_to_XYZ_D50 as X,OKLCH_to_XYZ_D50 as G,LCH_to_XYZ_D50 as A,OKLab_to_XYZ_D50 as Y,Lab_to_XYZ_D50 as V,HWB_to_XYZ_D50 as K,HSL_to_XYZ_D50 as I,ProPhoto_RGB_to_XYZ_D50 as O,a98_RGB_to_XYZ_D50 as W,rec_2020_to_XYZ_D50 as E,lin_P3_to_XYZ_D50 as U,P3_to_XYZ_D50 as j,lin_sRGB_to_XYZ_D50 as q,sRGB_to_XYZ_D50 as J,namedColors as Q,inGamut as ee,clip as ne,gam_sRGB as ae,mapGamutRayTrace as oe,OKLCH_to_OKLab as re,OKLab_to_XYZ as te,XYZ_to_lin_sRGB as le,lin_sRGB_to_XYZ as se,XYZ_to_OKLab as ce,OKLab_to_OKLCH as ie,contrast_ratio_wcag_2_1 as ue,gam_P3 as he,XYZ_to_lin_P3 as Ne,lin_P3_to_XYZ as me}from"@csstools/color-helpers";import{isWhitespaceNode as pe,isCommentNode as be,isTokenNode as ve,isFunctionNode as ge,TokenNode as fe,isWhiteSpaceOrCommentNode as de,replaceComponentValues as ye,FunctionNode as _e,WhitespaceNode as Ce}from"@csstools/css-parser-algorithms";import{mathFunctionNames as Te,calcFromComponentValues as we}from"@csstools/css-calc";var xe,De;function normalize(e,n,a,o){return Math.min(Math.max(e/n,a),o)}function convertNaNToZero(e){return[Number.isNaN(e[0])?0:e[0],Number.isNaN(e[1])?0:e[1],Number.isNaN(e[2])?0:e[2]]}function colorData_to_XYZ_D50(e){switch(e.colorNotation){case xe.HEX:case xe.RGB:case xe.sRGB:return{...e,colorNotation:xe.XYZ_D50,channels:J(convertNaNToZero(e.channels))};case xe.Linear_sRGB:return{...e,colorNotation:xe.XYZ_D50,channels:q(convertNaNToZero(e.channels))};case xe.Display_P3:return{...e,colorNotation:xe.XYZ_D50,channels:j(convertNaNToZero(e.channels))};case xe.Linear_Display_P3:return{...e,colorNotation:xe.XYZ_D50,channels:U(convertNaNToZero(e.channels))};case xe.Rec2020:return{...e,colorNotation:xe.XYZ_D50,channels:E(convertNaNToZero(e.channels))};case xe.A98_RGB:return{...e,colorNotation:xe.XYZ_D50,channels:W(convertNaNToZero(e.channels))};case xe.ProPhoto_RGB:return{...e,colorNotation:xe.XYZ_D50,channels:O(convertNaNToZero(e.channels))};case xe.HSL:return{...e,colorNotation:xe.XYZ_D50,channels:I(convertNaNToZero(e.channels))};case xe.HWB:return{...e,colorNotation:xe.XYZ_D50,channels:K(convertNaNToZero(e.channels))};case xe.Lab:return{...e,colorNotation:xe.XYZ_D50,channels:V(convertNaNToZero(e.channels))};case xe.OKLab:return{...e,colorNotation:xe.XYZ_D50,channels:Y(convertNaNToZero(e.channels))};case xe.LCH:return{...e,colorNotation:xe.XYZ_D50,channels:A(convertNaNToZero(e.channels))};case xe.OKLCH:return{...e,colorNotation:xe.XYZ_D50,channels:G(convertNaNToZero(e.channels))};case xe.XYZ_D50:return{...e,colorNotation:xe.XYZ_D50,channels:x(convertNaNToZero(e.channels))};case xe.XYZ_D65:return{...e,colorNotation:xe.XYZ_D50,channels:X(convertNaNToZero(e.channels))};default:throw new Error("Unsupported color notation")}}function colorData_to_XYZ_D65(e){switch(e.colorNotation){case xe.HEX:case xe.RGB:case xe.sRGB:return{...e,colorNotation:xe.XYZ_D65,channels:w(convertNaNToZero(e.channels))};case xe.Linear_sRGB:return{...e,colorNotation:xe.XYZ_D65,channels:T(convertNaNToZero(e.channels))};case xe.Display_P3:return{...e,colorNotation:xe.XYZ_D65,channels:C(convertNaNToZero(e.channels))};case xe.Linear_Display_P3:return{...e,colorNotation:xe.XYZ_D65,channels:_(convertNaNToZero(e.channels))};case xe.Rec2020:return{...e,colorNotation:xe.XYZ_D65,channels:y(convertNaNToZero(e.channels))};case xe.A98_RGB:return{...e,colorNotation:xe.XYZ_D65,channels:d(convertNaNToZero(e.channels))};case xe.ProPhoto_RGB:return{...e,colorNotation:xe.XYZ_D65,channels:f(convertNaNToZero(e.channels))};case xe.HSL:return{...e,colorNotation:xe.XYZ_D65,channels:g(convertNaNToZero(e.channels))};case xe.HWB:return{...e,colorNotation:xe.XYZ_D65,channels:v(convertNaNToZero(e.channels))};case xe.Lab:return{...e,colorNotation:xe.XYZ_D65,channels:b(convertNaNToZero(e.channels))};case xe.OKLab:return{...e,colorNotation:xe.XYZ_D65,channels:p(convertNaNToZero(e.channels))};case xe.LCH:return{...e,colorNotation:xe.XYZ_D65,channels:m(convertNaNToZero(e.channels))};case xe.OKLCH:return{...e,colorNotation:xe.XYZ_D65,channels:N(convertNaNToZero(e.channels))};case xe.XYZ_D50:return{...e,colorNotation:xe.XYZ_D65,channels:h(convertNaNToZero(e.channels))};case xe.XYZ_D65:return{...e,colorNotation:xe.XYZ_D65,channels:u(convertNaNToZero(e.channels))};default:throw new Error("Unsupported color notation")}}!function(e){e.A98_RGB="a98-rgb",e.Display_P3="display-p3",e.Linear_Display_P3="display-p3-linear",e.HEX="hex",e.HSL="hsl",e.HWB="hwb",e.LCH="lch",e.Lab="lab",e.Linear_sRGB="srgb-linear",e.OKLCH="oklch",e.OKLab="oklab",e.ProPhoto_RGB="prophoto-rgb",e.RGB="rgb",e.sRGB="srgb",e.Rec2020="rec2020",e.XYZ_D50="xyz-d50",e.XYZ_D65="xyz-d65"}(xe||(xe={})),function(e){e.ColorKeyword="color-keyword",e.HasAlpha="has-alpha",e.HasDimensionValues="has-dimension-values",e.HasNoneKeywords="has-none-keywords",e.HasNumberValues="has-number-values",e.HasPercentageAlpha="has-percentage-alpha",e.HasPercentageValues="has-percentage-values",e.HasVariableAlpha="has-variable-alpha",e.Hex="hex",e.LegacyHSL="legacy-hsl",e.LegacyRGB="legacy-rgb",e.NamedColor="named-color",e.RelativeColorSyntax="relative-color-syntax",e.ColorMix="color-mix",e.ColorMixVariadic="color-mix-variadic",e.ContrastColor="contrast-color",e.RelativeAlphaSyntax="relative-alpha-syntax",e.Experimental="experimental"}(De||(De={}));const Le=new Set([xe.A98_RGB,xe.Display_P3,xe.Linear_Display_P3,xe.HEX,xe.Linear_sRGB,xe.ProPhoto_RGB,xe.RGB,xe.sRGB,xe.Rec2020,xe.XYZ_D50,xe.XYZ_D65]);function colorDataToForInterpolation(e,n){const a=[...e.channels];let o={...e};return o.channels=convertPowerlessComponentsToMissingComponents(o.channels,e.colorNotation),o=convertToDestination(o,n),o.channels=carryForwardMissingComponentsForColorAndNotation(o,e.colorNotation,n,a),o}function colorDataToForRelativeColorSyntax(e,n){if(e.colorNotation===n)return{...e};const a=[...e.channels];let o={...e};return o.channels=convertPowerlessComponentsToMissingComponents(o.channels,e.colorNotation),o=convertToDestination(o,n),o.channels=carryForwardMissingComponentsForColorAndNotation(o,e.colorNotation,n,a),o}function convertToDestination(e,n){if(e.colorNotation===n)return e.channels=convertNaNToZero(e.channels),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n),e;switch(n){case xe.HEX:case xe.RGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.RGB,e.channels=B(n.channels),e.channels=e.channels.map(e=>reducePrecisionOrNaN(e,8)),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.sRGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.sRGB,e.channels=B(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Linear_sRGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Linear_sRGB,e.channels=k(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Display_P3:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Display_P3,e.channels=R(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Linear_Display_P3:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Linear_Display_P3,e.channels=z(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Rec2020:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Rec2020,e.channels=S(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.ProPhoto_RGB:{const n=colorData_to_XYZ_D50(e);e.colorNotation=xe.ProPhoto_RGB,e.channels=$(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.A98_RGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.A98_RGB,e.channels=F(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.HSL:{const a=colorData_to_XYZ_D65(e);e.colorNotation=xe.HSL,e.channels=M(a.channels),e.channels=e.channels.map(e=>reducePrecisionOrNaN(e,8)),e.channels=normalizeAfterColorConversion(e.channels,0),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.HWB:{const a=colorData_to_XYZ_D65(e);e.colorNotation=xe.HWB,e.channels=H(a.channels),e.channels=e.channels.map(e=>reducePrecisionOrNaN(e,8)),e.channels=normalizeAfterColorConversion(e.channels,0),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.Lab:{const n=colorData_to_XYZ_D50(e);e.colorNotation=xe.Lab,e.channels=Z(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.LCH:{const a=colorData_to_XYZ_D50(e);e.colorNotation=xe.LCH,e.channels=P(a.channels),e.channels=normalizeAfterColorConversion(e.channels,2),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.OKLCH:{const a=colorData_to_XYZ_D65(e);e.colorNotation=xe.OKLCH,e.channels=L(a.channels),e.channels=normalizeAfterColorConversion(e.channels,2),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.OKLab:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.OKLab,e.channels=D(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.XYZ_D50:{const n=colorData_to_XYZ_D50(e);e.colorNotation=xe.XYZ_D50,e.channels=x(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.XYZ_D65:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.XYZ_D65,e.channels=u(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}default:throw new Error("Unsupported color notation")}return e}function carryForwardMissingComponentsForColorAndNotation(e,n,a,o){if(n===a)return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);if(Le.has(a)&&Le.has(n))return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);switch(a){case xe.HSL:switch(n){case xe.HWB:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);case xe.Lab:case xe.OKLab:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[2],[0,1]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[2,1,0],[]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}case xe.HWB:switch(n){case xe.HSL:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[2],[0,1],e.channels,[0],[1,2]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}case xe.Lab:case xe.OKLab:switch(n){case xe.HSL:return carryForwardMissingComponents(o,[2],[0,1],e.channels,[0],[1,2]);case xe.Lab:case xe.OKLab:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}case xe.LCH:case xe.OKLCH:switch(n){case xe.HSL:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[2,1,0],[]);case xe.HWB:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[2],[0,1]);case xe.Lab:case xe.OKLab:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}}function convertPowerlessComponentsToMissingComponents(e,n){const a=[...e];switch(n){case xe.HSL:(Number.isNaN(a[1])?0:a[1])<=.001&&(a[0]=Number.NaN,!Number.isNaN(a[1])&&a[1]>0&&(a[1]=0));break;case xe.HWB:Math.max(0,Number.isNaN(a[1])?0:a[1])+Math.max(0,Number.isNaN(a[2])?0:a[2])>=99.999&&(a[0]=Number.NaN,Math.max(0,Number.isNaN(a[1])?0:a[1])+Math.max(0,Number.isNaN(a[2])?0:a[2])<100&&(Number.isNaN(a[1])?a[2]=100:Number.isNaN(a[2])?a[1]=100:a[2]=100-a[1]));break;case xe.LCH:(Number.isNaN(a[1])?0:a[1])<=.0015&&(a[2]=Number.NaN,!Number.isNaN(a[1])&&a[1]>0&&(a[1]=0));break;case xe.OKLCH:(Number.isNaN(a[1])?0:a[1])<=4e-6&&(a[2]=Number.NaN,!Number.isNaN(a[1])&&a[1]>0&&(a[1]=0))}return a}function convertPowerlessComponentsToZeroValuesForDisplay(e,n){const a=[...e];switch(n){case xe.HSL:(Number.isNaN(a[1])?0:a[1])<=.001&&(a[0]=Number.NaN),(reducePrecision$1(a[2])<=0||reducePrecision$1(a[2])>=100)&&(a[0]=Number.NaN,a[1]=Number.NaN);break;case xe.HWB:Math.max(0,Number.isNaN(a[1])?0:a[1])+Math.max(0,Number.isNaN(a[2])?0:a[2])>=99.999&&(a[0]=Number.NaN);break;case xe.Lab:(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=100)&&(a[1]=Number.NaN,a[2]=Number.NaN);break;case xe.LCH:(Number.isNaN(a[1])?0:a[1])<=.0015&&(a[2]=Number.NaN),(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=100)&&(a[1]=Number.NaN,a[2]=Number.NaN);break;case xe.OKLab:(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=1)&&(a[1]=Number.NaN,a[2]=Number.NaN);break;case xe.OKLCH:(Number.isNaN(a[1])?0:a[1])<=4e-6&&(a[2]=Number.NaN),(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=1)&&(a[1]=Number.NaN,a[2]=Number.NaN)}return a}function carryForwardMissingComponents(e,n,a,o,r,t){if(n.length<3&&e.every(Number.isNaN))return[Number.NaN,Number.NaN,Number.NaN];const l=[...o];for(let a=0;a<n.length;a++)Number.isNaN(e[n[a]])&&(l[r[a]]=Number.NaN);if(a.length&&a.every(n=>Number.isNaN(e[n])))for(let e=0;e<t.length;e++)l[t[e]]=Number.NaN;return l}function normalizeRelativeColorDataChannels(e){const n=new Map;switch(e.colorNotation){case xe.RGB:case xe.HEX:n.set("r",dummyNumberToken(255*e.channels[0])),n.set("g",dummyNumberToken(255*e.channels[1])),n.set("b",dummyNumberToken(255*e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha));break;case xe.HSL:n.set("h",dummyNumberToken(e.channels[0])),n.set("s",dummyNumberToken(e.channels[1])),n.set("l",dummyNumberToken(e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha));break;case xe.HWB:n.set("h",dummyNumberToken(e.channels[0])),n.set("w",dummyNumberToken(e.channels[1])),n.set("b",dummyNumberToken(e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha));break;case xe.Lab:case xe.OKLab:n.set("l",dummyNumberToken(e.channels[0])),n.set("a",dummyNumberToken(e.channels[1])),n.set("b",dummyNumberToken(e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha));break;case xe.LCH:case xe.OKLCH:n.set("l",dummyNumberToken(e.channels[0])),n.set("c",dummyNumberToken(e.channels[1])),n.set("h",dummyNumberToken(e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha));break;case xe.sRGB:case xe.A98_RGB:case xe.Display_P3:case xe.Linear_Display_P3:case xe.Rec2020:case xe.Linear_sRGB:case xe.ProPhoto_RGB:n.set("r",dummyNumberToken(e.channels[0])),n.set("g",dummyNumberToken(e.channels[1])),n.set("b",dummyNumberToken(e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha));break;case xe.XYZ_D50:case xe.XYZ_D65:n.set("x",dummyNumberToken(e.channels[0])),n.set("y",dummyNumberToken(e.channels[1])),n.set("z",dummyNumberToken(e.channels[2])),"number"==typeof e.alpha&&n.set("alpha",dummyNumberToken(e.alpha))}return n}function noneToZeroInRelativeColorDataChannels(e){const n=new Map(e);for(const[a,o]of e)Number.isNaN(o[4].value)&&n.set(a,dummyNumberToken(0));return n}function normalizeAfterColorConversion(e,n=-1){return e=convertNaNToZero(e),e=[0===n?e[0]:normalize(e[0],1,-2147483647,2147483647),1===n?e[1]:normalize(e[1],1,-2147483647,2147483647),2===n?e[2]:normalize(e[2],1,-2147483647,2147483647)],Number.isNaN(e[n])||Number.isFinite(e[n])||(e[n]=0),e}function dummyNumberToken(a){return Number.isNaN(a)?[e.Number,"none",-1,-1,{value:Number.NaN,type:n.Number}]:[e.Number,a.toString(),-1,-1,{value:a,type:n.Number}]}function reducePrecisionOrNaN(e,n=7){if(Number.isNaN(e))return e;const a=Math.pow(10,n);return Math.round(e*a)/a}function reducePrecision$1(e,n=7){if(Number.isNaN(e))return 0;const a=Math.pow(10,n);return Math.round(e*a)/a}function colorDataFitsRGB_Gamut(e){const n={...e,channels:[...e.channels]};n.channels=convertPowerlessComponentsToZeroValuesForDisplay(n.channels,n.colorNotation);return!colorDataToForRelativeColorSyntax(n,xe.RGB).channels.find(e=>e<-1e-5||e>1.00001)}function colorDataFitsDisplayP3_Gamut(e){const n={...e,channels:[...e.channels]};n.channels=convertPowerlessComponentsToZeroValuesForDisplay(n.channels,n.colorNotation);return!colorDataToForRelativeColorSyntax(n,xe.Display_P3).channels.find(e=>e<-1e-5||e>1.00001)}const Pe=/[A-Z]/g;function toLowerCaseAZ(e){return e.replace(Pe,e=>String.fromCharCode(e.charCodeAt(0)+32))}function normalize_Color_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,100,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,1,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}const Ze=new Set(["srgb","srgb-linear","display-p3","display-p3-linear","a98-rgb","prophoto-rgb","rec2020","xyz","xyz-d50","xyz-d65"]);function color$1(e,n){const o=[],s=[],c=[],i=[];let u,h,N=!1,m=!1;const p={colorNotation:xe.sRGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([])};let b=o;for(let r=0;r<e.value.length;r++){let v=e.value[r];if(pe(v)||be(v))for(;pe(e.value[r+1])||be(e.value[r+1]);)r++;else if(b===o&&o.length&&(b=s),b===s&&s.length&&(b=c),ve(v)&&t(v.value)&&"/"===v.value[4].value){if(b===i)return!1;b=i}else{if(ge(v)){if(b===i&&"var"===toLowerCaseAZ(v.getName())){p.syntaxFlags.add(De.HasVariableAlpha),b.push(v);continue}if(!Te.has(toLowerCaseAZ(v.getName())))return!1;const[[e]]=we([[v]],{censorIntoStandardRepresentableValues:!0,globals:h,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!e||!ve(e)||!l(e.value))return!1;Number.isNaN(e.value[4].value)&&(e.value[4].value=0),v=e}if(b===o&&0===o.length&&ve(v)&&a(v.value)&&Ze.has(toLowerCaseAZ(v.value[4].value))){if(N)return!1;N=toLowerCaseAZ(v.value[4].value),p.colorNotation=colorSpaceNameToColorNotation(N),m&&(m=colorDataToForRelativeColorSyntax(m,p.colorNotation),u=normalizeRelativeColorDataChannels(m),h=noneToZeroInRelativeColorDataChannels(u))}else if(b===o&&0===o.length&&ve(v)&&a(v.value)&&"from"===toLowerCaseAZ(v.value[4].value)){if(m)return!1;if(N)return!1;for(;pe(e.value[r+1])||be(e.value[r+1]);)r++;if(r++,v=e.value[r],m=n(v),!1===m)return!1;m.syntaxFlags.has(De.Experimental)&&p.syntaxFlags.add(De.Experimental),p.syntaxFlags.add(De.RelativeColorSyntax)}else{if(!ve(v))return!1;if(a(v.value)&&u&&u.has(toLowerCaseAZ(v.value[4].value))){b.push(new fe(u.get(toLowerCaseAZ(v.value[4].value))));continue}b.push(v)}}}if(!N)return!1;if(1!==b.length)return!1;if(1!==o.length||1!==s.length||1!==c.length)return!1;if(!ve(o[0])||!ve(s[0])||!ve(c[0]))return!1;if(u&&!u.has("alpha"))return!1;const v=normalize_Color_ChannelValues(o[0].value,0,p);if(!v||!r(v))return!1;const g=normalize_Color_ChannelValues(s[0].value,1,p);if(!g||!r(g))return!1;const f=normalize_Color_ChannelValues(c[0].value,2,p);if(!f||!r(f))return!1;const d=[v,g,f];if(1===i.length)if(p.syntaxFlags.add(De.HasAlpha),ve(i[0])){const e=normalize_Color_ChannelValues(i[0].value,3,p);if(!e||!r(e))return!1;d.push(e)}else p.alpha=i[0];else if(u&&u.has("alpha")){const e=normalize_Color_ChannelValues(u.get("alpha"),3,p);if(!e||!r(e))return!1;d.push(e)}return p.channels=[d[0][4].value,d[1][4].value,d[2][4].value],4===d.length&&(p.alpha=d[3][4].value),p}function colorSpaceNameToColorNotation(e){switch(e){case"srgb":return xe.sRGB;case"srgb-linear":return xe.Linear_sRGB;case"display-p3":return xe.Display_P3;case"display-p3-linear":return xe.Linear_Display_P3;case"a98-rgb":return xe.A98_RGB;case"prophoto-rgb":return xe.ProPhoto_RGB;case"rec2020":return xe.Rec2020;case"xyz":case"xyz-d65":return xe.XYZ_D65;case"xyz-d50":return xe.XYZ_D50;default:throw new Error("Unknown color space name: "+e)}}const He=new Set(["srgb","srgb-linear","display-p3","display-p3-linear","a98-rgb","prophoto-rgb","rec2020","lab","oklab","xyz","xyz-d50","xyz-d65"]),Me=new Set(["hsl","hwb","lch","oklch"]),Fe=new Set(["shorter","longer","increasing","decreasing"]);function colorMix(e,n){let o=null,r=null,t=null,l=!1;for(let c=0;c<e.value.length;c++){const i=e.value[c];if(!de(i)){if(!(o||ve(i)&&a(i.value)&&"in"===toLowerCaseAZ(i.value[4].value)))return colorMixRectangular("oklab",colorMixComponents(e.value,n));if(ve(i)&&a(i.value)){if(!o&&"in"===toLowerCaseAZ(i.value[4].value)){o=i;continue}if(o&&!r){r=toLowerCaseAZ(i.value[4].value);continue}if(o&&r&&!t&&Me.has(r)){t=toLowerCaseAZ(i.value[4].value);continue}if(o&&r&&t&&!l&&"hue"===toLowerCaseAZ(i.value[4].value)){l=!0;continue}return!1}return!(!ve(i)||!s(i.value))&&(!!r&&(t||l?!!(t&&l&&Me.has(r)&&Fe.has(t))&&colorMixPolar(r,t,colorMixComponents(e.value.slice(c+1),n)):He.has(r)?colorMixRectangular(r,colorMixComponents(e.value.slice(c+1),n)):!!Me.has(r)&&colorMixPolar(r,"shorter",colorMixComponents(e.value.slice(c+1),n))))}}return!1}function colorMixComponents(e,n){const a=[];let r=!1,t=!1;for(let c=0;c<e.length;c++){let i=e[c];if(!de(i)){if(!ve(i)||!s(i.value)){if(!r){const e=n(i);if(e){r=e;continue}}if(!t){if(ge(i)&&Te.has(toLowerCaseAZ(i.getName()))){if([[i]]=we([[i]],{censorIntoStandardRepresentableValues:!0,precision:-1,toCanonicalUnits:!0,rawPercentages:!0}),!i||!ve(i)||!l(i.value))return!1;Number.isNaN(i.value[4].value)&&(i.value[4].value=0)}if(ve(i)&&o(i.value)&&i.value[4].value>=0){t=i.value[4].value;continue}}return!1}if(!r)return!1;a.push({color:r,percentage:t}),r=!1,t=!1}}return!!r&&(a.push({color:r,percentage:t}),a)}function colorMixRectangular(e,n){if(!n||!n.length)return!1;for(const e of n)if(e.percentage&&(e.percentage<0||e.percentage>100))return!1;const{items:a,leftover:o}=normalizeMixPercentages(n,!0),r=1-o/100;let t;switch(e){case"srgb":t=xe.RGB;break;case"srgb-linear":t=xe.Linear_sRGB;break;case"display-p3":t=xe.Display_P3;break;case"display-p3-linear":t=xe.Linear_Display_P3;break;case"a98-rgb":t=xe.A98_RGB;break;case"prophoto-rgb":t=xe.ProPhoto_RGB;break;case"rec2020":t=xe.Rec2020;break;case"lab":t=xe.Lab;break;case"oklab":t=xe.OKLab;break;case"xyz-d50":t=xe.XYZ_D50;break;case"xyz":case"xyz-d65":t=xe.XYZ_D65;break;default:return!1}if(1===a.length){const e=colorDataToForInterpolation(a[0].color,t);return e.colorNotation=t,e.syntaxFlags.add(De.ColorMixVariadic),e.syntaxFlags.add(De.ColorMix),"number"!=typeof e.alpha?!1:(e.alpha=e.alpha*r,e)}for(a.reverse();a.length>=2;){const e=a.pop(),n=a.pop();if(!e||!n)return!1;const o=e.percentage+n.percentage,r=o>0?n.percentage/o:.5,l=colorMixRectangularPair(t,e.color,n.color,r);if(!l)return!1;a.push({color:l,percentage:o})}const l=a[0]?.color;return!!l&&("number"==typeof l.alpha&&(l.alpha=l.alpha*r,n.some(e=>e.color.syntaxFlags.has(De.Experimental))&&l.syntaxFlags.add(De.Experimental),2!==n.length&&l.syntaxFlags.add(De.ColorMixVariadic),l))}function colorMixRectangularPair(e,n,a,o){let r=n.alpha;if("number"!=typeof r)return!1;let t=a.alpha;if("number"!=typeof t)return!1;r=Number.isNaN(r)?t:r,t=Number.isNaN(t)?r:t;const l=colorDataToForInterpolation(n,e).channels,s=colorDataToForInterpolation(a,e).channels;l[0]=fillInMissingComponent(l[0],s[0]),s[0]=fillInMissingComponent(s[0],l[0]),l[1]=fillInMissingComponent(l[1],s[1]),s[1]=fillInMissingComponent(s[1],l[1]),l[2]=fillInMissingComponent(l[2],s[2]),s[2]=fillInMissingComponent(s[2],l[2]),l[0]=premultiply(l[0],r),l[1]=premultiply(l[1],r),l[2]=premultiply(l[2],r),s[0]=premultiply(s[0],t),s[1]=premultiply(s[1],t),s[2]=premultiply(s[2],t);const c=interpolate(r,t,o);return{colorNotation:e,channels:[un_premultiply(interpolate(l[0],s[0],o),c),un_premultiply(interpolate(l[1],s[1],o),c),un_premultiply(interpolate(l[2],s[2],o),c)],alpha:c,syntaxFlags:new Set([De.ColorMix])}}function colorMixPolar(e,n,a){if(!a||!a.length)return!1;for(const e of a)if(e.percentage&&(e.percentage<0||e.percentage>100))return!1;const{items:o,leftover:r}=normalizeMixPercentages(a,!0),t=1-r/100;let l;switch(e){case"hsl":l=xe.HSL;break;case"hwb":l=xe.HWB;break;case"lch":l=xe.LCH;break;case"oklch":l=xe.OKLCH;break;default:return!1}if(1===o.length){const e=colorDataToForInterpolation(o[0].color,l);return e.colorNotation=l,e.syntaxFlags.add(De.ColorMixVariadic),e.syntaxFlags.add(De.ColorMix),"number"!=typeof e.alpha?!1:(e.alpha=e.alpha*t,e)}for(o.reverse();o.length>=2;){const e=o.pop(),a=o.pop();if(!e||!a)return!1;const r=e.percentage+a.percentage,t=r>0?a.percentage/r:.5,s=colorMixPolarPair(l,n,e.color,a.color,t);if(!s)return!1;o.push({color:s,percentage:r})}const s=o[0]?.color;return!!s&&("number"==typeof s.alpha&&(s.alpha=s.alpha*t,a.some(e=>e.color.syntaxFlags.has(De.Experimental))&&s.syntaxFlags.add(De.Experimental),2!==a.length&&s.syntaxFlags.add(De.ColorMixVariadic),s))}function colorMixPolarPair(e,n,a,o,r){let t=0,l=0,s=0,c=0,i=0,u=0,h=a.alpha;if("number"!=typeof h)return!1;let N=o.alpha;if("number"!=typeof N)return!1;h=Number.isNaN(h)?N:h,N=Number.isNaN(N)?h:N;const m=colorDataToForInterpolation(a,e).channels,p=colorDataToForInterpolation(o,e).channels;switch(e){case xe.HSL:case xe.HWB:t=m[0],l=p[0],s=m[1],c=p[1],i=m[2],u=p[2];break;case xe.LCH:case xe.OKLCH:s=m[0],c=p[0],i=m[1],u=p[1],t=m[2],l=p[2]}if(s=fillInMissingComponent(s,c),c=fillInMissingComponent(c,s),i=fillInMissingComponent(i,u),u=fillInMissingComponent(u,i),t=fillInMissingComponent(t,l),l=fillInMissingComponent(l,t),Number.isNaN(t)&&Number.isNaN(l));else{Number.isNaN(t)?t=0:Number.isNaN(l)&&(l=0);const e=l-t;switch(n){case"shorter":e>180?t+=360:e<-180&&(l+=360);break;case"longer":-180<e&&e<180&&(e>0?t+=360:l+=360);break;case"increasing":e<0&&(l+=360);break;case"decreasing":e>0&&(t+=360);break;default:throw new Error("Unknown hue interpolation method")}}s=premultiply(s,h),i=premultiply(i,h),c=premultiply(c,N),u=premultiply(u,N);let b=[0,0,0];const v=interpolate(h,N,r);switch(e){case xe.HSL:case xe.HWB:b=[interpolate(t,l,r),un_premultiply(interpolate(s,c,r),v),un_premultiply(interpolate(i,u,r),v)];break;case xe.LCH:case xe.OKLCH:b=[un_premultiply(interpolate(s,c,r),v),un_premultiply(interpolate(i,u,r),v),interpolate(t,l,r)]}return{colorNotation:e,channels:b,alpha:v,syntaxFlags:new Set([De.ColorMix])}}function fillInMissingComponent(e,n){return Number.isNaN(e)?n:e}function interpolate(e,n,a){return e*(1-a)+n*a}function premultiply(e,n){return Number.isNaN(n)?e:Number.isNaN(e)?Number.NaN:e*n}function un_premultiply(e,n){return 0===n||Number.isNaN(n)?e:Number.isNaN(e)?Number.NaN:e/n}function normalizeMixPercentages(e,n=!1){let a=0,o=0;for(const n of e)n.percentage&&(a+=n.percentage),!1===n.percentage&&o++;a=Math.min(100,a);for(const n of e)!1===n.percentage&&(n.percentage=(100-a)/o);const r=e.slice();let t=0;for(const e of r)t+=e.percentage;if(t>100||t>0&&n)for(const e of r)e.percentage=e.percentage*(100/t);let l=0;return t<100&&(l=100-t),{items:r,leftover:l}}function hex(e){const n=toLowerCaseAZ(e[4].value);if(n.match(/[^a-f0-9]/))return!1;const a={colorNotation:xe.HEX,channels:[0,0,0],alpha:1,syntaxFlags:new Set([De.Hex])},o=n.length;if(3===o){const e=n[0],o=n[1],r=n[2];return a.channels=[parseInt(e+e,16)/255,parseInt(o+o,16)/255,parseInt(r+r,16)/255],a}if(6===o){const e=n[0]+n[1],o=n[2]+n[3],r=n[4]+n[5];return a.channels=[parseInt(e,16)/255,parseInt(o,16)/255,parseInt(r,16)/255],a}if(4===o){const e=n[0],o=n[1],r=n[2],t=n[3];return a.channels=[parseInt(e+e,16)/255,parseInt(o+o,16)/255,parseInt(r+r,16)/255],a.alpha=parseInt(t+t,16)/255,a.syntaxFlags.add(De.HasAlpha),a}if(8===o){const e=n[0]+n[1],o=n[2]+n[3],r=n[4]+n[5],t=n[6]+n[7];return a.channels=[parseInt(e,16)/255,parseInt(o,16)/255,parseInt(r,16)/255],a.alpha=parseInt(t,16)/255,a.syntaxFlags.add(De.HasAlpha),a}return!1}function normalizeHue(a){if(r(a))return Number.isNaN(a[4].value)||Number.isFinite(a[4].value)||(a[4].value=0),a[4].value=a[4].value%360,a[4].value<0&&(a[4].value+=360),a[1]=a[4].value.toString(),a;if(c(a)){let o=a[4].value;switch(toLowerCaseAZ(a[4].unit)){case"deg":break;case"rad":o=180*a[4].value/Math.PI;break;case"grad":o=.9*a[4].value;break;case"turn":o=360*a[4].value;break;default:return!1}return Number.isNaN(a[4].value)||Number.isFinite(a[4].value)||(a[4].value=0),o%=360,o<0&&(o+=360),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}return!1}function normalize_legacy_HSL_ChannelValues(a,t,l){if(0===t){const e=normalizeHue(a);return!1!==e&&(c(a)&&l.syntaxFlags.add(De.HasDimensionValues),e)}if(o(a)){let o;return 3===t?l.syntaxFlags.add(De.HasPercentageAlpha):l.syntaxFlags.add(De.HasPercentageValues),o=3===t?normalize(a[4].value,100,0,1):normalize(a[4].value,1,0,100),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}if(r(a)){if(3!==t)return!1;let o;return o=normalize(a[4].value,1,0,3===t?1:100),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}return!1}function normalize_modern_HSL_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(0===l){const e=normalizeHue(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3===l?s.syntaxFlags.add(De.HasPercentageAlpha):s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,1===l?0:-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,1,1===l?0:-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function threeChannelLegacySyntax(e,n,a,o){const t=[],c=[],i=[],u=[],h={colorNotation:a,channels:[0,0,0],alpha:1,syntaxFlags:new Set(o)};let N=t;for(let n=0;n<e.value.length;n++){let a=e.value[n];if(!pe(a)&&!be(a)){if(ve(a)&&s(a.value)){if(N===t){N=c;continue}if(N===c){N=i;continue}if(N===i){N=u;continue}if(N===u)return!1}if(ge(a)){if(N===u&&"var"===a.getName().toLowerCase()){h.syntaxFlags.add(De.HasVariableAlpha),N.push(a);continue}if(!Te.has(a.getName().toLowerCase()))return!1;const[[e]]=we([[a]],{censorIntoStandardRepresentableValues:!0,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!e||!ve(e)||!l(e.value))return!1;Number.isNaN(e.value[4].value)&&(e.value[4].value=0),a=e}if(!ve(a))return!1;N.push(a)}}if(1!==N.length)return!1;if(1!==t.length||1!==c.length||1!==i.length)return!1;if(!ve(t[0])||!ve(c[0])||!ve(i[0]))return!1;const m=n(t[0].value,0,h);if(!m||!r(m))return!1;const p=n(c[0].value,1,h);if(!p||!r(p))return!1;const b=n(i[0].value,2,h);if(!b||!r(b))return!1;const v=[m,p,b];if(1===u.length)if(h.syntaxFlags.add(De.HasAlpha),ve(u[0])){const e=n(u[0].value,3,h);if(!e||!r(e))return!1;v.push(e)}else h.alpha=u[0];return h.channels=[v[0][4].value,v[1][4].value,v[2][4].value],4===v.length&&(h.alpha=v[3][4].value),h}function threeChannelSpaceSeparated(e,n,o,s,c){const i=[],u=[],h=[],N=[];let m,p,b=!1;const v={colorNotation:o,channels:[0,0,0],alpha:1,syntaxFlags:new Set(s)};let g=i;for(let n=0;n<e.value.length;n++){let r=e.value[n];if(pe(r)||be(r))for(;pe(e.value[n+1])||be(e.value[n+1]);)n++;else if(g===i&&i.length&&(g=u),g===u&&u.length&&(g=h),ve(r)&&t(r.value)&&"/"===r.value[4].value){if(g===N)return!1;g=N}else{if(ge(r)){if(g===N&&"var"===r.getName().toLowerCase()){v.syntaxFlags.add(De.HasVariableAlpha),g.push(r);continue}if(!Te.has(r.getName().toLowerCase()))return!1;const[[e]]=we([[r]],{censorIntoStandardRepresentableValues:!0,globals:p,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!e||!ve(e)||!l(e.value))return!1;Number.isNaN(e.value[4].value)&&(e.value[4].value=0),r=e}if(g===i&&0===i.length&&ve(r)&&a(r.value)&&"from"===r.value[4].value.toLowerCase()){if(b)return!1;for(;pe(e.value[n+1])||be(e.value[n+1]);)n++;if(n++,r=e.value[n],b=c(r),!1===b)return!1;b.syntaxFlags.has(De.Experimental)&&v.syntaxFlags.add(De.Experimental),v.syntaxFlags.add(De.RelativeColorSyntax),b=colorDataToForRelativeColorSyntax(b,o),m=normalizeRelativeColorDataChannels(b),p=noneToZeroInRelativeColorDataChannels(m)}else{if(!ve(r))return!1;if(a(r.value)&&m){const e=r.value[4].value.toLowerCase();if(m.has(e)){g.push(new fe(m.get(e)));continue}}g.push(r)}}}if(1!==g.length)return!1;if(1!==i.length||1!==u.length||1!==h.length)return!1;if(!ve(i[0])||!ve(u[0])||!ve(h[0]))return!1;if(m&&!m.has("alpha"))return!1;const f=n(i[0].value,0,v);if(!f||!r(f))return!1;const d=n(u[0].value,1,v);if(!d||!r(d))return!1;const y=n(h[0].value,2,v);if(!y||!r(y))return!1;const _=[f,d,y];if(1===N.length)if(v.syntaxFlags.add(De.HasAlpha),ve(N[0])){const e=n(N[0].value,3,v);if(!e||!r(e))return!1;_.push(e)}else v.alpha=N[0];else if(m&&m.has("alpha")){const e=n(m.get("alpha"),3,v);if(!e||!r(e))return!1;_.push(e)}return v.channels=[_[0][4].value,_[1][4].value,_[2][4].value],4===_.length&&(v.alpha=_[3][4].value),v}function hsl(e,n){if(e.value.some(e=>ve(e)&&s(e.value))){const n=hslCommaSeparated(e);if(!1!==n)return n}{const a=hslSpaceSeparated(e,n);if(!1!==a)return a}return!1}function hslCommaSeparated(e){return threeChannelLegacySyntax(e,normalize_legacy_HSL_ChannelValues,xe.HSL,[De.LegacyHSL])}function hslSpaceSeparated(e,n){return threeChannelSpaceSeparated(e,normalize_modern_HSL_ChannelValues,xe.HSL,[],n)}function normalize_HWB_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(0===l){const e=normalizeHue(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3===l?s.syntaxFlags.add(De.HasPercentageAlpha):s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,1,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function normalize_Lab_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l||2===l?normalize(t[4].value,.8,-2147483647,2147483647):3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,0,100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=1===l||2===l?normalize(t[4].value,1,-2147483647,2147483647):normalize(t[4].value,1,0,3===l?1:100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function lab(e,n){return threeChannelSpaceSeparated(e,normalize_Lab_ChannelValues,xe.Lab,[],n)}function normalize_LCH_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(2===l){const e=normalizeHue(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l?normalize(t[4].value,100/150,0,2147483647):3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,0,100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=normalize(t[4].value,1,0,1===l?2147483647:3===l?1:100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function lch(e,n){return threeChannelSpaceSeparated(e,normalize_LCH_ChannelValues,xe.LCH,[],n)}const $e=new Map;for(const[e,n]of Object.entries(Q))$e.set(e,n);function namedColor(e){const n=$e.get(toLowerCaseAZ(e));return!!n&&{colorNotation:xe.RGB,channels:[n[0]/255,n[1]/255,n[2]/255],alpha:1,syntaxFlags:new Set([De.ColorKeyword,De.NamedColor])}}function normalize_OKLab_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l||2===l?normalize(t[4].value,250,-2147483647,2147483647):normalize(t[4].value,100,0,1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=1===l||2===l?normalize(t[4].value,1,-2147483647,2147483647):normalize(t[4].value,1,0,1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function oklab(e,n){return threeChannelSpaceSeparated(e,normalize_OKLab_ChannelValues,xe.OKLab,[],n)}function normalize_OKLCH_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(2===l){const e=normalizeHue(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l?normalize(t[4].value,250,0,2147483647):normalize(t[4].value,100,0,1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=normalize(t[4].value,1,0,1===l?2147483647:1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function oklch(e,n){return threeChannelSpaceSeparated(e,normalize_OKLCH_ChannelValues,xe.OKLCH,[],n)}function normalize_legacy_sRGB_ChannelValues(a,t,l){if(o(a)){3===t?l.syntaxFlags.add(De.HasPercentageAlpha):l.syntaxFlags.add(De.HasPercentageValues);const o=normalize(a[4].value,100,0,1);return[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}if(r(a)){let o;return 3!==t&&l.syntaxFlags.add(De.HasNumberValues),o=normalize(a[4].value,3===t?1:255,0,1),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}return!1}function normalize_modern_sRGB_ChannelValues(t,l,s){if(a(t)&&"none"===t[4].value.toLowerCase())return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,100,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,255,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function rgb(e,n){if(e.value.some(e=>ve(e)&&s(e.value))){const n=rgbCommaSeparated(e);if(!1!==n)return(!n.syntaxFlags.has(De.HasNumberValues)||!n.syntaxFlags.has(De.HasPercentageValues))&&n}else{const a=rgbSpaceSeparated(e,n);if(!1!==a)return a}return!1}function rgbCommaSeparated(e){return threeChannelLegacySyntax(e,normalize_legacy_sRGB_ChannelValues,xe.RGB,[De.LegacyRGB])}function rgbSpaceSeparated(e,n){return threeChannelSpaceSeparated(e,normalize_modern_sRGB_ChannelValues,xe.RGB,[],n)}function XYZ_D65_to_sRGB_Gamut(e){const n=B(e);if(ee(n))return ne(n);let a=e;return a=L(a),a[0]<1e-6&&(a=[0,0,0]),a[0]>.999999&&(a=[1,0,0]),ae(oe(a,oklch_to_lin_srgb,lin_srgb_to_oklch))}function oklch_to_lin_srgb(e){return e=re(e),e=te(e),le(e)}function lin_srgb_to_oklch(e){return e=se(e),e=ce(e),ie(e)}function contrastColor(e,n){let a=!1;for(let o=0;o<e.value.length;o++){const r=e.value[o];if(!pe(r)&&!be(r)&&(a||(a=n(r),!a)))return!1}if(!a)return!1;a.channels=convertNaNToZero(a.channels),a.channels=XYZ_D65_to_sRGB_Gamut(colorData_to_XYZ_D65(a).channels),a.colorNotation=xe.sRGB;const o={colorNotation:xe.RGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([De.ContrastColor,De.Experimental])},r=ue(a.channels,[1,1,1]),t=ue(a.channels,[0,0,0]);return o.channels=r>t?[1,1,1]:[0,0,0],o}function alpha(e,n){let o,s,c=!1,i=!1,u=!1;const h={colorNotation:xe.sRGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([])};for(let N=0;N<e.value.length;N++){let m=e.value[N];if(pe(m)||be(m))for(;pe(e.value[N+1])||be(e.value[N+1]);)N++;else if(u&&!c&&!i&&ve(m)&&t(m.value)&&"/"===m.value[4].value)c=!0;else{if(ge(m)&&Te.has(toLowerCaseAZ(m.getName()))){const[[e]]=we([[m]],{censorIntoStandardRepresentableValues:!0,globals:s,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!e||!ve(e)||!l(e.value))return!1;Number.isNaN(e.value[4].value)&&(e.value[4].value=0),m=e}if(c||i||!ve(m)||!a(m.value)||"from"!==toLowerCaseAZ(m.value[4].value)){if(!c)return!1;if(i)return!1;if(ve(m)){if(a(m.value)&&"alpha"===toLowerCaseAZ(m.value[4].value)&&o&&o.has("alpha")){h.alpha=o.get("alpha")[4].value,i=!0;continue}const e=normalize_Color_ChannelValues(m.value,3,h);if(!e||!r(e))return!1;h.alpha=e[4].value,i=!0;continue}if(ge(m)){const e=ye([[m]],e=>{if(ve(e)&&a(e.value)&&"alpha"===toLowerCaseAZ(e.value[4].value)&&o&&o.has("alpha"))return new fe(o.get("alpha"))});h.alpha=e[0][0],i=!0;continue}return!1}if(u)return!1;for(;pe(e.value[N+1])||be(e.value[N+1]);)N++;if(N++,m=e.value[N],u=n(m),!1===u)return!1;o=normalizeRelativeColorDataChannels(u),s=noneToZeroInRelativeColorDataChannels(o),h.syntaxFlags=new Set(u.syntaxFlags),h.syntaxFlags.add(De.RelativeAlphaSyntax),h.channels=[...u.channels],h.colorNotation=u.colorNotation,h.alpha=u.alpha}}return!!o&&(!!i&&h)}function XYZ_D65_to_P3_Gamut(e){const n=R(e);if(ee(n))return ne(n);let a=e;return a=L(a),a[0]<1e-6&&(a=[0,0,0]),a[0]>.999999&&(a=[1,0,0]),he(oe(a,oklch_to_lin_p3,lin_p3_to_oklch))}function oklch_to_lin_p3(e){return e=re(e),e=te(e),Ne(e)}function lin_p3_to_oklch(e){return e=me(e),e=ce(e),ie(e)}function toPrecision(e,n=7){e=+e,n=+n;const a=(Math.floor(Math.abs(e))+"").length;if(n>a)return+e.toFixed(n-a);{const o=10**(a-n);return Math.round(e/o)*o}}function serializeWithAlpha(a,o,r,t){const l=[e.CloseParen,")",-1,-1,void 0];if("number"==typeof a.alpha){const s=Math.min(1,Math.max(0,toPrecision(Number.isNaN(a.alpha)?0:a.alpha)));return 1===toPrecision(s,4)?new _e(o,l,t):new _e(o,l,[...t,new Ce([r]),new fe([e.Delim,"/",-1,-1,{value:"/"}]),new Ce([r]),new fe([e.Number,toPrecision(s,4).toString(),-1,-1,{value:a.alpha,type:n.Integer}])])}return new _e(o,l,[...t,new Ce([r]),new fe([e.Delim,"/",-1,-1,{value:"/"}]),new Ce([r]),a.alpha])}function serializeP3(a,o=!0){a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation);let r=a.channels.map(e=>Number.isNaN(e)?0:e);o?r=XYZ_D65_to_P3_Gamut(colorData_to_XYZ_D65(a).channels):a.colorNotation!==xe.Display_P3&&(r=R(colorData_to_XYZ_D65(a).channels));const t=o?Math.min(1,Math.max(0,toPrecision(r[0],6))):toPrecision(r[0],6),l=o?Math.min(1,Math.max(0,toPrecision(r[1],6))):toPrecision(r[1],6),s=o?Math.min(1,Math.max(0,toPrecision(r[2],6))):toPrecision(r[2],6),c=[e.Function,"color(",-1,-1,{value:"color"}],i=[e.Whitespace," ",-1,-1,void 0];return serializeWithAlpha(a,c,i,[new fe([e.Ident,"display-p3",-1,-1,{value:"display-p3"}]),new Ce([i]),new fe([e.Number,t.toString(),-1,-1,{value:r[0],type:n.Number}]),new Ce([i]),new fe([e.Number,l.toString(),-1,-1,{value:r[1],type:n.Number}]),new Ce([i]),new fe([e.Number,s.toString(),-1,-1,{value:r[2],type:n.Number}])])}function serializeRGB(a,o=!0){let r;a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation),r=o?XYZ_D65_to_sRGB_Gamut(colorData_to_XYZ_D65(a).channels):B(colorData_to_XYZ_D65(a).channels);const t=Math.min(255,Math.max(0,Math.round(255*toPrecision(r[0])))),l=Math.min(255,Math.max(0,Math.round(255*toPrecision(r[1])))),s=Math.min(255,Math.max(0,Math.round(255*toPrecision(r[2])))),c=[e.CloseParen,")",-1,-1,void 0],i=[e.Whitespace," ",-1,-1,void 0],u=[e.Comma,",",-1,-1,void 0],h=[new fe([e.Number,t.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,r[0])),type:n.Integer}]),new fe(u),new Ce([i]),new fe([e.Number,l.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,r[1])),type:n.Integer}]),new fe(u),new Ce([i]),new fe([e.Number,s.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,r[2])),type:n.Integer}])];if("number"==typeof a.alpha){const o=Math.min(1,Math.max(0,toPrecision(Number.isNaN(a.alpha)?0:a.alpha)));return 1===toPrecision(o,4)?new _e([e.Function,"rgb(",-1,-1,{value:"rgb"}],c,h):new _e([e.Function,"rgba(",-1,-1,{value:"rgba"}],c,[...h,new fe(u),new Ce([i]),new fe([e.Number,toPrecision(o,4).toString(),-1,-1,{value:a.alpha,type:n.Number}])])}return new _e([e.Function,"rgba(",-1,-1,{value:"rgba"}],c,[...h,new fe(u),new Ce([i]),a.alpha])}function serializeHSL(a,o=!0){let r;a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation),r=M(o?w(XYZ_D65_to_sRGB_Gamut(colorData_to_XYZ_D65(a).channels)):colorData_to_XYZ_D65(a).channels),r=r.map(e=>Number.isNaN(e)?0:e);const t=Math.min(360,Math.max(0,Math.round(toPrecision(r[0]))))%360,l=Math.min(100,Math.max(0,Math.round(toPrecision(r[1])))),s=Math.min(100,Math.max(0,Math.round(toPrecision(r[2])))),c=[e.CloseParen,")",-1,-1,void 0],i=[e.Whitespace," ",-1,-1,void 0],u=[e.Comma,",",-1,-1,void 0],h=[new fe([e.Number,t.toString(),-1,-1,{value:r[0],type:n.Integer}]),new fe(u),new Ce([i]),new fe([e.Percentage,l.toString()+"%",-1,-1,{value:r[1]}]),new fe(u),new Ce([i]),new fe([e.Percentage,s.toString()+"%",-1,-1,{value:r[2]}])];if("number"==typeof a.alpha){const o=Math.min(1,Math.max(0,toPrecision(Number.isNaN(a.alpha)?0:a.alpha)));return 1===toPrecision(o,4)?new _e([e.Function,"hsl(",-1,-1,{value:"hsl"}],c,h):new _e([e.Function,"hsla(",-1,-1,{value:"hsla"}],c,[...h,new fe(u),new Ce([i]),new fe([e.Number,toPrecision(o,4).toString(),-1,-1,{value:a.alpha,type:n.Number}])])}return new _e([e.Function,"hsla(",-1,-1,{value:"hsla"}],c,[...h,new fe(u),new Ce([i]),a.alpha])}function serializeOKLCH(a){a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation);let o=a.channels.map(e=>Number.isNaN(e)?0:e);a.colorNotation!==xe.OKLCH&&(o=L(colorData_to_XYZ_D65(a).channels));const r=toPrecision(o[0],6),t=toPrecision(o[1],6),l=toPrecision(o[2],6),s=[e.Function,"oklch(",-1,-1,{value:"oklch"}],c=[e.Whitespace," ",-1,-1,void 0];return serializeWithAlpha(a,s,c,[new fe([e.Number,r.toString(),-1,-1,{value:o[0],type:n.Number}]),new Ce([c]),new fe([e.Number,t.toString(),-1,-1,{value:o[1],type:n.Number}]),new Ce([c]),new fe([e.Number,l.toString(),-1,-1,{value:o[2],type:n.Number}])])}function computedValue(e,n=!0){const a=e.channels;switch(e.colorNotation){case xe.Lab:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(a[2]),1!==e.alpha?`lab(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`lab(${a[0]} ${a[1]} ${a[2]})`;case xe.LCH:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(a[2]),1!==e.alpha?`lch(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`lch(${a[0]} ${a[1]} ${a[2]})`;case xe.OKLab:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(a[2]),1!==e.alpha?`oklab(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`oklab(${a[0]} ${a[1]} ${a[2]})`;case xe.OKLCH:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(a[2]),1!==e.alpha?`oklch(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`oklch(${a[0]} ${a[1]} ${a[2]})`;case xe.RGB:case xe.HEX:return a.some(Number.isNaN)||Number.isNaN(e.alpha)?1!==e.alpha?`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`:e.syntaxFlags.has(De.RelativeColorSyntax)||e.syntaxFlags.has(De.ColorMix)||e.syntaxFlags.has(De.RelativeAlphaSyntax)?computedValue(colorDataToForRelativeColorSyntax(e,xe.sRGB)):1!==e.alpha?`rgba(${nanToNone(Math.round(255*reducePrecision(e.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[2],5)))}, ${nanToNone(e.alpha)})`:`rgb(${nanToNone(Math.round(255*reducePrecision(e.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[2],5)))})`;case xe.HSL:{if(a.some(Number.isNaN)||Number.isNaN(e.alpha)||!1===n)return 1!==e.alpha?`hsl(${nanToNone(a[0])} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")} / ${nanToNone(e.alpha)})`:`hsl(${nanToNone(a[0])} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")})`;if(e.syntaxFlags.has(De.RelativeColorSyntax)||e.syntaxFlags.has(De.ColorMix)||e.syntaxFlags.has(De.RelativeAlphaSyntax))return computedValue(colorDataToForRelativeColorSyntax(e,xe.sRGB));const o=colorDataToForRelativeColorSyntax(e,xe.RGB);return 1!==o.alpha?`rgba(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))}, ${nanToNone(o.alpha)})`:`rgb(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))})`}case xe.HWB:{if(a.some(Number.isNaN)||Number.isNaN(e.alpha)||!1===n)return 1!==e.alpha?`hwb(${nanToNone(a[0])} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")} / ${nanToNone(e.alpha)})`:`hwb(${nanToNone(a[0])} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")})`;if(e.syntaxFlags.has(De.RelativeColorSyntax)||e.syntaxFlags.has(De.ColorMix)||e.syntaxFlags.has(De.RelativeAlphaSyntax))return computedValue(colorDataToForRelativeColorSyntax(e,xe.sRGB));const o=colorDataToForRelativeColorSyntax(e,xe.RGB);return 1!==o.alpha?`rgba(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))}, ${nanToNone(o.alpha)})`:`rgb(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))})`}case xe.sRGB:return 1!==e.alpha?`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Linear_sRGB:return 1!==e.alpha?`color(srgb-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(srgb-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Display_P3:return 1!==e.alpha?`color(display-p3 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(display-p3 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Linear_Display_P3:return 1!==e.alpha?`color(display-p3-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(display-p3-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.A98_RGB:return 1!==e.alpha?`color(a98-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(a98-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.ProPhoto_RGB:return 1!==e.alpha?`color(prophoto-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(prophoto-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Rec2020:return 1!==e.alpha?`color(rec2020 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(rec2020 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.XYZ_D65:return 1!==e.alpha?`color(xyz-d65 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(xyz-d65 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.XYZ_D50:return 1!==e.alpha?`color(xyz-d50 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(xyz-d50 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`}throw new Error("unsupported color")}function nanToNone(e,n=""){return"string"==typeof e?e:"number"!=typeof e?e.toString():Number.isNaN(e)?"none":n?e.toString()+n:e.toString()}function reducePrecision(e,n=8){return Number.isNaN(e)||!Number.isFinite(e)?e:(n=Math.pow(10,n),Math.round(e*n)/n)}function color(e){if(ge(e)){switch(toLowerCaseAZ(e.getName())){case"rgb":case"rgba":return rgb(e,color);case"hsl":case"hsla":return hsl(e,color);case"hwb":return n=color,threeChannelSpaceSeparated(e,normalize_HWB_ChannelValues,xe.HWB,[],n);case"lab":return lab(e,color);case"lch":return lch(e,color);case"oklab":return oklab(e,color);case"oklch":return oklch(e,color);case"color":return color$1(e,color);case"color-mix":return colorMix(e,color);case"contrast-color":return contrastColor(e,color);case"alpha":return alpha(e,color)}}var n;if(ve(e)){if(i(e.value))return hex(e.value);if(a(e.value)){const n=namedColor(e.value[4].value);return!1!==n?n:"transparent"===toLowerCaseAZ(e.value[4].value)&&{colorNotation:xe.RGB,channels:[0,0,0],alpha:0,syntaxFlags:new Set([De.ColorKeyword])}}}return!1}export{xe as ColorNotation,De as SyntaxFlag,color,colorDataFitsDisplayP3_Gamut,colorDataFitsRGB_Gamut,computedValue,serializeHSL,serializeOKLCH,serializeP3,serializeRGB};
node_modules/@csstools/css-color-parser/package.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@csstools/css-color-parser",
3
+ "description": "Parse CSS color values",
4
+ "version": "4.2.0",
5
+ "contributors": [
6
+ {
7
+ "name": "Antonio Laguna",
8
+ "email": "antonio@laguna.es",
9
+ "url": "https://antonio.laguna.es"
10
+ },
11
+ {
12
+ "name": "Romain Menke",
13
+ "email": "romainmenke@gmail.com"
14
+ }
15
+ ],
16
+ "license": "MIT",
17
+ "funding": [
18
+ {
19
+ "type": "github",
20
+ "url": "https://github.com/sponsors/csstools"
21
+ },
22
+ {
23
+ "type": "opencollective",
24
+ "url": "https://opencollective.com/csstools"
25
+ }
26
+ ],
27
+ "engines": {
28
+ "node": ">=20.19.0"
29
+ },
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.mjs"
35
+ }
36
+ },
37
+ "files": [
38
+ "CHANGELOG.md",
39
+ "LICENSE.md",
40
+ "README.md",
41
+ "dist"
42
+ ],
43
+ "dependencies": {
44
+ "@csstools/color-helpers": "^6.1.1",
45
+ "@csstools/css-calc": "^3.3.0"
46
+ },
47
+ "peerDependencies": {
48
+ "@csstools/css-parser-algorithms": "^4.0.0",
49
+ "@csstools/css-tokenizer": "^4.0.0"
50
+ },
51
+ "scripts": {},
52
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser#readme",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
56
+ "directory": "packages/css-color-parser"
57
+ },
58
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
59
+ "keywords": [
60
+ "color",
61
+ "css",
62
+ "parser"
63
+ ]
64
+ }
node_modules/@csstools/css-parser-algorithms/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changes to CSS Parser Algorithms
2
+
3
+ ### 4.0.0
4
+
5
+ _January 14, 2026_
6
+
7
+ - Updated: Support for Node `20.19.0` or later (major).
8
+ - Removed: `commonjs` API. In supported Node versions `require(esm)` will work without needing to make code changes.
9
+ - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`4.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#400) (major)
10
+
11
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md)
node_modules/@csstools/css-parser-algorithms/LICENSE.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
node_modules/@csstools/css-parser-algorithms/README.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CSS Parser Algorithms <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
2
+
3
+ [<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-parser-algorithms.svg" height="20">][npm-url]
4
+ [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
5
+ [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
6
+
7
+ Implemented from : https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/
8
+
9
+ ## API
10
+
11
+ [Read the API docs](./docs/css-parser-algorithms.md)
12
+
13
+ ## Usage
14
+
15
+ Add [CSS Parser Algorithms] to your project:
16
+
17
+ ```bash
18
+ npm install @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
19
+ ```
20
+
21
+ [CSS Parser Algorithms] only accepts tokenized CSS.
22
+ It must be used together with `@csstools/css-tokenizer`.
23
+
24
+
25
+ ```js
26
+ import { tokenizer, TokenType } from '@csstools/css-tokenizer';
27
+ import { parseComponentValue } from '@csstools/css-parser-algorithms';
28
+
29
+ const myCSS = `@media only screen and (min-width: 768rem) {
30
+ .foo {
31
+ content: 'Some content!' !important;
32
+ }
33
+ }
34
+ `;
35
+
36
+ const t = tokenizer({
37
+ css: myCSS,
38
+ });
39
+
40
+ const tokens = [];
41
+
42
+ {
43
+ while (!t.endOfFile()) {
44
+ tokens.push(t.nextToken());
45
+ }
46
+
47
+ tokens.push(t.nextToken()); // EOF-token
48
+ }
49
+
50
+ const options = {
51
+ onParseError: ((err) => {
52
+ throw err;
53
+ }),
54
+ };
55
+
56
+ const result = parseComponentValue(tokens, options);
57
+
58
+ console.log(result);
59
+ ```
60
+
61
+ ### Available functions
62
+
63
+ - [`parseComponentValue`](https://www.w3.org/TR/css-syntax-3/#parse-component-value)
64
+ - [`parseListOfComponentValues`](https://www.w3.org/TR/css-syntax-3/#parse-list-of-component-values)
65
+ - [`parseCommaSeparatedListOfComponentValues`](https://www.w3.org/TR/css-syntax-3/#parse-comma-separated-list-of-component-values)
66
+
67
+ ### Utilities
68
+
69
+ #### `gatherNodeAncestry`
70
+
71
+ The AST does not expose the entire ancestry of each node.
72
+ The walker methods do provide access to the current parent, but also not the entire ancestry.
73
+
74
+ To gather the entire ancestry for a a given sub tree of the AST you can use `gatherNodeAncestry`.
75
+ The result is a `Map` with the child nodes as keys and the parents as values.
76
+ This allows you to lookup any ancestor of any node.
77
+
78
+ ```js
79
+ import { parseComponentValue } from '@csstools/css-parser-algorithms';
80
+
81
+ const result = parseComponentValue(tokens, options);
82
+ const ancestry = gatherNodeAncestry(result);
83
+ ```
84
+
85
+ ### Options
86
+
87
+ ```ts
88
+ {
89
+ onParseError?: (error: ParseError) => void
90
+ }
91
+ ```
92
+
93
+ #### `onParseError`
94
+
95
+ The parser algorithms are forgiving and won't stop when a parse error is encountered.
96
+ Parse errors also aren't tokens.
97
+
98
+ To receive parsing error information you can set a callback.
99
+
100
+ Parser errors will try to inform you about the point in the parsing logic the error happened.
101
+ This tells you the kind of error.
102
+
103
+ ## Goals and non-goals
104
+
105
+ Things this package aims to be:
106
+ - specification compliant CSS parser
107
+ - a reliable low level package to be used in CSS sub-grammars
108
+
109
+ What it is not:
110
+ - opinionated
111
+ - fast
112
+ - small
113
+ - a replacement for PostCSS (PostCSS is fast and also an ecosystem)
114
+
115
+ [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
116
+ [discord]: https://discord.gg/bUadyRwkJS
117
+ [npm-url]: https://www.npmjs.com/package/@csstools/css-parser-algorithms
118
+
119
+ [CSS Parser Algorithms]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms
node_modules/@csstools/css-parser-algorithms/dist/index.d.ts ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Parse CSS following the {@link https://drafts.csswg.org/css-syntax/#parsing | CSS Syntax Level 3 specification}.
3
+ *
4
+ * @remarks
5
+ * The tokenizing and parsing tools provided by CSS Tools are designed to be low level and generic with strong ties to their respective specifications.
6
+ *
7
+ * Any analysis or mutation of CSS source code should be done with the least powerful tool that can accomplish the task.
8
+ * For many applications it is sufficient to work with tokens.
9
+ * For others you might need to use {@link https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms | @csstools/css-parser-algorithms} or a more specific parser.
10
+ *
11
+ * The implementation of the AST nodes is kept lightweight and simple.
12
+ * Do not expect magic methods, instead assume that arrays and class instances behave like any other JavaScript.
13
+ *
14
+ * @example
15
+ * Parse a string of CSS into a component value:
16
+ * ```js
17
+ * import { tokenize } from '@csstools/css-tokenizer';
18
+ * import { parseComponentValue } from '@csstools/css-parser-algorithms';
19
+ *
20
+ * const myCSS = `calc(1px * 2)`;
21
+ *
22
+ * const componentValue = parseComponentValue(tokenize({
23
+ * css: myCSS,
24
+ * }));
25
+ *
26
+ * console.log(componentValue);
27
+ * ```
28
+ *
29
+ * @example
30
+ * Use the right algorithm for the job.
31
+ *
32
+ * Algorithms that can parse larger structures (comma-separated lists, ...) can also parse smaller structures.
33
+ * However, the opposite is not true.
34
+ *
35
+ * If your context allows a list of component values, use {@link parseListOfComponentValues}:
36
+ * ```js
37
+ * import { tokenize } from '@csstools/css-tokenizer';
38
+ * import { parseListOfComponentValues } from '@csstools/css-parser-algorithms';
39
+ *
40
+ * parseListOfComponentValues(tokenize({ css: `10x 20px` }));
41
+ * ```
42
+ *
43
+ * If your context allows a comma-separated list of component values, use {@link parseCommaSeparatedListOfComponentValues}:
44
+ * ```js
45
+ * import { tokenize } from '@csstools/css-tokenizer';
46
+ * import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms';
47
+ *
48
+ * parseCommaSeparatedListOfComponentValues(tokenize({ css: `20deg, 50%, 30%` }));
49
+ * ```
50
+ *
51
+ * @example
52
+ * Use the stateful walkers to keep track of the context of a given component value.
53
+ *
54
+ * ```js
55
+ * import { tokenize } from '@csstools/css-tokenizer';
56
+ * import { parseComponentValue, isSimpleBlockNode } from '@csstools/css-parser-algorithms';
57
+ *
58
+ * const myCSS = `calc(1px * (5 / 2))`;
59
+ *
60
+ * const componentValue = parseComponentValue(tokenize({ css: myCSS }));
61
+ *
62
+ * let state = { inSimpleBlock: false };
63
+ * componentValue.walk((entry) => {
64
+ * if (isSimpleBlockNode(entry)) {
65
+ * entry.state.inSimpleBlock = true;
66
+ * return;
67
+ * }
68
+ *
69
+ * if (entry.state.inSimpleBlock) {
70
+ * console.log(entry.node.toString()); // `5`, ...
71
+ * }
72
+ * }, state);
73
+ * ```
74
+ *
75
+ * @packageDocumentation
76
+ */
77
+
78
+ import type { CSSToken } from '@csstools/css-tokenizer';
79
+ import { ParseError } from '@csstools/css-tokenizer';
80
+ import type { TokenFunction } from '@csstools/css-tokenizer';
81
+
82
+ export declare class CommentNode {
83
+ /**
84
+ * The node type, always `ComponentValueType.Comment`
85
+ */
86
+ type: ComponentValueType;
87
+ /**
88
+ * The comment token.
89
+ */
90
+ value: CSSToken;
91
+ constructor(value: CSSToken);
92
+ /**
93
+ * Retrieve the tokens for the current comment.
94
+ * This is the inverse of parsing from a list of tokens.
95
+ */
96
+ tokens(): Array<CSSToken>;
97
+ /**
98
+ * Convert the current comment to a string.
99
+ * This is not a true serialization.
100
+ * It is purely a concatenation of the string representation of the tokens.
101
+ */
102
+ toString(): string;
103
+ /**
104
+ * @internal
105
+ *
106
+ * A debug helper to convert the current object to a JSON representation.
107
+ * This is useful in asserts and to store large ASTs in files.
108
+ */
109
+ toJSON(): Record<string, unknown>;
110
+ /**
111
+ * @internal
112
+ */
113
+ isCommentNode(): this is CommentNode;
114
+ /**
115
+ * @internal
116
+ */
117
+ static isCommentNode(x: unknown): x is CommentNode;
118
+ }
119
+
120
+ export declare type ComponentValue = FunctionNode | SimpleBlockNode | WhitespaceNode | CommentNode | TokenNode;
121
+
122
+ export declare enum ComponentValueType {
123
+ Function = "function",
124
+ SimpleBlock = "simple-block",
125
+ Whitespace = "whitespace",
126
+ Comment = "comment",
127
+ Token = "token"
128
+ }
129
+
130
+ export declare type ContainerNode = FunctionNode | SimpleBlockNode;
131
+
132
+ export declare abstract class ContainerNodeBaseClass {
133
+ /**
134
+ * The contents of the `Function` or `Simple Block`.
135
+ * This is a list of component values.
136
+ */
137
+ value: Array<ComponentValue>;
138
+ /**
139
+ * Retrieve the index of the given item in the current node.
140
+ * For most node types this will be trivially implemented as `this.value.indexOf(item)`.
141
+ */
142
+ indexOf(item: ComponentValue): number | string;
143
+ /**
144
+ * Retrieve the item at the given index in the current node.
145
+ * For most node types this will be trivially implemented as `this.value[index]`.
146
+ */
147
+ at(index: number | string): ComponentValue | undefined;
148
+ /**
149
+ * Iterates over each item in the `value` array of the current node.
150
+ *
151
+ * @param cb - The callback function to execute for each item.
152
+ * The function receives an object containing the current node (`node`), its parent (`parent`),
153
+ * and an optional `state` object.
154
+ * A second parameter is the index of the current node.
155
+ * The function can return `false` to stop the iteration.
156
+ *
157
+ * @param state - An optional state object that can be used to pass additional information to the callback function.
158
+ * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration.
159
+ *
160
+ * @returns `false` if the iteration was halted, `undefined` otherwise.
161
+ */
162
+ forEach<T extends Record<string, unknown>, U extends ContainerNode>(this: U, cb: (entry: {
163
+ node: ComponentValue;
164
+ parent: ContainerNode;
165
+ state?: T;
166
+ }, index: number | string) => boolean | void, state?: T): false | undefined;
167
+ /**
168
+ * Walks the current node and all its children.
169
+ *
170
+ * @param cb - The callback function to execute for each item.
171
+ * The function receives an object containing the current node (`node`), its parent (`parent`),
172
+ * and an optional `state` object.
173
+ * A second parameter is the index of the current node.
174
+ * The function can return `false` to stop the iteration.
175
+ *
176
+ * @param state - An optional state object that can be used to pass additional information to the callback function.
177
+ * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration.
178
+ * However changes are passed down to child node iterations.
179
+ *
180
+ * @returns `false` if the iteration was halted, `undefined` otherwise.
181
+ */
182
+ walk<T extends Record<string, unknown>, U extends ContainerNode>(this: U, cb: (entry: {
183
+ node: ComponentValue;
184
+ parent: ContainerNode;
185
+ state?: T;
186
+ }, index: number | string) => boolean | void, state?: T): false | undefined;
187
+ }
188
+
189
+ /**
190
+ * Iterates over each item in a list of component values.
191
+ *
192
+ * @param cb - The callback function to execute for each item.
193
+ * The function receives an object containing the current node (`node`), its parent (`parent`),
194
+ * and an optional `state` object.
195
+ * A second parameter is the index of the current node.
196
+ * The function can return `false` to stop the iteration.
197
+ *
198
+ * @param state - An optional state object that can be used to pass additional information to the callback function.
199
+ * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration.
200
+ *
201
+ * @returns `false` if the iteration was halted, `undefined` otherwise.
202
+ */
203
+ export declare function forEach<T extends Record<string, unknown>>(componentValues: Array<ComponentValue>, cb: (entry: {
204
+ node: ComponentValue;
205
+ parent: ContainerNode | {
206
+ value: Array<ComponentValue>;
207
+ };
208
+ state?: T;
209
+ }, index: number | string) => boolean | void, state?: T): false | undefined;
210
+
211
+ /**
212
+ * A function node.
213
+ *
214
+ * @example
215
+ * ```js
216
+ * const node = parseComponentValue(tokenize('calc(1 + 1)'));
217
+ *
218
+ * isFunctionNode(node); // true
219
+ * node.getName(); // 'calc'
220
+ * ```
221
+ */
222
+ export declare class FunctionNode extends ContainerNodeBaseClass {
223
+ /**
224
+ * The node type, always `ComponentValueType.Function`
225
+ */
226
+ type: ComponentValueType;
227
+ /**
228
+ * The token for the name of the function.
229
+ */
230
+ name: TokenFunction;
231
+ /**
232
+ * The token for the closing parenthesis of the function.
233
+ * If the function is unclosed, this will be an EOF token.
234
+ */
235
+ endToken: CSSToken;
236
+ constructor(name: TokenFunction, endToken: CSSToken, value: Array<ComponentValue>);
237
+ /**
238
+ * Retrieve the name of the current function.
239
+ * This is the parsed and unescaped name of the function.
240
+ */
241
+ getName(): string;
242
+ /**
243
+ * Normalize the current function:
244
+ * 1. if the "endToken" is EOF, replace with a ")-token"
245
+ */
246
+ normalize(): void;
247
+ /**
248
+ * Retrieve the tokens for the current function.
249
+ * This is the inverse of parsing from a list of tokens.
250
+ */
251
+ tokens(): Array<CSSToken>;
252
+ /**
253
+ * Convert the current function to a string.
254
+ * This is not a true serialization.
255
+ * It is purely a concatenation of the string representation of the tokens.
256
+ */
257
+ toString(): string;
258
+ /**
259
+ * @internal
260
+ *
261
+ * A debug helper to convert the current object to a JSON representation.
262
+ * This is useful in asserts and to store large ASTs in files.
263
+ */
264
+ toJSON(): unknown;
265
+ /**
266
+ * @internal
267
+ */
268
+ isFunctionNode(): this is FunctionNode;
269
+ /**
270
+ * @internal
271
+ */
272
+ static isFunctionNode(x: unknown): x is FunctionNode;
273
+ }
274
+
275
+ /**
276
+ * AST nodes do not have a `parent` property or method.
277
+ * This makes it harder to traverse the AST upwards.
278
+ * This function builds a `Map<Child, Parent>` that can be used to lookup ancestors of a node.
279
+ *
280
+ * @remarks
281
+ * There is no magic behind this or the map it returns.
282
+ * Mutating the AST will not update the map.
283
+ *
284
+ * Types are erased and any content of the map has type `unknown`.
285
+ * If someone knows a clever way to type this, please let us know.
286
+ *
287
+ * @example
288
+ * ```js
289
+ * const ancestry = gatherNodeAncestry(mediaQuery);
290
+ * mediaQuery.walk((entry) => {
291
+ * const node = entry.node; // directly exposed
292
+ * const parent = entry.parent; // directly exposed
293
+ * const grandParent: unknown = ancestry.get(parent); // lookup
294
+ *
295
+ * console.log('node', node);
296
+ * console.log('parent', parent);
297
+ * console.log('grandParent', grandParent);
298
+ * });
299
+ * ```
300
+ */
301
+ export declare function gatherNodeAncestry(node: {
302
+ walk(cb: (entry: {
303
+ node: unknown;
304
+ parent: unknown;
305
+ }, index: number | string) => boolean | void): false | undefined;
306
+ }): Map<unknown, unknown>;
307
+
308
+ /**
309
+ * Check if the current object is a `CommentNode`.
310
+ * This is a type guard.
311
+ */
312
+ export declare function isCommentNode(x: unknown): x is CommentNode;
313
+
314
+ /**
315
+ * Check if the current object is a `FunctionNode`.
316
+ * This is a type guard.
317
+ */
318
+ export declare function isFunctionNode(x: unknown): x is FunctionNode;
319
+
320
+ /**
321
+ * Check if the current object is a `SimpleBlockNode`.
322
+ * This is a type guard.
323
+ */
324
+ export declare function isSimpleBlockNode(x: unknown): x is SimpleBlockNode;
325
+
326
+ /**
327
+ * Check if the current object is a `TokenNode`.
328
+ * This is a type guard.
329
+ */
330
+ export declare function isTokenNode(x: unknown): x is TokenNode;
331
+
332
+ /**
333
+ * Check if the current object is a `WhitespaceNode`.
334
+ * This is a type guard.
335
+ */
336
+ export declare function isWhitespaceNode(x: unknown): x is WhitespaceNode;
337
+
338
+ /**
339
+ * Check if the current object is a `WhiteSpaceNode` or a `CommentNode`.
340
+ * This is a type guard.
341
+ */
342
+ export declare function isWhiteSpaceOrCommentNode(x: unknown): x is WhitespaceNode | CommentNode;
343
+
344
+ /**
345
+ * Parse a comma-separated list of component values.
346
+ *
347
+ * @example
348
+ * ```js
349
+ * import { tokenize } from '@csstools/css-tokenizer';
350
+ * import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms';
351
+ *
352
+ * parseCommaSeparatedListOfComponentValues(tokenize({ css: `20deg, 50%, 30%` }));
353
+ * ```
354
+ */
355
+ export declare function parseCommaSeparatedListOfComponentValues(tokens: Array<CSSToken>, options?: {
356
+ onParseError?: (error: ParseError) => void;
357
+ }): Array<Array<ComponentValue>>;
358
+
359
+ /**
360
+ * Parse a single component value.
361
+ *
362
+ * @example
363
+ * ```js
364
+ * import { tokenize } from '@csstools/css-tokenizer';
365
+ * import { parseComponentValue } from '@csstools/css-parser-algorithms';
366
+ *
367
+ * parseComponentValue(tokenize({ css: `10px` }));
368
+ * parseComponentValue(tokenize({ css: `calc((10px + 1x) * 4)` }));
369
+ * ```
370
+ */
371
+ export declare function parseComponentValue(tokens: Array<CSSToken>, options?: {
372
+ onParseError?: (error: ParseError) => void;
373
+ }): ComponentValue | undefined;
374
+
375
+ /**
376
+ * Parse a list of component values.
377
+ *
378
+ * @example
379
+ * ```js
380
+ * import { tokenize } from '@csstools/css-tokenizer';
381
+ * import { parseListOfComponentValues } from '@csstools/css-parser-algorithms';
382
+ *
383
+ * parseListOfComponentValues(tokenize({ css: `20deg 30%` }));
384
+ * ```
385
+ */
386
+ export declare function parseListOfComponentValues(tokens: Array<CSSToken>, options?: {
387
+ onParseError?: (error: ParseError) => void;
388
+ }): Array<ComponentValue>;
389
+
390
+ /**
391
+ * Replace specific component values in a list of component values.
392
+ * A helper for the most common and simplistic cases when mutating an AST.
393
+ */
394
+ export declare function replaceComponentValues(componentValuesList: Array<Array<ComponentValue>>, replaceWith: (componentValue: ComponentValue) => Array<ComponentValue> | ComponentValue | void): Array<Array<ComponentValue>>;
395
+
396
+ /**
397
+ * A simple block node.
398
+ *
399
+ * @example
400
+ * ```js
401
+ * const node = parseComponentValue(tokenize('[foo=bar]'));
402
+ *
403
+ * isSimpleBlockNode(node); // true
404
+ * node.startToken; // [TokenType.OpenSquare, '[', 0, 0, undefined]
405
+ * ```
406
+ */
407
+ export declare class SimpleBlockNode extends ContainerNodeBaseClass {
408
+ /**
409
+ * The node type, always `ComponentValueType.SimpleBlock`
410
+ */
411
+ type: ComponentValueType;
412
+ /**
413
+ * The token for the opening token of the block.
414
+ */
415
+ startToken: CSSToken;
416
+ /**
417
+ * The token for the closing token of the block.
418
+ * If the block is closed it will be the mirror variant of the `startToken`.
419
+ * If the block is unclosed, this will be an EOF token.
420
+ */
421
+ endToken: CSSToken;
422
+ constructor(startToken: CSSToken, endToken: CSSToken, value: Array<ComponentValue>);
423
+ /**
424
+ * Normalize the current simple block
425
+ * 1. if the "endToken" is EOF, replace with the mirror token of the "startToken"
426
+ */
427
+ normalize(): void;
428
+ /**
429
+ * Retrieve the tokens for the current simple block.
430
+ * This is the inverse of parsing from a list of tokens.
431
+ */
432
+ tokens(): Array<CSSToken>;
433
+ /**
434
+ * Convert the current simple block to a string.
435
+ * This is not a true serialization.
436
+ * It is purely a concatenation of the string representation of the tokens.
437
+ */
438
+ toString(): string;
439
+ /**
440
+ * @internal
441
+ *
442
+ * A debug helper to convert the current object to a JSON representation.
443
+ * This is useful in asserts and to store large ASTs in files.
444
+ */
445
+ toJSON(): unknown;
446
+ /**
447
+ * @internal
448
+ */
449
+ isSimpleBlockNode(): this is SimpleBlockNode;
450
+ /**
451
+ * @internal
452
+ */
453
+ static isSimpleBlockNode(x: unknown): x is SimpleBlockNode;
454
+ }
455
+
456
+ /**
457
+ * Returns the start and end index of a node in the CSS source string.
458
+ */
459
+ export declare function sourceIndices(x: {
460
+ tokens(): Array<CSSToken>;
461
+ } | Array<{
462
+ tokens(): Array<CSSToken>;
463
+ }>): [number, number];
464
+
465
+ /**
466
+ * Concatenate the string representation of a collection of component values.
467
+ * This is not a proper serializer that will handle escaping and whitespace.
468
+ * It only produces valid CSS for token lists that are also valid.
469
+ */
470
+ export declare function stringify(componentValueLists: Array<Array<ComponentValue>>): string;
471
+
472
+ export declare class TokenNode {
473
+ /**
474
+ * The node type, always `ComponentValueType.Token`
475
+ */
476
+ type: ComponentValueType;
477
+ /**
478
+ * The token.
479
+ */
480
+ value: CSSToken;
481
+ constructor(value: CSSToken);
482
+ /**
483
+ * This is the inverse of parsing from a list of tokens.
484
+ */
485
+ tokens(): [CSSToken];
486
+ /**
487
+ * Convert the current token to a string.
488
+ * This is not a true serialization.
489
+ * It is purely the string representation of token.
490
+ */
491
+ toString(): string;
492
+ /**
493
+ * @internal
494
+ *
495
+ * A debug helper to convert the current object to a JSON representation.
496
+ * This is useful in asserts and to store large ASTs in files.
497
+ */
498
+ toJSON(): Record<string, unknown>;
499
+ /**
500
+ * @internal
501
+ */
502
+ isTokenNode(): this is TokenNode;
503
+ /**
504
+ * @internal
505
+ */
506
+ static isTokenNode(x: unknown): x is TokenNode;
507
+ }
508
+
509
+ /**
510
+ * Walks each item in a list of component values all of their children.
511
+ *
512
+ * @param cb - The callback function to execute for each item.
513
+ * The function receives an object containing the current node (`node`), its parent (`parent`),
514
+ * and an optional `state` object.
515
+ * A second parameter is the index of the current node.
516
+ * The function can return `false` to stop the iteration.
517
+ *
518
+ * @param state - An optional state object that can be used to pass additional information to the callback function.
519
+ * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration.
520
+ * However changes are passed down to child node iterations.
521
+ *
522
+ * @returns `false` if the iteration was halted, `undefined` otherwise.
523
+ *
524
+ * @example
525
+ * ```js
526
+ * import { tokenize } from '@csstools/css-tokenizer';
527
+ * import { parseListOfComponentValues, isSimpleBlockNode } from '@csstools/css-parser-algorithms';
528
+ *
529
+ * const myCSS = `calc(1px * (5 / 2)) 10px`;
530
+ *
531
+ * const componentValues = parseListOfComponentValues(tokenize({ css: myCSS }));
532
+ *
533
+ * let state = { inSimpleBlock: false };
534
+ * walk(componentValues, (entry) => {
535
+ * if (isSimpleBlockNode(entry)) {
536
+ * entry.state.inSimpleBlock = true;
537
+ * return;
538
+ * }
539
+ *
540
+ * if (entry.state.inSimpleBlock) {
541
+ * console.log(entry.node.toString()); // `5`, ...
542
+ * }
543
+ * }, state);
544
+ * ```
545
+ */
546
+ export declare function walk<T extends Record<string, unknown>>(componentValues: Array<ComponentValue>, cb: (entry: {
547
+ node: ComponentValue;
548
+ parent: ContainerNode | {
549
+ value: Array<ComponentValue>;
550
+ };
551
+ state?: T;
552
+ }, index: number | string) => boolean | void, state?: T): false | undefined;
553
+
554
+ /**
555
+ * Generate a function that finds the next element that should be visited when walking an AST.
556
+ * Rules :
557
+ * 1. the previous iteration is used as a reference, so any checks are relative to the start of the current iteration.
558
+ * 2. the next element always appears after the current index.
559
+ * 3. the next element always exists in the list.
560
+ * 4. replacing an element does not cause the replaced element to be visited.
561
+ * 5. removing an element does not cause elements to be skipped.
562
+ * 6. an element added later in the list will be visited.
563
+ */
564
+ export declare function walkerIndexGenerator<T>(initialList: Array<T>): (list: Array<T>, child: T, index: number) => number;
565
+
566
+ export declare class WhitespaceNode {
567
+ /**
568
+ * The node type, always `ComponentValueType.WhiteSpace`
569
+ */
570
+ type: ComponentValueType;
571
+ /**
572
+ * The list of consecutive whitespace tokens.
573
+ */
574
+ value: Array<CSSToken>;
575
+ constructor(value: Array<CSSToken>);
576
+ /**
577
+ * Retrieve the tokens for the current whitespace.
578
+ * This is the inverse of parsing from a list of tokens.
579
+ */
580
+ tokens(): Array<CSSToken>;
581
+ /**
582
+ * Convert the current whitespace to a string.
583
+ * This is not a true serialization.
584
+ * It is purely a concatenation of the string representation of the tokens.
585
+ */
586
+ toString(): string;
587
+ /**
588
+ * @internal
589
+ *
590
+ * A debug helper to convert the current object to a JSON representation.
591
+ * This is useful in asserts and to store large ASTs in files.
592
+ */
593
+ toJSON(): Record<string, unknown>;
594
+ /**
595
+ * @internal
596
+ */
597
+ isWhitespaceNode(): this is WhitespaceNode;
598
+ /**
599
+ * @internal
600
+ */
601
+ static isWhitespaceNode(x: unknown): x is WhitespaceNode;
602
+ }
603
+
604
+ export { }
node_modules/@csstools/css-parser-algorithms/dist/index.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ import{isTokenEOF as e,TokenType as n,isToken as t,stringify as o,mirrorVariant as s,isTokenOpenParen as i,isTokenOpenCurly as r,isTokenOpenSquare as a,isTokenFunction as c,isTokenWhitespace as u,isTokenComment as l,mirrorVariantType as d,ParseError as h,isTokenWhiteSpaceOrComment as p,isTokenCloseParen as m,isTokenComma as k}from"@csstools/css-tokenizer";var f;function walkerIndexGenerator(e){let n=e.slice();return(e,t,o)=>{let s=-1;for(let i=n.indexOf(t);i<n.length&&(s=e.indexOf(n[i]),-1===s||s<o);i++);return-1===s||s===o&&t===e[o]&&(s++,s>=e.length)?-1:(n=e.slice(),s)}}function consumeComponentValue(e,n){const t=n[0];if(i(t)||r(t)||a(t)){const t=consumeSimpleBlock(e,n);return{advance:t.advance,node:t.node}}if(c(t)){const t=consumeFunction(e,n);return{advance:t.advance,node:t.node}}if(u(t)){const t=consumeWhitespace(e,n);return{advance:t.advance,node:t.node}}if(l(t)){const t=consumeComment(e,n);return{advance:t.advance,node:t.node}}return{advance:1,node:new TokenNode(t)}}!function(e){e.Function="function",e.SimpleBlock="simple-block",e.Whitespace="whitespace",e.Comment="comment",e.Token="token"}(f||(f={}));class ContainerNodeBaseClass{value=[];indexOf(e){return this.value.indexOf(e)}at(e){if("number"==typeof e)return e<0&&(e=this.value.length+e),this.value[e]}forEach(e,n){if(0===this.value.length)return;const t=walkerIndexGenerator(this.value);let o=0;for(;o<this.value.length;){const s=this.value[o];let i;if(n&&(i={...n}),!1===e({node:s,parent:this,state:i},o))return!1;if(o=t(this.value,s,o),-1===o)break}}walk(e,n){0!==this.value.length&&this.forEach((n,t)=>!1!==e(n,t)&&((!("walk"in n.node)||!this.value.includes(n.node)||!1!==n.node.walk(e,n.state))&&void 0),n)}}class FunctionNode extends ContainerNodeBaseClass{type=f.Function;name;endToken;constructor(e,n,t){super(),this.name=e,this.endToken=n,this.value=t}getName(){return this.name[4].value}normalize(){e(this.endToken)&&(this.endToken=[n.CloseParen,")",-1,-1,void 0])}tokens(){return e(this.endToken)?[this.name,...this.value.flatMap(e=>e.tokens())]:[this.name,...this.value.flatMap(e=>e.tokens()),this.endToken]}toString(){const e=this.value.map(e=>t(e)?o(e):e.toString()).join("");return o(this.name)+e+o(this.endToken)}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map(e=>e.toJSON())}}isFunctionNode(){return FunctionNode.isFunctionNode(this)}static isFunctionNode(e){return!!e&&(e instanceof FunctionNode&&e.type===f.Function)}}function consumeFunction(n,t){const o=[];let s=1;for(;;){const i=t[s];if(!i||e(i))return n.onParseError(new h("Unexpected EOF while consuming a function.",t[0][2],t[t.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:t.length,node:new FunctionNode(t[0],i,o)};if(m(i))return{advance:s+1,node:new FunctionNode(t[0],i,o)};if(p(i)){const e=consumeAllCommentsAndWhitespace(n,t.slice(s));s+=e.advance,o.push(...e.nodes);continue}const r=consumeComponentValue(n,t.slice(s));s+=r.advance,o.push(r.node)}}class SimpleBlockNode extends ContainerNodeBaseClass{type=f.SimpleBlock;startToken;endToken;constructor(e,n,t){super(),this.startToken=e,this.endToken=n,this.value=t}normalize(){if(e(this.endToken)){const e=s(this.startToken);e&&(this.endToken=e)}}tokens(){return e(this.endToken)?[this.startToken,...this.value.flatMap(e=>e.tokens())]:[this.startToken,...this.value.flatMap(e=>e.tokens()),this.endToken]}toString(){const e=this.value.map(e=>t(e)?o(e):e.toString()).join("");return o(this.startToken)+e+o(this.endToken)}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map(e=>e.toJSON())}}isSimpleBlockNode(){return SimpleBlockNode.isSimpleBlockNode(this)}static isSimpleBlockNode(e){return!!e&&(e instanceof SimpleBlockNode&&e.type===f.SimpleBlock)}}function consumeSimpleBlock(n,t){const o=d(t[0][0]);if(!o)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const s=[];let i=1;for(;;){const r=t[i];if(!r||e(r))return n.onParseError(new h("Unexpected EOF while consuming a simple block.",t[0][2],t[t.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:t.length,node:new SimpleBlockNode(t[0],r,s)};if(r[0]===o)return{advance:i+1,node:new SimpleBlockNode(t[0],r,s)};if(p(r)){const e=consumeAllCommentsAndWhitespace(n,t.slice(i));i+=e.advance,s.push(...e.nodes);continue}const a=consumeComponentValue(n,t.slice(i));i+=a.advance,s.push(a.node)}}class WhitespaceNode{type=f.Whitespace;value;constructor(e){this.value=e}tokens(){return this.value}toString(){return o(...this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isWhitespaceNode(){return WhitespaceNode.isWhitespaceNode(this)}static isWhitespaceNode(e){return!!e&&(e instanceof WhitespaceNode&&e.type===f.Whitespace)}}function consumeWhitespace(e,n){let t=0;for(;;){const e=n[t];if(!u(e))return{advance:t,node:new WhitespaceNode(n.slice(0,t))};t++}}class CommentNode{type=f.Comment;value;constructor(e){this.value=e}tokens(){return[this.value]}toString(){return o(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isCommentNode(){return CommentNode.isCommentNode(this)}static isCommentNode(e){return!!e&&(e instanceof CommentNode&&e.type===f.Comment)}}function consumeComment(e,n){return{advance:1,node:new CommentNode(n[0])}}function consumeAllCommentsAndWhitespace(e,n){const t=[];let o=0;for(;;){if(u(n[o])){const e=consumeWhitespace(0,n.slice(o));o+=e.advance,t.push(e.node);continue}if(!l(n[o]))return{advance:o,nodes:t};t.push(new CommentNode(n[o])),o++}}class TokenNode{type=f.Token;value;constructor(e){this.value=e}tokens(){return[this.value]}toString(){return this.value[1]}toJSON(){return{type:this.type,tokens:this.tokens()}}isTokenNode(){return TokenNode.isTokenNode(this)}static isTokenNode(e){return!!e&&(e instanceof TokenNode&&e.type===f.Token)}}function parseComponentValue(t,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...t];e(i[i.length-1])||i.push([n.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=consumeComponentValue(s,i);if(e(i[Math.min(r.advance,i.length-1)]))return r.node;s.onParseError(new h("Expected EOF after parsing a component value.",t[0][2],t[t.length-1][3],["5.3.9. Parse a component value","Expected EOF"]))}function parseListOfComponentValues(t,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...t];e(i[i.length-1])&&i.push([n.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=[];let a=0;for(;;){if(!i[a]||e(i[a]))return r;const n=consumeComponentValue(s,i.slice(a));r.push(n.node),a+=n.advance}}function parseCommaSeparatedListOfComponentValues(t,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...t];if(0===t.length)return[];e(i[i.length-1])&&i.push([n.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=[];let a=[],c=0;for(;;){if(!i[c]||e(i[c]))return a.length&&r.push(a),r;if(k(i[c])){r.push(a),a=[],c++;continue}const n=consumeComponentValue(s,t.slice(c));a.push(n.node),c+=n.advance}}function gatherNodeAncestry(e){const n=new Map;return e.walk(e=>{Array.isArray(e.node)?e.node.forEach(t=>{n.set(t,e.parent)}):n.set(e.node,e.parent)}),n}function forEach(e,n,t){if(0===e.length)return;const o=walkerIndexGenerator(e);let s=0;for(;s<e.length;){const i=e[s];let r;if(t&&(r={...t}),!1===n({node:i,parent:{value:e},state:r},s))return!1;if(s=o(e,i,s),-1===s)break}}function walk(e,n,t){0!==e.length&&forEach(e,(t,o)=>!1!==n(t,o)&&((!("walk"in t.node)||!e.includes(t.node)||!1!==t.node.walk(n,t.state))&&void 0),t)}function replaceComponentValues(e,n){for(let t=0;t<e.length;t++){walk(e[t],(e,t)=>{if("number"!=typeof t)return;const o=n(e.node);o&&(Array.isArray(o)?e.parent.value.splice(t,1,...o):e.parent.value.splice(t,1,o))})}return e}function stringify(e){return e.map(e=>e.map(e=>o(...e.tokens())).join("")).join(",")}function isSimpleBlockNode(e){return SimpleBlockNode.isSimpleBlockNode(e)}function isFunctionNode(e){return FunctionNode.isFunctionNode(e)}function isWhitespaceNode(e){return WhitespaceNode.isWhitespaceNode(e)}function isCommentNode(e){return CommentNode.isCommentNode(e)}function isWhiteSpaceOrCommentNode(e){return isWhitespaceNode(e)||isCommentNode(e)}function isTokenNode(e){return TokenNode.isTokenNode(e)}function sourceIndices(e){if(Array.isArray(e)){const n=e[0];if(!n)return[0,0];const t=e[e.length-1]||n;return[sourceIndices(n)[0],sourceIndices(t)[1]]}const n=e.tokens(),t=n[0],o=n[n.length-1];return t&&o?[t[2],o[3]]:[0,0]}export{CommentNode,f as ComponentValueType,ContainerNodeBaseClass,FunctionNode,SimpleBlockNode,TokenNode,WhitespaceNode,forEach,gatherNodeAncestry,isCommentNode,isFunctionNode,isSimpleBlockNode,isTokenNode,isWhiteSpaceOrCommentNode,isWhitespaceNode,parseCommaSeparatedListOfComponentValues,parseComponentValue,parseListOfComponentValues,replaceComponentValues,sourceIndices,stringify,walk,walkerIndexGenerator};
node_modules/@csstools/css-parser-algorithms/package.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@csstools/css-parser-algorithms",
3
+ "description": "Algorithms to help you parse CSS from an array of tokens.",
4
+ "version": "4.0.0",
5
+ "contributors": [
6
+ {
7
+ "name": "Antonio Laguna",
8
+ "email": "antonio@laguna.es",
9
+ "url": "https://antonio.laguna.es"
10
+ },
11
+ {
12
+ "name": "Romain Menke",
13
+ "email": "romainmenke@gmail.com"
14
+ }
15
+ ],
16
+ "license": "MIT",
17
+ "funding": [
18
+ {
19
+ "type": "github",
20
+ "url": "https://github.com/sponsors/csstools"
21
+ },
22
+ {
23
+ "type": "opencollective",
24
+ "url": "https://opencollective.com/csstools"
25
+ }
26
+ ],
27
+ "engines": {
28
+ "node": ">=20.19.0"
29
+ },
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.mjs"
35
+ }
36
+ },
37
+ "files": [
38
+ "CHANGELOG.md",
39
+ "LICENSE.md",
40
+ "README.md",
41
+ "dist"
42
+ ],
43
+ "peerDependencies": {
44
+ "@csstools/css-tokenizer": "^4.0.0"
45
+ },
46
+ "scripts": {},
47
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms#readme",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
51
+ "directory": "packages/css-parser-algorithms"
52
+ },
53
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
54
+ "keywords": [
55
+ "css",
56
+ "parser"
57
+ ]
58
+ }
node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Changes to CSS Syntax Patches For CSSTree
2
+
3
+ ### 1.1.8
4
+
5
+ _August 15, 2026_
6
+
7
+ - Update `@webref/css` to [`v8.7.1`](https://github.com/w3c/webref/releases/tag/%40webref%2Fcss%408.7.1)
8
+
9
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-syntax-patches-for-csstree/CHANGELOG.md)
node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT No Attribution (MIT-0)
2
+
3
+ Copyright © CSSTools Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so.
11
+
12
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
node_modules/@csstools/css-syntax-patches-for-csstree/README.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CSS Syntax Patches For CSSTree <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
2
+
3
+ [<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-syntax-patches-for-csstree.svg" height="20">][npm-url]
4
+ [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
5
+
6
+ Patch [csstree](https://github.com/csstree/csstree) syntax definitions with the latest data from CSS specifications.
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ npm install @csstools/css-syntax-patches-for-csstree
12
+ ```
13
+
14
+ ```js
15
+ import { fork } from 'css-tree';
16
+ import syntax_patches from '@csstools/css-syntax-patches-for-csstree' with { type: 'json' };
17
+
18
+ const forkedLexer = fork({
19
+ atrules: syntax_patches.next.atrules,
20
+ properties: syntax_patches.next.properties,
21
+ types: syntax_patches.next.types,
22
+ }).lexer;
23
+ ```
24
+
25
+ ## `next`
26
+
27
+ ```js
28
+ import syntax_patches from '@csstools/css-syntax-patches-for-csstree' with { type: 'json' };
29
+
30
+ console.log(syntax_patches.next);
31
+ // ^^^^
32
+ ```
33
+
34
+ CSS specifications are often still in flux and various parts might change or disappear altogether.
35
+ Specifications also contains parts that haven't been implemented yet in a browser.
36
+ Only CSS that is widely adopted can be expected to be stable.
37
+
38
+ The `next` grouping contains a combination of what is currently valid in browsers and the progress in various specifications.
39
+
40
+ _In the future more groupings might be added._
41
+
42
+ [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
43
+ [npm-url]: https://www.npmjs.com/package/@csstools/css-syntax-patches-for-csstree
node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export const next: {
2
+ atrules: Record<string, { descriptors: Record<string, string> }>,
3
+ properties: Record<string, string>,
4
+ types: Record<string, string>,
5
+ }
node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json ADDED
@@ -0,0 +1,802 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "next": {
3
+ "atrules": {
4
+ "color-profile": {
5
+ "descriptors": {
6
+ "components": "<ident>#",
7
+ "rendering-intent": "relative-colorimetric | absolute-colorimetric | perceptual | saturation",
8
+ "src": "<url>"
9
+ }
10
+ },
11
+ "font-face": {
12
+ "descriptors": {
13
+ "ascent-override": "[ normal | <percentage [0,∞]> ]{1,2}",
14
+ "descent-override": "[ normal | <percentage [0,∞]> ]{1,2}",
15
+ "font-family": "<font-family-name>",
16
+ "font-language-override": "normal | <string>",
17
+ "font-named-instance": "auto | <string>",
18
+ "font-size": "auto | [ <number> ]{1,2}",
19
+ "font-style": "auto | normal | italic | left | right | oblique [ <angle [-90deg,90deg]>{1,2} ]?",
20
+ "font-weight": "| auto",
21
+ "font-width": "auto | <'font-width'>{1,2}",
22
+ "line-gap-override": "[ normal | <percentage [0,∞]> ]{1,2}",
23
+ "size-adjust": "<percentage [0,∞]>",
24
+ "src": "<font-src-list>",
25
+ "subscript-position-override": "[ normal | from-font | <percentage> ]{1,2}",
26
+ "subscript-size-override": "[ normal | from-font | <percentage [0,∞]> ]{1,2}",
27
+ "superscript-position-override": "[ normal | from-font | <percentage> ]{1,2}",
28
+ "superscript-size-override": "[ normal | from-font | <percentage [0,∞]> ]{1,2}",
29
+ "unicode-range": "<unicode-range-token>#"
30
+ }
31
+ },
32
+ "font-feature-values": {
33
+ "descriptors": {
34
+ "font-display": "auto | block | swap | fallback | optional"
35
+ }
36
+ },
37
+ "font-palette-values": {
38
+ "descriptors": {
39
+ "font-family": "<font-family-name>#"
40
+ }
41
+ },
42
+ "function": {
43
+ "descriptors": {
44
+ "result": "<declaration-value>?"
45
+ }
46
+ },
47
+ "page": {
48
+ "descriptors": {
49
+ "margin": "<'margin'>",
50
+ "margin-bottom": "<'margin-bottom'>",
51
+ "margin-left": "<'margin-left'>",
52
+ "margin-right": "<'margin-right'>",
53
+ "margin-top": "<'margin-top'>",
54
+ "page-margin-safety": "none | clamp | add"
55
+ }
56
+ },
57
+ "position-try": {
58
+ "descriptors": {
59
+ "position-anchor": "<'position-anchor'>",
60
+ "position-area": "<'position-area'>"
61
+ }
62
+ },
63
+ "view-transition": {
64
+ "descriptors": {
65
+ "types": "none | <view-transition-type>+"
66
+ }
67
+ }
68
+ },
69
+ "properties": {
70
+ "align-self": "auto | <overflow-position>? [ normal | <self-position> ] | stretch | <baseline-position> | anchor-center",
71
+ "alignment-baseline": "auto | before-edge | text-before-edge | after-edge | text-after-edge | baseline | <baseline-metric>",
72
+ "all": " | revert-rule",
73
+ "anchor-name": "none | <anchor-name>#",
74
+ "anchor-scope": "none | all | <anchor-name>#",
75
+ "animation-delay": "[ <'animation-delay-start'> <'animation-delay-end'>? ]#",
76
+ "animation-delay-end": "<time [0s,∞]>#",
77
+ "animation-delay-start": "<time>#",
78
+ "animation-range-center": "[ normal | [ <length-percentage> | <timeline-range-center-subject> <length-percentage>? ] ]#",
79
+ "appearance": "none | auto | base | base-select | <compat-auto> | <compat-special> | base",
80
+ "background-blend-mode": "<'mix-blend-mode'>#",
81
+ "background-position-block": "[ center | [ [ start | end ]? <length-percentage>? ]! ]#",
82
+ "background-position-inline": "[ center | [ [ start | end ]? <length-percentage>? ]! ]#",
83
+ "background-repeat-block": "<repetition>#",
84
+ "background-repeat-inline": "<repetition>#",
85
+ "background-repeat-x": "<repetition>#",
86
+ "background-repeat-y": "<repetition>#",
87
+ "background-tbd": "<bg-layer>#",
88
+ "baseline-shift": "<length-percentage> | sub | super | top | center | bottom",
89
+ "block-ellipsis": "no-ellipsis | auto | <string>",
90
+ "block-step": "<'block-step-size'> || <'block-step-insert'> || <'block-step-align'> || <'block-step-round'>",
91
+ "block-step-align": "auto | center | start | end",
92
+ "block-step-insert": "margin-box | padding-box | content-box",
93
+ "block-step-round": "up | down | nearest",
94
+ "block-step-size": "none | <length [0,∞]>",
95
+ "bookmark-label": "<content-list>",
96
+ "bookmark-level": "none | <integer [1,∞]>",
97
+ "bookmark-state": "open | closed",
98
+ "border-block-clip": "<'border-top-clip'>",
99
+ "border-block-end": "<line-width> || <line-style> || <color>",
100
+ "border-block-end-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
101
+ "border-block-end-color": "<color> | <image-1D>",
102
+ "border-block-end-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
103
+ "border-block-end-style": "<line-style>",
104
+ "border-block-end-width": "<line-width>",
105
+ "border-block-start": "<line-width> || <line-style> || <color>",
106
+ "border-block-start-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
107
+ "border-block-start-color": "<color> | <image-1D>",
108
+ "border-block-start-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
109
+ "border-block-start-style": "<line-style>",
110
+ "border-block-start-width": "<line-width>",
111
+ "border-bottom-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
112
+ "border-bottom-color": "<color> | <image-1D>",
113
+ "border-bottom-left-radius": "<border-radius>",
114
+ "border-bottom-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
115
+ "border-bottom-right-radius": "<border-radius>",
116
+ "border-boundary": "none | parent | display",
117
+ "border-clip": "<'border-top-clip'>",
118
+ "border-color": "[ <color> | <image-1D> ]{1,4}",
119
+ "border-end-end-radius": "<border-radius>",
120
+ "border-end-start-radius": "<border-radius>",
121
+ "border-inline-clip": "<'border-top-clip'>",
122
+ "border-inline-end": "<line-width> || <line-style> || <color>",
123
+ "border-inline-end-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
124
+ "border-inline-end-color": "<color> | <image-1D>",
125
+ "border-inline-end-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
126
+ "border-inline-end-style": "<line-style>",
127
+ "border-inline-end-width": "<line-width>",
128
+ "border-inline-start": "<line-width> || <line-style> || <color>",
129
+ "border-inline-start-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
130
+ "border-inline-start-color": "<color> | <image-1D>",
131
+ "border-inline-start-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
132
+ "border-inline-start-style": "<line-style>",
133
+ "border-inline-start-width": "<line-width>",
134
+ "border-left-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
135
+ "border-left-color": "<color> | <image-1D>",
136
+ "border-left-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
137
+ "border-limit": "all | [ sides | corners ] <length-percentage [0,∞]>? | [ top | right | bottom | left ] <length-percentage [0,∞]>",
138
+ "border-right-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
139
+ "border-right-color": "<color> | <image-1D>",
140
+ "border-right-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
141
+ "border-shape": "none | [ <basic-shape> <geometry-box>? ]{1,2}",
142
+ "border-spacing": "<length [0,∞]>{1,2}",
143
+ "border-start-end-radius": "<border-radius>",
144
+ "border-start-start-radius": "<border-radius>",
145
+ "border-style": "<'border-top-style'>{1,4}",
146
+ "border-top-clip": "none | [ <length-percentage [0,∞]> | <flex> ]+",
147
+ "border-top-color": "<color> | <image-1D>",
148
+ "border-top-left-radius": "<border-radius>",
149
+ "border-top-radius": "<length-percentage [0,∞]>{1,2} [ / <length-percentage [0,∞]>{1,2} ]?",
150
+ "border-top-right-radius": "<border-radius>",
151
+ "border-width": "<'border-top-width'>{1,4}",
152
+ "box-shadow": "<spread-shadow>#",
153
+ "box-shadow-blur": "<length [0,∞]>#",
154
+ "box-shadow-color": "<color>#",
155
+ "box-shadow-offset": "[ none | <length>{1,2} ]#",
156
+ "box-shadow-position": "[ outset | inset ]#",
157
+ "box-shadow-spread": "<length>#",
158
+ "box-snap": "none | block-start | block-end | center | baseline | last-baseline",
159
+ "caret-color": "auto | <color> [ auto | <color> ]?",
160
+ "clear": "| block-start | block-end | top | bottom | both-inline | both-block",
161
+ "clip": "rect( <top> , <right> , <bottom> , <left> ) | rect( <top> <right> <bottom> <left> ) | auto",
162
+ "color-adjust": "<'print-color-adjust'>",
163
+ "color-interpolation": "auto | sRGB | linearRGB",
164
+ "column-count": "auto | <integer [1,∞]>",
165
+ "column-fill": "| balance-all",
166
+ "column-gap": "normal | <length-percentage [0,∞]> | <line-width>",
167
+ "column-rule": "<gap-rule-list> | <gap-auto-rule-list>",
168
+ "column-rule-break": "none | normal | intersection",
169
+ "column-rule-color": "<line-color-list> | <auto-line-color-list>",
170
+ "column-rule-inset": "<'column-rule-inset-cap'> [ / <'column-rule-inset-junction'> ]?",
171
+ "column-rule-inset-cap": "<inset-value> <inset-value>?",
172
+ "column-rule-inset-cap-end": "<inset-value>",
173
+ "column-rule-inset-cap-start": "<inset-value>",
174
+ "column-rule-inset-end": "<inset-value>",
175
+ "column-rule-inset-junction": "<inset-value> <inset-value>?",
176
+ "column-rule-inset-junction-end": "<inset-value>",
177
+ "column-rule-inset-junction-start": "<inset-value>",
178
+ "column-rule-inset-start": "<inset-value>",
179
+ "column-rule-style": "<line-style-list> | <auto-line-style-list>",
180
+ "column-rule-visibility-items": "all | around | between | normal",
181
+ "column-rule-width": "<line-width-list> | <auto-line-width-list>",
182
+ "column-span": "| <integer [1,∞]> | auto",
183
+ "column-width": "auto | <length [0,∞]> | min-content | max-content | fit-content( <length-percentage> )",
184
+ "contain": "none | strict | content | [ [ size | inline-size ] || layout || style || paint ]",
185
+ "contain-intrinsic-block-size": "auto? [ none | <length [0,∞]> ]",
186
+ "contain-intrinsic-height": "auto? [ none | <length [0,∞]> ]",
187
+ "contain-intrinsic-inline-size": "auto? [ none | <length [0,∞]> ]",
188
+ "contain-intrinsic-size": "[ auto? [ none | <length [0,∞]> ] ]{1,2}",
189
+ "contain-intrinsic-width": "auto? [ none | <length [0,∞]> ]",
190
+ "container-type": "normal | [ [ size | inline-size ] || scroll-state ]",
191
+ "content": "| <element()>",
192
+ "continue": "auto | discard | collapse | -webkit-legacy | overflow | paginate | fragments",
193
+ "copy-into": "none | [ [ <custom-ident> <content-level> ] [, <custom-ident> <content-level> ]* ]?",
194
+ "corner": "<'border-radius'> || <'corner-shape'>",
195
+ "corner-block-end": "<'border-top-radius'> || <'corner-top-shape'>",
196
+ "corner-block-end-shape": "<'corner-top-left-shape'>{1,2}",
197
+ "corner-block-start": "<'border-top-radius'> || <'corner-top-shape'>",
198
+ "corner-block-start-shape": "<'corner-top-left-shape'>{1,2}",
199
+ "corner-bottom": "<'border-top-radius'> || <'corner-top-shape'>",
200
+ "corner-bottom-left": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
201
+ "corner-bottom-right": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
202
+ "corner-bottom-shape": "<'corner-top-left-shape'>{1,2}",
203
+ "corner-end-end": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
204
+ "corner-end-start": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
205
+ "corner-inline-end": "<'border-top-radius'> || <'corner-top-shape'>",
206
+ "corner-inline-end-shape": "<'corner-top-left-shape'>{1,2}",
207
+ "corner-inline-start": "<'border-top-radius'> || <'corner-top-shape'>",
208
+ "corner-inline-start-shape": "<'corner-top-left-shape'>{1,2}",
209
+ "corner-left": "<'border-top-radius'> || <'corner-top-shape'>",
210
+ "corner-left-shape": "<'corner-top-left-shape'>{1,2}",
211
+ "corner-right": "<'border-top-radius'> || <'corner-top-shape'>",
212
+ "corner-right-shape": "<'corner-top-left-shape'>{1,2}",
213
+ "corner-shape": "<'corner-top-left-shape'>{1,4}",
214
+ "corner-start-end": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
215
+ "corner-start-start": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
216
+ "corner-top": "<'border-top-radius'> || <'corner-top-shape'>",
217
+ "corner-top-left": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
218
+ "corner-top-right": "<'border-top-left-radius'> || <'corner-top-left-shape'>",
219
+ "corner-top-shape": "<'corner-top-left-shape'>{1,2}",
220
+ "cursor": "[ <cursor-image> , ]* <cursor-predefined>",
221
+ "cx": "<length-percentage>",
222
+ "cy": "<length-percentage>",
223
+ "display": "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> | <-non-standard-display> | grid-lanes | inline-grid-lanes | <display-outside> || [ <display-inside> | math ]",
224
+ "dominant-baseline": "use-script | no-change | reset-size | text-after-edge | text-before-edge | auto | <baseline-metric>",
225
+ "event-trigger": "none | [ <'event-trigger-name'> <'event-trigger-source'> ]#",
226
+ "event-trigger-name": "none | <dashed-ident>#",
227
+ "event-trigger-source": "[ none | <event-trigger-event>+ [ / <event-trigger-event>+ ]? ]#",
228
+ "fill-break": "bounding-box | slice | clone",
229
+ "fill-color": "<color>",
230
+ "fill-image": "<paint>#",
231
+ "fill-opacity": "<'opacity'>",
232
+ "fill-origin": "match-parent | fill-box | stroke-box | content-box | padding-box | border-box",
233
+ "fill-position": "<position>#",
234
+ "fill-repeat": "<repeat-style>#",
235
+ "fill-size": "<bg-size>#",
236
+ "filter": "none | <filter-value-list>",
237
+ "flex-grow": "<number [0,∞]>",
238
+ "flex-line-count": "<integer [1,∞]>",
239
+ "flex-shrink": "<number [0,∞]>",
240
+ "flex-wrap": "nowrap | [ wrap | wrap-reverse ] || balance",
241
+ "float": "| block-start | block-end | snap-block | snap-block( <length> , [ start | end | near ]? ) | snap-inline | snap-inline( <length> , [ left | right | near ]? ) | top | bottom | footnote",
242
+ "float-defer": "<integer> | last | none",
243
+ "float-offset": "<length-percentage>",
244
+ "float-reference": "inline | column | region | page",
245
+ "flow-from": "<custom-ident> | none",
246
+ "flow-into": "none | <custom-ident> [ element | content ]?",
247
+ "flow-tolerance": "normal | <length-percentage [0,∞]> | infinite",
248
+ "font": "[ [ <'font-style'> || <font-variant-css2> || <'font-weight'> || <font-width-css3> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'># ] | <system-font-family-name> | <-non-standard-font>",
249
+ "font-family": "[ <font-family-name> | <generic-font-family> ]#",
250
+ "font-size-adjust": "none | [ ex-height | cap-height | ch-width | ic-width | ic-height ]? [ from-font | <number [0,∞]> ]",
251
+ "font-stretch": "normal | <percentage [0,∞]> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded",
252
+ "font-style": "normal | italic | left | right | oblique <angle [-90deg,90deg]>?",
253
+ "font-synthesis-style": "auto | none | oblique-only",
254
+ "font-variant": "normal | none | [ [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ] || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || [ stylistic( <font-feature-value-name> ) || historical-forms || styleset( <font-feature-value-name># ) || character-variant( <font-feature-value-name># ) || swash( <font-feature-value-name> ) || ornaments( <font-feature-value-name> ) || annotation( <font-feature-value-name> ) ] || [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ] || [ <east-asian-variant-values> || <east-asian-width-values> || ruby ] || [ sub | super ] || [ text | emoji | unicode ] ]",
255
+ "font-variant-alternates": "normal | [ stylistic( <font-feature-value-name> ) || historical-forms || styleset( <font-feature-value-name># ) || character-variant( <font-feature-value-name># ) || swash( <font-feature-value-name> ) || ornaments( <font-feature-value-name> ) || annotation( <font-feature-value-name> ) ]",
256
+ "font-variation-settings": "normal | [ <opentype-tag> <number> ]#",
257
+ "footnote-display": "block | inline | compact",
258
+ "footnote-policy": "auto | line | block",
259
+ "frame-sizing": "auto | content-width | content-height | content-block-size | content-inline-size",
260
+ "glyph-orientation-vertical": "auto | 0deg | 90deg | 0 | 90",
261
+ "grid-column-gap": "normal | <length-percentage [0,∞]> | <line-width>",
262
+ "grid-gap": "<'row-gap'> <'column-gap'>?",
263
+ "grid-row-gap": "normal | <length-percentage [0,∞]> | <line-width>",
264
+ "height": "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content( <length-percentage [0,∞]> ) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain | <-non-standard-size>",
265
+ "hyphenate-limit-last": "none | always | column | page | spread",
266
+ "hyphenate-limit-lines": "no-limit | <integer>",
267
+ "hyphenate-limit-zone": "<length-percentage>",
268
+ "image-animation": "normal | paused | stopped | running",
269
+ "image-orientation": "from-image | none | [ <angle> || flip ]",
270
+ "image-rendering": "auto | smooth | high-quality | pixelated | crisp-edges | <-non-standard-image-rendering>",
271
+ "initial-letter": "normal | <number [1,∞]> <integer [1,∞]> | <number [1,∞]> && [ drop | raise ]?",
272
+ "initial-letter-align": "[ border-box? [ alphabetic | ideographic | hanging | leading ]? ]!",
273
+ "initial-letter-wrap": "none | first | all | grid | <length-percentage>",
274
+ "inline-sizing": "normal | stretch",
275
+ "input-security": "auto | none",
276
+ "isolation": "<isolation-mode>",
277
+ "justify-self": "auto | <overflow-position>? [ normal | <self-position> | left | right ] | stretch | <baseline-position> | anchor-center",
278
+ "line-clamp": "none | [ <integer [1,∞]> || <'block-ellipsis'> ] -webkit-legacy?",
279
+ "line-fit-edge": "leading | <text-edge>",
280
+ "line-grid": "match-parent | create",
281
+ "line-height": "normal | <number [0,∞]> | <length-percentage [0,∞]>",
282
+ "line-height-step": "<length [0,∞]>",
283
+ "line-padding": "<length>",
284
+ "line-snap": "none | baseline | contain",
285
+ "link-parameters": "none | <param()>#",
286
+ "list-style": "<'list-style-position'> || <'list-style-image'> || <'list-style-type'>",
287
+ "margin-break": "auto | keep | discard",
288
+ "margin-trim": "none | [ block || inline ] | [ block-start || inline-start || block-end || inline-end ]",
289
+ "marker": "none | <marker-ref>",
290
+ "marker-end": "none | <marker-ref>",
291
+ "marker-mid": "none | <marker-ref>",
292
+ "marker-side": "match-self | match-parent",
293
+ "marker-start": "none | <marker-ref>",
294
+ "mask-border-outset": "<'border-image-outset'>",
295
+ "mask-border-repeat": "<'border-image-repeat'>",
296
+ "mask-border-slice": "<'border-image-slice'>",
297
+ "mask-border-source": "<'border-image-source'>",
298
+ "mask-border-width": "<'border-image-width'>",
299
+ "max-height": "none | <length-percentage [0,∞]> | min-content | max-content | fit-content( <length-percentage [0,∞]> ) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain | <-non-standard-size>",
300
+ "max-lines": "none | <integer [1,∞]>",
301
+ "max-width": "none | <length-percentage [0,∞]> | min-content | max-content | fit-content( <length-percentage [0,∞]> ) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain | <-non-standard-size>",
302
+ "min-height": "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content( <length-percentage [0,∞]> ) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain | <-non-standard-size>",
303
+ "min-intrinsic-sizing": "legacy | zero-if-scroll || zero-if-extrinsic",
304
+ "min-width": "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content( <length-percentage [0,∞]> ) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain | <-non-standard-size>",
305
+ "mix-blend-mode": "<blend-mode> | plus-lighter",
306
+ "object-fit": "fill | none | [ contain | cover ] || scale-down",
307
+ "orphans": "<integer [1,∞]>",
308
+ "outline-color": "auto | <'border-top-color'>",
309
+ "overflow": "<'overflow-block'>{1,2} | <-non-standard-overflow>",
310
+ "overflow-block": "| <-non-standard-overflow>",
311
+ "overflow-clip-margin": "<visual-box> || <length>",
312
+ "overflow-clip-margin-block": "<visual-box> || <length>",
313
+ "overflow-clip-margin-block-end": "<visual-box> || <length>",
314
+ "overflow-clip-margin-block-start": "<visual-box> || <length>",
315
+ "overflow-clip-margin-bottom": "<visual-box> || <length>",
316
+ "overflow-clip-margin-inline": "<visual-box> || <length>",
317
+ "overflow-clip-margin-inline-end": "<visual-box> || <length>",
318
+ "overflow-clip-margin-inline-start": "<visual-box> || <length>",
319
+ "overflow-clip-margin-left": "<visual-box> || <length>",
320
+ "overflow-clip-margin-right": "<visual-box> || <length>",
321
+ "overflow-clip-margin-top": "<visual-box> || <length>",
322
+ "overflow-inline": "| <-non-standard-overflow>",
323
+ "overflow-x": "| <-non-standard-overflow>",
324
+ "overflow-y": "| <-non-standard-overflow>",
325
+ "overscroll-behavior": "[ contain | none | auto | chain ]{1,2}",
326
+ "overscroll-behavior-block": "contain | none | auto | chain",
327
+ "overscroll-behavior-inline": "contain | none | auto | chain",
328
+ "overscroll-behavior-x": "contain | none | auto | chain",
329
+ "overscroll-behavior-y": "contain | none | auto | chain",
330
+ "path-length": "none | <length> [ 0 , ∞ ]",
331
+ "pause-after": "<time [0s,∞]> | none | x-weak | weak | medium | strong | x-strong",
332
+ "pause-before": "<time [0s,∞]> | none | x-weak | weak | medium | strong | x-strong",
333
+ "perspective": "none | <length [0,∞]>",
334
+ "pointer-events": "| bounding-box",
335
+ "pointer-timeline": "[ <'pointer-timeline-name'> <'pointer-timeline-axis'>? ]#",
336
+ "pointer-timeline-axis": "[ block | inline | x | y ]#",
337
+ "pointer-timeline-name": "[ none | <dashed-ident> ]#",
338
+ "position": "| <running()>",
339
+ "position-anchor": "| normal | match-parent",
340
+ "position-try-fallbacks": "none | [ [ <dashed-ident> || <try-tactic> ] | <position-area> ]#",
341
+ "position-visibility": "always | [ anchor-valid || anchor-visible || no-overflow ]",
342
+ "quotes": "| match-parent",
343
+ "r": "<length-percentage>",
344
+ "region-fragment": "auto | break",
345
+ "rest-after": "<time [0s,∞]> | none | x-weak | weak | medium | strong | x-strong",
346
+ "rest-before": "<time [0s,∞]> | none | x-weak | weak | medium | strong | x-strong",
347
+ "row-gap": "normal | <length-percentage [0,∞]> | <line-width>",
348
+ "row-rule": "<gap-rule-list> | <gap-auto-rule-list>",
349
+ "row-rule-break": "none | normal | intersection",
350
+ "row-rule-color": "<line-color-list> | <auto-line-color-list>",
351
+ "row-rule-inset": "<'column-rule-inset-cap'> [ / <'column-rule-inset-junction'> ]?",
352
+ "row-rule-inset-cap": "<inset-value> <inset-value>?",
353
+ "row-rule-inset-cap-end": "<inset-value>",
354
+ "row-rule-inset-cap-start": "<inset-value>",
355
+ "row-rule-inset-end": "<inset-value>",
356
+ "row-rule-inset-junction": "<inset-value> <inset-value>?",
357
+ "row-rule-inset-junction-end": "<inset-value>",
358
+ "row-rule-inset-junction-start": "<inset-value>",
359
+ "row-rule-inset-start": "<inset-value>",
360
+ "row-rule-style": "<line-style-list> | <auto-line-style-list>",
361
+ "row-rule-visibility-items": "all | around | between | normal",
362
+ "row-rule-width": "<line-width-list> | <auto-line-width-list>",
363
+ "ruby-merge": "separate | merge | auto",
364
+ "ruby-overhang": "auto | spaces",
365
+ "rule": "<'column-rule'>",
366
+ "rule-break": "<'column-rule-break'>",
367
+ "rule-color": "<'column-rule-color'>",
368
+ "rule-inset": "<'column-rule-inset'>",
369
+ "rule-inset-cap": "<'column-rule-inset-cap'>",
370
+ "rule-inset-end": "<'column-rule-inset-end'>",
371
+ "rule-inset-junction": "<'column-rule-inset-junction'>",
372
+ "rule-inset-start": "<'column-rule-inset-start'>",
373
+ "rule-overlap": "row-over-column | column-over-row",
374
+ "rule-style": "<'column-rule-style'>",
375
+ "rule-visibility-items": "<'column-rule-visibility-items'>",
376
+ "rule-width": "<'column-rule-width'>",
377
+ "rx": "<length-percentage> | auto",
378
+ "ry": "<length-percentage> | auto",
379
+ "scroll-marker-group": "none | [ [ before | after ] || [ links | tabs ] ]",
380
+ "scroll-padding": "[ auto | <length-percentage [0,∞]> ]{1,4}",
381
+ "scroll-padding-block": "[ auto | <length-percentage [0,∞]> ]{1,2}",
382
+ "scroll-padding-block-end": "auto | <length-percentage [0,∞]>",
383
+ "scroll-padding-block-start": "auto | <length-percentage [0,∞]>",
384
+ "scroll-padding-bottom": "auto | <length-percentage [0,∞]>",
385
+ "scroll-padding-inline": "[ auto | <length-percentage [0,∞]> ]{1,2}",
386
+ "scroll-padding-inline-end": "auto | <length-percentage [0,∞]>",
387
+ "scroll-padding-inline-start": "auto | <length-percentage [0,∞]>",
388
+ "scroll-padding-left": "auto | <length-percentage [0,∞]>",
389
+ "scroll-padding-right": "auto | <length-percentage [0,∞]>",
390
+ "scroll-padding-top": "auto | <length-percentage [0,∞]>",
391
+ "shape-inside": "auto | outside-shape | [ <basic-shape> || shape-box ] | <image> | display",
392
+ "shape-margin": "<length-percentage [0,∞]>",
393
+ "shape-padding": "<length-percentage [0,∞]>",
394
+ "slider-orientation": "auto | left-to-right | right-to-left | top-to-bottom | bottom-to-top",
395
+ "spatial-navigation-action": "auto | focus | scroll",
396
+ "spatial-navigation-contain": "auto | contain",
397
+ "spatial-navigation-function": "normal | grid",
398
+ "string-set": "none | [ <custom-ident> <string>+ ]#",
399
+ "stroke-align": "center | inset | outset",
400
+ "stroke-alignment": "center | inner | outer",
401
+ "stroke-break": "bounding-box | slice | clone",
402
+ "stroke-color": "<color>#",
403
+ "stroke-dash-corner": "none | <length>",
404
+ "stroke-dash-justify": "none | [ stretch | compress ] || [ dashes || gaps ]",
405
+ "stroke-dashadjust": "none | [ stretch | compress ] [ dashes | gaps ]?",
406
+ "stroke-dasharray": "none | [ <length-percentage> | <number> ]+#",
407
+ "stroke-dashcorner": "none | <length>",
408
+ "stroke-dashoffset": "<length-percentage> | <number>",
409
+ "stroke-image": "<paint>#",
410
+ "stroke-linejoin": "[ crop | arcs | miter ] || [ bevel | round | fallback ]",
411
+ "stroke-miterlimit": "<number>",
412
+ "stroke-origin": "match-parent | fill-box | stroke-box | content-box | padding-box | border-box",
413
+ "stroke-position": "<position>#",
414
+ "stroke-repeat": "<repeat-style>#",
415
+ "stroke-size": "<bg-size>#",
416
+ "stroke-width": "[ <length-percentage> | <line-width> | <number> ]#",
417
+ "tab-size": "<number [0,∞]> | <length [0,∞]>",
418
+ "text-align": "| <string> | justify-all",
419
+ "text-align-all": "start | end | left | right | center | <string> | justify | match-parent",
420
+ "text-align-last": "| match-parent",
421
+ "text-combine-upright": "none | all | [ digits <integer [2,4]>? ]",
422
+ "text-decoration-skip": "none | auto",
423
+ "text-decoration-skip-box": "none | all",
424
+ "text-decoration-skip-self": "auto | skip-all | [ skip-underline || skip-overline || skip-line-through ] | no-skip",
425
+ "text-decoration-skip-spaces": "none | all | [ start || end ]",
426
+ "text-decoration-thickness": "auto | from-font | <length-percentage> | <line-width>",
427
+ "text-emphasis-skip": "spaces || punctuation || symbols || narrow",
428
+ "text-fit": "[ none | grow | shrink ] [ consistent | per-line | per-line-all ]? <percentage>?",
429
+ "text-group-align": "none | start | end | left | right | center",
430
+ "text-indent": "[ <length-percentage> ] && hanging? && each-line?",
431
+ "text-justify": "[ auto | none | inter-word | inter-character | ruby ] || no-compress",
432
+ "text-overflow": "[ clip | ellipsis | <string> | fade | fade( [ <length> | <percentage> ] ) ]{1,2}",
433
+ "text-shadow": "none | <shadow>#",
434
+ "text-size-adjust": "auto | none | <percentage [0,∞]>",
435
+ "text-spacing": "none | auto | <spacing-trim> || <autospace>",
436
+ "text-spacing-trim": "<spacing-trim> | auto",
437
+ "text-underline-offset": "auto | <length-percentage>",
438
+ "text-underline-position": "auto | [ from-font | under ] || [ left | right ]",
439
+ "text-wrap-style": "auto | balance | stable | pretty | avoid-orphans",
440
+ "timeline-scope": "| all",
441
+ "timeline-trigger": "none | [ <'timeline-trigger-name'> <'timeline-trigger-source'> <'timeline-trigger-activation-range'> [ / <'timeline-trigger-active-range'> ]? ]#",
442
+ "timeline-trigger-activation-range": "[ <'timeline-trigger-activation-range-start'> <'timeline-trigger-activation-range-end'>? ]#",
443
+ "timeline-trigger-activation-range-end": "[ normal | <length-percentage> | <timeline-range-name> <length-percentage>? ]#",
444
+ "timeline-trigger-activation-range-start": "[ normal | <length-percentage> | <timeline-range-name> <length-percentage>? ]#",
445
+ "timeline-trigger-active-range": "[ <'timeline-trigger-active-range-start'> <'timeline-trigger-active-range-end'>? ]#",
446
+ "timeline-trigger-active-range-end": "[ auto | normal | <length-percentage> | <timeline-range-name> <length-percentage>? ]#",
447
+ "timeline-trigger-active-range-start": "[ auto | normal | <length-percentage> | <timeline-range-name> <length-percentage>? ]#",
448
+ "transform-origin": "[ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] <length>? | [ [ center | left | right ] && [ center | top | bottom ] ] <length>?",
449
+ "transition-duration": "<time [0s,∞]>#",
450
+ "user-select": "auto | text | none | contain | all",
451
+ "vertical-align": "[ first | last ] || <'alignment-baseline'> || <'baseline-shift'>",
452
+ "view-transition-group": "normal | contain | nearest | <custom-ident>",
453
+ "view-transition-scope": "none | all",
454
+ "visibility": "visible | hidden | force-hidden | collapse",
455
+ "voice-duration": "auto | <time [0s,∞]>",
456
+ "voice-family": "[ <voice-family-name> | <generic-voice> ]# | preserve",
457
+ "voice-pitch": "<frequency [0Hz,∞]> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency [0Hz,∞]> | <semitones> | <percentage> ] ]",
458
+ "voice-range": "<frequency [0Hz,∞]> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency [0Hz,∞]> | <semitones> | <percentage> ] ]",
459
+ "voice-rate": "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage [0,∞]>",
460
+ "white-space": "normal | pre | pre-wrap | pre-line | [ <'white-space-collapse'> || <'text-wrap'> || <'white-space-trim'> ]",
461
+ "white-space-collapse": "collapse | discard | preserve | preserve-breaks | preserve-spaces | break-spaces",
462
+ "widows": "<integer [1,∞]>",
463
+ "width": "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content( <length-percentage [0,∞]> ) | <calc-size()> | <anchor-size()> | stretch | fit-content | contain | <-non-standard-size>",
464
+ "window-drag": "none | move",
465
+ "word-break": "| manual",
466
+ "word-space-transform": "none | [ space | ideographic-space ] && auto-phrase?",
467
+ "word-spacing": "normal | <length-percentage>",
468
+ "word-wrap": "| anywhere",
469
+ "wrap-after": "auto | avoid | avoid-line | avoid-flex | line | flex",
470
+ "wrap-before": "auto | avoid | avoid-line | avoid-flex | line | flex",
471
+ "wrap-flow": "auto | both | start | end | minimum | maximum | clear",
472
+ "wrap-inside": "auto | avoid",
473
+ "wrap-through": "wrap | none",
474
+ "x": "<length-percentage>",
475
+ "y": "<length-percentage>",
476
+ "zoom": "normal | reset | <number [0,∞]> | <percentage [0,∞]>"
477
+ },
478
+ "types": {
479
+ "dashed-ident": "<custom-property-name>",
480
+ "unicode-range-token": "<urange>",
481
+ "a-n-plus-b": "odd | even | <integer> | <n-dimension> | '+'? n | -n | <ndashdigit-dimension> | '+'? <ndashdigit-ident> | <dashndashdigit-ident> | <n-dimension> <signed-integer> | '+'? n <signed-integer> | -n <signed-integer> | <ndash-dimension> <signless-integer> | '+'? n- <signless-integer> | -n- <signless-integer> | <n-dimension> [ '+' | '-' ] <signless-integer> | '+'? n [ '+' | '-' ] <signless-integer> | -n [ '+' | '-' ] <signless-integer>",
482
+ "alpha()": "alpha( [ from <color> ] [ / [ <alpha-value> | alpha | none ] ]? )",
483
+ "anchored-feature": "fallback : <'position-try-fallbacks'>",
484
+ "anchored-in-parens": "( <anchored-query> ) | ( <anchored-feature> ) | <general-enclosed>",
485
+ "anchored-query": "not <anchored-in-parens> | <anchored-in-parens> [ [ and <anchored-in-parens> ]* | [ or <anchored-in-parens> ]* ] | <anchored-feature>",
486
+ "angle-percentage": "[ <angle> | <percentage> ]",
487
+ "arc-command": "arc <command-end-point> [ [ of <length-percentage>{1,2} ] && <arc-sweep>? && <arc-size>? && [ rotate <angle> ]? ]",
488
+ "arc-size": "large | small",
489
+ "arc-sweep": "cw | ccw",
490
+ "attr-args": "attr( <declaration-value> , <declaration-value>? )",
491
+ "attr-name": "[ [ <ident-token>? '|' ]? <ident-token> ]",
492
+ "auto-line-color-list": "<line-color-or-repeat>#? , <auto-repeat-line-color> , <line-color-or-repeat>#?",
493
+ "auto-line-style-list": "<line-style-or-repeat>#? , <auto-repeat-line-style> , <line-style-or-repeat>#?",
494
+ "auto-line-width-list": "<line-width-or-repeat>#? , <auto-repeat-line-width> , <line-width-or-repeat>#?",
495
+ "auto-repeat": "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <track-size> ]+ <line-names>? )",
496
+ "auto-repeat-line-color": "repeat( auto , [ <color> ]# )",
497
+ "auto-repeat-line-style": "repeat( auto , [ <line-style> ]# )",
498
+ "auto-repeat-line-width": "repeat( auto , [ <line-width> ]# )",
499
+ "base-descriptor": "base-url : stylesheet | document | <url>",
500
+ "baseline-metric": "text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top",
501
+ "baseline-position": "[ first | last ]? && baseline",
502
+ "basic-shape": "<basic-shape-rect> | <circle()> | <ellipse()> | <polygon()> | <path()> | <shape()>",
503
+ "bg-clip": "<visual-box> | [ border-area || text ]",
504
+ "bg-layer": "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <bg-clip> || <visual-box>",
505
+ "bg-position": "<position> | <position-three>",
506
+ "blend-mode": "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | soft-light | hard-light | difference | exclusion | hue | saturation | color | luminosity",
507
+ "border-radius": "<slash-separated-border-radius-syntax> | <legacy-border-radius-syntax>",
508
+ "calc-interpolate()": "calc-interpolate( [ <progress-source> && [ by <easing-function> ]? && <easing-function>? ] , <input-position>{1,2} : <calc-sum> , [ <easing-function>? , <input-position>{1,2} : <calc-sum> ]#? )",
509
+ "calc-keyword": "e | pi | infinity | -infinity | NaN",
510
+ "calc-mix()": "calc-mix( [ <calc-sum> <percentage [0,100]>? ]# )",
511
+ "calc-product": "<calc-value> [ [ '*' | / ] <calc-value> ]*",
512
+ "calc-size-basis": "[ <size-keyword> | <calc-size()> | <calc-sum> ]",
513
+ "calc-size()": "calc-size( [ [ <calc-size-basis> , [ <calc-sum> | size ] ] | [ any , <calc-sum> ] ] )",
514
+ "calc-value": "<number> | <dimension> | <percentage> | <calc-keyword> | ( <calc-sum> )",
515
+ "cf-image": "[ <image> | <color> ] && <percentage [0,100]>?",
516
+ "circle()": "circle( [ <radial-extent> | <length-percentage [0,∞]> ]? [ at <position> ]? )",
517
+ "clamp()": "clamp( [ <calc-sum> | none ] , <calc-sum> , [ <calc-sum> | none ] )",
518
+ "color": "<color-base> | currentColor | <system-color> | <contrast-color()> | <device-cmyk()> | <light-dark-color> | <-non-standard-color>",
519
+ "color-font-tech": "[ color-COLRv0 | color-COLRv1 | color-SVG | color-sbix | color-CBDT ]",
520
+ "color-function": "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <lab()> | <lch()> | <oklab()> | <oklch()> | <ictcp()> | <jzazbz()> | <jzczhz()> | <alpha()> | <color()> | <hdr-color()>",
521
+ "color-interpolate()": "color-interpolate( [ <progress-source> && [ by <easing-function> ]? && <easing-function>? && <color-interpolation-method>? ] , <input-position>{1,2} : <color> , [ [ <easing-function> || <color-interpolation-method> ]? , <input-position>{1,2} : <color> ]#? )",
522
+ "color-layers()": "color-layers( [ <blend-mode> , ]? <color># )",
523
+ "color-mix()": "color-mix( <color-interpolation-method>? , [ <color> && <percentage [0,100]>? ]# )",
524
+ "color-stripe": "<color> && [ <length-percentage> | <flex> ]?",
525
+ "color()": "color( [ from <color> ]? [ <custom-params> | [ <predefined-rgb> [ <number> | <percentage> | r | g | b | alpha | none ]{3} [ / [ <alpha-value> | r | g | b | alpha | none ] ]? ] | [ <xyz-space> [ <number> | <percentage> | x | y | z | alpha | none ]{3} [ / [ <alpha-value> | x | y | z | alpha | none ] ]? ] ] )",
526
+ "colorspace-params": "[ <custom-params> | <predefined-rgb-params> | <xyz-params> ]",
527
+ "combinator": "'>' | '+' | '~' | [ '|' '|' ] | [ / <wq-name> / ]",
528
+ "command-end-point": "[ to <position> | by <coordinate-pair> ]",
529
+ "composite-mode": "clear | copy | source-over | destination-over | source-in | destination-in | source-out | destination-out | source-atop | destination-atop | xor | lighter | plus-darker | plus-lighter",
530
+ "container-condition": "[ <container-name>? <container-query>? ]!",
531
+ "content-level": "element | content | text | <attr()> | <counter>",
532
+ "content-list": "[ <string> | contents | <image> | <counter> | <quote> | <target> | <leader()> | <attr()> | <string()> | <content()> ]+",
533
+ "content()": "content( [ text | before | after | first-letter | marker ]? )",
534
+ "contrast-color()": "contrast-color( <color> )",
535
+ "control-point": "[ <position> | <relative-control-point> ]",
536
+ "control-value()": "control-value( <type>? )",
537
+ "coord-box": "<paint-box> | view-box",
538
+ "coordinate-pair": "<length-percentage>{2}",
539
+ "counter-style": "<counter-style-name> | <symbols()>",
540
+ "cross-fade()": "cross-fade( <cf-image># )",
541
+ "cross-origin-modifier": "cross-origin( anonymous | use-credentials )",
542
+ "css-type": "<syntax-component> | <type()>",
543
+ "cubic-bezier-easing-function": "ease | ease-in | ease-out | ease-in-out | <cubic-bezier()>",
544
+ "cursor-image": "[ <url> | <url-set> ] <number>{2}?",
545
+ "curve-command": "curve [ [ to <position> with <control-point> [ / <control-point> ]? ] | [ by <coordinate-pair> with <relative-control-point> [ / <relative-control-point> ]? ] ]",
546
+ "custom-arg": "'$' <ident-token>",
547
+ "default-value": "<declaration-value>",
548
+ "deprecated-color": "ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonHighlight | ButtonShadow | CaptionText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText",
549
+ "element()": "element( <id-selector> )",
550
+ "env-args": "env( <declaration-value> , <declaration-value>? )",
551
+ "env()": "env( <custom-ident> <integer [0,∞]>* , <declaration-value>? )",
552
+ "event-trigger-event": "activate | interest | click | touch | dblclick | keypress( <string> ) | . . .",
553
+ "fade()": "fade( [ <length-percentage> ] )",
554
+ "feature-tag-value": "<opentype-tag> [ <integer [0,∞]> | on | off ]?",
555
+ "filter()": "filter( [ <image> | <string> ] , <filter-value-list> )",
556
+ "final-bg-layer": "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <bg-clip> || <visual-box> || <'background-color'>",
557
+ "first-valid()": "first-valid( <declaration-value># )",
558
+ "fit-content()": "fit-content( <length-percentage> )",
559
+ "fixed-breadth": "<length-percentage [0,∞]>",
560
+ "font-family-name": "<string> | <custom-ident>+",
561
+ "font-feature-index": "<integer>",
562
+ "font-feature-value-name": "<ident>",
563
+ "font-features-tech": "[ features-opentype | features-aat | features-graphite ]",
564
+ "font-format": "[ <string> | collection | embedded-opentype | opentype | svg | truetype | woff | woff2 ]",
565
+ "font-src": "<url> [ format( <font-format> ) ]? [ tech( <font-tech># ) ]? | local( <font-family-name> )",
566
+ "font-src-list": "[ <url> [ format( <font-format> ) ]? [ tech( <font-tech># ) ]? | local( <family-name> ) ]#",
567
+ "font-tech": "[ <font-features-tech> | <color-font-tech> | variations | palettes | incremental ]",
568
+ "font-weight-absolute": "[ normal | bold | <number [1,1000]> ]",
569
+ "frequency-percentage": "[ <frequency> | <percentage> ]",
570
+ "function-parameter": "<custom-property-name> <css-type>? [ : <default-value> ]?",
571
+ "gap-auto-repeat-rule": "repeat( auto , <gap-rule># )",
572
+ "gap-auto-rule-list": "<gap-rule-or-repeat>#? , <gap-auto-repeat-rule> , <gap-rule-or-repeat>#?",
573
+ "gap-repeat-rule": "repeat( <integer [1,∞]> , <gap-rule># )",
574
+ "gap-rule": "<line-width> || <line-style> || <color>",
575
+ "gap-rule-list": "<gap-rule-or-repeat>#",
576
+ "gap-rule-or-repeat": "<gap-rule> | <gap-repeat-rule>",
577
+ "generic-font-complete": "serif | sans-serif | system-ui | cursive | fantasy | math | monospace",
578
+ "generic-font-family": "<generic-font-script-specific> | <generic-font-complete> | <generic-font-incomplete> | <-non-standard-generic-family>",
579
+ "generic-font-incomplete": "ui-serif | ui-sans-serif | ui-monospace | ui-rounded",
580
+ "generic-font-script-specific": "generic( fangsong ) | generic( kai ) | generic( khmer-mul ) | generic( nastaliq )",
581
+ "generic-voice": "<age>? <gender> <integer [1,∞]>?",
582
+ "gradient": "[ <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()> | <repeating-conic-gradient()> | <-legacy-gradient> ]",
583
+ "grid-line": "auto | <custom-ident> | [ [ <integer [-∞,-1]> | <integer [1,∞]> ] && <custom-ident>? ] | [ span && [ <integer [1,∞]> || <custom-ident> ] ]",
584
+ "hdr-color()": "color-hdr( [ <color> && <number [0,∞]>? ]#{2} )",
585
+ "horizontal-line-command": "hline [ to [ <length-percentage> | left | center | right | x-start | x-end ] | by <length-percentage> ]",
586
+ "hsl()": "[ <legacy-hsl-syntax> | <modern-hsl-syntax> ]",
587
+ "hsla()": "[ <legacy-hsla-syntax> | <modern-hsla-syntax> ]",
588
+ "hwb()": "hwb( [ from <color> ]? [ <hue> | h | w | b | alpha | none ] [ <percentage> | <number> | h | w | b | alpha | none ] [ <percentage> | <number> | h | w | b | alpha | none ] [ / [ <alpha-value> | h | w | b | alpha | none ] ]? )",
589
+ "ictcp()": "ictcp( [ from <color> ]? [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? )",
590
+ "ident-arg": "<string> | <integer> | <ident>",
591
+ "ident()": "ident( <ident-arg>+ )",
592
+ "if-args": "if( [ <if-args-branch> ; ]* <if-args-branch> ;? )",
593
+ "if-args-branch": "<declaration-value> : <declaration-value>?",
594
+ "if-branch": "<if-condition> : <declaration-value>?",
595
+ "if-condition": "<boolean-expr[<if-test>]> | else",
596
+ "if-test": "supports( [ <ident> : <declaration-value> ] | <supports-condition> ) | media( <media-feature> | <media-condition> ) | style( <style-query> )",
597
+ "if()": "if( [ <if-branch> ; ]* <if-branch> ;? )",
598
+ "image": "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient> | <light-dark-image>",
599
+ "image-1D": "<stripes()>",
600
+ "image-set-option": "[ <image> | <string> ] [ <resolution> || type( <string> ) ]?",
601
+ "image-src": "[ <url> | <string> ]",
602
+ "image-tags": "[ ltr | rtl ]",
603
+ "import-conditions": "[ supports( [ <supports-condition> | <declaration> ] ) ]? <media-query-list>?",
604
+ "inflexible-breadth": "<length-percentage [0,∞]> | min-content | max-content | auto",
605
+ "inherit-args": "inherit( <declaration-value> , <declaration-value>? )",
606
+ "inherit()": "inherit( <custom-property-name> , <declaration-value>? )",
607
+ "init-descriptor": "<init-descriptor-name> : <string>",
608
+ "init-descriptor-name": "protocol | hostname | port | pathname | search | hash",
609
+ "input-position": "<percentage> | <number> | <dimension>",
610
+ "inset-value": "<length-percentage> | overlap-join",
611
+ "integrity-modifier": "integrity( <string> )",
612
+ "interpolate()": "interpolate( [ <progress-source> && [ by <easing-function> ]? && <easing-function>? ] , <input-position>{1,2} : <whole-value> , [ <easing-function>? , <input-position>{1,2} : <whole-value> ]#? ) | interpolate( <progress-source> && [ by <easing-function> ]? && <easing-function>? of <keyframes-name> )",
613
+ "isolation-mode": "auto | isolate",
614
+ "jzazbz()": "jzazbz( [ from <color> ]? [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? )",
615
+ "jzczhz()": "jzczhz( [ from <color> ]? [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <hue> | none ] [ / [ <alpha-value> | none ] ]? )",
616
+ "lab()": "lab( [ from <color> ]? [ <percentage> | <number> | l | a | b | alpha | none ] [ <percentage> | <number> | l | a | b | alpha | none ] [ <percentage> | <number> | l | a | b | alpha | none ] [ / [ <alpha-value> | l | a | b | alpha | none ] ]? )",
617
+ "layout-box": "<visual-box> | margin-box",
618
+ "lch()": "lch( [ from <color> ]? [ <percentage> | <number> | l | c | h | alpha | none ] [ <percentage> | <number> | l | c | h | alpha | none ] [ <hue> | l | c | h | alpha | none ] [ / [ <alpha-value> | l | c | h | alpha | none ] ]? )",
619
+ "legacy-border-radius-syntax": "<length-percentage [0,∞]>{1,2}",
620
+ "legacy-hsl-syntax": "hsl( <hue> , <percentage> , <percentage> , <alpha-value>? )",
621
+ "legacy-hsla-syntax": "hsla( <hue> , <percentage> , <percentage> , <alpha-value>? )",
622
+ "legacy-pseudo-element-selector": ": [ before | after | first-line | first-letter ]",
623
+ "legacy-rgb-syntax": "rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )",
624
+ "legacy-rgba-syntax": "rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )",
625
+ "length-percentage": "[ <length> | <percentage> ]",
626
+ "light-dark-color": "light-dark( <color> , <color> )",
627
+ "light-dark-image": "light-dark( [ <image> | none ] , [ <image> | none ] )",
628
+ "light-dark()": "<light-dark-color> | <light-dark-image>",
629
+ "line-color-list": "<line-color-or-repeat>#",
630
+ "line-color-or-repeat": "[ <color> | <repeat-line-color> ]",
631
+ "line-command": "line <command-end-point>",
632
+ "line-style-list": "<line-style-or-repeat>#",
633
+ "line-style-or-repeat": "[ <line-style> | <repeat-line-style> ]",
634
+ "line-width": "<length [0,∞]> | hairline | thin | medium | thick",
635
+ "line-width-list": "<line-width-or-repeat>#",
636
+ "line-width-or-repeat": "[ <line-width> | <repeat-line-width> ]",
637
+ "marker-ref": "<url>",
638
+ "media-and": "and <media-in-parens>",
639
+ "media-condition": "<media-not> | <media-in-parens> [ <media-and>* | <media-or>* ]",
640
+ "media-condition-without-or": "<media-not> | <media-in-parens> <media-and>*",
641
+ "media-feature": "[ <mf-plain> | <mf-boolean> | <mf-range> ]",
642
+ "media-import-condition": "<media-query-list>",
643
+ "media-in-parens": "( <media-condition> ) | ( <media-feature> ) | <general-enclosed>",
644
+ "media-or": "or <media-in-parens>",
645
+ "media()": "media( [ <mf-plain> | <mf-boolean> | <mf-range> ] )",
646
+ "mf-comparison": "<mf-lt> | <mf-gt> | <mf-eq>",
647
+ "mf-eq": "'='",
648
+ "mf-gt": "'>' '='?",
649
+ "mf-lt": "'<' '='?",
650
+ "mf-range": "<mf-name> <mf-comparison> <mf-value> | <mf-value> <mf-comparison> <mf-name> | <mf-value> <mf-lt> <mf-name> <mf-lt> <mf-value> | <mf-value> <mf-gt> <mf-name> <mf-gt> <mf-value>",
651
+ "modern-hsl-syntax": "hsl( [ from <color> ]? [ <hue> | h | s | l | alpha | none ] [ <percentage> | <number> | h | s | l | alpha | none ] [ <percentage> | <number> | h | s | l | alpha | none ] [ / [ <alpha-value> | h | s | l | alpha | none ] ]? )",
652
+ "modern-hsla-syntax": "hsla( [ from <color> ]? [ <hue> | h | s | l | alpha | none ] [ <percentage> | <number> | h | s | l | alpha | none ] [ <percentage> | <number> | h | s | l | alpha | none ] [ / [ <alpha-value> | h | s | l | alpha | none ] ]? )",
653
+ "modern-rgb-syntax": "rgb( [ from <color> ]? [ <number> | <percentage> | r | g | b | alpha | none ]{3} [ / [ <alpha-value> | r | g | b | alpha | none ] ]? )",
654
+ "modern-rgba-syntax": "rgba( [ from <color> ]? [ <number> | <percentage> | r | g | b | alpha | none ]{3} [ / [ <alpha-value> | r | g | b | alpha | none ] ]? )",
655
+ "move-command": "move <command-end-point>",
656
+ "mq-boolean": "<integer [0,1]>",
657
+ "named-color": "| transparent",
658
+ "navigation-condition": "not <navigation-in-parens> | <navigation-in-parens> [ and <navigation-in-parens> ]* | <navigation-in-parens> [ or <navigation-in-parens> ]*",
659
+ "navigation-in-parens": "( <navigation-condition> ) | ( <navigation-test> ) | <general-enclosed>",
660
+ "navigation-location-between-test": "between : <route-location> and <route-location>",
661
+ "navigation-location-test": "<navigation-relation> : <route-location>",
662
+ "navigation-phase-keyword": "loading | ready | committed",
663
+ "navigation-phase-test": "phase : <navigation-phase-keyword>",
664
+ "navigation-relation": "at | with | from | to",
665
+ "navigation-test": "<navigation-location-test> | <navigation-location-between-test> | <navigation-type-test> | <navigation-phase-test>",
666
+ "navigation-type-keyword": "traverse | back | forward | reload",
667
+ "navigation-type-test": "history : <navigation-type-keyword>",
668
+ "number-optional-number": "<number> <number>?",
669
+ "oklab()": "oklab( [ from <color> ]? [ <percentage> | <number> | l | a | b | alpha | none ] [ <percentage> | <number> | l | a | b | alpha | none ] [ <percentage> | <number> | l | a | b | alpha | none ] [ / [ <alpha-value> | l | a | b | alpha | none ] ]? )",
670
+ "oklch()": "oklch( [ from <color> ]? [ <percentage> | <number> | l | c | h | alpha | none ] [ <percentage> | <number> | l | c | h | alpha | none ] [ <hue> | l | c | h | alpha | none ] [ / [ <alpha-value> | l | c | h | alpha | none ] ]? )",
671
+ "opentype-tag": "<string>",
672
+ "outline-line-style": "| auto",
673
+ "page-selector": "[ <ident-token>? <pseudo-page>* ]!",
674
+ "page-selector-list": "<page-selector>#",
675
+ "paint": "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke | <image> | <svg-paint>",
676
+ "param()": "param( <dashed-ident> , <declaration-value>? )",
677
+ "pattern-descriptor": "pattern : <url-pattern()>",
678
+ "pointer-axis": "block | inline | x | y",
679
+ "pointer-source": "root | nearest | self",
680
+ "pointer()": "pointer( [ <pointer-source> || <pointer-axis> ]? )",
681
+ "points": "[ <number>+ ]#",
682
+ "polygon()": "polygon( <'fill-rule'>? [ round <length> ]? , [ <length-percentage> <length-percentage> ]# )",
683
+ "position": "<position-one> | <position-two> | <position-four>",
684
+ "position-area": "[ [ left | center | right | span-left | span-right | x-start | x-end | span-x-start | span-x-end | self-x-start | self-x-end | span-self-x-start | span-self-x-end | span-all ] || [ top | center | bottom | span-top | span-bottom | y-start | y-end | span-y-start | span-y-end | self-y-start | self-y-end | span-self-y-start | span-self-y-end | span-all ] | [ block-start | center | block-end | span-block-start | span-block-end | span-all ] || [ inline-start | center | inline-end | span-inline-start | span-inline-end | span-all ] | [ self-block-start | center | self-block-end | span-self-block-start | span-self-block-end | span-all ] || [ self-inline-start | center | self-inline-end | span-self-inline-start | span-self-inline-end | span-all ] | [ start | center | end | span-start | span-end | span-all ]{1,2} | [ self-start | center | self-end | span-self-start | span-self-end | span-all ]{1,2} ]",
685
+ "position-area-query": "[ [ left | center | right | span-left | span-right | x-start | x-end | span-x-start | span-x-end | self-x-start | self-x-end | span-self-x-start | span-self-x-end | span-all | any ] || [ top | center | bottom | span-top | span-bottom | y-start | y-end | span-y-start | span-y-end | self-y-start | self-y-end | span-self-y-start | span-self-y-end | span-all | any ] | [ block-start | center | block-end | span-block-start | span-block-end | span-all | any ] || [ inline-start | center | inline-end | span-inline-start | span-inline-end | span-all | any ] | [ self-block-start | center | self-block-end | span-self-block-start | span-self-block-end | span-all | any ] || [ self-inline-start | center | self-inline-end | span-self-inline-start | span-self-inline-end | span-all | any ] | [ start | center | end | span-start | span-end | span-all | any ]{1,2} | [ self-start | center | self-end | span-self-start | span-self-end | span-all | any ]{1,2} ]",
686
+ "position-four": "[ [ [ left | right | x-start | x-end ] <length-percentage> ] && [ [ top | bottom | y-start | y-end ] <length-percentage> ] | [ [ block-start | block-end ] <length-percentage> ] && [ [ inline-start | inline-end ] <length-percentage> ] | [ [ start | end ] <length-percentage> ]{2} ]",
687
+ "position-one": "[ left | center | right | top | bottom | x-start | x-end | y-start | y-end | block-start | block-end | inline-start | inline-end | <length-percentage> ]",
688
+ "position-three": "[ [ left | center | right ] && [ [ top | bottom ] <length-percentage> ] | [ [ left | right ] <length-percentage> ] && [ top | center | bottom ] ]",
689
+ "position-two": "[ [ left | center | right | x-start | x-end ] && [ top | center | bottom | y-start | y-end ] | [ left | center | right | x-start | x-end | <length-percentage> ] [ top | center | bottom | y-start | y-end | <length-percentage> ] | [ block-start | center | block-end ] && [ inline-start | center | inline-end ] | [ start | center | end ]{2} ]",
690
+ "predefined-rgb": "| rec2100-pq | rec2100-hlg | rec2100-linear",
691
+ "progress-source": "<percentage> | <number> | <dimension> | <'animation-timeline'>",
692
+ "progress()": "progress( no-clamp? <calc-sum> , <calc-sum> , <calc-sum> )",
693
+ "pseudo-class-selector": ": <ident-token> | : <function-token> <any-value> )",
694
+ "pseudo-element-selector": ": <pseudo-class-selector> | <legacy-pseudo-element-selector>",
695
+ "pt-class-selector": "[ '.' <custom-ident> ]+",
696
+ "pt-name-and-class-selector": "<pt-name-selector> <pt-class-selector>? | <pt-class-selector>",
697
+ "pt-name-selector": "'*' | <custom-ident>",
698
+ "query-in-parens": "( <container-query> ) | ( <size-feature> ) | style( <style-query> ) | scroll-state( <scroll-state-query> ) | <general-enclosed>",
699
+ "random-cache-key": "<dashed-ident> || element-scoped || [ property-scoped | property-index-scoped | <random-ua-ident> ]",
700
+ "random-item-args": "random-item( <declaration-value> , [ <declaration-value>? ]# )",
701
+ "random-item()": "random-item( <random-key> , [ <declaration-value>? ]# )",
702
+ "random-key": "auto | <random-cache-key> | fixed <number [0,1]>",
703
+ "random-ua-ident": "<custom-ident>",
704
+ "random()": "random( <random-key>? , <calc-sum> , <calc-sum> , <calc-sum>? )",
705
+ "ray-size": "<radial-extent> | sides",
706
+ "rectangular-color-space": "srgb | srgb-linear | display-p3 | display-p3-linear | a98-rgb | prophoto-rgb | rec2020 | lab | oklab | <xyz-space>",
707
+ "referrer-policy-modifier": "referrer-policy( no-referrer | no-referrer-when-downgrade | same-origin | origin | strict-origin | origin-when-cross-origin | strict-origin-when-cross-origin | unsafe-url )",
708
+ "relative-control-point": "<coordinate-pair> [ from [ start | end | origin ] ]?",
709
+ "repeat-line-color": "repeat( [ <integer [1,∞]> ] , [ <color> ]# )",
710
+ "repeat-line-style": "repeat( [ <integer [1,∞]> ] , [ <line-style> ]# )",
711
+ "repeat-line-width": "repeat( [ <integer [1,∞]> ] , [ <line-width> ]# )",
712
+ "repeat-style": "repeat-x | repeat-y | repeat-block | repeat-inline | <repetition>{1,2}",
713
+ "repetition": "repeat | space | round | no-repeat",
714
+ "request-url-modifier": "<cross-origin-modifier> | <integrity-modifier> | <referrer-policy-modifier>",
715
+ "rgb()": "[ <legacy-rgb-syntax> | <modern-rgb-syntax> ]",
716
+ "rgba()": "[ <legacy-rgba-syntax> | <modern-rgba-syntax> ]",
717
+ "round()": "round( <rounding-strategy>? , <calc-sum> , <calc-sum>? )",
718
+ "rounding-strategy": "| line-width",
719
+ "route-descriptor": "<pattern-descriptor> | <init-descriptor> | <base-descriptor>",
720
+ "route-location": "<url> | [ <route-name> | <url-pattern()> ]",
721
+ "route-name": "<dashed-ident>",
722
+ "route-rule": "@route <dashed-ident> { <declaration-list> }",
723
+ "running()": "running( <custom-ident> )",
724
+ "scope-boundaries": "[ [ ( <scope-start> ) ]? [ to ( <scope-end> ) ]? ]!",
725
+ "scope-end": "<selector-list>",
726
+ "scope-start": "<selector-list>",
727
+ "scroll-button-direction": "up | down | left | right | block-start | block-end | inline-start | inline-end | prev | next",
728
+ "scroll-state-feature": "[ <scroll-state-feature-plain> | <scroll-state-feature-boolean> ]",
729
+ "scroll-state-feature-boolean": "<scroll-state-feature-name>",
730
+ "scroll-state-feature-name": "<ident>",
731
+ "scroll-state-feature-plain": "<scroll-state-feature-name> : <scroll-state-feature-value>",
732
+ "scroll-state-feature-value": "<ident>",
733
+ "shadow": "<color>? && [ <length>{2} [ <length [0,∞]> <length>? ]? ] && inset?",
734
+ "shape-box": "<visual-box> | margin-box | half-border-box",
735
+ "shape-command": "<move-command> | <line-command> | close | <horizontal-line-command> | <vertical-line-command> | <curve-command> | <smooth-command> | <arc-command>",
736
+ "shape()": "shape( <'fill-rule'>? from <position> , <shape-command># )",
737
+ "single-animation": "<'animation-duration'> || <easing-function> || <'animation-delay-start'> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ] || <single-animation-timeline>",
738
+ "single-animation-iteration-count": "infinite | <number [0,∞]>",
739
+ "size-keyword": "auto | max-content | min-content | stretch",
740
+ "slash-separated-border-radius-syntax": "<length-percentage [0,∞]> [ / <length-percentage [0,∞]> ]?",
741
+ "smooth-command": "smooth [ [ to <position> [ with <control-point> ]? ] | [ by <coordinate-pair> [ with <relative-control-point> ]? ] ]",
742
+ "snap-block()": "snap-block( <length> , [ start | end | near ]? )",
743
+ "snap-inline()": "snap-inline( <length> , [ left | right | near ]? )",
744
+ "source-size": "<media-condition> <source-size-value> | auto",
745
+ "source-size-list": "<source-size>#? , <source-size-value>",
746
+ "source-size-value": "<length> | auto",
747
+ "spacing-trim": "space-all | normal | space-first | trim-start | trim-both | trim-all",
748
+ "spread-shadow": "<'box-shadow-color'>? && [ [ none | <length>{2} ] [ <'box-shadow-blur'> <'box-shadow-spread'>? ]? ] && <'box-shadow-position'>?",
749
+ "src()": "src( <string> <url-modifier>* )",
750
+ "string()": "string( <custom-ident> , [ first | start | last | first-except ]? )",
751
+ "stripes()": "stripes( <color-stripe># )",
752
+ "style-feature": "<style-feature-plain> | <style-feature-boolean> | <style-range>",
753
+ "style-feature-boolean": "<style-feature-name>",
754
+ "style-feature-plain": "<style-feature-name> : <style-feature-value>",
755
+ "style-feature-value": "<declaration-value>",
756
+ "style-in-parens": "( <style-query> ) | ( <style-feature> ) | <general-enclosed>",
757
+ "style-query": "not <style-in-parens> | <style-in-parens> [ [ and <style-in-parens> ]* | [ or <style-in-parens> ]* ] | <style-feature>",
758
+ "style-range": "<style-range-value> <mf-comparison> <style-range-value> | <style-range-value> <mf-lt> <style-range-value> <mf-lt> <style-range-value> | <style-range-value> <mf-gt> <style-range-value> <mf-gt> <style-range-value>",
759
+ "style-range-value": "<custom-property-name> | <style-feature-value>",
760
+ "supports-at-rule-fn": "at-rule( <at-keyword-token> )",
761
+ "supports-condition-name": "<custom-ident>",
762
+ "supports-decl": "( [ <declaration> | <supports-condition-name> ] )",
763
+ "supports-env-fn": "env( <ident> )",
764
+ "supports-feature": "<supports-selector-fn> | <supports-font-tech-fn> | <supports-font-format-fn> | <supports-at-rule-fn> | <supports-named-feature-fn> | <supports-env-fn> | <supports-decl>",
765
+ "supports-font-format-fn": "font-format( <font-format> )",
766
+ "supports-font-tech-fn": "font-tech( <font-tech> )",
767
+ "supports-import-condition": "supports( [ <supports-condition> | <declaration> ] )",
768
+ "supports-named-feature-fn": "named-feature( <ident> )",
769
+ "supports()": "supports( <declaration> )",
770
+ "svg-paint": "child | child( <integer> )",
771
+ "syntax-multiplier": "[ '#' | '+' ]",
772
+ "system-color": "AccentColor | AccentColorText | ActiveText | ButtonBorder | ButtonFace | ButtonText | Canvas | CanvasText | Field | FieldText | GrayText | Highlight | HighlightText | LinkText | Mark | MarkText | SelectedItem | SelectedItemText | VisitedText | <deprecated-color>",
773
+ "system-font-family-name": "caption | icon | menu | message-box | small-caption | status-bar",
774
+ "target-contrast": "<wcag2>",
775
+ "text-edge": "[ text | ideographic | ideographic-ink ] | [ text | ideographic | ideographic-ink | cap | ex ] [ text | ideographic | ideographic-ink | alphabetic ]",
776
+ "time-percentage": "[ <time> | <percentage> ]",
777
+ "timeline-range-center-subject": "<ident>",
778
+ "toggle()": "toggle( <any-value># )",
779
+ "track-breadth": "<length-percentage [0,∞]> | <flex [0,∞]> | min-content | max-content | auto",
780
+ "track-size": "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( <length-percentage [0,∞]> )",
781
+ "transform-function": "<scale3d()> | <scale()> | <scaleX()> | <scaleY()> | <scaleZ()> | <translate3d()> | <translate()> | <translateX()> | <translateY()> | <translateZ()> | <rotate3d()> | <rotate()> | <rotateX()> | <rotateY()> | <rotateZ()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <matrix()> | <perspective()>",
782
+ "transform-interpolate()": "transform-interpolate( [ <progress-source> && [ by <easing-function> ]? && <easing-function>? ] , <input-position>{1,2} : <transform-list> , [ <easing-function>? , <input-position>{1,2} : <transform-list> ]#? )",
783
+ "transform-mix()": "transform-mix( [ <transform-list> && <percentage [0,100]> ]# )",
784
+ "try-tactic": "flip-block || flip-inline || flip-start || flip-x || flip-y",
785
+ "type": "'<' [ number | string ] '>'",
786
+ "type()": "type( <syntax> )",
787
+ "url": "<url()> | <src()> | <url-token>",
788
+ "url-pattern()": "url-pattern( <string> )",
789
+ "url-set": "image-set( <url-set-option># )",
790
+ "url-set-option": "[ <url> | <string> ] [ <resolution> || type( <string> ) ]?",
791
+ "url-set()": "url-set( <url-set-option># )",
792
+ "url()": "url( <string> <url-modifier>* ) | <url-token>",
793
+ "var-args": "var( <declaration-value> , <declaration-value>? )",
794
+ "vertical-line-command": "vline [ to [ <length-percentage> | top | center | bottom | y-start | y-end ] | by <length-percentage> ]",
795
+ "view-transition-type": "<custom-ident>",
796
+ "voice-family-name": "<string> | <custom-ident>+",
797
+ "wcag2": "wcag2 | wcag2( [ <number> | [ aa | aaa ] && large? ] )",
798
+ "whole-value": "<declaration-value>",
799
+ "style-feature-name": "<dashed-ident> | -moz-appearance | -moz-background-clip | -moz-binding | -moz-border-bottom-colors | -moz-border-left-colors | -moz-border-radius-bottomleft | -moz-border-radius-bottomright | -moz-border-radius-topleft | -moz-border-radius-topright | -moz-border-right-colors | -moz-border-top-colors | -moz-context-properties | -moz-control-character-visibility | -moz-float-edge | -moz-force-broken-image-icon | -moz-orient | -moz-osx-font-smoothing | -moz-outline-radius | -moz-outline-radius-bottomleft | -moz-outline-radius-bottomright | -moz-outline-radius-topleft | -moz-outline-radius-topright | -moz-stack-sizing | -moz-text-blink | -moz-user-focus | -moz-user-input | -moz-user-modify | -moz-user-select | -moz-window-dragging | -moz-window-shadow | -ms-accelerator | -ms-block-progression | -ms-content-zoom-chaining | -ms-content-zoom-limit | -ms-content-zoom-limit-max | -ms-content-zoom-limit-min | -ms-content-zoom-snap | -ms-content-zoom-snap-points | -ms-content-zoom-snap-type | -ms-content-zooming | -ms-filter | -ms-flex-align | -ms-flex-item-align | -ms-flex-line-pack | -ms-flex-negative | -ms-flex-order | -ms-flex-pack | -ms-flex-positive | -ms-flex-preferred-size | -ms-flow-from | -ms-flow-into | -ms-grid-column-align | -ms-grid-columns | -ms-grid-row-align | -ms-grid-rows | -ms-high-contrast-adjust | -ms-hyphenate-limit-chars | -ms-hyphenate-limit-last | -ms-hyphenate-limit-lines | -ms-hyphenate-limit-zone | -ms-ime-align | -ms-interpolation-mode | -ms-overflow-style | -ms-scroll-chaining | -ms-scroll-limit | -ms-scroll-limit-x-max | -ms-scroll-limit-x-min | -ms-scroll-limit-y-max | -ms-scroll-limit-y-min | -ms-scroll-rails | -ms-scroll-snap-points-x | -ms-scroll-snap-points-y | -ms-scroll-snap-type | -ms-scroll-snap-x | -ms-scroll-snap-y | -ms-scroll-translation | -ms-scrollbar-3dlight-color | -ms-scrollbar-arrow-color | -ms-scrollbar-base-color | -ms-scrollbar-darkshadow-color | -ms-scrollbar-face-color | -ms-scrollbar-highlight-color | -ms-scrollbar-shadow-color | -ms-scrollbar-track-color | -ms-text-autospace | -ms-touch-select | -ms-user-select | -ms-wrap-flow | -ms-wrap-margin | -ms-wrap-through | -webkit-appearance | -webkit-background-clip | -webkit-border-before | -webkit-border-before-color | -webkit-border-before-style | -webkit-border-before-width | -webkit-box-reflect | -webkit-column-break-after | -webkit-column-break-before | -webkit-column-break-inside | -webkit-font-smoothing | -webkit-line-clamp | -webkit-mask | -webkit-mask-attachment | -webkit-mask-box-image | -webkit-mask-clip | -webkit-mask-composite | -webkit-mask-image | -webkit-mask-origin | -webkit-mask-position | -webkit-mask-position-x | -webkit-mask-position-y | -webkit-mask-repeat | -webkit-mask-repeat-x | -webkit-mask-repeat-y | -webkit-mask-size | -webkit-overflow-scrolling | -webkit-print-color-adjust | -webkit-tap-highlight-color | -webkit-text-fill-color | -webkit-text-security | -webkit-text-stroke | -webkit-text-stroke-color | -webkit-text-stroke-width | -webkit-touch-callout | -webkit-user-drag | -webkit-user-modify | -webkit-user-select | accent-color | align-content | align-items | align-self | align-tracks | alignment-baseline | all | anchor-name | anchor-scope | animation | animation-composition | animation-delay | animation-delay-end | animation-delay-start | animation-direction | animation-duration | animation-fill-mode | animation-iteration-count | animation-name | animation-play-state | animation-range | animation-range-center | animation-range-end | animation-range-start | animation-timeline | animation-timing-function | animation-trigger | appearance | aspect-ratio | backdrop-filter | backface-visibility | background | background-attachment | background-blend-mode | background-clip | background-color | background-image | background-origin | background-position | background-position-block | background-position-inline | background-position-x | background-position-y | background-repeat | background-repeat-block | background-repeat-inline | background-repeat-x | background-repeat-y | background-size | background-tbd | baseline-shift | baseline-source | behavior | block-ellipsis | block-size | block-step | block-step-align | block-step-insert | block-step-round | block-step-size | bookmark-label | bookmark-level | bookmark-state | border | border-block | border-block-clip | border-block-color | border-block-end | border-block-end-clip | border-block-end-color | border-block-end-radius | border-block-end-style | border-block-end-width | border-block-start | border-block-start-clip | border-block-start-color | border-block-start-radius | border-block-start-style | border-block-start-width | border-block-style | border-block-width | border-bottom | border-bottom-clip | border-bottom-color | border-bottom-left-radius | border-bottom-radius | border-bottom-right-radius | border-bottom-style | border-bottom-width | border-boundary | border-clip | border-collapse | border-color | border-end-end-radius | border-end-start-radius | border-image | border-image-outset | border-image-repeat | border-image-slice | border-image-source | border-image-width | border-inline | border-inline-clip | border-inline-color | border-inline-end | border-inline-end-clip | border-inline-end-color | border-inline-end-radius | border-inline-end-style | border-inline-end-width | border-inline-start | border-inline-start-clip | border-inline-start-color | border-inline-start-radius | border-inline-start-style | border-inline-start-width | border-inline-style | border-inline-width | border-left | border-left-clip | border-left-color | border-left-radius | border-left-style | border-left-width | border-limit | border-radius | border-right | border-right-clip | border-right-color | border-right-radius | border-right-style | border-right-width | border-shape | border-spacing | border-start-end-radius | border-start-start-radius | border-style | border-top | border-top-clip | border-top-color | border-top-left-radius | border-top-radius | border-top-right-radius | border-top-style | border-top-width | border-width | bottom | box-align | box-decoration-break | box-direction | box-flex | box-flex-group | box-lines | box-ordinal-group | box-orient | box-pack | box-shadow | box-shadow-blur | box-shadow-color | box-shadow-offset | box-shadow-position | box-shadow-spread | box-sizing | box-snap | break-after | break-before | break-inside | caption-side | caret | caret-animation | caret-color | caret-shape | clear | clip | clip-path | clip-rule | color | color-adjust | color-interpolation | color-interpolation-filters | color-scheme | column-count | column-fill | column-gap | column-height | column-rule | column-rule-break | column-rule-color | column-rule-inset | column-rule-inset-cap | column-rule-inset-cap-end | column-rule-inset-cap-start | column-rule-inset-end | column-rule-inset-junction | column-rule-inset-junction-end | column-rule-inset-junction-start | column-rule-inset-start | column-rule-style | column-rule-visibility-items | column-rule-width | column-span | column-width | column-wrap | columns | contain | contain-intrinsic-block-size | contain-intrinsic-height | contain-intrinsic-inline-size | contain-intrinsic-size | contain-intrinsic-width | container | container-name | container-type | content | content-visibility | continue | copy-into | corner | corner-block-end | corner-block-end-shape | corner-block-start | corner-block-start-shape | corner-bottom | corner-bottom-left | corner-bottom-left-shape | corner-bottom-right | corner-bottom-right-shape | corner-bottom-shape | corner-end-end | corner-end-end-shape | corner-end-start | corner-end-start-shape | corner-inline-end | corner-inline-end-shape | corner-inline-start | corner-inline-start-shape | corner-left | corner-left-shape | corner-right | corner-right-shape | corner-shape | corner-start-end | corner-start-end-shape | corner-start-start | corner-start-start-shape | corner-top | corner-top-left | corner-top-left-shape | corner-top-right | corner-top-right-shape | corner-top-shape | counter-increment | counter-reset | counter-set | cue | cue-after | cue-before | cursor | cx | cy | d | direction | display | dominant-baseline | dynamic-range-limit | empty-cells | event-trigger | event-trigger-name | event-trigger-source | field-sizing | fill | fill-break | fill-color | fill-image | fill-opacity | fill-origin | fill-position | fill-repeat | fill-rule | fill-size | filter | flex | flex-basis | flex-direction | flex-flow | flex-grow | flex-line-count | flex-shrink | flex-wrap | float | float-defer | float-offset | float-reference | flood-color | flood-opacity | flow-from | flow-into | flow-tolerance | font | font-family | font-feature-settings | font-kerning | font-language-override | font-optical-sizing | font-palette | font-size | font-size-adjust | font-smooth | font-stretch | font-style | font-synthesis | font-synthesis-position | font-synthesis-small-caps | font-synthesis-style | font-synthesis-weight | font-variant | font-variant-alternates | font-variant-caps | font-variant-east-asian | font-variant-emoji | font-variant-ligatures | font-variant-numeric | font-variant-position | font-variation-settings | font-weight | font-width | footnote-display | footnote-policy | forced-color-adjust | frame-sizing | gap | glyph-orientation-horizontal | glyph-orientation-vertical | grid | grid-area | grid-auto-columns | grid-auto-flow | grid-auto-rows | grid-column | grid-column-end | grid-column-gap | grid-column-start | grid-gap | grid-row | grid-row-end | grid-row-gap | grid-row-start | grid-template | grid-template-areas | grid-template-columns | grid-template-rows | hanging-punctuation | height | hyphenate-character | hyphenate-limit-chars | hyphenate-limit-last | hyphenate-limit-lines | hyphenate-limit-zone | hyphens | image-animation | image-orientation | image-rendering | image-resolution | ime-mode | initial-letter | initial-letter-align | initial-letter-wrap | inline-size | inline-sizing | input-security | inset | inset-block | inset-block-end | inset-block-start | inset-inline | inset-inline-end | inset-inline-start | interactivity | interest-delay | interest-delay-end | interest-delay-start | interpolate-size | isolation | justify-content | justify-items | justify-self | justify-tracks | kerning | left | letter-spacing | lighting-color | line-break | line-clamp | line-fit-edge | line-grid | line-height | line-height-step | line-padding | line-snap | link-parameters | list-style | list-style-image | list-style-position | list-style-type | margin | margin-block | margin-block-end | margin-block-start | margin-bottom | margin-break | margin-inline | margin-inline-end | margin-inline-start | margin-left | margin-right | margin-top | margin-trim | marker | marker-end | marker-mid | marker-side | marker-start | mask | mask-border | mask-border-mode | mask-border-outset | mask-border-repeat | mask-border-slice | mask-border-source | mask-border-width | mask-clip | mask-composite | mask-image | mask-mode | mask-origin | mask-position | mask-repeat | mask-size | mask-type | masonry-auto-flow | math-depth | math-shift | math-style | max-block-size | max-height | max-inline-size | max-lines | max-width | min-block-size | min-height | min-inline-size | min-intrinsic-sizing | min-width | mix-blend-mode | nav-down | nav-left | nav-right | nav-up | object-fit | object-position | object-view-box | offset | offset-anchor | offset-distance | offset-path | offset-position | offset-rotate | opacity | order | orphans | outline | outline-color | outline-offset | outline-style | outline-width | overflow | overflow-anchor | overflow-block | overflow-clip-box | overflow-clip-margin | overflow-clip-margin-block | overflow-clip-margin-block-end | overflow-clip-margin-block-start | overflow-clip-margin-bottom | overflow-clip-margin-inline | overflow-clip-margin-inline-end | overflow-clip-margin-inline-start | overflow-clip-margin-left | overflow-clip-margin-right | overflow-clip-margin-top | overflow-inline | overflow-wrap | overflow-x | overflow-y | overlay | overscroll-behavior | overscroll-behavior-block | overscroll-behavior-inline | overscroll-behavior-x | overscroll-behavior-y | padding | padding-block | padding-block-end | padding-block-start | padding-bottom | padding-inline | padding-inline-end | padding-inline-start | padding-left | padding-right | padding-top | page | page-break-after | page-break-before | page-break-inside | paint-order | path-length | pause | pause-after | pause-before | perspective | perspective-origin | place-content | place-items | place-self | pointer-events | pointer-timeline | pointer-timeline-axis | pointer-timeline-name | position | position-anchor | position-area | position-try | position-try-fallbacks | position-try-options | position-try-order | position-visibility | print-color-adjust | quotes | r | reading-flow | reading-order | region-fragment | resize | rest | rest-after | rest-before | right | rotate | row-gap | row-rule | row-rule-break | row-rule-color | row-rule-inset | row-rule-inset-cap | row-rule-inset-cap-end | row-rule-inset-cap-start | row-rule-inset-end | row-rule-inset-junction | row-rule-inset-junction-end | row-rule-inset-junction-start | row-rule-inset-start | row-rule-style | row-rule-visibility-items | row-rule-width | ruby-align | ruby-merge | ruby-overhang | ruby-position | rule | rule-break | rule-color | rule-inset | rule-inset-cap | rule-inset-end | rule-inset-junction | rule-inset-start | rule-overlap | rule-style | rule-visibility-items | rule-width | rx | ry | scale | scroll-behavior | scroll-initial-target | scroll-margin | scroll-margin-block | scroll-margin-block-end | scroll-margin-block-start | scroll-margin-bottom | scroll-margin-inline | scroll-margin-inline-end | scroll-margin-inline-start | scroll-margin-left | scroll-margin-right | scroll-margin-top | scroll-marker-group | scroll-padding | scroll-padding-block | scroll-padding-block-end | scroll-padding-block-start | scroll-padding-bottom | scroll-padding-inline | scroll-padding-inline-end | scroll-padding-inline-start | scroll-padding-left | scroll-padding-right | scroll-padding-top | scroll-snap-align | scroll-snap-coordinate | scroll-snap-destination | scroll-snap-points-x | scroll-snap-points-y | scroll-snap-stop | scroll-snap-type | scroll-snap-type-x | scroll-snap-type-y | scroll-target-group | scroll-timeline | scroll-timeline-axis | scroll-timeline-name | scrollbar-color | scrollbar-gutter | scrollbar-width | shape-image-threshold | shape-inside | shape-margin | shape-outside | shape-padding | shape-rendering | slider-orientation | spatial-navigation-action | spatial-navigation-contain | spatial-navigation-function | speak | speak-as | stop-color | stop-opacity | string-set | stroke | stroke-align | stroke-alignment | stroke-break | stroke-color | stroke-dash-corner | stroke-dash-justify | stroke-dashadjust | stroke-dasharray | stroke-dashcorner | stroke-dashoffset | stroke-image | stroke-linecap | stroke-linejoin | stroke-miterlimit | stroke-opacity | stroke-origin | stroke-position | stroke-repeat | stroke-size | stroke-width | tab-size | table-layout | text-align | text-align-all | text-align-last | text-anchor | text-autospace | text-box | text-box-edge | text-box-trim | text-combine-upright | text-decoration | text-decoration-color | text-decoration-inset | text-decoration-line | text-decoration-skip | text-decoration-skip-box | text-decoration-skip-ink | text-decoration-skip-self | text-decoration-skip-spaces | text-decoration-style | text-decoration-thickness | text-emphasis | text-emphasis-color | text-emphasis-position | text-emphasis-skip | text-emphasis-style | text-fit | text-group-align | text-indent | text-justify | text-orientation | text-overflow | text-rendering | text-shadow | text-size-adjust | text-spacing | text-spacing-trim | text-transform | text-underline-offset | text-underline-position | text-wrap | text-wrap-mode | text-wrap-style | timeline-scope | timeline-trigger | timeline-trigger-activation-range | timeline-trigger-activation-range-end | timeline-trigger-activation-range-start | timeline-trigger-active-range | timeline-trigger-active-range-end | timeline-trigger-active-range-start | timeline-trigger-exit-range | timeline-trigger-exit-range-end | timeline-trigger-exit-range-start | timeline-trigger-name | timeline-trigger-range | timeline-trigger-range-end | timeline-trigger-range-start | timeline-trigger-source | top | touch-action | transform | transform-box | transform-origin | transform-style | transition | transition-behavior | transition-delay | transition-duration | transition-property | transition-timing-function | translate | trigger-scope | unicode-bidi | user-select | vector-effect | vertical-align | view-timeline | view-timeline-axis | view-timeline-inset | view-timeline-name | view-transition-class | view-transition-group | view-transition-name | view-transition-scope | visibility | voice-balance | voice-duration | voice-family | voice-pitch | voice-range | voice-rate | voice-stress | voice-volume | white-space | white-space-collapse | white-space-trim | widows | width | will-change | window-drag | word-break | word-space-transform | word-spacing | word-wrap | wrap-after | wrap-before | wrap-flow | wrap-inside | wrap-through | writing-mode | x | y | z-index | zoom"
800
+ }
801
+ }
802
+ }
node_modules/@csstools/css-syntax-patches-for-csstree/package.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@csstools/css-syntax-patches-for-csstree",
3
+ "description": "CSS syntax patches for CSS tree",
4
+ "version": "1.1.8",
5
+ "contributors": [
6
+ {
7
+ "name": "Antonio Laguna",
8
+ "email": "antonio@laguna.es",
9
+ "url": "https://antonio.laguna.es"
10
+ },
11
+ {
12
+ "name": "Romain Menke",
13
+ "email": "romainmenke@gmail.com"
14
+ }
15
+ ],
16
+ "license": "MIT-0",
17
+ "funding": [
18
+ {
19
+ "type": "github",
20
+ "url": "https://github.com/sponsors/csstools"
21
+ },
22
+ {
23
+ "type": "opencollective",
24
+ "url": "https://opencollective.com/csstools"
25
+ }
26
+ ],
27
+ "main": "dist/index.json",
28
+ "types": "dist/index.d.ts",
29
+ "files": [
30
+ "CHANGELOG.md",
31
+ "LICENSE.md",
32
+ "README.md",
33
+ "dist"
34
+ ],
35
+ "peerDependencies": {
36
+ "css-tree": "^3.2.1"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "css-tree": {
40
+ "optional": true
41
+ }
42
+ },
43
+ "scripts": {},
44
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-syntax-patches-for-csstree#readme",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
48
+ "directory": "packages/css-syntax-patches-for-csstree"
49
+ },
50
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
51
+ "keywords": [
52
+ "css",
53
+ "csstree",
54
+ "syntax"
55
+ ]
56
+ }
node_modules/@csstools/css-tokenizer/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changes to CSS Tokenizer
2
+
3
+ ### 4.0.0
4
+
5
+ _January 14, 2026_
6
+
7
+ - Updated: Support for Node `20.19.0` or later (major).
8
+ - Removed: `commonjs` API. In supported Node versions `require(esm)` will work without needing to make code changes.
9
+
10
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md)
node_modules/@csstools/css-tokenizer/LICENSE.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
node_modules/@csstools/css-tokenizer/README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CSS Tokenizer <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
2
+
3
+ [<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-tokenizer.svg" height="20">][npm-url]
4
+ [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
5
+ [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
6
+
7
+ Implemented from : https://drafts.csswg.org/css-syntax/
8
+
9
+ ## API
10
+
11
+ [Read the API docs](./docs/css-tokenizer.md)
12
+
13
+ ## Usage
14
+
15
+ Add [CSS Tokenizer] to your project:
16
+
17
+ ```bash
18
+ npm install @csstools/css-tokenizer --save-dev
19
+ ```
20
+
21
+ ```js
22
+ import { tokenize } from '@csstools/css-tokenizer';
23
+
24
+ const myCSS = `@media only screen and (min-width: 768rem) {
25
+ .foo {
26
+ content: 'Some content!' !important;
27
+ }
28
+ }
29
+ `;
30
+
31
+ const tokens = tokenize({
32
+ css: myCSS,
33
+ });
34
+
35
+ console.log(tokens);
36
+ ```
37
+
38
+ Or use the streaming interface:
39
+
40
+ ```js
41
+ import { tokenizer, TokenType } from '@csstools/css-tokenizer';
42
+
43
+ const myCSS = `@media only screen and (min-width: 768rem) {
44
+ .foo {
45
+ content: 'Some content!' !important;
46
+ }
47
+ }
48
+ `;
49
+
50
+ const t = tokenizer({
51
+ css: myCSS,
52
+ });
53
+
54
+ while (true) {
55
+ const token = t.nextToken();
56
+ if (token[0] === TokenType.EOF) {
57
+ break;
58
+ }
59
+
60
+ console.log(token);
61
+ }
62
+ ```
63
+
64
+ ### Options
65
+
66
+ ```ts
67
+ {
68
+ onParseError?: (error: ParseError) => void
69
+ }
70
+ ```
71
+
72
+ #### `onParseError`
73
+
74
+ The tokenizer is forgiving and won't stop when a parse error is encountered.
75
+
76
+ To receive parsing error information you can set a callback.
77
+
78
+ ```js
79
+ import { tokenizer, TokenType } from '@csstools/css-tokenizer';
80
+
81
+ const t = tokenizer({
82
+ css: '\\',
83
+ }, { onParseError: (err) => console.warn(err) });
84
+
85
+ while (true) {
86
+ const token = t.nextToken();
87
+ if (token[0] === TokenType.EOF) {
88
+ break;
89
+ }
90
+ }
91
+ ```
92
+
93
+ Parser errors will try to inform you where in the tokenizer logic the error happened.
94
+ This tells you what kind of error occurred.
95
+
96
+ ## Order of priorities
97
+
98
+ 1. specification compliance
99
+ 2. correctness
100
+ 3. reliability
101
+ 4. tokenizing and serializing must round trip losslessly
102
+ 5. exposing useful aspects about the source code
103
+ 6. runtime performance
104
+ 7. package size
105
+
106
+
107
+ [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
108
+ [discord]: https://discord.gg/bUadyRwkJS
109
+ [npm-url]: https://www.npmjs.com/package/@csstools/css-tokenizer
110
+
111
+ [CSS Tokenizer]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer
node_modules/@csstools/css-tokenizer/dist/index.d.ts ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Tokenize CSS following the {@link https://drafts.csswg.org/css-syntax/#tokenization | CSS Syntax Level 3 specification}.
3
+ *
4
+ * @remarks
5
+ * The tokenizing and parsing tools provided by CSS Tools are designed to be low level and generic with strong ties to their respective specifications.
6
+ *
7
+ * Any analysis or mutation of CSS source code should be done with the least powerful tool that can accomplish the task.
8
+ * For many applications it is sufficient to work with tokens.
9
+ * For others you might need to use {@link https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms | @csstools/css-parser-algorithms} or a more specific parser.
10
+ *
11
+ * @example
12
+ * Tokenize a string of CSS into an array of tokens:
13
+ * ```js
14
+ * import { tokenize } from '@csstools/css-tokenizer';
15
+ *
16
+ * const myCSS = `@media only screen and (min-width: 768rem) {
17
+ * .foo {
18
+ * content: 'Some content!' !important;
19
+ * }
20
+ * }
21
+ * `;
22
+ *
23
+ * const tokens = tokenize({
24
+ * css: myCSS,
25
+ * });
26
+ *
27
+ * console.log(tokens);
28
+ * ```
29
+ *
30
+ * @packageDocumentation
31
+ */
32
+
33
+ /**
34
+ * Deep clone a list of tokens.
35
+ * Useful for mutations without altering the original list.
36
+ */
37
+ export declare function cloneTokens(tokens: Array<CSSToken>): Array<CSSToken>;
38
+
39
+ /**
40
+ * The union of all possible CSS tokens
41
+ */
42
+ export declare type CSSToken = TokenAtKeyword | TokenBadString | TokenBadURL | TokenCDC | TokenCDO | TokenColon | TokenComma | TokenComment | TokenDelim | TokenDimension | TokenEOF | TokenFunction | TokenHash | TokenIdent | TokenNumber | TokenPercentage | TokenSemicolon | TokenString | TokenURL | TokenWhitespace | TokenOpenParen | TokenCloseParen | TokenOpenSquare | TokenCloseSquare | TokenOpenCurly | TokenCloseCurly | TokenUnicodeRange;
43
+
44
+ /**
45
+ * The type of hash token
46
+ */
47
+ export declare enum HashType {
48
+ /**
49
+ * The hash token did not start with an ident sequence (e.g. `#-2`)
50
+ */
51
+ Unrestricted = "unrestricted",
52
+ /**
53
+ * The hash token started with an ident sequence (e.g. `#foo`)
54
+ * Only hash tokens with the "id" type are valid ID selectors.
55
+ */
56
+ ID = "id"
57
+ }
58
+
59
+ /**
60
+ * Assert that a given value has the general structure of a CSS token:
61
+ * 1. is an array.
62
+ * 2. has at least four items.
63
+ * 3. has a known token type.
64
+ * 4. has a string representation.
65
+ * 5. has a start position.
66
+ * 6. has an end position.
67
+ */
68
+ export declare function isToken(x: any): x is CSSToken;
69
+
70
+ export declare function isTokenAtKeyword(x?: CSSToken | null): x is TokenAtKeyword;
71
+
72
+ export declare function isTokenBadString(x?: CSSToken | null): x is TokenBadString;
73
+
74
+ export declare function isTokenBadURL(x?: CSSToken | null): x is TokenBadURL;
75
+
76
+ export declare function isTokenCDC(x?: CSSToken | null): x is TokenCDC;
77
+
78
+ export declare function isTokenCDO(x?: CSSToken | null): x is TokenCDO;
79
+
80
+ export declare function isTokenCloseCurly(x?: CSSToken | null): x is TokenCloseCurly;
81
+
82
+ export declare function isTokenCloseParen(x?: CSSToken | null): x is TokenCloseParen;
83
+
84
+ export declare function isTokenCloseSquare(x?: CSSToken | null): x is TokenCloseSquare;
85
+
86
+ export declare function isTokenColon(x?: CSSToken | null): x is TokenColon;
87
+
88
+ export declare function isTokenComma(x?: CSSToken | null): x is TokenComma;
89
+
90
+ export declare function isTokenComment(x?: CSSToken | null): x is TokenComment;
91
+
92
+ export declare function isTokenDelim(x?: CSSToken | null): x is TokenDelim;
93
+
94
+ export declare function isTokenDimension(x?: CSSToken | null): x is TokenDimension;
95
+
96
+ export declare function isTokenEOF(x?: CSSToken | null): x is TokenEOF;
97
+
98
+ export declare function isTokenFunction(x?: CSSToken | null): x is TokenFunction;
99
+
100
+ export declare function isTokenHash(x?: CSSToken | null): x is TokenHash;
101
+
102
+ export declare function isTokenIdent(x?: CSSToken | null): x is TokenIdent;
103
+
104
+ export declare function isTokenNumber(x?: CSSToken | null): x is TokenNumber;
105
+
106
+ /**
107
+ * Assert that a token is a numeric token
108
+ */
109
+ export declare function isTokenNumeric(x?: CSSToken | null): x is NumericToken;
110
+
111
+ export declare function isTokenOpenCurly(x?: CSSToken | null): x is TokenOpenCurly;
112
+
113
+ export declare function isTokenOpenParen(x?: CSSToken | null): x is TokenOpenParen;
114
+
115
+ export declare function isTokenOpenSquare(x?: CSSToken | null): x is TokenOpenSquare;
116
+
117
+ export declare function isTokenPercentage(x?: CSSToken | null): x is TokenPercentage;
118
+
119
+ export declare function isTokenSemicolon(x?: CSSToken | null): x is TokenSemicolon;
120
+
121
+ export declare function isTokenString(x?: CSSToken | null): x is TokenString;
122
+
123
+ export declare function isTokenUnicodeRange(x?: CSSToken | null): x is TokenUnicodeRange;
124
+
125
+ export declare function isTokenURL(x?: CSSToken | null): x is TokenURL;
126
+
127
+ export declare function isTokenWhitespace(x?: CSSToken | null): x is TokenWhitespace;
128
+
129
+ /**
130
+ * Assert that a token is a whitespace or comment token
131
+ */
132
+ export declare function isTokenWhiteSpaceOrComment(x?: CSSToken | null): x is TokenWhitespace | TokenComment;
133
+
134
+ /**
135
+ * Get the mirror variant of a given token
136
+ *
137
+ * @example
138
+ *
139
+ * ```js
140
+ * const input = [TokenType.OpenParen, '(', 0, 1, undefined];
141
+ * const output = mirrorVariant(input);
142
+ *
143
+ * console.log(output); // [TokenType.CloseParen, ')', -1, -1, undefined]
144
+ * ```
145
+ */
146
+ export declare function mirrorVariant(token: CSSToken): CSSToken | null;
147
+
148
+ /**
149
+ * Get the mirror variant type of a given token type
150
+ *
151
+ * @example
152
+ *
153
+ * ```js
154
+ * const input = TokenType.OpenParen;
155
+ * const output = mirrorVariantType(input);
156
+ *
157
+ * console.log(output); // TokenType.CloseParen
158
+ * ```
159
+ */
160
+ export declare function mirrorVariantType(type: TokenType): TokenType | null;
161
+
162
+ /**
163
+ * Set the ident value and update the string representation.
164
+ * This handles escaping.
165
+ */
166
+ export declare function mutateIdent(ident: TokenIdent, newValue: string): void;
167
+
168
+ /**
169
+ * Set the unit and update the string representation.
170
+ * This handles escaping.
171
+ */
172
+ export declare function mutateUnit(ident: TokenDimension, newUnit: string): void;
173
+
174
+ /**
175
+ * The type of number token
176
+ * Either `integer` or `number`
177
+ */
178
+ export declare enum NumberType {
179
+ Integer = "integer",
180
+ Number = "number"
181
+ }
182
+
183
+ /**
184
+ * The union of all possible CSS tokens that represent a numeric value
185
+ */
186
+ export declare type NumericToken = TokenDimension | TokenNumber | TokenPercentage;
187
+
188
+ /**
189
+ * The CSS Tokenizer is forgiving and will never throw on invalid input.
190
+ * Any errors are reported through the `onParseError` callback.
191
+ */
192
+ export declare class ParseError extends Error {
193
+ /** The index of the start character of the current token. */
194
+ sourceStart: number;
195
+ /** The index of the end character of the current token. */
196
+ sourceEnd: number;
197
+ /** The parser steps that preceded the error. */
198
+ parserState: Array<string>;
199
+ constructor(message: string, sourceStart: number, sourceEnd: number, parserState: Array<string>);
200
+ }
201
+
202
+ export declare const ParseErrorMessage: {
203
+ UnexpectedNewLineInString: string;
204
+ UnexpectedEOFInString: string;
205
+ UnexpectedEOFInComment: string;
206
+ UnexpectedEOFInURL: string;
207
+ UnexpectedEOFInEscapedCodePoint: string;
208
+ UnexpectedCharacterInURL: string;
209
+ InvalidEscapeSequenceInURL: string;
210
+ InvalidEscapeSequenceAfterBackslash: string;
211
+ };
212
+
213
+ export declare class ParseErrorWithToken extends ParseError {
214
+ /** The associated token. */
215
+ token: CSSToken;
216
+ constructor(message: string, sourceStart: number, sourceEnd: number, parserState: Array<string>, token: CSSToken);
217
+ }
218
+
219
+ /**
220
+ * Concatenate the string representation of a list of tokens.
221
+ * This is not a proper serializer that will handle escaping and whitespace.
222
+ * It only produces valid CSS for a token list that is also valid.
223
+ */
224
+ export declare function stringify(...tokens: Array<CSSToken>): string;
225
+
226
+ /**
227
+ * The CSS Token interface
228
+ *
229
+ * @remarks
230
+ * CSS Tokens are fully typed and have a strict structure.
231
+ * This makes it easier to iterate and analyze a token stream.
232
+ *
233
+ * The string representation and the parsed value are stored separately for many token types.
234
+ * It is always assumed that the string representation will be used when stringifying, while the parsed value should be used when analyzing tokens.
235
+ */
236
+ export declare interface Token<T extends TokenType, U> extends Array<T | string | number | U> {
237
+ /**
238
+ * The type of token
239
+ */
240
+ 0: T;
241
+ /**
242
+ * The token representation
243
+ *
244
+ * @remarks
245
+ * This field will be used when stringifying the token.
246
+ * Any stored value is assumed to be valid CSS.
247
+ *
248
+ * You should never use this field when analyzing the token when there is a parsed value available.
249
+ * But you must store mutated values here.
250
+ */
251
+ 1: string;
252
+ /**
253
+ * Start position of representation
254
+ */
255
+ 2: number;
256
+ /**
257
+ * End position of representation
258
+ */
259
+ 3: number;
260
+ /**
261
+ * Extra data
262
+ *
263
+ * @remarks
264
+ * This holds the parsed value of each token.
265
+ * These values are unescaped, unquoted, converted to numbers, etc.
266
+ *
267
+ * You should always use this field when analyzing the token.
268
+ * But you must not assume that mutating only this field will have any effect.
269
+ */
270
+ 4: U;
271
+ }
272
+
273
+ export declare interface TokenAtKeyword extends Token<TokenType.AtKeyword, {
274
+ /**
275
+ * The unescaped at-keyword name without the leading `@`.
276
+ */
277
+ value: string;
278
+ }> {
279
+ }
280
+
281
+ export declare interface TokenBadString extends Token<TokenType.BadString, undefined> {
282
+ }
283
+
284
+ export declare interface TokenBadURL extends Token<TokenType.BadURL, undefined> {
285
+ }
286
+
287
+ export declare interface TokenCDC extends Token<TokenType.CDC, undefined> {
288
+ }
289
+
290
+ export declare interface TokenCDO extends Token<TokenType.CDO, undefined> {
291
+ }
292
+
293
+ export declare interface TokenCloseCurly extends Token<TokenType.CloseCurly, undefined> {
294
+ }
295
+
296
+ export declare interface TokenCloseParen extends Token<TokenType.CloseParen, undefined> {
297
+ }
298
+
299
+ export declare interface TokenCloseSquare extends Token<TokenType.CloseSquare, undefined> {
300
+ }
301
+
302
+ export declare interface TokenColon extends Token<TokenType.Colon, undefined> {
303
+ }
304
+
305
+ export declare interface TokenComma extends Token<TokenType.Comma, undefined> {
306
+ }
307
+
308
+ export declare interface TokenComment extends Token<TokenType.Comment, undefined> {
309
+ }
310
+
311
+ export declare interface TokenDelim extends Token<TokenType.Delim, {
312
+ /**
313
+ * The delim character.
314
+ */
315
+ value: string;
316
+ }> {
317
+ }
318
+
319
+ export declare interface TokenDimension extends Token<TokenType.Dimension, {
320
+ /**
321
+ * The numeric value.
322
+ */
323
+ value: number;
324
+ /**
325
+ * The unescaped unit name.
326
+ */
327
+ unit: string;
328
+ /**
329
+ * `integer` or `number`
330
+ */
331
+ type: NumberType;
332
+ /**
333
+ * The sign character as it appeared in the source.
334
+ * This is only useful if you need to determine if a value was written as "2px" or "+2px".
335
+ */
336
+ signCharacter?: '+' | '-';
337
+ }> {
338
+ }
339
+
340
+ export declare interface TokenEOF extends Token<TokenType.EOF, undefined> {
341
+ }
342
+
343
+ export declare interface TokenFunction extends Token<TokenType.Function, {
344
+ /**
345
+ * The unescaped function name without the trailing `(`.
346
+ */
347
+ value: string;
348
+ }> {
349
+ }
350
+
351
+ export declare interface TokenHash extends Token<TokenType.Hash, {
352
+ /**
353
+ * The unescaped hash value without the leading `#`.
354
+ */
355
+ value: string;
356
+ /**
357
+ * The hash type.
358
+ */
359
+ type: HashType;
360
+ }> {
361
+ }
362
+
363
+ export declare interface TokenIdent extends Token<TokenType.Ident, {
364
+ /**
365
+ * The unescaped ident value.
366
+ */
367
+ value: string;
368
+ }> {
369
+ }
370
+
371
+ /**
372
+ * Tokenize a CSS string into a list of tokens.
373
+ */
374
+ export declare function tokenize(input: {
375
+ css: {
376
+ valueOf(): string;
377
+ };
378
+ unicodeRangesAllowed?: boolean;
379
+ }, options?: {
380
+ onParseError?: (error: ParseError) => void;
381
+ }): Array<CSSToken>;
382
+
383
+ /**
384
+ * Create a tokenizer for a CSS string.
385
+ */
386
+ export declare function tokenizer(input: {
387
+ css: {
388
+ valueOf(): string;
389
+ };
390
+ unicodeRangesAllowed?: boolean;
391
+ }, options?: {
392
+ onParseError?: (error: ParseError) => void;
393
+ }): {
394
+ nextToken: () => CSSToken;
395
+ endOfFile: () => boolean;
396
+ };
397
+
398
+ export declare interface TokenNumber extends Token<TokenType.Number, {
399
+ /**
400
+ * The numeric value.
401
+ */
402
+ value: number;
403
+ /**
404
+ * `integer` or `number`
405
+ */
406
+ type: NumberType;
407
+ /**
408
+ * The sign character as it appeared in the source.
409
+ * This is only useful if you need to determine if a value was written as "2" or "+2".
410
+ */
411
+ signCharacter?: '+' | '-';
412
+ }> {
413
+ }
414
+
415
+ export declare interface TokenOpenCurly extends Token<TokenType.OpenCurly, undefined> {
416
+ }
417
+
418
+ export declare interface TokenOpenParen extends Token<TokenType.OpenParen, undefined> {
419
+ }
420
+
421
+ export declare interface TokenOpenSquare extends Token<TokenType.OpenSquare, undefined> {
422
+ }
423
+
424
+ export declare interface TokenPercentage extends Token<TokenType.Percentage, {
425
+ /**
426
+ * The numeric value.
427
+ */
428
+ value: number;
429
+ /**
430
+ * The sign character as it appeared in the source.
431
+ * This is only useful if you need to determine if a value was written as "2%" or "+2%".
432
+ */
433
+ signCharacter?: '+' | '-';
434
+ }> {
435
+ }
436
+
437
+ export declare interface TokenSemicolon extends Token<TokenType.Semicolon, undefined> {
438
+ }
439
+
440
+ export declare interface TokenString extends Token<TokenType.String, {
441
+ /**
442
+ * The unescaped string value without the leading and trailing quotes.
443
+ */
444
+ value: string;
445
+ }> {
446
+ }
447
+
448
+ /**
449
+ * All possible CSS token types
450
+ */
451
+ export declare enum TokenType {
452
+ /**
453
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#comment-diagram}
454
+ */
455
+ Comment = "comment",
456
+ /**
457
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-at-keyword-token}
458
+ */
459
+ AtKeyword = "at-keyword-token",
460
+ /**
461
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-bad-string-token}
462
+ */
463
+ BadString = "bad-string-token",
464
+ /**
465
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-bad-url-token}
466
+ */
467
+ BadURL = "bad-url-token",
468
+ /**
469
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-cdc-token}
470
+ */
471
+ CDC = "CDC-token",
472
+ /**
473
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-cdo-token}
474
+ */
475
+ CDO = "CDO-token",
476
+ /**
477
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-colon-token}
478
+ */
479
+ Colon = "colon-token",
480
+ /**
481
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-comma-token}
482
+ */
483
+ Comma = "comma-token",
484
+ /**
485
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-delim-token}
486
+ */
487
+ Delim = "delim-token",
488
+ /**
489
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-dimension-token}
490
+ */
491
+ Dimension = "dimension-token",
492
+ /**
493
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-eof-token}
494
+ */
495
+ EOF = "EOF-token",
496
+ /**
497
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-function-token}
498
+ */
499
+ Function = "function-token",
500
+ /**
501
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-hash-token}
502
+ */
503
+ Hash = "hash-token",
504
+ /**
505
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-ident-token}
506
+ */
507
+ Ident = "ident-token",
508
+ /**
509
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-percentage-token}
510
+ */
511
+ Number = "number-token",
512
+ /**
513
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-percentage-token}
514
+ */
515
+ Percentage = "percentage-token",
516
+ /**
517
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-semicolon-token}
518
+ */
519
+ Semicolon = "semicolon-token",
520
+ /**
521
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-string-token}
522
+ */
523
+ String = "string-token",
524
+ /**
525
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-url-token}
526
+ */
527
+ URL = "url-token",
528
+ /**
529
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#typedef-whitespace-token}
530
+ */
531
+ Whitespace = "whitespace-token",
532
+ /**
533
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-open-paren}
534
+ */
535
+ OpenParen = "(-token",
536
+ /**
537
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-close-paren}
538
+ */
539
+ CloseParen = ")-token",
540
+ /**
541
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-open-square}
542
+ */
543
+ OpenSquare = "[-token",
544
+ /**
545
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-close-square}
546
+ */
547
+ CloseSquare = "]-token",
548
+ /**
549
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-open-curly}
550
+ */
551
+ OpenCurly = "{-token",
552
+ /**
553
+ * @see {@link https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-close-curly}
554
+ */
555
+ CloseCurly = "}-token",
556
+ /**
557
+ * Only appears in the token stream when the `unicodeRangesAllowed` option is set to true.
558
+ *
559
+ * @example
560
+ * ```js
561
+ * import { tokenize } from '@csstools/css-tokenizer';
562
+ *
563
+ * const tokens = tokenize({
564
+ * css: `U+0025-00FF, U+4??`,
565
+ * unicodeRangesAllowed: true,
566
+ * });
567
+ *
568
+ * console.log(tokens);
569
+ * ```
570
+ *
571
+ * @see {@link https://drafts.csswg.org/css-syntax/#typedef-unicode-range-token}
572
+ */
573
+ UnicodeRange = "unicode-range-token"
574
+ }
575
+
576
+ export declare interface TokenUnicodeRange extends Token<TokenType.UnicodeRange, {
577
+ startOfRange: number;
578
+ endOfRange: number;
579
+ }> {
580
+ }
581
+
582
+ export declare interface TokenURL extends Token<TokenType.URL, {
583
+ /**
584
+ * The unescaped URL value without the leading `url(` and trailing `)`.
585
+ */
586
+ value: string;
587
+ }> {
588
+ }
589
+
590
+ export declare interface TokenWhitespace extends Token<TokenType.Whitespace, undefined> {
591
+ }
592
+
593
+ export { }
node_modules/@csstools/css-tokenizer/dist/index.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,t,o){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=t,this.parserState=o}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,t,o,r){super(e,n,t,o),this.token=r}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))}function stringify(...e){let n="";for(let t=0;t<e.length;t++)n+=e[t][1];return n}const t=13,o=45,r=10,i=43,s=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===o&&e.source.codePointAt(e.cursor+3)===o}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===o}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNonPrintableCodePoint(e){return 11===e||127===e||0<=e&&e<=8||14<=e&&e<=31}function isNewLine(e){return e===r||e===t||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===t||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===o?n.source.codePointAt(n.cursor+1)===o||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===i||e.source.codePointAt(e.cursor)===o?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===o&&e.source.codePointAt(e.cursor+1)===o&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function mirrorVariantType(e){switch(e){case c.OpenParen:return c.CloseParen;case c.CloseParen:return c.OpenParen;case c.OpenCurly:return c.CloseCurly;case c.CloseCurly:return c.OpenCurly;case c.OpenSquare:return c.CloseSquare;case c.CloseSquare:return c.OpenSquare;default:return null}}function mirrorVariant(e){switch(e[0]){case c.OpenParen:return[c.CloseParen,")",-1,-1,void 0];case c.CloseParen:return[c.OpenParen,"(",-1,-1,void 0];case c.OpenCurly:return[c.CloseCurly,"}",-1,-1,void 0];case c.CloseCurly:return[c.OpenCurly,"{",-1,-1,void 0];case c.OpenSquare:return[c.CloseSquare,"]",-1,-1,void 0];case c.CloseSquare:return[c.OpenSquare,"[",-1,-1,void 0];default:return null}}function consumeComment(n,t){for(t.advanceCodePoint(2);;){const o=t.readCodePoint();if(void 0===o){const o=[c.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,t.representationStart,t.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],o)),o}if(42===o&&(void 0!==t.source.codePointAt(t.cursor)&&47===t.source.codePointAt(t.cursor))){t.advanceCodePoint();break}}return[c.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0]}function consumeEscapedCodePoint(n,o){const i=o.readCodePoint();if(void 0===i)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,o.representationStart,o.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),s;if(isHexDigitCodePoint(i)){const e=[i];let n;for(;void 0!==(n=o.source.codePointAt(o.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1)&&(o.source.codePointAt(o.cursor)===t&&o.source.codePointAt(o.cursor+1)===r&&o.advanceCodePoint(),o.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?s:c}return 0===i||isSurrogate(i)?s:i}function consumeIdentSequence(e,n){const t=[];for(;;){const o=n.source.codePointAt(n.cursor)??-1;if(0===o||isSurrogate(o))t.push(s),n.advanceCodePoint(+(o>65535)+1);else if(isIdentCodePoint(o))t.push(o),n.advanceCodePoint(+(o>65535)+1);else{if(!checkIfTwoCodePointsAreAValidEscape(n))return t;n.advanceCodePoint(),t.push(consumeEscapedCodePoint(e,n))}}}function consumeHashToken(e,n){n.advanceCodePoint();const t=n.source.codePointAt(n.cursor);if(void 0!==t&&(isIdentCodePoint(t)||checkIfTwoCodePointsAreAValidEscape(n))){let t=u.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(t=u.ID);const o=consumeIdentSequence(e,n);return[c.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o),type:t}]}return[c.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let t=a.Integer;for(n.source.codePointAt(n.cursor)!==i&&n.source.codePointAt(n.cursor)!==o||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),t=a.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else{if(n.source.codePointAt(n.cursor+1)!==o&&n.source.codePointAt(n.cursor+1)!==i||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return t;n.advanceCodePoint(3)}for(t=a.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint()}return t}function consumeNumericToken(e,n){let t;{const e=n.source.codePointAt(n.cursor);e===o?t="-":e===i&&(t="+")}const r=consumeNumber(0,n),s=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const o=consumeIdentSequence(e,n);return[c.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:s,signCharacter:t,type:r,unit:String.fromCodePoint(...o)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[c.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:s,signCharacter:t}]):[c.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:s,signCharacter:t,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return[c.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}!function(e){e.Comment="comment",e.AtKeyword="at-keyword-token",e.BadString="bad-string-token",e.BadURL="bad-url-token",e.CDC="CDC-token",e.CDO="CDO-token",e.Colon="colon-token",e.Comma="comma-token",e.Delim="delim-token",e.Dimension="dimension-token",e.EOF="EOF-token",e.Function="function-token",e.Hash="hash-token",e.Ident="ident-token",e.Number="number-token",e.Percentage="percentage-token",e.Semicolon="semicolon-token",e.String="string-token",e.URL="url-token",e.Whitespace="whitespace-token",e.OpenParen="(-token",e.CloseParen=")-token",e.OpenSquare="[-token",e.CloseSquare="]-token",e.OpenCurly="{-token",e.CloseCurly="}-token",e.UnicodeRange="unicode-range-token"}(c||(c={})),function(e){e.Integer="integer",e.Number="number"}(a||(a={})),function(e){e.Unrestricted="unrestricted",e.ID="id"}(u||(u={}));class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1}}function consumeStringToken(n,o){let i="";const a=o.readCodePoint();for(;;){const u=o.readCodePoint();if(void 0===u){const t=[c.String,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:i}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,o.representationStart,o.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],t)),t}if(isNewLine(u)){o.unreadCodePoint();const i=[c.BadString,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,o.representationStart,o.source.codePointAt(o.cursor)===t&&o.source.codePointAt(o.cursor+1)===r?o.representationEnd+2:o.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],i)),i}if(u===a)return[c.String,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:i}];if(92!==u)0===u||isSurrogate(u)?i+=String.fromCodePoint(s):i+=String.fromCodePoint(u);else{if(void 0===o.source.codePointAt(o.cursor))continue;if(isNewLine(o.source.codePointAt(o.cursor)??-1)){o.source.codePointAt(o.cursor)===t&&o.source.codePointAt(o.cursor+1)===r&&o.advanceCodePoint(),o.advanceCodePoint();continue}i+=String.fromCodePoint(consumeEscapedCodePoint(n,o))}}}function checkIfCodePointsMatchURLIdent(e){return!(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const t=n.source.codePointAt(n.cursor);if(void 0===t)return;if(41===t)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint()}}function consumeUrlToken(n,t){for(;isWhitespace(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();let o="";for(;;){if(void 0===t.source.codePointAt(t.cursor)){const r=[c.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:o}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===t.source.codePointAt(t.cursor))return t.advanceCodePoint(),[c.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:o}];if(isWhitespace(t.source.codePointAt(t.cursor)??-1)){for(t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(void 0===t.source.codePointAt(t.cursor)){const r=[c.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:o}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===t.source.codePointAt(t.cursor)?(t.advanceCodePoint(),[c.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:o}]):(consumeBadURL(n,t),[c.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0])}const r=t.source.codePointAt(t.cursor);if(34===r||39===r||40===r||isNonPrintableCodePoint(r??-1)){consumeBadURL(n,t);const o=[c.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],o)),o}if(92===r){if(checkIfTwoCodePointsAreAValidEscape(t)){t.advanceCodePoint(),o+=String.fromCodePoint(consumeEscapedCodePoint(n,t));continue}consumeBadURL(n,t);const r=[c.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===t.source.codePointAt(t.cursor)||isSurrogate(t.source.codePointAt(t.cursor)??-1)?(o+=String.fromCodePoint(s),t.advanceCodePoint()):(o+=t.source[t.cursor],t.advanceCodePoint())}}function consumeIdentLikeToken(e,n){const t=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return[c.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t)}];if(checkIfCodePointsMatchURLIdent(t)){n.advanceCodePoint();let o=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){o+=1,n.advanceCodePoint(1);continue}const i=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===i||39===i)return o>0&&n.unreadCodePoint(o),[c.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[c.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return!(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==i||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const t=[],r=[];let i;for(;void 0!==(i=n.source.codePointAt(n.cursor))&&t.length<6&&isHexDigitCodePoint(i);)t.push(i),n.advanceCodePoint();for(;void 0!==(i=n.source.codePointAt(n.cursor))&&t.length<6&&63===i;)0===r.length&&r.push(...t),t.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===o&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(i=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(i);)r.push(i),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...t),16);return[c.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const s=parseInt(String.fromCodePoint(...t),16),a=parseInt(String.fromCodePoint(...r),16);return[c.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:s,endOfRange:a}]}function tokenize(e,n){const t=tokenizer(e,n),o=[];for(;!t.endOfFile();)o.push(t.nextToken());return o.push(t.nextToken()),o}function tokenizer(n,s){const a=n.css.valueOf(),u=n.unicodeRangesAllowed??!1,d=new Reader(a),p={onParseError:s?.onParseError??noop};return{nextToken:function nextToken(){d.resetRepresentation();const n=d.source.codePointAt(d.cursor);if(void 0===n)return[c.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(d))return consumeComment(p,d);if(u&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(d))return consumeUnicodeRangeToken(0,d);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(p,d);if(isDigitCodePoint(n))return consumeNumericToken(p,d);switch(n){case 44:return d.advanceCodePoint(),[c.Comma,",",d.representationStart,d.representationEnd,void 0];case 58:return d.advanceCodePoint(),[c.Colon,":",d.representationStart,d.representationEnd,void 0];case 59:return d.advanceCodePoint(),[c.Semicolon,";",d.representationStart,d.representationEnd,void 0];case 40:return d.advanceCodePoint(),[c.OpenParen,"(",d.representationStart,d.representationEnd,void 0];case 41:return d.advanceCodePoint(),[c.CloseParen,")",d.representationStart,d.representationEnd,void 0];case 91:return d.advanceCodePoint(),[c.OpenSquare,"[",d.representationStart,d.representationEnd,void 0];case 93:return d.advanceCodePoint(),[c.CloseSquare,"]",d.representationStart,d.representationEnd,void 0];case 123:return d.advanceCodePoint(),[c.OpenCurly,"{",d.representationStart,d.representationEnd,void 0];case 125:return d.advanceCodePoint(),[c.CloseCurly,"}",d.representationStart,d.representationEnd,void 0];case 39:case 34:return consumeStringToken(p,d);case 35:return consumeHashToken(p,d);case i:case 46:return checkIfThreeCodePointsWouldStartANumber(d)?consumeNumericToken(p,d):(d.advanceCodePoint(),[c.Delim,d.source[d.representationStart],d.representationStart,d.representationEnd,{value:d.source[d.representationStart]}]);case r:case t:case 12:case 9:case 32:return consumeWhiteSpace(d);case o:return checkIfThreeCodePointsWouldStartANumber(d)?consumeNumericToken(p,d):checkIfThreeCodePointsWouldStartCDC(d)?(d.advanceCodePoint(3),[c.CDC,"--\x3e",d.representationStart,d.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,d)?consumeIdentLikeToken(p,d):(d.advanceCodePoint(),[c.Delim,"-",d.representationStart,d.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(d)?(d.advanceCodePoint(4),[c.CDO,"\x3c!--",d.representationStart,d.representationEnd,void 0]):(d.advanceCodePoint(),[c.Delim,"<",d.representationStart,d.representationEnd,{value:"<"}]);case 64:if(d.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,d)){const e=consumeIdentSequence(p,d);return[c.AtKeyword,d.source.slice(d.representationStart,d.representationEnd+1),d.representationStart,d.representationEnd,{value:String.fromCodePoint(...e)}]}return[c.Delim,"@",d.representationStart,d.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(d))return consumeIdentLikeToken(p,d);d.advanceCodePoint();const n=[c.Delim,"\\",d.representationStart,d.representationEnd,{value:"\\"}];return p.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,d.representationStart,d.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return d.advanceCodePoint(),[c.Delim,d.source[d.representationStart],d.representationStart,d.representationEnd,{value:d.source[d.representationStart]}]},endOfFile:function endOfFile(){return void 0===d.source.codePointAt(d.cursor)}}}function noop(){}function mutateIdent(e,n){const t=[];for(const e of n)t.push(e.codePointAt(0));const o=String.fromCodePoint(...serializeIdent(t));e[1]=o,e[4].value=n}function mutateUnit(e,n){const t=[];for(const e of n)t.push(e.codePointAt(0));const o=serializeIdent(t);101===o[0]&&insertEscapedCodePoint(o,0,o[0]);const r=String.fromCodePoint(...o),i="+"===e[4].signCharacter?e[4].signCharacter:"",s=e[4].value.toString();e[1]=`${i}${s}${r}`,e[4].unit=n}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,s),n=1;else if(e[0]===o&&e[1]===o)n=2;else if(e[0]===o&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else{if(e[0]===o&&!e[1])return[92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]))}for(let t=n;t<e.length;t++)0!==e[t]?isIdentCodePoint(e[t])||(t+=insertEscapedCharacter(e,t,e[t])):(e.splice(t,1,s),t++);return e}function insertEscapedCharacter(e,n,t){return e.splice(n,1,92,t),1}function insertEscapedCodePoint(e,n,t){const o=t.toString(16),r=[];for(const e of o)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(c);function isToken(e){return!!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))}function isTokenNumeric(e){if(!e)return!1;switch(e[0]){case c.Dimension:case c.Number:case c.Percentage:return!0;default:return!1}}function isTokenWhiteSpaceOrComment(e){if(!e)return!1;switch(e[0]){case c.Whitespace:case c.Comment:return!0;default:return!1}}function isTokenAtKeyword(e){return!!e&&e[0]===c.AtKeyword}function isTokenBadString(e){return!!e&&e[0]===c.BadString}function isTokenBadURL(e){return!!e&&e[0]===c.BadURL}function isTokenCDC(e){return!!e&&e[0]===c.CDC}function isTokenCDO(e){return!!e&&e[0]===c.CDO}function isTokenColon(e){return!!e&&e[0]===c.Colon}function isTokenComma(e){return!!e&&e[0]===c.Comma}function isTokenComment(e){return!!e&&e[0]===c.Comment}function isTokenDelim(e){return!!e&&e[0]===c.Delim}function isTokenDimension(e){return!!e&&e[0]===c.Dimension}function isTokenEOF(e){return!!e&&e[0]===c.EOF}function isTokenFunction(e){return!!e&&e[0]===c.Function}function isTokenHash(e){return!!e&&e[0]===c.Hash}function isTokenIdent(e){return!!e&&e[0]===c.Ident}function isTokenNumber(e){return!!e&&e[0]===c.Number}function isTokenPercentage(e){return!!e&&e[0]===c.Percentage}function isTokenSemicolon(e){return!!e&&e[0]===c.Semicolon}function isTokenString(e){return!!e&&e[0]===c.String}function isTokenURL(e){return!!e&&e[0]===c.URL}function isTokenWhitespace(e){return!!e&&e[0]===c.Whitespace}function isTokenOpenParen(e){return!!e&&e[0]===c.OpenParen}function isTokenCloseParen(e){return!!e&&e[0]===c.CloseParen}function isTokenOpenSquare(e){return!!e&&e[0]===c.OpenSquare}function isTokenCloseSquare(e){return!!e&&e[0]===c.CloseSquare}function isTokenOpenCurly(e){return!!e&&e[0]===c.OpenCurly}function isTokenCloseCurly(e){return!!e&&e[0]===c.CloseCurly}function isTokenUnicodeRange(e){return!!e&&e[0]===c.UnicodeRange}export{u as HashType,a as NumberType,ParseError,e as ParseErrorMessage,ParseErrorWithToken,c as TokenType,cloneTokens,isToken,isTokenAtKeyword,isTokenBadString,isTokenBadURL,isTokenCDC,isTokenCDO,isTokenCloseCurly,isTokenCloseParen,isTokenCloseSquare,isTokenColon,isTokenComma,isTokenComment,isTokenDelim,isTokenDimension,isTokenEOF,isTokenFunction,isTokenHash,isTokenIdent,isTokenNumber,isTokenNumeric,isTokenOpenCurly,isTokenOpenParen,isTokenOpenSquare,isTokenPercentage,isTokenSemicolon,isTokenString,isTokenURL,isTokenUnicodeRange,isTokenWhiteSpaceOrComment,isTokenWhitespace,mirrorVariant,mirrorVariantType,mutateIdent,mutateUnit,stringify,tokenize,tokenizer};
node_modules/@csstools/css-tokenizer/package.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@csstools/css-tokenizer",
3
+ "description": "Tokenize CSS",
4
+ "version": "4.0.0",
5
+ "contributors": [
6
+ {
7
+ "name": "Antonio Laguna",
8
+ "email": "antonio@laguna.es",
9
+ "url": "https://antonio.laguna.es"
10
+ },
11
+ {
12
+ "name": "Romain Menke",
13
+ "email": "romainmenke@gmail.com"
14
+ }
15
+ ],
16
+ "license": "MIT",
17
+ "funding": [
18
+ {
19
+ "type": "github",
20
+ "url": "https://github.com/sponsors/csstools"
21
+ },
22
+ {
23
+ "type": "opencollective",
24
+ "url": "https://opencollective.com/csstools"
25
+ }
26
+ ],
27
+ "engines": {
28
+ "node": ">=20.19.0"
29
+ },
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.mjs"
35
+ }
36
+ },
37
+ "files": [
38
+ "CHANGELOG.md",
39
+ "LICENSE.md",
40
+ "README.md",
41
+ "dist"
42
+ ],
43
+ "scripts": {},
44
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer#readme",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
48
+ "directory": "packages/css-tokenizer"
49
+ },
50
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
51
+ "keywords": [
52
+ "css",
53
+ "tokenizer"
54
+ ]
55
+ }
node_modules/@esbuild/win32-x64/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # esbuild
2
+
3
+ This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
node_modules/@esbuild/win32-x64/esbuild.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cae1bbc86f4df800b01d99e28aea0a154b02243de6797e98f48a9b88a64a7be0
3
+ size 10617344
node_modules/@esbuild/win32-x64/package.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@esbuild/win32-x64",
3
+ "version": "0.25.12",
4
+ "description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/evanw/esbuild.git"
8
+ },
9
+ "license": "MIT",
10
+ "preferUnplugged": true,
11
+ "engines": {
12
+ "node": ">=18"
13
+ },
14
+ "os": [
15
+ "win32"
16
+ ],
17
+ "cpu": [
18
+ "x64"
19
+ ]
20
+ }
node_modules/@exodus/bytes/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 Exodus Movement
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
node_modules/@exodus/bytes/README.md ADDED
@@ -0,0 +1,818 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @exodus/bytes
2
+
3
+ [![](https://img.shields.io/npm/v/@exodus/bytes?style=flat-square)](https://npmjs.org/package/@exodus/bytes)
4
+ [![](https://img.shields.io/github/release/ExodusOSS/bytes?style=flat-square&logo=github)](https://github.com/ExodusOSS/bytes/releases)
5
+ [![](https://img.shields.io/npm/dm/@exodus/bytes?style=flat-square)](https://www.npmcharts.com/compare/@exodus/bytes?minimal=true)
6
+ [![](https://img.shields.io/npm/l/@exodus/bytes?style=flat-square&color=blue)](https://github.com/ExodusOSS/bytes/blob/HEAD/LICENSE)
7
+ [![](https://img.shields.io/github/check-runs/ExodusOSS/bytes/main?style=flat-square&logo=github)](https://github.com/ExodusOSS/bytes/actions/workflows/test.yml?query=branch%3Amain)
8
+ [![](https://img.shields.io/badge/Documentation-3178c6?style=flat-square&logo=TypeScript&logoColor=fff)](https://exodusoss.github.io/bytes/)
9
+
10
+ `Uint8Array` conversion to and from `base64`, `base32`, `base58`, `hex`, `utf8`, `utf16`, `bech32` and `wif`
11
+
12
+ And a [`TextEncoder` / `TextDecoder` polyfill](#textencoder--textdecoder-polyfill)
13
+
14
+ See [documentation](https://exodusoss.github.io/bytes/).
15
+
16
+ ## Strict
17
+
18
+ Performs proper input validation, ensures no garbage-in-garbage-out
19
+
20
+ Tested in CI with [@exodus/test](https://github.com/ExodusMovement/test#exodustest) on:
21
+
22
+ [![Node.js](https://img.shields.io/badge/Node.js-338750?style=for-the-badge&logo=Node.js&logoColor=FFF)](https://nodejs.org/api/test.html)
23
+ [![Deno](https://img.shields.io/badge/Deno-121417?style=for-the-badge&logo=Deno&logoColor=FFF)](https://deno.com/)
24
+ [![Bun](https://img.shields.io/badge/Bun-F472B6?style=for-the-badge&logo=Bun&logoColor=FFF)](https://bun.sh/)
25
+ [![Electron](https://img.shields.io/badge/Electron-2F3242?style=for-the-badge&logo=Electron&logoColor=A2ECFB)](http://electronjs.org/)
26
+ [![workerd](https://img.shields.io/badge/workerd-F38020?style=for-the-badge&logo=cloudflareworkers&logoColor=FFF)](https://github.com/cloudflare/workerd)\
27
+ [![Chrome](https://img.shields.io/badge/Chrome-4285F4?style=for-the-badge&logo=GoogleChrome&logoColor=FFF)](https://www.chromium.org/Home/)
28
+ [![WebKit](https://img.shields.io/badge/WebKit-006CFF?style=for-the-badge&logo=Safari&logoColor=FFF)](http://webkit.org/)
29
+ [![Firefox](https://img.shields.io/badge/Firefox-FF7139?style=for-the-badge&logo=Firefox&logoColor=FFF)](https://github.com/mozilla-firefox)
30
+ [![Servo](https://img.shields.io/badge/Servo-009D9A?style=for-the-badge)](https://servo.org/)\
31
+ [![Hermes](https://img.shields.io/badge/Hermes-282C34?style=for-the-badge&logo=React)](https://hermesengine.dev)
32
+ [![V8](https://img.shields.io/badge/V8-4285F4?style=for-the-badge&logo=V8&logoColor=white)](https://v8.dev/docs/d8)
33
+ [![JavaScriptCore](https://img.shields.io/badge/JavaScriptCore-006CFF?style=for-the-badge)](https://docs.webkit.org/Deep%20Dive/JSC/JavaScriptCore.html)
34
+ [![SpiderMonkey](https://img.shields.io/badge/SpiderMonkey-FFD681?style=for-the-badge)](https://spidermonkey.dev/)\
35
+ [![QuickJS](https://img.shields.io/badge/QuickJS-E58200?style=for-the-badge)](https://github.com/quickjs-ng/quickjs)
36
+ [![XS](https://img.shields.io/badge/XS-0B307A?style=for-the-badge)](https://github.com/Moddable-OpenSource/moddable)
37
+ [![GraalJS](https://img.shields.io/badge/GraalJS-C74634?style=for-the-badge)](https://github.com/oracle/graaljs)
38
+
39
+ ## Fast
40
+
41
+ * `10-20x` faster than `Buffer` polyfill
42
+ * `2-10x` faster than `iconv-lite`
43
+
44
+ The above was for the js fallback
45
+
46
+ It's up to `100x` when native impl is available \
47
+ e.g. in `utf8fromString` on Hermes / React Native or `fromHex` in Chrome
48
+
49
+ Also:
50
+ * `3-8x` faster than `bs58`
51
+ * `10-30x` faster than `@scure/base` (or `>100x` on Node.js <25)
52
+ * Faster in `utf8toString` / `utf8fromString` than `Buffer` or `TextDecoder` / `TextEncoder` on Node.js
53
+
54
+ See [Performance](./Performance.md) for more info
55
+
56
+ ## TextEncoder / TextDecoder polyfill
57
+
58
+ ```js
59
+ import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding.js'
60
+ import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding.js' // Requires Streams
61
+ ```
62
+
63
+ Less than half the bundle size of [text-encoding](https://npmjs.com/text-encoding), [whatwg-encoding](https://npmjs.com/whatwg-encoding) or [iconv-lite](https://npmjs.com/iconv-lite) (gzipped or not).\
64
+ Also [much faster](#fast) than all of those.
65
+
66
+ > [!TIP]
67
+ > See also the [lite version](#lite-version) to get this down to 8 KiB gzipped.
68
+
69
+ Spec compliant, passing WPT and covered with extra tests.\
70
+ Moreover, tests for this library uncovered [bugs in all major implementations](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit).\
71
+ Including all three major browser engines being wrong at UTF-8.\
72
+ See [WPT pull request](https://github.com/web-platform-tests/wpt/pull/56892).
73
+
74
+ It works correctly even in environments that have native implementations broken (that's all of them currently).\
75
+ Runs (and passes WPT) on Node.js built without ICU.
76
+
77
+ > [!NOTE]
78
+ > [Faster than Node.js native implementation on Node.js](https://github.com/nodejs/node/issues/61041#issuecomment-3649242024).
79
+ >
80
+ > The JS multi-byte version is as fast as native impl in Node.js and browsers, but (unlike them) returns correct results.
81
+ >
82
+ > For encodings where native version is known to be fast and correct, it is automatically used.\
83
+ > Some single-byte encodings are faster than native in all three major browser engines.
84
+
85
+ See [analysis table](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit) for more info.
86
+
87
+ ### Caveat: `TextDecoder` / `TextEncoder` APIs are lossy by default per spec
88
+
89
+ _These are only provided as a compatibility layer, prefer hardened APIs instead in new code._
90
+
91
+ * `TextDecoder` can (and should) be used with `{ fatal: true }` option for all purposes demanding correctness / lossless transforms
92
+
93
+ * `TextEncoder` does not support a fatal mode per spec, it always performs replacement.
94
+
95
+ That is not suitable for hashing, cryptography or consensus applications.\
96
+ Otherwise there would be non-equal strings with equal signatures and hashes — the collision is caused by the lossy transform of a JS string to bytes.
97
+ Those also survive e.g. `JSON.stringify`/`JSON.parse` or being sent over network.
98
+
99
+ Use strict APIs in new applications, see `utf8fromString` / `utf16fromString` below.\
100
+ Those throw on non-well-formed strings by default.
101
+
102
+ ### Lite version
103
+
104
+ Alternate exports exist that can help reduce bundle size, see comparison:
105
+
106
+ | import | size |
107
+ | - | - |
108
+ | [@exodus/bytes/encoding-browser.js](#exodusbytesencoding-browserjs-) | <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square)</sub> |
109
+ | [@exodus/bytes/encoding-lite.js](#exodusbytesencoding-litejs-) | <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square)</sub> |
110
+ | [@exodus/bytes/encoding.js](#exodusbytesencodingjs-) | <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square)</sub> |
111
+ | `text-encoding` | <sub>![](https://img.shields.io/bundlejs/size/text-encoding?style=flat-square)</sub> |
112
+ | `iconv-lite` | <sub>![](https://img.shields.io/bundlejs/size/iconv-lite/lib/index.js?style=flat-square)</sub> |
113
+ | `whatwg-encoding` | <sub>![](https://img.shields.io/bundlejs/size/whatwg-encoding?style=flat-square)</sub> |
114
+
115
+ Libraries are advised to use single-purpose hardened `@exodus/bytes/utf8.js` / `@exodus/bytes/utf16.js` APIs for Unicode.
116
+
117
+ Applications (including React Native apps) are advised to load either `@exodus/bytes/encoding-lite.js` or `@exodus/bytes/encoding.js`
118
+ (depending on whether legacy multi-byte support is needed) and use that as a global polyfill.
119
+
120
+ #### `@exodus/bytes/encoding-lite.js`
121
+
122
+ If you don't need support for legacy multi-byte encodings.
123
+
124
+ Reduces the bundle size ~12x, while still keeping `utf-8`, `utf-16le`, `utf-16be` and all single-byte encodings specified by the spec.
125
+ The only difference is support for legacy multi-byte encodings.
126
+
127
+ See [the list of encodings](https://encoding.spec.whatwg.org/#names-and-labels).
128
+
129
+ This can be useful for example in React Native global TextDecoder polyfill,
130
+ if you are sure that you don't need legacy multi-byte encodings support.
131
+
132
+ #### `@exodus/bytes/encoding-browser.js`
133
+
134
+ Resolves to a tiny import in browser bundles, preferring native `TextDecoder` / `TextEncoder`.
135
+
136
+ For non-browsers (Node.js, React Native), loads a full implementation.
137
+
138
+ > [!NOTE]
139
+ > This is not the default behavior for `@exodus/bytes/encoding.js` because all major browser implementations have bugs,
140
+ > which `@exodus/bytes/encoding.js` fixes. Only use if you are ok with that.
141
+
142
+ ## API
143
+
144
+ ### @exodus/bytes/utf8.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/utf8.js?style=flat-square)</sub>
145
+
146
+ UTF-8 encoding/decoding
147
+
148
+ ```js
149
+ import { utf8fromString, utf8toString } from '@exodus/bytes/utf8.js'
150
+
151
+ // loose
152
+ import { utf8fromStringLoose, utf8toStringLoose } from '@exodus/bytes/utf8.js'
153
+ ```
154
+
155
+ _These methods by design encode/decode BOM (codepoint `U+FEFF` Byte Order Mark) as-is._\
156
+ _If you need BOM handling or detection, use `@exodus/bytes/encoding.js`_
157
+
158
+ #### `utf8fromString(string, format = 'uint8')`
159
+
160
+ Encode a string to UTF-8 bytes (strict mode)
161
+
162
+ Throws on invalid Unicode (unpaired surrogates)
163
+
164
+ This is similar to the following snippet (but works on all engines):
165
+ ```js
166
+ // Strict encode, requiring Unicode codepoints to be valid
167
+ if (typeof string !== 'string' || !string.isWellFormed()) throw new TypeError()
168
+ return new TextEncoder().encode(string)
169
+ ```
170
+
171
+ #### `utf8fromStringLoose(string, format = 'uint8')`
172
+
173
+ Encode a string to UTF-8 bytes (loose mode)
174
+
175
+ Replaces invalid Unicode (unpaired surrogates) with replacement codepoints `U+FFFD`
176
+ per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification.
177
+
178
+ _Such replacement is a non-injective function, is irreversable and causes collisions.\
179
+ Prefer using strict throwing methods for cryptography applications._
180
+
181
+ This is similar to the following snippet (but works on all engines):
182
+ ```js
183
+ // Loose encode, replacing invalid Unicode codepoints with U+FFFD
184
+ if (typeof string !== 'string') throw new TypeError()
185
+ return new TextEncoder().encode(string)
186
+ ```
187
+
188
+ #### `utf8toString(arr)`
189
+
190
+ Decode UTF-8 bytes to a string (strict mode)
191
+
192
+ Throws on invalid UTF-8 byte sequences
193
+
194
+ This is similar to `new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(arr)`,
195
+ but works on all engines.
196
+
197
+ #### `utf8toStringLoose(arr)`
198
+
199
+ Decode UTF-8 bytes to a string (loose mode)
200
+
201
+ Replaces invalid UTF-8 byte sequences with replacement codepoints `U+FFFD`
202
+ per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification.
203
+
204
+ _Such replacement is a non-injective function, is irreversable and causes collisions.\
205
+ Prefer using strict throwing methods for cryptography applications._
206
+
207
+ This is similar to `new TextDecoder('utf-8', { ignoreBOM: true }).decode(arr)`,
208
+ but works on all engines.
209
+
210
+ ### @exodus/bytes/utf16.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/utf16.js?style=flat-square)</sub>
211
+
212
+ UTF-16 encoding/decoding
213
+
214
+ ```js
215
+ import { utf16fromString, utf16toString } from '@exodus/bytes/utf16.js'
216
+
217
+ // loose
218
+ import { utf16fromStringLoose, utf16toStringLoose } from '@exodus/bytes/utf16.js'
219
+ ```
220
+
221
+ _These methods by design encode/decode BOM (codepoint `U+FEFF` Byte Order Mark) as-is._\
222
+ _If you need BOM handling or detection, use `@exodus/bytes/encoding.js`_
223
+
224
+ #### `utf16fromString(string, format = 'uint16')`
225
+
226
+ Encode a string to UTF-16 bytes (strict mode)
227
+
228
+ Throws on invalid Unicode (unpaired surrogates)
229
+
230
+ #### `utf16fromStringLoose(string, format = 'uint16')`
231
+
232
+ Encode a string to UTF-16 bytes (loose mode)
233
+
234
+ Replaces invalid Unicode (unpaired surrogates) with replacement codepoints `U+FFFD`
235
+ per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification.
236
+
237
+ _Such replacement is a non-injective function, is irreversible and causes collisions.\
238
+ Prefer using strict throwing methods for cryptography applications._
239
+
240
+ #### `utf16toString(arr, format = 'uint16')`
241
+
242
+ Decode UTF-16 bytes to a string (strict mode)
243
+
244
+ Throws on invalid UTF-16 byte sequences
245
+
246
+ Throws on non-even byte length.
247
+
248
+ #### `utf16toStringLoose(arr, format = 'uint16')`
249
+
250
+ Decode UTF-16 bytes to a string (loose mode)
251
+
252
+ Replaces invalid UTF-16 byte sequences with replacement codepoints `U+FFFD`
253
+ per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification.
254
+
255
+ _Such replacement is a non-injective function, is irreversible and causes collisions.\
256
+ Prefer using strict throwing methods for cryptography applications._
257
+
258
+ Throws on non-even byte length.
259
+
260
+ ### @exodus/bytes/bigint.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/bigint.js?style=flat-square)</sub>
261
+
262
+ Convert between BigInt and Uint8Array
263
+
264
+ ```js
265
+ import { fromBigInt, toBigInt } from '@exodus/bytes/bigint.js'
266
+ ```
267
+
268
+ #### `fromBigInt(bigint, { length, format = 'uint8' })`
269
+
270
+ Convert a BigInt to a Uint8Array or Buffer
271
+
272
+ The output bytes are in big-endian format.
273
+
274
+ Throws if the BigInt is negative or cannot fit into the specified length.
275
+
276
+ #### `toBigInt(arr)`
277
+
278
+ Convert a Uint8Array or Buffer to a BigInt
279
+
280
+ The bytes are interpreted as a big-endian unsigned integer.
281
+
282
+ ### @exodus/bytes/hex.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/hex.js?style=flat-square)</sub>
283
+
284
+ Implements Base16 from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648)
285
+ (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)).
286
+
287
+ ```js
288
+ import { fromHex, toHex } from '@exodus/bytes/hex.js'
289
+ ```
290
+
291
+ #### `fromHex(string, format = 'uint8')`
292
+
293
+ Decode a hex string to bytes
294
+
295
+ Unlike `Buffer.from()`, throws on invalid input
296
+
297
+ #### `toHex(arr)`
298
+
299
+ Encode a `Uint8Array` to a lowercase hex string
300
+
301
+ ### @exodus/bytes/base64.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/base64.js?style=flat-square)</sub>
302
+
303
+ Implements base64 and base64url from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648)
304
+ (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)).
305
+
306
+ ```js
307
+ import { fromBase64, toBase64 } from '@exodus/bytes/base64.js'
308
+ import { fromBase64url, toBase64url } from '@exodus/bytes/base64.js'
309
+ import { fromBase64any } from '@exodus/bytes/base64.js'
310
+ ```
311
+
312
+ #### `fromBase64(string, { format = 'uint8', padding = 'both' })`
313
+
314
+ Decode a base64 string to bytes
315
+
316
+ Operates in strict mode for last chunk, does not allow whitespace
317
+
318
+ #### `fromBase64url(string, { format = 'uint8', padding = false })`
319
+
320
+ Decode a base64url string to bytes
321
+
322
+ Operates in strict mode for last chunk, does not allow whitespace
323
+
324
+ #### `fromBase64any(string, { format = 'uint8', padding = 'both' })`
325
+
326
+ Decode either base64 or base64url string to bytes
327
+
328
+ Automatically detects the variant based on characters present
329
+
330
+ #### `toBase64(arr, { padding = true })`
331
+
332
+ Encode a `Uint8Array` to a base64 string (RFC 4648)
333
+
334
+ #### `toBase64url(arr, { padding = false })`
335
+
336
+ Encode a `Uint8Array` to a base64url string (RFC 4648)
337
+
338
+ ### @exodus/bytes/base32.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/base32.js?style=flat-square)</sub>
339
+
340
+ Implements base32 and base32hex from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648)
341
+ (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)).
342
+
343
+ ```js
344
+ import { fromBase32, toBase32 } from '@exodus/bytes/base32.js'
345
+ import { fromBase32hex, toBase32hex } from '@exodus/bytes/base32.js'
346
+ ```
347
+
348
+ #### `fromBase32(string, { format = 'uint8', padding = 'both' })`
349
+
350
+ Decode a base32 string to bytes
351
+
352
+ Operates in strict mode for last chunk, does not allow whitespace
353
+
354
+ #### `fromBase32hex(string, { format = 'uint8', padding = 'both' })`
355
+
356
+ Decode a base32hex string to bytes
357
+
358
+ Operates in strict mode for last chunk, does not allow whitespace
359
+
360
+ #### `fromBase32crockford(string, options)`
361
+
362
+ Decode a Crockford base32 string to bytes
363
+
364
+ Operates in strict mode for last chunk, does not allow whitespace
365
+
366
+ Crockford base32 decoding follows extra mapping per spec: `LIli -> 1, Oo -> 0`
367
+
368
+ #### `toBase32(arr, { padding = false })`
369
+
370
+ Encode a `Uint8Array` to a base32 string (RFC 4648)
371
+
372
+ #### `toBase32hex(arr, { padding = false })`
373
+
374
+ Encode a `Uint8Array` to a base32hex string (RFC 4648)
375
+
376
+ #### `toBase32crockford(arr, options)`
377
+
378
+ Encode a `Uint8Array` to a Crockford base32 string
379
+
380
+ ### @exodus/bytes/bech32.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/bech32.js?style=flat-square)</sub>
381
+
382
+ Implements bech32 and bech32m from
383
+ [BIP-0173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#specification)
384
+ and [BIP-0350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki#specification).
385
+
386
+ ```js
387
+ import { fromBech32, toBech32 } from '@exodus/bytes/bech32.js'
388
+ import { fromBech32m, toBech32m } from '@exodus/bytes/bech32.js'
389
+ import { getPrefix } from '@exodus/bytes/bech32.js'
390
+ ```
391
+
392
+ #### `getPrefix(string, limit = 90)`
393
+
394
+ Extract the prefix from a bech32 or bech32m string without full validation
395
+
396
+ This is a quick check that skips most validation.
397
+
398
+ #### `fromBech32(string, limit = 90)`
399
+
400
+ Decode a bech32 string to bytes
401
+
402
+ #### `toBech32(prefix, bytes, limit = 90)`
403
+
404
+ Encode bytes to a bech32 string
405
+
406
+ #### `fromBech32m(string, limit = 90)`
407
+
408
+ Decode a bech32m string to bytes
409
+
410
+ #### `toBech32m(prefix, bytes, limit = 90)`
411
+
412
+ Encode bytes to a bech32m string
413
+
414
+ ### @exodus/bytes/base58.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/base58.js?style=flat-square)</sub>
415
+
416
+ Implements [base58](https://www.ietf.org/archive/id/draft-msporny-base58-03.txt) encoding.
417
+
418
+ Supports both standard base58 and XRP variant alphabets.
419
+
420
+ ```js
421
+ import { fromBase58, toBase58 } from '@exodus/bytes/base58.js'
422
+ import { fromBase58xrp, toBase58xrp } from '@exodus/bytes/base58.js'
423
+ ```
424
+
425
+ #### `fromBase58(string, format = 'uint8')`
426
+
427
+ Decode a base58 string to bytes
428
+
429
+ Uses the standard Bitcoin base58 alphabet
430
+
431
+ #### `toBase58(arr)`
432
+
433
+ Encode a `Uint8Array` to a base58 string
434
+
435
+ Uses the standard Bitcoin base58 alphabet
436
+
437
+ #### `fromBase58xrp(string, format = 'uint8')`
438
+
439
+ Decode a base58 string to bytes using XRP alphabet
440
+
441
+ Uses the XRP variant base58 alphabet
442
+
443
+ #### `toBase58xrp(arr)`
444
+
445
+ Encode a `Uint8Array` to a base58 string using XRP alphabet
446
+
447
+ Uses the XRP variant base58 alphabet
448
+
449
+ ### @exodus/bytes/base58check.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/base58check.js?style=flat-square)</sub>
450
+
451
+ Implements [base58check](https://en.bitcoin.it/wiki/Base58Check_encoding) encoding.
452
+
453
+ ```js
454
+ import { fromBase58check, toBase58check } from '@exodus/bytes/base58check.js'
455
+ import { fromBase58checkSync, toBase58checkSync } from '@exodus/bytes/base58check.js'
456
+ import { makeBase58check } from '@exodus/bytes/base58check.js'
457
+ ```
458
+
459
+ On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed.
460
+
461
+ #### `async fromBase58check(string, format = 'uint8')`
462
+
463
+ Decode a base58check string to bytes asynchronously
464
+
465
+ Validates the checksum using double SHA-256
466
+
467
+ #### `async toBase58check(arr)`
468
+
469
+ Encode bytes to base58check string asynchronously
470
+
471
+ Uses double SHA-256 for checksum calculation
472
+
473
+ #### `fromBase58checkSync(string, format = 'uint8')`
474
+
475
+ Decode a base58check string to bytes synchronously
476
+
477
+ Validates the checksum using double SHA-256
478
+
479
+ #### `toBase58checkSync(arr)`
480
+
481
+ Encode bytes to base58check string synchronously
482
+
483
+ Uses double SHA-256 for checksum calculation
484
+
485
+ #### `makeBase58check(hashAlgo, hashAlgoSync)`
486
+
487
+ Create a base58check encoder/decoder with custom hash functions
488
+
489
+ ### @exodus/bytes/wif.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/wif.js?style=flat-square)</sub>
490
+
491
+ Wallet Import Format (WIF) encoding and decoding.
492
+
493
+ ```js
494
+ import { fromWifString, toWifString } from '@exodus/bytes/wif.js'
495
+ import { fromWifStringSync, toWifStringSync } from '@exodus/bytes/wif.js'
496
+ ```
497
+
498
+ On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed.
499
+
500
+ #### `async fromWifString(string[, version])`
501
+
502
+ Decode a WIF string to WIF data
503
+
504
+ Returns a promise that resolves to an object with `{ version, privateKey, compressed }`.
505
+
506
+ The optional `version` parameter validates the version byte.
507
+
508
+ Throws if the WIF string is invalid or version doesn't match.
509
+
510
+ #### `fromWifStringSync(string[, version])`
511
+
512
+ Decode a WIF string to WIF data (synchronous)
513
+
514
+ Returns an object with `{ version, privateKey, compressed }`.
515
+
516
+ The optional `version` parameter validates the version byte.
517
+
518
+ Throws if the WIF string is invalid or version doesn't match.
519
+
520
+ #### `async toWifString({ version, privateKey, compressed })`
521
+
522
+ Encode WIF data to a WIF string
523
+
524
+ #### `toWifStringSync({ version, privateKey, compressed })`
525
+
526
+ Encode WIF data to a WIF string (synchronous)
527
+
528
+ ### @exodus/bytes/array.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/array.js?style=flat-square)</sub>
529
+
530
+ TypedArray utils and conversions.
531
+
532
+ ```js
533
+ import { typedCopyBytes, typedView } from '@exodus/bytes/array.js'
534
+ ```
535
+
536
+ #### `typedCopyBytes(arr, format = 'uint8')`
537
+
538
+ Create a copy of TypedArray underlying bytes in the specified format (`'uint8'`, `'buffer'`, or `'arraybuffer'`)
539
+
540
+ This does not copy _values_, but copies the underlying bytes.
541
+ The result is similar to that of `typedView()`, but this function provides a copy, not a view of the same memory.
542
+
543
+ > [!WARNING]
544
+ > Copying underlying bytes from `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`)
545
+ > is platform endianness-dependent.
546
+
547
+ > [!NOTE]
548
+ > Buffer might be pooled.
549
+ > Uint8Array return values are not pooled and match their underlying ArrayBuffer.
550
+
551
+ #### `typedView(arr, format = 'uint8')`
552
+
553
+ Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`)
554
+
555
+ > [!IMPORTANT]
556
+ > Does not copy data, returns a view on the same underlying buffer
557
+
558
+ > [!WARNING]
559
+ > Viewing `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`) as bytes
560
+ > is platform endianness-dependent.
561
+
562
+ ### @exodus/bytes/encoding.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square)</sub>
563
+
564
+ Implements the [Encoding standard](https://encoding.spec.whatwg.org/):
565
+ [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder),
566
+ [TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder),
567
+ [TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream),
568
+ [TextEncoderStream](https://encoding.spec.whatwg.org/#interface-textencoderstream),
569
+ some [hooks](https://encoding.spec.whatwg.org/#specification-hooks).
570
+
571
+ ```js
572
+ import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding.js'
573
+ import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding.js' // Requires Streams
574
+ import { isomorphicDecode, isomorphicEncode } from '@exodus/bytes/encoding.js'
575
+
576
+ // Hooks for standards
577
+ import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding.js'
578
+ ```
579
+
580
+ #### `new TextDecoder(label = 'utf-8', { fatal = false, ignoreBOM = false })`
581
+
582
+ [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder) implementation/polyfill.
583
+
584
+ Decode bytes to strings according to [WHATWG Encoding](https://encoding.spec.whatwg.org) specification.
585
+
586
+ #### `new TextEncoder()`
587
+
588
+ [TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder) implementation/polyfill.
589
+
590
+ Encode strings to UTF-8 bytes according to [WHATWG Encoding](https://encoding.spec.whatwg.org) specification.
591
+
592
+ #### `new TextDecoderStream(label = 'utf-8', { fatal = false, ignoreBOM = false })`
593
+
594
+ [TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream) implementation/polyfill.
595
+
596
+ A [Streams](https://streams.spec.whatwg.org/) wrapper for `TextDecoder`.
597
+
598
+ Requires [Streams](https://streams.spec.whatwg.org/) to be either supported by the platform or
599
+ [polyfilled](https://npmjs.com/package/web-streams-polyfill).
600
+
601
+ #### `new TextEncoderStream()`
602
+
603
+ [TextEncoderStream](https://encoding.spec.whatwg.org/#interface-textencoderstream) implementation/polyfill.
604
+
605
+ A [Streams](https://streams.spec.whatwg.org/) wrapper for `TextEncoder`.
606
+
607
+ Requires [Streams](https://streams.spec.whatwg.org/) to be either supported by the platform or
608
+ [polyfilled](https://npmjs.com/package/web-streams-polyfill).
609
+
610
+ #### `isomorphicDecode(input)`
611
+
612
+ Implements [isomorphic decode](https://infra.spec.whatwg.org/#isomorphic-decode).
613
+
614
+ Given a `TypedArray` or an `ArrayBuffer` instance `input`, creates a string of the same length
615
+ as input byteLength, using bytes from input as codepoints.
616
+
617
+ E.g. for `Uint8Array` input, this is similar to `String.fromCodePoint(...input)`.
618
+
619
+ Wider `TypedArray` inputs, e.g. `Uint16Array`, are interpreted as underlying _bytes_.
620
+
621
+ #### `isomorphicEncode(str)`
622
+
623
+ Implements [isomorphic encode](https://infra.spec.whatwg.org/#isomorphic-encode).
624
+
625
+ Given a string, creates an `Uint8Array` of the same length with the string codepoints as byte values.
626
+
627
+ Accepts only [isomorphic string](https://infra.spec.whatwg.org/#isomorphic-string) input
628
+ and asserts that, throwing on any strings containing codepoints higher than `U+00FF`.
629
+
630
+ #### `labelToName(label)`
631
+
632
+ Implements [get an encoding from a string `label`](https://encoding.spec.whatwg.org/#concept-encoding-get).
633
+
634
+ Convert an encoding [label](https://encoding.spec.whatwg.org/#names-and-labels) to its name,
635
+ as a case-sensitive string.
636
+
637
+ If an encoding with that label does not exist, returns `null`.
638
+
639
+ All encoding names are also valid labels for corresponding encodings.
640
+
641
+ #### `normalizeEncoding(label)`
642
+
643
+ Convert an encoding [label](https://encoding.spec.whatwg.org/#names-and-labels) to its name,
644
+ as an ASCII-lowercased string.
645
+
646
+ If an encoding with that label does not exist, returns `null`.
647
+
648
+ This is the same as [`decoder.encoding` getter](https://encoding.spec.whatwg.org/#dom-textdecoder-encoding),
649
+ except that it:
650
+ 1. Supports [`replacement` encoding](https://encoding.spec.whatwg.org/#replacement) and its
651
+ [labels](https://encoding.spec.whatwg.org/#ref-for-replacement%E2%91%A1)
652
+ 2. Does not throw for invalid labels and instead returns `null`
653
+
654
+ It is identical to:
655
+ ```js
656
+ labelToName(label)?.toLowerCase() ?? null
657
+ ```
658
+
659
+ All encoding names are also valid labels for corresponding encodings.
660
+
661
+ #### `getBOMEncoding(input)`
662
+
663
+ Implements [BOM sniff](https://encoding.spec.whatwg.org/#bom-sniff) legacy hook.
664
+
665
+ Given a `TypedArray` or an `ArrayBuffer` instance `input`, returns either of:
666
+ - `'utf-8'`, if `input` starts with UTF-8 byte order mark.
667
+ - `'utf-16le'`, if `input` starts with UTF-16LE byte order mark.
668
+ - `'utf-16be'`, if `input` starts with UTF-16BE byte order mark.
669
+ - `null` otherwise.
670
+
671
+ #### `legacyHookDecode(input, fallbackEncoding = 'utf-8')`
672
+
673
+ Implements [decode](https://encoding.spec.whatwg.org/#decode) legacy hook.
674
+
675
+ Given a `TypedArray` or an `ArrayBuffer` instance `input` and an optional `fallbackEncoding`
676
+ encoding [label](https://encoding.spec.whatwg.org/#names-and-labels),
677
+ sniffs encoding from BOM with `fallbackEncoding` fallback and then
678
+ decodes the `input` using that encoding, skipping BOM if it was present.
679
+
680
+ Notes:
681
+
682
+ - BOM-sniffed encoding takes precedence over `fallbackEncoding` option per spec.
683
+ Use with care.
684
+ - Always operates in non-fatal [mode](https://encoding.spec.whatwg.org/#textdecoder-error-mode),
685
+ aka replacement. It can convert different byte sequences to equal strings.
686
+
687
+ This method is similar to the following code, except that it doesn't support encoding labels and
688
+ only expects lowercased encoding name:
689
+
690
+ ```js
691
+ new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input)
692
+ ```
693
+
694
+ ### @exodus/bytes/encoding-lite.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square)</sub>
695
+
696
+ The exact same exports as `@exodus/bytes/encoding.js` are also exported as
697
+ `@exodus/bytes/encoding-lite.js`, with the difference that the lite version does not load
698
+ multi-byte `TextDecoder` encodings by default to reduce bundle size ~12x.
699
+
700
+ ```js
701
+ import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-lite.js'
702
+ import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-lite.js' // Requires Streams
703
+ import { isomorphicDecode, isomorphicEncode } from '@exodus/bytes/encoding-lite.js'
704
+
705
+ // Hooks for standards
706
+ import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-lite.js'
707
+ ```
708
+
709
+ The only affected encodings are: `gbk`, `gb18030`, `big5`, `euc-jp`, `iso-2022-jp`, `shift_jis`
710
+ and their [labels](https://encoding.spec.whatwg.org/#names-and-labels) when used with `TextDecoder`.
711
+
712
+ Legacy single-byte encodingds are loaded by default in both cases.
713
+
714
+ `TextEncoder` and hooks for standards (including `labelToName` / `normalizeEncoding`) do not have any behavior
715
+ differences in the lite version and support full range if inputs.
716
+
717
+ To avoid inconsistencies, the exported classes and methods are exactly the same objects.
718
+
719
+ ```console
720
+ > lite = require('@exodus/bytes/encoding-lite.js')
721
+ [Module: null prototype] {
722
+ TextDecoder: [class TextDecoder],
723
+ TextDecoderStream: [class TextDecoderStream],
724
+ TextEncoder: [class TextEncoder],
725
+ TextEncoderStream: [class TextEncoderStream],
726
+ getBOMEncoding: [Function: getBOMEncoding],
727
+ labelToName: [Function: labelToName],
728
+ legacyHookDecode: [Function: legacyHookDecode],
729
+ normalizeEncoding: [Function: normalizeEncoding]
730
+ }
731
+ > new lite.TextDecoder('big5').decode(Uint8Array.of(0x25))
732
+ Uncaught:
733
+ Error: Legacy multi-byte encodings are disabled in /encoding-lite.js, use /encoding.js for full encodings range support
734
+
735
+ > full = require('@exodus/bytes/encoding.js')
736
+ [Module: null prototype] {
737
+ TextDecoder: [class TextDecoder],
738
+ TextDecoderStream: [class TextDecoderStream],
739
+ TextEncoder: [class TextEncoder],
740
+ TextEncoderStream: [class TextEncoderStream],
741
+ getBOMEncoding: [Function: getBOMEncoding],
742
+ labelToName: [Function: labelToName],
743
+ legacyHookDecode: [Function: legacyHookDecode],
744
+ normalizeEncoding: [Function: normalizeEncoding]
745
+ }
746
+ > full.TextDecoder === lite.TextDecoder
747
+ true
748
+ > new full.TextDecoder('big5').decode(Uint8Array.of(0x25))
749
+ '%'
750
+ > new lite.TextDecoder('big5').decode(Uint8Array.of(0x25))
751
+ '%'
752
+ ```
753
+
754
+ ### @exodus/bytes/encoding-browser.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square)</sub>
755
+
756
+ Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the
757
+ browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped).
758
+
759
+ Does not provide `isomorphicDecode` and `isomorphicEncode` exports.
760
+
761
+ ```js
762
+ import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-browser.js'
763
+ import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-browser.js' // Requires Streams
764
+
765
+ // Hooks for standards
766
+ import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-browser.js'
767
+ ```
768
+
769
+ Under non-browser engines (Node.js, React Native, etc.) a full polyfill is used as those platforms
770
+ do not provide sufficiently complete / non-buggy `TextDecoder` APIs.
771
+
772
+ > [!NOTE]
773
+ > Implementations in browsers [have bugs](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit),
774
+ > but they are fixing them and the expected update window is short.\
775
+ > If you want to circumvent browser bugs, use full `@exodus/bytes/encoding.js` import.
776
+
777
+ ### @exodus/bytes/whatwg.js <sub>![](https://img.shields.io/bundlejs/size/@exodus/bytes/whatwg.js?style=flat-square)</sub>
778
+
779
+ WHATWG helpers
780
+
781
+ ```js
782
+ import '@exodus/bytes/encoding.js' // For full legacy multi-byte encodings support
783
+ import { percentEncodeAfterEncoding } from '@exodus/bytes/whatwg.js'
784
+ ```
785
+
786
+ #### `percentEncodeAfterEncoding(encoding, input, percentEncodeSet, spaceAsPlus = false)`
787
+
788
+ Implements [percent-encode after encoding](https://url.spec.whatwg.org/#string-percent-encode-after-encoding)
789
+ per WHATWG URL specification.
790
+
791
+ > [!IMPORTANT]
792
+ > You must import `@exodus/bytes/encoding.js` for this API to accept legacy multi-byte encodings.
793
+
794
+ Encodings `utf16-le`, `utf16-be`, and `replacement` are not accepted.
795
+
796
+ [C0 control percent-encode set](https://url.spec.whatwg.org/#c0-control-percent-encode-set) is
797
+ always percent-encoded.
798
+
799
+ `percentEncodeSet` is an addition to that, and must be a string of unique increasing codepoints
800
+ in range 0x20 - 0x7e, e.g. `' "#<>'`.
801
+
802
+ This method accepts [DOMStrings](https://webidl.spec.whatwg.org/#idl-DOMString) and converts them
803
+ to [USVStrings](https://webidl.spec.whatwg.org/#idl-USVString).
804
+ This is different from e.g. `encodeURI` and `encodeURIComponent` which throw on surrogates:
805
+ ```js
806
+ > percentEncodeAfterEncoding('utf8', '\ud800', ' "#$%&+,/:;<=>?@[\\]^`{|}') // component
807
+ '%EF%BF%BD'
808
+ > encodeURIComponent('\ud800')
809
+ Uncaught URIError: URI malformed
810
+ ```
811
+
812
+ ## Changelog
813
+
814
+ See [GitHub Releases](https://github.com/ExodusOSS/bytes/releases) tab
815
+
816
+ ## License
817
+
818
+ [MIT](./LICENSE)
node_modules/@exodus/bytes/array.d.ts ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TypedArray utils and conversions.
3
+ *
4
+ * ```js
5
+ * import { typedCopyBytes, typedView } from '@exodus/bytes/array.js'
6
+ * ```
7
+ *
8
+ * @module @exodus/bytes/array.js
9
+ */
10
+
11
+ /// <reference types="node" />
12
+
13
+ // >= TypeScript 5.9 made Uint8Array templated with <> and defaulted to ArrayBufferLike
14
+ // which would incorrectly accept SharedArrayBuffer instances.
15
+ // < TypeScript 5.7 doesn't support templates for Uint8Array.
16
+ // So this type is defined as a workaround to evaluate to Uint8Array<ArrayBuffer> on all versions of TypeScript.
17
+
18
+ /**
19
+ * This is `Uint8Array<ArrayBuffer>`
20
+ * (as opposed to `Uint8Array<SharedArrayBuffer>` and `Uint8Array<ArrayBufferLike>`)
21
+ * on TypeScript versions that support that distinction.
22
+ *
23
+ * On TypeScript < 5.7, this is just `Uint8Array`, as it's not a template there.
24
+ */
25
+ export type Uint8ArrayBuffer = ReturnType<typeof Uint8Array.from>;
26
+
27
+ /**
28
+ * This is `Uint16Array<ArrayBuffer>`
29
+ * (as opposed to `Uint16Array<SharedArrayBuffer>` and `Uint16Array<ArrayBufferLike>`)
30
+ * on TypeScript versions that support that distinction.
31
+ *
32
+ * On TypeScript < 5.7, this is just `Uint16Array`, as it's not a template there.
33
+ */
34
+ export type Uint16ArrayBuffer = ReturnType<typeof Uint16Array.from>;
35
+
36
+ /**
37
+ * This is `Uint32Array<ArrayBuffer>`
38
+ * (as opposed to `Uint32Array<SharedArrayBuffer>` and `Uint32Array<ArrayBufferLike>`)
39
+ * on TypeScript versions that support that distinction.
40
+ *
41
+ * On TypeScript < 5.7, this is just `Uint32Array`, as it's not a template there.
42
+ */
43
+ export type Uint32ArrayBuffer = ReturnType<typeof Uint32Array.from>;
44
+
45
+ /**
46
+ * Output format for typed array conversions
47
+ */
48
+ export type OutputFormat = 'uint8' | 'arraybuffer' | 'buffer';
49
+
50
+ /**
51
+ * Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`)
52
+ *
53
+ * > [!IMPORTANT]
54
+ * > Does not copy data, returns a view on the same underlying buffer
55
+ *
56
+ * > [!WARNING]
57
+ * > Viewing `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`) as bytes
58
+ * > is platform endianness-dependent.
59
+ *
60
+ * @param arr - The input TypedArray
61
+ * @param format - The desired output format (`'uint8'` or `'buffer'`)
62
+ * @returns A view on the same underlying buffer
63
+ */
64
+ export function typedView(arr: ArrayBufferView, format: 'uint8'): Uint8Array;
65
+ export function typedView(arr: ArrayBufferView, format: 'buffer'): Buffer;
66
+ export function typedView(arr: ArrayBufferView, format: 'uint8' | 'buffer'): Uint8Array | Buffer;
67
+
68
+ /**
69
+ * Create a copy of TypedArray underlying bytes in the specified format (`'uint8'`, `'buffer'`, or `'arraybuffer'`)
70
+ *
71
+ * This does not copy _values_, but copies the underlying bytes.
72
+ * The result is similar to that of `typedView()`, but this function provides a copy, not a view of the same memory.
73
+ *
74
+ * > [!WARNING]
75
+ * > Copying underlying bytes from `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`)
76
+ * > is platform endianness-dependent.
77
+ *
78
+ * > [!NOTE]
79
+ * > Buffer might be pooled.
80
+ * > Uint8Array return values are not pooled and match their underlying ArrayBuffer.
81
+ *
82
+ * @param arr - The input TypedArray
83
+ * @param format - The desired output format (`'uint8'`, `'buffer'`, or `'arraybuffer'`)
84
+ * @returns A copy of the underlying buffer
85
+ */
86
+ export function typedCopyBytes(arr: ArrayBufferView, format: 'uint8'): Uint8Array;
87
+ export function typedCopyBytes(arr: ArrayBufferView, format: 'arraybuffer'): ArrayBuffer;
88
+ export function typedCopyBytes(arr: ArrayBufferView, format: 'buffer'): Buffer;
89
+ export function typedCopyBytes(arr: ArrayBufferView, format: OutputFormat): Uint8Array | ArrayBuffer | Buffer;
node_modules/@exodus/bytes/array.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { assertTypedArray } from './assert.js'
2
+
3
+ const Buffer = globalThis.Buffer // Buffer is optional
4
+
5
+ export function typedView(arr, format) {
6
+ assertTypedArray(arr)
7
+ switch (format) {
8
+ case 'uint8':
9
+ if (arr.constructor === Uint8Array) return arr // fast path
10
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength)
11
+ case 'buffer':
12
+ if (arr.constructor === Buffer && Buffer.isBuffer(arr)) return arr
13
+ return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength)
14
+ }
15
+
16
+ throw new TypeError('Unexpected format')
17
+ }
18
+
19
+ export function typedCopyBytes(arr, format) {
20
+ assertTypedArray(arr)
21
+ if (!(arr instanceof Uint8Array)) {
22
+ arr = new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength)
23
+ }
24
+
25
+ switch (format) {
26
+ case 'uint8':
27
+ return Uint8Array.from(arr) // never pooled
28
+ case 'buffer':
29
+ return Buffer.from(arr)
30
+ case 'arraybuffer':
31
+ return Uint8Array.from(arr).buffer
32
+ }
33
+
34
+ throw new TypeError('Unexpected format')
35
+ }
node_modules/@exodus/bytes/assert.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export function assertEmptyRest(rest) {
2
+ if (Object.keys(rest).length > 0) throw new TypeError('Unexpected extra options')
3
+ }
4
+
5
+ // eslint-disable-next-line sonarjs/no-nested-template-literals
6
+ const makeMessage = (name, extra) => `Expected${name ? ` ${name} to be` : ''} an Uint8Array${extra}`
7
+
8
+ const TypedArray = Object.getPrototypeOf(Uint8Array)
9
+
10
+ export function assertTypedArray(arr) {
11
+ if (arr && arr instanceof TypedArray) return
12
+ throw new TypeError('Expected a TypedArray instance')
13
+ }
14
+
15
+ export function assertUint8(arr, options) {
16
+ if (!options) {
17
+ // fast path
18
+ if (arr instanceof Uint8Array) return
19
+ throw new TypeError('Expected an Uint8Array')
20
+ }
21
+
22
+ const { name, length, ...rest } = options
23
+ assertEmptyRest(rest)
24
+ if (arr instanceof Uint8Array && (length === undefined || arr.length === length)) return
25
+ throw new TypeError(makeMessage(name, length === undefined ? '' : ` of size ${Number(length)}`))
26
+ }
node_modules/@exodus/bytes/base32.d.ts ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Implements base32 and base32hex from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648)
3
+ * (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)).
4
+ *
5
+ * ```js
6
+ * import { fromBase32, toBase32 } from '@exodus/bytes/base32.js'
7
+ * import { fromBase32hex, toBase32hex } from '@exodus/bytes/base32.js'
8
+ * ```
9
+ *
10
+ * @module @exodus/bytes/base32.js
11
+ */
12
+
13
+ /// <reference types="node" />
14
+
15
+ import type { OutputFormat, Uint8ArrayBuffer } from './array.js';
16
+
17
+ /**
18
+ * Options for base32 encoding
19
+ */
20
+ export interface ToBase32Options {
21
+ /** Whether to include padding characters (default: false) */
22
+ padding?: boolean;
23
+ }
24
+
25
+ /**
26
+ * Padding mode for base32 decoding
27
+ * - `true`: padding is required
28
+ * - `false`: padding is not allowed
29
+ * - `'both'`: padding is optional (default)
30
+ */
31
+ export type PaddingMode = boolean | 'both';
32
+
33
+ /**
34
+ * Options for base32 decoding
35
+ */
36
+ export interface FromBase32Options {
37
+ /** Output format (default: 'uint8') */
38
+ format?: OutputFormat;
39
+ /** Padding mode */
40
+ padding?: PaddingMode;
41
+ }
42
+
43
+ /**
44
+ * Encode a `Uint8Array` to a base32 string (RFC 4648)
45
+ *
46
+ * @param arr - The input bytes
47
+ * @param options - Encoding options
48
+ * @returns The base32 encoded string
49
+ */
50
+ export function toBase32(arr: Uint8Array, options?: ToBase32Options): string;
51
+
52
+ /**
53
+ * Encode a `Uint8Array` to a base32hex string (RFC 4648)
54
+ *
55
+ * @param arr - The input bytes
56
+ * @param options - Encoding options (padding defaults to false)
57
+ * @returns The base32hex encoded string
58
+ */
59
+ export function toBase32hex(arr: Uint8Array, options?: ToBase32Options): string;
60
+
61
+ /**
62
+ * Encode a `Uint8Array` to a Crockford base32 string
63
+ *
64
+ * @param arr - The input bytes
65
+ * @param options - Encoding options (padding defaults to false)
66
+ * @returns The Crockford base32 encoded string
67
+ */
68
+ export function toBase32crockford(arr: Uint8Array, options?: ToBase32Options): string;
69
+
70
+ /**
71
+ * Decode a base32 string to bytes
72
+ *
73
+ * Operates in strict mode for last chunk, does not allow whitespace
74
+ *
75
+ * @param string - The base32 encoded string
76
+ * @param options - Decoding options
77
+ * @returns The decoded bytes
78
+ */
79
+ export function fromBase32(string: string, options?: FromBase32Options & { format?: 'uint8' }): Uint8ArrayBuffer;
80
+ export function fromBase32(string: string, options: FromBase32Options & { format: 'arraybuffer' }): ArrayBuffer;
81
+ export function fromBase32(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer;
82
+ export function fromBase32(string: string, options?: FromBase32Options): Uint8ArrayBuffer | ArrayBuffer | Buffer;
83
+
84
+ /**
85
+ * Decode a base32hex string to bytes
86
+ *
87
+ * Operates in strict mode for last chunk, does not allow whitespace
88
+ *
89
+ * @param string - The base32hex encoded string
90
+ * @param options - Decoding options
91
+ * @returns The decoded bytes
92
+ */
93
+ export function fromBase32hex(string: string, options?: FromBase32Options & { format?: 'uint8' }): Uint8ArrayBuffer;
94
+ export function fromBase32hex(string: string, options: FromBase32Options & { format: 'arraybuffer' }): ArrayBuffer;
95
+ export function fromBase32hex(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer;
96
+ export function fromBase32hex(string: string, options?: FromBase32Options): Uint8ArrayBuffer | ArrayBuffer | Buffer;
97
+
98
+ /**
99
+ * Decode a Crockford base32 string to bytes
100
+ *
101
+ * Operates in strict mode for last chunk, does not allow whitespace
102
+ *
103
+ * Crockford base32 decoding follows extra mapping per spec: `LIli -> 1, Oo -> 0`
104
+ *
105
+ * @param string - The Crockford base32 encoded string
106
+ * @param options - Decoding options
107
+ * @returns The decoded bytes
108
+ */
109
+ export function fromBase32crockford(string: string, options?: FromBase32Options & { format?: 'uint8' }): Uint8ArrayBuffer;
110
+ export function fromBase32crockford(string: string, options: FromBase32Options & { format: 'arraybuffer' }): ArrayBuffer;
111
+ export function fromBase32crockford(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer;
112
+ export function fromBase32crockford(string: string, options?: FromBase32Options): Uint8ArrayBuffer | ArrayBuffer | Buffer;
node_modules/@exodus/bytes/base32.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { assertEmptyRest } from './assert.js'
2
+ import { fromUint8, E_STRING } from './fallback/_utils.js'
3
+ import * as js from './fallback/base32.js'
4
+
5
+ // See https://datatracker.ietf.org/doc/html/rfc4648
6
+
7
+ // 8 chars per 5 bytes
8
+
9
+ function fromBase32common(str, mode, padding, format, rest) {
10
+ if (typeof str !== 'string') throw new TypeError(E_STRING)
11
+ if (rest !== null) assertEmptyRest(rest)
12
+
13
+ if (padding === true) {
14
+ if (str.length % 8 !== 0) throw new SyntaxError(js.E_PADDING)
15
+ } else if (padding === false) {
16
+ if (str.endsWith('=')) throw new SyntaxError('Did not expect padding in base32 input')
17
+ } else if (padding !== 'both') {
18
+ throw new TypeError('Invalid padding option')
19
+ }
20
+
21
+ return fromUint8(js.fromBase32(str, mode), format)
22
+ }
23
+
24
+ // By default, valid padding is accepted but not required
25
+ const fromBase32wrap = (mode) => (str, options) => {
26
+ if (!options) return fromBase32common(str, mode, 'both', 'uint8', null)
27
+ const { format = 'uint8', padding = 'both', ...rest } = options
28
+ return fromBase32common(str, mode, padding, format, rest)
29
+ }
30
+
31
+ export const fromBase32 = fromBase32wrap(0)
32
+ export const fromBase32hex = fromBase32wrap(1)
33
+ export const fromBase32crockford = fromBase32wrap(2)
34
+
35
+ export const toBase32 = (arr, { padding = false } = {}) => js.toBase32(arr, 0, padding)
36
+ export const toBase32hex = (arr, { padding = false } = {}) => js.toBase32(arr, 1, padding)
37
+ export const toBase32crockford = (arr, { padding = false } = {}) => js.toBase32(arr, 2, padding)
node_modules/@exodus/bytes/base58.d.ts ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Implements [base58](https://www.ietf.org/archive/id/draft-msporny-base58-03.txt) encoding.
3
+ *
4
+ * Supports both standard base58 and XRP variant alphabets.
5
+ *
6
+ * ```js
7
+ * import { fromBase58, toBase58 } from '@exodus/bytes/base58.js'
8
+ * import { fromBase58xrp, toBase58xrp } from '@exodus/bytes/base58.js'
9
+ * ```
10
+ *
11
+ * @module @exodus/bytes/base58.js
12
+ */
13
+
14
+ /// <reference types="node" />
15
+
16
+ import type { OutputFormat, Uint8ArrayBuffer } from './array.js';
17
+
18
+ /**
19
+ * Encode a `Uint8Array` to a base58 string
20
+ *
21
+ * Uses the standard Bitcoin base58 alphabet
22
+ *
23
+ * @param arr - The input bytes
24
+ * @returns The base58 encoded string
25
+ */
26
+ export function toBase58(arr: Uint8Array): string;
27
+
28
+ /**
29
+ * Decode a base58 string to bytes
30
+ *
31
+ * Uses the standard Bitcoin base58 alphabet
32
+ *
33
+ * @param string - The base58 encoded string
34
+ * @param format - Output format (default: 'uint8')
35
+ * @returns The decoded bytes
36
+ */
37
+ export function fromBase58(string: string, format?: 'uint8'): Uint8ArrayBuffer;
38
+ export function fromBase58(string: string, format: 'arraybuffer'): ArrayBuffer;
39
+ export function fromBase58(string: string, format: 'buffer'): Buffer;
40
+ export function fromBase58(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer;
41
+
42
+ /**
43
+ * Encode a `Uint8Array` to a base58 string using XRP alphabet
44
+ *
45
+ * Uses the XRP variant base58 alphabet
46
+ *
47
+ * @param arr - The input bytes
48
+ * @returns The base58 encoded string
49
+ */
50
+ export function toBase58xrp(arr: Uint8Array): string;
51
+
52
+ /**
53
+ * Decode a base58 string to bytes using XRP alphabet
54
+ *
55
+ * Uses the XRP variant base58 alphabet
56
+ *
57
+ * @param string - The base58 encoded string
58
+ * @param format - Output format (default: 'uint8')
59
+ * @returns The decoded bytes
60
+ */
61
+ export function fromBase58xrp(string: string, format?: 'uint8'): Uint8ArrayBuffer;
62
+ export function fromBase58xrp(string: string, format: 'arraybuffer'): ArrayBuffer;
63
+ export function fromBase58xrp(string: string, format: 'buffer'): Buffer;
64
+ export function fromBase58xrp(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer;
node_modules/@exodus/bytes/base58.js ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { assertU8, fromUint8, E_STRING } from './fallback/_utils.js'
2
+ import { nativeDecoder, nativeEncoder, isHermes } from './fallback/platform.js'
3
+ import { encodeAscii, decodeAscii } from './fallback/latin1.js'
4
+
5
+ const alphabet58 = [...'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz']
6
+ const alphabetXRP = [...'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz']
7
+ const codes58 = new Uint8Array(alphabet58.map((x) => x.charCodeAt(0)))
8
+ const codesXRP = new Uint8Array(alphabetXRP.map((x) => x.charCodeAt(0)))
9
+
10
+ const _0n = BigInt(0)
11
+ const _1n = BigInt(1)
12
+ const _8n = BigInt(8)
13
+ const _32n = BigInt(32)
14
+ const _58n = BigInt(58)
15
+ const _0xffffffffn = BigInt(0xff_ff_ff_ff)
16
+
17
+ let table // 15 * 82, diagonal, <1kb
18
+ const fromMaps = new Map()
19
+
20
+ const E_CHAR = 'Invalid character in base58 input'
21
+
22
+ const shouldUseBigIntFrom = isHermes // faster only on Hermes, numbers path beats it on normal engines
23
+
24
+ function toBase58core(arr, alphabet, codes) {
25
+ assertU8(arr)
26
+ const length = arr.length
27
+ if (length === 0) return ''
28
+
29
+ const ZERO = alphabet[0]
30
+ let zeros = 0
31
+ while (zeros < length && arr[zeros] === 0) zeros++
32
+
33
+ if (length > 60) {
34
+ // Slow path. Can be optimized ~10%, but the main factor is /58n division anyway, so doesn't matter much
35
+ let x = _0n
36
+ for (let i = 0; i < arr.length; i++) x = (x << _8n) | BigInt(arr[i])
37
+
38
+ let out = ''
39
+ while (x) {
40
+ const d = x / _58n
41
+ out = alphabet[Number(x - _58n * d)] + out
42
+ x = d
43
+ }
44
+
45
+ return ZERO.repeat(zeros) + out
46
+ }
47
+
48
+ // We run fast mode operations only on short (<=60 bytes) inputs, via precomputation table
49
+ if (!table) {
50
+ table = []
51
+ let x = _1n
52
+ for (let i = 0; i < 15; i++) {
53
+ // Convert x to base 58 digits
54
+ const in58 = []
55
+ let y = x
56
+ while (y) {
57
+ const d = y / _58n
58
+ in58.push(Number(y - _58n * d))
59
+ y = d
60
+ }
61
+
62
+ table.push(new Uint8Array(in58))
63
+ x <<= _32n
64
+ }
65
+ }
66
+
67
+ const res = []
68
+ {
69
+ let j = 0
70
+ // We group each 4 bytes into 32-bit chunks
71
+ // Not using u32arr to not deal with remainder + BE/LE differences
72
+ for (let i = length - 1; i >= 0; i -= 4) {
73
+ let c
74
+ if (i > 2) {
75
+ c = (arr[i] | (arr[i - 1] << 8) | (arr[i - 2] << 16) | (arr[i - 3] << 24)) >>> 0
76
+ } else if (i > 1) {
77
+ c = arr[i] | (arr[i - 1] << 8) | (arr[i - 2] << 16)
78
+ } else {
79
+ c = i === 1 ? arr[i] | (arr[i - 1] << 8) : arr[i]
80
+ }
81
+
82
+ const row = table[j++]
83
+ if (c === 0) continue
84
+ const olen = res.length
85
+ const nlen = row.length
86
+ let k = 0
87
+ for (; k < olen; k++) res[k] += c * row[k]
88
+ while (k < nlen) res.push(c * row[k++])
89
+ }
90
+ }
91
+
92
+ // We can now do a single scan over regular numbers under MAX_SAFE_INTEGER
93
+ // Note: can't use int32 operations on them, as they are outside of 2**32 range
94
+ // This is faster though
95
+ {
96
+ let carry = 0
97
+ let i = 0
98
+ while (i < res.length) {
99
+ const c = res[i] + carry
100
+ carry = Math.floor(c / 58)
101
+ res[i++] = c - carry * 58
102
+ }
103
+
104
+ while (carry) {
105
+ const c = carry
106
+ carry = Math.floor(c / 58)
107
+ res.push(c - carry * 58)
108
+ }
109
+ }
110
+
111
+ if (nativeDecoder) {
112
+ const oa = new Uint8Array(res.length)
113
+ let j = 0
114
+ for (let i = res.length - 1; i >= 0; i--) oa[j++] = codes[res[i]]
115
+ return ZERO.repeat(zeros) + decodeAscii(oa)
116
+ }
117
+
118
+ let out = ''
119
+ for (let i = res.length - 1; i >= 0; i--) out += alphabet[res[i]]
120
+ return ZERO.repeat(zeros) + out
121
+ }
122
+
123
+ function fromBase58core(str, alphabet, codes, format = 'uint8') {
124
+ if (typeof str !== 'string') throw new TypeError(E_STRING)
125
+ const length = str.length
126
+ if (length === 0) return fromUint8(new Uint8Array(), format)
127
+
128
+ const zeroC = codes[0]
129
+ let zeros = 0
130
+ while (zeros < length && str.charCodeAt(zeros) === zeroC) zeros++
131
+
132
+ let fromMap = fromMaps.get(alphabet)
133
+ if (!fromMap) {
134
+ fromMap = new Int8Array(256).fill(-1)
135
+ for (let i = 0; i < 58; i++) fromMap[alphabet[i].charCodeAt(0)] = i
136
+ fromMaps.set(alphabet, fromMap)
137
+ }
138
+
139
+ const size = zeros + (((length - zeros + 1) * 3) >> 2) // 3/4 rounded up, larger than ~0.73 coef to fit everything
140
+ const res = new Uint8Array(size)
141
+ let at = size // where is the first significant byte written
142
+
143
+ if (shouldUseBigIntFrom) {
144
+ let x = _0n
145
+
146
+ // nativeEncoder gives a benefit here
147
+ if (nativeEncoder) {
148
+ const codes = encodeAscii(str, E_CHAR)
149
+ for (let i = zeros; i < length; i++) {
150
+ const c = fromMap[codes[i]]
151
+ if (c < 0) throw new SyntaxError(E_CHAR)
152
+ x = x * _58n + BigInt(c)
153
+ }
154
+ } else {
155
+ for (let i = zeros; i < length; i++) {
156
+ const charCode = str.charCodeAt(i)
157
+ const c = fromMap[charCode]
158
+ if (charCode > 255 || c < 0) throw new SyntaxError(E_CHAR)
159
+ x = x * _58n + BigInt(c)
160
+ }
161
+ }
162
+
163
+ while (x) {
164
+ let y = Number(x & _0xffffffffn)
165
+ x >>= _32n
166
+ res[--at] = y & 0xff
167
+ y >>>= 8
168
+ if (!x && !y) break
169
+ res[--at] = y & 0xff
170
+ y >>>= 8
171
+ if (!x && !y) break
172
+ res[--at] = y & 0xff
173
+ y >>>= 8
174
+ if (!x && !y) break
175
+ res[--at] = y & 0xff
176
+ }
177
+ } else {
178
+ for (let i = zeros; i < length; i++) {
179
+ const charCode = str.charCodeAt(i)
180
+ let c = fromMap[charCode]
181
+ if (charCode > 255 || c < 0) throw new SyntaxError(E_CHAR)
182
+
183
+ let k = size - 1
184
+ for (;;) {
185
+ if (c === 0 && k < at) break
186
+ c += 58 * res[k]
187
+ res[k] = c & 0xff
188
+ c >>>= 8
189
+ k--
190
+ // unroll a bit
191
+ if (c === 0 && k < at) break
192
+ c += 58 * res[k]
193
+ res[k] = c & 0xff
194
+ c >>>= 8
195
+ k--
196
+ if (c === 0 && k < at) break
197
+ c += 58 * res[k]
198
+ res[k] = c & 0xff
199
+ c >>>= 8
200
+ k--
201
+ if (c === 0 && k < at) break
202
+ c += 58 * res[k]
203
+ res[k] = c & 0xff
204
+ c >>>= 8
205
+ k--
206
+ }
207
+
208
+ at = k + 1
209
+ if (c !== 0 || at < zeros) /* c8 ignore next */ throw new Error('Unexpected') // unreachable
210
+ }
211
+ }
212
+
213
+ return fromUint8(res.slice(at - zeros), format)
214
+ }
215
+
216
+ export const toBase58 = (arr) => toBase58core(arr, alphabet58, codes58)
217
+ export const fromBase58 = (str, format) => fromBase58core(str, alphabet58, codes58, format)
218
+ export const toBase58xrp = (arr) => toBase58core(arr, alphabetXRP, codesXRP)
219
+ export const fromBase58xrp = (str, format) => fromBase58core(str, alphabetXRP, codesXRP, format)
node_modules/@exodus/bytes/base58check.d.ts ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Implements [base58check](https://en.bitcoin.it/wiki/Base58Check_encoding) encoding.
3
+ *
4
+ * ```js
5
+ * import { fromBase58check, toBase58check } from '@exodus/bytes/base58check.js'
6
+ * import { fromBase58checkSync, toBase58checkSync } from '@exodus/bytes/base58check.js'
7
+ * import { makeBase58check } from '@exodus/bytes/base58check.js'
8
+ * ```
9
+ *
10
+ * On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed.
11
+ *
12
+ * @module @exodus/bytes/base58check.js
13
+ */
14
+
15
+ /// <reference types="node" />
16
+
17
+ import type { OutputFormat, Uint8ArrayBuffer } from './array.js';
18
+
19
+ /**
20
+ * Hash function type that takes Uint8Array and returns a Promise of Uint8Array
21
+ */
22
+ export type HashFunction = (data: Uint8Array) => Promise<Uint8Array>;
23
+
24
+ /**
25
+ * Synchronous hash function type that takes Uint8Array and returns Uint8Array
26
+ */
27
+ export type HashFunctionSync = (data: Uint8Array) => Uint8Array;
28
+
29
+ /**
30
+ * Base58Check encoder/decoder instance with async methods
31
+ */
32
+ export interface Base58CheckAsync {
33
+ /**
34
+ * Encode bytes to base58check string asynchronously
35
+ *
36
+ * @param arr - The input bytes to encode
37
+ * @returns A Promise that resolves to the base58check encoded string
38
+ */
39
+ encode(arr: Uint8Array): Promise<string>;
40
+
41
+ /**
42
+ * Decode a base58check string to bytes asynchronously
43
+ *
44
+ * @param string - The base58check encoded string
45
+ * @param format - Output format (default: 'uint8')
46
+ * @returns A Promise that resolves to the decoded bytes
47
+ */
48
+ decode(string: string, format?: 'uint8'): Promise<Uint8ArrayBuffer>;
49
+ decode(string: string, format: 'arraybuffer'): Promise<ArrayBuffer>;
50
+ decode(string: string, format: 'buffer'): Promise<Buffer>;
51
+ decode(string: string, format?: OutputFormat): Promise<Uint8ArrayBuffer | ArrayBuffer | Buffer>;
52
+ }
53
+
54
+ /**
55
+ * Base58Check encoder/decoder instance with both async and sync methods
56
+ */
57
+ export interface Base58CheckSync extends Base58CheckAsync {
58
+ /**
59
+ * Encode bytes to base58check string synchronously
60
+ *
61
+ * @param arr - The input bytes to encode
62
+ * @returns The base58check encoded string
63
+ */
64
+ encodeSync(arr: Uint8Array): string;
65
+
66
+ /**
67
+ * Decode a base58check string to bytes synchronously
68
+ *
69
+ * @param string - The base58check encoded string
70
+ * @param format - Output format (default: 'uint8')
71
+ * @returns The decoded bytes
72
+ */
73
+ decodeSync(string: string, format?: 'uint8'): Uint8ArrayBuffer;
74
+ decodeSync(string: string, format: 'arraybuffer'): ArrayBuffer;
75
+ decodeSync(string: string, format: 'buffer'): Buffer;
76
+ decodeSync(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer;
77
+ }
78
+
79
+ /**
80
+ * Create a base58check encoder/decoder with custom hash functions
81
+ *
82
+ * @param hashAlgo - Async hash function (typically double SHA-256)
83
+ * @param hashAlgoSync - Optional sync hash function
84
+ * @returns Base58Check encoder/decoder instance
85
+ */
86
+ export function makeBase58check(hashAlgo: HashFunction | HashFunctionSync, hashAlgoSync: HashFunctionSync): Base58CheckSync;
87
+ export function makeBase58check(hashAlgo: HashFunction | HashFunctionSync, hashAlgoSync?: undefined): Base58CheckAsync;
88
+
89
+ /**
90
+ * Encode bytes to base58check string asynchronously
91
+ *
92
+ * Uses double SHA-256 for checksum calculation
93
+ *
94
+ * @param arr - The input bytes to encode
95
+ * @returns A Promise that resolves to the base58check encoded string
96
+ */
97
+ export function toBase58check(arr: Uint8Array): Promise<string>;
98
+
99
+ /**
100
+ * Decode a base58check string to bytes asynchronously
101
+ *
102
+ * Validates the checksum using double SHA-256
103
+ *
104
+ * @param string - The base58check encoded string
105
+ * @param format - Output format (default: 'uint8')
106
+ * @returns A Promise that resolves to the decoded bytes
107
+ */
108
+ export function fromBase58check(string: string, format?: 'uint8'): Promise<Uint8ArrayBuffer>;
109
+ export function fromBase58check(string: string, format: 'arraybuffer'): Promise<ArrayBuffer>;
110
+ export function fromBase58check(string: string, format: 'buffer'): Promise<Buffer>;
111
+ export function fromBase58check(string: string, format?: OutputFormat): Promise<Uint8ArrayBuffer | ArrayBuffer | Buffer>;
112
+
113
+ /**
114
+ * Encode bytes to base58check string synchronously
115
+ *
116
+ * Uses double SHA-256 for checksum calculation
117
+ *
118
+ * @param arr - The input bytes to encode
119
+ * @returns The base58check encoded string
120
+ */
121
+ export function toBase58checkSync(arr: Uint8Array): string;
122
+
123
+ /**
124
+ * Decode a base58check string to bytes synchronously
125
+ *
126
+ * Validates the checksum using double SHA-256
127
+ *
128
+ * @param string - The base58check encoded string
129
+ * @param format - Output format (default: 'uint8')
130
+ * @returns The decoded bytes
131
+ */
132
+ export function fromBase58checkSync(string: string, format?: 'uint8'): Uint8ArrayBuffer;
133
+ export function fromBase58checkSync(string: string, format: 'arraybuffer'): ArrayBuffer;
134
+ export function fromBase58checkSync(string: string, format: 'buffer'): Buffer;
135
+ export function fromBase58checkSync(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer;