@terrazzo/plugin-sass 0.7.4 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,45 +1,3848 @@
1
+ //#region ../plugin-css/dist/index.js
2
+ const parseNumber$1 = (color, len) => {
3
+ if (typeof color !== "number") return;
4
+ if (len === 3) return {
5
+ mode: "rgb",
6
+ r: (color >> 8 & 15 | color >> 4 & 240) / 255,
7
+ g: (color >> 4 & 15 | color & 240) / 255,
8
+ b: (color & 15 | color << 4 & 240) / 255
9
+ };
10
+ if (len === 4) return {
11
+ mode: "rgb",
12
+ r: (color >> 12 & 15 | color >> 8 & 240) / 255,
13
+ g: (color >> 8 & 15 | color >> 4 & 240) / 255,
14
+ b: (color >> 4 & 15 | color & 240) / 255,
15
+ alpha: (color & 15 | color << 4 & 240) / 255
16
+ };
17
+ if (len === 6) return {
18
+ mode: "rgb",
19
+ r: (color >> 16 & 255) / 255,
20
+ g: (color >> 8 & 255) / 255,
21
+ b: (color & 255) / 255
22
+ };
23
+ if (len === 8) return {
24
+ mode: "rgb",
25
+ r: (color >> 24 & 255) / 255,
26
+ g: (color >> 16 & 255) / 255,
27
+ b: (color >> 8 & 255) / 255,
28
+ alpha: (color & 255) / 255
29
+ };
30
+ };
31
+ var parseNumber_default$1 = parseNumber$1;
32
+ const named$1 = {
33
+ aliceblue: 15792383,
34
+ antiquewhite: 16444375,
35
+ aqua: 65535,
36
+ aquamarine: 8388564,
37
+ azure: 15794175,
38
+ beige: 16119260,
39
+ bisque: 16770244,
40
+ black: 0,
41
+ blanchedalmond: 16772045,
42
+ blue: 255,
43
+ blueviolet: 9055202,
44
+ brown: 10824234,
45
+ burlywood: 14596231,
46
+ cadetblue: 6266528,
47
+ chartreuse: 8388352,
48
+ chocolate: 13789470,
49
+ coral: 16744272,
50
+ cornflowerblue: 6591981,
51
+ cornsilk: 16775388,
52
+ crimson: 14423100,
53
+ cyan: 65535,
54
+ darkblue: 139,
55
+ darkcyan: 35723,
56
+ darkgoldenrod: 12092939,
57
+ darkgray: 11119017,
58
+ darkgreen: 25600,
59
+ darkgrey: 11119017,
60
+ darkkhaki: 12433259,
61
+ darkmagenta: 9109643,
62
+ darkolivegreen: 5597999,
63
+ darkorange: 16747520,
64
+ darkorchid: 10040012,
65
+ darkred: 9109504,
66
+ darksalmon: 15308410,
67
+ darkseagreen: 9419919,
68
+ darkslateblue: 4734347,
69
+ darkslategray: 3100495,
70
+ darkslategrey: 3100495,
71
+ darkturquoise: 52945,
72
+ darkviolet: 9699539,
73
+ deeppink: 16716947,
74
+ deepskyblue: 49151,
75
+ dimgray: 6908265,
76
+ dimgrey: 6908265,
77
+ dodgerblue: 2003199,
78
+ firebrick: 11674146,
79
+ floralwhite: 16775920,
80
+ forestgreen: 2263842,
81
+ fuchsia: 16711935,
82
+ gainsboro: 14474460,
83
+ ghostwhite: 16316671,
84
+ gold: 16766720,
85
+ goldenrod: 14329120,
86
+ gray: 8421504,
87
+ green: 32768,
88
+ greenyellow: 11403055,
89
+ grey: 8421504,
90
+ honeydew: 15794160,
91
+ hotpink: 16738740,
92
+ indianred: 13458524,
93
+ indigo: 4915330,
94
+ ivory: 16777200,
95
+ khaki: 15787660,
96
+ lavender: 15132410,
97
+ lavenderblush: 16773365,
98
+ lawngreen: 8190976,
99
+ lemonchiffon: 16775885,
100
+ lightblue: 11393254,
101
+ lightcoral: 15761536,
102
+ lightcyan: 14745599,
103
+ lightgoldenrodyellow: 16448210,
104
+ lightgray: 13882323,
105
+ lightgreen: 9498256,
106
+ lightgrey: 13882323,
107
+ lightpink: 16758465,
108
+ lightsalmon: 16752762,
109
+ lightseagreen: 2142890,
110
+ lightskyblue: 8900346,
111
+ lightslategray: 7833753,
112
+ lightslategrey: 7833753,
113
+ lightsteelblue: 11584734,
114
+ lightyellow: 16777184,
115
+ lime: 65280,
116
+ limegreen: 3329330,
117
+ linen: 16445670,
118
+ magenta: 16711935,
119
+ maroon: 8388608,
120
+ mediumaquamarine: 6737322,
121
+ mediumblue: 205,
122
+ mediumorchid: 12211667,
123
+ mediumpurple: 9662683,
124
+ mediumseagreen: 3978097,
125
+ mediumslateblue: 8087790,
126
+ mediumspringgreen: 64154,
127
+ mediumturquoise: 4772300,
128
+ mediumvioletred: 13047173,
129
+ midnightblue: 1644912,
130
+ mintcream: 16121850,
131
+ mistyrose: 16770273,
132
+ moccasin: 16770229,
133
+ navajowhite: 16768685,
134
+ navy: 128,
135
+ oldlace: 16643558,
136
+ olive: 8421376,
137
+ olivedrab: 7048739,
138
+ orange: 16753920,
139
+ orangered: 16729344,
140
+ orchid: 14315734,
141
+ palegoldenrod: 15657130,
142
+ palegreen: 10025880,
143
+ paleturquoise: 11529966,
144
+ palevioletred: 14381203,
145
+ papayawhip: 16773077,
146
+ peachpuff: 16767673,
147
+ peru: 13468991,
148
+ pink: 16761035,
149
+ plum: 14524637,
150
+ powderblue: 11591910,
151
+ purple: 8388736,
152
+ rebeccapurple: 6697881,
153
+ red: 16711680,
154
+ rosybrown: 12357519,
155
+ royalblue: 4286945,
156
+ saddlebrown: 9127187,
157
+ salmon: 16416882,
158
+ sandybrown: 16032864,
159
+ seagreen: 3050327,
160
+ seashell: 16774638,
161
+ sienna: 10506797,
162
+ silver: 12632256,
163
+ skyblue: 8900331,
164
+ slateblue: 6970061,
165
+ slategray: 7372944,
166
+ slategrey: 7372944,
167
+ snow: 16775930,
168
+ springgreen: 65407,
169
+ steelblue: 4620980,
170
+ tan: 13808780,
171
+ teal: 32896,
172
+ thistle: 14204888,
173
+ tomato: 16737095,
174
+ turquoise: 4251856,
175
+ violet: 15631086,
176
+ wheat: 16113331,
177
+ white: 16777215,
178
+ whitesmoke: 16119285,
179
+ yellow: 16776960,
180
+ yellowgreen: 10145074
181
+ };
182
+ var named_default$1 = named$1;
183
+ const parseNamed$1 = (color) => {
184
+ return parseNumber_default$1(named_default$1[color.toLowerCase()], 6);
185
+ };
186
+ var parseNamed_default$1 = parseNamed$1;
187
+ const hex$1 = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i;
188
+ const parseHex$1 = (color) => {
189
+ let match;
190
+ return (match = color.match(hex$1)) ? parseNumber_default$1(parseInt(match[1], 16), match[1].length) : void 0;
191
+ };
192
+ var parseHex_default$1 = parseHex$1;
193
+ const num$1$1 = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)";
194
+ const num_none$1 = `(?:${num$1$1}|none)`;
195
+ const per$1 = `${num$1$1}%`;
196
+ const per_none$1 = `(?:${num$1$1}%|none)`;
197
+ const num_per$1 = `(?:${num$1$1}%|${num$1$1})`;
198
+ const num_per_none$1 = `(?:${num$1$1}%|${num$1$1}|none)`;
199
+ const hue$1$1 = `(?:${num$1$1}(deg|grad|rad|turn)|${num$1$1})`;
200
+ const hue_none$1 = `(?:${num$1$1}(deg|grad|rad|turn)|${num$1$1}|none)`;
201
+ const c$1 = `\\s*,\\s*`;
202
+ const rx_num_per_none$1 = new RegExp("^" + num_per_none$1 + "$");
203
+ const rgb_num_old$1 = new RegExp(`^rgba?\\(\\s*${num$1$1}${c$1}${num$1$1}${c$1}${num$1$1}\\s*(?:,\\s*${num_per$1}\\s*)?\\)$`);
204
+ const rgb_per_old$1 = new RegExp(`^rgba?\\(\\s*${per$1}${c$1}${per$1}${c$1}${per$1}\\s*(?:,\\s*${num_per$1}\\s*)?\\)$`);
205
+ const parseRgbLegacy$1 = (color) => {
206
+ let res = { mode: "rgb" };
207
+ let match;
208
+ if (match = color.match(rgb_num_old$1)) {
209
+ if (match[1] !== void 0) res.r = match[1] / 255;
210
+ if (match[2] !== void 0) res.g = match[2] / 255;
211
+ if (match[3] !== void 0) res.b = match[3] / 255;
212
+ } else if (match = color.match(rgb_per_old$1)) {
213
+ if (match[1] !== void 0) res.r = match[1] / 100;
214
+ if (match[2] !== void 0) res.g = match[2] / 100;
215
+ if (match[3] !== void 0) res.b = match[3] / 100;
216
+ } else return void 0;
217
+ if (match[4] !== void 0) res.alpha = Math.max(0, Math.min(1, match[4] / 100));
218
+ else if (match[5] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[5]));
219
+ return res;
220
+ };
221
+ var parseRgbLegacy_default$1 = parseRgbLegacy$1;
222
+ const prepare$1 = (color, mode) => color === void 0 ? void 0 : typeof color !== "object" ? parse_default$1(color) : color.mode !== void 0 ? color : mode ? {
223
+ ...color,
224
+ mode
225
+ } : void 0;
226
+ var _prepare_default$1 = prepare$1;
227
+ const converter$1 = (target_mode = "rgb") => (color) => (color = _prepare_default$1(color, target_mode)) !== void 0 ? color.mode === target_mode ? color : converters$1$1[color.mode][target_mode] ? converters$1$1[color.mode][target_mode](color) : target_mode === "rgb" ? converters$1$1[color.mode].rgb(color) : converters$1$1.rgb[target_mode](converters$1$1[color.mode].rgb(color)) : void 0;
228
+ var converter_default$1 = converter$1;
229
+ const converters$1$1 = {};
230
+ const modes$1 = {};
231
+ const parsers$1 = [];
232
+ const colorProfiles$1 = {};
233
+ const identity$1 = (v) => v;
234
+ const useMode$1 = (definition$15$1) => {
235
+ converters$1$1[definition$15$1.mode] = {
236
+ ...converters$1$1[definition$15$1.mode],
237
+ ...definition$15$1.toMode
238
+ };
239
+ Object.keys(definition$15$1.fromMode || {}).forEach((k$2$1) => {
240
+ if (!converters$1$1[k$2$1]) converters$1$1[k$2$1] = {};
241
+ converters$1$1[k$2$1][definition$15$1.mode] = definition$15$1.fromMode[k$2$1];
242
+ });
243
+ if (!definition$15$1.ranges) definition$15$1.ranges = {};
244
+ if (!definition$15$1.difference) definition$15$1.difference = {};
245
+ definition$15$1.channels.forEach((channel) => {
246
+ if (definition$15$1.ranges[channel] === void 0) definition$15$1.ranges[channel] = [0, 1];
247
+ if (!definition$15$1.interpolate[channel]) throw new Error(`Missing interpolator for: ${channel}`);
248
+ if (typeof definition$15$1.interpolate[channel] === "function") definition$15$1.interpolate[channel] = { use: definition$15$1.interpolate[channel] };
249
+ if (!definition$15$1.interpolate[channel].fixup) definition$15$1.interpolate[channel].fixup = identity$1;
250
+ });
251
+ modes$1[definition$15$1.mode] = definition$15$1;
252
+ (definition$15$1.parse || []).forEach((parser) => {
253
+ useParser$1(parser, definition$15$1.mode);
254
+ });
255
+ return converter_default$1(definition$15$1.mode);
256
+ };
257
+ const getMode$1 = (mode) => modes$1[mode];
258
+ const useParser$1 = (parser, mode) => {
259
+ if (typeof parser === "string") {
260
+ if (!mode) throw new Error(`'mode' required when 'parser' is a string`);
261
+ colorProfiles$1[parser] = mode;
262
+ } else if (typeof parser === "function") {
263
+ if (parsers$1.indexOf(parser) < 0) parsers$1.push(parser);
264
+ }
265
+ };
266
+ const IdentStartCodePoint$1 = /[^\x00-\x7F]|[a-zA-Z_]/;
267
+ const IdentCodePoint$1 = /[^\x00-\x7F]|[-\w]/;
268
+ const Tok$1 = {
269
+ Function: "function",
270
+ Ident: "ident",
271
+ Number: "number",
272
+ Percentage: "percentage",
273
+ ParenClose: ")",
274
+ None: "none",
275
+ Hue: "hue",
276
+ Alpha: "alpha"
277
+ };
278
+ let _i$1 = 0;
279
+ function is_num$1(chars) {
280
+ let ch = chars[_i$1];
281
+ let ch1 = chars[_i$1 + 1];
282
+ if (ch === "-" || ch === "+") return /\d/.test(ch1) || ch1 === "." && /\d/.test(chars[_i$1 + 2]);
283
+ if (ch === ".") return /\d/.test(ch1);
284
+ return /\d/.test(ch);
285
+ }
286
+ function is_ident$1(chars) {
287
+ if (_i$1 >= chars.length) return false;
288
+ let ch = chars[_i$1];
289
+ if (IdentStartCodePoint$1.test(ch)) return true;
290
+ if (ch === "-") {
291
+ if (chars.length - _i$1 < 2) return false;
292
+ let ch1 = chars[_i$1 + 1];
293
+ if (ch1 === "-" || IdentStartCodePoint$1.test(ch1)) return true;
294
+ return false;
295
+ }
296
+ return false;
297
+ }
298
+ const huenits$1 = {
299
+ deg: 1,
300
+ rad: 180 / Math.PI,
301
+ grad: 9 / 10,
302
+ turn: 360
303
+ };
304
+ function num$2(chars) {
305
+ let value = "";
306
+ if (chars[_i$1] === "-" || chars[_i$1] === "+") value += chars[_i$1++];
307
+ value += digits$1(chars);
308
+ if (chars[_i$1] === "." && /\d/.test(chars[_i$1 + 1])) value += chars[_i$1++] + digits$1(chars);
309
+ if (chars[_i$1] === "e" || chars[_i$1] === "E") {
310
+ if ((chars[_i$1 + 1] === "-" || chars[_i$1 + 1] === "+") && /\d/.test(chars[_i$1 + 2])) value += chars[_i$1++] + chars[_i$1++] + digits$1(chars);
311
+ else if (/\d/.test(chars[_i$1 + 1])) value += chars[_i$1++] + digits$1(chars);
312
+ }
313
+ if (is_ident$1(chars)) {
314
+ let id = ident$1(chars);
315
+ if (id === "deg" || id === "rad" || id === "turn" || id === "grad") return {
316
+ type: Tok$1.Hue,
317
+ value: value * huenits$1[id]
318
+ };
319
+ return void 0;
320
+ }
321
+ if (chars[_i$1] === "%") {
322
+ _i$1++;
323
+ return {
324
+ type: Tok$1.Percentage,
325
+ value: +value
326
+ };
327
+ }
328
+ return {
329
+ type: Tok$1.Number,
330
+ value: +value
331
+ };
332
+ }
333
+ function digits$1(chars) {
334
+ let v = "";
335
+ while (/\d/.test(chars[_i$1])) v += chars[_i$1++];
336
+ return v;
337
+ }
338
+ function ident$1(chars) {
339
+ let v = "";
340
+ while (_i$1 < chars.length && IdentCodePoint$1.test(chars[_i$1])) v += chars[_i$1++];
341
+ return v;
342
+ }
343
+ function identlike$1(chars) {
344
+ let v = ident$1(chars);
345
+ if (chars[_i$1] === "(") {
346
+ _i$1++;
347
+ return {
348
+ type: Tok$1.Function,
349
+ value: v
350
+ };
351
+ }
352
+ if (v === "none") return {
353
+ type: Tok$1.None,
354
+ value: void 0
355
+ };
356
+ return {
357
+ type: Tok$1.Ident,
358
+ value: v
359
+ };
360
+ }
361
+ function tokenize$1(str = "") {
362
+ let chars = str.trim();
363
+ let tokens = [];
364
+ let ch;
365
+ _i$1 = 0;
366
+ while (_i$1 < chars.length) {
367
+ ch = chars[_i$1++];
368
+ if (ch === "\n" || ch === " " || ch === " ") {
369
+ while (_i$1 < chars.length && (chars[_i$1] === "\n" || chars[_i$1] === " " || chars[_i$1] === " ")) _i$1++;
370
+ continue;
371
+ }
372
+ if (ch === ",") return void 0;
373
+ if (ch === ")") {
374
+ tokens.push({ type: Tok$1.ParenClose });
375
+ continue;
376
+ }
377
+ if (ch === "+") {
378
+ _i$1--;
379
+ if (is_num$1(chars)) {
380
+ tokens.push(num$2(chars));
381
+ continue;
382
+ }
383
+ return void 0;
384
+ }
385
+ if (ch === "-") {
386
+ _i$1--;
387
+ if (is_num$1(chars)) {
388
+ tokens.push(num$2(chars));
389
+ continue;
390
+ }
391
+ if (is_ident$1(chars)) {
392
+ tokens.push({
393
+ type: Tok$1.Ident,
394
+ value: ident$1(chars)
395
+ });
396
+ continue;
397
+ }
398
+ return void 0;
399
+ }
400
+ if (ch === ".") {
401
+ _i$1--;
402
+ if (is_num$1(chars)) {
403
+ tokens.push(num$2(chars));
404
+ continue;
405
+ }
406
+ return void 0;
407
+ }
408
+ if (ch === "/") {
409
+ while (_i$1 < chars.length && (chars[_i$1] === "\n" || chars[_i$1] === " " || chars[_i$1] === " ")) _i$1++;
410
+ let alpha;
411
+ if (is_num$1(chars)) {
412
+ alpha = num$2(chars);
413
+ if (alpha.type !== Tok$1.Hue) {
414
+ tokens.push({
415
+ type: Tok$1.Alpha,
416
+ value: alpha
417
+ });
418
+ continue;
419
+ }
420
+ }
421
+ if (is_ident$1(chars)) {
422
+ if (ident$1(chars) === "none") {
423
+ tokens.push({
424
+ type: Tok$1.Alpha,
425
+ value: {
426
+ type: Tok$1.None,
427
+ value: void 0
428
+ }
429
+ });
430
+ continue;
431
+ }
432
+ }
433
+ return void 0;
434
+ }
435
+ if (/\d/.test(ch)) {
436
+ _i$1--;
437
+ tokens.push(num$2(chars));
438
+ continue;
439
+ }
440
+ if (IdentStartCodePoint$1.test(ch)) {
441
+ _i$1--;
442
+ tokens.push(identlike$1(chars));
443
+ continue;
444
+ }
445
+ return void 0;
446
+ }
447
+ return tokens;
448
+ }
449
+ function parseColorSyntax$1(tokens) {
450
+ tokens._i = 0;
451
+ let token = tokens[tokens._i++];
452
+ if (!token || token.type !== Tok$1.Function || token.value !== "color") return void 0;
453
+ token = tokens[tokens._i++];
454
+ if (token.type !== Tok$1.Ident) return void 0;
455
+ const mode = colorProfiles$1[token.value];
456
+ if (!mode) return void 0;
457
+ const res = { mode };
458
+ const coords = consumeCoords$1(tokens, false);
459
+ if (!coords) return void 0;
460
+ const channels = getMode$1(mode).channels;
461
+ for (let ii = 0, c$1$1, ch; ii < channels.length; ii++) {
462
+ c$1$1 = coords[ii];
463
+ ch = channels[ii];
464
+ if (c$1$1.type !== Tok$1.None) {
465
+ res[ch] = c$1$1.type === Tok$1.Number ? c$1$1.value : c$1$1.value / 100;
466
+ if (ch === "alpha") res[ch] = Math.max(0, Math.min(1, res[ch]));
467
+ }
468
+ }
469
+ return res;
470
+ }
471
+ function consumeCoords$1(tokens, includeHue) {
472
+ const coords = [];
473
+ let token;
474
+ while (tokens._i < tokens.length) {
475
+ token = tokens[tokens._i++];
476
+ if (token.type === Tok$1.None || token.type === Tok$1.Number || token.type === Tok$1.Alpha || token.type === Tok$1.Percentage || includeHue && token.type === Tok$1.Hue) {
477
+ coords.push(token);
478
+ continue;
479
+ }
480
+ if (token.type === Tok$1.ParenClose) {
481
+ if (tokens._i < tokens.length) return void 0;
482
+ continue;
483
+ }
484
+ return void 0;
485
+ }
486
+ if (coords.length < 3 || coords.length > 4) return void 0;
487
+ if (coords.length === 4) {
488
+ if (coords[3].type !== Tok$1.Alpha) return void 0;
489
+ coords[3] = coords[3].value;
490
+ }
491
+ if (coords.length === 3) coords.push({
492
+ type: Tok$1.None,
493
+ value: void 0
494
+ });
495
+ return coords.every((c$1$1) => c$1$1.type !== Tok$1.Alpha) ? coords : void 0;
496
+ }
497
+ function parseModernSyntax$1(tokens, includeHue) {
498
+ tokens._i = 0;
499
+ let token = tokens[tokens._i++];
500
+ if (!token || token.type !== Tok$1.Function) return void 0;
501
+ let coords = consumeCoords$1(tokens, includeHue);
502
+ if (!coords) return void 0;
503
+ coords.unshift(token.value);
504
+ return coords;
505
+ }
506
+ const parse$1 = (color) => {
507
+ if (typeof color !== "string") return void 0;
508
+ const tokens = tokenize$1(color);
509
+ const parsed = tokens ? parseModernSyntax$1(tokens, true) : void 0;
510
+ let result = void 0;
511
+ let i = 0;
512
+ let len = parsers$1.length;
513
+ while (i < len) if ((result = parsers$1[i++](color, parsed)) !== void 0) return result;
514
+ return tokens ? parseColorSyntax$1(tokens) : void 0;
515
+ };
516
+ var parse_default$1 = parse$1;
517
+ function parseRgb$1(color, parsed) {
518
+ if (!parsed || parsed[0] !== "rgb" && parsed[0] !== "rgba") return void 0;
519
+ const res = { mode: "rgb" };
520
+ const [, r$1, g, b, alpha] = parsed;
521
+ if (r$1.type === Tok$1.Hue || g.type === Tok$1.Hue || b.type === Tok$1.Hue) return void 0;
522
+ if (r$1.type !== Tok$1.None) res.r = r$1.type === Tok$1.Number ? r$1.value / 255 : r$1.value / 100;
523
+ if (g.type !== Tok$1.None) res.g = g.type === Tok$1.Number ? g.value / 255 : g.value / 100;
524
+ if (b.type !== Tok$1.None) res.b = b.type === Tok$1.Number ? b.value / 255 : b.value / 100;
525
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
526
+ return res;
527
+ }
528
+ var parseRgb_default$1 = parseRgb$1;
529
+ const parseTransparent$1 = (c$1$1) => c$1$1 === "transparent" ? {
530
+ mode: "rgb",
531
+ r: 0,
532
+ g: 0,
533
+ b: 0,
534
+ alpha: 0
535
+ } : void 0;
536
+ var parseTransparent_default$1 = parseTransparent$1;
537
+ const lerp$1 = (a, b, t) => a + t * (b - a);
538
+ const get_classes$1 = (arr) => {
539
+ let classes = [];
540
+ for (let i = 0; i < arr.length - 1; i++) {
541
+ let a = arr[i];
542
+ let b = arr[i + 1];
543
+ if (a === void 0 && b === void 0) classes.push(void 0);
544
+ else if (a !== void 0 && b !== void 0) classes.push([a, b]);
545
+ else classes.push(a !== void 0 ? [a, a] : [b, b]);
546
+ }
547
+ return classes;
548
+ };
549
+ const interpolatorPiecewise$1 = (interpolator) => (arr) => {
550
+ let classes = get_classes$1(arr);
551
+ return (t) => {
552
+ let cls = t * classes.length;
553
+ let idx = t >= 1 ? classes.length - 1 : Math.max(Math.floor(cls), 0);
554
+ let pair = classes[idx];
555
+ return pair === void 0 ? void 0 : interpolator(pair[0], pair[1], cls - idx);
556
+ };
557
+ };
558
+ const interpolatorLinear$1 = interpolatorPiecewise$1(lerp$1);
559
+ const fixupAlpha$1 = (arr) => {
560
+ let some_defined = false;
561
+ let res = arr.map((v) => {
562
+ if (v !== void 0) {
563
+ some_defined = true;
564
+ return v;
565
+ }
566
+ return 1;
567
+ });
568
+ return some_defined ? res : arr;
569
+ };
570
+ const definition$14$1 = {
571
+ mode: "rgb",
572
+ channels: [
573
+ "r",
574
+ "g",
575
+ "b",
576
+ "alpha"
577
+ ],
578
+ parse: [
579
+ parseRgb_default$1,
580
+ parseHex_default$1,
581
+ parseRgbLegacy_default$1,
582
+ parseNamed_default$1,
583
+ parseTransparent_default$1,
584
+ "srgb"
585
+ ],
586
+ serialize: "srgb",
587
+ interpolate: {
588
+ r: interpolatorLinear$1,
589
+ g: interpolatorLinear$1,
590
+ b: interpolatorLinear$1,
591
+ alpha: {
592
+ use: interpolatorLinear$1,
593
+ fixup: fixupAlpha$1
594
+ }
595
+ },
596
+ gamut: true,
597
+ white: {
598
+ r: 1,
599
+ g: 1,
600
+ b: 1
601
+ },
602
+ black: {
603
+ r: 0,
604
+ g: 0,
605
+ b: 0
606
+ }
607
+ };
608
+ var definition_default$12$1 = definition$14$1;
609
+ const linearize$2$1 = (v = 0) => Math.pow(Math.abs(v), 563 / 256) * Math.sign(v);
610
+ const convertA98ToXyz65$1 = (a98) => {
611
+ let r$1 = linearize$2$1(a98.r);
612
+ let g = linearize$2$1(a98.g);
613
+ let b = linearize$2$1(a98.b);
614
+ let res = {
615
+ mode: "xyz65",
616
+ x: .5766690429101305 * r$1 + .1855582379065463 * g + .1882286462349947 * b,
617
+ y: .297344975250536 * r$1 + .6273635662554661 * g + .0752914584939979 * b,
618
+ z: .0270313613864123 * r$1 + .0706888525358272 * g + .9913375368376386 * b
619
+ };
620
+ if (a98.alpha !== void 0) res.alpha = a98.alpha;
621
+ return res;
622
+ };
623
+ var convertA98ToXyz65_default$1 = convertA98ToXyz65$1;
624
+ const gamma$2$1 = (v) => Math.pow(Math.abs(v), 256 / 563) * Math.sign(v);
625
+ const convertXyz65ToA98$1 = ({ x, y, z, alpha }) => {
626
+ if (x === void 0) x = 0;
627
+ if (y === void 0) y = 0;
628
+ if (z === void 0) z = 0;
629
+ let res = {
630
+ mode: "a98",
631
+ r: gamma$2$1(x * 2.0415879038107465 - y * .5650069742788597 - .3447313507783297 * z),
632
+ g: gamma$2$1(x * -.9692436362808798 + y * 1.8759675015077206 + .0415550574071756 * z),
633
+ b: gamma$2$1(x * .0134442806320312 - y * .1183623922310184 + 1.0151749943912058 * z)
634
+ };
635
+ if (alpha !== void 0) res.alpha = alpha;
636
+ return res;
637
+ };
638
+ var convertXyz65ToA98_default$1 = convertXyz65ToA98$1;
639
+ const fn$2$1 = (c$1$1 = 0) => {
640
+ const abs = Math.abs(c$1$1);
641
+ if (abs <= .04045) return c$1$1 / 12.92;
642
+ return (Math.sign(c$1$1) || 1) * Math.pow((abs + .055) / 1.055, 2.4);
643
+ };
644
+ const convertRgbToLrgb$1 = ({ r: r$1, g, b, alpha }) => {
645
+ let res = {
646
+ mode: "lrgb",
647
+ r: fn$2$1(r$1),
648
+ g: fn$2$1(g),
649
+ b: fn$2$1(b)
650
+ };
651
+ if (alpha !== void 0) res.alpha = alpha;
652
+ return res;
653
+ };
654
+ var convertRgbToLrgb_default$1 = convertRgbToLrgb$1;
655
+ const convertRgbToXyz65$1 = (rgb$2) => {
656
+ let { r: r$1, g, b, alpha } = convertRgbToLrgb_default$1(rgb$2);
657
+ let res = {
658
+ mode: "xyz65",
659
+ x: .4123907992659593 * r$1 + .357584339383878 * g + .1804807884018343 * b,
660
+ y: .2126390058715102 * r$1 + .715168678767756 * g + .0721923153607337 * b,
661
+ z: .0193308187155918 * r$1 + .119194779794626 * g + .9505321522496607 * b
662
+ };
663
+ if (alpha !== void 0) res.alpha = alpha;
664
+ return res;
665
+ };
666
+ var convertRgbToXyz65_default$1 = convertRgbToXyz65$1;
667
+ const fn$1$1 = (c$1$1 = 0) => {
668
+ const abs = Math.abs(c$1$1);
669
+ if (abs > .0031308) return (Math.sign(c$1$1) || 1) * (1.055 * Math.pow(abs, 1 / 2.4) - .055);
670
+ return c$1$1 * 12.92;
671
+ };
672
+ const convertLrgbToRgb$1 = ({ r: r$1, g, b, alpha }, mode = "rgb") => {
673
+ let res = {
674
+ mode,
675
+ r: fn$1$1(r$1),
676
+ g: fn$1$1(g),
677
+ b: fn$1$1(b)
678
+ };
679
+ if (alpha !== void 0) res.alpha = alpha;
680
+ return res;
681
+ };
682
+ var convertLrgbToRgb_default$1 = convertLrgbToRgb$1;
683
+ const convertXyz65ToRgb$1 = ({ x, y, z, alpha }) => {
684
+ if (x === void 0) x = 0;
685
+ if (y === void 0) y = 0;
686
+ if (z === void 0) z = 0;
687
+ let res = convertLrgbToRgb_default$1({
688
+ r: x * 3.2409699419045226 - y * 1.537383177570094 - .4986107602930034 * z,
689
+ g: x * -.9692436362808796 + y * 1.8759675015077204 + .0415550574071756 * z,
690
+ b: x * .0556300796969936 - y * .2039769588889765 + 1.0569715142428784 * z
691
+ });
692
+ if (alpha !== void 0) res.alpha = alpha;
693
+ return res;
694
+ };
695
+ var convertXyz65ToRgb_default$1 = convertXyz65ToRgb$1;
696
+ const definition$13$1 = {
697
+ ...definition_default$12$1,
698
+ mode: "a98",
699
+ parse: ["a98-rgb"],
700
+ serialize: "a98-rgb",
701
+ fromMode: {
702
+ rgb: (color) => convertXyz65ToA98_default$1(convertRgbToXyz65_default$1(color)),
703
+ xyz65: convertXyz65ToA98_default$1
704
+ },
705
+ toMode: {
706
+ rgb: (color) => convertXyz65ToRgb_default$1(convertA98ToXyz65_default$1(color)),
707
+ xyz65: convertA98ToXyz65_default$1
708
+ }
709
+ };
710
+ var definition_default$15 = definition$13$1;
711
+ const normalizeHue$1 = (hue$2$1) => (hue$2$1 = hue$2$1 % 360) < 0 ? hue$2$1 + 360 : hue$2$1;
712
+ var normalizeHue_default$1 = normalizeHue$1;
713
+ function convertHslToRgb$1({ h, s, l, alpha }) {
714
+ h = normalizeHue_default$1(h !== void 0 ? h : 0);
715
+ if (s === void 0) s = 0;
716
+ if (l === void 0) l = 0;
717
+ let m1 = l + s * (l < .5 ? l : 1 - l);
718
+ let m2 = m1 - (m1 - l) * 2 * Math.abs(h / 60 % 2 - 1);
719
+ let res;
720
+ switch (Math.floor(h / 60)) {
721
+ case 0:
722
+ res = {
723
+ r: m1,
724
+ g: m2,
725
+ b: 2 * l - m1
726
+ };
727
+ break;
728
+ case 1:
729
+ res = {
730
+ r: m2,
731
+ g: m1,
732
+ b: 2 * l - m1
733
+ };
734
+ break;
735
+ case 2:
736
+ res = {
737
+ r: 2 * l - m1,
738
+ g: m1,
739
+ b: m2
740
+ };
741
+ break;
742
+ case 3:
743
+ res = {
744
+ r: 2 * l - m1,
745
+ g: m2,
746
+ b: m1
747
+ };
748
+ break;
749
+ case 4:
750
+ res = {
751
+ r: m2,
752
+ g: 2 * l - m1,
753
+ b: m1
754
+ };
755
+ break;
756
+ case 5:
757
+ res = {
758
+ r: m1,
759
+ g: 2 * l - m1,
760
+ b: m2
761
+ };
762
+ break;
763
+ default: res = {
764
+ r: 2 * l - m1,
765
+ g: 2 * l - m1,
766
+ b: 2 * l - m1
767
+ };
768
+ }
769
+ res.mode = "rgb";
770
+ if (alpha !== void 0) res.alpha = alpha;
771
+ return res;
772
+ }
773
+ function convertRgbToHsl$1({ r: r$1, g, b, alpha }) {
774
+ if (r$1 === void 0) r$1 = 0;
775
+ if (g === void 0) g = 0;
776
+ if (b === void 0) b = 0;
777
+ let M = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
778
+ let res = {
779
+ mode: "hsl",
780
+ s: M === m ? 0 : (M - m) / (1 - Math.abs(M + m - 1)),
781
+ l: .5 * (M + m)
782
+ };
783
+ if (M - m !== 0) res.h = (M === r$1 ? (g - b) / (M - m) + (g < b) * 6 : M === g ? (b - r$1) / (M - m) + 2 : (r$1 - g) / (M - m) + 4) * 60;
784
+ if (alpha !== void 0) res.alpha = alpha;
785
+ return res;
786
+ }
787
+ const hueToDeg$1 = (val, unit) => {
788
+ switch (unit) {
789
+ case "deg": return +val;
790
+ case "rad": return val / Math.PI * 180;
791
+ case "grad": return val / 10 * 9;
792
+ case "turn": return val * 360;
793
+ }
794
+ };
795
+ var hue_default$1 = hueToDeg$1;
796
+ const hsl_old$1 = new RegExp(`^hsla?\\(\\s*${hue$1$1}${c$1}${per$1}${c$1}${per$1}\\s*(?:,\\s*${num_per$1}\\s*)?\\)$`);
797
+ const parseHslLegacy$1 = (color) => {
798
+ let match = color.match(hsl_old$1);
799
+ if (!match) return;
800
+ let res = { mode: "hsl" };
801
+ if (match[3] !== void 0) res.h = +match[3];
802
+ else if (match[1] !== void 0 && match[2] !== void 0) res.h = hue_default$1(match[1], match[2]);
803
+ if (match[4] !== void 0) res.s = Math.min(Math.max(0, match[4] / 100), 1);
804
+ if (match[5] !== void 0) res.l = Math.min(Math.max(0, match[5] / 100), 1);
805
+ if (match[6] !== void 0) res.alpha = Math.max(0, Math.min(1, match[6] / 100));
806
+ else if (match[7] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[7]));
807
+ return res;
808
+ };
809
+ var parseHslLegacy_default$1 = parseHslLegacy$1;
810
+ function parseHsl$1(color, parsed) {
811
+ if (!parsed || parsed[0] !== "hsl" && parsed[0] !== "hsla") return void 0;
812
+ const res = { mode: "hsl" };
813
+ const [, h, s, l, alpha] = parsed;
814
+ if (h.type !== Tok$1.None) {
815
+ if (h.type === Tok$1.Percentage) return void 0;
816
+ res.h = h.value;
817
+ }
818
+ if (s.type !== Tok$1.None) {
819
+ if (s.type === Tok$1.Hue) return void 0;
820
+ res.s = s.value / 100;
821
+ }
822
+ if (l.type !== Tok$1.None) {
823
+ if (l.type === Tok$1.Hue) return void 0;
824
+ res.l = l.value / 100;
825
+ }
826
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
827
+ return res;
828
+ }
829
+ var parseHsl_default$1 = parseHsl$1;
830
+ const hue$2 = (hues, fn$3$1) => {
831
+ return hues.map((hue$2$1, idx, arr) => {
832
+ if (hue$2$1 === void 0) return hue$2$1;
833
+ let normalized = normalizeHue_default$1(hue$2$1);
834
+ if (idx === 0 || hues[idx - 1] === void 0) return normalized;
835
+ return fn$3$1(normalized - normalizeHue_default$1(arr[idx - 1]));
836
+ }).reduce((acc, curr) => {
837
+ if (!acc.length || curr === void 0 || acc[acc.length - 1] === void 0) {
838
+ acc.push(curr);
839
+ return acc;
840
+ }
841
+ acc.push(curr + acc[acc.length - 1]);
842
+ return acc;
843
+ }, []);
844
+ };
845
+ const fixupHueShorter$1 = (arr) => hue$2(arr, (d) => Math.abs(d) <= 180 ? d : d - 360 * Math.sign(d));
846
+ const differenceHueSaturation$1 = (std, smp) => {
847
+ if (std.h === void 0 || smp.h === void 0 || !std.s || !smp.s) return 0;
848
+ let std_h = normalizeHue_default$1(std.h);
849
+ let smp_h = normalizeHue_default$1(smp.h);
850
+ let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180);
851
+ return 2 * Math.sqrt(std.s * smp.s) * dH;
852
+ };
853
+ const differenceHueNaive$1 = (std, smp) => {
854
+ if (std.h === void 0 || smp.h === void 0) return 0;
855
+ let std_h = normalizeHue_default$1(std.h);
856
+ let smp_h = normalizeHue_default$1(smp.h);
857
+ if (Math.abs(smp_h - std_h) > 180) return std_h - (smp_h - 360 * Math.sign(smp_h - std_h));
858
+ return smp_h - std_h;
859
+ };
860
+ const differenceHueChroma$1 = (std, smp) => {
861
+ if (std.h === void 0 || smp.h === void 0 || !std.c || !smp.c) return 0;
862
+ let std_h = normalizeHue_default$1(std.h);
863
+ let smp_h = normalizeHue_default$1(smp.h);
864
+ let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180);
865
+ return 2 * Math.sqrt(std.c * smp.c) * dH;
866
+ };
867
+ const averageAngle$1 = (val) => {
868
+ let sum = val.reduce((sum$1, val$1) => {
869
+ if (val$1 !== void 0) {
870
+ let rad = val$1 * Math.PI / 180;
871
+ sum$1.sin += Math.sin(rad);
872
+ sum$1.cos += Math.cos(rad);
873
+ }
874
+ return sum$1;
875
+ }, {
876
+ sin: 0,
877
+ cos: 0
878
+ });
879
+ let angle = Math.atan2(sum.sin, sum.cos) * 180 / Math.PI;
880
+ return angle < 0 ? 360 + angle : angle;
881
+ };
882
+ const definition$12$1 = {
883
+ mode: "hsl",
884
+ toMode: { rgb: convertHslToRgb$1 },
885
+ fromMode: { rgb: convertRgbToHsl$1 },
886
+ channels: [
887
+ "h",
888
+ "s",
889
+ "l",
890
+ "alpha"
891
+ ],
892
+ ranges: { h: [0, 360] },
893
+ gamut: "rgb",
894
+ parse: [parseHsl_default$1, parseHslLegacy_default$1],
895
+ serialize: (c$1$1) => `hsl(${c$1$1.h !== void 0 ? c$1$1.h : "none"} ${c$1$1.s !== void 0 ? c$1$1.s * 100 + "%" : "none"} ${c$1$1.l !== void 0 ? c$1$1.l * 100 + "%" : "none"}${c$1$1.alpha < 1 ? ` / ${c$1$1.alpha}` : ""})`,
896
+ interpolate: {
897
+ h: {
898
+ use: interpolatorLinear$1,
899
+ fixup: fixupHueShorter$1
900
+ },
901
+ s: interpolatorLinear$1,
902
+ l: interpolatorLinear$1,
903
+ alpha: {
904
+ use: interpolatorLinear$1,
905
+ fixup: fixupAlpha$1
906
+ }
907
+ },
908
+ difference: { h: differenceHueSaturation$1 },
909
+ average: { h: averageAngle$1 }
910
+ };
911
+ var definition_default$1$1 = definition$12$1;
912
+ function convertHsvToRgb$1({ h, s, v, alpha }) {
913
+ h = normalizeHue_default$1(h !== void 0 ? h : 0);
914
+ if (s === void 0) s = 0;
915
+ if (v === void 0) v = 0;
916
+ let f$1$1 = Math.abs(h / 60 % 2 - 1);
917
+ let res;
918
+ switch (Math.floor(h / 60)) {
919
+ case 0:
920
+ res = {
921
+ r: v,
922
+ g: v * (1 - s * f$1$1),
923
+ b: v * (1 - s)
924
+ };
925
+ break;
926
+ case 1:
927
+ res = {
928
+ r: v * (1 - s * f$1$1),
929
+ g: v,
930
+ b: v * (1 - s)
931
+ };
932
+ break;
933
+ case 2:
934
+ res = {
935
+ r: v * (1 - s),
936
+ g: v,
937
+ b: v * (1 - s * f$1$1)
938
+ };
939
+ break;
940
+ case 3:
941
+ res = {
942
+ r: v * (1 - s),
943
+ g: v * (1 - s * f$1$1),
944
+ b: v
945
+ };
946
+ break;
947
+ case 4:
948
+ res = {
949
+ r: v * (1 - s * f$1$1),
950
+ g: v * (1 - s),
951
+ b: v
952
+ };
953
+ break;
954
+ case 5:
955
+ res = {
956
+ r: v,
957
+ g: v * (1 - s),
958
+ b: v * (1 - s * f$1$1)
959
+ };
960
+ break;
961
+ default: res = {
962
+ r: v * (1 - s),
963
+ g: v * (1 - s),
964
+ b: v * (1 - s)
965
+ };
966
+ }
967
+ res.mode = "rgb";
968
+ if (alpha !== void 0) res.alpha = alpha;
969
+ return res;
970
+ }
971
+ function convertRgbToHsv$1({ r: r$1, g, b, alpha }) {
972
+ if (r$1 === void 0) r$1 = 0;
973
+ if (g === void 0) g = 0;
974
+ if (b === void 0) b = 0;
975
+ let M = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
976
+ let res = {
977
+ mode: "hsv",
978
+ s: M === 0 ? 0 : 1 - m / M,
979
+ v: M
980
+ };
981
+ if (M - m !== 0) res.h = (M === r$1 ? (g - b) / (M - m) + (g < b) * 6 : M === g ? (b - r$1) / (M - m) + 2 : (r$1 - g) / (M - m) + 4) * 60;
982
+ if (alpha !== void 0) res.alpha = alpha;
983
+ return res;
984
+ }
985
+ const definition$11$1 = {
986
+ mode: "hsv",
987
+ toMode: { rgb: convertHsvToRgb$1 },
988
+ parse: ["--hsv"],
989
+ serialize: "--hsv",
990
+ fromMode: { rgb: convertRgbToHsv$1 },
991
+ channels: [
992
+ "h",
993
+ "s",
994
+ "v",
995
+ "alpha"
996
+ ],
997
+ ranges: { h: [0, 360] },
998
+ gamut: "rgb",
999
+ interpolate: {
1000
+ h: {
1001
+ use: interpolatorLinear$1,
1002
+ fixup: fixupHueShorter$1
1003
+ },
1004
+ s: interpolatorLinear$1,
1005
+ v: interpolatorLinear$1,
1006
+ alpha: {
1007
+ use: interpolatorLinear$1,
1008
+ fixup: fixupAlpha$1
1009
+ }
1010
+ },
1011
+ difference: { h: differenceHueSaturation$1 },
1012
+ average: { h: averageAngle$1 }
1013
+ };
1014
+ var definition_default$2$1 = definition$11$1;
1015
+ function convertHwbToRgb$1({ h, w, b, alpha }) {
1016
+ if (w === void 0) w = 0;
1017
+ if (b === void 0) b = 0;
1018
+ if (w + b > 1) {
1019
+ let s = w + b;
1020
+ w /= s;
1021
+ b /= s;
1022
+ }
1023
+ return convertHsvToRgb$1({
1024
+ h,
1025
+ s: b === 1 ? 1 : 1 - w / (1 - b),
1026
+ v: 1 - b,
1027
+ alpha
1028
+ });
1029
+ }
1030
+ function convertRgbToHwb$1(rgba) {
1031
+ let hsv = convertRgbToHsv$1(rgba);
1032
+ if (hsv === void 0) return void 0;
1033
+ let s = hsv.s !== void 0 ? hsv.s : 0;
1034
+ let v = hsv.v !== void 0 ? hsv.v : 0;
1035
+ let res = {
1036
+ mode: "hwb",
1037
+ w: (1 - s) * v,
1038
+ b: 1 - v
1039
+ };
1040
+ if (hsv.h !== void 0) res.h = hsv.h;
1041
+ if (hsv.alpha !== void 0) res.alpha = hsv.alpha;
1042
+ return res;
1043
+ }
1044
+ function ParseHwb$1(color, parsed) {
1045
+ if (!parsed || parsed[0] !== "hwb") return void 0;
1046
+ const res = { mode: "hwb" };
1047
+ const [, h, w, b, alpha] = parsed;
1048
+ if (h.type !== Tok$1.None) {
1049
+ if (h.type === Tok$1.Percentage) return void 0;
1050
+ res.h = h.value;
1051
+ }
1052
+ if (w.type !== Tok$1.None) {
1053
+ if (w.type === Tok$1.Hue) return void 0;
1054
+ res.w = w.value / 100;
1055
+ }
1056
+ if (b.type !== Tok$1.None) {
1057
+ if (b.type === Tok$1.Hue) return void 0;
1058
+ res.b = b.value / 100;
1059
+ }
1060
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
1061
+ return res;
1062
+ }
1063
+ var parseHwb_default$1 = ParseHwb$1;
1064
+ const definition$10$1 = {
1065
+ mode: "hwb",
1066
+ toMode: { rgb: convertHwbToRgb$1 },
1067
+ fromMode: { rgb: convertRgbToHwb$1 },
1068
+ channels: [
1069
+ "h",
1070
+ "w",
1071
+ "b",
1072
+ "alpha"
1073
+ ],
1074
+ ranges: { h: [0, 360] },
1075
+ gamut: "rgb",
1076
+ parse: [parseHwb_default$1],
1077
+ serialize: (c$1$1) => `hwb(${c$1$1.h !== void 0 ? c$1$1.h : "none"} ${c$1$1.w !== void 0 ? c$1$1.w * 100 + "%" : "none"} ${c$1$1.b !== void 0 ? c$1$1.b * 100 + "%" : "none"}${c$1$1.alpha < 1 ? ` / ${c$1$1.alpha}` : ""})`,
1078
+ interpolate: {
1079
+ h: {
1080
+ use: interpolatorLinear$1,
1081
+ fixup: fixupHueShorter$1
1082
+ },
1083
+ w: interpolatorLinear$1,
1084
+ b: interpolatorLinear$1,
1085
+ alpha: {
1086
+ use: interpolatorLinear$1,
1087
+ fixup: fixupAlpha$1
1088
+ }
1089
+ },
1090
+ difference: { h: differenceHueNaive$1 },
1091
+ average: { h: averageAngle$1 }
1092
+ };
1093
+ var definition_default$3$1 = definition$10$1;
1094
+ const k$2 = Math.pow(29, 3) / Math.pow(3, 3);
1095
+ const e$2 = Math.pow(6, 3) / Math.pow(29, 3);
1096
+ const D50$1 = {
1097
+ X: .3457 / .3585,
1098
+ Y: 1,
1099
+ Z: .2958 / .3585
1100
+ };
1101
+ const D65$1 = {
1102
+ X: .3127 / .329,
1103
+ Y: 1,
1104
+ Z: .3583 / .329
1105
+ };
1106
+ const k$1$1 = Math.pow(29, 3) / Math.pow(3, 3);
1107
+ const e$1$1 = Math.pow(6, 3) / Math.pow(29, 3);
1108
+ let fn$3 = (v) => Math.pow(v, 3) > e$2 ? Math.pow(v, 3) : (116 * v - 16) / k$2;
1109
+ const convertLabToXyz50$1 = ({ l, a, b, alpha }) => {
1110
+ if (l === void 0) l = 0;
1111
+ if (a === void 0) a = 0;
1112
+ if (b === void 0) b = 0;
1113
+ let fy = (l + 16) / 116;
1114
+ let fx = a / 500 + fy;
1115
+ let fz = fy - b / 200;
1116
+ let res = {
1117
+ mode: "xyz50",
1118
+ x: fn$3(fx) * D50$1.X,
1119
+ y: fn$3(fy) * D50$1.Y,
1120
+ z: fn$3(fz) * D50$1.Z
1121
+ };
1122
+ if (alpha !== void 0) res.alpha = alpha;
1123
+ return res;
1124
+ };
1125
+ var convertLabToXyz50_default$1 = convertLabToXyz50$1;
1126
+ const convertXyz50ToRgb$1 = ({ x, y, z, alpha }) => {
1127
+ if (x === void 0) x = 0;
1128
+ if (y === void 0) y = 0;
1129
+ if (z === void 0) z = 0;
1130
+ let res = convertLrgbToRgb_default$1({
1131
+ r: x * 3.1341359569958707 - y * 1.6173863321612538 - .4906619460083532 * z,
1132
+ g: x * -.978795502912089 + y * 1.916254567259524 + .03344273116131949 * z,
1133
+ b: x * .07195537988411677 - y * .2289768264158322 + 1.405386058324125 * z
1134
+ });
1135
+ if (alpha !== void 0) res.alpha = alpha;
1136
+ return res;
1137
+ };
1138
+ var convertXyz50ToRgb_default$1 = convertXyz50ToRgb$1;
1139
+ const convertLabToRgb$1 = (lab) => convertXyz50ToRgb_default$1(convertLabToXyz50_default$1(lab));
1140
+ var convertLabToRgb_default$1 = convertLabToRgb$1;
1141
+ const convertRgbToXyz50$1 = (rgb$2) => {
1142
+ let { r: r$1, g, b, alpha } = convertRgbToLrgb_default$1(rgb$2);
1143
+ let res = {
1144
+ mode: "xyz50",
1145
+ x: .436065742824811 * r$1 + .3851514688337912 * g + .14307845442264197 * b,
1146
+ y: .22249319175623702 * r$1 + .7168870538238823 * g + .06061979053616537 * b,
1147
+ z: .013923904500943465 * r$1 + .09708128566574634 * g + .7140993584005155 * b
1148
+ };
1149
+ if (alpha !== void 0) res.alpha = alpha;
1150
+ return res;
1151
+ };
1152
+ var convertRgbToXyz50_default$1 = convertRgbToXyz50$1;
1153
+ const f$1 = (value) => value > e$2 ? Math.cbrt(value) : (k$2 * value + 16) / 116;
1154
+ const convertXyz50ToLab$1 = ({ x, y, z, alpha }) => {
1155
+ if (x === void 0) x = 0;
1156
+ if (y === void 0) y = 0;
1157
+ if (z === void 0) z = 0;
1158
+ let f0 = f$1(x / D50$1.X);
1159
+ let f1 = f$1(y / D50$1.Y);
1160
+ let f2 = f$1(z / D50$1.Z);
1161
+ let res = {
1162
+ mode: "lab",
1163
+ l: 116 * f1 - 16,
1164
+ a: 500 * (f0 - f1),
1165
+ b: 200 * (f1 - f2)
1166
+ };
1167
+ if (alpha !== void 0) res.alpha = alpha;
1168
+ return res;
1169
+ };
1170
+ var convertXyz50ToLab_default$1 = convertXyz50ToLab$1;
1171
+ const convertRgbToLab$1 = (rgb$2) => {
1172
+ let res = convertXyz50ToLab_default$1(convertRgbToXyz50_default$1(rgb$2));
1173
+ if (rgb$2.r === rgb$2.b && rgb$2.b === rgb$2.g) res.a = res.b = 0;
1174
+ return res;
1175
+ };
1176
+ var convertRgbToLab_default$1 = convertRgbToLab$1;
1177
+ function parseLab$1(color, parsed) {
1178
+ if (!parsed || parsed[0] !== "lab") return void 0;
1179
+ const res = { mode: "lab" };
1180
+ const [, l, a, b, alpha] = parsed;
1181
+ if (l.type === Tok$1.Hue || a.type === Tok$1.Hue || b.type === Tok$1.Hue) return void 0;
1182
+ if (l.type !== Tok$1.None) res.l = Math.min(Math.max(0, l.value), 100);
1183
+ if (a.type !== Tok$1.None) res.a = a.type === Tok$1.Number ? a.value : a.value * 125 / 100;
1184
+ if (b.type !== Tok$1.None) res.b = b.type === Tok$1.Number ? b.value : b.value * 125 / 100;
1185
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
1186
+ return res;
1187
+ }
1188
+ var parseLab_default$1 = parseLab$1;
1189
+ const definition$9$1 = {
1190
+ mode: "lab",
1191
+ toMode: {
1192
+ xyz50: convertLabToXyz50_default$1,
1193
+ rgb: convertLabToRgb_default$1
1194
+ },
1195
+ fromMode: {
1196
+ xyz50: convertXyz50ToLab_default$1,
1197
+ rgb: convertRgbToLab_default$1
1198
+ },
1199
+ channels: [
1200
+ "l",
1201
+ "a",
1202
+ "b",
1203
+ "alpha"
1204
+ ],
1205
+ ranges: {
1206
+ l: [0, 100],
1207
+ a: [-100, 100],
1208
+ b: [-100, 100]
1209
+ },
1210
+ parse: [parseLab_default$1],
1211
+ serialize: (c$1$1) => `lab(${c$1$1.l !== void 0 ? c$1$1.l : "none"} ${c$1$1.a !== void 0 ? c$1$1.a : "none"} ${c$1$1.b !== void 0 ? c$1$1.b : "none"}${c$1$1.alpha < 1 ? ` / ${c$1$1.alpha}` : ""})`,
1212
+ interpolate: {
1213
+ l: interpolatorLinear$1,
1214
+ a: interpolatorLinear$1,
1215
+ b: interpolatorLinear$1,
1216
+ alpha: {
1217
+ use: interpolatorLinear$1,
1218
+ fixup: fixupAlpha$1
1219
+ }
1220
+ }
1221
+ };
1222
+ var definition_default$4$1 = definition$9$1;
1223
+ const convertLabToLch$1 = ({ l, a, b, alpha }, mode = "lch") => {
1224
+ if (a === void 0) a = 0;
1225
+ if (b === void 0) b = 0;
1226
+ let c$1$1 = Math.sqrt(a * a + b * b);
1227
+ let res = {
1228
+ mode,
1229
+ l,
1230
+ c: c$1$1
1231
+ };
1232
+ if (c$1$1) res.h = normalizeHue_default$1(Math.atan2(b, a) * 180 / Math.PI);
1233
+ if (alpha !== void 0) res.alpha = alpha;
1234
+ return res;
1235
+ };
1236
+ var convertLabToLch_default$1 = convertLabToLch$1;
1237
+ const convertLchToLab$1 = ({ l, c: c$1$1, h, alpha }, mode = "lab") => {
1238
+ if (h === void 0) h = 0;
1239
+ let res = {
1240
+ mode,
1241
+ l,
1242
+ a: c$1$1 ? c$1$1 * Math.cos(h / 180 * Math.PI) : 0,
1243
+ b: c$1$1 ? c$1$1 * Math.sin(h / 180 * Math.PI) : 0
1244
+ };
1245
+ if (alpha !== void 0) res.alpha = alpha;
1246
+ return res;
1247
+ };
1248
+ var convertLchToLab_default$1 = convertLchToLab$1;
1249
+ function parseLch$1(color, parsed) {
1250
+ if (!parsed || parsed[0] !== "lch") return void 0;
1251
+ const res = { mode: "lch" };
1252
+ const [, l, c$1$1, h, alpha] = parsed;
1253
+ if (l.type !== Tok$1.None) {
1254
+ if (l.type === Tok$1.Hue) return void 0;
1255
+ res.l = Math.min(Math.max(0, l.value), 100);
1256
+ }
1257
+ if (c$1$1.type !== Tok$1.None) res.c = Math.max(0, c$1$1.type === Tok$1.Number ? c$1$1.value : c$1$1.value * 150 / 100);
1258
+ if (h.type !== Tok$1.None) {
1259
+ if (h.type === Tok$1.Percentage) return void 0;
1260
+ res.h = h.value;
1261
+ }
1262
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
1263
+ return res;
1264
+ }
1265
+ var parseLch_default$1 = parseLch$1;
1266
+ const definition$8$1 = {
1267
+ mode: "lch",
1268
+ toMode: {
1269
+ lab: convertLchToLab_default$1,
1270
+ rgb: (c$1$1) => convertLabToRgb_default$1(convertLchToLab_default$1(c$1$1))
1271
+ },
1272
+ fromMode: {
1273
+ rgb: (c$1$1) => convertLabToLch_default$1(convertRgbToLab_default$1(c$1$1)),
1274
+ lab: convertLabToLch_default$1
1275
+ },
1276
+ channels: [
1277
+ "l",
1278
+ "c",
1279
+ "h",
1280
+ "alpha"
1281
+ ],
1282
+ ranges: {
1283
+ l: [0, 100],
1284
+ c: [0, 150],
1285
+ h: [0, 360]
1286
+ },
1287
+ parse: [parseLch_default$1],
1288
+ serialize: (c$1$1) => `lch(${c$1$1.l !== void 0 ? c$1$1.l : "none"} ${c$1$1.c !== void 0 ? c$1$1.c : "none"} ${c$1$1.h !== void 0 ? c$1$1.h : "none"}${c$1$1.alpha < 1 ? ` / ${c$1$1.alpha}` : ""})`,
1289
+ interpolate: {
1290
+ h: {
1291
+ use: interpolatorLinear$1,
1292
+ fixup: fixupHueShorter$1
1293
+ },
1294
+ c: interpolatorLinear$1,
1295
+ l: interpolatorLinear$1,
1296
+ alpha: {
1297
+ use: interpolatorLinear$1,
1298
+ fixup: fixupAlpha$1
1299
+ }
1300
+ },
1301
+ difference: { h: differenceHueChroma$1 },
1302
+ average: { h: averageAngle$1 }
1303
+ };
1304
+ var definition_default$5$1 = definition$8$1;
1305
+ const definition$7$1 = {
1306
+ ...definition_default$12$1,
1307
+ mode: "lrgb",
1308
+ toMode: { rgb: convertLrgbToRgb_default$1 },
1309
+ fromMode: { rgb: convertRgbToLrgb_default$1 },
1310
+ parse: ["srgb-linear"],
1311
+ serialize: "srgb-linear"
1312
+ };
1313
+ var definition_default$6$1 = definition$7$1;
1314
+ const convertOklabToLrgb$1 = ({ l, a, b, alpha }) => {
1315
+ if (l === void 0) l = 0;
1316
+ if (a === void 0) a = 0;
1317
+ if (b === void 0) b = 0;
1318
+ let L = Math.pow(l * .9999999984505198 + .39633779217376786 * a + .2158037580607588 * b, 3);
1319
+ let M = Math.pow(l * 1.0000000088817609 - .10556134232365635 * a - .06385417477170591 * b, 3);
1320
+ let S = Math.pow(l * 1.0000000546724108 - .08948418209496575 * a - 1.2914855378640917 * b, 3);
1321
+ let res = {
1322
+ mode: "lrgb",
1323
+ r: 4.076741661347994 * L - 3.307711590408193 * M + .230969928729428 * S,
1324
+ g: -1.2684380040921763 * L + 2.6097574006633715 * M - .3413193963102197 * S,
1325
+ b: -.004196086541837188 * L - .7034186144594493 * M + 1.7076147009309444 * S
1326
+ };
1327
+ if (alpha !== void 0) res.alpha = alpha;
1328
+ return res;
1329
+ };
1330
+ var convertOklabToLrgb_default$1 = convertOklabToLrgb$1;
1331
+ const convertLrgbToOklab$1 = ({ r: r$1, g, b, alpha }) => {
1332
+ if (r$1 === void 0) r$1 = 0;
1333
+ if (g === void 0) g = 0;
1334
+ if (b === void 0) b = 0;
1335
+ let L = Math.cbrt(.41222147079999993 * r$1 + .5363325363 * g + .0514459929 * b);
1336
+ let M = Math.cbrt(.2119034981999999 * r$1 + .6806995450999999 * g + .1073969566 * b);
1337
+ let S = Math.cbrt(.08830246189999998 * r$1 + .2817188376 * g + .6299787005000002 * b);
1338
+ let res = {
1339
+ mode: "oklab",
1340
+ l: .2104542553 * L + .793617785 * M - .0040720468 * S,
1341
+ a: 1.9779984951 * L - 2.428592205 * M + .4505937099 * S,
1342
+ b: .0259040371 * L + .7827717662 * M - .808675766 * S
1343
+ };
1344
+ if (alpha !== void 0) res.alpha = alpha;
1345
+ return res;
1346
+ };
1347
+ var convertLrgbToOklab_default$1 = convertLrgbToOklab$1;
1348
+ const convertRgbToOklab$1 = (rgb$2) => {
1349
+ let res = convertLrgbToOklab_default$1(convertRgbToLrgb_default$1(rgb$2));
1350
+ if (rgb$2.r === rgb$2.b && rgb$2.b === rgb$2.g) res.a = res.b = 0;
1351
+ return res;
1352
+ };
1353
+ var convertRgbToOklab_default$1 = convertRgbToOklab$1;
1354
+ const convertOklabToRgb$1 = (c$1$1) => convertLrgbToRgb_default$1(convertOklabToLrgb_default$1(c$1$1));
1355
+ var convertOklabToRgb_default$1 = convertOklabToRgb$1;
1356
+ function parseOklab$1(color, parsed) {
1357
+ if (!parsed || parsed[0] !== "oklab") return void 0;
1358
+ const res = { mode: "oklab" };
1359
+ const [, l, a, b, alpha] = parsed;
1360
+ if (l.type === Tok$1.Hue || a.type === Tok$1.Hue || b.type === Tok$1.Hue) return void 0;
1361
+ if (l.type !== Tok$1.None) res.l = Math.min(Math.max(0, l.type === Tok$1.Number ? l.value : l.value / 100), 1);
1362
+ if (a.type !== Tok$1.None) res.a = a.type === Tok$1.Number ? a.value : a.value * .4 / 100;
1363
+ if (b.type !== Tok$1.None) res.b = b.type === Tok$1.Number ? b.value : b.value * .4 / 100;
1364
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
1365
+ return res;
1366
+ }
1367
+ var parseOklab_default$1 = parseOklab$1;
1368
+ const definition$6$1 = {
1369
+ ...definition_default$4$1,
1370
+ mode: "oklab",
1371
+ toMode: {
1372
+ lrgb: convertOklabToLrgb_default$1,
1373
+ rgb: convertOklabToRgb_default$1
1374
+ },
1375
+ fromMode: {
1376
+ lrgb: convertLrgbToOklab_default$1,
1377
+ rgb: convertRgbToOklab_default$1
1378
+ },
1379
+ ranges: {
1380
+ l: [0, 1],
1381
+ a: [-.4, .4],
1382
+ b: [-.4, .4]
1383
+ },
1384
+ parse: [parseOklab_default$1],
1385
+ serialize: (c$1$1) => `oklab(${c$1$1.l !== void 0 ? c$1$1.l : "none"} ${c$1$1.a !== void 0 ? c$1$1.a : "none"} ${c$1$1.b !== void 0 ? c$1$1.b : "none"}${c$1$1.alpha < 1 ? ` / ${c$1$1.alpha}` : ""})`
1386
+ };
1387
+ var definition_default$7$1 = definition$6$1;
1388
+ function parseOklch$1(color, parsed) {
1389
+ if (!parsed || parsed[0] !== "oklch") return void 0;
1390
+ const res = { mode: "oklch" };
1391
+ const [, l, c$1$1, h, alpha] = parsed;
1392
+ if (l.type !== Tok$1.None) {
1393
+ if (l.type === Tok$1.Hue) return void 0;
1394
+ res.l = Math.min(Math.max(0, l.type === Tok$1.Number ? l.value : l.value / 100), 1);
1395
+ }
1396
+ if (c$1$1.type !== Tok$1.None) res.c = Math.max(0, c$1$1.type === Tok$1.Number ? c$1$1.value : c$1$1.value * .4 / 100);
1397
+ if (h.type !== Tok$1.None) {
1398
+ if (h.type === Tok$1.Percentage) return void 0;
1399
+ res.h = h.value;
1400
+ }
1401
+ if (alpha.type !== Tok$1.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok$1.Number ? alpha.value : alpha.value / 100));
1402
+ return res;
1403
+ }
1404
+ var parseOklch_default$1 = parseOklch$1;
1405
+ const definition$5$1 = {
1406
+ ...definition_default$5$1,
1407
+ mode: "oklch",
1408
+ toMode: {
1409
+ oklab: (c$1$1) => convertLchToLab_default$1(c$1$1, "oklab"),
1410
+ rgb: (c$1$1) => convertOklabToRgb_default$1(convertLchToLab_default$1(c$1$1, "oklab"))
1411
+ },
1412
+ fromMode: {
1413
+ rgb: (c$1$1) => convertLabToLch_default$1(convertRgbToOklab_default$1(c$1$1), "oklch"),
1414
+ oklab: (c$1$1) => convertLabToLch_default$1(c$1$1, "oklch")
1415
+ },
1416
+ parse: [parseOklch_default$1],
1417
+ serialize: (c$1$1) => `oklch(${c$1$1.l !== void 0 ? c$1$1.l : "none"} ${c$1$1.c !== void 0 ? c$1$1.c : "none"} ${c$1$1.h !== void 0 ? c$1$1.h : "none"}${c$1$1.alpha < 1 ? ` / ${c$1$1.alpha}` : ""})`,
1418
+ ranges: {
1419
+ l: [0, 1],
1420
+ c: [0, .4],
1421
+ h: [0, 360]
1422
+ }
1423
+ };
1424
+ var definition_default$8$1 = definition$5$1;
1425
+ const convertP3ToXyz65$1 = (rgb$2) => {
1426
+ let { r: r$1, g, b, alpha } = convertRgbToLrgb_default$1(rgb$2);
1427
+ let res = {
1428
+ mode: "xyz65",
1429
+ x: .486570948648216 * r$1 + .265667693169093 * g + .1982172852343625 * b,
1430
+ y: .2289745640697487 * r$1 + .6917385218365062 * g + .079286914093745 * b,
1431
+ z: 0 * r$1 + .0451133818589026 * g + 1.043944368900976 * b
1432
+ };
1433
+ if (alpha !== void 0) res.alpha = alpha;
1434
+ return res;
1435
+ };
1436
+ var convertP3ToXyz65_default$1 = convertP3ToXyz65$1;
1437
+ const convertXyz65ToP3$1 = ({ x, y, z, alpha }) => {
1438
+ if (x === void 0) x = 0;
1439
+ if (y === void 0) y = 0;
1440
+ if (z === void 0) z = 0;
1441
+ let res = convertLrgbToRgb_default$1({
1442
+ r: x * 2.4934969119414263 - y * .9313836179191242 - .402710784450717 * z,
1443
+ g: x * -.8294889695615749 + y * 1.7626640603183465 + .0236246858419436 * z,
1444
+ b: x * .0358458302437845 - y * .0761723892680418 + .9568845240076871 * z
1445
+ }, "p3");
1446
+ if (alpha !== void 0) res.alpha = alpha;
1447
+ return res;
1448
+ };
1449
+ var convertXyz65ToP3_default$1 = convertXyz65ToP3$1;
1450
+ const definition$4$1 = {
1451
+ ...definition_default$12$1,
1452
+ mode: "p3",
1453
+ parse: ["display-p3"],
1454
+ serialize: "display-p3",
1455
+ fromMode: {
1456
+ rgb: (color) => convertXyz65ToP3_default$1(convertRgbToXyz65_default$1(color)),
1457
+ xyz65: convertXyz65ToP3_default$1
1458
+ },
1459
+ toMode: {
1460
+ rgb: (color) => convertXyz65ToRgb_default$1(convertP3ToXyz65_default$1(color)),
1461
+ xyz65: convertP3ToXyz65_default$1
1462
+ }
1463
+ };
1464
+ var definition_default$9$1 = definition$4$1;
1465
+ const gamma$1$1 = (v) => {
1466
+ let abs = Math.abs(v);
1467
+ if (abs >= 1 / 512) return Math.sign(v) * Math.pow(abs, 1 / 1.8);
1468
+ return 16 * v;
1469
+ };
1470
+ const convertXyz50ToProphoto$1 = ({ x, y, z, alpha }) => {
1471
+ if (x === void 0) x = 0;
1472
+ if (y === void 0) y = 0;
1473
+ if (z === void 0) z = 0;
1474
+ let res = {
1475
+ mode: "prophoto",
1476
+ r: gamma$1$1(x * 1.3457868816471585 - y * .2555720873797946 - .0511018649755453 * z),
1477
+ g: gamma$1$1(x * -.5446307051249019 + y * 1.5082477428451466 + .0205274474364214 * z),
1478
+ b: gamma$1$1(x * 0 + y * 0 + 1.2119675456389452 * z)
1479
+ };
1480
+ if (alpha !== void 0) res.alpha = alpha;
1481
+ return res;
1482
+ };
1483
+ var convertXyz50ToProphoto_default$1 = convertXyz50ToProphoto$1;
1484
+ const linearize$1$1 = (v = 0) => {
1485
+ let abs = Math.abs(v);
1486
+ if (abs >= 16 / 512) return Math.sign(v) * Math.pow(abs, 1.8);
1487
+ return v / 16;
1488
+ };
1489
+ const convertProphotoToXyz50$1 = (prophoto) => {
1490
+ let r$1 = linearize$1$1(prophoto.r);
1491
+ let g = linearize$1$1(prophoto.g);
1492
+ let b = linearize$1$1(prophoto.b);
1493
+ let res = {
1494
+ mode: "xyz50",
1495
+ x: .7977666449006423 * r$1 + .1351812974005331 * g + .0313477341283922 * b,
1496
+ y: .2880748288194013 * r$1 + .7118352342418731 * g + 899369387256e-16 * b,
1497
+ z: 0 * r$1 + 0 * g + .8251046025104602 * b
1498
+ };
1499
+ if (prophoto.alpha !== void 0) res.alpha = prophoto.alpha;
1500
+ return res;
1501
+ };
1502
+ var convertProphotoToXyz50_default$1 = convertProphotoToXyz50$1;
1503
+ const definition$3$1 = {
1504
+ ...definition_default$12$1,
1505
+ mode: "prophoto",
1506
+ parse: ["prophoto-rgb"],
1507
+ serialize: "prophoto-rgb",
1508
+ fromMode: {
1509
+ xyz50: convertXyz50ToProphoto_default$1,
1510
+ rgb: (color) => convertXyz50ToProphoto_default$1(convertRgbToXyz50_default$1(color))
1511
+ },
1512
+ toMode: {
1513
+ xyz50: convertProphotoToXyz50_default$1,
1514
+ rgb: (color) => convertXyz50ToRgb_default$1(convertProphotoToXyz50_default$1(color))
1515
+ }
1516
+ };
1517
+ var definition_default$10$1 = definition$3$1;
1518
+ const α$1$1 = 1.09929682680944;
1519
+ const β$1$1 = .018053968510807;
1520
+ const gamma$3 = (v) => {
1521
+ const abs = Math.abs(v);
1522
+ if (abs > β$1$1) return (Math.sign(v) || 1) * (α$1$1 * Math.pow(abs, .45) - (α$1$1 - 1));
1523
+ return 4.5 * v;
1524
+ };
1525
+ const convertXyz65ToRec2020$1 = ({ x, y, z, alpha }) => {
1526
+ if (x === void 0) x = 0;
1527
+ if (y === void 0) y = 0;
1528
+ if (z === void 0) z = 0;
1529
+ let res = {
1530
+ mode: "rec2020",
1531
+ r: gamma$3(x * 1.7166511879712683 - y * .3556707837763925 - .2533662813736599 * z),
1532
+ g: gamma$3(x * -.6666843518324893 + y * 1.6164812366349395 + .0157685458139111 * z),
1533
+ b: gamma$3(x * .0176398574453108 - y * .0427706132578085 + .9421031212354739 * z)
1534
+ };
1535
+ if (alpha !== void 0) res.alpha = alpha;
1536
+ return res;
1537
+ };
1538
+ var convertXyz65ToRec2020_default$1 = convertXyz65ToRec2020$1;
1539
+ const α$2 = 1.09929682680944;
1540
+ const β$2 = .018053968510807;
1541
+ const linearize$3 = (v = 0) => {
1542
+ let abs = Math.abs(v);
1543
+ if (abs < β$2 * 4.5) return v / 4.5;
1544
+ return (Math.sign(v) || 1) * Math.pow((abs + α$2 - 1) / α$2, 1 / .45);
1545
+ };
1546
+ const convertRec2020ToXyz65$1 = (rec2020) => {
1547
+ let r$1 = linearize$3(rec2020.r);
1548
+ let g = linearize$3(rec2020.g);
1549
+ let b = linearize$3(rec2020.b);
1550
+ let res = {
1551
+ mode: "xyz65",
1552
+ x: .6369580483012911 * r$1 + .1446169035862083 * g + .1688809751641721 * b,
1553
+ y: .262700212011267 * r$1 + .6779980715188708 * g + .059301716469862 * b,
1554
+ z: 0 * r$1 + .0280726930490874 * g + 1.0609850577107909 * b
1555
+ };
1556
+ if (rec2020.alpha !== void 0) res.alpha = rec2020.alpha;
1557
+ return res;
1558
+ };
1559
+ var convertRec2020ToXyz65_default$1 = convertRec2020ToXyz65$1;
1560
+ const definition$2$1 = {
1561
+ ...definition_default$12$1,
1562
+ mode: "rec2020",
1563
+ fromMode: {
1564
+ xyz65: convertXyz65ToRec2020_default$1,
1565
+ rgb: (color) => convertXyz65ToRec2020_default$1(convertRgbToXyz65_default$1(color))
1566
+ },
1567
+ toMode: {
1568
+ xyz65: convertRec2020ToXyz65_default$1,
1569
+ rgb: (color) => convertXyz65ToRgb_default$1(convertRec2020ToXyz65_default$1(color))
1570
+ },
1571
+ parse: ["rec2020"],
1572
+ serialize: "rec2020"
1573
+ };
1574
+ var definition_default$11$1 = definition$2$1;
1575
+ const definition$1$1 = {
1576
+ mode: "xyz50",
1577
+ parse: ["xyz-d50"],
1578
+ serialize: "xyz-d50",
1579
+ toMode: {
1580
+ rgb: convertXyz50ToRgb_default$1,
1581
+ lab: convertXyz50ToLab_default$1
1582
+ },
1583
+ fromMode: {
1584
+ rgb: convertRgbToXyz50_default$1,
1585
+ lab: convertLabToXyz50_default$1
1586
+ },
1587
+ channels: [
1588
+ "x",
1589
+ "y",
1590
+ "z",
1591
+ "alpha"
1592
+ ],
1593
+ ranges: {
1594
+ x: [0, .964],
1595
+ y: [0, .999],
1596
+ z: [0, .825]
1597
+ },
1598
+ interpolate: {
1599
+ x: interpolatorLinear$1,
1600
+ y: interpolatorLinear$1,
1601
+ z: interpolatorLinear$1,
1602
+ alpha: {
1603
+ use: interpolatorLinear$1,
1604
+ fixup: fixupAlpha$1
1605
+ }
1606
+ }
1607
+ };
1608
+ var definition_default$13$1 = definition$1$1;
1609
+ const convertXyz65ToXyz50$1 = (xyz65) => {
1610
+ let { x, y, z, alpha } = xyz65;
1611
+ if (x === void 0) x = 0;
1612
+ if (y === void 0) y = 0;
1613
+ if (z === void 0) z = 0;
1614
+ let res = {
1615
+ mode: "xyz50",
1616
+ x: 1.0479298208405488 * x + .0229467933410191 * y - .0501922295431356 * z,
1617
+ y: .0296278156881593 * x + .990434484573249 * y - .0170738250293851 * z,
1618
+ z: -.0092430581525912 * x + .0150551448965779 * y + .7518742899580008 * z
1619
+ };
1620
+ if (alpha !== void 0) res.alpha = alpha;
1621
+ return res;
1622
+ };
1623
+ var convertXyz65ToXyz50_default$1 = convertXyz65ToXyz50$1;
1624
+ const convertXyz50ToXyz65$1 = (xyz50) => {
1625
+ let { x, y, z, alpha } = xyz50;
1626
+ if (x === void 0) x = 0;
1627
+ if (y === void 0) y = 0;
1628
+ if (z === void 0) z = 0;
1629
+ let res = {
1630
+ mode: "xyz65",
1631
+ x: .9554734527042182 * x - .0230985368742614 * y + .0632593086610217 * z,
1632
+ y: -.0283697069632081 * x + 1.0099954580058226 * y + .021041398966943 * z,
1633
+ z: .0123140016883199 * x - .0205076964334779 * y + 1.3303659366080753 * z
1634
+ };
1635
+ if (alpha !== void 0) res.alpha = alpha;
1636
+ return res;
1637
+ };
1638
+ var convertXyz50ToXyz65_default$1 = convertXyz50ToXyz65$1;
1639
+ const definition$15 = {
1640
+ mode: "xyz65",
1641
+ toMode: {
1642
+ rgb: convertXyz65ToRgb_default$1,
1643
+ xyz50: convertXyz65ToXyz50_default$1
1644
+ },
1645
+ fromMode: {
1646
+ rgb: convertRgbToXyz65_default$1,
1647
+ xyz50: convertXyz50ToXyz65_default$1
1648
+ },
1649
+ ranges: {
1650
+ x: [0, .95],
1651
+ y: [0, 1],
1652
+ z: [0, 1.088]
1653
+ },
1654
+ channels: [
1655
+ "x",
1656
+ "y",
1657
+ "z",
1658
+ "alpha"
1659
+ ],
1660
+ parse: ["xyz", "xyz-d65"],
1661
+ serialize: "xyz-d65",
1662
+ interpolate: {
1663
+ x: interpolatorLinear$1,
1664
+ y: interpolatorLinear$1,
1665
+ z: interpolatorLinear$1,
1666
+ alpha: {
1667
+ use: interpolatorLinear$1,
1668
+ fixup: fixupAlpha$1
1669
+ }
1670
+ }
1671
+ };
1672
+ var definition_default$14$1 = definition$15;
1673
+ const r = (value, precision) => Math.round(value * (precision = Math.pow(10, precision))) / precision;
1674
+ const round = (precision = 4) => (value) => typeof value === "number" ? r(value, precision) : value;
1675
+ var round_default = round;
1676
+ let twoDecimals = round_default(2);
1677
+ const rgb$1 = converter_default$1("rgb");
1678
+ const hsl = converter_default$1("hsl");
1679
+ const rgb = converter_default$1("rgb");
1680
+ const converters$2 = {
1681
+ a98: useMode$1(definition_default$15),
1682
+ hsl: useMode$1(definition_default$1$1),
1683
+ hsv: useMode$1(definition_default$2$1),
1684
+ hwb: useMode$1(definition_default$3$1),
1685
+ lab: useMode$1(definition_default$4$1),
1686
+ lch: useMode$1(definition_default$5$1),
1687
+ lrgb: useMode$1(definition_default$6$1),
1688
+ oklab: useMode$1(definition_default$7$1),
1689
+ oklch: useMode$1(definition_default$8$1),
1690
+ p3: useMode$1(definition_default$9$1),
1691
+ prophoto: useMode$1(definition_default$10$1),
1692
+ rec2020: useMode$1(definition_default$11$1),
1693
+ rgb: useMode$1(definition_default$12$1),
1694
+ xyz50: useMode$1(definition_default$13$1),
1695
+ xyz65: useMode$1(definition_default$14$1)
1696
+ };
1697
+ const FORMAT_ID = "css";
1698
+
1699
+ //#endregion
1700
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/parseNumber.js
1701
+ const parseNumber = (color, len) => {
1702
+ if (typeof color !== "number") return;
1703
+ if (len === 3) return {
1704
+ mode: "rgb",
1705
+ r: (color >> 8 & 15 | color >> 4 & 240) / 255,
1706
+ g: (color >> 4 & 15 | color & 240) / 255,
1707
+ b: (color & 15 | color << 4 & 240) / 255
1708
+ };
1709
+ if (len === 4) return {
1710
+ mode: "rgb",
1711
+ r: (color >> 12 & 15 | color >> 8 & 240) / 255,
1712
+ g: (color >> 8 & 15 | color >> 4 & 240) / 255,
1713
+ b: (color >> 4 & 15 | color & 240) / 255,
1714
+ alpha: (color & 15 | color << 4 & 240) / 255
1715
+ };
1716
+ if (len === 6) return {
1717
+ mode: "rgb",
1718
+ r: (color >> 16 & 255) / 255,
1719
+ g: (color >> 8 & 255) / 255,
1720
+ b: (color & 255) / 255
1721
+ };
1722
+ if (len === 8) return {
1723
+ mode: "rgb",
1724
+ r: (color >> 24 & 255) / 255,
1725
+ g: (color >> 16 & 255) / 255,
1726
+ b: (color >> 8 & 255) / 255,
1727
+ alpha: (color & 255) / 255
1728
+ };
1729
+ };
1730
+ var parseNumber_default = parseNumber;
1731
+
1732
+ //#endregion
1733
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/colors/named.js
1734
+ const named = {
1735
+ aliceblue: 15792383,
1736
+ antiquewhite: 16444375,
1737
+ aqua: 65535,
1738
+ aquamarine: 8388564,
1739
+ azure: 15794175,
1740
+ beige: 16119260,
1741
+ bisque: 16770244,
1742
+ black: 0,
1743
+ blanchedalmond: 16772045,
1744
+ blue: 255,
1745
+ blueviolet: 9055202,
1746
+ brown: 10824234,
1747
+ burlywood: 14596231,
1748
+ cadetblue: 6266528,
1749
+ chartreuse: 8388352,
1750
+ chocolate: 13789470,
1751
+ coral: 16744272,
1752
+ cornflowerblue: 6591981,
1753
+ cornsilk: 16775388,
1754
+ crimson: 14423100,
1755
+ cyan: 65535,
1756
+ darkblue: 139,
1757
+ darkcyan: 35723,
1758
+ darkgoldenrod: 12092939,
1759
+ darkgray: 11119017,
1760
+ darkgreen: 25600,
1761
+ darkgrey: 11119017,
1762
+ darkkhaki: 12433259,
1763
+ darkmagenta: 9109643,
1764
+ darkolivegreen: 5597999,
1765
+ darkorange: 16747520,
1766
+ darkorchid: 10040012,
1767
+ darkred: 9109504,
1768
+ darksalmon: 15308410,
1769
+ darkseagreen: 9419919,
1770
+ darkslateblue: 4734347,
1771
+ darkslategray: 3100495,
1772
+ darkslategrey: 3100495,
1773
+ darkturquoise: 52945,
1774
+ darkviolet: 9699539,
1775
+ deeppink: 16716947,
1776
+ deepskyblue: 49151,
1777
+ dimgray: 6908265,
1778
+ dimgrey: 6908265,
1779
+ dodgerblue: 2003199,
1780
+ firebrick: 11674146,
1781
+ floralwhite: 16775920,
1782
+ forestgreen: 2263842,
1783
+ fuchsia: 16711935,
1784
+ gainsboro: 14474460,
1785
+ ghostwhite: 16316671,
1786
+ gold: 16766720,
1787
+ goldenrod: 14329120,
1788
+ gray: 8421504,
1789
+ green: 32768,
1790
+ greenyellow: 11403055,
1791
+ grey: 8421504,
1792
+ honeydew: 15794160,
1793
+ hotpink: 16738740,
1794
+ indianred: 13458524,
1795
+ indigo: 4915330,
1796
+ ivory: 16777200,
1797
+ khaki: 15787660,
1798
+ lavender: 15132410,
1799
+ lavenderblush: 16773365,
1800
+ lawngreen: 8190976,
1801
+ lemonchiffon: 16775885,
1802
+ lightblue: 11393254,
1803
+ lightcoral: 15761536,
1804
+ lightcyan: 14745599,
1805
+ lightgoldenrodyellow: 16448210,
1806
+ lightgray: 13882323,
1807
+ lightgreen: 9498256,
1808
+ lightgrey: 13882323,
1809
+ lightpink: 16758465,
1810
+ lightsalmon: 16752762,
1811
+ lightseagreen: 2142890,
1812
+ lightskyblue: 8900346,
1813
+ lightslategray: 7833753,
1814
+ lightslategrey: 7833753,
1815
+ lightsteelblue: 11584734,
1816
+ lightyellow: 16777184,
1817
+ lime: 65280,
1818
+ limegreen: 3329330,
1819
+ linen: 16445670,
1820
+ magenta: 16711935,
1821
+ maroon: 8388608,
1822
+ mediumaquamarine: 6737322,
1823
+ mediumblue: 205,
1824
+ mediumorchid: 12211667,
1825
+ mediumpurple: 9662683,
1826
+ mediumseagreen: 3978097,
1827
+ mediumslateblue: 8087790,
1828
+ mediumspringgreen: 64154,
1829
+ mediumturquoise: 4772300,
1830
+ mediumvioletred: 13047173,
1831
+ midnightblue: 1644912,
1832
+ mintcream: 16121850,
1833
+ mistyrose: 16770273,
1834
+ moccasin: 16770229,
1835
+ navajowhite: 16768685,
1836
+ navy: 128,
1837
+ oldlace: 16643558,
1838
+ olive: 8421376,
1839
+ olivedrab: 7048739,
1840
+ orange: 16753920,
1841
+ orangered: 16729344,
1842
+ orchid: 14315734,
1843
+ palegoldenrod: 15657130,
1844
+ palegreen: 10025880,
1845
+ paleturquoise: 11529966,
1846
+ palevioletred: 14381203,
1847
+ papayawhip: 16773077,
1848
+ peachpuff: 16767673,
1849
+ peru: 13468991,
1850
+ pink: 16761035,
1851
+ plum: 14524637,
1852
+ powderblue: 11591910,
1853
+ purple: 8388736,
1854
+ rebeccapurple: 6697881,
1855
+ red: 16711680,
1856
+ rosybrown: 12357519,
1857
+ royalblue: 4286945,
1858
+ saddlebrown: 9127187,
1859
+ salmon: 16416882,
1860
+ sandybrown: 16032864,
1861
+ seagreen: 3050327,
1862
+ seashell: 16774638,
1863
+ sienna: 10506797,
1864
+ silver: 12632256,
1865
+ skyblue: 8900331,
1866
+ slateblue: 6970061,
1867
+ slategray: 7372944,
1868
+ slategrey: 7372944,
1869
+ snow: 16775930,
1870
+ springgreen: 65407,
1871
+ steelblue: 4620980,
1872
+ tan: 13808780,
1873
+ teal: 32896,
1874
+ thistle: 14204888,
1875
+ tomato: 16737095,
1876
+ turquoise: 4251856,
1877
+ violet: 15631086,
1878
+ wheat: 16113331,
1879
+ white: 16777215,
1880
+ whitesmoke: 16119285,
1881
+ yellow: 16776960,
1882
+ yellowgreen: 10145074
1883
+ };
1884
+ var named_default = named;
1885
+
1886
+ //#endregion
1887
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/parseNamed.js
1888
+ const parseNamed = (color) => {
1889
+ return parseNumber_default(named_default[color.toLowerCase()], 6);
1890
+ };
1891
+ var parseNamed_default = parseNamed;
1892
+
1893
+ //#endregion
1894
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/parseHex.js
1895
+ const hex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i;
1896
+ const parseHex = (color) => {
1897
+ let match;
1898
+ return (match = color.match(hex)) ? parseNumber_default(parseInt(match[1], 16), match[1].length) : void 0;
1899
+ };
1900
+ var parseHex_default = parseHex;
1901
+
1902
+ //#endregion
1903
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/util/regex.js
1904
+ const num$1 = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)";
1905
+ const num_none = `(?:${num$1}|none)`;
1906
+ const per = `${num$1}%`;
1907
+ const per_none = `(?:${num$1}%|none)`;
1908
+ const num_per = `(?:${num$1}%|${num$1})`;
1909
+ const num_per_none = `(?:${num$1}%|${num$1}|none)`;
1910
+ const hue$1 = `(?:${num$1}(deg|grad|rad|turn)|${num$1})`;
1911
+ const hue_none = `(?:${num$1}(deg|grad|rad|turn)|${num$1}|none)`;
1912
+ const c = `\\s*,\\s*`;
1913
+ const rx_num_per_none = new RegExp("^" + num_per_none + "$");
1914
+
1915
+ //#endregion
1916
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/parseRgbLegacy.js
1917
+ const rgb_num_old = new RegExp(`^rgba?\\(\\s*${num$1}${c}${num$1}${c}${num$1}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
1918
+ const rgb_per_old = new RegExp(`^rgba?\\(\\s*${per}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
1919
+ const parseRgbLegacy = (color) => {
1920
+ let res = { mode: "rgb" };
1921
+ let match;
1922
+ if (match = color.match(rgb_num_old)) {
1923
+ if (match[1] !== void 0) res.r = match[1] / 255;
1924
+ if (match[2] !== void 0) res.g = match[2] / 255;
1925
+ if (match[3] !== void 0) res.b = match[3] / 255;
1926
+ } else if (match = color.match(rgb_per_old)) {
1927
+ if (match[1] !== void 0) res.r = match[1] / 100;
1928
+ if (match[2] !== void 0) res.g = match[2] / 100;
1929
+ if (match[3] !== void 0) res.b = match[3] / 100;
1930
+ } else return void 0;
1931
+ if (match[4] !== void 0) res.alpha = Math.max(0, Math.min(1, match[4] / 100));
1932
+ else if (match[5] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[5]));
1933
+ return res;
1934
+ };
1935
+ var parseRgbLegacy_default = parseRgbLegacy;
1936
+
1937
+ //#endregion
1938
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/_prepare.js
1939
+ const prepare = (color, mode) => color === void 0 ? void 0 : typeof color !== "object" ? parse_default(color) : color.mode !== void 0 ? color : mode ? {
1940
+ ...color,
1941
+ mode
1942
+ } : void 0;
1943
+ var _prepare_default = prepare;
1944
+
1945
+ //#endregion
1946
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/converter.js
1947
+ const converter = (target_mode = "rgb") => (color) => (color = _prepare_default(color, target_mode)) !== void 0 ? color.mode === target_mode ? color : converters$1[color.mode][target_mode] ? converters$1[color.mode][target_mode](color) : target_mode === "rgb" ? converters$1[color.mode].rgb(color) : converters$1.rgb[target_mode](converters$1[color.mode].rgb(color)) : void 0;
1948
+ var converter_default = converter;
1949
+
1950
+ //#endregion
1951
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/modes.js
1952
+ const converters$1 = {};
1953
+ const modes = {};
1954
+ const parsers = [];
1955
+ const colorProfiles = {};
1956
+ const identity = (v) => v;
1957
+ const useMode = (definition$16) => {
1958
+ converters$1[definition$16.mode] = {
1959
+ ...converters$1[definition$16.mode],
1960
+ ...definition$16.toMode
1961
+ };
1962
+ Object.keys(definition$16.fromMode || {}).forEach((k$3) => {
1963
+ if (!converters$1[k$3]) converters$1[k$3] = {};
1964
+ converters$1[k$3][definition$16.mode] = definition$16.fromMode[k$3];
1965
+ });
1966
+ if (!definition$16.ranges) definition$16.ranges = {};
1967
+ if (!definition$16.difference) definition$16.difference = {};
1968
+ definition$16.channels.forEach((channel) => {
1969
+ if (definition$16.ranges[channel] === void 0) definition$16.ranges[channel] = [0, 1];
1970
+ if (!definition$16.interpolate[channel]) throw new Error(`Missing interpolator for: ${channel}`);
1971
+ if (typeof definition$16.interpolate[channel] === "function") definition$16.interpolate[channel] = { use: definition$16.interpolate[channel] };
1972
+ if (!definition$16.interpolate[channel].fixup) definition$16.interpolate[channel].fixup = identity;
1973
+ });
1974
+ modes[definition$16.mode] = definition$16;
1975
+ (definition$16.parse || []).forEach((parser) => {
1976
+ useParser(parser, definition$16.mode);
1977
+ });
1978
+ return converter_default(definition$16.mode);
1979
+ };
1980
+ const getMode = (mode) => modes[mode];
1981
+ const useParser = (parser, mode) => {
1982
+ if (typeof parser === "string") {
1983
+ if (!mode) throw new Error(`'mode' required when 'parser' is a string`);
1984
+ colorProfiles[parser] = mode;
1985
+ } else if (typeof parser === "function") {
1986
+ if (parsers.indexOf(parser) < 0) parsers.push(parser);
1987
+ }
1988
+ };
1989
+
1990
+ //#endregion
1991
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/parse.js
1992
+ const IdentStartCodePoint = /[^\x00-\x7F]|[a-zA-Z_]/;
1993
+ const IdentCodePoint = /[^\x00-\x7F]|[-\w]/;
1994
+ const Tok = {
1995
+ Function: "function",
1996
+ Ident: "ident",
1997
+ Number: "number",
1998
+ Percentage: "percentage",
1999
+ ParenClose: ")",
2000
+ None: "none",
2001
+ Hue: "hue",
2002
+ Alpha: "alpha"
2003
+ };
2004
+ let _i = 0;
2005
+ function is_num(chars) {
2006
+ let ch = chars[_i];
2007
+ let ch1 = chars[_i + 1];
2008
+ if (ch === "-" || ch === "+") return /\d/.test(ch1) || ch1 === "." && /\d/.test(chars[_i + 2]);
2009
+ if (ch === ".") return /\d/.test(ch1);
2010
+ return /\d/.test(ch);
2011
+ }
2012
+ function is_ident(chars) {
2013
+ if (_i >= chars.length) return false;
2014
+ let ch = chars[_i];
2015
+ if (IdentStartCodePoint.test(ch)) return true;
2016
+ if (ch === "-") {
2017
+ if (chars.length - _i < 2) return false;
2018
+ let ch1 = chars[_i + 1];
2019
+ if (ch1 === "-" || IdentStartCodePoint.test(ch1)) return true;
2020
+ return false;
2021
+ }
2022
+ return false;
2023
+ }
2024
+ const huenits = {
2025
+ deg: 1,
2026
+ rad: 180 / Math.PI,
2027
+ grad: 9 / 10,
2028
+ turn: 360
2029
+ };
2030
+ function num(chars) {
2031
+ let value = "";
2032
+ if (chars[_i] === "-" || chars[_i] === "+") value += chars[_i++];
2033
+ value += digits(chars);
2034
+ if (chars[_i] === "." && /\d/.test(chars[_i + 1])) value += chars[_i++] + digits(chars);
2035
+ if (chars[_i] === "e" || chars[_i] === "E") {
2036
+ if ((chars[_i + 1] === "-" || chars[_i + 1] === "+") && /\d/.test(chars[_i + 2])) value += chars[_i++] + chars[_i++] + digits(chars);
2037
+ else if (/\d/.test(chars[_i + 1])) value += chars[_i++] + digits(chars);
2038
+ }
2039
+ if (is_ident(chars)) {
2040
+ let id = ident(chars);
2041
+ if (id === "deg" || id === "rad" || id === "turn" || id === "grad") return {
2042
+ type: Tok.Hue,
2043
+ value: value * huenits[id]
2044
+ };
2045
+ return void 0;
2046
+ }
2047
+ if (chars[_i] === "%") {
2048
+ _i++;
2049
+ return {
2050
+ type: Tok.Percentage,
2051
+ value: +value
2052
+ };
2053
+ }
2054
+ return {
2055
+ type: Tok.Number,
2056
+ value: +value
2057
+ };
2058
+ }
2059
+ function digits(chars) {
2060
+ let v = "";
2061
+ while (/\d/.test(chars[_i])) v += chars[_i++];
2062
+ return v;
2063
+ }
2064
+ function ident(chars) {
2065
+ let v = "";
2066
+ while (_i < chars.length && IdentCodePoint.test(chars[_i])) v += chars[_i++];
2067
+ return v;
2068
+ }
2069
+ function identlike(chars) {
2070
+ let v = ident(chars);
2071
+ if (chars[_i] === "(") {
2072
+ _i++;
2073
+ return {
2074
+ type: Tok.Function,
2075
+ value: v
2076
+ };
2077
+ }
2078
+ if (v === "none") return {
2079
+ type: Tok.None,
2080
+ value: void 0
2081
+ };
2082
+ return {
2083
+ type: Tok.Ident,
2084
+ value: v
2085
+ };
2086
+ }
2087
+ function tokenize(str = "") {
2088
+ let chars = str.trim();
2089
+ let tokens = [];
2090
+ let ch;
2091
+ _i = 0;
2092
+ while (_i < chars.length) {
2093
+ ch = chars[_i++];
2094
+ if (ch === "\n" || ch === " " || ch === " ") {
2095
+ while (_i < chars.length && (chars[_i] === "\n" || chars[_i] === " " || chars[_i] === " ")) _i++;
2096
+ continue;
2097
+ }
2098
+ if (ch === ",") return void 0;
2099
+ if (ch === ")") {
2100
+ tokens.push({ type: Tok.ParenClose });
2101
+ continue;
2102
+ }
2103
+ if (ch === "+") {
2104
+ _i--;
2105
+ if (is_num(chars)) {
2106
+ tokens.push(num(chars));
2107
+ continue;
2108
+ }
2109
+ return void 0;
2110
+ }
2111
+ if (ch === "-") {
2112
+ _i--;
2113
+ if (is_num(chars)) {
2114
+ tokens.push(num(chars));
2115
+ continue;
2116
+ }
2117
+ if (is_ident(chars)) {
2118
+ tokens.push({
2119
+ type: Tok.Ident,
2120
+ value: ident(chars)
2121
+ });
2122
+ continue;
2123
+ }
2124
+ return void 0;
2125
+ }
2126
+ if (ch === ".") {
2127
+ _i--;
2128
+ if (is_num(chars)) {
2129
+ tokens.push(num(chars));
2130
+ continue;
2131
+ }
2132
+ return void 0;
2133
+ }
2134
+ if (ch === "/") {
2135
+ while (_i < chars.length && (chars[_i] === "\n" || chars[_i] === " " || chars[_i] === " ")) _i++;
2136
+ let alpha;
2137
+ if (is_num(chars)) {
2138
+ alpha = num(chars);
2139
+ if (alpha.type !== Tok.Hue) {
2140
+ tokens.push({
2141
+ type: Tok.Alpha,
2142
+ value: alpha
2143
+ });
2144
+ continue;
2145
+ }
2146
+ }
2147
+ if (is_ident(chars)) {
2148
+ if (ident(chars) === "none") {
2149
+ tokens.push({
2150
+ type: Tok.Alpha,
2151
+ value: {
2152
+ type: Tok.None,
2153
+ value: void 0
2154
+ }
2155
+ });
2156
+ continue;
2157
+ }
2158
+ }
2159
+ return void 0;
2160
+ }
2161
+ if (/\d/.test(ch)) {
2162
+ _i--;
2163
+ tokens.push(num(chars));
2164
+ continue;
2165
+ }
2166
+ if (IdentStartCodePoint.test(ch)) {
2167
+ _i--;
2168
+ tokens.push(identlike(chars));
2169
+ continue;
2170
+ }
2171
+ return void 0;
2172
+ }
2173
+ return tokens;
2174
+ }
2175
+ function parseColorSyntax(tokens) {
2176
+ tokens._i = 0;
2177
+ let token = tokens[tokens._i++];
2178
+ if (!token || token.type !== Tok.Function || token.value !== "color") return void 0;
2179
+ token = tokens[tokens._i++];
2180
+ if (token.type !== Tok.Ident) return void 0;
2181
+ const mode = colorProfiles[token.value];
2182
+ if (!mode) return void 0;
2183
+ const res = { mode };
2184
+ const coords = consumeCoords(tokens, false);
2185
+ if (!coords) return void 0;
2186
+ const channels = getMode(mode).channels;
2187
+ for (let ii = 0, c$2, ch; ii < channels.length; ii++) {
2188
+ c$2 = coords[ii];
2189
+ ch = channels[ii];
2190
+ if (c$2.type !== Tok.None) {
2191
+ res[ch] = c$2.type === Tok.Number ? c$2.value : c$2.value / 100;
2192
+ if (ch === "alpha") res[ch] = Math.max(0, Math.min(1, res[ch]));
2193
+ }
2194
+ }
2195
+ return res;
2196
+ }
2197
+ function consumeCoords(tokens, includeHue) {
2198
+ const coords = [];
2199
+ let token;
2200
+ while (tokens._i < tokens.length) {
2201
+ token = tokens[tokens._i++];
2202
+ if (token.type === Tok.None || token.type === Tok.Number || token.type === Tok.Alpha || token.type === Tok.Percentage || includeHue && token.type === Tok.Hue) {
2203
+ coords.push(token);
2204
+ continue;
2205
+ }
2206
+ if (token.type === Tok.ParenClose) {
2207
+ if (tokens._i < tokens.length) return void 0;
2208
+ continue;
2209
+ }
2210
+ return void 0;
2211
+ }
2212
+ if (coords.length < 3 || coords.length > 4) return void 0;
2213
+ if (coords.length === 4) {
2214
+ if (coords[3].type !== Tok.Alpha) return void 0;
2215
+ coords[3] = coords[3].value;
2216
+ }
2217
+ if (coords.length === 3) coords.push({
2218
+ type: Tok.None,
2219
+ value: void 0
2220
+ });
2221
+ return coords.every((c$2) => c$2.type !== Tok.Alpha) ? coords : void 0;
2222
+ }
2223
+ function parseModernSyntax(tokens, includeHue) {
2224
+ tokens._i = 0;
2225
+ let token = tokens[tokens._i++];
2226
+ if (!token || token.type !== Tok.Function) return void 0;
2227
+ let coords = consumeCoords(tokens, includeHue);
2228
+ if (!coords) return void 0;
2229
+ coords.unshift(token.value);
2230
+ return coords;
2231
+ }
2232
+ const parse = (color) => {
2233
+ if (typeof color !== "string") return void 0;
2234
+ const tokens = tokenize(color);
2235
+ const parsed = tokens ? parseModernSyntax(tokens, true) : void 0;
2236
+ let result = void 0;
2237
+ let i = 0;
2238
+ let len = parsers.length;
2239
+ while (i < len) if ((result = parsers[i++](color, parsed)) !== void 0) return result;
2240
+ return tokens ? parseColorSyntax(tokens) : void 0;
2241
+ };
2242
+ var parse_default = parse;
2243
+
2244
+ //#endregion
2245
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/parseRgb.js
2246
+ function parseRgb(color, parsed) {
2247
+ if (!parsed || parsed[0] !== "rgb" && parsed[0] !== "rgba") return void 0;
2248
+ const res = { mode: "rgb" };
2249
+ const [, r$1, g, b, alpha] = parsed;
2250
+ if (r$1.type === Tok.Hue || g.type === Tok.Hue || b.type === Tok.Hue) return void 0;
2251
+ if (r$1.type !== Tok.None) res.r = r$1.type === Tok.Number ? r$1.value / 255 : r$1.value / 100;
2252
+ if (g.type !== Tok.None) res.g = g.type === Tok.Number ? g.value / 255 : g.value / 100;
2253
+ if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value / 255 : b.value / 100;
2254
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
2255
+ return res;
2256
+ }
2257
+ var parseRgb_default = parseRgb;
2258
+
2259
+ //#endregion
2260
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/parseTransparent.js
2261
+ const parseTransparent = (c$2) => c$2 === "transparent" ? {
2262
+ mode: "rgb",
2263
+ r: 0,
2264
+ g: 0,
2265
+ b: 0,
2266
+ alpha: 0
2267
+ } : void 0;
2268
+ var parseTransparent_default = parseTransparent;
2269
+
2270
+ //#endregion
2271
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/interpolate/lerp.js
2272
+ const lerp = (a, b, t) => a + t * (b - a);
2273
+
2274
+ //#endregion
2275
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/interpolate/piecewise.js
2276
+ const get_classes = (arr) => {
2277
+ let classes = [];
2278
+ for (let i = 0; i < arr.length - 1; i++) {
2279
+ let a = arr[i];
2280
+ let b = arr[i + 1];
2281
+ if (a === void 0 && b === void 0) classes.push(void 0);
2282
+ else if (a !== void 0 && b !== void 0) classes.push([a, b]);
2283
+ else classes.push(a !== void 0 ? [a, a] : [b, b]);
2284
+ }
2285
+ return classes;
2286
+ };
2287
+ const interpolatorPiecewise = (interpolator) => (arr) => {
2288
+ let classes = get_classes(arr);
2289
+ return (t) => {
2290
+ let cls = t * classes.length;
2291
+ let idx = t >= 1 ? classes.length - 1 : Math.max(Math.floor(cls), 0);
2292
+ let pair = classes[idx];
2293
+ return pair === void 0 ? void 0 : interpolator(pair[0], pair[1], cls - idx);
2294
+ };
2295
+ };
2296
+
2297
+ //#endregion
2298
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/interpolate/linear.js
2299
+ const interpolatorLinear = interpolatorPiecewise(lerp);
2300
+
2301
+ //#endregion
2302
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/fixup/alpha.js
2303
+ const fixupAlpha = (arr) => {
2304
+ let some_defined = false;
2305
+ let res = arr.map((v) => {
2306
+ if (v !== void 0) {
2307
+ some_defined = true;
2308
+ return v;
2309
+ }
2310
+ return 1;
2311
+ });
2312
+ return some_defined ? res : arr;
2313
+ };
2314
+
2315
+ //#endregion
2316
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/definition.js
2317
+ const definition$14 = {
2318
+ mode: "rgb",
2319
+ channels: [
2320
+ "r",
2321
+ "g",
2322
+ "b",
2323
+ "alpha"
2324
+ ],
2325
+ parse: [
2326
+ parseRgb_default,
2327
+ parseHex_default,
2328
+ parseRgbLegacy_default,
2329
+ parseNamed_default,
2330
+ parseTransparent_default,
2331
+ "srgb"
2332
+ ],
2333
+ serialize: "srgb",
2334
+ interpolate: {
2335
+ r: interpolatorLinear,
2336
+ g: interpolatorLinear,
2337
+ b: interpolatorLinear,
2338
+ alpha: {
2339
+ use: interpolatorLinear,
2340
+ fixup: fixupAlpha
2341
+ }
2342
+ },
2343
+ gamut: true,
2344
+ white: {
2345
+ r: 1,
2346
+ g: 1,
2347
+ b: 1
2348
+ },
2349
+ black: {
2350
+ r: 0,
2351
+ g: 0,
2352
+ b: 0
2353
+ }
2354
+ };
2355
+ var definition_default$12 = definition$14;
2356
+
2357
+ //#endregion
2358
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/a98/convertA98ToXyz65.js
2359
+ const linearize$2 = (v = 0) => Math.pow(Math.abs(v), 563 / 256) * Math.sign(v);
2360
+ const convertA98ToXyz65 = (a98) => {
2361
+ let r$1 = linearize$2(a98.r);
2362
+ let g = linearize$2(a98.g);
2363
+ let b = linearize$2(a98.b);
2364
+ let res = {
2365
+ mode: "xyz65",
2366
+ x: .5766690429101305 * r$1 + .1855582379065463 * g + .1882286462349947 * b,
2367
+ y: .297344975250536 * r$1 + .6273635662554661 * g + .0752914584939979 * b,
2368
+ z: .0270313613864123 * r$1 + .0706888525358272 * g + .9913375368376386 * b
2369
+ };
2370
+ if (a98.alpha !== void 0) res.alpha = a98.alpha;
2371
+ return res;
2372
+ };
2373
+ var convertA98ToXyz65_default = convertA98ToXyz65;
2374
+
2375
+ //#endregion
2376
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/a98/convertXyz65ToA98.js
2377
+ const gamma$2 = (v) => Math.pow(Math.abs(v), 256 / 563) * Math.sign(v);
2378
+ const convertXyz65ToA98 = ({ x, y, z, alpha }) => {
2379
+ if (x === void 0) x = 0;
2380
+ if (y === void 0) y = 0;
2381
+ if (z === void 0) z = 0;
2382
+ let res = {
2383
+ mode: "a98",
2384
+ r: gamma$2(x * 2.0415879038107465 - y * .5650069742788597 - .3447313507783297 * z),
2385
+ g: gamma$2(x * -.9692436362808798 + y * 1.8759675015077206 + .0415550574071756 * z),
2386
+ b: gamma$2(x * .0134442806320312 - y * .1183623922310184 + 1.0151749943912058 * z)
2387
+ };
2388
+ if (alpha !== void 0) res.alpha = alpha;
2389
+ return res;
2390
+ };
2391
+ var convertXyz65ToA98_default = convertXyz65ToA98;
2392
+
2393
+ //#endregion
2394
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lrgb/convertRgbToLrgb.js
2395
+ const fn$2 = (c$2 = 0) => {
2396
+ const abs = Math.abs(c$2);
2397
+ if (abs <= .04045) return c$2 / 12.92;
2398
+ return (Math.sign(c$2) || 1) * Math.pow((abs + .055) / 1.055, 2.4);
2399
+ };
2400
+ const convertRgbToLrgb = ({ r: r$1, g, b, alpha }) => {
2401
+ let res = {
2402
+ mode: "lrgb",
2403
+ r: fn$2(r$1),
2404
+ g: fn$2(g),
2405
+ b: fn$2(b)
2406
+ };
2407
+ if (alpha !== void 0) res.alpha = alpha;
2408
+ return res;
2409
+ };
2410
+ var convertRgbToLrgb_default = convertRgbToLrgb;
2411
+
2412
+ //#endregion
2413
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz65/convertRgbToXyz65.js
2414
+ const convertRgbToXyz65 = (rgb$2) => {
2415
+ let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$2);
2416
+ let res = {
2417
+ mode: "xyz65",
2418
+ x: .4123907992659593 * r$1 + .357584339383878 * g + .1804807884018343 * b,
2419
+ y: .2126390058715102 * r$1 + .715168678767756 * g + .0721923153607337 * b,
2420
+ z: .0193308187155918 * r$1 + .119194779794626 * g + .9505321522496607 * b
2421
+ };
2422
+ if (alpha !== void 0) res.alpha = alpha;
2423
+ return res;
2424
+ };
2425
+ var convertRgbToXyz65_default = convertRgbToXyz65;
2426
+
2427
+ //#endregion
2428
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lrgb/convertLrgbToRgb.js
2429
+ const fn$1 = (c$2 = 0) => {
2430
+ const abs = Math.abs(c$2);
2431
+ if (abs > .0031308) return (Math.sign(c$2) || 1) * (1.055 * Math.pow(abs, 1 / 2.4) - .055);
2432
+ return c$2 * 12.92;
2433
+ };
2434
+ const convertLrgbToRgb = ({ r: r$1, g, b, alpha }, mode = "rgb") => {
2435
+ let res = {
2436
+ mode,
2437
+ r: fn$1(r$1),
2438
+ g: fn$1(g),
2439
+ b: fn$1(b)
2440
+ };
2441
+ if (alpha !== void 0) res.alpha = alpha;
2442
+ return res;
2443
+ };
2444
+ var convertLrgbToRgb_default = convertLrgbToRgb;
2445
+
2446
+ //#endregion
2447
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz65/convertXyz65ToRgb.js
2448
+ const convertXyz65ToRgb = ({ x, y, z, alpha }) => {
2449
+ if (x === void 0) x = 0;
2450
+ if (y === void 0) y = 0;
2451
+ if (z === void 0) z = 0;
2452
+ let res = convertLrgbToRgb_default({
2453
+ r: x * 3.2409699419045226 - y * 1.537383177570094 - .4986107602930034 * z,
2454
+ g: x * -.9692436362808796 + y * 1.8759675015077204 + .0415550574071756 * z,
2455
+ b: x * .0556300796969936 - y * .2039769588889765 + 1.0569715142428784 * z
2456
+ });
2457
+ if (alpha !== void 0) res.alpha = alpha;
2458
+ return res;
2459
+ };
2460
+ var convertXyz65ToRgb_default = convertXyz65ToRgb;
2461
+
2462
+ //#endregion
2463
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/a98/definition.js
2464
+ const definition$13 = {
2465
+ ...definition_default$12,
2466
+ mode: "a98",
2467
+ parse: ["a98-rgb"],
2468
+ serialize: "a98-rgb",
2469
+ fromMode: {
2470
+ rgb: (color) => convertXyz65ToA98_default(convertRgbToXyz65_default(color)),
2471
+ xyz65: convertXyz65ToA98_default
2472
+ },
2473
+ toMode: {
2474
+ rgb: (color) => convertXyz65ToRgb_default(convertA98ToXyz65_default(color)),
2475
+ xyz65: convertA98ToXyz65_default
2476
+ }
2477
+ };
2478
+ var definition_default = definition$13;
2479
+
2480
+ //#endregion
2481
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/util/normalizeHue.js
2482
+ const normalizeHue = (hue$3) => (hue$3 = hue$3 % 360) < 0 ? hue$3 + 360 : hue$3;
2483
+ var normalizeHue_default = normalizeHue;
2484
+
2485
+ //#endregion
2486
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsl/convertHslToRgb.js
2487
+ function convertHslToRgb({ h, s, l, alpha }) {
2488
+ h = normalizeHue_default(h !== void 0 ? h : 0);
2489
+ if (s === void 0) s = 0;
2490
+ if (l === void 0) l = 0;
2491
+ let m1 = l + s * (l < .5 ? l : 1 - l);
2492
+ let m2 = m1 - (m1 - l) * 2 * Math.abs(h / 60 % 2 - 1);
2493
+ let res;
2494
+ switch (Math.floor(h / 60)) {
2495
+ case 0:
2496
+ res = {
2497
+ r: m1,
2498
+ g: m2,
2499
+ b: 2 * l - m1
2500
+ };
2501
+ break;
2502
+ case 1:
2503
+ res = {
2504
+ r: m2,
2505
+ g: m1,
2506
+ b: 2 * l - m1
2507
+ };
2508
+ break;
2509
+ case 2:
2510
+ res = {
2511
+ r: 2 * l - m1,
2512
+ g: m1,
2513
+ b: m2
2514
+ };
2515
+ break;
2516
+ case 3:
2517
+ res = {
2518
+ r: 2 * l - m1,
2519
+ g: m2,
2520
+ b: m1
2521
+ };
2522
+ break;
2523
+ case 4:
2524
+ res = {
2525
+ r: m2,
2526
+ g: 2 * l - m1,
2527
+ b: m1
2528
+ };
2529
+ break;
2530
+ case 5:
2531
+ res = {
2532
+ r: m1,
2533
+ g: 2 * l - m1,
2534
+ b: m2
2535
+ };
2536
+ break;
2537
+ default: res = {
2538
+ r: 2 * l - m1,
2539
+ g: 2 * l - m1,
2540
+ b: 2 * l - m1
2541
+ };
2542
+ }
2543
+ res.mode = "rgb";
2544
+ if (alpha !== void 0) res.alpha = alpha;
2545
+ return res;
2546
+ }
2547
+
2548
+ //#endregion
2549
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsl/convertRgbToHsl.js
2550
+ function convertRgbToHsl({ r: r$1, g, b, alpha }) {
2551
+ if (r$1 === void 0) r$1 = 0;
2552
+ if (g === void 0) g = 0;
2553
+ if (b === void 0) b = 0;
2554
+ let M = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
2555
+ let res = {
2556
+ mode: "hsl",
2557
+ s: M === m ? 0 : (M - m) / (1 - Math.abs(M + m - 1)),
2558
+ l: .5 * (M + m)
2559
+ };
2560
+ if (M - m !== 0) res.h = (M === r$1 ? (g - b) / (M - m) + (g < b) * 6 : M === g ? (b - r$1) / (M - m) + 2 : (r$1 - g) / (M - m) + 4) * 60;
2561
+ if (alpha !== void 0) res.alpha = alpha;
2562
+ return res;
2563
+ }
2564
+
2565
+ //#endregion
2566
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/util/hue.js
2567
+ const hueToDeg = (val, unit) => {
2568
+ switch (unit) {
2569
+ case "deg": return +val;
2570
+ case "rad": return val / Math.PI * 180;
2571
+ case "grad": return val / 10 * 9;
2572
+ case "turn": return val * 360;
2573
+ }
2574
+ };
2575
+ var hue_default = hueToDeg;
2576
+
2577
+ //#endregion
2578
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsl/parseHslLegacy.js
2579
+ const hsl_old = new RegExp(`^hsla?\\(\\s*${hue$1}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`);
2580
+ const parseHslLegacy = (color) => {
2581
+ let match = color.match(hsl_old);
2582
+ if (!match) return;
2583
+ let res = { mode: "hsl" };
2584
+ if (match[3] !== void 0) res.h = +match[3];
2585
+ else if (match[1] !== void 0 && match[2] !== void 0) res.h = hue_default(match[1], match[2]);
2586
+ if (match[4] !== void 0) res.s = Math.min(Math.max(0, match[4] / 100), 1);
2587
+ if (match[5] !== void 0) res.l = Math.min(Math.max(0, match[5] / 100), 1);
2588
+ if (match[6] !== void 0) res.alpha = Math.max(0, Math.min(1, match[6] / 100));
2589
+ else if (match[7] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[7]));
2590
+ return res;
2591
+ };
2592
+ var parseHslLegacy_default = parseHslLegacy;
2593
+
2594
+ //#endregion
2595
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsl/parseHsl.js
2596
+ function parseHsl(color, parsed) {
2597
+ if (!parsed || parsed[0] !== "hsl" && parsed[0] !== "hsla") return void 0;
2598
+ const res = { mode: "hsl" };
2599
+ const [, h, s, l, alpha] = parsed;
2600
+ if (h.type !== Tok.None) {
2601
+ if (h.type === Tok.Percentage) return void 0;
2602
+ res.h = h.value;
2603
+ }
2604
+ if (s.type !== Tok.None) {
2605
+ if (s.type === Tok.Hue) return void 0;
2606
+ res.s = s.value / 100;
2607
+ }
2608
+ if (l.type !== Tok.None) {
2609
+ if (l.type === Tok.Hue) return void 0;
2610
+ res.l = l.value / 100;
2611
+ }
2612
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
2613
+ return res;
2614
+ }
2615
+ var parseHsl_default = parseHsl;
2616
+
2617
+ //#endregion
2618
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/fixup/hue.js
2619
+ const hue = (hues, fn$4) => {
2620
+ return hues.map((hue$3, idx, arr) => {
2621
+ if (hue$3 === void 0) return hue$3;
2622
+ let normalized = normalizeHue_default(hue$3);
2623
+ if (idx === 0 || hues[idx - 1] === void 0) return normalized;
2624
+ return fn$4(normalized - normalizeHue_default(arr[idx - 1]));
2625
+ }).reduce((acc, curr) => {
2626
+ if (!acc.length || curr === void 0 || acc[acc.length - 1] === void 0) {
2627
+ acc.push(curr);
2628
+ return acc;
2629
+ }
2630
+ acc.push(curr + acc[acc.length - 1]);
2631
+ return acc;
2632
+ }, []);
2633
+ };
2634
+ const fixupHueShorter = (arr) => hue(arr, (d) => Math.abs(d) <= 180 ? d : d - 360 * Math.sign(d));
2635
+
2636
+ //#endregion
2637
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/difference.js
2638
+ const differenceHueSaturation = (std, smp) => {
2639
+ if (std.h === void 0 || smp.h === void 0 || !std.s || !smp.s) return 0;
2640
+ let std_h = normalizeHue_default(std.h);
2641
+ let smp_h = normalizeHue_default(smp.h);
2642
+ let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180);
2643
+ return 2 * Math.sqrt(std.s * smp.s) * dH;
2644
+ };
2645
+ const differenceHueNaive = (std, smp) => {
2646
+ if (std.h === void 0 || smp.h === void 0) return 0;
2647
+ let std_h = normalizeHue_default(std.h);
2648
+ let smp_h = normalizeHue_default(smp.h);
2649
+ if (Math.abs(smp_h - std_h) > 180) return std_h - (smp_h - 360 * Math.sign(smp_h - std_h));
2650
+ return smp_h - std_h;
2651
+ };
2652
+ const differenceHueChroma = (std, smp) => {
2653
+ if (std.h === void 0 || smp.h === void 0 || !std.c || !smp.c) return 0;
2654
+ let std_h = normalizeHue_default(std.h);
2655
+ let smp_h = normalizeHue_default(smp.h);
2656
+ let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180);
2657
+ return 2 * Math.sqrt(std.c * smp.c) * dH;
2658
+ };
2659
+
2660
+ //#endregion
2661
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/average.js
2662
+ const averageAngle = (val) => {
2663
+ let sum = val.reduce((sum$1, val$1) => {
2664
+ if (val$1 !== void 0) {
2665
+ let rad = val$1 * Math.PI / 180;
2666
+ sum$1.sin += Math.sin(rad);
2667
+ sum$1.cos += Math.cos(rad);
2668
+ }
2669
+ return sum$1;
2670
+ }, {
2671
+ sin: 0,
2672
+ cos: 0
2673
+ });
2674
+ let angle = Math.atan2(sum.sin, sum.cos) * 180 / Math.PI;
2675
+ return angle < 0 ? 360 + angle : angle;
2676
+ };
2677
+
2678
+ //#endregion
2679
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsl/definition.js
2680
+ const definition$12 = {
2681
+ mode: "hsl",
2682
+ toMode: { rgb: convertHslToRgb },
2683
+ fromMode: { rgb: convertRgbToHsl },
2684
+ channels: [
2685
+ "h",
2686
+ "s",
2687
+ "l",
2688
+ "alpha"
2689
+ ],
2690
+ ranges: { h: [0, 360] },
2691
+ gamut: "rgb",
2692
+ parse: [parseHsl_default, parseHslLegacy_default],
2693
+ serialize: (c$2) => `hsl(${c$2.h !== void 0 ? c$2.h : "none"} ${c$2.s !== void 0 ? c$2.s * 100 + "%" : "none"} ${c$2.l !== void 0 ? c$2.l * 100 + "%" : "none"}${c$2.alpha < 1 ? ` / ${c$2.alpha}` : ""})`,
2694
+ interpolate: {
2695
+ h: {
2696
+ use: interpolatorLinear,
2697
+ fixup: fixupHueShorter
2698
+ },
2699
+ s: interpolatorLinear,
2700
+ l: interpolatorLinear,
2701
+ alpha: {
2702
+ use: interpolatorLinear,
2703
+ fixup: fixupAlpha
2704
+ }
2705
+ },
2706
+ difference: { h: differenceHueSaturation },
2707
+ average: { h: averageAngle }
2708
+ };
2709
+ var definition_default$1 = definition$12;
2710
+
2711
+ //#endregion
2712
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsv/convertHsvToRgb.js
2713
+ function convertHsvToRgb({ h, s, v, alpha }) {
2714
+ h = normalizeHue_default(h !== void 0 ? h : 0);
2715
+ if (s === void 0) s = 0;
2716
+ if (v === void 0) v = 0;
2717
+ let f$2 = Math.abs(h / 60 % 2 - 1);
2718
+ let res;
2719
+ switch (Math.floor(h / 60)) {
2720
+ case 0:
2721
+ res = {
2722
+ r: v,
2723
+ g: v * (1 - s * f$2),
2724
+ b: v * (1 - s)
2725
+ };
2726
+ break;
2727
+ case 1:
2728
+ res = {
2729
+ r: v * (1 - s * f$2),
2730
+ g: v,
2731
+ b: v * (1 - s)
2732
+ };
2733
+ break;
2734
+ case 2:
2735
+ res = {
2736
+ r: v * (1 - s),
2737
+ g: v,
2738
+ b: v * (1 - s * f$2)
2739
+ };
2740
+ break;
2741
+ case 3:
2742
+ res = {
2743
+ r: v * (1 - s),
2744
+ g: v * (1 - s * f$2),
2745
+ b: v
2746
+ };
2747
+ break;
2748
+ case 4:
2749
+ res = {
2750
+ r: v * (1 - s * f$2),
2751
+ g: v * (1 - s),
2752
+ b: v
2753
+ };
2754
+ break;
2755
+ case 5:
2756
+ res = {
2757
+ r: v,
2758
+ g: v * (1 - s),
2759
+ b: v * (1 - s * f$2)
2760
+ };
2761
+ break;
2762
+ default: res = {
2763
+ r: v * (1 - s),
2764
+ g: v * (1 - s),
2765
+ b: v * (1 - s)
2766
+ };
2767
+ }
2768
+ res.mode = "rgb";
2769
+ if (alpha !== void 0) res.alpha = alpha;
2770
+ return res;
2771
+ }
2772
+
2773
+ //#endregion
2774
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsv/convertRgbToHsv.js
2775
+ function convertRgbToHsv({ r: r$1, g, b, alpha }) {
2776
+ if (r$1 === void 0) r$1 = 0;
2777
+ if (g === void 0) g = 0;
2778
+ if (b === void 0) b = 0;
2779
+ let M = Math.max(r$1, g, b), m = Math.min(r$1, g, b);
2780
+ let res = {
2781
+ mode: "hsv",
2782
+ s: M === 0 ? 0 : 1 - m / M,
2783
+ v: M
2784
+ };
2785
+ if (M - m !== 0) res.h = (M === r$1 ? (g - b) / (M - m) + (g < b) * 6 : M === g ? (b - r$1) / (M - m) + 2 : (r$1 - g) / (M - m) + 4) * 60;
2786
+ if (alpha !== void 0) res.alpha = alpha;
2787
+ return res;
2788
+ }
2789
+
2790
+ //#endregion
2791
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsv/definition.js
2792
+ const definition$11 = {
2793
+ mode: "hsv",
2794
+ toMode: { rgb: convertHsvToRgb },
2795
+ parse: ["--hsv"],
2796
+ serialize: "--hsv",
2797
+ fromMode: { rgb: convertRgbToHsv },
2798
+ channels: [
2799
+ "h",
2800
+ "s",
2801
+ "v",
2802
+ "alpha"
2803
+ ],
2804
+ ranges: { h: [0, 360] },
2805
+ gamut: "rgb",
2806
+ interpolate: {
2807
+ h: {
2808
+ use: interpolatorLinear,
2809
+ fixup: fixupHueShorter
2810
+ },
2811
+ s: interpolatorLinear,
2812
+ v: interpolatorLinear,
2813
+ alpha: {
2814
+ use: interpolatorLinear,
2815
+ fixup: fixupAlpha
2816
+ }
2817
+ },
2818
+ difference: { h: differenceHueSaturation },
2819
+ average: { h: averageAngle }
2820
+ };
2821
+ var definition_default$2 = definition$11;
2822
+
2823
+ //#endregion
2824
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hwb/convertHwbToRgb.js
2825
+ function convertHwbToRgb({ h, w, b, alpha }) {
2826
+ if (w === void 0) w = 0;
2827
+ if (b === void 0) b = 0;
2828
+ if (w + b > 1) {
2829
+ let s = w + b;
2830
+ w /= s;
2831
+ b /= s;
2832
+ }
2833
+ return convertHsvToRgb({
2834
+ h,
2835
+ s: b === 1 ? 1 : 1 - w / (1 - b),
2836
+ v: 1 - b,
2837
+ alpha
2838
+ });
2839
+ }
2840
+
2841
+ //#endregion
2842
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hwb/convertRgbToHwb.js
2843
+ function convertRgbToHwb(rgba) {
2844
+ let hsv = convertRgbToHsv(rgba);
2845
+ if (hsv === void 0) return void 0;
2846
+ let s = hsv.s !== void 0 ? hsv.s : 0;
2847
+ let v = hsv.v !== void 0 ? hsv.v : 0;
2848
+ let res = {
2849
+ mode: "hwb",
2850
+ w: (1 - s) * v,
2851
+ b: 1 - v
2852
+ };
2853
+ if (hsv.h !== void 0) res.h = hsv.h;
2854
+ if (hsv.alpha !== void 0) res.alpha = hsv.alpha;
2855
+ return res;
2856
+ }
2857
+
2858
+ //#endregion
2859
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hwb/parseHwb.js
2860
+ function ParseHwb(color, parsed) {
2861
+ if (!parsed || parsed[0] !== "hwb") return void 0;
2862
+ const res = { mode: "hwb" };
2863
+ const [, h, w, b, alpha] = parsed;
2864
+ if (h.type !== Tok.None) {
2865
+ if (h.type === Tok.Percentage) return void 0;
2866
+ res.h = h.value;
2867
+ }
2868
+ if (w.type !== Tok.None) {
2869
+ if (w.type === Tok.Hue) return void 0;
2870
+ res.w = w.value / 100;
2871
+ }
2872
+ if (b.type !== Tok.None) {
2873
+ if (b.type === Tok.Hue) return void 0;
2874
+ res.b = b.value / 100;
2875
+ }
2876
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
2877
+ return res;
2878
+ }
2879
+ var parseHwb_default = ParseHwb;
2880
+
2881
+ //#endregion
2882
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hwb/definition.js
2883
+ const definition$10 = {
2884
+ mode: "hwb",
2885
+ toMode: { rgb: convertHwbToRgb },
2886
+ fromMode: { rgb: convertRgbToHwb },
2887
+ channels: [
2888
+ "h",
2889
+ "w",
2890
+ "b",
2891
+ "alpha"
2892
+ ],
2893
+ ranges: { h: [0, 360] },
2894
+ gamut: "rgb",
2895
+ parse: [parseHwb_default],
2896
+ serialize: (c$2) => `hwb(${c$2.h !== void 0 ? c$2.h : "none"} ${c$2.w !== void 0 ? c$2.w * 100 + "%" : "none"} ${c$2.b !== void 0 ? c$2.b * 100 + "%" : "none"}${c$2.alpha < 1 ? ` / ${c$2.alpha}` : ""})`,
2897
+ interpolate: {
2898
+ h: {
2899
+ use: interpolatorLinear,
2900
+ fixup: fixupHueShorter
2901
+ },
2902
+ w: interpolatorLinear,
2903
+ b: interpolatorLinear,
2904
+ alpha: {
2905
+ use: interpolatorLinear,
2906
+ fixup: fixupAlpha
2907
+ }
2908
+ },
2909
+ difference: { h: differenceHueNaive },
2910
+ average: { h: averageAngle }
2911
+ };
2912
+ var definition_default$3 = definition$10;
2913
+
2914
+ //#endregion
2915
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz50/constants.js
2916
+ const k = Math.pow(29, 3) / Math.pow(3, 3);
2917
+ const e = Math.pow(6, 3) / Math.pow(29, 3);
2918
+
2919
+ //#endregion
2920
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/constants.js
2921
+ const D50 = {
2922
+ X: .3457 / .3585,
2923
+ Y: 1,
2924
+ Z: .2958 / .3585
2925
+ };
2926
+ const D65 = {
2927
+ X: .3127 / .329,
2928
+ Y: 1,
2929
+ Z: .3583 / .329
2930
+ };
2931
+ const k$1 = Math.pow(29, 3) / Math.pow(3, 3);
2932
+ const e$1 = Math.pow(6, 3) / Math.pow(29, 3);
2933
+
2934
+ //#endregion
2935
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/convertLabToXyz50.js
2936
+ let fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k;
2937
+ const convertLabToXyz50 = ({ l, a, b, alpha }) => {
2938
+ if (l === void 0) l = 0;
2939
+ if (a === void 0) a = 0;
2940
+ if (b === void 0) b = 0;
2941
+ let fy = (l + 16) / 116;
2942
+ let fx = a / 500 + fy;
2943
+ let fz = fy - b / 200;
2944
+ let res = {
2945
+ mode: "xyz50",
2946
+ x: fn(fx) * D50.X,
2947
+ y: fn(fy) * D50.Y,
2948
+ z: fn(fz) * D50.Z
2949
+ };
2950
+ if (alpha !== void 0) res.alpha = alpha;
2951
+ return res;
2952
+ };
2953
+ var convertLabToXyz50_default = convertLabToXyz50;
2954
+
2955
+ //#endregion
2956
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz50/convertXyz50ToRgb.js
2957
+ const convertXyz50ToRgb = ({ x, y, z, alpha }) => {
2958
+ if (x === void 0) x = 0;
2959
+ if (y === void 0) y = 0;
2960
+ if (z === void 0) z = 0;
2961
+ let res = convertLrgbToRgb_default({
2962
+ r: x * 3.1341359569958707 - y * 1.6173863321612538 - .4906619460083532 * z,
2963
+ g: x * -.978795502912089 + y * 1.916254567259524 + .03344273116131949 * z,
2964
+ b: x * .07195537988411677 - y * .2289768264158322 + 1.405386058324125 * z
2965
+ });
2966
+ if (alpha !== void 0) res.alpha = alpha;
2967
+ return res;
2968
+ };
2969
+ var convertXyz50ToRgb_default = convertXyz50ToRgb;
2970
+
2971
+ //#endregion
2972
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/convertLabToRgb.js
2973
+ const convertLabToRgb = (lab) => convertXyz50ToRgb_default(convertLabToXyz50_default(lab));
2974
+ var convertLabToRgb_default = convertLabToRgb;
2975
+
2976
+ //#endregion
2977
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz50/convertRgbToXyz50.js
2978
+ const convertRgbToXyz50 = (rgb$2) => {
2979
+ let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$2);
2980
+ let res = {
2981
+ mode: "xyz50",
2982
+ x: .436065742824811 * r$1 + .3851514688337912 * g + .14307845442264197 * b,
2983
+ y: .22249319175623702 * r$1 + .7168870538238823 * g + .06061979053616537 * b,
2984
+ z: .013923904500943465 * r$1 + .09708128566574634 * g + .7140993584005155 * b
2985
+ };
2986
+ if (alpha !== void 0) res.alpha = alpha;
2987
+ return res;
2988
+ };
2989
+ var convertRgbToXyz50_default = convertRgbToXyz50;
2990
+
2991
+ //#endregion
2992
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/convertXyz50ToLab.js
2993
+ const f = (value) => value > e ? Math.cbrt(value) : (k * value + 16) / 116;
2994
+ const convertXyz50ToLab = ({ x, y, z, alpha }) => {
2995
+ if (x === void 0) x = 0;
2996
+ if (y === void 0) y = 0;
2997
+ if (z === void 0) z = 0;
2998
+ let f0 = f(x / D50.X);
2999
+ let f1 = f(y / D50.Y);
3000
+ let f2 = f(z / D50.Z);
3001
+ let res = {
3002
+ mode: "lab",
3003
+ l: 116 * f1 - 16,
3004
+ a: 500 * (f0 - f1),
3005
+ b: 200 * (f1 - f2)
3006
+ };
3007
+ if (alpha !== void 0) res.alpha = alpha;
3008
+ return res;
3009
+ };
3010
+ var convertXyz50ToLab_default = convertXyz50ToLab;
3011
+
3012
+ //#endregion
3013
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/convertRgbToLab.js
3014
+ const convertRgbToLab = (rgb$2) => {
3015
+ let res = convertXyz50ToLab_default(convertRgbToXyz50_default(rgb$2));
3016
+ if (rgb$2.r === rgb$2.b && rgb$2.b === rgb$2.g) res.a = res.b = 0;
3017
+ return res;
3018
+ };
3019
+ var convertRgbToLab_default = convertRgbToLab;
3020
+
3021
+ //#endregion
3022
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/parseLab.js
3023
+ function parseLab(color, parsed) {
3024
+ if (!parsed || parsed[0] !== "lab") return void 0;
3025
+ const res = { mode: "lab" };
3026
+ const [, l, a, b, alpha] = parsed;
3027
+ if (l.type === Tok.Hue || a.type === Tok.Hue || b.type === Tok.Hue) return void 0;
3028
+ if (l.type !== Tok.None) res.l = Math.min(Math.max(0, l.value), 100);
3029
+ if (a.type !== Tok.None) res.a = a.type === Tok.Number ? a.value : a.value * 125 / 100;
3030
+ if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value : b.value * 125 / 100;
3031
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
3032
+ return res;
3033
+ }
3034
+ var parseLab_default = parseLab;
3035
+
3036
+ //#endregion
3037
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/definition.js
3038
+ const definition$9 = {
3039
+ mode: "lab",
3040
+ toMode: {
3041
+ xyz50: convertLabToXyz50_default,
3042
+ rgb: convertLabToRgb_default
3043
+ },
3044
+ fromMode: {
3045
+ xyz50: convertXyz50ToLab_default,
3046
+ rgb: convertRgbToLab_default
3047
+ },
3048
+ channels: [
3049
+ "l",
3050
+ "a",
3051
+ "b",
3052
+ "alpha"
3053
+ ],
3054
+ ranges: {
3055
+ l: [0, 100],
3056
+ a: [-100, 100],
3057
+ b: [-100, 100]
3058
+ },
3059
+ parse: [parseLab_default],
3060
+ serialize: (c$2) => `lab(${c$2.l !== void 0 ? c$2.l : "none"} ${c$2.a !== void 0 ? c$2.a : "none"} ${c$2.b !== void 0 ? c$2.b : "none"}${c$2.alpha < 1 ? ` / ${c$2.alpha}` : ""})`,
3061
+ interpolate: {
3062
+ l: interpolatorLinear,
3063
+ a: interpolatorLinear,
3064
+ b: interpolatorLinear,
3065
+ alpha: {
3066
+ use: interpolatorLinear,
3067
+ fixup: fixupAlpha
3068
+ }
3069
+ }
3070
+ };
3071
+ var definition_default$4 = definition$9;
3072
+
3073
+ //#endregion
3074
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lch/convertLabToLch.js
3075
+ const convertLabToLch = ({ l, a, b, alpha }, mode = "lch") => {
3076
+ if (a === void 0) a = 0;
3077
+ if (b === void 0) b = 0;
3078
+ let c$2 = Math.sqrt(a * a + b * b);
3079
+ let res = {
3080
+ mode,
3081
+ l,
3082
+ c: c$2
3083
+ };
3084
+ if (c$2) res.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI);
3085
+ if (alpha !== void 0) res.alpha = alpha;
3086
+ return res;
3087
+ };
3088
+ var convertLabToLch_default = convertLabToLch;
3089
+
3090
+ //#endregion
3091
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lch/convertLchToLab.js
3092
+ const convertLchToLab = ({ l, c: c$2, h, alpha }, mode = "lab") => {
3093
+ if (h === void 0) h = 0;
3094
+ let res = {
3095
+ mode,
3096
+ l,
3097
+ a: c$2 ? c$2 * Math.cos(h / 180 * Math.PI) : 0,
3098
+ b: c$2 ? c$2 * Math.sin(h / 180 * Math.PI) : 0
3099
+ };
3100
+ if (alpha !== void 0) res.alpha = alpha;
3101
+ return res;
3102
+ };
3103
+ var convertLchToLab_default = convertLchToLab;
3104
+
3105
+ //#endregion
3106
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lch/parseLch.js
3107
+ function parseLch(color, parsed) {
3108
+ if (!parsed || parsed[0] !== "lch") return void 0;
3109
+ const res = { mode: "lch" };
3110
+ const [, l, c$2, h, alpha] = parsed;
3111
+ if (l.type !== Tok.None) {
3112
+ if (l.type === Tok.Hue) return void 0;
3113
+ res.l = Math.min(Math.max(0, l.value), 100);
3114
+ }
3115
+ if (c$2.type !== Tok.None) res.c = Math.max(0, c$2.type === Tok.Number ? c$2.value : c$2.value * 150 / 100);
3116
+ if (h.type !== Tok.None) {
3117
+ if (h.type === Tok.Percentage) return void 0;
3118
+ res.h = h.value;
3119
+ }
3120
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
3121
+ return res;
3122
+ }
3123
+ var parseLch_default = parseLch;
3124
+
3125
+ //#endregion
3126
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lch/definition.js
3127
+ const definition$8 = {
3128
+ mode: "lch",
3129
+ toMode: {
3130
+ lab: convertLchToLab_default,
3131
+ rgb: (c$2) => convertLabToRgb_default(convertLchToLab_default(c$2))
3132
+ },
3133
+ fromMode: {
3134
+ rgb: (c$2) => convertLabToLch_default(convertRgbToLab_default(c$2)),
3135
+ lab: convertLabToLch_default
3136
+ },
3137
+ channels: [
3138
+ "l",
3139
+ "c",
3140
+ "h",
3141
+ "alpha"
3142
+ ],
3143
+ ranges: {
3144
+ l: [0, 100],
3145
+ c: [0, 150],
3146
+ h: [0, 360]
3147
+ },
3148
+ parse: [parseLch_default],
3149
+ serialize: (c$2) => `lch(${c$2.l !== void 0 ? c$2.l : "none"} ${c$2.c !== void 0 ? c$2.c : "none"} ${c$2.h !== void 0 ? c$2.h : "none"}${c$2.alpha < 1 ? ` / ${c$2.alpha}` : ""})`,
3150
+ interpolate: {
3151
+ h: {
3152
+ use: interpolatorLinear,
3153
+ fixup: fixupHueShorter
3154
+ },
3155
+ c: interpolatorLinear,
3156
+ l: interpolatorLinear,
3157
+ alpha: {
3158
+ use: interpolatorLinear,
3159
+ fixup: fixupAlpha
3160
+ }
3161
+ },
3162
+ difference: { h: differenceHueChroma },
3163
+ average: { h: averageAngle }
3164
+ };
3165
+ var definition_default$5 = definition$8;
3166
+
3167
+ //#endregion
3168
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lrgb/definition.js
3169
+ const definition$7 = {
3170
+ ...definition_default$12,
3171
+ mode: "lrgb",
3172
+ toMode: { rgb: convertLrgbToRgb_default },
3173
+ fromMode: { rgb: convertRgbToLrgb_default },
3174
+ parse: ["srgb-linear"],
3175
+ serialize: "srgb-linear"
3176
+ };
3177
+ var definition_default$6 = definition$7;
3178
+
3179
+ //#endregion
3180
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/convertOklabToLrgb.js
3181
+ const convertOklabToLrgb = ({ l, a, b, alpha }) => {
3182
+ if (l === void 0) l = 0;
3183
+ if (a === void 0) a = 0;
3184
+ if (b === void 0) b = 0;
3185
+ let L = Math.pow(l * .9999999984505198 + .39633779217376786 * a + .2158037580607588 * b, 3);
3186
+ let M = Math.pow(l * 1.0000000088817609 - .10556134232365635 * a - .06385417477170591 * b, 3);
3187
+ let S = Math.pow(l * 1.0000000546724108 - .08948418209496575 * a - 1.2914855378640917 * b, 3);
3188
+ let res = {
3189
+ mode: "lrgb",
3190
+ r: 4.076741661347994 * L - 3.307711590408193 * M + .230969928729428 * S,
3191
+ g: -1.2684380040921763 * L + 2.6097574006633715 * M - .3413193963102197 * S,
3192
+ b: -.004196086541837188 * L - .7034186144594493 * M + 1.7076147009309444 * S
3193
+ };
3194
+ if (alpha !== void 0) res.alpha = alpha;
3195
+ return res;
3196
+ };
3197
+ var convertOklabToLrgb_default = convertOklabToLrgb;
3198
+
3199
+ //#endregion
3200
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/convertLrgbToOklab.js
3201
+ const convertLrgbToOklab = ({ r: r$1, g, b, alpha }) => {
3202
+ if (r$1 === void 0) r$1 = 0;
3203
+ if (g === void 0) g = 0;
3204
+ if (b === void 0) b = 0;
3205
+ let L = Math.cbrt(.41222147079999993 * r$1 + .5363325363 * g + .0514459929 * b);
3206
+ let M = Math.cbrt(.2119034981999999 * r$1 + .6806995450999999 * g + .1073969566 * b);
3207
+ let S = Math.cbrt(.08830246189999998 * r$1 + .2817188376 * g + .6299787005000002 * b);
3208
+ let res = {
3209
+ mode: "oklab",
3210
+ l: .2104542553 * L + .793617785 * M - .0040720468 * S,
3211
+ a: 1.9779984951 * L - 2.428592205 * M + .4505937099 * S,
3212
+ b: .0259040371 * L + .7827717662 * M - .808675766 * S
3213
+ };
3214
+ if (alpha !== void 0) res.alpha = alpha;
3215
+ return res;
3216
+ };
3217
+ var convertLrgbToOklab_default = convertLrgbToOklab;
3218
+
3219
+ //#endregion
3220
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/convertRgbToOklab.js
3221
+ const convertRgbToOklab = (rgb$2) => {
3222
+ let res = convertLrgbToOklab_default(convertRgbToLrgb_default(rgb$2));
3223
+ if (rgb$2.r === rgb$2.b && rgb$2.b === rgb$2.g) res.a = res.b = 0;
3224
+ return res;
3225
+ };
3226
+ var convertRgbToOklab_default = convertRgbToOklab;
3227
+
3228
+ //#endregion
3229
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/convertOklabToRgb.js
3230
+ const convertOklabToRgb = (c$2) => convertLrgbToRgb_default(convertOklabToLrgb_default(c$2));
3231
+ var convertOklabToRgb_default = convertOklabToRgb;
3232
+
3233
+ //#endregion
3234
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/parseOklab.js
3235
+ function parseOklab(color, parsed) {
3236
+ if (!parsed || parsed[0] !== "oklab") return void 0;
3237
+ const res = { mode: "oklab" };
3238
+ const [, l, a, b, alpha] = parsed;
3239
+ if (l.type === Tok.Hue || a.type === Tok.Hue || b.type === Tok.Hue) return void 0;
3240
+ if (l.type !== Tok.None) res.l = Math.min(Math.max(0, l.type === Tok.Number ? l.value : l.value / 100), 1);
3241
+ if (a.type !== Tok.None) res.a = a.type === Tok.Number ? a.value : a.value * .4 / 100;
3242
+ if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value : b.value * .4 / 100;
3243
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
3244
+ return res;
3245
+ }
3246
+ var parseOklab_default = parseOklab;
3247
+
3248
+ //#endregion
3249
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/definition.js
3250
+ const definition$6 = {
3251
+ ...definition_default$4,
3252
+ mode: "oklab",
3253
+ toMode: {
3254
+ lrgb: convertOklabToLrgb_default,
3255
+ rgb: convertOklabToRgb_default
3256
+ },
3257
+ fromMode: {
3258
+ lrgb: convertLrgbToOklab_default,
3259
+ rgb: convertRgbToOklab_default
3260
+ },
3261
+ ranges: {
3262
+ l: [0, 1],
3263
+ a: [-.4, .4],
3264
+ b: [-.4, .4]
3265
+ },
3266
+ parse: [parseOklab_default],
3267
+ serialize: (c$2) => `oklab(${c$2.l !== void 0 ? c$2.l : "none"} ${c$2.a !== void 0 ? c$2.a : "none"} ${c$2.b !== void 0 ? c$2.b : "none"}${c$2.alpha < 1 ? ` / ${c$2.alpha}` : ""})`
3268
+ };
3269
+ var definition_default$7 = definition$6;
3270
+
3271
+ //#endregion
3272
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklch/parseOklch.js
3273
+ function parseOklch(color, parsed) {
3274
+ if (!parsed || parsed[0] !== "oklch") return void 0;
3275
+ const res = { mode: "oklch" };
3276
+ const [, l, c$2, h, alpha] = parsed;
3277
+ if (l.type !== Tok.None) {
3278
+ if (l.type === Tok.Hue) return void 0;
3279
+ res.l = Math.min(Math.max(0, l.type === Tok.Number ? l.value : l.value / 100), 1);
3280
+ }
3281
+ if (c$2.type !== Tok.None) res.c = Math.max(0, c$2.type === Tok.Number ? c$2.value : c$2.value * .4 / 100);
3282
+ if (h.type !== Tok.None) {
3283
+ if (h.type === Tok.Percentage) return void 0;
3284
+ res.h = h.value;
3285
+ }
3286
+ if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100));
3287
+ return res;
3288
+ }
3289
+ var parseOklch_default = parseOklch;
3290
+
3291
+ //#endregion
3292
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklch/definition.js
3293
+ const definition$5 = {
3294
+ ...definition_default$5,
3295
+ mode: "oklch",
3296
+ toMode: {
3297
+ oklab: (c$2) => convertLchToLab_default(c$2, "oklab"),
3298
+ rgb: (c$2) => convertOklabToRgb_default(convertLchToLab_default(c$2, "oklab"))
3299
+ },
3300
+ fromMode: {
3301
+ rgb: (c$2) => convertLabToLch_default(convertRgbToOklab_default(c$2), "oklch"),
3302
+ oklab: (c$2) => convertLabToLch_default(c$2, "oklch")
3303
+ },
3304
+ parse: [parseOklch_default],
3305
+ serialize: (c$2) => `oklch(${c$2.l !== void 0 ? c$2.l : "none"} ${c$2.c !== void 0 ? c$2.c : "none"} ${c$2.h !== void 0 ? c$2.h : "none"}${c$2.alpha < 1 ? ` / ${c$2.alpha}` : ""})`,
3306
+ ranges: {
3307
+ l: [0, 1],
3308
+ c: [0, .4],
3309
+ h: [0, 360]
3310
+ }
3311
+ };
3312
+ var definition_default$8 = definition$5;
3313
+
3314
+ //#endregion
3315
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/p3/convertP3ToXyz65.js
3316
+ const convertP3ToXyz65 = (rgb$2) => {
3317
+ let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$2);
3318
+ let res = {
3319
+ mode: "xyz65",
3320
+ x: .486570948648216 * r$1 + .265667693169093 * g + .1982172852343625 * b,
3321
+ y: .2289745640697487 * r$1 + .6917385218365062 * g + .079286914093745 * b,
3322
+ z: 0 * r$1 + .0451133818589026 * g + 1.043944368900976 * b
3323
+ };
3324
+ if (alpha !== void 0) res.alpha = alpha;
3325
+ return res;
3326
+ };
3327
+ var convertP3ToXyz65_default = convertP3ToXyz65;
3328
+
3329
+ //#endregion
3330
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/p3/convertXyz65ToP3.js
3331
+ const convertXyz65ToP3 = ({ x, y, z, alpha }) => {
3332
+ if (x === void 0) x = 0;
3333
+ if (y === void 0) y = 0;
3334
+ if (z === void 0) z = 0;
3335
+ let res = convertLrgbToRgb_default({
3336
+ r: x * 2.4934969119414263 - y * .9313836179191242 - .402710784450717 * z,
3337
+ g: x * -.8294889695615749 + y * 1.7626640603183465 + .0236246858419436 * z,
3338
+ b: x * .0358458302437845 - y * .0761723892680418 + .9568845240076871 * z
3339
+ }, "p3");
3340
+ if (alpha !== void 0) res.alpha = alpha;
3341
+ return res;
3342
+ };
3343
+ var convertXyz65ToP3_default = convertXyz65ToP3;
3344
+
3345
+ //#endregion
3346
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/p3/definition.js
3347
+ const definition$4 = {
3348
+ ...definition_default$12,
3349
+ mode: "p3",
3350
+ parse: ["display-p3"],
3351
+ serialize: "display-p3",
3352
+ fromMode: {
3353
+ rgb: (color) => convertXyz65ToP3_default(convertRgbToXyz65_default(color)),
3354
+ xyz65: convertXyz65ToP3_default
3355
+ },
3356
+ toMode: {
3357
+ rgb: (color) => convertXyz65ToRgb_default(convertP3ToXyz65_default(color)),
3358
+ xyz65: convertP3ToXyz65_default
3359
+ }
3360
+ };
3361
+ var definition_default$9 = definition$4;
3362
+
3363
+ //#endregion
3364
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/prophoto/convertXyz50ToProphoto.js
3365
+ const gamma$1 = (v) => {
3366
+ let abs = Math.abs(v);
3367
+ if (abs >= 1 / 512) return Math.sign(v) * Math.pow(abs, 1 / 1.8);
3368
+ return 16 * v;
3369
+ };
3370
+ const convertXyz50ToProphoto = ({ x, y, z, alpha }) => {
3371
+ if (x === void 0) x = 0;
3372
+ if (y === void 0) y = 0;
3373
+ if (z === void 0) z = 0;
3374
+ let res = {
3375
+ mode: "prophoto",
3376
+ r: gamma$1(x * 1.3457868816471585 - y * .2555720873797946 - .0511018649755453 * z),
3377
+ g: gamma$1(x * -.5446307051249019 + y * 1.5082477428451466 + .0205274474364214 * z),
3378
+ b: gamma$1(x * 0 + y * 0 + 1.2119675456389452 * z)
3379
+ };
3380
+ if (alpha !== void 0) res.alpha = alpha;
3381
+ return res;
3382
+ };
3383
+ var convertXyz50ToProphoto_default = convertXyz50ToProphoto;
3384
+
3385
+ //#endregion
3386
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/prophoto/convertProphotoToXyz50.js
3387
+ const linearize$1 = (v = 0) => {
3388
+ let abs = Math.abs(v);
3389
+ if (abs >= 16 / 512) return Math.sign(v) * Math.pow(abs, 1.8);
3390
+ return v / 16;
3391
+ };
3392
+ const convertProphotoToXyz50 = (prophoto) => {
3393
+ let r$1 = linearize$1(prophoto.r);
3394
+ let g = linearize$1(prophoto.g);
3395
+ let b = linearize$1(prophoto.b);
3396
+ let res = {
3397
+ mode: "xyz50",
3398
+ x: .7977666449006423 * r$1 + .1351812974005331 * g + .0313477341283922 * b,
3399
+ y: .2880748288194013 * r$1 + .7118352342418731 * g + 899369387256e-16 * b,
3400
+ z: 0 * r$1 + 0 * g + .8251046025104602 * b
3401
+ };
3402
+ if (prophoto.alpha !== void 0) res.alpha = prophoto.alpha;
3403
+ return res;
3404
+ };
3405
+ var convertProphotoToXyz50_default = convertProphotoToXyz50;
3406
+
3407
+ //#endregion
3408
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/prophoto/definition.js
3409
+ const definition$3 = {
3410
+ ...definition_default$12,
3411
+ mode: "prophoto",
3412
+ parse: ["prophoto-rgb"],
3413
+ serialize: "prophoto-rgb",
3414
+ fromMode: {
3415
+ xyz50: convertXyz50ToProphoto_default,
3416
+ rgb: (color) => convertXyz50ToProphoto_default(convertRgbToXyz50_default(color))
3417
+ },
3418
+ toMode: {
3419
+ xyz50: convertProphotoToXyz50_default,
3420
+ rgb: (color) => convertXyz50ToRgb_default(convertProphotoToXyz50_default(color))
3421
+ }
3422
+ };
3423
+ var definition_default$10 = definition$3;
3424
+
3425
+ //#endregion
3426
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rec2020/convertXyz65ToRec2020.js
3427
+ const α$1 = 1.09929682680944;
3428
+ const β$1 = .018053968510807;
3429
+ const gamma = (v) => {
3430
+ const abs = Math.abs(v);
3431
+ if (abs > β$1) return (Math.sign(v) || 1) * (α$1 * Math.pow(abs, .45) - (α$1 - 1));
3432
+ return 4.5 * v;
3433
+ };
3434
+ const convertXyz65ToRec2020 = ({ x, y, z, alpha }) => {
3435
+ if (x === void 0) x = 0;
3436
+ if (y === void 0) y = 0;
3437
+ if (z === void 0) z = 0;
3438
+ let res = {
3439
+ mode: "rec2020",
3440
+ r: gamma(x * 1.7166511879712683 - y * .3556707837763925 - .2533662813736599 * z),
3441
+ g: gamma(x * -.6666843518324893 + y * 1.6164812366349395 + .0157685458139111 * z),
3442
+ b: gamma(x * .0176398574453108 - y * .0427706132578085 + .9421031212354739 * z)
3443
+ };
3444
+ if (alpha !== void 0) res.alpha = alpha;
3445
+ return res;
3446
+ };
3447
+ var convertXyz65ToRec2020_default = convertXyz65ToRec2020;
3448
+
3449
+ //#endregion
3450
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rec2020/convertRec2020ToXyz65.js
3451
+ const α = 1.09929682680944;
3452
+ const β = .018053968510807;
3453
+ const linearize = (v = 0) => {
3454
+ let abs = Math.abs(v);
3455
+ if (abs < β * 4.5) return v / 4.5;
3456
+ return (Math.sign(v) || 1) * Math.pow((abs + α - 1) / α, 1 / .45);
3457
+ };
3458
+ const convertRec2020ToXyz65 = (rec2020) => {
3459
+ let r$1 = linearize(rec2020.r);
3460
+ let g = linearize(rec2020.g);
3461
+ let b = linearize(rec2020.b);
3462
+ let res = {
3463
+ mode: "xyz65",
3464
+ x: .6369580483012911 * r$1 + .1446169035862083 * g + .1688809751641721 * b,
3465
+ y: .262700212011267 * r$1 + .6779980715188708 * g + .059301716469862 * b,
3466
+ z: 0 * r$1 + .0280726930490874 * g + 1.0609850577107909 * b
3467
+ };
3468
+ if (rec2020.alpha !== void 0) res.alpha = rec2020.alpha;
3469
+ return res;
3470
+ };
3471
+ var convertRec2020ToXyz65_default = convertRec2020ToXyz65;
3472
+
3473
+ //#endregion
3474
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rec2020/definition.js
3475
+ const definition$2 = {
3476
+ ...definition_default$12,
3477
+ mode: "rec2020",
3478
+ fromMode: {
3479
+ xyz65: convertXyz65ToRec2020_default,
3480
+ rgb: (color) => convertXyz65ToRec2020_default(convertRgbToXyz65_default(color))
3481
+ },
3482
+ toMode: {
3483
+ xyz65: convertRec2020ToXyz65_default,
3484
+ rgb: (color) => convertXyz65ToRgb_default(convertRec2020ToXyz65_default(color))
3485
+ },
3486
+ parse: ["rec2020"],
3487
+ serialize: "rec2020"
3488
+ };
3489
+ var definition_default$11 = definition$2;
3490
+
3491
+ //#endregion
3492
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz50/definition.js
3493
+ const definition$1 = {
3494
+ mode: "xyz50",
3495
+ parse: ["xyz-d50"],
3496
+ serialize: "xyz-d50",
3497
+ toMode: {
3498
+ rgb: convertXyz50ToRgb_default,
3499
+ lab: convertXyz50ToLab_default
3500
+ },
3501
+ fromMode: {
3502
+ rgb: convertRgbToXyz50_default,
3503
+ lab: convertLabToXyz50_default
3504
+ },
3505
+ channels: [
3506
+ "x",
3507
+ "y",
3508
+ "z",
3509
+ "alpha"
3510
+ ],
3511
+ ranges: {
3512
+ x: [0, .964],
3513
+ y: [0, .999],
3514
+ z: [0, .825]
3515
+ },
3516
+ interpolate: {
3517
+ x: interpolatorLinear,
3518
+ y: interpolatorLinear,
3519
+ z: interpolatorLinear,
3520
+ alpha: {
3521
+ use: interpolatorLinear,
3522
+ fixup: fixupAlpha
3523
+ }
3524
+ }
3525
+ };
3526
+ var definition_default$13 = definition$1;
3527
+
3528
+ //#endregion
3529
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz65/convertXyz65ToXyz50.js
3530
+ const convertXyz65ToXyz50 = (xyz65) => {
3531
+ let { x, y, z, alpha } = xyz65;
3532
+ if (x === void 0) x = 0;
3533
+ if (y === void 0) y = 0;
3534
+ if (z === void 0) z = 0;
3535
+ let res = {
3536
+ mode: "xyz50",
3537
+ x: 1.0479298208405488 * x + .0229467933410191 * y - .0501922295431356 * z,
3538
+ y: .0296278156881593 * x + .990434484573249 * y - .0170738250293851 * z,
3539
+ z: -.0092430581525912 * x + .0150551448965779 * y + .7518742899580008 * z
3540
+ };
3541
+ if (alpha !== void 0) res.alpha = alpha;
3542
+ return res;
3543
+ };
3544
+ var convertXyz65ToXyz50_default = convertXyz65ToXyz50;
3545
+
3546
+ //#endregion
3547
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz65/convertXyz50ToXyz65.js
3548
+ const convertXyz50ToXyz65 = (xyz50) => {
3549
+ let { x, y, z, alpha } = xyz50;
3550
+ if (x === void 0) x = 0;
3551
+ if (y === void 0) y = 0;
3552
+ if (z === void 0) z = 0;
3553
+ let res = {
3554
+ mode: "xyz65",
3555
+ x: .9554734527042182 * x - .0230985368742614 * y + .0632593086610217 * z,
3556
+ y: -.0283697069632081 * x + 1.0099954580058226 * y + .021041398966943 * z,
3557
+ z: .0123140016883199 * x - .0205076964334779 * y + 1.3303659366080753 * z
3558
+ };
3559
+ if (alpha !== void 0) res.alpha = alpha;
3560
+ return res;
3561
+ };
3562
+ var convertXyz50ToXyz65_default = convertXyz50ToXyz65;
3563
+
3564
+ //#endregion
3565
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz65/definition.js
3566
+ const definition = {
3567
+ mode: "xyz65",
3568
+ toMode: {
3569
+ rgb: convertXyz65ToRgb_default,
3570
+ xyz50: convertXyz65ToXyz50_default
3571
+ },
3572
+ fromMode: {
3573
+ rgb: convertRgbToXyz65_default,
3574
+ xyz50: convertXyz50ToXyz65_default
3575
+ },
3576
+ ranges: {
3577
+ x: [0, .95],
3578
+ y: [0, 1],
3579
+ z: [0, 1.088]
3580
+ },
3581
+ channels: [
3582
+ "x",
3583
+ "y",
3584
+ "z",
3585
+ "alpha"
3586
+ ],
3587
+ parse: ["xyz", "xyz-d65"],
3588
+ serialize: "xyz-d65",
3589
+ interpolate: {
3590
+ x: interpolatorLinear,
3591
+ y: interpolatorLinear,
3592
+ z: interpolatorLinear,
3593
+ alpha: {
3594
+ use: interpolatorLinear,
3595
+ fixup: fixupAlpha
3596
+ }
3597
+ }
3598
+ };
3599
+ var definition_default$14 = definition;
3600
+
3601
+ //#endregion
3602
+ //#region ../../node_modules/.pnpm/wildcard-match@5.1.4/node_modules/wildcard-match/build/index.es.mjs
3603
+ /**
3604
+ * Escapes a character if it has a special meaning in regular expressions
3605
+ * and returns the character as is if it doesn't
3606
+ */
3607
+ function escapeRegExpChar(char) {
3608
+ if (char === "-" || char === "^" || char === "$" || char === "+" || char === "." || char === "(" || char === ")" || char === "|" || char === "[" || char === "]" || char === "{" || char === "}" || char === "*" || char === "?" || char === "\\") return "\\".concat(char);
3609
+ else return char;
3610
+ }
3611
+ /**
3612
+ * Escapes all characters in a given string that have a special meaning in regular expressions
3613
+ */
3614
+ function escapeRegExpString(str) {
3615
+ var result = "";
3616
+ for (var i = 0; i < str.length; i++) result += escapeRegExpChar(str[i]);
3617
+ return result;
3618
+ }
3619
+ /**
3620
+ * Transforms one or more glob patterns into a RegExp pattern
3621
+ */
3622
+ function transform(pattern, separator) {
3623
+ if (separator === void 0) separator = true;
3624
+ if (Array.isArray(pattern)) {
3625
+ var regExpPatterns = pattern.map(function(p) {
3626
+ return "^".concat(transform(p, separator), "$");
3627
+ });
3628
+ return "(?:".concat(regExpPatterns.join("|"), ")");
3629
+ }
3630
+ var separatorSplitter = "";
3631
+ var separatorMatcher = "";
3632
+ var wildcard = ".";
3633
+ if (separator === true) {
3634
+ separatorSplitter = "/";
3635
+ separatorMatcher = "[/\\\\]";
3636
+ wildcard = "[^/\\\\]";
3637
+ } else if (separator) {
3638
+ separatorSplitter = separator;
3639
+ separatorMatcher = escapeRegExpString(separatorSplitter);
3640
+ if (separatorMatcher.length > 1) {
3641
+ separatorMatcher = "(?:".concat(separatorMatcher, ")");
3642
+ wildcard = "((?!".concat(separatorMatcher, ").)");
3643
+ } else wildcard = "[^".concat(separatorMatcher, "]");
3644
+ }
3645
+ var requiredSeparator = separator ? "".concat(separatorMatcher, "+?") : "";
3646
+ var optionalSeparator = separator ? "".concat(separatorMatcher, "*?") : "";
3647
+ var segments = separator ? pattern.split(separatorSplitter) : [pattern];
3648
+ var result = "";
3649
+ for (var s = 0; s < segments.length; s++) {
3650
+ var segment = segments[s];
3651
+ var nextSegment = segments[s + 1];
3652
+ var currentSeparator = "";
3653
+ if (!segment && s > 0) continue;
3654
+ if (separator) if (s === segments.length - 1) currentSeparator = optionalSeparator;
3655
+ else if (nextSegment !== "**") currentSeparator = requiredSeparator;
3656
+ else currentSeparator = "";
3657
+ if (separator && segment === "**") {
3658
+ if (currentSeparator) {
3659
+ result += s === 0 ? "" : s === segments.length - 1 ? "(?:".concat(requiredSeparator, "|$)") : requiredSeparator;
3660
+ result += "(?:".concat(wildcard, "*?").concat(currentSeparator, ")*?");
3661
+ }
3662
+ continue;
3663
+ }
3664
+ for (var c$2 = 0; c$2 < segment.length; c$2++) {
3665
+ var char = segment[c$2];
3666
+ if (char === "\\") {
3667
+ if (c$2 < segment.length - 1) {
3668
+ result += escapeRegExpChar(segment[c$2 + 1]);
3669
+ c$2++;
3670
+ }
3671
+ } else if (char === "?") result += wildcard;
3672
+ else if (char === "*") result += "".concat(wildcard, "*?");
3673
+ else result += escapeRegExpChar(char);
3674
+ }
3675
+ result += currentSeparator;
3676
+ }
3677
+ return result;
3678
+ }
3679
+ function isMatch(regexp, sample) {
3680
+ if (typeof sample !== "string") throw new TypeError("Sample must be a string, but ".concat(typeof sample, " given"));
3681
+ return regexp.test(sample);
3682
+ }
1
3683
  /**
2
- * @module @terrazzo/plugin-sass
3
- * @license MIT License
4
- *
5
- * Copyright (c) 2021 Drew Powers
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
- import build from './build.js';
26
- export * from './lib.js';
27
- export default function pluginSass(options) {
28
- const filename = options?.filename ?? 'index.scss';
29
- return {
30
- name: '@terrazzo/plugin-sass',
31
- enforce: 'post',
32
- config(config) {
33
- // plugin-css is required for transforms. throw error
34
- if (!config.plugins.some((p) => p.name === '@terrazzo/plugin-css')) {
35
- throw new Error(`@terrazzo/plugin-sass relies on @terrazzo/plugin-css.
3684
+ * Compiles one or more glob patterns into a RegExp and returns an isMatch function.
3685
+ * The isMatch function takes a sample string as its only argument and returns `true`
3686
+ * if the string matches the pattern(s).
3687
+ *
3688
+ * ```js
3689
+ * wildcardMatch('src/*.js')('src/index.js') //=> true
3690
+ * ```
3691
+ *
3692
+ * ```js
3693
+ * const isMatch = wildcardMatch('*.example.com', '.')
3694
+ * isMatch('foo.example.com') //=> true
3695
+ * isMatch('foo.bar.com') //=> false
3696
+ * ```
3697
+ */
3698
+ function wildcardMatch(pattern, options) {
3699
+ if (typeof pattern !== "string" && !Array.isArray(pattern)) throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof pattern, " given"));
3700
+ if (typeof options === "string" || typeof options === "boolean") options = { separator: options };
3701
+ if (arguments.length === 2 && !(typeof options === "undefined" || typeof options === "object" && options !== null && !Array.isArray(options))) throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof options, " given"));
3702
+ options = options || {};
3703
+ if (options.separator === "\\") throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");
3704
+ var regexpPattern = transform(pattern, options.separator);
3705
+ var regexp = new RegExp("^".concat(regexpPattern, "$"), options.flags);
3706
+ var fn$4 = isMatch.bind(null, regexp);
3707
+ fn$4.options = options;
3708
+ fn$4.pattern = pattern;
3709
+ fn$4.regexp = regexp;
3710
+ return fn$4;
3711
+ }
3712
+
3713
+ //#endregion
3714
+ //#region ../token-tools/dist/index.js
3715
+ /** Match token against globs */
3716
+ function isTokenMatch(tokenID, globPatterns) {
3717
+ return wildcardMatch(globPatterns)(tokenID);
3718
+ }
3719
+
3720
+ //#endregion
3721
+ //#region ../token-tools/dist/css.js
3722
+ const CSS_VAR_RE = /(?:(\p{Uppercase_Letter}?[\p{Lowercase_Letter}\p{Number}]+|[\p{Uppercase_Letter}\p{Number}]+|[\u{80}-\u{10FFFF}\p{Number}]+)|.)/u;
3723
+ /**
3724
+ * Generate a valid CSS variable from any string
3725
+ * Code by @dfrankland
3726
+ */
3727
+ function makeCSSVar(name, { prefix, wrapVar = false } = {}) {
3728
+ if (typeof name !== "string") throw new Error(`makeCSSVar() Expected string, received ${name}`);
3729
+ let property = name.split(CSS_VAR_RE).filter(Boolean).join("-");
3730
+ if (prefix && !property.startsWith(`${prefix}-`)) property = `${prefix}-${property}`;
3731
+ const finalProperty = `--${property}`.toLocaleLowerCase();
3732
+ return wrapVar ? `var(${finalProperty})` : finalProperty;
3733
+ }
3734
+ const converters = {
3735
+ a98: useMode(definition_default),
3736
+ hsl: useMode(definition_default$1),
3737
+ hsv: useMode(definition_default$2),
3738
+ hwb: useMode(definition_default$3),
3739
+ lab: useMode(definition_default$4),
3740
+ lch: useMode(definition_default$5),
3741
+ lrgb: useMode(definition_default$6),
3742
+ oklab: useMode(definition_default$7),
3743
+ oklch: useMode(definition_default$8),
3744
+ p3: useMode(definition_default$9),
3745
+ prophoto: useMode(definition_default$10),
3746
+ rec2020: useMode(definition_default$11),
3747
+ rgb: useMode(definition_default$12),
3748
+ xyz50: useMode(definition_default$13),
3749
+ xyz65: useMode(definition_default$14)
3750
+ };
3751
+
3752
+ //#endregion
3753
+ //#region src/lib.ts
3754
+ const FILE_HEADER = `////
3755
+ /// Autogenerated by ⛋ Terrazzo. DO NOT EDIT!
3756
+ ////
3757
+
3758
+ @use "sass:list";
3759
+ @use "sass:map";`;
3760
+ const MIXIN_TOKEN = `@function token($tokenName) {
3761
+ @if map.has-key($__token-values, $tokenName) == false {
3762
+ @error 'No token named "#{$tokenName}"';
3763
+ }
3764
+ $_token: map.get($__token-values, $tokenName);
3765
+ @if map.has-key($_token, "__tz-error") {
3766
+ @error map.get($_token, "__tz-error");
3767
+ }
3768
+ @return map.get($_token);
3769
+ }`;
3770
+ const MIXIN_TYPOGRAPHY = `@mixin typography($tokenName, $modeName: ".") {
3771
+ @if map.has-key($__token-typography-mixins, $tokenName) == false {
3772
+ @error 'No typography mixin named "#{$tokenName}"';
3773
+ }
3774
+ $_mixin: map.get($__token-typography-mixins, $tokenName);
3775
+ $_properties: map.get($_mixin, ".");
3776
+ @if map.has-key($_mixin) {
3777
+ $_properties: map.get($_mixin);
3778
+ }
3779
+ @each $_property, $_value in $_properties {
3780
+ #{$_property}: #{$_value};
3781
+ }
3782
+ }`;
3783
+
3784
+ //#endregion
3785
+ //#region src/build.ts
3786
+ function build({ getTransforms, options }) {
3787
+ const tokens = getTransforms({
3788
+ format: FORMAT_ID,
3789
+ id: "*",
3790
+ mode: "."
3791
+ });
3792
+ const output = [FILE_HEADER, ""];
3793
+ output.push("$__token-values: (");
3794
+ for (const token of tokens) {
3795
+ if (isTokenMatch(token.token.id, options?.exclude ?? [])) continue;
3796
+ if (token.token.$type === "typography") output.push(` "${token.token.id}": (
3797
+ "__tz-error": 'This is a typography mixin. Use \`@include typography("${token.token.id}")\` instead.',
3798
+ ),`);
3799
+ else {
3800
+ const name = token.localID ?? token.token.id;
3801
+ output.push(` "${token.token.id}": (${makeCSSVar(name, { wrapVar: true })}),`);
3802
+ }
3803
+ }
3804
+ output.push(");", "");
3805
+ output.push("$__token-typography-mixins: (");
3806
+ const typographyTokens = getTransforms({
3807
+ format: "css",
3808
+ id: "*",
3809
+ mode: ".",
3810
+ $type: "typography"
3811
+ });
3812
+ for (const token of typographyTokens) {
3813
+ output.push(` "${token.token.id}": (`);
3814
+ for (const property of Object.keys(token.value)) {
3815
+ const name = `${token.localID ?? token.token.id}-${property}`;
3816
+ output.push(` "${property}": (${makeCSSVar(name, { wrapVar: true })}),`);
3817
+ }
3818
+ output.push(" ),");
3819
+ }
3820
+ output.push(");", "");
3821
+ output.push(MIXIN_TOKEN, "", MIXIN_TYPOGRAPHY, "");
3822
+ return output.join("\n");
3823
+ }
3824
+
3825
+ //#endregion
3826
+ //#region src/index.ts
3827
+ function pluginSass(options) {
3828
+ const filename = options?.filename ?? "index.scss";
3829
+ return {
3830
+ name: "@terrazzo/plugin-sass",
3831
+ enforce: "post",
3832
+ config(config) {
3833
+ if (!config.plugins.some((p) => p.name === "@terrazzo/plugin-css")) throw new Error(`@terrazzo/plugin-sass relies on @terrazzo/plugin-css.
36
3834
  Please install @terrazzo/plugin-css and follow setup to add to your config.`);
37
- }
38
- },
39
- async build({ getTransforms, outputFile }) {
40
- const output = build({ getTransforms, options });
41
- outputFile(filename, output);
42
- },
43
- };
3835
+ },
3836
+ async build({ getTransforms, outputFile }) {
3837
+ const output = build({
3838
+ getTransforms,
3839
+ options
3840
+ });
3841
+ outputFile(filename, output);
3842
+ }
3843
+ };
44
3844
  }
3845
+
3846
+ //#endregion
3847
+ export { FILE_HEADER, MIXIN_TOKEN, MIXIN_TYPOGRAPHY, pluginSass as default };
45
3848
  //# sourceMappingURL=index.js.map