@mkbabb/keyframes.js 0.9.97 → 1.0.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.
@@ -0,0 +1,4645 @@
1
+ const pn = 16.666666666666668, Te = (e) => !!e && e.constructor === Object;
2
+ function ct(e) {
3
+ return Te(e) ? Object.entries(e).map(([t, n]) => [t, ct(n)]).reduce((t, [n, r]) => (t[n] = r, t), {}) : e != null && typeof e.clone == "function" ? e.clone() : Array.isArray(e) ? e.map(ct) : e;
4
+ }
5
+ async function os(e) {
6
+ return await new Promise((t) => setTimeout(t, e));
7
+ }
8
+ function Q(e, t = {}) {
9
+ const n = /* @__PURE__ */ new Map(), { maxCacheSize: r = 1 / 0, ttl: s = 1 / 0, keyFn: i = JSON.stringify } = t, o = function(...a) {
10
+ const c = i.apply(this, a), l = Date.now();
11
+ if (n.has(c)) {
12
+ const h = n.get(c);
13
+ if (l - h.timestamp <= s)
14
+ return h.value;
15
+ n.delete(c);
16
+ }
17
+ const u = e.apply(this, a);
18
+ if (n.set(c, { value: u, timestamp: l }), n.size > r) {
19
+ const h = n.keys().next().value;
20
+ n.delete(h);
21
+ }
22
+ return u;
23
+ };
24
+ return o.cache = n, o;
25
+ }
26
+ const as = (e) => e.replace(
27
+ /([-_][a-z])/gi,
28
+ (t) => t.toUpperCase().replace("-", "").replace("_", "")
29
+ );
30
+ function cs(e) {
31
+ return e.replace(/([A-Z])/g, (t) => `-${t[0].toLowerCase()}`);
32
+ }
33
+ function mn(e, t, n) {
34
+ for (let r = e - 1; r >= 0; r--)
35
+ if (n(t[r]))
36
+ return r;
37
+ }
38
+ function vt(e) {
39
+ if (typeof window < "u" && window.requestAnimationFrame)
40
+ return window.requestAnimationFrame(e);
41
+ let t = pn, n = Date.now();
42
+ return setTimeout(() => {
43
+ let r = Date.now(), s = r - n;
44
+ n = r, t = Math.max(0, pn - s), e(r);
45
+ }, t);
46
+ }
47
+ function er(e) {
48
+ if (typeof window < "u" && window.cancelAnimationFrame)
49
+ return window.cancelAnimationFrame(e);
50
+ clearTimeout(e);
51
+ }
52
+ const nr = ["px", "cm", "mm", "Q", "in", "pc", "pt"], rr = [
53
+ "em",
54
+ "ex",
55
+ "ch",
56
+ "rem",
57
+ "lh",
58
+ "rlh",
59
+ "vw",
60
+ "vh",
61
+ "vmin",
62
+ "vmax",
63
+ "vb",
64
+ "vi",
65
+ "svw",
66
+ "svh",
67
+ "lvw",
68
+ "lvh",
69
+ "dvw",
70
+ "dvh"
71
+ ], ls = [
72
+ ...nr,
73
+ ...rr
74
+ ], us = ["s", "ms"], hs = ["deg", "rad", "grad", "turn"], ps = ["%"], ms = ["dpi", "dpcm", "dppx", "cqw"], ye = ["var", "calc"], fs = ["string", "var", "calc"], ds = [
75
+ "accentColor",
76
+ "additiveSymbols",
77
+ "alignContent",
78
+ "alignItems",
79
+ "alignSelf",
80
+ "alignmentBaseline",
81
+ "all",
82
+ "anchorName",
83
+ "animation",
84
+ "animationComposition",
85
+ "animationDelay",
86
+ "animationDirection",
87
+ "animationDuration",
88
+ "animationFillMode",
89
+ "animationIterationCount",
90
+ "animationName",
91
+ "animationPlayState",
92
+ "animationRange",
93
+ "animationRangeEnd",
94
+ "animationRangeStart",
95
+ "animationTimeline",
96
+ "animationTimingFunction",
97
+ "appRegion",
98
+ "appearance",
99
+ "ascentOverride",
100
+ "aspectRatio",
101
+ "backdropFilter",
102
+ "backfaceVisibility",
103
+ "background",
104
+ "backgroundAttachment",
105
+ "backgroundBlendMode",
106
+ "backgroundClip",
107
+ "backgroundColor",
108
+ "backgroundImage",
109
+ "backgroundOrigin",
110
+ "backgroundPosition",
111
+ "backgroundPositionX",
112
+ "backgroundPositionY",
113
+ "backgroundRepeat",
114
+ "backgroundSize",
115
+ "basePalette",
116
+ "baselineShift",
117
+ "baselineSource",
118
+ "blockSize",
119
+ "border",
120
+ "borderBlock",
121
+ "borderBlockColor",
122
+ "borderBlockEnd",
123
+ "borderBlockEndColor",
124
+ "borderBlockEndStyle",
125
+ "borderBlockEndWidth",
126
+ "borderBlockStart",
127
+ "borderBlockStartColor",
128
+ "borderBlockStartStyle",
129
+ "borderBlockStartWidth",
130
+ "borderBlockStyle",
131
+ "borderBlockWidth",
132
+ "borderBottom",
133
+ "borderBottomColor",
134
+ "borderBottomLeftRadius",
135
+ "borderBottomRightRadius",
136
+ "borderBottomStyle",
137
+ "borderBottomWidth",
138
+ "borderCollapse",
139
+ "borderColor",
140
+ "borderEndEndRadius",
141
+ "borderEndStartRadius",
142
+ "borderImage",
143
+ "borderImageOutset",
144
+ "borderImageRepeat",
145
+ "borderImageSlice",
146
+ "borderImageSource",
147
+ "borderImageWidth",
148
+ "borderInline",
149
+ "borderInlineColor",
150
+ "borderInlineEnd",
151
+ "borderInlineEndColor",
152
+ "borderInlineEndStyle",
153
+ "borderInlineEndWidth",
154
+ "borderInlineStart",
155
+ "borderInlineStartColor",
156
+ "borderInlineStartStyle",
157
+ "borderInlineStartWidth",
158
+ "borderInlineStyle",
159
+ "borderInlineWidth",
160
+ "borderLeft",
161
+ "borderLeftColor",
162
+ "borderLeftStyle",
163
+ "borderLeftWidth",
164
+ "borderRadius",
165
+ "borderRight",
166
+ "borderRightColor",
167
+ "borderRightStyle",
168
+ "borderRightWidth",
169
+ "borderSpacing",
170
+ "borderStartEndRadius",
171
+ "borderStartStartRadius",
172
+ "borderStyle",
173
+ "borderTop",
174
+ "borderTopColor",
175
+ "borderTopLeftRadius",
176
+ "borderTopRightRadius",
177
+ "borderTopStyle",
178
+ "borderTopWidth",
179
+ "borderWidth",
180
+ "bottom",
181
+ "boxShadow",
182
+ "boxSizing",
183
+ "breakAfter",
184
+ "breakBefore",
185
+ "breakInside",
186
+ "bufferedRendering",
187
+ "captionSide",
188
+ "caretColor",
189
+ "clear",
190
+ "clip",
191
+ "clipPath",
192
+ "clipRule",
193
+ "color",
194
+ "colorInterpolation",
195
+ "colorInterpolationFilters",
196
+ "colorRendering",
197
+ "colorScheme",
198
+ "columnCount",
199
+ "columnFill",
200
+ "columnGap",
201
+ "columnRule",
202
+ "columnRuleColor",
203
+ "columnRuleStyle",
204
+ "columnRuleWidth",
205
+ "columnSpan",
206
+ "columnWidth",
207
+ "columns",
208
+ "contain",
209
+ "containIntrinsicBlockSize",
210
+ "containIntrinsicHeight",
211
+ "containIntrinsicInlineSize",
212
+ "containIntrinsicSize",
213
+ "containIntrinsicWidth",
214
+ "container",
215
+ "containerName",
216
+ "containerType",
217
+ "content",
218
+ "contentVisibility",
219
+ "counterIncrement",
220
+ "counterReset",
221
+ "counterSet",
222
+ "cursor",
223
+ "cx",
224
+ "cy",
225
+ "d",
226
+ "descentOverride",
227
+ "direction",
228
+ "display",
229
+ "dominantBaseline",
230
+ "emptyCells",
231
+ "fallback",
232
+ "fieldSizing",
233
+ "fill",
234
+ "fillOpacity",
235
+ "fillRule",
236
+ "filter",
237
+ "flex",
238
+ "flexBasis",
239
+ "flexDirection",
240
+ "flexFlow",
241
+ "flexGrow",
242
+ "flexShrink",
243
+ "flexWrap",
244
+ "float",
245
+ "floodColor",
246
+ "floodOpacity",
247
+ "font",
248
+ "fontDisplay",
249
+ "fontFamily",
250
+ "fontFeatureSettings",
251
+ "fontKerning",
252
+ "fontOpticalSizing",
253
+ "fontPalette",
254
+ "fontSize",
255
+ "fontStretch",
256
+ "fontStyle",
257
+ "fontSynthesis",
258
+ "fontSynthesisSmallCaps",
259
+ "fontSynthesisStyle",
260
+ "fontSynthesisWeight",
261
+ "fontVariant",
262
+ "fontVariantAlternates",
263
+ "fontVariantCaps",
264
+ "fontVariantEastAsian",
265
+ "fontVariantLigatures",
266
+ "fontVariantNumeric",
267
+ "fontVariantPosition",
268
+ "fontVariationSettings",
269
+ "fontWeight",
270
+ "forcedColorAdjust",
271
+ "gap",
272
+ "grid",
273
+ "gridArea",
274
+ "gridAutoColumns",
275
+ "gridAutoFlow",
276
+ "gridAutoRows",
277
+ "gridColumn",
278
+ "gridColumnEnd",
279
+ "gridColumnGap",
280
+ "gridColumnStart",
281
+ "gridGap",
282
+ "gridRow",
283
+ "gridRowEnd",
284
+ "gridRowGap",
285
+ "gridRowStart",
286
+ "gridTemplate",
287
+ "gridTemplateAreas",
288
+ "gridTemplateColumns",
289
+ "gridTemplateRows",
290
+ "height",
291
+ "hyphenateCharacter",
292
+ "hyphenateLimitChars",
293
+ "hyphens",
294
+ "imageOrientation",
295
+ "imageRendering",
296
+ "inherits",
297
+ "initialLetter",
298
+ "initialValue",
299
+ "inlineSize",
300
+ "inset",
301
+ "insetArea",
302
+ "insetBlock",
303
+ "insetBlockEnd",
304
+ "insetBlockStart",
305
+ "insetInline",
306
+ "insetInlineEnd",
307
+ "insetInlineStart",
308
+ "isolation",
309
+ "justifyContent",
310
+ "justifyItems",
311
+ "justifySelf",
312
+ "left",
313
+ "letterSpacing",
314
+ "lightingColor",
315
+ "lineBreak",
316
+ "lineGapOverride",
317
+ "lineHeight",
318
+ "listStyle",
319
+ "listStyleImage",
320
+ "listStylePosition",
321
+ "listStyleType",
322
+ "margin",
323
+ "marginBlock",
324
+ "marginBlockEnd",
325
+ "marginBlockStart",
326
+ "marginBottom",
327
+ "marginInline",
328
+ "marginInlineEnd",
329
+ "marginInlineStart",
330
+ "marginLeft",
331
+ "marginRight",
332
+ "marginTop",
333
+ "marker",
334
+ "markerEnd",
335
+ "markerMid",
336
+ "markerStart",
337
+ "mask",
338
+ "maskClip",
339
+ "maskComposite",
340
+ "maskImage",
341
+ "maskMode",
342
+ "maskOrigin",
343
+ "maskPosition",
344
+ "maskRepeat",
345
+ "maskSize",
346
+ "maskType",
347
+ "mathDepth",
348
+ "mathShift",
349
+ "mathStyle",
350
+ "maxBlockSize",
351
+ "maxHeight",
352
+ "maxInlineSize",
353
+ "maxWidth",
354
+ "minBlockSize",
355
+ "minHeight",
356
+ "minInlineSize",
357
+ "minWidth",
358
+ "mixBlendMode",
359
+ "navigation",
360
+ "negative",
361
+ "objectFit",
362
+ "objectPosition",
363
+ "objectViewBox",
364
+ "offset",
365
+ "offsetAnchor",
366
+ "offsetDistance",
367
+ "offsetPath",
368
+ "offsetPosition",
369
+ "offsetRotate",
370
+ "opacity",
371
+ "order",
372
+ "orphans",
373
+ "outline",
374
+ "outlineColor",
375
+ "outlineOffset",
376
+ "outlineStyle",
377
+ "outlineWidth",
378
+ "overflow",
379
+ "overflowAnchor",
380
+ "overflowClipMargin",
381
+ "overflowWrap",
382
+ "overflowX",
383
+ "overflowY",
384
+ "overlay",
385
+ "overrideColors",
386
+ "overscrollBehavior",
387
+ "overscrollBehaviorBlock",
388
+ "overscrollBehaviorInline",
389
+ "overscrollBehaviorX",
390
+ "overscrollBehaviorY",
391
+ "pad",
392
+ "padding",
393
+ "paddingBlock",
394
+ "paddingBlockEnd",
395
+ "paddingBlockStart",
396
+ "paddingBottom",
397
+ "paddingInline",
398
+ "paddingInlineEnd",
399
+ "paddingInlineStart",
400
+ "paddingLeft",
401
+ "paddingRight",
402
+ "paddingTop",
403
+ "page",
404
+ "pageBreakAfter",
405
+ "pageBreakBefore",
406
+ "pageBreakInside",
407
+ "pageOrientation",
408
+ "paintOrder",
409
+ "perspective",
410
+ "perspectiveOrigin",
411
+ "placeContent",
412
+ "placeItems",
413
+ "placeSelf",
414
+ "pointerEvents",
415
+ "position",
416
+ "positionAnchor",
417
+ "positionTry",
418
+ "positionTryOptions",
419
+ "positionTryOrder",
420
+ "positionVisibility",
421
+ "prefix",
422
+ "quotes",
423
+ "r",
424
+ "range",
425
+ "resize",
426
+ "right",
427
+ "rotate",
428
+ "rowGap",
429
+ "rubyPosition",
430
+ "rx",
431
+ "ry",
432
+ "scale",
433
+ "scrollBehavior",
434
+ "scrollMargin",
435
+ "scrollMarginBlock",
436
+ "scrollMarginBlockEnd",
437
+ "scrollMarginBlockStart",
438
+ "scrollMarginBottom",
439
+ "scrollMarginInline",
440
+ "scrollMarginInlineEnd",
441
+ "scrollMarginInlineStart",
442
+ "scrollMarginLeft",
443
+ "scrollMarginRight",
444
+ "scrollMarginTop",
445
+ "scrollPadding",
446
+ "scrollPaddingBlock",
447
+ "scrollPaddingBlockEnd",
448
+ "scrollPaddingBlockStart",
449
+ "scrollPaddingBottom",
450
+ "scrollPaddingInline",
451
+ "scrollPaddingInlineEnd",
452
+ "scrollPaddingInlineStart",
453
+ "scrollPaddingLeft",
454
+ "scrollPaddingRight",
455
+ "scrollPaddingTop",
456
+ "scrollSnapAlign",
457
+ "scrollSnapStop",
458
+ "scrollSnapType",
459
+ "scrollTimeline",
460
+ "scrollTimelineAxis",
461
+ "scrollTimelineName",
462
+ "scrollbarColor",
463
+ "scrollbarGutter",
464
+ "scrollbarWidth",
465
+ "shapeImageThreshold",
466
+ "shapeMargin",
467
+ "shapeOutside",
468
+ "shapeRendering",
469
+ "size",
470
+ "sizeAdjust",
471
+ "speak",
472
+ "speakAs",
473
+ "src",
474
+ "stopColor",
475
+ "stopOpacity",
476
+ "stroke",
477
+ "strokeDasharray",
478
+ "strokeDashoffset",
479
+ "strokeLinecap",
480
+ "strokeLinejoin",
481
+ "strokeMiterlimit",
482
+ "strokeOpacity",
483
+ "strokeWidth",
484
+ "suffix",
485
+ "symbols",
486
+ "syntax",
487
+ "system",
488
+ "tabSize",
489
+ "tableLayout",
490
+ "textAlign",
491
+ "textAlignLast",
492
+ "textAnchor",
493
+ "textCombineUpright",
494
+ "textDecoration",
495
+ "textDecorationColor",
496
+ "textDecorationLine",
497
+ "textDecorationSkipInk",
498
+ "textDecorationStyle",
499
+ "textDecorationThickness",
500
+ "textEmphasis",
501
+ "textEmphasisColor",
502
+ "textEmphasisPosition",
503
+ "textEmphasisStyle",
504
+ "textIndent",
505
+ "textOrientation",
506
+ "textOverflow",
507
+ "textRendering",
508
+ "textShadow",
509
+ "textSizeAdjust",
510
+ "textSpacingTrim",
511
+ "textTransform",
512
+ "textUnderlineOffset",
513
+ "textUnderlinePosition",
514
+ "textWrap",
515
+ "timelineScope",
516
+ "top",
517
+ "touchAction",
518
+ "transform",
519
+ "transformBox",
520
+ "transformOrigin",
521
+ "transformStyle",
522
+ "transition",
523
+ "transitionBehavior",
524
+ "transitionDelay",
525
+ "transitionDuration",
526
+ "transitionProperty",
527
+ "transitionTimingFunction",
528
+ "translate",
529
+ "types",
530
+ "unicodeBidi",
531
+ "unicodeRange",
532
+ "userSelect",
533
+ "vectorEffect",
534
+ "verticalAlign",
535
+ "viewTimeline",
536
+ "viewTimelineAxis",
537
+ "viewTimelineInset",
538
+ "viewTimelineName",
539
+ "viewTransitionClass",
540
+ "viewTransitionName",
541
+ "visibility",
542
+ "webkitAlignContent",
543
+ "webkitAlignItems",
544
+ "webkitAlignSelf",
545
+ "webkitAnimation",
546
+ "webkitAnimationDelay",
547
+ "webkitAnimationDirection",
548
+ "webkitAnimationDuration",
549
+ "webkitAnimationFillMode",
550
+ "webkitAnimationIterationCount",
551
+ "webkitAnimationName",
552
+ "webkitAnimationPlayState",
553
+ "webkitAnimationTimingFunction",
554
+ "webkitAppRegion",
555
+ "webkitAppearance",
556
+ "webkitBackfaceVisibility",
557
+ "webkitBackgroundClip",
558
+ "webkitBackgroundOrigin",
559
+ "webkitBackgroundSize",
560
+ "webkitBorderAfter",
561
+ "webkitBorderAfterColor",
562
+ "webkitBorderAfterStyle",
563
+ "webkitBorderAfterWidth",
564
+ "webkitBorderBefore",
565
+ "webkitBorderBeforeColor",
566
+ "webkitBorderBeforeStyle",
567
+ "webkitBorderBeforeWidth",
568
+ "webkitBorderBottomLeftRadius",
569
+ "webkitBorderBottomRightRadius",
570
+ "webkitBorderEnd",
571
+ "webkitBorderEndColor",
572
+ "webkitBorderEndStyle",
573
+ "webkitBorderEndWidth",
574
+ "webkitBorderHorizontalSpacing",
575
+ "webkitBorderImage",
576
+ "webkitBorderRadius",
577
+ "webkitBorderStart",
578
+ "webkitBorderStartColor",
579
+ "webkitBorderStartStyle",
580
+ "webkitBorderStartWidth",
581
+ "webkitBorderTopLeftRadius",
582
+ "webkitBorderTopRightRadius",
583
+ "webkitBorderVerticalSpacing",
584
+ "webkitBoxAlign",
585
+ "webkitBoxDecorationBreak",
586
+ "webkitBoxDirection",
587
+ "webkitBoxFlex",
588
+ "webkitBoxOrdinalGroup",
589
+ "webkitBoxOrient",
590
+ "webkitBoxPack",
591
+ "webkitBoxReflect",
592
+ "webkitBoxShadow",
593
+ "webkitBoxSizing",
594
+ "webkitClipPath",
595
+ "webkitColumnBreakAfter",
596
+ "webkitColumnBreakBefore",
597
+ "webkitColumnBreakInside",
598
+ "webkitColumnCount",
599
+ "webkitColumnGap",
600
+ "webkitColumnRule",
601
+ "webkitColumnRuleColor",
602
+ "webkitColumnRuleStyle",
603
+ "webkitColumnRuleWidth",
604
+ "webkitColumnSpan",
605
+ "webkitColumnWidth",
606
+ "webkitColumns",
607
+ "webkitFilter",
608
+ "webkitFlex",
609
+ "webkitFlexBasis",
610
+ "webkitFlexDirection",
611
+ "webkitFlexFlow",
612
+ "webkitFlexGrow",
613
+ "webkitFlexShrink",
614
+ "webkitFlexWrap",
615
+ "webkitFontFeatureSettings",
616
+ "webkitFontSmoothing",
617
+ "webkitHyphenateCharacter",
618
+ "webkitJustifyContent",
619
+ "webkitLineBreak",
620
+ "webkitLineClamp",
621
+ "webkitLocale",
622
+ "webkitLogicalHeight",
623
+ "webkitLogicalWidth",
624
+ "webkitMarginAfter",
625
+ "webkitMarginBefore",
626
+ "webkitMarginEnd",
627
+ "webkitMarginStart",
628
+ "webkitMask",
629
+ "webkitMaskBoxImage",
630
+ "webkitMaskBoxImageOutset",
631
+ "webkitMaskBoxImageRepeat",
632
+ "webkitMaskBoxImageSlice",
633
+ "webkitMaskBoxImageSource",
634
+ "webkitMaskBoxImageWidth",
635
+ "webkitMaskClip",
636
+ "webkitMaskComposite",
637
+ "webkitMaskImage",
638
+ "webkitMaskOrigin",
639
+ "webkitMaskPosition",
640
+ "webkitMaskPositionX",
641
+ "webkitMaskPositionY",
642
+ "webkitMaskRepeat",
643
+ "webkitMaskSize",
644
+ "webkitMaxLogicalHeight",
645
+ "webkitMaxLogicalWidth",
646
+ "webkitMinLogicalHeight",
647
+ "webkitMinLogicalWidth",
648
+ "webkitOpacity",
649
+ "webkitOrder",
650
+ "webkitPaddingAfter",
651
+ "webkitPaddingBefore",
652
+ "webkitPaddingEnd",
653
+ "webkitPaddingStart",
654
+ "webkitPerspective",
655
+ "webkitPerspectiveOrigin",
656
+ "webkitPerspectiveOriginX",
657
+ "webkitPerspectiveOriginY",
658
+ "webkitPrintColorAdjust",
659
+ "webkitRtlOrdering",
660
+ "webkitRubyPosition",
661
+ "webkitShapeImageThreshold",
662
+ "webkitShapeMargin",
663
+ "webkitShapeOutside",
664
+ "webkitTapHighlightColor",
665
+ "webkitTextCombine",
666
+ "webkitTextDecorationsInEffect",
667
+ "webkitTextEmphasis",
668
+ "webkitTextEmphasisColor",
669
+ "webkitTextEmphasisPosition",
670
+ "webkitTextEmphasisStyle",
671
+ "webkitTextFillColor",
672
+ "webkitTextOrientation",
673
+ "webkitTextSecurity",
674
+ "webkitTextSizeAdjust",
675
+ "webkitTextStroke",
676
+ "webkitTextStrokeColor",
677
+ "webkitTextStrokeWidth",
678
+ "webkitTransform",
679
+ "webkitTransformOrigin",
680
+ "webkitTransformOriginX",
681
+ "webkitTransformOriginY",
682
+ "webkitTransformOriginZ",
683
+ "webkitTransformStyle",
684
+ "webkitTransition",
685
+ "webkitTransitionDelay",
686
+ "webkitTransitionDuration",
687
+ "webkitTransitionProperty",
688
+ "webkitTransitionTimingFunction",
689
+ "webkitUserDrag",
690
+ "webkitUserModify",
691
+ "webkitUserSelect",
692
+ "webkitWritingMode",
693
+ "whiteSpace",
694
+ "whiteSpaceCollapse",
695
+ "widows",
696
+ "width",
697
+ "willChange",
698
+ "wordBreak",
699
+ "wordSpacing",
700
+ "wordWrap",
701
+ "writingMode",
702
+ "x",
703
+ "y",
704
+ "zIndex",
705
+ "zoom"
706
+ ], fn = (e, t = 2) => typeof e == "number" && Number.isNaN(e) ? "none" : String(e?.toFixed?.(t) ?? e).trim().replace(/\.0+$/, ""), dn = (e, t, n) => `${e}(${t.join(" ")} / ${n})`;
707
+ let H = class {
708
+ constructor(e, t = 1) {
709
+ this.colorSpace = e, this.alpha = t, this.components = /* @__PURE__ */ new Map();
710
+ }
711
+ components;
712
+ toString() {
713
+ const e = Array.from(this.components.values()).map(
714
+ (n) => typeof n == "number" && Number.isNaN(n) ? "none" : n
715
+ ), t = typeof this.alpha == "number" && Number.isNaN(this.alpha) ? "none" : this.alpha;
716
+ return dn(this.colorSpace, e, t);
717
+ }
718
+ toFormattedString(e = 2) {
719
+ const t = Array.from(this.components.values()).map(
720
+ (r) => fn(r, e)
721
+ ), n = fn(this.alpha, e);
722
+ return dn(this.colorSpace, t, n);
723
+ }
724
+ valueOf() {
725
+ return [...this.values(), this.alpha];
726
+ }
727
+ toJSON() {
728
+ const e = {};
729
+ for (const [t, n] of this.entries())
730
+ e[t] = n;
731
+ return e.alpha = this.alpha, e;
732
+ }
733
+ clone() {
734
+ const e = this.constructor, t = new e();
735
+ return t.alpha = ct(this.alpha), this.components.forEach((n, r) => {
736
+ t.components.set(r, ct(n));
737
+ }), t;
738
+ }
739
+ keys() {
740
+ return [...this.components.keys(), "alpha"];
741
+ }
742
+ values() {
743
+ return [...this.components.values(), this.alpha];
744
+ }
745
+ entries() {
746
+ return [...this.components.entries(), ["alpha", this.alpha]];
747
+ }
748
+ getComponent(e) {
749
+ return this.components.get(e);
750
+ }
751
+ setComponent(e, t) {
752
+ this.components.set(e, t);
753
+ }
754
+ };
755
+ class Pe extends H {
756
+ constructor(t, n, r) {
757
+ super(t, n), this.whitePoint = r;
758
+ }
759
+ }
760
+ class q extends H {
761
+ constructor(t, n, r, s) {
762
+ super("rgb", s), this.components.set("r", t), this.components.set("g", n), this.components.set("b", r);
763
+ }
764
+ get r() {
765
+ return this.getComponent("r");
766
+ }
767
+ set r(t) {
768
+ this.setComponent("r", t);
769
+ }
770
+ get g() {
771
+ return this.getComponent("g");
772
+ }
773
+ set g(t) {
774
+ this.setComponent("g", t);
775
+ }
776
+ get b() {
777
+ return this.getComponent("b");
778
+ }
779
+ set b(t) {
780
+ this.setComponent("b", t);
781
+ }
782
+ }
783
+ class jt extends H {
784
+ constructor(t, n, r, s) {
785
+ super("hsl", s), this.components.set("h", t), this.components.set("s", n), this.components.set("l", r);
786
+ }
787
+ get h() {
788
+ return this.getComponent("h");
789
+ }
790
+ set h(t) {
791
+ this.setComponent("h", t);
792
+ }
793
+ get s() {
794
+ return this.getComponent("s");
795
+ }
796
+ set s(t) {
797
+ this.setComponent("s", t);
798
+ }
799
+ get l() {
800
+ return this.getComponent("l");
801
+ }
802
+ set l(t) {
803
+ this.setComponent("l", t);
804
+ }
805
+ }
806
+ class ze extends H {
807
+ constructor(t, n, r, s) {
808
+ super("hsv", s), this.components.set("h", t), this.components.set("s", n), this.components.set("v", r);
809
+ }
810
+ get h() {
811
+ return this.getComponent("h");
812
+ }
813
+ set h(t) {
814
+ this.setComponent("h", t);
815
+ }
816
+ get s() {
817
+ return this.getComponent("s");
818
+ }
819
+ set s(t) {
820
+ this.setComponent("s", t);
821
+ }
822
+ get v() {
823
+ return this.getComponent("v");
824
+ }
825
+ set v(t) {
826
+ this.setComponent("v", t);
827
+ }
828
+ }
829
+ class Oe extends H {
830
+ constructor(t, n, r, s) {
831
+ super("hwb", s), this.components.set("h", t), this.components.set("w", n), this.components.set("b", r);
832
+ }
833
+ get h() {
834
+ return this.getComponent("h");
835
+ }
836
+ set h(t) {
837
+ this.setComponent("h", t);
838
+ }
839
+ get w() {
840
+ return this.getComponent("w");
841
+ }
842
+ set w(t) {
843
+ this.setComponent("w", t);
844
+ }
845
+ get b() {
846
+ return this.getComponent("b");
847
+ }
848
+ set b(t) {
849
+ this.setComponent("b", t);
850
+ }
851
+ }
852
+ class ee extends Pe {
853
+ constructor(t, n, r, s) {
854
+ super("lab", s, "D50"), this.components.set("l", t), this.components.set("a", n), this.components.set("b", r);
855
+ }
856
+ get l() {
857
+ return this.getComponent("l");
858
+ }
859
+ set l(t) {
860
+ this.setComponent("l", t);
861
+ }
862
+ get a() {
863
+ return this.getComponent("a");
864
+ }
865
+ set a(t) {
866
+ this.setComponent("a", t);
867
+ }
868
+ get b() {
869
+ return this.getComponent("b");
870
+ }
871
+ set b(t) {
872
+ this.setComponent("b", t);
873
+ }
874
+ }
875
+ class Ne extends H {
876
+ constructor(t, n, r, s) {
877
+ super("lch", s), this.components.set("l", t), this.components.set("c", n), this.components.set("h", r);
878
+ }
879
+ get l() {
880
+ return this.getComponent("l");
881
+ }
882
+ set l(t) {
883
+ this.setComponent("l", t);
884
+ }
885
+ get c() {
886
+ return this.getComponent("c");
887
+ }
888
+ set c(t) {
889
+ this.setComponent("c", t);
890
+ }
891
+ get h() {
892
+ return this.getComponent("h");
893
+ }
894
+ set h(t) {
895
+ this.setComponent("h", t);
896
+ }
897
+ }
898
+ class ne extends Pe {
899
+ constructor(t, n, r, s) {
900
+ super("oklab", s, "D50"), this.components.set("l", t), this.components.set("a", n), this.components.set("b", r);
901
+ }
902
+ get l() {
903
+ return this.getComponent("l");
904
+ }
905
+ set l(t) {
906
+ this.setComponent("l", t);
907
+ }
908
+ get a() {
909
+ return this.getComponent("a");
910
+ }
911
+ set a(t) {
912
+ this.setComponent("a", t);
913
+ }
914
+ get b() {
915
+ return this.getComponent("b");
916
+ }
917
+ set b(t) {
918
+ this.setComponent("b", t);
919
+ }
920
+ }
921
+ class $e extends H {
922
+ constructor(t, n, r, s) {
923
+ super("oklch", s), this.components.set("l", t), this.components.set("c", n), this.components.set("h", r);
924
+ }
925
+ get l() {
926
+ return this.getComponent("l");
927
+ }
928
+ set l(t) {
929
+ this.setComponent("l", t);
930
+ }
931
+ get c() {
932
+ return this.getComponent("c");
933
+ }
934
+ set c(t) {
935
+ this.setComponent("c", t);
936
+ }
937
+ get h() {
938
+ return this.getComponent("h");
939
+ }
940
+ set h(t) {
941
+ this.setComponent("h", t);
942
+ }
943
+ }
944
+ class Y extends Pe {
945
+ constructor(t, n, r, s) {
946
+ super("xyz", s, "D65"), this.components.set("x", t), this.components.set("y", n), this.components.set("z", r);
947
+ }
948
+ get x() {
949
+ return this.getComponent("x");
950
+ }
951
+ set x(t) {
952
+ this.setComponent("x", t);
953
+ }
954
+ get y() {
955
+ return this.getComponent("y");
956
+ }
957
+ set y(t) {
958
+ this.setComponent("y", t);
959
+ }
960
+ get z() {
961
+ return this.getComponent("z");
962
+ }
963
+ set z(t) {
964
+ this.setComponent("z", t);
965
+ }
966
+ }
967
+ class sr extends H {
968
+ constructor(t, n) {
969
+ super("kelvin", n), this.components.set("kelvin", t);
970
+ }
971
+ get kelvin() {
972
+ return this.getComponent("kelvin");
973
+ }
974
+ set kelvin(t) {
975
+ this.setComponent("kelvin", t);
976
+ }
977
+ }
978
+ class Fe extends H {
979
+ constructor(t, n, r, s) {
980
+ super("srgb-linear", s), this.components.set("r", t), this.components.set("g", n), this.components.set("b", r);
981
+ }
982
+ get r() {
983
+ return this.getComponent("r");
984
+ }
985
+ set r(t) {
986
+ this.setComponent("r", t);
987
+ }
988
+ get g() {
989
+ return this.getComponent("g");
990
+ }
991
+ set g(t) {
992
+ this.setComponent("g", t);
993
+ }
994
+ get b() {
995
+ return this.getComponent("b");
996
+ }
997
+ set b(t) {
998
+ this.setComponent("b", t);
999
+ }
1000
+ }
1001
+ class Ae extends H {
1002
+ constructor(t, n, r, s) {
1003
+ super("display-p3", s), this.components.set("r", t), this.components.set("g", n), this.components.set("b", r);
1004
+ }
1005
+ get r() {
1006
+ return this.getComponent("r");
1007
+ }
1008
+ set r(t) {
1009
+ this.setComponent("r", t);
1010
+ }
1011
+ get g() {
1012
+ return this.getComponent("g");
1013
+ }
1014
+ set g(t) {
1015
+ this.setComponent("g", t);
1016
+ }
1017
+ get b() {
1018
+ return this.getComponent("b");
1019
+ }
1020
+ set b(t) {
1021
+ this.setComponent("b", t);
1022
+ }
1023
+ }
1024
+ class Ve extends H {
1025
+ constructor(t, n, r, s) {
1026
+ super("a98-rgb", s), this.components.set("r", t), this.components.set("g", n), this.components.set("b", r);
1027
+ }
1028
+ get r() {
1029
+ return this.getComponent("r");
1030
+ }
1031
+ set r(t) {
1032
+ this.setComponent("r", t);
1033
+ }
1034
+ get g() {
1035
+ return this.getComponent("g");
1036
+ }
1037
+ set g(t) {
1038
+ this.setComponent("g", t);
1039
+ }
1040
+ get b() {
1041
+ return this.getComponent("b");
1042
+ }
1043
+ set b(t) {
1044
+ this.setComponent("b", t);
1045
+ }
1046
+ }
1047
+ class Re extends H {
1048
+ constructor(t, n, r, s) {
1049
+ super("prophoto-rgb", s), this.components.set("r", t), this.components.set("g", n), this.components.set("b", r);
1050
+ }
1051
+ get r() {
1052
+ return this.getComponent("r");
1053
+ }
1054
+ set r(t) {
1055
+ this.setComponent("r", t);
1056
+ }
1057
+ get g() {
1058
+ return this.getComponent("g");
1059
+ }
1060
+ set g(t) {
1061
+ this.setComponent("g", t);
1062
+ }
1063
+ get b() {
1064
+ return this.getComponent("b");
1065
+ }
1066
+ set b(t) {
1067
+ this.setComponent("b", t);
1068
+ }
1069
+ }
1070
+ class je extends H {
1071
+ constructor(t, n, r, s) {
1072
+ super("rec2020", s), this.components.set("r", t), this.components.set("g", n), this.components.set("b", r);
1073
+ }
1074
+ get r() {
1075
+ return this.getComponent("r");
1076
+ }
1077
+ set r(t) {
1078
+ this.setComponent("r", t);
1079
+ }
1080
+ get g() {
1081
+ return this.getComponent("g");
1082
+ }
1083
+ set g(t) {
1084
+ this.setComponent("g", t);
1085
+ }
1086
+ get b() {
1087
+ return this.getComponent("b");
1088
+ }
1089
+ set b(t) {
1090
+ this.setComponent("b", t);
1091
+ }
1092
+ }
1093
+ function xe(e) {
1094
+ return e.unit === "color";
1095
+ }
1096
+ const ir = (e) => {
1097
+ const t = {}, n = (r, s = void 0) => {
1098
+ if (Array.isArray(r)) {
1099
+ r.forEach((o, a) => n(o, s));
1100
+ return;
1101
+ } else if (r instanceof _) {
1102
+ let o = r.name;
1103
+ s && (s.endsWith(r.name) ? o = s : o = `${s}.${r.name}`), r.values.forEach((a, c) => n(a, o));
1104
+ return;
1105
+ } else if (Te(r)) {
1106
+ for (const [o, a] of Object.entries(r)) {
1107
+ const c = s ? `${s}.${o}` : o;
1108
+ n(a, c);
1109
+ }
1110
+ return;
1111
+ }
1112
+ const i = s;
1113
+ t[i] == null && (t[i] = new st()), t[i].push(r), t[i] = t[i].flat();
1114
+ };
1115
+ return n(e), t;
1116
+ }, bs = (e) => {
1117
+ const t = {};
1118
+ for (const [n, r] of Object.entries(e)) {
1119
+ const s = n.split(".");
1120
+ let i = t;
1121
+ for (let o = 0; o < s.length; o++) {
1122
+ const a = s[o];
1123
+ o === s.length - 1 ? Array.isArray(i) ? i.push(r) : i[a] = r : (a in i || (i[a] = {}), i = i[a]);
1124
+ }
1125
+ }
1126
+ return t;
1127
+ }, gs = (e) => {
1128
+ const t = {};
1129
+ for (const [n, r] of Object.entries(e)) {
1130
+ const s = n.split("."), i = s[0];
1131
+ let o = t[i] ?? "", a = "", c = "";
1132
+ for (let u = 1; u < s.length; u++)
1133
+ a += `${s[u]}(`, c += ")";
1134
+ let l = "";
1135
+ s.length > 1 && Array.isArray(r) ? l = r.join(", ") : l = r.toString(), o += ` ${a}${l}${c}`, t[i] = o.trim();
1136
+ }
1137
+ return t;
1138
+ };
1139
+ new Set(ds);
1140
+ const or = (e) => {
1141
+ const t = e.name, n = e.valueOf();
1142
+ if (!e.name.startsWith("matrix"))
1143
+ throw new Error("Input must be a matrix or matrix3d value");
1144
+ const r = {
1145
+ scaleX: 1,
1146
+ scaleY: 1,
1147
+ scaleZ: 1,
1148
+ skewX: 0,
1149
+ skewY: 0,
1150
+ skewZ: 0,
1151
+ translateX: 0,
1152
+ translateY: 0,
1153
+ translateZ: 0,
1154
+ rotateX: 0,
1155
+ rotateY: 0,
1156
+ rotateZ: 0,
1157
+ perspectiveX: 0,
1158
+ perspectiveY: 0,
1159
+ perspectiveZ: 0,
1160
+ perspectiveW: 1
1161
+ };
1162
+ if (e.name === "matrix")
1163
+ return {
1164
+ ...r,
1165
+ scaleX: n[0] ?? 1,
1166
+ skewY: n[1] ?? 0,
1167
+ skewX: n[2] ?? 0,
1168
+ scaleY: n[3] ?? 1,
1169
+ translateX: n[4] ?? 0,
1170
+ translateY: n[5] ?? 0,
1171
+ rotateZ: Math.atan2(n[1] ?? 0, n[0] ?? 1),
1172
+ rotateY: Math.atan2(-(n[2] ?? 0), n[0] ?? 1),
1173
+ rotateX: Math.atan2(n[1] ?? 0, n[3] ?? 1)
1174
+ };
1175
+ if (t === "matrix3d") {
1176
+ if (n.length === 4)
1177
+ return {
1178
+ ...r,
1179
+ translateX: n[0] ?? 0,
1180
+ translateY: n[1] ?? 0,
1181
+ translateZ: n[2] ?? 0,
1182
+ perspectiveW: n[3] ?? 1
1183
+ };
1184
+ if (n.length === 16)
1185
+ return {
1186
+ scaleX: n[0] ?? 1,
1187
+ skewY: n[1] ?? 0,
1188
+ skewX: n[4] ?? 0,
1189
+ scaleY: n[5] ?? 1,
1190
+ scaleZ: n[10] ?? 1,
1191
+ skewZ: n[2] ?? 0,
1192
+ translateX: n[12] ?? 0,
1193
+ translateY: n[13] ?? 0,
1194
+ translateZ: n[14] ?? 0,
1195
+ rotateX: Math.atan2(-(n[9] ?? 0), n[10] ?? 1),
1196
+ rotateY: Math.atan2(
1197
+ n[8] ?? 0,
1198
+ Math.sqrt(
1199
+ Math.pow(n[0] ?? 1, 2) + Math.pow(n[1] ?? 0, 2)
1200
+ )
1201
+ ),
1202
+ rotateZ: Math.atan2(n[1] ?? 0, n[0] ?? 1),
1203
+ perspectiveX: n[3] ?? 0,
1204
+ perspectiveY: n[7] ?? 0,
1205
+ perspectiveZ: n[11] ?? 0,
1206
+ perspectiveW: n[15] ?? 1
1207
+ };
1208
+ }
1209
+ throw new Error("Unsupported matrix type or invalid number of values");
1210
+ };
1211
+ function ws(e, t) {
1212
+ let n = e;
1213
+ return t === "cm" ? n *= 96 / 2.54 : t === "mm" ? n *= 96 / 25.4 : t === "in" ? n *= 96 : t === "pt" ? n *= 4 / 3 : t === "pc" && (n *= 16), n;
1214
+ }
1215
+ function ks(e, t, n, r) {
1216
+ if (t === "em" && n)
1217
+ e *= parseFloat(getComputedStyle(n).fontSize);
1218
+ else if (t === "rem")
1219
+ e *= parseFloat(getComputedStyle(document.documentElement).fontSize);
1220
+ else if (t === "vh")
1221
+ e *= window.innerHeight / 100;
1222
+ else if (t === "vw")
1223
+ e *= window.innerWidth / 100;
1224
+ else if (t === "vmin")
1225
+ e *= Math.min(window.innerHeight, window.innerWidth) / 100;
1226
+ else if (t === "vmax")
1227
+ e *= Math.max(window.innerHeight, window.innerWidth) / 100;
1228
+ else if (t === "%" && n?.parentElement && r) {
1229
+ const s = parseFloat(
1230
+ getComputedStyle(n.parentElement).getPropertyValue(r)
1231
+ );
1232
+ e = e / 100 * s;
1233
+ } else t === "ex" || t === "ch" ? e *= parseFloat(getComputedStyle(n).fontSize) ?? 16 : e = ws(e, t);
1234
+ return e;
1235
+ }
1236
+ function ar(e, t) {
1237
+ return t === "s" && (e *= 1e3), e;
1238
+ }
1239
+ function cr(e, t) {
1240
+ return t === "grad" ? e *= 0.9 : t === "rad" ? e *= 180 / Math.PI : t === "turn" && (e *= 360), e;
1241
+ }
1242
+ function ys(e, t) {
1243
+ return t === "dpcm" ? e *= 2.54 : t === "dppx" && (e *= 96), e;
1244
+ }
1245
+ class d {
1246
+ constructor(t, n, r, s, i, o) {
1247
+ this.value = t, this.unit = n, this.superType = r, this.subProperty = s, this.property = i, this.targets = o;
1248
+ }
1249
+ setSubProperty(t) {
1250
+ this.subProperty = t;
1251
+ }
1252
+ setProperty(t) {
1253
+ this.property = t;
1254
+ }
1255
+ setTargets(t) {
1256
+ this.targets = t;
1257
+ }
1258
+ valueOf() {
1259
+ return this.value;
1260
+ }
1261
+ setValue(t) {
1262
+ this.value = t;
1263
+ }
1264
+ toString() {
1265
+ return this.value == null ? "" : this.unit == null || this.unit === "string" ? `${this.value}` : xe(this) ? this.value.toString() : this.unit === "var" ? `var(${this.value})` : this.unit === "calc" ? `calc(${this.value})` : `${this.value}${this.unit}`;
1266
+ }
1267
+ toJSON() {
1268
+ return this.valueOf();
1269
+ }
1270
+ toFixed(t = 2) {
1271
+ const n = Number(this.value).toFixed(t).replace(/\.0+$/, "");
1272
+ return new d(n).coalesce(this, !0).toString();
1273
+ }
1274
+ clone() {
1275
+ return new d(
1276
+ ct(this.value),
1277
+ this.unit,
1278
+ ct(this.superType),
1279
+ this.subProperty,
1280
+ this.property
1281
+ );
1282
+ }
1283
+ coalesce(t, n = !1) {
1284
+ return t == null ? this : fs.includes(this.unit) ? this : n ? (this.unit ??= t.unit, this.superType ??= t.superType, this.subProperty ??= t.subProperty, this.property ??= t.property, this.targets ??= t.targets, this) : new d(
1285
+ ct(this.value),
1286
+ this.unit ?? t.unit,
1287
+ ct(this.superType ?? t.superType),
1288
+ this.subProperty ?? t.subProperty,
1289
+ this.property ?? t.property,
1290
+ this.targets ?? t.targets
1291
+ );
1292
+ }
1293
+ }
1294
+ class _ {
1295
+ constructor(t, n) {
1296
+ this.name = t, this.values = n, n.forEach((r) => {
1297
+ this.setSubProperty(t);
1298
+ });
1299
+ }
1300
+ setSubProperty(t) {
1301
+ this.values.forEach((n) => n.setSubProperty(t));
1302
+ }
1303
+ setProperty(t) {
1304
+ this.values.forEach((n) => n.setProperty(t));
1305
+ }
1306
+ setTargets(t) {
1307
+ this.values.forEach((n) => n.setTargets(t));
1308
+ }
1309
+ setValue(t, n) {
1310
+ n != null ? this.values[n].setValue(t) : this.values.forEach((r) => r.setValue(t));
1311
+ }
1312
+ valueOf() {
1313
+ return this.values.map((t) => t.valueOf());
1314
+ }
1315
+ toString() {
1316
+ return `${this.name}(${this.values.map((t) => t.toString()).join(", ")})`;
1317
+ }
1318
+ toJSON() {
1319
+ return {
1320
+ [this.name]: this.values.map((t) => t.toJSON())
1321
+ };
1322
+ }
1323
+ clone() {
1324
+ return new _(
1325
+ this.name,
1326
+ this.values.map((t) => t.clone())
1327
+ );
1328
+ }
1329
+ }
1330
+ class st extends Array {
1331
+ constructor(...t) {
1332
+ super(...t);
1333
+ }
1334
+ setSubProperty(t) {
1335
+ this.forEach((n) => n.setSubProperty(t));
1336
+ }
1337
+ setProperty(t) {
1338
+ this.forEach((n) => n.setProperty(t));
1339
+ }
1340
+ setTargets(t) {
1341
+ this.forEach((n) => n.setTargets(t));
1342
+ }
1343
+ setValue(t, n) {
1344
+ n != null ? this[n].setValue(t) : this.forEach((r) => r.setValue(t));
1345
+ }
1346
+ valueOf() {
1347
+ return this.map((t) => t.valueOf());
1348
+ }
1349
+ toString() {
1350
+ return this.map((t) => t.toString()).join(" ");
1351
+ }
1352
+ toJSON() {
1353
+ return this.map((t) => t.toJSON());
1354
+ }
1355
+ clone() {
1356
+ return new st(...this.map((t) => t.clone()));
1357
+ }
1358
+ }
1359
+ const bn = 4;
1360
+ function gn(e, t = "^", n = !1) {
1361
+ const r = e.src.split(`
1362
+ `), s = Math.min(r.length - 1, e.getLineNumber()), i = Math.max(s - bn, 0), o = Math.min(s + bn + 1, r.length), a = r.slice(i, o);
1363
+ if (t) {
1364
+ const c = " ".repeat(e.getColumnNumber()) + t;
1365
+ a.splice(s - i + 1, 0, c);
1366
+ }
1367
+ return a.map((c, l) => ` ${i + l + 1}| ${c}`).join(`
1368
+ `);
1369
+ }
1370
+ const dt = /* @__PURE__ */ new Map();
1371
+ function lr(e) {
1372
+ if (dt.has(e.id))
1373
+ return dt.get(e.id);
1374
+ const t = (r, s) => {
1375
+ if (dt.has(r.id))
1376
+ return dt.get(r.id);
1377
+ const { name: i, args: o, parser: a } = r.context, c = a != null ? t(a, s) : "unknown", l = (() => {
1378
+ switch (i) {
1379
+ case "string":
1380
+ return `"${o[0]}"`;
1381
+ case "regex":
1382
+ case "regexConcat":
1383
+ case "regexWrap":
1384
+ return `${o[0]}`;
1385
+ case "wrap":
1386
+ case "trim": {
1387
+ const [u, h] = o;
1388
+ return `${t(u, s)} ${c} ${t(h, s)}`;
1389
+ }
1390
+ case "trimWhitespace":
1391
+ return `${c}?w`;
1392
+ case "not":
1393
+ return `!${c}`;
1394
+ case "opt":
1395
+ return `${c}?`;
1396
+ case "next": {
1397
+ const [u] = o;
1398
+ return `${c} >> ${t(u, s)}`;
1399
+ }
1400
+ case "skip": {
1401
+ const [u] = o;
1402
+ return `${c} << ${t(u, s)}`;
1403
+ }
1404
+ case "map":
1405
+ return c;
1406
+ case "all":
1407
+ case "then":
1408
+ return `[${o.map(
1409
+ (u) => t(u, s)
1410
+ ).join(", ")}]`;
1411
+ case "any":
1412
+ case "or":
1413
+ return o.map(
1414
+ (u) => t(u, s)
1415
+ ).join(" | ");
1416
+ case "many": {
1417
+ const [u, h] = o, b = h === 1 / 0 ? `${u},` : `${u},${h}`;
1418
+ return `${c} {${b}}`;
1419
+ }
1420
+ case "sepBy":
1421
+ return `${c} sepBy ${t(o[0], s)}`;
1422
+ case "lazy": {
1423
+ const [u] = o, h = hr(u);
1424
+ if (s)
1425
+ return i;
1426
+ {
1427
+ const b = t(h, h.id);
1428
+ return dt.set(h.id, b), b;
1429
+ }
1430
+ }
1431
+ case "debug":
1432
+ return c;
1433
+ default:
1434
+ return;
1435
+ }
1436
+ })() ?? i ?? "unknown";
1437
+ return s && dt.set(r.id, l), l;
1438
+ }, n = t(e);
1439
+ return dt.set(e.id, n), n;
1440
+ }
1441
+ function ur(e, t = "", n = "") {
1442
+ const r = String(e.value), s = e.offset >= e.src.length, i = `${`[${e.isError ? "err" : s ? "done" : "ok"}]`} ${t} offset=${e.offset} value=${r}`, o = e.offset >= e.src.length ? gn(e, "", e.isError) : gn(e, "^", e.isError);
1443
+ return `${i}
1444
+ ${o}`;
1445
+ }
1446
+ function xs(e, t = "", n = !1, r = console.log) {
1447
+ const s = (i) => {
1448
+ const o = e.parser(i), a = n ? lr(e) : e.context.name ?? "", c = ur(
1449
+ o,
1450
+ t,
1451
+ a
1452
+ );
1453
+ return r(c), o;
1454
+ };
1455
+ return new S(s, I("debug", e, r));
1456
+ }
1457
+ class Yt {
1458
+ constructor(t, n = void 0, r = 0, s = !1, i = 0) {
1459
+ this.src = t, this.value = n, this.offset = r, this.isError = s, this.furthest = i;
1460
+ }
1461
+ ok(t, n = 0) {
1462
+ return n += this.offset, new Yt(this.src, t, n, !1);
1463
+ }
1464
+ err(t, n = 0) {
1465
+ const r = this.ok(t, n);
1466
+ return r.isError = !0, r;
1467
+ }
1468
+ from(t, n = 0) {
1469
+ return n += this.offset, new Yt(this.src, t, n, this.isError);
1470
+ }
1471
+ getColumnNumber() {
1472
+ const t = this.offset, n = this.src.lastIndexOf(`
1473
+ `, t), r = n === -1 ? t : t - (n + 1);
1474
+ return Math.max(0, r);
1475
+ }
1476
+ getLineNumber() {
1477
+ const t = this.src.lastIndexOf(`
1478
+ `, this.offset);
1479
+ return t >= 0 ? this.src.slice(0, t).split(`
1480
+ `).length : 0;
1481
+ }
1482
+ toString() {
1483
+ return ur(this);
1484
+ }
1485
+ }
1486
+ function I(e, t, ...n) {
1487
+ return {
1488
+ name: e,
1489
+ parser: t,
1490
+ args: n
1491
+ };
1492
+ }
1493
+ let Ss = 0;
1494
+ const bt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map();
1495
+ let Ft;
1496
+ function D(e) {
1497
+ return (!Ft || e.offset > Ft.offset) && (Ft = e), Ft;
1498
+ }
1499
+ function hr(e) {
1500
+ return e.parser ? e.parser : e.parser = e();
1501
+ }
1502
+ class S {
1503
+ constructor(t, n = {}) {
1504
+ this.parser = t, this.context = n;
1505
+ }
1506
+ id = Ss++;
1507
+ state;
1508
+ reset() {
1509
+ Ft = void 0, bt.clear(), qt.clear();
1510
+ }
1511
+ parseState(t) {
1512
+ this.reset();
1513
+ const n = this.parser(new Yt(t));
1514
+ return this.state = D(n), this.state.isError = n.isError, this.state.isError, n;
1515
+ }
1516
+ parse(t) {
1517
+ return this.parseState(t).value;
1518
+ }
1519
+ getCijKey(t) {
1520
+ return `${this.id}${t.offset}`;
1521
+ }
1522
+ atLeftRecursionLimit(t) {
1523
+ return (qt.get(this.getCijKey(t)) ?? 0) > t.src.length - t.offset;
1524
+ }
1525
+ memoize() {
1526
+ const t = (n) => {
1527
+ const r = this.getCijKey(n), s = qt.get(r) ?? 0;
1528
+ let i = bt.get(this.id);
1529
+ if (i && i.offset >= n.offset)
1530
+ return i;
1531
+ if (this.atLeftRecursionLimit(n))
1532
+ return n.err(void 0);
1533
+ qt.set(r, s + 1);
1534
+ const o = this.parser(n);
1535
+ return i = bt.get(this.id), i && i.offset > o.offset ? o.offset = i.offset : i || bt.set(this.id, o), o;
1536
+ };
1537
+ return new S(
1538
+ t,
1539
+ I("memoize", this)
1540
+ );
1541
+ }
1542
+ mergeMemos() {
1543
+ const t = (n) => {
1544
+ let r = bt.get(this.id);
1545
+ if (r)
1546
+ return r;
1547
+ if (this.atLeftRecursionLimit(n))
1548
+ return n.err(void 0);
1549
+ const s = this.parser(n);
1550
+ return r = bt.get(this.id), r || bt.set(this.id, s), s;
1551
+ };
1552
+ return new S(
1553
+ t,
1554
+ I("mergeMemo", this)
1555
+ );
1556
+ }
1557
+ then(t) {
1558
+ const n = (r) => {
1559
+ const s = this.parser(r);
1560
+ if (!s.isError) {
1561
+ const i = t.parser(s);
1562
+ if (!i.isError)
1563
+ return i.ok([s.value, i.value]);
1564
+ }
1565
+ return D(r), r.err(void 0);
1566
+ };
1567
+ return new S(
1568
+ n,
1569
+ I("then", this, this, t)
1570
+ );
1571
+ }
1572
+ or(t) {
1573
+ const n = (r) => {
1574
+ const s = this.parser(r);
1575
+ return s.isError ? t.parser(r) : s;
1576
+ };
1577
+ return new S(
1578
+ n,
1579
+ I("or", this, this, t)
1580
+ );
1581
+ }
1582
+ chain(t, n = !1) {
1583
+ const r = (s) => {
1584
+ const i = this.parser(s);
1585
+ return i.isError ? i : i.value || n ? t(i.value).parser(i) : s;
1586
+ };
1587
+ return new S(
1588
+ r,
1589
+ I("chain", this, t)
1590
+ );
1591
+ }
1592
+ map(t, n = !1) {
1593
+ const r = (s) => {
1594
+ const i = this.parser(s);
1595
+ return !i.isError || n ? i.ok(t(i.value)) : i;
1596
+ };
1597
+ return new S(
1598
+ r,
1599
+ I("map", this)
1600
+ );
1601
+ }
1602
+ mapState(t) {
1603
+ const n = (r) => {
1604
+ const s = this.parser(r);
1605
+ return t(s, r);
1606
+ };
1607
+ return new S(
1608
+ n,
1609
+ I("mapState", this)
1610
+ );
1611
+ }
1612
+ skip(t) {
1613
+ const n = (r) => {
1614
+ const s = this.parser(r);
1615
+ if (!s.isError) {
1616
+ const i = t.parser(s);
1617
+ if (!i.isError)
1618
+ return i.ok(s.value);
1619
+ }
1620
+ return D(r), r.err(void 0);
1621
+ };
1622
+ return new S(
1623
+ n,
1624
+ I("skip", this, t)
1625
+ );
1626
+ }
1627
+ next(t) {
1628
+ const n = this.then(t).map(([, r]) => r);
1629
+ return n.context = I("next", this, t), n;
1630
+ }
1631
+ opt() {
1632
+ const t = (n) => {
1633
+ const r = this.parser(n);
1634
+ return r.isError ? (D(n), n.ok(void 0)) : r;
1635
+ };
1636
+ return new S(
1637
+ t,
1638
+ I("opt", this)
1639
+ );
1640
+ }
1641
+ not(t) {
1642
+ const n = (s) => this.parser(s).isError ? (D(s), s.ok(s.value)) : s.err(void 0), r = (s) => {
1643
+ const i = this.parser(s);
1644
+ return i.isError ? (D(s), i) : t.parser(s).isError ? i : (D(s), s.err(void 0));
1645
+ };
1646
+ return new S(
1647
+ t ? r : n,
1648
+ I("not", this, t)
1649
+ );
1650
+ }
1651
+ wrap(t, n, r = !0) {
1652
+ if (!r)
1653
+ return T(t, this, n);
1654
+ const s = t.next(this).skip(n);
1655
+ return s.context = I("wrap", this, t, n), s;
1656
+ }
1657
+ trim(t = w, n = !0) {
1658
+ if (!n)
1659
+ return T(t, this, t);
1660
+ if (t.context?.name === "whitespace") {
1661
+ const r = (s) => {
1662
+ const i = kn(s), o = this.parser(i);
1663
+ return o.isError ? (D(s), s.err(void 0)) : kn(o);
1664
+ };
1665
+ return new S(
1666
+ r,
1667
+ I("trimWhitespace", this)
1668
+ );
1669
+ }
1670
+ return this.wrap(t, t);
1671
+ }
1672
+ many(t = 0, n = 1 / 0) {
1673
+ const r = (s) => {
1674
+ const i = [];
1675
+ let o = s;
1676
+ for (let a = 0; a < n; a += 1) {
1677
+ const c = this.parser(o);
1678
+ if (c.isError)
1679
+ break;
1680
+ i.push(c.value), o = c;
1681
+ }
1682
+ return i.length >= t ? o.ok(i) : (D(s), s.err([]));
1683
+ };
1684
+ return new S(
1685
+ r,
1686
+ I("many", this, t, n)
1687
+ );
1688
+ }
1689
+ sepBy(t, n = 0, r = 1 / 0) {
1690
+ const s = (i) => {
1691
+ const o = [];
1692
+ let a = i;
1693
+ for (let c = 0; c < r; c += 1) {
1694
+ const l = this.parser(a);
1695
+ if (l.isError)
1696
+ break;
1697
+ a = l, o.push(a.value);
1698
+ const u = t.parser(a);
1699
+ if (u.isError)
1700
+ break;
1701
+ a = u;
1702
+ }
1703
+ return o.length > n ? a.ok(o) : (D(i), i.err([]));
1704
+ };
1705
+ return new S(
1706
+ s,
1707
+ I("sepBy", this, t)
1708
+ );
1709
+ }
1710
+ eof() {
1711
+ const t = this.skip(vs());
1712
+ return t.context = I("eof", this), t;
1713
+ }
1714
+ debug(t = "", n = !1, r = console.log) {
1715
+ return xs(this, t, n, r);
1716
+ }
1717
+ toString() {
1718
+ return lr(this);
1719
+ }
1720
+ static lazy(t) {
1721
+ const n = (r) => hr(t).parser(r);
1722
+ return new S(
1723
+ n,
1724
+ I("lazy", void 0, t)
1725
+ );
1726
+ }
1727
+ }
1728
+ function vs() {
1729
+ const e = (t) => t.offset >= t.src.length ? t.ok(void 0) : (D(t), t.err());
1730
+ return new S(
1731
+ e,
1732
+ I("eof", void 0)
1733
+ );
1734
+ }
1735
+ function g(...e) {
1736
+ const t = (n) => {
1737
+ for (const r of e) {
1738
+ const s = r.parser(n);
1739
+ if (!s.isError)
1740
+ return s;
1741
+ }
1742
+ return D(n), n.err(void 0);
1743
+ };
1744
+ return new S(
1745
+ e.length === 1 ? e[0].parser : t,
1746
+ I("any", void 0, ...e)
1747
+ );
1748
+ }
1749
+ function T(...e) {
1750
+ const t = (n) => {
1751
+ const r = [];
1752
+ let s = n;
1753
+ for (const i of e) {
1754
+ const o = i.parser(s);
1755
+ if (o.isError)
1756
+ return o;
1757
+ o.value !== void 0 && r.push(o.value), s = o;
1758
+ }
1759
+ return D(s), s.ok(r);
1760
+ };
1761
+ return new S(
1762
+ e.length === 1 ? e[0].parser : t,
1763
+ I("all", void 0, ...e)
1764
+ );
1765
+ }
1766
+ function z(e) {
1767
+ const t = (n) => {
1768
+ if (n.offset >= n.src.length)
1769
+ return n.err(void 0);
1770
+ const r = n.src.slice(n.offset, n.offset + e.length);
1771
+ return r === e ? n.ok(r, r.length) : (D(n), n.err(void 0));
1772
+ };
1773
+ return new S(
1774
+ t,
1775
+ I("string", void 0, e)
1776
+ );
1777
+ }
1778
+ function G(e, t = (n) => n?.[0] ?? null) {
1779
+ const n = e.flags.replace(/y/g, ""), r = new RegExp(e, n + "y"), s = (i) => {
1780
+ if (i.offset >= i.src.length)
1781
+ return i.err(void 0);
1782
+ r.lastIndex = i.offset;
1783
+ const o = t(i.src.match(r));
1784
+ return o ? i.ok(o, r.lastIndex - i.offset) : o === "" ? i.ok(void 0) : (D(i), i.err(void 0));
1785
+ };
1786
+ return new S(
1787
+ s,
1788
+ I("regex", void 0, e)
1789
+ );
1790
+ }
1791
+ const wn = /\s*/y, kn = (e) => {
1792
+ if (e.offset >= e.src.length)
1793
+ return e;
1794
+ wn.lastIndex = e.offset;
1795
+ const t = e.src.match(wn)?.[0] ?? "";
1796
+ return e.ok(e.value, t.length);
1797
+ }, w = G(/\s*/);
1798
+ w.context.name = "whitespace";
1799
+ const p = (e) => {
1800
+ const t = new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i");
1801
+ return G(t);
1802
+ }, Lt = G(/-?[a-zA-Z][a-zA-Z0-9-]*/), Le = p("none"), Cs = G(/-?\d+/).map(Number), it = G(/-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/).map(Number);
1803
+ function Es(e) {
1804
+ return new S((t) => t.ok(e, 0));
1805
+ }
1806
+ function Ms(e) {
1807
+ return new S((t) => t.err(void 0, 0));
1808
+ }
1809
+ function et(e, t) {
1810
+ const n = e.parseState(t);
1811
+ if (n.isError)
1812
+ throw new Error(`Parse error at offset ${n.offset}`);
1813
+ return n.value;
1814
+ }
1815
+ function N(e, t) {
1816
+ const [n, r, s] = e;
1817
+ return [
1818
+ t[0] * n + t[1] * r + t[2] * s,
1819
+ t[3] * n + t[4] * r + t[5] * s,
1820
+ t[6] * n + t[7] * r + t[8] * s
1821
+ ];
1822
+ }
1823
+ function lt(e) {
1824
+ const [t, n, r, s, i, o, a, c, l] = e, u = i * l - o * c, h = -(s * l - o * a), b = s * c - i * a, y = 1 / (t * u + n * h + r * b);
1825
+ return [
1826
+ u * y,
1827
+ (r * c - n * l) * y,
1828
+ (n * o - r * i) * y,
1829
+ h * y,
1830
+ (t * l - r * a) * y,
1831
+ (r * s - t * o) * y,
1832
+ b * y,
1833
+ (n * a - t * c) * y,
1834
+ (t * i - n * s) * y
1835
+ ];
1836
+ }
1837
+ const F = 255, m = {
1838
+ "%": { min: 0, max: 100 },
1839
+ number: { min: 0, max: 1 }
1840
+ }, me = {
1841
+ "%": m["%"],
1842
+ number: { min: 0, max: F }
1843
+ }, L = {
1844
+ "%": m["%"],
1845
+ number: m.number
1846
+ }, $t = {
1847
+ deg: { min: 0, max: 360 },
1848
+ number: { min: 0, max: 360 },
1849
+ "%": m["%"]
1850
+ }, f = {
1851
+ rgb: {
1852
+ r: me,
1853
+ g: me,
1854
+ b: me,
1855
+ alpha: m
1856
+ },
1857
+ hsl: {
1858
+ h: $t,
1859
+ s: { "%": m["%"], number: m.number },
1860
+ l: { "%": m["%"], number: m.number },
1861
+ alpha: m
1862
+ },
1863
+ hsv: {
1864
+ h: $t,
1865
+ s: { "%": m["%"], number: m.number },
1866
+ v: { "%": m["%"], number: m.number },
1867
+ alpha: m
1868
+ },
1869
+ hwb: {
1870
+ h: $t,
1871
+ w: { "%": m["%"], number: m.number },
1872
+ b: { "%": m["%"], number: m.number },
1873
+ alpha: m
1874
+ },
1875
+ lab: {
1876
+ l: { "%": m["%"], number: m["%"] },
1877
+ a: { number: { min: -125, max: 125 }, "%": { min: -100, max: 100 } },
1878
+ b: { number: { min: -125, max: 125 }, "%": { min: -100, max: 100 } },
1879
+ alpha: m
1880
+ },
1881
+ lch: {
1882
+ l: { "%": m["%"], number: m["%"] },
1883
+ c: { number: { min: 0, max: 150 }, "%": m["%"] },
1884
+ h: $t,
1885
+ alpha: m
1886
+ },
1887
+ oklab: {
1888
+ l: { "%": m["%"], number: m["%"] },
1889
+ a: { number: { min: -0.4, max: 0.4 }, "%": { min: -100, max: 100 } },
1890
+ b: { number: { min: -0.4, max: 0.4 }, "%": { min: -100, max: 100 } },
1891
+ alpha: m
1892
+ },
1893
+ oklch: {
1894
+ l: { "%": m["%"], number: m["%"] },
1895
+ c: { number: { min: 0, max: 0.5 }, "%": m["%"] },
1896
+ h: $t,
1897
+ alpha: m
1898
+ },
1899
+ xyz: {
1900
+ x: { "%": m["%"], number: m.number },
1901
+ y: { "%": m["%"], number: m.number },
1902
+ z: { "%": m["%"], number: m.number },
1903
+ alpha: m
1904
+ },
1905
+ kelvin: {
1906
+ kelvin: { number: { min: 1e3, max: 4e4 } },
1907
+ alpha: m
1908
+ },
1909
+ "srgb-linear": {
1910
+ r: L,
1911
+ g: L,
1912
+ b: L,
1913
+ alpha: m
1914
+ },
1915
+ "display-p3": {
1916
+ r: L,
1917
+ g: L,
1918
+ b: L,
1919
+ alpha: m
1920
+ },
1921
+ "a98-rgb": {
1922
+ r: L,
1923
+ g: L,
1924
+ b: L,
1925
+ alpha: m
1926
+ },
1927
+ "prophoto-rgb": {
1928
+ r: L,
1929
+ g: L,
1930
+ b: L,
1931
+ alpha: m
1932
+ },
1933
+ rec2020: {
1934
+ r: L,
1935
+ g: L,
1936
+ b: L,
1937
+ alpha: m
1938
+ }
1939
+ }, W = "%", Is = {
1940
+ rgb: {
1941
+ r: "",
1942
+ g: "",
1943
+ b: "",
1944
+ alpha: W
1945
+ },
1946
+ hsl: {
1947
+ h: "deg",
1948
+ s: "%",
1949
+ l: "%",
1950
+ alpha: W
1951
+ },
1952
+ hsv: {
1953
+ h: "deg",
1954
+ s: "%",
1955
+ v: "%",
1956
+ alpha: W
1957
+ },
1958
+ hwb: {
1959
+ h: "deg",
1960
+ w: "%",
1961
+ b: "%",
1962
+ alpha: W
1963
+ },
1964
+ lab: {
1965
+ l: "%",
1966
+ a: "",
1967
+ b: "",
1968
+ alpha: W
1969
+ },
1970
+ lch: {
1971
+ l: "%",
1972
+ c: "",
1973
+ h: "deg",
1974
+ alpha: W
1975
+ },
1976
+ oklab: {
1977
+ l: "%",
1978
+ a: "",
1979
+ b: "",
1980
+ alpha: W
1981
+ },
1982
+ oklch: {
1983
+ l: "%",
1984
+ c: "",
1985
+ h: "deg",
1986
+ alpha: W
1987
+ },
1988
+ xyz: {
1989
+ x: "%",
1990
+ y: "%",
1991
+ z: "%",
1992
+ alpha: W
1993
+ },
1994
+ kelvin: {
1995
+ kelvin: "K",
1996
+ alpha: W
1997
+ },
1998
+ "srgb-linear": {
1999
+ r: "",
2000
+ g: "",
2001
+ b: "",
2002
+ alpha: W
2003
+ },
2004
+ "display-p3": {
2005
+ r: "",
2006
+ g: "",
2007
+ b: "",
2008
+ alpha: W
2009
+ },
2010
+ "a98-rgb": {
2011
+ r: "",
2012
+ g: "",
2013
+ b: "",
2014
+ alpha: W
2015
+ },
2016
+ "prophoto-rgb": {
2017
+ r: "",
2018
+ g: "",
2019
+ b: "",
2020
+ alpha: W
2021
+ },
2022
+ rec2020: {
2023
+ r: "",
2024
+ g: "",
2025
+ b: "",
2026
+ alpha: W
2027
+ }
2028
+ }, Bs = [
2029
+ 0.3127 / 0.329,
2030
+ 1,
2031
+ (1 - 0.3127 - 0.329) / 0.329
2032
+ ], Ts = [
2033
+ 0.3457 / 0.3585,
2034
+ 1,
2035
+ (1 - 0.3457 - 0.3585) / 0.3585
2036
+ ], We = [
2037
+ 1.0479297925449969,
2038
+ 0.022946870601609652,
2039
+ -0.05019226628920524,
2040
+ 0.02962780877005599,
2041
+ 0.9904344267538799,
2042
+ -0.017073799063418826,
2043
+ -0.009243040646204504,
2044
+ 0.015055191490298152,
2045
+ 0.7518742814281371
2046
+ ], pr = lt(We), mr = {
2047
+ D65: Bs,
2048
+ D50: Ts
2049
+ }, fr = [
2050
+ 0.819022437996703,
2051
+ 0.3619062600528904,
2052
+ -0.1288737815209879,
2053
+ 0.0329836539323885,
2054
+ 0.9292868615863434,
2055
+ 0.0361446663506424,
2056
+ 0.0481771893596242,
2057
+ 0.2642395317527308,
2058
+ 0.6335478284694309
2059
+ ], Ps = lt(fr), dr = [
2060
+ 0.210454268309314,
2061
+ 0.7936177747023054,
2062
+ -0.0040720430116193,
2063
+ 1.9779985324311684,
2064
+ -2.42859224204858,
2065
+ 0.450593709617411,
2066
+ 0.0259040424655478,
2067
+ 0.7827717124575296,
2068
+ -0.8086757549230774
2069
+ ], zs = lt(dr), k = [
2070
+ 4.0767416621,
2071
+ -3.3077115913,
2072
+ 0.2309699292,
2073
+ -1.2684380046,
2074
+ 2.6097574011,
2075
+ -0.3413193965,
2076
+ -0.0041960863,
2077
+ -0.7034186147,
2078
+ 1.707614701
2079
+ ], nt = [
2080
+ 0.4122214708,
2081
+ 0.5363325363,
2082
+ 0.0514459929,
2083
+ 0.2119034982,
2084
+ 0.6806995451,
2085
+ 0.1073969566,
2086
+ 0.0883024619,
2087
+ 0.2817188376,
2088
+ 0.6299787005
2089
+ ], V = {
2090
+ l: [1, 0.3963377774, 0.2158037573],
2091
+ m: [1, -0.1055613458, -0.0638541728],
2092
+ s: [1, -0.0894841775, -1.291485548]
2093
+ }, Os = [
2094
+ {
2095
+ // Red sector: -1.88170328*a - 0.80936493*b > 1
2096
+ test: (e, t) => -1.88170328 * e - 0.80936493 * t > 1,
2097
+ k0: 1.19086277,
2098
+ k1: 1.76576728,
2099
+ k2: 0.59662641,
2100
+ k3: 0.75515197,
2101
+ k4: 0.56771245,
2102
+ wl: 4.0767416621,
2103
+ wm: -3.3077115913,
2104
+ ws: 0.2309699292
2105
+ },
2106
+ {
2107
+ // Green sector: 1.81444104*a - 1.19445276*b > 1
2108
+ test: (e, t) => 1.81444104 * e - 1.19445276 * t > 1,
2109
+ k0: 0.73956515,
2110
+ k1: -0.45954404,
2111
+ k2: 0.08285427,
2112
+ k3: 0.1254107,
2113
+ k4: 0.14503204,
2114
+ wl: -1.2684380046,
2115
+ wm: 2.6097574011,
2116
+ ws: -0.3413193965
2117
+ },
2118
+ {
2119
+ // Blue sector (fallback)
2120
+ test: () => !0,
2121
+ k0: 1.35733652,
2122
+ k1: -915799e-8,
2123
+ k2: -1.1513021,
2124
+ k3: -0.50559606,
2125
+ k4: 692167e-8,
2126
+ wl: -0.0041960863,
2127
+ wm: -0.7034186147,
2128
+ ws: 1.707614701
2129
+ }
2130
+ ], yn = {
2131
+ aliceblue: "#f0f8ff",
2132
+ antiquewhite: "#faebd7",
2133
+ aqua: "#00ffff",
2134
+ aquamarine: "#7fffd4",
2135
+ azure: "#f0ffff",
2136
+ beige: "#f5f5dc",
2137
+ bisque: "#ffe4c4",
2138
+ black: "#000000",
2139
+ blanchedalmond: "#ffebcd",
2140
+ blue: "#0000ff",
2141
+ blueviolet: "#8a2be2",
2142
+ brown: "#a52a2a",
2143
+ burlywood: "#deb887",
2144
+ cadetblue: "#5f9ea0",
2145
+ chartreuse: "#7fff00",
2146
+ chocolate: "#d2691e",
2147
+ coral: "#ff7f50",
2148
+ cornflowerblue: "#6495ed",
2149
+ cornsilk: "#fff8dc",
2150
+ crimson: "#dc143c",
2151
+ cyan: "#00ffff",
2152
+ darkblue: "#00008b",
2153
+ darkcyan: "#008b8b",
2154
+ darkgoldenrod: "#b8860b",
2155
+ darkgray: "#a9a9a9",
2156
+ darkgreen: "#006400",
2157
+ darkgrey: "#a9a9a9",
2158
+ darkkhaki: "#bdb76b",
2159
+ darkmagenta: "#8b008b",
2160
+ darkolivegreen: "#556b2f",
2161
+ darkorange: "#ff8c00",
2162
+ darkorchid: "#9932cc",
2163
+ darkred: "#8b0000",
2164
+ darksalmon: "#e9967a",
2165
+ darkseagreen: "#8fbc8f",
2166
+ darkslateblue: "#483d8b",
2167
+ darkslategray: "#2f4f4f",
2168
+ darkslategrey: "#2f4f4f",
2169
+ darkturquoise: "#00ced1",
2170
+ darkviolet: "#9400d3",
2171
+ deeppink: "#ff1493",
2172
+ deepskyblue: "#00bfff",
2173
+ dimgray: "#696969",
2174
+ dimgrey: "#696969",
2175
+ dodgerblue: "#1e90ff",
2176
+ firebrick: "#b22222",
2177
+ floralwhite: "#fffaf0",
2178
+ forestgreen: "#228b22",
2179
+ fuchsia: "#ff00ff",
2180
+ gainsboro: "#dcdcdc",
2181
+ ghostwhite: "#f8f8ff",
2182
+ gold: "#ffd700",
2183
+ goldenrod: "#daa520",
2184
+ gray: "#808080",
2185
+ green: "#008000",
2186
+ greenyellow: "#adff2f",
2187
+ grey: "#808080",
2188
+ honeydew: "#f0fff0",
2189
+ hotpink: "#ff69b4",
2190
+ indianred: "#cd5c5c",
2191
+ indigo: "#4b0082",
2192
+ ivory: "#fffff0",
2193
+ khaki: "#f0e68c",
2194
+ lavender: "#e6e6fa",
2195
+ lavenderblush: "#fff0f5",
2196
+ lawngreen: "#7cfc00",
2197
+ lemonchiffon: "#fffacd",
2198
+ lightblue: "#add8e6",
2199
+ lightcoral: "#f08080",
2200
+ lightcyan: "#e0ffff",
2201
+ lightgoldenrodyellow: "#fafad2",
2202
+ lightgray: "#d3d3d3",
2203
+ lightgreen: "#90ee90",
2204
+ lightgrey: "#d3d3d3",
2205
+ lightpink: "#ffb6c1",
2206
+ lightsalmon: "#ffa07a",
2207
+ lightseagreen: "#20b2aa",
2208
+ lightskyblue: "#87cefa",
2209
+ lightslategray: "#778899",
2210
+ lightslategrey: "#778899",
2211
+ lightsteelblue: "#b0c4de",
2212
+ lightyellow: "#ffffe0",
2213
+ lime: "#00ff00",
2214
+ limegreen: "#32cd32",
2215
+ linen: "#faf0e6",
2216
+ magenta: "#ff00ff",
2217
+ maroon: "#800000",
2218
+ mediumaquamarine: "#66cdaa",
2219
+ mediumblue: "#0000cd",
2220
+ mediumorchid: "#ba55d3",
2221
+ mediumpurple: "#9370db",
2222
+ mediumseagreen: "#3cb371",
2223
+ mediumslateblue: "#7b68ee",
2224
+ mediumspringgreen: "#00fa9a",
2225
+ mediumturquoise: "#48d1cc",
2226
+ mediumvioletred: "#c71585",
2227
+ midnightblue: "#191970",
2228
+ mintcream: "#f5fffa",
2229
+ mistyrose: "#ffe4e1",
2230
+ moccasin: "#ffe4b5",
2231
+ navajowhite: "#ffdead",
2232
+ navy: "#000080",
2233
+ oldlace: "#fdf5e6",
2234
+ olive: "#808000",
2235
+ olivedrab: "#6b8e23",
2236
+ orange: "#ffa500",
2237
+ orangered: "#ff4500",
2238
+ orchid: "#da70d6",
2239
+ palegoldenrod: "#eee8aa",
2240
+ palegreen: "#98fb98",
2241
+ paleturquoise: "#afeeee",
2242
+ palevioletred: "#db7093",
2243
+ papayawhip: "#ffefd5",
2244
+ peachpuff: "#ffdab9",
2245
+ peru: "#cd853f",
2246
+ pink: "#ffc0cb",
2247
+ plum: "#dda0dd",
2248
+ powderblue: "#b0e0e6",
2249
+ purple: "#800080",
2250
+ rebeccapurple: "#663399",
2251
+ red: "#ff0000",
2252
+ rosybrown: "#bc8f8f",
2253
+ royalblue: "#4169e1",
2254
+ saddlebrown: "#8b4513",
2255
+ salmon: "#fa8072",
2256
+ sandybrown: "#f4a460",
2257
+ seagreen: "#2e8b57",
2258
+ seashell: "#fff5ee",
2259
+ sienna: "#a0522d",
2260
+ silver: "#c0c0c0",
2261
+ skyblue: "#87ceeb",
2262
+ slateblue: "#6a5acd",
2263
+ slategray: "#708090",
2264
+ slategrey: "#708090",
2265
+ snow: "#fffafa",
2266
+ springgreen: "#00ff7f",
2267
+ steelblue: "#4682b4",
2268
+ tan: "#d2b48c",
2269
+ teal: "#008080",
2270
+ thistle: "#d8bfd8",
2271
+ transparent: "rgba(0, 0, 0, 0)",
2272
+ tomato: "#ff6347",
2273
+ turquoise: "#40e0d0",
2274
+ violet: "#ee82ee",
2275
+ wheat: "#f5deb3",
2276
+ white: "#ffffff",
2277
+ whitesmoke: "#f5f5f5",
2278
+ yellow: "#ffff00",
2279
+ yellowgreen: "#9acd32",
2280
+ padaleckipink: "oklch(100% 0.42 360deg / 71.70%)",
2281
+ "lodge-blu-color": "rgb(53 101 144)",
2282
+ lavendi: "oklch(79.90% 0.11 318.24deg / 100%)",
2283
+ shadyshroom: "oklch(53% 0.07 21.60deg / 100%)",
2284
+ patriarchalplum: "oklch(31.20% 0.11 19.80deg / 100%)"
2285
+ };
2286
+ function J(e, t, n) {
2287
+ return Math.min(Math.max(e, t), n);
2288
+ }
2289
+ function E(e, t, n, r = 0, s = 1) {
2290
+ const i = (s - r) / (n - t);
2291
+ if (n === t)
2292
+ throw new Error("fromMax and fromMin cannot be equal");
2293
+ return (e - t) * i + r;
2294
+ }
2295
+ function Tt(e, t, n) {
2296
+ return (1 - e) * t + e * n;
2297
+ }
2298
+ function Gt(e, t) {
2299
+ const n = t.length - 1, r = [...t];
2300
+ for (let s = 1; s <= n; s++)
2301
+ for (let i = 0; i <= n - s; i++)
2302
+ r[i] = Tt(e, r[i], r[i + 1]);
2303
+ return r[0];
2304
+ }
2305
+ function Ns(e, t, n, r, s) {
2306
+ return [Gt(e, [0, t, r, 1]), Gt(e, [0, n, s, 1])];
2307
+ }
2308
+ function re(e, t) {
2309
+ const n = t.map((s) => s[0]), r = t.map((s) => s[1]);
2310
+ return [Gt(e, n), Gt(e, r)];
2311
+ }
2312
+ const br = 2.4, Ht = 0.055, De = 12.92, $s = 0.04045, gr = $s / De;
2313
+ function fe(e) {
2314
+ const t = e < 0 ? -1 : 1, n = e * t;
2315
+ return n <= gr ? e / De : t * ((n + Ht) / (1 + Ht)) ** br;
2316
+ }
2317
+ function de(e) {
2318
+ const t = e < 0 ? -1 : 1, n = e * t;
2319
+ return n <= gr ? e * De : t * ((1 + Ht) * n ** (1 / br) - Ht);
2320
+ }
2321
+ function be(e, t, n) {
2322
+ return Math.min(Math.max(e, t), n);
2323
+ }
2324
+ function Ue(e, t, n) {
2325
+ const r = e + V.l[1] * t + V.l[2] * n, s = e + V.m[1] * t + V.m[2] * n, i = e + V.s[1] * t + V.s[2] * n, o = r * r * r, a = s * s * s, c = i * i * i;
2326
+ return [
2327
+ k[0] * o + k[1] * a + k[2] * c,
2328
+ k[3] * o + k[4] * a + k[5] * c,
2329
+ k[6] * o + k[7] * a + k[8] * c
2330
+ ];
2331
+ }
2332
+ function Fs(e, t, n) {
2333
+ return e >= 0 && e <= 1 && t >= 0 && t <= 1 && n >= 0 && n <= 1;
2334
+ }
2335
+ function As(e, t) {
2336
+ const n = Os.find((v) => v.test(e, t)), { k0: r, k1: s, k2: i, k3: o, k4: a, wl: c, wm: l, ws: u } = n;
2337
+ let h = r + s * e + i * t + o * e * e + a * e * t;
2338
+ const b = V.l[1] * e + V.l[2] * t, y = V.m[1] * e + V.m[2] * t, O = V.s[1] * e + V.s[2] * t;
2339
+ {
2340
+ const v = 1 + h * b, $ = 1 + h * y, x = 1 + h * O, M = v * v * v, j = $ * $ * $, ht = x * x * x, pt = 3 * b * v * v, mt = 3 * y * $ * $, Pt = 3 * O * x * x, zt = 6 * b * b * v, Ot = 6 * y * y * $, Nt = 6 * O * O * x, xt = c * M + l * j + u * ht, ft = c * pt + l * mt + u * Pt, Ut = c * zt + l * Ot + u * Nt;
2341
+ h = h - xt * ft / (ft * ft - 0.5 * xt * Ut);
2342
+ }
2343
+ return h;
2344
+ }
2345
+ function Vs(e, t) {
2346
+ const n = As(e, t), [r, s, i] = Ue(1, n * e, n * t), o = Math.cbrt(1 / Math.max(r, s, i)), a = o * n;
2347
+ return { L: o, C: a };
2348
+ }
2349
+ function Rs(e, t, n, r, s, i) {
2350
+ let o;
2351
+ if ((n - s) * i.C - (i.L - s) * r <= 0)
2352
+ o = i.C * s / (r * i.L + i.C * (s - n));
2353
+ else {
2354
+ o = i.C * (s - 1) / (r * (i.L - 1) + i.C * (s - n));
2355
+ const a = n - s, c = r, l = V.l[1] * e + V.l[2] * t, u = V.m[1] * e + V.m[2] * t, h = V.s[1] * e + V.s[2] * t, b = a + c * l, y = a + c * u, O = a + c * h;
2356
+ {
2357
+ const v = s * (1 - o) + o * n, $ = o * r, x = v + $ * l, M = v + $ * u, j = v + $ * h, ht = x * x * x, pt = M * M * M, mt = j * j * j, Pt = 3 * b * x * x, zt = 3 * y * M * M, Ot = 3 * O * j * j, Nt = 6 * b * b * x, xt = 6 * y * y * M, ft = 6 * O * O * j, Ut = k[0] * ht + k[1] * pt + k[2] * mt - 1, ae = k[0] * Pt + k[1] * zt + k[2] * Ot, rs = k[0] * Nt + k[1] * xt + k[2] * ft, an = ae / (ae * ae - 0.5 * Ut * rs);
2358
+ let ce = -Ut * an;
2359
+ const cn = k[3] * ht + k[4] * pt + k[5] * mt - 1, le = k[3] * Pt + k[4] * zt + k[5] * Ot, ss = k[3] * Nt + k[4] * xt + k[5] * ft, ln = le / (le * le - 0.5 * cn * ss);
2360
+ let ue = -cn * ln;
2361
+ const un = k[6] * ht + k[7] * pt + k[8] * mt - 1, he = k[6] * Pt + k[7] * zt + k[8] * Ot, is = k[6] * Nt + k[7] * xt + k[8] * ft, hn = he / (he * he - 0.5 * un * is);
2362
+ let pe = -un * hn;
2363
+ ce = an >= 0 ? ce : 1 / 0, ue = ln >= 0 ? ue : 1 / 0, pe = hn >= 0 ? pe : 1 / 0, o += Math.min(ce, ue, pe);
2364
+ }
2365
+ }
2366
+ return o;
2367
+ }
2368
+ const js = 1e-5, Ls = 0.05;
2369
+ function Ws(e, t, n) {
2370
+ const [r, s, i] = Ue(e, t, n);
2371
+ if (Fs(r, s, i))
2372
+ return [e, t, n];
2373
+ const o = Math.max(js, Math.sqrt(t * t + n * n)), a = t / o, c = n / o, l = Vs(a, c), u = e - 0.5, h = 0.5 + Math.abs(u) + Ls * o, b = 0.5 * (1 + Math.sign(u) * (h - Math.sqrt(h * h - 2 * Math.abs(u)))), y = Rs(a, c, e, o, b, l), O = b * (1 - y) + y * e, v = y * o;
2374
+ return [O, v * a, v * c];
2375
+ }
2376
+ function Ds(e, t, n) {
2377
+ const r = fe(e), s = fe(t), i = fe(n), o = Math.cbrt(nt[0] * r + nt[1] * s + nt[2] * i), a = Math.cbrt(nt[3] * r + nt[4] * s + nt[5] * i), c = Math.cbrt(nt[6] * r + nt[7] * s + nt[8] * i);
2378
+ return [
2379
+ 0.2104542553 * o + 0.793617785 * a - 0.0040720468 * c,
2380
+ 1.9779984951 * o - 2.428592205 * a + 0.4505937099 * c,
2381
+ 0.0259040371 * o + 0.7827717662 * a - 0.808675766 * c
2382
+ ];
2383
+ }
2384
+ function Us(e, t, n) {
2385
+ if (e >= 0 && e <= 1 && t >= 0 && t <= 1 && n >= 0 && n <= 1)
2386
+ return [e, t, n];
2387
+ const [r, s, i] = Ds(e, t, n), [o, a, c] = Ws(r, s, i), [l, u, h] = Ue(o, a, c);
2388
+ return [
2389
+ be(de(l), 0, 1),
2390
+ be(de(u), 0, 1),
2391
+ be(de(h), 0, 1)
2392
+ ];
2393
+ }
2394
+ const at = 16, qs = (e) => {
2395
+ if (e = e.slice(1), e.length <= 4) {
2396
+ const t = parseInt(e[0] + e[0], at), n = parseInt(e[1] + e[1], at), r = parseInt(e[2] + e[2], at), s = e[3] ? parseInt(e[3] + e[3], at) / F : 1;
2397
+ return new q(t, n, r, s);
2398
+ } else {
2399
+ const t = parseInt(e.slice(0, 2), at), n = parseInt(e.slice(2, 4), at), r = parseInt(e.slice(4, 6), at), s = e.length === 8 ? parseInt(e.slice(6, 8), at) / F : 1;
2400
+ return new q(t, n, r, s);
2401
+ }
2402
+ }, wr = 1e3, kr = 4e4, yr = 100, xr = ({ kelvin: e, alpha: t }) => {
2403
+ e = J(e, wr, kr) / yr;
2404
+ let n, r, s;
2405
+ return e <= 66 ? n = F : (n = e - 60, n = 329.698727446 * n ** -0.1332047592), n = J(n, 0, F) / F, e <= 66 ? (r = e, r = 99.4708025861 * Math.log(r) - 161.1195681661) : (r = e - 60, r = 288.1221695283 * r ** -0.0755148492), r = J(r, 0, F) / F, e >= 66 ? s = F : e <= 19 ? s = 0 : (s = e - 10, s = 138.5177312231 * Math.log(s) - 305.0447927307), s = J(s, 0, F) / F, new q(n, r, s, t);
2406
+ }, Ks = ({ r: e, g: t, b: n, alpha: r }) => {
2407
+ e = J(e * F, 0, F), t = J(t * F, 0, F), n = J(n * F, 0, F);
2408
+ let s;
2409
+ if (n === F ? s = 6600 : n === 0 ? s = 1900 : s = Math.exp((n + 305.0447927307) / 138.5177312231) + 10, e < F) {
2410
+ const o = (329.698727446 / e) ** -7.507239275877164 + 60;
2411
+ s = Math.max(s, o);
2412
+ }
2413
+ const i = s <= 6600 ? Math.exp((t + 161.1195681661) / 99.4708025861) : (288.1221695283 / t) ** (1 / -0.0755148492) + 60;
2414
+ return s = (s + i) / 2, s = J(Math.round(s * yr), wr, kr), new sr(s, r);
2415
+ }, Sr = ({ h: e, s: t, v: n, alpha: r }) => {
2416
+ const s = n - n * t / 2;
2417
+ let i;
2418
+ return s === 0 || s === 1 ? i = 0 : i = (n - s) / Math.min(s, 1 - s), new jt(e, i, s, r);
2419
+ }, vr = ({ h: e, s: t, l: n, alpha: r }) => {
2420
+ const s = n + t * Math.min(n, 1 - n);
2421
+ let i;
2422
+ return s === 0 ? i = 0 : i = 2 * (1 - n / s), new ze(e, i, s, r);
2423
+ }, Xs = ({ h: e, w: t, b: n, alpha: r }) => {
2424
+ let s, i;
2425
+ const o = t + n;
2426
+ return o >= 1 ? (i = t / o, s = 0) : (i = 1 - n, s = i === 0 ? 0 : 1 - t / i), Sr(new ze(e, s, i, r));
2427
+ }, Ys = ({ h: e, s: t, l: n, alpha: r }) => {
2428
+ const { h: s, s: i, v: o } = vr(new jt(e, t, n, r));
2429
+ return new Oe(s, o * (1 - i), 1 - o, r);
2430
+ }, Gs = ({ r: e, g: t, b: n, alpha: r }) => {
2431
+ const s = Math.max(e, t, n), i = Math.min(e, t, n);
2432
+ let [o, a, c] = [0, 0, (s + i) / 2];
2433
+ const l = s - i;
2434
+ switch (a = l / (1 - Math.abs(2 * c - 1)), s) {
2435
+ case e:
2436
+ o = (t - n) / l + (t < n ? 6 : 0);
2437
+ break;
2438
+ case t:
2439
+ o = (n - e) / l + 2;
2440
+ break;
2441
+ case n:
2442
+ o = (e - t) / l + 4;
2443
+ break;
2444
+ }
2445
+ return o /= 6, a < 0 && (o = (o + 0.5) % 1, a = Math.abs(a) % 1), o >= 1 && (o -= 1), new jt(o, a, c, r);
2446
+ };
2447
+ function Hs({ h: e, s: t, l: n, alpha: r }) {
2448
+ const s = (1 - Math.abs(2 * n - 1)) * t, i = s * (1 - Math.abs(e * 6 % 2 - 1)), o = n - s / 2;
2449
+ let a, c, l;
2450
+ return e < 1 / 6 ? [a, c, l] = [s, i, 0] : e < 2 / 6 ? [a, c, l] = [i, s, 0] : e < 3 / 6 ? [a, c, l] = [0, s, i] : e < 4 / 6 ? [a, c, l] = [0, i, s] : e < 5 / 6 ? [a, c, l] = [i, 0, s] : [a, c, l] = [s, 0, i], new q(a + o, c + o, l + o, r);
2451
+ }
2452
+ const Zs = 216 / 24389, Js = 24 / 116, Se = 24389 / 27, Qs = 8, Vt = 16, Rt = 116, Cr = 500, Er = 200;
2453
+ function _s(e) {
2454
+ if (e.whitePoint === "D50") return [e.x, e.y, e.z];
2455
+ if (e.whitePoint === "D65") return N([e.x, e.y, e.z], We);
2456
+ throw new Error(`Unsupported white point: ${e.whitePoint}`);
2457
+ }
2458
+ function ti(e) {
2459
+ if (e.whitePoint === "D65") return [e.x, e.y, e.z];
2460
+ if (e.whitePoint === "D50") return N([e.x, e.y, e.z], pr);
2461
+ throw new Error(`Unsupported white point: ${e.whitePoint}`);
2462
+ }
2463
+ function Mr(e, t = "D50") {
2464
+ const n = (x) => x > Zs ? Math.cbrt(x) : (Se * x + Vt) / Rt, r = mr[t], [s, i, o] = _s(e), a = s / r[0], c = i / r[1], l = o / r[2], u = n(a), h = n(c), b = n(l), y = Rt * h - Vt, O = Cr * (u - h), v = Er * (h - b), $ = new ee(
2465
+ E(
2466
+ y,
2467
+ f.lab.l.number.min,
2468
+ f.lab.l.number.max
2469
+ ),
2470
+ E(
2471
+ O,
2472
+ f.lab.a.number.min,
2473
+ f.lab.a.number.max
2474
+ ),
2475
+ E(
2476
+ v,
2477
+ f.lab.b.number.min,
2478
+ f.lab.b.number.max
2479
+ ),
2480
+ e.alpha
2481
+ );
2482
+ return $.whitePoint = t, $;
2483
+ }
2484
+ function Ir(e) {
2485
+ const t = (M) => M > Js ? M ** 3 : (Rt * M - Vt) / Se, n = (M) => M > Qs ? ((M + Vt) / Rt) ** 3 : M / Se, r = mr[e.whitePoint];
2486
+ let { l: s, a: i, b: o, alpha: a } = e;
2487
+ s = E(
2488
+ s,
2489
+ 0,
2490
+ 1,
2491
+ f.lab.l.number.min,
2492
+ f.lab.l.number.max
2493
+ ), i = E(
2494
+ i,
2495
+ 0,
2496
+ 1,
2497
+ f.lab.a.number.min,
2498
+ f.lab.a.number.max
2499
+ ), o = E(
2500
+ o,
2501
+ 0,
2502
+ 1,
2503
+ f.lab.b.number.min,
2504
+ f.lab.b.number.max
2505
+ );
2506
+ const c = (s + Vt) / Rt, l = i / Cr + c, u = c - o / Er, [h, b, y] = [t(l), n(s), t(u)];
2507
+ let O = h * r[0], v = b * r[1], $ = y * r[2];
2508
+ const x = new Y(O, v, $, a);
2509
+ return x.whitePoint = e.whitePoint, [O, v, $] = ti(x), x.whitePoint = "D65", x.x = O, x.y = v, x.z = $, x;
2510
+ }
2511
+ const qe = [
2512
+ 0.41239079926595934,
2513
+ 0.357584339383878,
2514
+ 0.1804807884018343,
2515
+ 0.21263900587151027,
2516
+ 0.715168678767756,
2517
+ 0.07219231536073371,
2518
+ 0.01933081871559182,
2519
+ 0.11919477979462598,
2520
+ 0.9505321522496607
2521
+ ], Br = lt(qe), Tr = 2.4, Zt = 0.055, Ke = 12.92, ei = 0.04045, Pr = ei / Ke;
2522
+ function Ct(e) {
2523
+ const t = e < 0 ? -1 : 1, n = e * t;
2524
+ return n <= Pr ? e / Ke : t * ((n + Zt) / (1 + Zt)) ** Tr;
2525
+ }
2526
+ function zr(e) {
2527
+ const t = e < 0 ? -1 : 1, n = e * t;
2528
+ return n <= Pr ? e * Ke : t * ((1 + Zt) * n ** (1 / Tr) - Zt);
2529
+ }
2530
+ function Xe({ r: e, g: t, b: n, alpha: r }) {
2531
+ const s = [Ct(e), Ct(t), Ct(n)], [i, o, a] = N(s, qe);
2532
+ return new Y(i, o, a, r);
2533
+ }
2534
+ const Ye = ({ x: e, y: t, z: n, alpha: r }, s = !0) => {
2535
+ const i = N([e, t, n], Br), [o, a, c] = i.map(zr);
2536
+ if (s) {
2537
+ const l = Ni(new q(o, a, c, r));
2538
+ return new q(l.r, l.g, l.b, r);
2539
+ } else
2540
+ return new q(o, a, c, r);
2541
+ };
2542
+ function ni({ l: e, c: t, h: n, alpha: r }) {
2543
+ t = E(
2544
+ t,
2545
+ 0,
2546
+ 1,
2547
+ f.lch.c.number.min,
2548
+ f.lch.c.number.max
2549
+ );
2550
+ const s = n * 2 * Math.PI, i = Math.cos(s) * t, o = Math.sin(s) * t;
2551
+ return new ee(
2552
+ e,
2553
+ E(
2554
+ i,
2555
+ f.lab.a.number.min,
2556
+ f.lab.a.number.max
2557
+ ),
2558
+ E(
2559
+ o,
2560
+ f.lab.b.number.min,
2561
+ f.lab.b.number.max
2562
+ ),
2563
+ r
2564
+ );
2565
+ }
2566
+ function ri({ l: e, a: t, b: n, alpha: r }) {
2567
+ t = E(
2568
+ t,
2569
+ 0,
2570
+ 1,
2571
+ f.lab.a.number.min,
2572
+ f.lab.a.number.max
2573
+ ), n = E(
2574
+ n,
2575
+ 0,
2576
+ 1,
2577
+ f.lab.b.number.min,
2578
+ f.lab.b.number.max
2579
+ );
2580
+ const s = Math.hypot(t, n);
2581
+ let i = Math.atan2(n, t) / (2 * Math.PI);
2582
+ return i < 0 && (i += 1), new Ne(
2583
+ e,
2584
+ E(
2585
+ s,
2586
+ f.lch.c.number.min,
2587
+ f.lch.c.number.max
2588
+ ),
2589
+ i,
2590
+ r
2591
+ );
2592
+ }
2593
+ function Or({ l: e, a: t, b: n, alpha: r }) {
2594
+ t = E(
2595
+ t,
2596
+ 0,
2597
+ 1,
2598
+ f.oklab.a.number.min,
2599
+ f.oklab.a.number.max
2600
+ ), n = E(
2601
+ n,
2602
+ 0,
2603
+ 1,
2604
+ f.oklab.b.number.min,
2605
+ f.oklab.b.number.max
2606
+ );
2607
+ const s = N([e, t, n], zs), i = [s[0] * s[0] * s[0], s[1] * s[1] * s[1], s[2] * s[2] * s[2]], [o, a, c] = N(i, Ps);
2608
+ return new Y(o, a, c, r);
2609
+ }
2610
+ function Nr(e) {
2611
+ const { x: t, y: n, z: r } = e, s = N([t, n, r], fr), i = [Math.cbrt(s[0]), Math.cbrt(s[1]), Math.cbrt(s[2])], [o, a, c] = N(i, dr);
2612
+ return new ne(
2613
+ o,
2614
+ E(
2615
+ a,
2616
+ f.oklab.a.number.min,
2617
+ f.oklab.a.number.max
2618
+ ),
2619
+ E(
2620
+ c,
2621
+ f.oklab.b.number.min,
2622
+ f.oklab.b.number.max
2623
+ ),
2624
+ e.alpha
2625
+ );
2626
+ }
2627
+ function si({ l: e, a: t, b: n, alpha: r }) {
2628
+ t = E(t, 0, 1, f.oklab.a.number.min, f.oklab.a.number.max), n = E(n, 0, 1, f.oklab.b.number.min, f.oklab.b.number.max);
2629
+ const s = Math.hypot(t, n);
2630
+ let i = Math.atan2(n, t) / (2 * Math.PI);
2631
+ return i < 0 && (i += 1), new $e(
2632
+ e,
2633
+ E(s, f.oklch.c.number.min, f.oklch.c.number.max),
2634
+ i,
2635
+ r
2636
+ );
2637
+ }
2638
+ function ii({ l: e, c: t, h: n, alpha: r }) {
2639
+ t = E(t, 0, 1, f.oklch.c.number.min, f.oklch.c.number.max);
2640
+ const s = n * 2 * Math.PI, i = Math.cos(s) * t, o = Math.sin(s) * t;
2641
+ return new ne(
2642
+ e,
2643
+ E(i, f.oklab.a.number.min, f.oklab.a.number.max),
2644
+ E(o, f.oklab.b.number.min, f.oklab.b.number.max),
2645
+ r
2646
+ );
2647
+ }
2648
+ function Ge(e) {
2649
+ const t = Hs(e);
2650
+ return Xe(t);
2651
+ }
2652
+ function He(e) {
2653
+ const t = Ye(e);
2654
+ return Gs(t);
2655
+ }
2656
+ function oi(e) {
2657
+ const t = Sr(e);
2658
+ return Ge(t);
2659
+ }
2660
+ function ai(e) {
2661
+ const t = He(e);
2662
+ return vr(t);
2663
+ }
2664
+ function ci(e) {
2665
+ const t = Xs(e);
2666
+ return Ge(t);
2667
+ }
2668
+ function li(e) {
2669
+ const t = He(e);
2670
+ return Ys(t);
2671
+ }
2672
+ function ui(e) {
2673
+ const t = ni(e);
2674
+ return Ir(t);
2675
+ }
2676
+ function hi(e) {
2677
+ const t = Mr(e);
2678
+ return ri(t);
2679
+ }
2680
+ function pi(e) {
2681
+ const t = ii(e);
2682
+ return Or(t);
2683
+ }
2684
+ function mi(e) {
2685
+ const t = Nr(e);
2686
+ return si(t);
2687
+ }
2688
+ function fi(e) {
2689
+ const t = xr(e);
2690
+ return Xe(t);
2691
+ }
2692
+ function di(e) {
2693
+ const t = Ye(e);
2694
+ return Ks(t);
2695
+ }
2696
+ const $r = 563 / 256;
2697
+ function ge(e) {
2698
+ return (e < 0 ? -1 : 1) * Math.abs(e) ** $r;
2699
+ }
2700
+ function bi(e) {
2701
+ return (e < 0 ? -1 : 1) * Math.abs(e) ** (1 / $r);
2702
+ }
2703
+ const Fr = 1 / 512, Ar = 1.8;
2704
+ function we(e) {
2705
+ const t = e < 0 ? -1 : 1, n = Math.abs(e);
2706
+ return t * (n <= Fr * 16 ? n / 16 : n ** Ar);
2707
+ }
2708
+ function gi(e) {
2709
+ const t = e < 0 ? -1 : 1, n = Math.abs(e);
2710
+ return t * (n >= Fr ? n ** (1 / Ar) : n * 16);
2711
+ }
2712
+ const Jt = 1.09929682680944, Vr = 0.018053968510807;
2713
+ function ke(e) {
2714
+ const t = e < 0 ? -1 : 1, n = Math.abs(e);
2715
+ return n < Vr * 4.5 ? t * n / 4.5 : t * ((n + Jt - 1) / Jt) ** (1 / 0.45);
2716
+ }
2717
+ function wi(e) {
2718
+ const t = e < 0 ? -1 : 1, n = Math.abs(e);
2719
+ return n >= Vr ? t * (Jt * n ** 0.45 - (Jt - 1)) : t * 4.5 * n;
2720
+ }
2721
+ const Rr = [
2722
+ 0.4865709486482162,
2723
+ 0.26566769316909306,
2724
+ 0.1982172852343625,
2725
+ 0.22897456406974884,
2726
+ 0.6917385218365064,
2727
+ 0.079286914093745,
2728
+ 0,
2729
+ 0.04511338185890264,
2730
+ 1.043944368900976
2731
+ ], ki = lt(Rr), jr = [
2732
+ 0.5766690429101305,
2733
+ 0.1855582379065463,
2734
+ 0.1882286462349947,
2735
+ 0.29734497525053605,
2736
+ 0.6273635662554661,
2737
+ 0.07529145849399788,
2738
+ 0.02703136138641234,
2739
+ 0.07068885253582723,
2740
+ 0.9913375368376388
2741
+ ], yi = lt(jr), Lr = [
2742
+ 0.7977604896723027,
2743
+ 0.13518583717574031,
2744
+ 0.0313493495815248,
2745
+ 0.2880711282292934,
2746
+ 0.7118432178101014,
2747
+ 8565396060525902e-20,
2748
+ 0,
2749
+ 0,
2750
+ 0.8251046025104602
2751
+ ], xi = lt(Lr), Wr = [
2752
+ 0.6369580483012914,
2753
+ 0.14461690358620832,
2754
+ 0.1688809751641721,
2755
+ 0.2627002120112671,
2756
+ 0.6779980715188708,
2757
+ 0.05930171646986196,
2758
+ 0,
2759
+ 0.028072693049087428,
2760
+ 1.0609850577107909
2761
+ ], Si = lt(Wr);
2762
+ function vi({ r: e, g: t, b: n, alpha: r }) {
2763
+ const [s, i, o] = N([e, t, n], qe);
2764
+ return new Y(s, i, o, r);
2765
+ }
2766
+ function Ci({ x: e, y: t, z: n, alpha: r }) {
2767
+ const [s, i, o] = N([e, t, n], Br);
2768
+ return new Fe(s, i, o, r);
2769
+ }
2770
+ function Ei({ r: e, g: t, b: n, alpha: r }) {
2771
+ const s = [Ct(e), Ct(t), Ct(n)], [i, o, a] = N(s, Rr);
2772
+ return new Y(i, o, a, r);
2773
+ }
2774
+ function Mi({ x: e, y: t, z: n, alpha: r }) {
2775
+ const s = N([e, t, n], ki), [i, o, a] = s.map(zr);
2776
+ return new Ae(i, o, a, r);
2777
+ }
2778
+ function Ii({ r: e, g: t, b: n, alpha: r }) {
2779
+ const s = [ge(e), ge(t), ge(n)], [i, o, a] = N(s, jr);
2780
+ return new Y(i, o, a, r);
2781
+ }
2782
+ function Bi({ x: e, y: t, z: n, alpha: r }) {
2783
+ const s = N([e, t, n], yi), [i, o, a] = s.map(bi);
2784
+ return new Ve(i, o, a, r);
2785
+ }
2786
+ function Ti({ r: e, g: t, b: n, alpha: r }) {
2787
+ const s = [we(e), we(t), we(n)], i = N(s, Lr), [o, a, c] = N(i, pr);
2788
+ return new Y(o, a, c, r);
2789
+ }
2790
+ function Pi({ x: e, y: t, z: n, alpha: r }) {
2791
+ const s = N([e, t, n], We), i = N(s, xi), [o, a, c] = i.map(gi);
2792
+ return new Re(o, a, c, r);
2793
+ }
2794
+ function zi({ r: e, g: t, b: n, alpha: r }) {
2795
+ const s = [ke(e), ke(t), ke(n)], [i, o, a] = N(s, Wr);
2796
+ return new Y(i, o, a, r);
2797
+ }
2798
+ function Oi({ x: e, y: t, z: n, alpha: r }) {
2799
+ const s = N([e, t, n], Si), [i, o, a] = s.map(wi);
2800
+ return new je(i, o, a, r);
2801
+ }
2802
+ const xn = {
2803
+ rgb: { to: Xe, from: Ye },
2804
+ hsl: { to: Ge, from: He },
2805
+ hsv: { to: oi, from: ai },
2806
+ hwb: { to: ci, from: li },
2807
+ lab: { to: Ir, from: Mr },
2808
+ lch: { to: ui, from: hi },
2809
+ oklab: { to: Or, from: Nr },
2810
+ oklch: { to: pi, from: mi },
2811
+ kelvin: { to: fi, from: di },
2812
+ xyz: { to: (e) => e, from: (e) => e },
2813
+ "srgb-linear": { to: vi, from: Ci },
2814
+ "display-p3": { to: Ei, from: Mi },
2815
+ "a98-rgb": { to: Ii, from: Bi },
2816
+ "prophoto-rgb": { to: Ti, from: Pi },
2817
+ rec2020: { to: zi, from: Oi }
2818
+ };
2819
+ function yt(e, t) {
2820
+ if (e.colorSpace === t)
2821
+ return e;
2822
+ const n = xn[e.colorSpace];
2823
+ if (!n)
2824
+ throw new Error(`Unknown source color space: "${e.colorSpace}"`);
2825
+ const r = xn[t];
2826
+ if (!r)
2827
+ throw new Error(`Unknown target color space: "${t}"`);
2828
+ const s = n.to(e), i = r.from;
2829
+ return i(s);
2830
+ }
2831
+ const St = 1e-6;
2832
+ function Ni(e) {
2833
+ const t = yt(e, "rgb"), n = Number.isNaN(t.r) ? 0 : t.r, r = Number.isNaN(t.g) ? 0 : t.g, s = Number.isNaN(t.b) ? 0 : t.b;
2834
+ if (n >= 0 && n <= 1 && r >= 0 && r <= 1 && s >= 0 && s <= 1)
2835
+ return e;
2836
+ if (n >= -St && n <= 1 + St && r >= -St && r <= 1 + St && s >= -St && s <= 1 + St) {
2837
+ const l = new q(J(n, 0, 1), J(r, 0, 1), J(s, 0, 1), e.alpha);
2838
+ return yt(l, e.colorSpace);
2839
+ }
2840
+ const [i, o, a] = Us(n, r, s), c = new q(i, o, a, e.alpha);
2841
+ return yt(c, e.colorSpace);
2842
+ }
2843
+ const $i = {
2844
+ hsl: "h",
2845
+ hsv: "h",
2846
+ hwb: "h",
2847
+ lch: "h",
2848
+ oklch: "h"
2849
+ };
2850
+ function Fi(e, t, n, r = "shorter") {
2851
+ if (Number.isNaN(e) && Number.isNaN(t)) return 0;
2852
+ if (Number.isNaN(e)) return t;
2853
+ if (Number.isNaN(t)) return e;
2854
+ let s = t - e;
2855
+ switch (r) {
2856
+ case "shorter":
2857
+ s > 0.5 ? e += 1 : s < -0.5 && (t += 1);
2858
+ break;
2859
+ case "longer":
2860
+ s > 0 && s < 0.5 ? e += 1 : s > -0.5 && s <= 0 && (t += 1);
2861
+ break;
2862
+ case "increasing":
2863
+ s < 0 && (t += 1);
2864
+ break;
2865
+ case "decreasing":
2866
+ s > 0 && (e += 1);
2867
+ break;
2868
+ }
2869
+ let i = e + n * (t - e);
2870
+ return i = (i % 1 + 1) % 1, i;
2871
+ }
2872
+ function Ai(e, t, n, r, s = "oklab", i = "shorter") {
2873
+ const o = yt(e, s), a = yt(t, s);
2874
+ n < 0 && (n = 0), r < 0 && (r = 0);
2875
+ const c = n + r;
2876
+ c === 0 ? (n = 0.5, r = 0.5) : c !== 1 && (n = n / c, r = r / c);
2877
+ const l = Math.min(c, 1), u = $i[s], h = o.keys().filter((x) => x !== "alpha"), b = Number.isNaN(o.alpha) ? a.alpha : o.alpha, y = Number.isNaN(a.alpha) ? o.alpha : a.alpha, O = Tt(r, b, y) * l, v = [];
2878
+ for (const x of h) {
2879
+ let M = o[x], j = a[x];
2880
+ if (Number.isNaN(M) && Number.isNaN(j)) {
2881
+ v.push(0);
2882
+ continue;
2883
+ }
2884
+ if (Number.isNaN(M) && (M = j), Number.isNaN(j) && (j = M), x === u)
2885
+ v.push(Fi(M, j, r, i));
2886
+ else {
2887
+ const ht = M * b, pt = j * y, mt = Tt(r, ht, pt);
2888
+ v.push(O > 0 ? mt / O : 0);
2889
+ }
2890
+ }
2891
+ const $ = o.constructor;
2892
+ return new $(...v, O);
2893
+ }
2894
+ const Vi = (e, t, n) => {
2895
+ const r = f[t][n];
2896
+ return r[e] ?? r.number;
2897
+ }, Ri = (e, t, n, r, s = !1) => {
2898
+ t = s ? Is[n][r] : t;
2899
+ const { min: i, max: o } = Vi(t, n, r), [a, c, l, u] = s ? [i, o, 0, 1] : [0, 1, i, o], h = E(e, l, u, a, c);
2900
+ return new d(h, s ? t : "");
2901
+ }, ji = (e, t = !1) => {
2902
+ const n = e.colorSpace;
2903
+ return e.keys().forEach((r) => {
2904
+ const s = e[r] instanceof d ? e[r].value : e[r];
2905
+ e[r] = Ri(
2906
+ s,
2907
+ e[r]?.unit,
2908
+ n,
2909
+ r,
2910
+ t
2911
+ );
2912
+ }), e;
2913
+ }, ve = (e, t = !1, n = !1) => {
2914
+ e = n ? e : e.clone();
2915
+ const r = ji(e.value, t);
2916
+ return n ? e : new d(r).coalesce(e, !0);
2917
+ }, Sn = (e, t = "lab", n = !1, r = !1, s = !1) => {
2918
+ const i = n ? s ? e : e.clone() : ve(e, !1, s), o = yt(i.toJSON(), t);
2919
+ return o.entries().forEach(([a, c]) => {
2920
+ o[a] = new d(c);
2921
+ }), i.value = o, i.superType[1] = t, r ? ve(i, !0, !0) : i;
2922
+ }, Li = (e, t, n = "lab", r = !1, s = !1, i = !1) => [
2923
+ Sn(e, n, r, s, i),
2924
+ Sn(t, n, r, s, i)
2925
+ ], K = (e) => new d(
2926
+ e,
2927
+ "color",
2928
+ ["color", e.colorSpace],
2929
+ void 0,
2930
+ "color"
2931
+ );
2932
+ function Ce(e) {
2933
+ const t = ve(e).value, n = t.clone();
2934
+ for (const r of t.keys()) {
2935
+ const s = t[r];
2936
+ n[r] = s instanceof d ? s.value : s;
2937
+ }
2938
+ return n;
2939
+ }
2940
+ function Wi(e) {
2941
+ const t = e.replace(/[^0-9.+\-*/() e]/g, "");
2942
+ return new Function(`return (${t})`)();
2943
+ }
2944
+ function vn(e, t) {
2945
+ switch (e.type) {
2946
+ case "ref":
2947
+ return t[e.name] ?? 0;
2948
+ case "literal":
2949
+ return e.value;
2950
+ case "none":
2951
+ return NaN;
2952
+ case "calc": {
2953
+ let n = e.expr;
2954
+ const r = Object.keys(t).sort((s, i) => i.length - s.length);
2955
+ for (const s of r)
2956
+ n = n.replace(new RegExp(`\\b${s}\\b`, "g"), String(t[s]));
2957
+ return Wi(n);
2958
+ }
2959
+ }
2960
+ }
2961
+ function Di(e, t, n, r) {
2962
+ const s = Ce(e), i = yt(s, t), o = {};
2963
+ for (const [h, b] of i.entries())
2964
+ o[h] = b;
2965
+ const a = n.map((h) => vn(h, o)), c = r ? vn(r, o) : o.alpha ?? 1, l = {
2966
+ rgb: q,
2967
+ hsl: jt,
2968
+ hwb: Oe,
2969
+ lab: ee,
2970
+ lch: Ne,
2971
+ oklab: ne,
2972
+ oklch: $e,
2973
+ xyz: Y,
2974
+ "srgb-linear": Fe,
2975
+ "display-p3": Ae,
2976
+ "a98-rgb": Ve,
2977
+ "prophoto-rgb": Re,
2978
+ rec2020: je
2979
+ }[t] ?? q, u = new l(...a, c);
2980
+ return K(u);
2981
+ }
2982
+ const Ui = {
2983
+ srgb: "rgb",
2984
+ "srgb-linear": "srgb-linear",
2985
+ "display-p3": "display-p3",
2986
+ "a98-rgb": "a98-rgb",
2987
+ "prophoto-rgb": "prophoto-rgb",
2988
+ rec2020: "rec2020",
2989
+ lab: "lab",
2990
+ oklab: "oklab",
2991
+ oklch: "oklch",
2992
+ hsl: "hsl",
2993
+ hwb: "hwb",
2994
+ lch: "lch",
2995
+ xyz: "xyz",
2996
+ "xyz-d65": "xyz",
2997
+ "xyz-d50": "xyz"
2998
+ }, qi = {
2999
+ srgb: { space: "rgb", ctor: q },
3000
+ "srgb-linear": { space: "srgb-linear", ctor: Fe },
3001
+ "display-p3": { space: "display-p3", ctor: Ae },
3002
+ "a98-rgb": { space: "a98-rgb", ctor: Ve },
3003
+ "prophoto-rgb": { space: "prophoto-rgb", ctor: Re },
3004
+ rec2020: { space: "rec2020", ctor: je },
3005
+ xyz: { space: "xyz", ctor: Y },
3006
+ "xyz-d65": { space: "xyz", ctor: Y },
3007
+ "xyz-d50": { space: "xyz", ctor: Y }
3008
+ }, Ki = z(","), Xi = G(/\s+/), Ze = z("/"), se = z("("), ie = z(")"), Ee = g(Ki.trim(w), Xi), Yi = g(Ze.trim(w), Ee), tt = S.lazy(() => g(
3009
+ A.Percentage,
3010
+ A.Angle.map((e) => {
3011
+ const t = cr(e.value, e.unit);
3012
+ return new d(t, "deg", ["angle"]);
3013
+ }),
3014
+ g(it, Cs).map((e) => new d(e)),
3015
+ Le.map(() => new d(NaN))
3016
+ )), Kt = g(
3017
+ // calc(...)
3018
+ p("calc").next(
3019
+ G(/\(([^)]+)\)/, (e) => e?.[1] ?? null)
3020
+ ).map((e) => ({ type: "calc", expr: e })),
3021
+ // none
3022
+ Le.map(() => ({ type: "none" })),
3023
+ // component reference (alpha must be tried before single 'a')
3024
+ G(/\b(alpha|r|g|b|h|s|l|c|w|a|x|y|z)\b/).map(
3025
+ (e) => ({ type: "ref", name: e })
3026
+ ),
3027
+ // literal number / percentage / angle
3028
+ tt.map((e) => ({ type: "literal", value: e.value }))
3029
+ ), ot = (e) => {
3030
+ const t = z(e).skip(p("a").opt()), n = g(
3031
+ T(tt.skip(Yi), tt),
3032
+ tt.map((s) => [s])
3033
+ ), r = T(
3034
+ tt.skip(Ee),
3035
+ tt.skip(Ee),
3036
+ n
3037
+ ).trim(w).wrap(se, ie);
3038
+ return t.next(r).map(([s, i, [o, a]]) => [s, i, o, a ?? new d(1)]);
3039
+ };
3040
+ function ut(e, t) {
3041
+ return z(e).skip(p("a").opt()).next(
3042
+ T(
3043
+ p("from").skip(w).next(S.lazy(() => Je.Value)),
3044
+ w.next(Kt),
3045
+ w.next(Kt),
3046
+ w.next(Kt),
3047
+ Ze.trim(w).next(Kt).opt()
3048
+ ).trim(w).wrap(se, ie)
3049
+ ).map(([n, r, s, i, o]) => Di(n, t, [r, s, i], o));
3050
+ }
3051
+ const Gi = G(/#[0-9a-fA-F]{3,8}/).map((e) => {
3052
+ const { r: t, g: n, b: r, alpha: s } = qs(e);
3053
+ return K(new q(t, n, r, s));
3054
+ }), Hi = it.skip(p("k")).map((e) => {
3055
+ const t = xr(new sr(e));
3056
+ return K(t);
3057
+ }), Zi = g(
3058
+ ut("rgb", "rgb"),
3059
+ ot("rgb").map(
3060
+ ([e, t, n, r]) => K(new q(e, t, n, r))
3061
+ )
3062
+ ), Ji = g(
3063
+ ut("hsl", "hsl"),
3064
+ ot("hsl").map(
3065
+ ([e, t, n, r]) => K(new jt(e, t, n, r))
3066
+ )
3067
+ ), Qi = ot("hsv").map(
3068
+ ([e, t, n, r]) => K(new ze(e, t, n, r))
3069
+ ), _i = g(
3070
+ ut("hwb", "hwb"),
3071
+ ot("hwb").map(
3072
+ ([e, t, n, r]) => K(new Oe(e, t, n, r))
3073
+ )
3074
+ ), to = g(
3075
+ ut("lab", "lab"),
3076
+ ot("lab").map(
3077
+ ([e, t, n, r]) => K(new ee(e, t, n, r))
3078
+ )
3079
+ ), eo = g(
3080
+ ut("lch", "lch"),
3081
+ ot("lch").map(
3082
+ ([e, t, n, r]) => K(new Ne(e, t, n, r))
3083
+ )
3084
+ ), no = g(
3085
+ ut("oklab", "oklab"),
3086
+ ot("oklab").map(
3087
+ ([e, t, n, r]) => K(new ne(e, t, n, r))
3088
+ )
3089
+ ), ro = g(
3090
+ ut("oklch", "oklch"),
3091
+ ot("oklch").map(
3092
+ ([e, t, n, r]) => K(new $e(e, t, n, r))
3093
+ )
3094
+ ), so = g(
3095
+ ut("xyz", "xyz"),
3096
+ ot("xyz").map(
3097
+ ([e, t, n, r]) => K(new Y(e, t, n, r))
3098
+ )
3099
+ ), io = g(
3100
+ p("srgb-linear").map(() => "srgb-linear"),
3101
+ p("srgb").map(() => "srgb"),
3102
+ p("display-p3").map(() => "display-p3"),
3103
+ p("a98-rgb").map(() => "a98-rgb"),
3104
+ p("prophoto-rgb").map(() => "prophoto-rgb"),
3105
+ p("rec2020").map(() => "rec2020"),
3106
+ p("oklab").map(() => "oklab"),
3107
+ p("oklch").map(() => "oklch"),
3108
+ p("lab").map(() => "lab"),
3109
+ p("lch").map(() => "lch"),
3110
+ p("hsl").map(() => "hsl"),
3111
+ p("hwb").map(() => "hwb"),
3112
+ p("xyz-d65").map(() => "xyz-d65"),
3113
+ p("xyz-d50").map(() => "xyz-d50"),
3114
+ p("xyz").map(() => "xyz")
3115
+ ), oo = g(
3116
+ p("shorter"),
3117
+ p("longer"),
3118
+ p("increasing"),
3119
+ p("decreasing")
3120
+ ).skip(w).skip(p("hue")), Cn = S.lazy(
3121
+ () => T(
3122
+ Je.Value,
3123
+ w.next(A.Percentage).opt()
3124
+ )
3125
+ ), ao = p("color-mix").next(
3126
+ T(
3127
+ // "in <space> [<hueMethod>]"
3128
+ p("in").skip(w).next(
3129
+ T(
3130
+ io,
3131
+ w.next(oo).opt()
3132
+ )
3133
+ ),
3134
+ // ", <color> [<pct>]?"
3135
+ z(",").trim(w).next(Cn),
3136
+ // ", <color> [<pct>]?"
3137
+ z(",").trim(w).next(Cn)
3138
+ ).trim(w).wrap(se, ie)
3139
+ ).map(([[e, t], [n, r], [s, i]]) => {
3140
+ const o = Ui[e] ?? "oklab", a = t ?? "shorter";
3141
+ let c = r != null ? r.value / 100 : -1, l = i != null ? i.value / 100 : -1;
3142
+ c < 0 && l < 0 ? (c = 0.5, l = 0.5) : c < 0 ? c = 1 - l : l < 0 && (l = 1 - c);
3143
+ const u = Ce(n), h = Ce(s), b = Ai(u, h, c, l, o, a);
3144
+ return K(b);
3145
+ }), co = g(
3146
+ p("srgb-linear").map(() => "srgb-linear"),
3147
+ p("srgb").map(() => "srgb"),
3148
+ p("display-p3").map(() => "display-p3"),
3149
+ p("a98-rgb").map(() => "a98-rgb"),
3150
+ p("prophoto-rgb").map(() => "prophoto-rgb"),
3151
+ p("rec2020").map(() => "rec2020"),
3152
+ p("xyz-d65").map(() => "xyz-d65"),
3153
+ p("xyz-d50").map(() => "xyz-d50"),
3154
+ p("xyz").map(() => "xyz")
3155
+ ), lo = p("color").next(
3156
+ T(
3157
+ co.skip(w),
3158
+ tt.skip(w),
3159
+ tt.skip(w),
3160
+ g(
3161
+ T(
3162
+ tt.skip(Ze.trim(w)),
3163
+ tt
3164
+ ),
3165
+ tt.map((e) => [e, void 0])
3166
+ )
3167
+ ).trim(w).wrap(se, ie)
3168
+ ).map(([e, t, n, [r, s]]) => {
3169
+ const i = qi[e];
3170
+ if (!i)
3171
+ throw new Error(`Unknown color() space: ${e}`);
3172
+ const o = s ?? new d(1);
3173
+ if (e === "srgb") {
3174
+ const c = (l) => l.value * 255;
3175
+ return K(new q(c(t), c(n), c(r), o.value));
3176
+ }
3177
+ const a = new i.ctor(t, n, r, o);
3178
+ return K(a);
3179
+ }), uo = g(
3180
+ ...Object.keys(yn).sort((e, t) => t.length - e.length).map(p)
3181
+ ).chain((e) => {
3182
+ const t = yn[e.toLowerCase()];
3183
+ if (t) {
3184
+ const n = oe(t);
3185
+ if (n)
3186
+ return Es(n);
3187
+ }
3188
+ return Ms();
3189
+ }), ho = g(
3190
+ ao,
3191
+ lo,
3192
+ Gi,
3193
+ Hi,
3194
+ Zi,
3195
+ Ji,
3196
+ Qi,
3197
+ _i,
3198
+ to,
3199
+ eo,
3200
+ no,
3201
+ ro,
3202
+ so,
3203
+ uo
3204
+ ).trim(w), Je = {
3205
+ Value: ho
3206
+ }, po = g(...ls.map(p)), mo = g(...hs.map(p)), fo = g(...us.map(p)), bo = g(...ms.map(p)), go = g(...ps.map(p)), wo = z(","), ko = z(" ");
3207
+ g(wo, ko).trim(w);
3208
+ const Dr = T(it, po).map(([e, t]) => {
3209
+ const n = ["length"];
3210
+ return rr.includes(t) ? n.push("relative") : nr.includes(t) && n.push("absolute"), new d(e, t, n);
3211
+ }), Ur = T(it, mo).map(([e, t]) => new d(e, t, ["angle"])), Qe = T(it, fo).map(([e, t]) => new d(e, t, ["time"])), yo = S.lazy(() => g(_e, Qe)), xo = T(it, bo).map(([e, t]) => new d(e, t, ["resolution"])), _e = g(
3212
+ T(it, go),
3213
+ p("from").map(() => [0, "%"]),
3214
+ p("to").map(() => [100, "%"])
3215
+ ).map(([e, t]) => new d(e, t, ["percentage"])), qr = S.lazy(() => Je.Value), So = z("/").trim(w).map(() => new d("/", "string")), Kr = g(
3216
+ Dr,
3217
+ Ur,
3218
+ Qe,
3219
+ xo,
3220
+ _e,
3221
+ qr,
3222
+ So,
3223
+ it.map((e) => new d(e)),
3224
+ Le.map(() => new d(NaN))
3225
+ ).trim(w), A = {
3226
+ Length: Dr,
3227
+ Angle: Ur,
3228
+ Time: Qe,
3229
+ TimePercentage: yo,
3230
+ Percentage: _e,
3231
+ Color: qr,
3232
+ Value: Kr
3233
+ };
3234
+ function oe(e) {
3235
+ return et(Kr, e);
3236
+ }
3237
+ const Et = z("("), Mt = z(")"), Me = z(","), vo = S.lazy(
3238
+ () => Gr.sepBy(g(Me, w)).trim(w).map((e) => new st(...e))
3239
+ ), tn = (e) => T(
3240
+ e || Lt,
3241
+ vo.wrap(Et, Mt)
3242
+ ), Co = () => {
3243
+ const e = G(/[^)]+/);
3244
+ return z("var").next(e.trim(w).wrap(Et, Mt)).map((t) => new d(t, "var"));
3245
+ }, Eo = () => {
3246
+ const e = S.lazy(
3247
+ () => g(
3248
+ G(/[^()]+/),
3249
+ e.many(1).wrap(Et, Mt).map((t) => `(${t.join(" ")})`)
3250
+ ).many(1)
3251
+ );
3252
+ return z("calc").next(
3253
+ g(
3254
+ S.lazy(() => Gr).trim(w).wrap(Et, Mt),
3255
+ e.wrap(Et, Mt).map((t) => t.join(" "))
3256
+ )
3257
+ ).map((t) => t instanceof d ? t : new d(t, "calc"));
3258
+ }, Mo = ["translate", "scale", "rotate", "skew"], Ie = ["x", "y", "z"], Io = Ie.map(p), Bo = Mo.map(p), To = () => {
3259
+ const e = T(
3260
+ g(...Bo),
3261
+ g(...Io, z(""))
3262
+ ), t = (n, r) => n + r.toUpperCase();
3263
+ return tn(e).map(([[n, r], s]) => {
3264
+ const i = n.toLowerCase(), o = {};
3265
+ if (r) {
3266
+ const c = i + r.toUpperCase();
3267
+ o[c] = s[0];
3268
+ } else s.length === 1 ? Ie.forEach((c) => {
3269
+ const l = t(i, c);
3270
+ o[l] = s[0];
3271
+ }) : s.forEach((c, l) => {
3272
+ const u = t(i, Ie[l]);
3273
+ o[u] = c;
3274
+ });
3275
+ const a = Object.entries(o).map(([c, l]) => new _(c, [l]));
3276
+ return new st(...a);
3277
+ });
3278
+ }, Po = {
3279
+ left: "270",
3280
+ right: "90",
3281
+ top: "0",
3282
+ bottom: "180"
3283
+ }, zo = () => {
3284
+ const e = g(...["linear-gradient", "radial-gradient"].map(p)), t = T(
3285
+ z("to").skip(w),
3286
+ g(...["left", "right", "top", "bottom"].map(p))
3287
+ ).map(([, o]) => {
3288
+ const a = Po[o.toLowerCase()];
3289
+ return new d(a, "deg");
3290
+ }), n = g(A.Angle, t), r = g(A.Length, A.Percentage), s = T(
3291
+ A.Color,
3292
+ r.sepBy(w)
3293
+ ).map(([o, a]) => !a || a.length === 0 ? [o] : [o, ...a]), i = T(
3294
+ s,
3295
+ Me.trim(w).next(g(s, r)).many()
3296
+ ).map(([o, a]) => [o, ...a]);
3297
+ return T(
3298
+ e,
3299
+ T(n.skip(Me).opt(), i).trim(w).wrap(Et, Mt).map(([o, a]) => o ? [o, ...a].flat() : [a])
3300
+ ).map(([o, a]) => new _(o, a));
3301
+ }, Oo = () => tn(z("cubic-bezier")).map((e) => new _("cubic-bezier", e[1])), Xr = G(/[^\(\)\{\}\s,;]+/).map((e) => new d(e)), Yr = g(
3302
+ To(),
3303
+ Co(),
3304
+ Eo(),
3305
+ zo(),
3306
+ Oo(),
3307
+ tn().map(([e, t]) => new _(e, t))
3308
+ ), Gr = g(A.Value, Yr, Xr).trim(w), No = T(z("{"), G(/[^{}]+/), z("}")).map(
3309
+ (e) => {
3310
+ const t = e.join(`
3311
+ `);
3312
+ let n = JSON.parse(t);
3313
+ return new d(n, "json");
3314
+ }
3315
+ ), Hr = g(A.Value, Yr, No, Xr).trim(w);
3316
+ Hr.sepBy(w);
3317
+ const $o = Q((e) => et(Hr, e));
3318
+ Q(
3319
+ (e) => et(A.Percentage, String(e)).valueOf()
3320
+ );
3321
+ Q((e) => et(
3322
+ A.Time.map((t) => t.unit === "ms" ? t.value : t.unit === "s" ? t.value * 1e3 : t.value),
3323
+ e
3324
+ ));
3325
+ Q(
3326
+ (e, t) => (() => {
3327
+ if (!t)
3328
+ return e;
3329
+ if (e.unit === "var") {
3330
+ const n = getComputedStyle(t).getPropertyValue(e.value);
3331
+ return oe(n);
3332
+ }
3333
+ if (e.unit === "calc" && e.property && e.subProperty && e.value && t) {
3334
+ const n = e.property, r = t.style[n], s = e.subProperty ? `${e.subProperty}(${e.toString()})` : e.toString();
3335
+ t.style[n] = s;
3336
+ const i = getComputedStyle(t).getPropertyValue(
3337
+ n
3338
+ );
3339
+ t.style[n] = r;
3340
+ const o = $o(i);
3341
+ if (o instanceof d)
3342
+ return o;
3343
+ if (o.name.startsWith("matrix")) {
3344
+ const a = or(o)[e.subProperty];
3345
+ if (a != null)
3346
+ return new d(a, "px", [
3347
+ "length",
3348
+ "absolute"
3349
+ ]);
3350
+ }
3351
+ }
3352
+ return e;
3353
+ })().coalesce(e),
3354
+ { keyFn: (e, t) => `${e.toString()}-${JSON.stringify(t)}` }
3355
+ );
3356
+ function Fo(e) {
3357
+ return e;
3358
+ }
3359
+ function En(e) {
3360
+ return e * e;
3361
+ }
3362
+ function Mn(e) {
3363
+ return -e * (e - 2);
3364
+ }
3365
+ function In(e) {
3366
+ return (e /= 0.5) < 1 ? 0.5 * e * e : -0.5 * (--e * (e - 2) - 1);
3367
+ }
3368
+ function Bn(e) {
3369
+ return e * e * e;
3370
+ }
3371
+ function Tn(e) {
3372
+ return (e = e - 1) * e * e + 1;
3373
+ }
3374
+ function Qt(e) {
3375
+ return (e /= 0.5) < 1 ? 0.5 * e * e * e : 0.5 * ((e -= 2) * e * e + 2);
3376
+ }
3377
+ function Pn(e) {
3378
+ return e * e * (3 - 2 * e);
3379
+ }
3380
+ const rt = (e, t, n, r) => (s) => (s = Ns(s, e, t, n, r)[1], s);
3381
+ function zn(e) {
3382
+ return e = rt(0.09, 0.91, 0.5, 1.5)(e), e;
3383
+ }
3384
+ function On(e) {
3385
+ return e = rt(0.09, 0.91, 0.5, 1.5)(e), e;
3386
+ }
3387
+ function Nn(e) {
3388
+ return e = re(e, [
3389
+ [0, 0],
3390
+ [0.026, 1.746],
3391
+ [0.633, 1.06],
3392
+ [1, 0]
3393
+ ])[1], e;
3394
+ }
3395
+ function $n(e) {
3396
+ return e = re(e, [
3397
+ [0, 0],
3398
+ [0.367, 0.94],
3399
+ [0.974, 0.254],
3400
+ [1, 0]
3401
+ ])[1], e;
3402
+ }
3403
+ function Fn(e) {
3404
+ return e = re(e, [
3405
+ [0, 0],
3406
+ [0.026, 1.746],
3407
+ [0.633, 1.06],
3408
+ [1, 0]
3409
+ ])[1], e;
3410
+ }
3411
+ function An(e) {
3412
+ return e = re(e, [
3413
+ [0, 0],
3414
+ [0.026, 1.746],
3415
+ [0.633, 1.06],
3416
+ [1, 0]
3417
+ ])[1], e;
3418
+ }
3419
+ function Vn(e) {
3420
+ return 1 - Math.cos(e * Math.PI / 2);
3421
+ }
3422
+ function Rn(e) {
3423
+ return Math.sin(e * Math.PI / 2);
3424
+ }
3425
+ function jn(e) {
3426
+ return -(Math.cos(Math.PI * e) - 1) / 2;
3427
+ }
3428
+ function Ln(e) {
3429
+ return 1 - Math.sqrt(1 - e * e);
3430
+ }
3431
+ function Wn(e) {
3432
+ return Math.sqrt(1 - --e * e);
3433
+ }
3434
+ function Dn(e) {
3435
+ return (e /= 0.5) < 1 ? -(Math.sqrt(1 - e * e) - 1) / 2 : (Math.sqrt(1 - (e -= 2) * e) + 1) / 2;
3436
+ }
3437
+ function Un(e) {
3438
+ return e === 0 ? 0 : Math.pow(2, 10 * (e - 1));
3439
+ }
3440
+ function qn(e) {
3441
+ return e === 1 ? 1 : 1 - Math.pow(2, -10 * e);
3442
+ }
3443
+ function Kn(e) {
3444
+ return e === 0 ? 0 : e === 1 ? 1 : (e /= 0.5) < 1 ? 0.5 * Math.pow(2, 10 * (e - 1)) : 0.5 * (2 - Math.pow(2, -10 * --e));
3445
+ }
3446
+ function Zr(e, t) {
3447
+ return Math.floor(e * t) / t;
3448
+ }
3449
+ function Ao(e, t) {
3450
+ return Math.ceil(e * t) / t;
3451
+ }
3452
+ function Vo(e, t) {
3453
+ return e === 0 || e === 1 ? e : Zr(e, t);
3454
+ }
3455
+ function Ro(e, t) {
3456
+ return Math.round(e * t) / t;
3457
+ }
3458
+ function en(e, t = "jump-start") {
3459
+ switch (t) {
3460
+ case "jump-none":
3461
+ return (n) => Ro(n, e);
3462
+ case "jump-start":
3463
+ case "start":
3464
+ return (n) => Zr(n, e);
3465
+ case "jump-end":
3466
+ case "end":
3467
+ return (n) => Ao(n, e);
3468
+ case "jump-both":
3469
+ case "both":
3470
+ return (n) => Vo(n, e);
3471
+ }
3472
+ }
3473
+ function jo() {
3474
+ return en(1, "jump-start");
3475
+ }
3476
+ function Lo() {
3477
+ return en(1, "jump-end");
3478
+ }
3479
+ const gt = {
3480
+ ease: [0.25, 0.1, 0.25, 1],
3481
+ "ease-in": [0.42, 0, 1, 1],
3482
+ "ease-out": [0, 0, 0.58, 1],
3483
+ "ease-in-out": [0.42, 0, 0.58, 1],
3484
+ "ease-in-back": [0.6, -0.28, 0.735, 0.045],
3485
+ "ease-out-back": [0.175, 0.885, 0.32, 1.275],
3486
+ "ease-in-out-back": [0.68, -0.55, 0.265, 1.55]
3487
+ }, Wo = {
3488
+ linear: Fo,
3489
+ easeInQuad: En,
3490
+ "ease-in-quad": En,
3491
+ // "easeInQuad",
3492
+ easeOutQuad: Mn,
3493
+ "ease-out-quad": Mn,
3494
+ // "easeOutQuad",
3495
+ easeInOutQuad: In,
3496
+ "ease-in-out-quad": In,
3497
+ // "easeInOutQuad",
3498
+ easeInCubic: Bn,
3499
+ "ease-in-cubic": Bn,
3500
+ easeOutCubic: Tn,
3501
+ "ease-out-cubic": Tn,
3502
+ easeInOutCubic: Qt,
3503
+ "ease-in-out-cubic": Qt,
3504
+ easeInBounce: zn,
3505
+ "ease-in-bounce": zn,
3506
+ // "easeInBounce",
3507
+ bounceInEase: On,
3508
+ "bounce-in-ease": On,
3509
+ bounceInEaseHalf: Nn,
3510
+ "bounce-in-ease-half": Nn,
3511
+ bounceOutEase: $n,
3512
+ "bounce-out-ease": $n,
3513
+ bounceOutEaseHalf: Fn,
3514
+ "bounce-out-ease-half": Fn,
3515
+ bounceInOutEase: An,
3516
+ "bounce-in-out-ease": An,
3517
+ easeInSine: Vn,
3518
+ "ease-in-sine": Vn,
3519
+ easeOutSine: Rn,
3520
+ "ease-out-sine": Rn,
3521
+ easeInOutSine: jn,
3522
+ "ease-in-out-sine": jn,
3523
+ easeInCirc: Ln,
3524
+ "ease-in-circ": Ln,
3525
+ easeOutCirc: Wn,
3526
+ "ease-out-circ": Wn,
3527
+ easeInOutCirc: Dn,
3528
+ "ease-in-out-circ": Dn,
3529
+ easeInExpo: Un,
3530
+ "ease-in-expo": Un,
3531
+ easeOutExpo: qn,
3532
+ "ease-out-expo": qn,
3533
+ easeInOutExpo: Kn,
3534
+ "ease-in-out-expo": Kn,
3535
+ smoothStep3: Pn,
3536
+ "smooth-step-3": Pn,
3537
+ ease: rt(...gt.ease),
3538
+ "ease-in": rt(...gt["ease-in"]),
3539
+ "ease-out": rt(...gt["ease-out"]),
3540
+ "ease-in-out": rt(...gt["ease-in-out"]),
3541
+ "ease-in-back": rt(...gt["ease-in-back"]),
3542
+ "ease-out-back": rt(...gt["ease-out-back"]),
3543
+ "ease-in-out-back": rt(...gt["ease-in-out-back"]),
3544
+ steps: en,
3545
+ "step-start": jo,
3546
+ "step-end": Lo
3547
+ }, Xn = 4;
3548
+ function Yn(e, t = "^", n = !1) {
3549
+ const r = e.src.split(`
3550
+ `), s = Math.min(r.length - 1, e.getLineNumber()), i = Math.max(s - Xn, 0), o = Math.min(s + Xn + 1, r.length), a = r.slice(i, o);
3551
+ if (t) {
3552
+ const l = " ".repeat(e.getColumnNumber()) + t;
3553
+ a.splice(s - i + 1, 0, l);
3554
+ }
3555
+ return a.map((l, u) => ` ${i + u + 1}| ${l}`).join(`
3556
+ `);
3557
+ }
3558
+ const wt = /* @__PURE__ */ new Map();
3559
+ function Jr(e) {
3560
+ if (wt.has(e.id))
3561
+ return wt.get(e.id);
3562
+ const t = (r, s) => {
3563
+ if (wt.has(r.id))
3564
+ return wt.get(r.id);
3565
+ const { name: i, args: o, parser: a } = r.context, c = a != null ? t(a, s) : "unknown", u = (() => {
3566
+ switch (i) {
3567
+ case "string":
3568
+ return `"${o[0]}"`;
3569
+ case "regex":
3570
+ case "regexConcat":
3571
+ case "regexWrap":
3572
+ return `${o[0]}`;
3573
+ case "wrap":
3574
+ case "trim": {
3575
+ const [h, b] = o;
3576
+ return `${t(h, s)} ${c} ${t(b, s)}`;
3577
+ }
3578
+ case "trimWhitespace":
3579
+ return `${c}?w`;
3580
+ case "not":
3581
+ return `!${c}`;
3582
+ case "opt":
3583
+ return `${c}?`;
3584
+ case "next": {
3585
+ const [h] = o;
3586
+ return `${c} >> ${t(h, s)}`;
3587
+ }
3588
+ case "skip": {
3589
+ const [h] = o;
3590
+ return `${c} << ${t(h, s)}`;
3591
+ }
3592
+ case "map":
3593
+ return c;
3594
+ case "all":
3595
+ case "then":
3596
+ return `[${o.map(
3597
+ (b) => t(b, s)
3598
+ ).join(", ")}]`;
3599
+ case "any":
3600
+ case "or":
3601
+ return o.map(
3602
+ (b) => t(b, s)
3603
+ ).join(" | ");
3604
+ case "many": {
3605
+ const [h, b] = o, y = b === 1 / 0 ? `${h},` : `${h},${b}`;
3606
+ return `${c} {${y}}`;
3607
+ }
3608
+ case "sepBy":
3609
+ return `${c} sepBy ${t(o[0], s)}`;
3610
+ case "lazy": {
3611
+ const [h] = o, b = _r(h);
3612
+ if (s)
3613
+ return i;
3614
+ {
3615
+ const y = t(b, b.id);
3616
+ return wt.set(b.id, y), y;
3617
+ }
3618
+ }
3619
+ case "debug":
3620
+ return c;
3621
+ default:
3622
+ return;
3623
+ }
3624
+ })() ?? i ?? "unknown";
3625
+ return s && wt.set(r.id, u), u;
3626
+ }, n = t(e);
3627
+ return wt.set(e.id, n), n;
3628
+ }
3629
+ function Qr(e, t = "", n = "") {
3630
+ const r = String(e.value), s = e.offset >= e.src.length, a = `${`[${e.isError ? "err" : s ? "done" : "ok"}]`} ${t} offset=${e.offset} value=${r}`, c = e.offset >= e.src.length ? Yn(e, "", e.isError) : Yn(e, "^", e.isError);
3631
+ return `${a}
3632
+ ${c}`;
3633
+ }
3634
+ function Do(e, t = "", n = !1, r = console.log) {
3635
+ const s = (i) => {
3636
+ const o = e.parser(i), a = n ? Jr(e) : e.context.name ?? "", c = Qr(
3637
+ o,
3638
+ t,
3639
+ a
3640
+ );
3641
+ return r(c), o;
3642
+ };
3643
+ return new C(s, B("debug", e, r));
3644
+ }
3645
+ class _t {
3646
+ constructor(t, n = void 0, r = 0, s = !1, i = 0) {
3647
+ this.src = t, this.value = n, this.offset = r, this.isError = s, this.furthest = i;
3648
+ }
3649
+ ok(t, n = 0) {
3650
+ return n += this.offset, new _t(this.src, t, n, !1);
3651
+ }
3652
+ err(t, n = 0) {
3653
+ const r = this.ok(t, n);
3654
+ return r.isError = !0, r;
3655
+ }
3656
+ from(t, n = 0) {
3657
+ return n += this.offset, new _t(this.src, t, n, this.isError);
3658
+ }
3659
+ getColumnNumber() {
3660
+ const t = this.offset, n = this.src.lastIndexOf(`
3661
+ `, t), r = n === -1 ? t : t - (n + 1);
3662
+ return Math.max(0, r);
3663
+ }
3664
+ getLineNumber() {
3665
+ const t = this.src.lastIndexOf(`
3666
+ `, this.offset);
3667
+ return t >= 0 ? this.src.slice(0, t).split(`
3668
+ `).length : 0;
3669
+ }
3670
+ toString() {
3671
+ return Qr(this);
3672
+ }
3673
+ }
3674
+ function B(e, t, ...n) {
3675
+ return {
3676
+ name: e,
3677
+ parser: t,
3678
+ args: n
3679
+ };
3680
+ }
3681
+ let Uo = 0;
3682
+ const kt = /* @__PURE__ */ new Map(), Xt = /* @__PURE__ */ new Map();
3683
+ let At;
3684
+ function U(e) {
3685
+ return (!At || e.offset > At.offset) && (At = e), At;
3686
+ }
3687
+ function _r(e) {
3688
+ return e.parser ? e.parser : e.parser = e();
3689
+ }
3690
+ class C {
3691
+ constructor(t, n = {}) {
3692
+ this.parser = t, this.context = n;
3693
+ }
3694
+ id = Uo++;
3695
+ state;
3696
+ reset() {
3697
+ At = void 0, kt.clear(), Xt.clear();
3698
+ }
3699
+ parseState(t) {
3700
+ this.reset();
3701
+ const n = this.parser(new _t(t));
3702
+ return this.state = U(n), this.state.isError = n.isError, this.state.isError, n;
3703
+ }
3704
+ parse(t) {
3705
+ return this.parseState(t).value;
3706
+ }
3707
+ getCijKey(t) {
3708
+ return `${this.id}${t.offset}`;
3709
+ }
3710
+ atLeftRecursionLimit(t) {
3711
+ return (Xt.get(this.getCijKey(t)) ?? 0) > t.src.length - t.offset;
3712
+ }
3713
+ memoize() {
3714
+ const t = (n) => {
3715
+ const r = this.getCijKey(n), s = Xt.get(r) ?? 0;
3716
+ let i = kt.get(this.id);
3717
+ if (i && i.offset >= n.offset)
3718
+ return i;
3719
+ if (this.atLeftRecursionLimit(n))
3720
+ return n.err(void 0);
3721
+ Xt.set(r, s + 1);
3722
+ const o = this.parser(n);
3723
+ return i = kt.get(this.id), i && i.offset > o.offset ? o.offset = i.offset : i || kt.set(this.id, o), o;
3724
+ };
3725
+ return new C(
3726
+ t,
3727
+ B("memoize", this)
3728
+ );
3729
+ }
3730
+ mergeMemos() {
3731
+ const t = (n) => {
3732
+ let r = kt.get(this.id);
3733
+ if (r)
3734
+ return r;
3735
+ if (this.atLeftRecursionLimit(n))
3736
+ return n.err(void 0);
3737
+ const s = this.parser(n);
3738
+ return r = kt.get(this.id), r || kt.set(this.id, s), s;
3739
+ };
3740
+ return new C(
3741
+ t,
3742
+ B("mergeMemo", this)
3743
+ );
3744
+ }
3745
+ then(t) {
3746
+ const n = (r) => {
3747
+ const s = this.parser(r);
3748
+ if (!s.isError) {
3749
+ const i = t.parser(s);
3750
+ if (!i.isError)
3751
+ return i.ok([s.value, i.value]);
3752
+ }
3753
+ return U(r), r.err(void 0);
3754
+ };
3755
+ return new C(
3756
+ n,
3757
+ B("then", this, this, t)
3758
+ );
3759
+ }
3760
+ or(t) {
3761
+ const n = (r) => {
3762
+ const s = this.parser(r);
3763
+ return s.isError ? t.parser(r) : s;
3764
+ };
3765
+ return new C(
3766
+ n,
3767
+ B("or", this, this, t)
3768
+ );
3769
+ }
3770
+ chain(t, n = !1) {
3771
+ const r = (s) => {
3772
+ const i = this.parser(s);
3773
+ return i.isError ? i : i.value || n ? t(i.value).parser(i) : s;
3774
+ };
3775
+ return new C(
3776
+ r,
3777
+ B("chain", this, t)
3778
+ );
3779
+ }
3780
+ map(t, n = !1) {
3781
+ const r = (s) => {
3782
+ const i = this.parser(s);
3783
+ return !i.isError || n ? i.ok(t(i.value)) : i;
3784
+ };
3785
+ return new C(
3786
+ r,
3787
+ B("map", this)
3788
+ );
3789
+ }
3790
+ mapState(t) {
3791
+ const n = (r) => {
3792
+ const s = this.parser(r);
3793
+ return t(s, r);
3794
+ };
3795
+ return new C(
3796
+ n,
3797
+ B("mapState", this)
3798
+ );
3799
+ }
3800
+ skip(t) {
3801
+ const n = (r) => {
3802
+ const s = this.parser(r);
3803
+ if (!s.isError) {
3804
+ const i = t.parser(s);
3805
+ if (!i.isError)
3806
+ return i.ok(s.value);
3807
+ }
3808
+ return U(r), r.err(void 0);
3809
+ };
3810
+ return new C(
3811
+ n,
3812
+ B("skip", this, t)
3813
+ );
3814
+ }
3815
+ next(t) {
3816
+ const n = this.then(t).map(([, r]) => r);
3817
+ return n.context = B("next", this, t), n;
3818
+ }
3819
+ opt() {
3820
+ const t = (n) => {
3821
+ const r = this.parser(n);
3822
+ return r.isError ? (U(n), n.ok(void 0)) : r;
3823
+ };
3824
+ return new C(
3825
+ t,
3826
+ B("opt", this)
3827
+ );
3828
+ }
3829
+ not(t) {
3830
+ const n = (s) => this.parser(s).isError ? (U(s), s.ok(s.value)) : s.err(void 0), r = (s) => {
3831
+ const i = this.parser(s);
3832
+ return i.isError ? (U(s), i) : t.parser(s).isError ? i : (U(s), s.err(void 0));
3833
+ };
3834
+ return new C(
3835
+ t ? r : n,
3836
+ B("not", this, t)
3837
+ );
3838
+ }
3839
+ wrap(t, n, r = !0) {
3840
+ if (!r)
3841
+ return Z(t, this, n);
3842
+ const s = t.next(this).skip(n);
3843
+ return s.context = B("wrap", this, t, n), s;
3844
+ }
3845
+ trim(t = nn, n = !0) {
3846
+ if (!n)
3847
+ return Z(t, this, t);
3848
+ if (t.context?.name === "whitespace") {
3849
+ const r = (s) => {
3850
+ const i = Hn(s), o = this.parser(i);
3851
+ return o.isError ? (U(s), s.err(void 0)) : Hn(o);
3852
+ };
3853
+ return new C(
3854
+ r,
3855
+ B("trimWhitespace", this)
3856
+ );
3857
+ }
3858
+ return this.wrap(t, t);
3859
+ }
3860
+ many(t = 0, n = 1 / 0) {
3861
+ const r = (s) => {
3862
+ const i = [];
3863
+ let o = s;
3864
+ for (let a = 0; a < n; a += 1) {
3865
+ const c = this.parser(o);
3866
+ if (c.isError)
3867
+ break;
3868
+ i.push(c.value), o = c;
3869
+ }
3870
+ return i.length >= t ? o.ok(i) : (U(s), s.err([]));
3871
+ };
3872
+ return new C(
3873
+ r,
3874
+ B("many", this, t, n)
3875
+ );
3876
+ }
3877
+ sepBy(t, n = 0, r = 1 / 0) {
3878
+ const s = (i) => {
3879
+ const o = [];
3880
+ let a = i;
3881
+ for (let c = 0; c < r; c += 1) {
3882
+ const l = this.parser(a);
3883
+ if (l.isError)
3884
+ break;
3885
+ a = l, o.push(a.value);
3886
+ const u = t.parser(a);
3887
+ if (u.isError)
3888
+ break;
3889
+ a = u;
3890
+ }
3891
+ return o.length > n ? a.ok(o) : (U(i), i.err([]));
3892
+ };
3893
+ return new C(
3894
+ s,
3895
+ B("sepBy", this, t)
3896
+ );
3897
+ }
3898
+ eof() {
3899
+ const t = this.skip(qo());
3900
+ return t.context = B("eof", this), t;
3901
+ }
3902
+ debug(t = "", n = !1, r = console.log) {
3903
+ return Do(this, t, n, r);
3904
+ }
3905
+ toString() {
3906
+ return Jr(this);
3907
+ }
3908
+ static lazy(t) {
3909
+ const n = (r) => _r(t).parser(r);
3910
+ return new C(
3911
+ n,
3912
+ B("lazy", void 0, t)
3913
+ );
3914
+ }
3915
+ }
3916
+ function qo() {
3917
+ const e = (t) => t.offset >= t.src.length ? t.ok(void 0) : (U(t), t.err());
3918
+ return new C(
3919
+ e,
3920
+ B("eof", void 0)
3921
+ );
3922
+ }
3923
+ function R(...e) {
3924
+ const t = (n) => {
3925
+ for (const r of e) {
3926
+ const s = r.parser(n);
3927
+ if (!s.isError)
3928
+ return s;
3929
+ }
3930
+ return U(n), n.err(void 0);
3931
+ };
3932
+ return new C(
3933
+ e.length === 1 ? e[0].parser : t,
3934
+ B("any", void 0, ...e)
3935
+ );
3936
+ }
3937
+ function Z(...e) {
3938
+ const t = (n) => {
3939
+ const r = [];
3940
+ let s = n;
3941
+ for (const i of e) {
3942
+ const o = i.parser(s);
3943
+ if (o.isError)
3944
+ return o;
3945
+ o.value !== void 0 && r.push(o.value), s = o;
3946
+ }
3947
+ return U(s), s.ok(r);
3948
+ };
3949
+ return new C(
3950
+ e.length === 1 ? e[0].parser : t,
3951
+ B("all", void 0, ...e)
3952
+ );
3953
+ }
3954
+ function X(e) {
3955
+ const t = (n) => {
3956
+ if (n.offset >= n.src.length)
3957
+ return n.err(void 0);
3958
+ const r = n.src.slice(n.offset, n.offset + e.length);
3959
+ return r === e ? n.ok(r, r.length) : (U(n), n.err(void 0));
3960
+ };
3961
+ return new C(
3962
+ t,
3963
+ B("string", void 0, e)
3964
+ );
3965
+ }
3966
+ function Wt(e, t = (n) => n?.[0] ?? null) {
3967
+ const n = e.flags.replace(/y/g, ""), r = new RegExp(e, n + "y"), s = (i) => {
3968
+ if (i.offset >= i.src.length)
3969
+ return i.err(void 0);
3970
+ r.lastIndex = i.offset;
3971
+ const o = t(i.src.match(r));
3972
+ return o ? i.ok(o, r.lastIndex - i.offset) : o === "" ? i.ok(void 0) : (U(i), i.err(void 0));
3973
+ };
3974
+ return new C(
3975
+ s,
3976
+ B("regex", void 0, e)
3977
+ );
3978
+ }
3979
+ const Gn = /\s*/y, Hn = (e) => {
3980
+ if (e.offset >= e.src.length)
3981
+ return e;
3982
+ Gn.lastIndex = e.offset;
3983
+ const t = e.src.match(Gn)?.[0] ?? "";
3984
+ return e.ok(e.value, t.length);
3985
+ }, nn = Wt(/\s*/);
3986
+ nn.context.name = "whitespace";
3987
+ const It = X("("), Bt = X(")"), Ko = X(";"), Xo = X(":"), rn = X("{"), sn = X("}"), te = X(","), Yo = X("."), P = nn, ts = C.lazy(
3988
+ () => Dt.sepBy(R(te, P)).trim(P).map((e) => new st(...e))
3989
+ ), on = (e) => Z(
3990
+ e || Lt,
3991
+ ts.wrap(It, Bt)
3992
+ ), Go = () => {
3993
+ const e = Wt(/[^)]+/);
3994
+ return X("var").next(e.trim(P).wrap(It, Bt)).map((t) => new d(t, "var"));
3995
+ }, Ho = () => {
3996
+ const e = C.lazy(
3997
+ () => R(
3998
+ Wt(/[^()]+/),
3999
+ e.many(1).wrap(It, Bt).map((t) => `(${t.join(" ")})`)
4000
+ ).many(1)
4001
+ );
4002
+ return X("calc").next(
4003
+ R(
4004
+ C.lazy(() => Dt).trim(P).wrap(It, Bt),
4005
+ e.wrap(It, Bt).map((t) => t.join(" "))
4006
+ )
4007
+ ).map((t) => t instanceof d ? t : new d(t, "calc"));
4008
+ }, Zo = ["translate", "scale", "rotate", "skew"], Be = ["x", "y", "z"], Jo = Be.map(p), Qo = Zo.map(p), _o = () => {
4009
+ const e = Z(
4010
+ R(...Qo),
4011
+ R(...Jo, X(""))
4012
+ ), t = (r, s) => r + s.toUpperCase();
4013
+ return on(e).map(([[r, s], i]) => {
4014
+ const o = r.toLowerCase(), a = {};
4015
+ if (s) {
4016
+ const l = o + s.toUpperCase();
4017
+ a[l] = i[0];
4018
+ } else i.length === 1 ? Be.forEach((l) => {
4019
+ const u = t(o, l);
4020
+ a[u] = i[0];
4021
+ }) : i.forEach((l, u) => {
4022
+ const h = t(o, Be[u]);
4023
+ a[h] = l;
4024
+ });
4025
+ const c = Object.entries(a).map(([l, u]) => new _(l, [u]));
4026
+ return new st(...c);
4027
+ });
4028
+ }, ta = {
4029
+ left: "270",
4030
+ right: "90",
4031
+ top: "0",
4032
+ bottom: "180"
4033
+ }, ea = () => {
4034
+ const e = R(...["linear-gradient", "radial-gradient"].map(p)), t = Z(
4035
+ X("to").skip(P),
4036
+ R(...["left", "right", "top", "bottom"].map(p))
4037
+ ).map(([, a]) => {
4038
+ const c = ta[a.toLowerCase()];
4039
+ return new d(c, "deg");
4040
+ }), n = R(A.Angle, t), r = R(A.Length, A.Percentage), s = Z(
4041
+ A.Color,
4042
+ r.sepBy(P)
4043
+ ).map(([a, c]) => !c || c.length === 0 ? [a] : [a, ...c]), i = Z(
4044
+ s,
4045
+ te.trim(P).next(R(s, r)).many()
4046
+ ).map(([a, c]) => [a, ...c]);
4047
+ return Z(
4048
+ e,
4049
+ Z(n.skip(te).opt(), i).trim(P).wrap(It, Bt).map(([a, c]) => a ? [a, ...c].flat() : [c])
4050
+ ).map(([a, c]) => new _(a, c));
4051
+ }, na = () => on(X("cubic-bezier")).map((e) => new _("cubic-bezier", e[1])), ra = Wt(/[^\(\)\{\}\s,;]+/).map((e) => new d(e)), sa = R(
4052
+ _o(),
4053
+ Go(),
4054
+ Ho(),
4055
+ ea(),
4056
+ na(),
4057
+ on().map(([e, t]) => new _(e, t))
4058
+ ), ia = Z(rn, Wt(/[^{}]+/), sn).map(
4059
+ (e) => {
4060
+ const t = e.join(`
4061
+ `), n = JSON.parse(t);
4062
+ return new d(n, "json");
4063
+ }
4064
+ ), Dt = R(A.Value, sa, ia, ra).trim(P), oa = Dt.sepBy(P), aa = Z(
4065
+ Lt.skip(Xo).trim(P).map((e) => as(e)),
4066
+ oa.skip(Ko).trim(P)
4067
+ ).map(([e, t]) => {
4068
+ const n = new st(...t).flat();
4069
+ return n.setProperty(e), {
4070
+ [e]: n
4071
+ };
4072
+ }), ca = R(
4073
+ A.TimePercentage.trim(P).map((e) => e.toString()),
4074
+ it.map((e) => `${e}%`)
4075
+ ), la = ca.sepBy(te).trim(P), es = aa.many().trim(P).wrap(rn, sn).map((e) => Object.assign({}, ...e)), ua = X("@keyframes").trim(P).next(Lt), Zn = Z(la, es).map(([e, t]) => e.reduce((n, r) => (n.set(r, t), n), /* @__PURE__ */ new Map())), ns = R(
4076
+ ua.next(
4077
+ Zn.many(1).trim(P).wrap(rn, sn).trim(P)
4078
+ ),
4079
+ Zn.many(1).trim(P)
4080
+ ).map((e) => e.reduce((t, n) => {
4081
+ for (const [r, s] of n)
4082
+ t.has(r) ? t.set(r, { ...t.get(r), ...s }) : t.set(r, s);
4083
+ return t;
4084
+ }, /* @__PURE__ */ new Map())), ha = Yo.trim(P).next(Lt).trim(P), pa = es.map((e) => {
4085
+ const t = {};
4086
+ for (const [n, r] of Object.entries(e))
4087
+ if (n.includes("animation")) {
4088
+ const s = n.replace(/^animation/i, "").replace(/^\w/, (o) => o.toLowerCase()), i = cs(r.toString());
4089
+ t[s] = i, delete e[n];
4090
+ }
4091
+ return {
4092
+ options: t,
4093
+ values: e
4094
+ };
4095
+ }), ma = ha.next(pa), fa = R(
4096
+ ma.map((e) => e),
4097
+ ns.map((e) => ({
4098
+ keyframes: e
4099
+ }))
4100
+ ), da = fa.sepBy(P).map((e) => Object.assign({}, ...e)), Jn = {
4101
+ Value: Dt,
4102
+ FunctionArgs: ts
4103
+ }, ba = Q(
4104
+ (e) => et(Dt, e)
4105
+ ), ga = Q(
4106
+ (e) => et(ns, e)
4107
+ );
4108
+ Q((e) => {
4109
+ const { options: t, values: n, keyframes: r } = et(da, e);
4110
+ return {
4111
+ options: t,
4112
+ values: n,
4113
+ keyframes: r
4114
+ };
4115
+ });
4116
+ Q(
4117
+ (e) => et(A.Percentage, String(e)).valueOf()
4118
+ );
4119
+ const Qn = Q((e) => et(
4120
+ A.Time.map((t) => t.unit === "ms" ? t.value : t.unit === "s" ? t.value * 1e3 : t.value),
4121
+ e
4122
+ ));
4123
+ Q((e) => e >= 5e3 ? `${e / 1e3}s` : `${e}ms`);
4124
+ Q((e) => e === 1 / 0 ? "infinite" : String(e));
4125
+ const wa = {
4126
+ duration: 1e3,
4127
+ delay: 0,
4128
+ iterationCount: 1,
4129
+ direction: "normal",
4130
+ fillMode: "forwards",
4131
+ timingFunction: Qt
4132
+ };
4133
+ class ka {
4134
+ animations = {};
4135
+ transform;
4136
+ superKey;
4137
+ paused = !1;
4138
+ started = !1;
4139
+ done = !1;
4140
+ singleTarget = !0;
4141
+ handleId = void 0;
4142
+ resolvePromise = null;
4143
+ constructor(...t) {
4144
+ for (const n of t) {
4145
+ this.transform ??= n.frames[0].transform;
4146
+ const r = Ta(n);
4147
+ this.animations[r] = {
4148
+ values: {},
4149
+ animation: n
4150
+ };
4151
+ }
4152
+ this.singleTarget = t.every(
4153
+ (n) => n.targets[0] === t[0].targets[0]
4154
+ );
4155
+ }
4156
+ setSuperKey(t) {
4157
+ return this.superKey = t, Object.values(this.animations).forEach((n) => {
4158
+ n.animation.superKey = t;
4159
+ }), this;
4160
+ }
4161
+ setTargets(...t) {
4162
+ Object.values(this.animations).forEach((r) => {
4163
+ r.animation.setTargets(...t);
4164
+ });
4165
+ const n = Object.values(this.animations).map(
4166
+ (r) => r.animation
4167
+ );
4168
+ return this.singleTarget = n.every(
4169
+ (r) => r.targets[0] === n[0].targets[0]
4170
+ ), this;
4171
+ }
4172
+ onStart() {
4173
+ return this.started = !0, this;
4174
+ }
4175
+ onEnd() {
4176
+ return this;
4177
+ }
4178
+ transformFramesGrouped(t) {
4179
+ let n = {}, r = !0;
4180
+ for (const s of Object.values(this.animations)) {
4181
+ const { animation: i, values: o } = s;
4182
+ if (r = r && i.done, !(i.done || i.paused)) {
4183
+ const a = i.interpFrames(i.t, !1);
4184
+ Object.assign(o, a);
4185
+ }
4186
+ n = {
4187
+ ...n,
4188
+ ...o
4189
+ };
4190
+ }
4191
+ return this.done = r, this.transform(n, t), n;
4192
+ }
4193
+ async tick(t) {
4194
+ return this.started || this.onStart(), Object.values(this.animations).forEach(async (n) => {
4195
+ (!n.animation.paused || n.animation.pausedTime === 0) && await n.animation.tick(t);
4196
+ }), this.done && this.onEnd(), this;
4197
+ }
4198
+ async draw(t) {
4199
+ await this.tick(t), !this.paused && (this.singleTarget ? this.transformFramesGrouped(t) : this.done = Object.values(this.animations).map(({ animation: n }) => (n.interpFrames(n.t, !0), n)).every((n) => n.done), this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = vt(this.draw.bind(this)));
4200
+ }
4201
+ async play() {
4202
+ return new Promise((t) => {
4203
+ this.resolvePromise = t, this.handleId = vt(this.draw.bind(this));
4204
+ });
4205
+ }
4206
+ pause() {
4207
+ const t = this.paused;
4208
+ return this.started && (this.paused = !this.paused, Object.values(this.animations).forEach((n) => {
4209
+ n.animation.pause(!1);
4210
+ })), t && vt(this.draw.bind(this)), this;
4211
+ }
4212
+ reset() {
4213
+ return Object.values(this.animations).forEach((t) => {
4214
+ t.animation.reset();
4215
+ }), this.started = !1, this.done = !1, this.paused = !1, this;
4216
+ }
4217
+ stop() {
4218
+ return er(this.handleId), this.reset(), this;
4219
+ }
4220
+ playing() {
4221
+ return !(!this.started || this.paused);
4222
+ }
4223
+ forcePause() {
4224
+ this.paused = !0, Object.values(this.animations).forEach((t) => {
4225
+ t.animation.paused = !0;
4226
+ });
4227
+ }
4228
+ forcePlay() {
4229
+ this.paused = !1, Object.values(this.animations).forEach((t) => {
4230
+ t.animation.paused = !1;
4231
+ });
4232
+ }
4233
+ }
4234
+ const _n = Q(
4235
+ (e, t) => (() => {
4236
+ if (!t)
4237
+ return e;
4238
+ if (e.unit === "var") {
4239
+ const s = getComputedStyle(t).getPropertyValue(e.value);
4240
+ return oe(s);
4241
+ }
4242
+ if (e.unit === "calc" && e.property && e.subProperty && e.value && t) {
4243
+ const s = t.style[e.property], i = e.subProperty ? `${e.subProperty}(${e.toString()})` : e.toString();
4244
+ t.style[e.property] = i;
4245
+ const o = getComputedStyle(t).getPropertyValue(
4246
+ e.property
4247
+ );
4248
+ t.style[e.property] = s;
4249
+ const a = ba(o);
4250
+ if (a instanceof d)
4251
+ return a;
4252
+ if (a.name.startsWith("matrix")) {
4253
+ const l = or(a)[e.subProperty];
4254
+ if (l != null)
4255
+ return new d(l, "px", [
4256
+ "length",
4257
+ "absolute"
4258
+ ]);
4259
+ }
4260
+ }
4261
+ return e;
4262
+ })().coalesce(e),
4263
+ { keyFn: (e, t) => `${e.toString()}-${JSON.stringify(t)}` }
4264
+ ), ya = (e, t, n = !1) => {
4265
+ if (e?.superType?.[0] !== t?.superType?.[0])
4266
+ return n ? [e, t] : [e.clone(), t.clone()];
4267
+ const r = (o) => {
4268
+ switch (o?.superType?.[0]) {
4269
+ case "length":
4270
+ return {
4271
+ value: ks(o.value, o.unit, o.targets?.[0]),
4272
+ unit: "px"
4273
+ };
4274
+ case "angle":
4275
+ return {
4276
+ value: cr(o.value, o.unit),
4277
+ unit: "deg"
4278
+ };
4279
+ case "time":
4280
+ return {
4281
+ value: ar(o.value, o.unit),
4282
+ unit: "ms"
4283
+ };
4284
+ case "resolution":
4285
+ return {
4286
+ value: ys(o.value, o.unit),
4287
+ unit: "dpi"
4288
+ };
4289
+ default:
4290
+ return { value: o.value, unit: o.unit };
4291
+ }
4292
+ }, [s, i] = [r(e), r(t)];
4293
+ return n ? (e.value = s.value, e.unit = s.unit, t.value = i.value, t.unit = i.unit, [e, t]) : [
4294
+ new d(
4295
+ s.value,
4296
+ s.unit,
4297
+ e.superType,
4298
+ e.subProperty,
4299
+ e.property,
4300
+ e.targets
4301
+ ),
4302
+ new d(
4303
+ i.value,
4304
+ i.unit,
4305
+ t.superType,
4306
+ t.subProperty,
4307
+ t.property,
4308
+ t.targets
4309
+ )
4310
+ ];
4311
+ };
4312
+ function xa(e, t) {
4313
+ e = e.coalesce(t, !0), t = t.coalesce(e, !0);
4314
+ const n = {
4315
+ start: e,
4316
+ stop: t,
4317
+ value: e.clone()
4318
+ };
4319
+ if (xe(e) && xe(t)) {
4320
+ const [r, s] = Li(
4321
+ e,
4322
+ t,
4323
+ "lab",
4324
+ !0
4325
+ );
4326
+ n.start = r, n.stop = s, n.value = r.clone();
4327
+ }
4328
+ if (e.unit !== t.unit) {
4329
+ const [r, s] = ya(
4330
+ e,
4331
+ t,
4332
+ !0
4333
+ );
4334
+ n.start = r, n.stop = s, n.value = r.clone();
4335
+ }
4336
+ return n.computed = ye.includes(e.unit) || ye.includes(t.unit), n;
4337
+ }
4338
+ const tr = (e) => typeof e == "string" ? Wo[e] : e ?? void 0;
4339
+ function Sa(e, { start: t, stop: n, value: r }) {
4340
+ const s = _n(t.clone(), t.targets?.[0]), i = _n(n.clone(), n.targets?.[0]), o = ye.includes(s.unit) ? i.unit : s.unit, a = Tt(e, s.value, i.value);
4341
+ return r.value = a, r.unit = o, r;
4342
+ }
4343
+ function va(e, { start: t, stop: n, value: r }) {
4344
+ return t.value.keys().forEach((s) => {
4345
+ r.value[s] = Tt(e, t.value[s], n.value[s]);
4346
+ }), r;
4347
+ }
4348
+ function Ca(e, t) {
4349
+ const { start: n, stop: r, computed: s } = t;
4350
+ return typeof n.value == "number" && typeof r.value == "number" ? t.value.value = Tt(e, n.value, r.value) : n.unit === "color" ? va(e, t) : s && Sa(e, t), t;
4351
+ }
4352
+ function Ea(e) {
4353
+ const t = ir(e), n = (s, i) => {
4354
+ const o = s.split(".").pop(), a = s.split(".").shift();
4355
+ if (i instanceof d)
4356
+ return i.setProperty(a), i;
4357
+ if (i instanceof _)
4358
+ return i.setProperty(a), i.setSubProperty(o), i.values.flat();
4359
+ if (i instanceof st)
4360
+ return i.map((l) => n(s, l)).flat();
4361
+ const c = et(
4362
+ R(
4363
+ Jn.FunctionArgs.map((l) => (l.setSubProperty(o), l)),
4364
+ Jn.Value
4365
+ ),
4366
+ String(i)
4367
+ );
4368
+ return c.setProperty(a), c;
4369
+ };
4370
+ return Object.entries(t).map(([s, i]) => [s, n(s, i)]).reduce((s, [i, o]) => (s[i] = o, s), {});
4371
+ }
4372
+ const Ma = (e, t, n, r) => {
4373
+ const s = r[t][e], i = r[n][e], o = Math.max(s.length, i.length), a = s.concat(
4374
+ Array(Math.abs(o - s.length)).fill(new d(0))
4375
+ ), c = i.concat(
4376
+ Array(Math.abs(o - i.length)).fill(new d(0))
4377
+ );
4378
+ return a.map((l, u) => xa(l, c[u]));
4379
+ };
4380
+ function Ia(e, t, n) {
4381
+ const [r, s] = [e.start, t.start];
4382
+ return {
4383
+ start: r.value * n / 100,
4384
+ stop: s.value * n / 100
4385
+ };
4386
+ }
4387
+ function Ba(e, t, n = !0) {
4388
+ e = n ? e : ir(e);
4389
+ const r = gs(e);
4390
+ t.forEach((s) => {
4391
+ Object.entries(r).forEach(([i, o]) => {
4392
+ s.style[i] = o;
4393
+ });
4394
+ });
4395
+ }
4396
+ const Ta = (e) => typeof e == "string" ? e : e.name ?? String(e.id);
4397
+ let Pa = 0;
4398
+ class za {
4399
+ id = Pa++;
4400
+ name;
4401
+ superKey;
4402
+ targets;
4403
+ options;
4404
+ templateFrames = [];
4405
+ parsedVars = [];
4406
+ frameId = 0;
4407
+ frames = [];
4408
+ handleId = void 0;
4409
+ startTime = void 0;
4410
+ pausedTime = 0;
4411
+ prevTime = 0;
4412
+ t = 0;
4413
+ iteration = 0;
4414
+ started = !1;
4415
+ done = !1;
4416
+ reversed = !1;
4417
+ paused = !1;
4418
+ unflatten = !0;
4419
+ resolvePromise = null;
4420
+ constructor(t, n, r, s) {
4421
+ this.options = {}, this.setOptions({ ...wa, ...t ?? {} }), this.targets = n == null ? [] : Array.isArray(n) ? n : [n], this.name = r, this.superKey = s;
4422
+ }
4423
+ convertFrameStart(t) {
4424
+ if (t.start.unit === "s" || t.start.unit === "ms" || !t.start.unit) {
4425
+ const n = ar(t.start.value, t.start.unit);
4426
+ t.start.value = n / this.options.duration * 100, t.start.unit = "%";
4427
+ }
4428
+ return t.start.value = J(t.start.value, 0, 100), t;
4429
+ }
4430
+ addFrame(t, n, r, s) {
4431
+ typeof t == "number" ? t = String(t) + "%" : typeof t == "string" ? t = t : t instanceof d && (t = String(t));
4432
+ const i = oe(t);
4433
+ let o = {
4434
+ id: this.frameId,
4435
+ start: i,
4436
+ vars: n,
4437
+ transform: r,
4438
+ timingFunction: tr(s) ?? this.options.timingFunction
4439
+ };
4440
+ return this.convertFrameStart(o), this.templateFrames.push(o), this.frameId += 1, this;
4441
+ }
4442
+ createFrame(t, n) {
4443
+ const [r, s] = [
4444
+ this.templateFrames[t],
4445
+ this.templateFrames[n]
4446
+ ], i = {
4447
+ start: t,
4448
+ stop: n
4449
+ }, o = Ia(r, s, this.options.duration);
4450
+ let a = r.transform;
4451
+ if (a == null) {
4452
+ const u = mn(
4453
+ t,
4454
+ this.frames,
4455
+ (h) => h.transform != null
4456
+ );
4457
+ a = this.frames[u].transform;
4458
+ }
4459
+ let c = r.timingFunction;
4460
+ if (c == null) {
4461
+ const u = mn(
4462
+ t,
4463
+ this.frames,
4464
+ (h) => h.timingFunction != null
4465
+ );
4466
+ c = this.frames[u].timingFunction;
4467
+ }
4468
+ return {
4469
+ id: this.frameId++,
4470
+ ixs: i,
4471
+ start: r.start,
4472
+ time: o,
4473
+ vars: void 0,
4474
+ flatVars: void 0,
4475
+ interpVars: {},
4476
+ transform: a,
4477
+ timingFunction: c
4478
+ };
4479
+ }
4480
+ reconcileVars(t) {
4481
+ const n = this.parsedVars[t];
4482
+ Object.keys(n).forEach((r) => {
4483
+ const s = this.parsedVars.findIndex((l, u) => u > t && l[r] != null);
4484
+ if (s === -1)
4485
+ return;
4486
+ const [i, o] = [t, s], a = this.frames.findIndex(
4487
+ (l) => l.ixs.start === i && l.ixs.stop === o
4488
+ ), c = a !== -1 ? this.frames[a] : this.createFrame(i, o);
4489
+ c.interpVars[r] = Ma(
4490
+ r,
4491
+ i,
4492
+ o,
4493
+ this.parsedVars
4494
+ ), a === -1 && this.frames.push(c);
4495
+ });
4496
+ }
4497
+ parse() {
4498
+ this.frames = [], this.templateFrames.sort((t, n) => t.start.value - n.start.value), this.parsedVars = this.templateFrames.map((t) => {
4499
+ const n = Ea(t.vars);
4500
+ return Object.values(n).forEach((r) => {
4501
+ r.setTargets(this.targets);
4502
+ }), n;
4503
+ });
4504
+ for (let t = 0; t < this.templateFrames.length - 1; t++)
4505
+ this.frames.push(this.createFrame(t, t + 1));
4506
+ return this.frames.forEach((t, n) => this.reconcileVars(n)), this.frames.sort((t, n) => t.time.start === n.time.start ? t.time.stop - n.time.stop : t.time.start - n.time.start), this.frames = this.frames.filter(
4507
+ (t) => t.interpVars != null && Object.keys(t.interpVars).length > 0
4508
+ ), this.frames.forEach((t) => {
4509
+ t.flatVars = Object.entries(t.interpVars).reduce(
4510
+ (n, [r, s]) => (n[r] = s.map((i) => i.value), n),
4511
+ {}
4512
+ ), t.vars = bs(t.flatVars);
4513
+ }), this;
4514
+ }
4515
+ setTimingFunction(t) {
4516
+ return this.options.timingFunction = tr(t) ?? Qt, this;
4517
+ }
4518
+ setIterationCount(t) {
4519
+ return !t || t === "infinite" || t === "∞" || t === "Infinity" ? this.options.iterationCount = 1 / 0 : typeof t == "string" ? this.options.iterationCount = parseFloat(t.trim()) : this.options.iterationCount = t, this;
4520
+ }
4521
+ setDuration(t) {
4522
+ typeof t == "string" && (t = Qn(t));
4523
+ const n = this.options.duration, r = t ?? n, s = r / n;
4524
+ for (let i = 0; i < this.frames.length; i++) {
4525
+ const o = this.frames[i];
4526
+ o.time.start *= s, o.time.stop *= s;
4527
+ }
4528
+ return this.options.duration = r, this;
4529
+ }
4530
+ setDelay(t) {
4531
+ return typeof t == "string" && (t = Qn(t)), this.options.delay = t ?? 0, this;
4532
+ }
4533
+ setDirection(t) {
4534
+ return this.options.direction = t ?? "normal", this;
4535
+ }
4536
+ setFillMode(t) {
4537
+ return this.options.fillMode = t ?? "forwards", this;
4538
+ }
4539
+ setOptions(t) {
4540
+ return this.setTimingFunction(t.timingFunction), this.setDuration(t.duration), this.setIterationCount(t.iterationCount), this.setDelay(t.delay), this.setDirection(t.direction), this.setFillMode(t.fillMode), this;
4541
+ }
4542
+ reverse() {
4543
+ return this.reversed = !this.reversed, this;
4544
+ }
4545
+ fillForwards() {
4546
+ this.interpFrames(this.options.duration, !0);
4547
+ }
4548
+ fillBackwards() {
4549
+ this.interpFrames(0, !0);
4550
+ }
4551
+ interpFrames(t, n = !1) {
4552
+ return t = this.reversed ? this.options.duration - t : t, this.frames.map((r) => {
4553
+ const { start: s, stop: i } = r.time;
4554
+ if (t < s || t > i)
4555
+ return;
4556
+ const o = E(t, s, i, 0, 1), a = r.timingFunction(o);
4557
+ return Object.values(r.interpVars).forEach((c) => {
4558
+ c.forEach((l) => {
4559
+ Ca(a, l);
4560
+ });
4561
+ }), n && r.transform(this.unflatten ? r.vars : r.flatVars, t), r.flatVars;
4562
+ }).reduce((r, s) => ({ ...r, ...s }), {});
4563
+ }
4564
+ async onStart() {
4565
+ this.reversed = !1, (this.options.direction === "reverse" || this.options.direction === "alternate-reverse" || this.options.direction === "alternate" && this.iteration % 2 === 1) && this.reverse(), (this.options.fillMode === "backwards" || this.options.fillMode === "both") && this.fillBackwards(), this.options.delay > 0 && (this.pause(), await os(this.options.delay), this.pause()), this.started = !0;
4566
+ }
4567
+ async onEnd() {
4568
+ this.options.fillMode === "forwards" || this.options.fillMode === "both" ? this.fillForwards() : (this.options.fillMode === "none" || this.options.fillMode === "backwards") && this.fillBackwards(), this.startTime = void 0, this.iteration === this.options.iterationCount - 1 ? (this.done = !0, this.iteration = 0) : this.iteration += 1;
4569
+ }
4570
+ async tick(t) {
4571
+ if (this.startTime === void 0 && (await this.onStart(), this.startTime = t + this.options.delay), this.paused && this.pausedTime === 0)
4572
+ return this.pausedTime = t, this.t;
4573
+ if (this.pausedTime > 0 && !this.paused) {
4574
+ const n = t - this.pausedTime;
4575
+ this.startTime += n, this.pausedTime = 0;
4576
+ }
4577
+ return this.t = t - this.startTime, this.t >= this.options.duration && (await this.onEnd(), this.t = this.options.duration), this.t;
4578
+ }
4579
+ async draw(t) {
4580
+ t = await this.tick(t), !this.paused && (this.interpFrames(t, !0), this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = vt(this.draw.bind(this)));
4581
+ }
4582
+ async play() {
4583
+ return new Promise((t) => {
4584
+ this.resolvePromise = t, this.handleId = vt(this.draw.bind(this));
4585
+ });
4586
+ }
4587
+ pause(t = !0) {
4588
+ return this.paused && t && (this.handleId = vt(this.draw.bind(this))), this.started && (this.paused = !this.paused), this;
4589
+ }
4590
+ stop() {
4591
+ er(this.handleId), this.reset();
4592
+ }
4593
+ playing() {
4594
+ return !(!this.started || this.paused);
4595
+ }
4596
+ reset() {
4597
+ return this.done = !1, this.started = !1, this.paused = !1, this;
4598
+ }
4599
+ setTargets(...t) {
4600
+ return this.targets = t, this.frames.forEach((n) => {
4601
+ Object.values(n.interpVars).forEach((r) => {
4602
+ r.forEach(({ start: s, stop: i, value: o }) => {
4603
+ s.setTargets(this.targets), i.setTargets(this.targets), o.setTargets(this.targets);
4604
+ });
4605
+ });
4606
+ }), this;
4607
+ }
4608
+ group(...t) {
4609
+ return new ka(this, ...t);
4610
+ }
4611
+ }
4612
+ class Oa extends za {
4613
+ constructor(t, ...n) {
4614
+ super(t, n), this.unflatten = !1;
4615
+ }
4616
+ fromVars(t, n) {
4617
+ this.unflatten = n != null, n ??= this.transform.bind(this);
4618
+ for (let r = 0; r < t.length; r++) {
4619
+ const s = t[r], i = Math.round(r / (t.length - 1) * 100);
4620
+ this.addFrame(i, s, n);
4621
+ }
4622
+ return this.parse(), this;
4623
+ }
4624
+ fromKeyframes(t, n) {
4625
+ this.unflatten = n != null, n ??= this.transform.bind(this), Te(t) && (t = new Map(Object.entries(t)));
4626
+ for (const [r, s] of t.entries())
4627
+ this.addFrame(r, s, n);
4628
+ return this.parse(), this;
4629
+ }
4630
+ fromString(t, n) {
4631
+ this.unflatten = n != null, n ??= this.transform.bind(this);
4632
+ const r = ga(t);
4633
+ for (const [s, i] of r.entries())
4634
+ this.addFrame(s, i, n), this.parsedVars.push(i);
4635
+ return this.parse(), this;
4636
+ }
4637
+ transform(t) {
4638
+ Ba(t, this.targets);
4639
+ }
4640
+ }
4641
+ export {
4642
+ za as Animation,
4643
+ Oa as CSSKeyframesAnimation,
4644
+ Ta as getAnimationId
4645
+ };