tailwind-clamp 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/index.js +438 -385
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var C = (t, e, n) =>
|
|
1
|
+
var gt = Object.defineProperty;
|
|
2
|
+
var vt = (t, e, n) => e in t ? gt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var C = (t, e, n) => vt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
function _e(t, e) {
|
|
5
5
|
return { handler: t, config: e };
|
|
6
6
|
}
|
|
@@ -68,6 +68,18 @@ const ht = (t) => {
|
|
|
68
68
|
key: "padding",
|
|
69
69
|
props: ["paddingBlock"]
|
|
70
70
|
};
|
|
71
|
+
case "pbs":
|
|
72
|
+
return {
|
|
73
|
+
type: "spacing",
|
|
74
|
+
key: "padding",
|
|
75
|
+
props: ["paddingBlockStart"]
|
|
76
|
+
};
|
|
77
|
+
case "pbe":
|
|
78
|
+
return {
|
|
79
|
+
type: "spacing",
|
|
80
|
+
key: "padding",
|
|
81
|
+
props: ["paddingBlockEnd"]
|
|
82
|
+
};
|
|
71
83
|
case "m":
|
|
72
84
|
return {
|
|
73
85
|
type: "spacing",
|
|
@@ -122,6 +134,18 @@ const ht = (t) => {
|
|
|
122
134
|
key: "margin",
|
|
123
135
|
props: ["marginBlock"]
|
|
124
136
|
};
|
|
137
|
+
case "mbs":
|
|
138
|
+
return {
|
|
139
|
+
type: "spacing",
|
|
140
|
+
key: "margin",
|
|
141
|
+
props: ["marginBlockStart"]
|
|
142
|
+
};
|
|
143
|
+
case "mbe":
|
|
144
|
+
return {
|
|
145
|
+
type: "spacing",
|
|
146
|
+
key: "margin",
|
|
147
|
+
props: ["marginBlockEnd"]
|
|
148
|
+
};
|
|
125
149
|
case "inset":
|
|
126
150
|
return {
|
|
127
151
|
type: "spacing",
|
|
@@ -290,6 +314,18 @@ const ht = (t) => {
|
|
|
290
314
|
key: "scrollMargin",
|
|
291
315
|
props: ["scrollMarginRight"]
|
|
292
316
|
};
|
|
317
|
+
case "scroll-mbs":
|
|
318
|
+
return {
|
|
319
|
+
type: "spacing",
|
|
320
|
+
key: "scrollMargin",
|
|
321
|
+
props: ["scrollMarginBlockStart"]
|
|
322
|
+
};
|
|
323
|
+
case "scroll-mbe":
|
|
324
|
+
return {
|
|
325
|
+
type: "spacing",
|
|
326
|
+
key: "scrollMargin",
|
|
327
|
+
props: ["scrollMarginBlockEnd"]
|
|
328
|
+
};
|
|
293
329
|
case "scroll-p":
|
|
294
330
|
return {
|
|
295
331
|
type: "spacing",
|
|
@@ -344,6 +380,18 @@ const ht = (t) => {
|
|
|
344
380
|
key: "scrollPadding",
|
|
345
381
|
props: ["scrollPaddingRight"]
|
|
346
382
|
};
|
|
383
|
+
case "scroll-pbs":
|
|
384
|
+
return {
|
|
385
|
+
type: "spacing",
|
|
386
|
+
key: "scrollPadding",
|
|
387
|
+
props: ["scrollPaddingBlockStart"]
|
|
388
|
+
};
|
|
389
|
+
case "scroll-pbe":
|
|
390
|
+
return {
|
|
391
|
+
type: "spacing",
|
|
392
|
+
key: "scrollPadding",
|
|
393
|
+
props: ["scrollPaddingBlockEnd"]
|
|
394
|
+
};
|
|
347
395
|
case "translate":
|
|
348
396
|
return {
|
|
349
397
|
type: "spacing",
|
|
@@ -582,10 +630,10 @@ class De extends Error {
|
|
|
582
630
|
}
|
|
583
631
|
}
|
|
584
632
|
class Y extends De {
|
|
585
|
-
constructor(n, r, o, i,
|
|
633
|
+
constructor(n, r, o, i, a) {
|
|
586
634
|
super(n, r, o, i);
|
|
587
635
|
C(this, "token");
|
|
588
|
-
this.token =
|
|
636
|
+
this.token = a;
|
|
589
637
|
}
|
|
590
638
|
}
|
|
591
639
|
const H = { UnexpectedNewLineInString: "Unexpected newline while consuming a string token.", UnexpectedEOFInString: "Unexpected EOF while consuming a string token.", UnexpectedEOFInComment: "Unexpected EOF while consuming a comment.", UnexpectedEOFInURL: "Unexpected EOF while consuming a url token.", UnexpectedEOFInEscapedCodePoint: "Unexpected EOF while consuming an escaped code point.", UnexpectedCharacterInURL: "Unexpected character while consuming a url token.", InvalidEscapeSequenceInURL: "Invalid escape sequence while consuming a url token.", InvalidEscapeSequenceAfterBackslash: 'Invalid escape sequence after "\\"' };
|
|
@@ -604,23 +652,23 @@ function W(t) {
|
|
|
604
652
|
function yt(t) {
|
|
605
653
|
return t >= 65 && t <= 90;
|
|
606
654
|
}
|
|
607
|
-
function
|
|
655
|
+
function kt(t) {
|
|
608
656
|
return t >= 97 && t <= 122;
|
|
609
657
|
}
|
|
610
658
|
function te(t) {
|
|
611
659
|
return t >= 48 && t <= 57 || t >= 97 && t <= 102 || t >= 65 && t <= 70;
|
|
612
660
|
}
|
|
613
|
-
function
|
|
614
|
-
return
|
|
661
|
+
function Et(t) {
|
|
662
|
+
return kt(t) || yt(t);
|
|
615
663
|
}
|
|
616
664
|
function ie(t) {
|
|
617
|
-
return
|
|
665
|
+
return Et(t) || Pt(t) || t === 95;
|
|
618
666
|
}
|
|
619
667
|
function qe(t) {
|
|
620
668
|
return ie(t) || W(t) || t === A;
|
|
621
669
|
}
|
|
622
|
-
function
|
|
623
|
-
return t === 183 || t === 8204 || t === 8205 || t === 8255 || t === 8256 || t === 8204 || 192 <= t && t <= 214 || 216 <= t && t <= 246 || 248 <= t && t <= 893 || 895 <= t && t <= 8191 || 8304 <= t && t <= 8591 || 11264 <= t && t <= 12271 || 12289 <= t && t <= 55295 || 63744 <= t && t <= 64975 || 65008 <= t && t <= 65533 || t === 0 || !!
|
|
670
|
+
function Pt(t) {
|
|
671
|
+
return t === 183 || t === 8204 || t === 8205 || t === 8255 || t === 8256 || t === 8204 || 192 <= t && t <= 214 || 216 <= t && t <= 246 || 248 <= t && t <= 893 || 895 <= t && t <= 8191 || 8304 <= t && t <= 8591 || 11264 <= t && t <= 12271 || 12289 <= t && t <= 55295 || 63744 <= t && t <= 64975 || 65008 <= t && t <= 65533 || t === 0 || !!se(t) || t >= 65536;
|
|
624
672
|
}
|
|
625
673
|
function be(t) {
|
|
626
674
|
return t === re || t === ne || t === 12;
|
|
@@ -628,14 +676,14 @@ function be(t) {
|
|
|
628
676
|
function X(t) {
|
|
629
677
|
return t === 32 || t === re || t === 9 || t === ne || t === 12;
|
|
630
678
|
}
|
|
631
|
-
function
|
|
679
|
+
function se(t) {
|
|
632
680
|
return t >= 55296 && t <= 57343;
|
|
633
681
|
}
|
|
634
|
-
function
|
|
682
|
+
function pe(t) {
|
|
635
683
|
return t.source.codePointAt(t.cursor) === 92 && !be(t.source.codePointAt(t.cursor + 1) ?? -1);
|
|
636
684
|
}
|
|
637
685
|
function Se(t, e) {
|
|
638
|
-
return e.source.codePointAt(e.cursor) === A ? e.source.codePointAt(e.cursor + 1) === A || !!ie(e.source.codePointAt(e.cursor + 1) ?? -1) || e.source.codePointAt(e.cursor + 1) === 92 && !be(e.source.codePointAt(e.cursor + 2) ?? -1) : !!ie(e.source.codePointAt(e.cursor) ?? -1) ||
|
|
686
|
+
return e.source.codePointAt(e.cursor) === A ? e.source.codePointAt(e.cursor + 1) === A || !!ie(e.source.codePointAt(e.cursor + 1) ?? -1) || e.source.codePointAt(e.cursor + 1) === 92 && !be(e.source.codePointAt(e.cursor + 2) ?? -1) : !!ie(e.source.codePointAt(e.cursor) ?? -1) || pe(e);
|
|
639
687
|
}
|
|
640
688
|
function Ye(t) {
|
|
641
689
|
return t.source.codePointAt(t.cursor) === oe || t.source.codePointAt(t.cursor) === A ? !!W(t.source.codePointAt(t.cursor + 1) ?? -1) || t.source.codePointAt(t.cursor + 1) === 46 && W(t.source.codePointAt(t.cursor + 2) ?? -1) : t.source.codePointAt(t.cursor) === 46 ? W(t.source.codePointAt(t.cursor + 1) ?? -1) : W(t.source.codePointAt(t.cursor) ?? -1);
|
|
@@ -646,39 +694,39 @@ function bt(t) {
|
|
|
646
694
|
function St(t) {
|
|
647
695
|
return t.source.codePointAt(t.cursor) === A && t.source.codePointAt(t.cursor + 1) === A && t.source.codePointAt(t.cursor + 2) === 62;
|
|
648
696
|
}
|
|
649
|
-
var
|
|
697
|
+
var s, p, Ae;
|
|
650
698
|
function At(t) {
|
|
651
699
|
switch (t) {
|
|
652
|
-
case
|
|
653
|
-
return
|
|
654
|
-
case
|
|
655
|
-
return
|
|
656
|
-
case
|
|
657
|
-
return
|
|
658
|
-
case
|
|
659
|
-
return
|
|
660
|
-
case
|
|
661
|
-
return
|
|
662
|
-
case
|
|
663
|
-
return
|
|
700
|
+
case s.OpenParen:
|
|
701
|
+
return s.CloseParen;
|
|
702
|
+
case s.CloseParen:
|
|
703
|
+
return s.OpenParen;
|
|
704
|
+
case s.OpenCurly:
|
|
705
|
+
return s.CloseCurly;
|
|
706
|
+
case s.CloseCurly:
|
|
707
|
+
return s.OpenCurly;
|
|
708
|
+
case s.OpenSquare:
|
|
709
|
+
return s.CloseSquare;
|
|
710
|
+
case s.CloseSquare:
|
|
711
|
+
return s.OpenSquare;
|
|
664
712
|
default:
|
|
665
713
|
return null;
|
|
666
714
|
}
|
|
667
715
|
}
|
|
668
716
|
function Dt(t) {
|
|
669
717
|
switch (t[0]) {
|
|
670
|
-
case
|
|
671
|
-
return [
|
|
672
|
-
case
|
|
673
|
-
return [
|
|
674
|
-
case
|
|
675
|
-
return [
|
|
676
|
-
case
|
|
677
|
-
return [
|
|
678
|
-
case
|
|
679
|
-
return [
|
|
680
|
-
case
|
|
681
|
-
return [
|
|
718
|
+
case s.OpenParen:
|
|
719
|
+
return [s.CloseParen, ")", -1, -1, void 0];
|
|
720
|
+
case s.CloseParen:
|
|
721
|
+
return [s.OpenParen, "(", -1, -1, void 0];
|
|
722
|
+
case s.OpenCurly:
|
|
723
|
+
return [s.CloseCurly, "}", -1, -1, void 0];
|
|
724
|
+
case s.CloseCurly:
|
|
725
|
+
return [s.OpenCurly, "{", -1, -1, void 0];
|
|
726
|
+
case s.OpenSquare:
|
|
727
|
+
return [s.CloseSquare, "]", -1, -1, void 0];
|
|
728
|
+
case s.CloseSquare:
|
|
729
|
+
return [s.OpenSquare, "[", -1, -1, void 0];
|
|
682
730
|
default:
|
|
683
731
|
return null;
|
|
684
732
|
}
|
|
@@ -687,7 +735,7 @@ function Bt(t, e) {
|
|
|
687
735
|
for (e.advanceCodePoint(2); ; ) {
|
|
688
736
|
const n = e.readCodePoint();
|
|
689
737
|
if (n === void 0) {
|
|
690
|
-
const r = [
|
|
738
|
+
const r = [s.Comment, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
691
739
|
return t.onParseError(new Y(H.UnexpectedEOFInComment, e.representationStart, e.representationEnd, ["4.3.2. Consume comments", "Unexpected EOF"], r)), r;
|
|
692
740
|
}
|
|
693
741
|
if (n === 42 && e.source.codePointAt(e.cursor) !== void 0 && e.source.codePointAt(e.cursor) === 47) {
|
|
@@ -695,7 +743,7 @@ function Bt(t, e) {
|
|
|
695
743
|
break;
|
|
696
744
|
}
|
|
697
745
|
}
|
|
698
|
-
return [
|
|
746
|
+
return [s.Comment, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
699
747
|
}
|
|
700
748
|
function Be(t, e) {
|
|
701
749
|
const n = e.readCodePoint();
|
|
@@ -706,18 +754,18 @@ function Be(t, e) {
|
|
|
706
754
|
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && te(o) && r.length < 6; ) r.push(o), e.advanceCodePoint();
|
|
707
755
|
X(e.source.codePointAt(e.cursor) ?? -1) && (e.source.codePointAt(e.cursor) === ne && e.source.codePointAt(e.cursor + 1) === re && e.advanceCodePoint(), e.advanceCodePoint());
|
|
708
756
|
const i = parseInt(String.fromCodePoint(...r), 16);
|
|
709
|
-
return i === 0 ||
|
|
757
|
+
return i === 0 || se(i) || i > 1114111 ? Z : i;
|
|
710
758
|
}
|
|
711
|
-
return n === 0 ||
|
|
759
|
+
return n === 0 || se(n) ? Z : n;
|
|
712
760
|
}
|
|
713
761
|
function Fe(t, e) {
|
|
714
762
|
const n = [];
|
|
715
763
|
for (; ; ) {
|
|
716
764
|
const r = e.source.codePointAt(e.cursor) ?? -1;
|
|
717
|
-
if (r === 0 ||
|
|
765
|
+
if (r === 0 || se(r)) n.push(Z), e.advanceCodePoint(+(r > 65535) + 1);
|
|
718
766
|
else if (qe(r)) n.push(r), e.advanceCodePoint(+(r > 65535) + 1);
|
|
719
767
|
else {
|
|
720
|
-
if (!
|
|
768
|
+
if (!pe(e)) return n;
|
|
721
769
|
e.advanceCodePoint(), n.push(Be(t, e));
|
|
722
770
|
}
|
|
723
771
|
}
|
|
@@ -725,25 +773,25 @@ function Fe(t, e) {
|
|
|
725
773
|
function Ft(t, e) {
|
|
726
774
|
e.advanceCodePoint();
|
|
727
775
|
const n = e.source.codePointAt(e.cursor);
|
|
728
|
-
if (n !== void 0 && (qe(n) ||
|
|
776
|
+
if (n !== void 0 && (qe(n) || pe(e))) {
|
|
729
777
|
let r = Ae.Unrestricted;
|
|
730
778
|
Se(0, e) && (r = Ae.ID);
|
|
731
779
|
const o = Fe(t, e);
|
|
732
|
-
return [
|
|
780
|
+
return [s.Hash, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...o), type: r }];
|
|
733
781
|
}
|
|
734
|
-
return [
|
|
782
|
+
return [s.Delim, "#", e.representationStart, e.representationEnd, { value: "#" }];
|
|
735
783
|
}
|
|
736
784
|
function Nt(t, e) {
|
|
737
|
-
let n =
|
|
785
|
+
let n = p.Integer;
|
|
738
786
|
for (e.source.codePointAt(e.cursor) !== oe && e.source.codePointAt(e.cursor) !== A || e.advanceCodePoint(); W(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
739
|
-
if (e.source.codePointAt(e.cursor) === 46 && W(e.source.codePointAt(e.cursor + 1) ?? -1)) for (e.advanceCodePoint(2), n =
|
|
787
|
+
if (e.source.codePointAt(e.cursor) === 46 && W(e.source.codePointAt(e.cursor + 1) ?? -1)) for (e.advanceCodePoint(2), n = p.Number; W(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
740
788
|
if (e.source.codePointAt(e.cursor) === 101 || e.source.codePointAt(e.cursor) === 69) {
|
|
741
789
|
if (W(e.source.codePointAt(e.cursor + 1) ?? -1)) e.advanceCodePoint(2);
|
|
742
790
|
else {
|
|
743
791
|
if (e.source.codePointAt(e.cursor + 1) !== A && e.source.codePointAt(e.cursor + 1) !== oe || !W(e.source.codePointAt(e.cursor + 2) ?? -1)) return n;
|
|
744
792
|
e.advanceCodePoint(3);
|
|
745
793
|
}
|
|
746
|
-
for (n =
|
|
794
|
+
for (n = p.Number; W(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
747
795
|
}
|
|
748
796
|
return n;
|
|
749
797
|
}
|
|
@@ -756,19 +804,19 @@ function Me(t, e) {
|
|
|
756
804
|
const r = Nt(0, e), o = parseFloat(e.source.slice(e.representationStart, e.representationEnd + 1));
|
|
757
805
|
if (Se(0, e)) {
|
|
758
806
|
const i = Fe(t, e);
|
|
759
|
-
return [
|
|
807
|
+
return [s.Dimension, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n, type: r, unit: String.fromCodePoint(...i) }];
|
|
760
808
|
}
|
|
761
|
-
return e.source.codePointAt(e.cursor) === 37 ? (e.advanceCodePoint(), [
|
|
809
|
+
return e.source.codePointAt(e.cursor) === 37 ? (e.advanceCodePoint(), [s.Percentage, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n }]) : [s.Number, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n, type: r }];
|
|
762
810
|
}
|
|
763
811
|
function wt(t) {
|
|
764
812
|
for (; X(t.source.codePointAt(t.cursor) ?? -1); ) t.advanceCodePoint();
|
|
765
|
-
return [
|
|
813
|
+
return [s.Whitespace, t.source.slice(t.representationStart, t.representationEnd + 1), t.representationStart, t.representationEnd, void 0];
|
|
766
814
|
}
|
|
767
815
|
(function(t) {
|
|
768
816
|
t.Comment = "comment", t.AtKeyword = "at-keyword-token", t.BadString = "bad-string-token", t.BadURL = "bad-url-token", t.CDC = "CDC-token", t.CDO = "CDO-token", t.Colon = "colon-token", t.Comma = "comma-token", t.Delim = "delim-token", t.Dimension = "dimension-token", t.EOF = "EOF-token", t.Function = "function-token", t.Hash = "hash-token", t.Ident = "ident-token", t.Number = "number-token", t.Percentage = "percentage-token", t.Semicolon = "semicolon-token", t.String = "string-token", t.URL = "url-token", t.Whitespace = "whitespace-token", t.OpenParen = "(-token", t.CloseParen = ")-token", t.OpenSquare = "[-token", t.CloseSquare = "]-token", t.OpenCurly = "{-token", t.CloseCurly = "}-token", t.UnicodeRange = "unicode-range-token";
|
|
769
|
-
})(
|
|
817
|
+
})(s || (s = {})), (function(t) {
|
|
770
818
|
t.Integer = "integer", t.Number = "number";
|
|
771
|
-
})(
|
|
819
|
+
})(p || (p = {})), (function(t) {
|
|
772
820
|
t.Unrestricted = "unrestricted", t.ID = "id";
|
|
773
821
|
})(Ae || (Ae = {}));
|
|
774
822
|
class It {
|
|
@@ -799,16 +847,16 @@ function xt(t, e) {
|
|
|
799
847
|
for (; ; ) {
|
|
800
848
|
const o = e.readCodePoint();
|
|
801
849
|
if (o === void 0) {
|
|
802
|
-
const i = [
|
|
850
|
+
const i = [s.String, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
803
851
|
return t.onParseError(new Y(H.UnexpectedEOFInString, e.representationStart, e.representationEnd, ["4.3.5. Consume a string token", "Unexpected EOF"], i)), i;
|
|
804
852
|
}
|
|
805
853
|
if (be(o)) {
|
|
806
854
|
e.unreadCodePoint();
|
|
807
|
-
const i = [
|
|
855
|
+
const i = [s.BadString, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
808
856
|
return t.onParseError(new Y(H.UnexpectedNewLineInString, e.representationStart, e.source.codePointAt(e.cursor) === ne && e.source.codePointAt(e.cursor + 1) === re ? e.representationEnd + 2 : e.representationEnd + 1, ["4.3.5. Consume a string token", "Unexpected newline"], i)), i;
|
|
809
857
|
}
|
|
810
|
-
if (o === r) return [
|
|
811
|
-
if (o !== 92) o === 0 ||
|
|
858
|
+
if (o === r) return [s.String, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
859
|
+
if (o !== 92) o === 0 || se(o) ? n += String.fromCodePoint(Z) : n += String.fromCodePoint(o);
|
|
812
860
|
else {
|
|
813
861
|
if (e.source.codePointAt(e.cursor) === void 0) continue;
|
|
814
862
|
if (be(e.source.codePointAt(e.cursor) ?? -1)) {
|
|
@@ -827,7 +875,7 @@ function Re(t, e) {
|
|
|
827
875
|
const n = e.source.codePointAt(e.cursor);
|
|
828
876
|
if (n === void 0) return;
|
|
829
877
|
if (n === 41) return void e.advanceCodePoint();
|
|
830
|
-
|
|
878
|
+
pe(e) ? (e.advanceCodePoint(), Be(t, e)) : e.advanceCodePoint();
|
|
831
879
|
}
|
|
832
880
|
}
|
|
833
881
|
function Tt(t, e) {
|
|
@@ -835,40 +883,40 @@ function Tt(t, e) {
|
|
|
835
883
|
let n = "";
|
|
836
884
|
for (; ; ) {
|
|
837
885
|
if (e.source.codePointAt(e.cursor) === void 0) {
|
|
838
|
-
const i = [
|
|
886
|
+
const i = [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
839
887
|
return t.onParseError(new Y(H.UnexpectedEOFInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "Unexpected EOF"], i)), i;
|
|
840
888
|
}
|
|
841
|
-
if (e.source.codePointAt(e.cursor) === 41) return e.advanceCodePoint(), [
|
|
889
|
+
if (e.source.codePointAt(e.cursor) === 41) return e.advanceCodePoint(), [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
842
890
|
if (X(e.source.codePointAt(e.cursor) ?? -1)) {
|
|
843
891
|
for (e.advanceCodePoint(); X(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
844
892
|
if (e.source.codePointAt(e.cursor) === void 0) {
|
|
845
|
-
const i = [
|
|
893
|
+
const i = [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
846
894
|
return t.onParseError(new Y(H.UnexpectedEOFInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "Consume as much whitespace as possible", "Unexpected EOF"], i)), i;
|
|
847
895
|
}
|
|
848
|
-
return e.source.codePointAt(e.cursor) === 41 ? (e.advanceCodePoint(), [
|
|
896
|
+
return e.source.codePointAt(e.cursor) === 41 ? (e.advanceCodePoint(), [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }]) : (Re(t, e), [s.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0]);
|
|
849
897
|
}
|
|
850
898
|
const o = e.source.codePointAt(e.cursor);
|
|
851
899
|
if (o === 34 || o === 39 || o === 40 || (r = o ?? -1) === 11 || r === 127 || 0 <= r && r <= 8 || 14 <= r && r <= 31) {
|
|
852
900
|
Re(t, e);
|
|
853
|
-
const i = [
|
|
901
|
+
const i = [s.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
854
902
|
return t.onParseError(new Y(H.UnexpectedCharacterInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", `Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`], i)), i;
|
|
855
903
|
}
|
|
856
904
|
if (o === 92) {
|
|
857
|
-
if (
|
|
905
|
+
if (pe(e)) {
|
|
858
906
|
e.advanceCodePoint(), n += String.fromCodePoint(Be(t, e));
|
|
859
907
|
continue;
|
|
860
908
|
}
|
|
861
909
|
Re(t, e);
|
|
862
|
-
const i = [
|
|
910
|
+
const i = [s.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
863
911
|
return t.onParseError(new Y(H.InvalidEscapeSequenceInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "U+005C REVERSE SOLIDUS (\\)", "The input stream does not start with a valid escape sequence"], i)), i;
|
|
864
912
|
}
|
|
865
|
-
e.source.codePointAt(e.cursor) === 0 ||
|
|
913
|
+
e.source.codePointAt(e.cursor) === 0 || se(e.source.codePointAt(e.cursor) ?? -1) ? (n += String.fromCodePoint(Z), e.advanceCodePoint()) : (n += e.source[e.cursor], e.advanceCodePoint());
|
|
866
914
|
}
|
|
867
915
|
var r;
|
|
868
916
|
}
|
|
869
917
|
function Ue(t, e) {
|
|
870
918
|
const n = Fe(t, e);
|
|
871
|
-
if (e.source.codePointAt(e.cursor) !== 40) return [
|
|
919
|
+
if (e.source.codePointAt(e.cursor) !== 40) return [s.Ident, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
872
920
|
if (Ot(n)) {
|
|
873
921
|
e.advanceCodePoint();
|
|
874
922
|
let r = 0;
|
|
@@ -878,13 +926,13 @@ function Ue(t, e) {
|
|
|
878
926
|
r += 1, e.advanceCodePoint(1);
|
|
879
927
|
continue;
|
|
880
928
|
}
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
929
|
+
const a = o ? e.source.codePointAt(e.cursor + 1) : e.source.codePointAt(e.cursor);
|
|
930
|
+
if (a === 34 || a === 39) return r > 0 && e.unreadCodePoint(r), [s.Function, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
883
931
|
break;
|
|
884
932
|
}
|
|
885
933
|
return Tt(t, e);
|
|
886
934
|
}
|
|
887
|
-
return e.advanceCodePoint(), [
|
|
935
|
+
return e.advanceCodePoint(), [s.Function, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
888
936
|
}
|
|
889
937
|
function Mt(t) {
|
|
890
938
|
return !(t.source.codePointAt(t.cursor) !== 117 && t.source.codePointAt(t.cursor) !== 85 || t.source.codePointAt(t.cursor + 1) !== oe || t.source.codePointAt(t.cursor + 2) !== 63 && !te(t.source.codePointAt(t.cursor + 2) ?? -1));
|
|
@@ -898,10 +946,10 @@ function Rt(t, e) {
|
|
|
898
946
|
if (!r.length && e.source.codePointAt(e.cursor) === A && te(e.source.codePointAt(e.cursor + 1) ?? -1)) for (e.advanceCodePoint(); (o = e.source.codePointAt(e.cursor)) !== void 0 && r.length < 6 && te(o); ) r.push(o), e.advanceCodePoint();
|
|
899
947
|
if (!r.length) {
|
|
900
948
|
const u = parseInt(String.fromCodePoint(...n), 16);
|
|
901
|
-
return [
|
|
949
|
+
return [s.UnicodeRange, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { startOfRange: u, endOfRange: u }];
|
|
902
950
|
}
|
|
903
|
-
const i = parseInt(String.fromCodePoint(...n), 16),
|
|
904
|
-
return [
|
|
951
|
+
const i = parseInt(String.fromCodePoint(...n), 16), a = parseInt(String.fromCodePoint(...r), 16);
|
|
952
|
+
return [s.UnicodeRange, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { startOfRange: i, endOfRange: a }];
|
|
905
953
|
}
|
|
906
954
|
function Ut(t, e) {
|
|
907
955
|
const n = Wt(t), r = [];
|
|
@@ -913,30 +961,30 @@ function Wt(t, e) {
|
|
|
913
961
|
return { nextToken: function() {
|
|
914
962
|
o.resetRepresentation();
|
|
915
963
|
const u = o.source.codePointAt(o.cursor);
|
|
916
|
-
if (u === void 0) return [
|
|
964
|
+
if (u === void 0) return [s.EOF, "", -1, -1, void 0];
|
|
917
965
|
if (u === 47 && bt(o)) return Bt(i, o);
|
|
918
966
|
if (r && (u === 117 || u === 85) && Mt(o)) return Rt(0, o);
|
|
919
967
|
if (ie(u)) return Ue(i, o);
|
|
920
968
|
if (W(u)) return Me(i, o);
|
|
921
969
|
switch (u) {
|
|
922
970
|
case 44:
|
|
923
|
-
return o.advanceCodePoint(), [
|
|
971
|
+
return o.advanceCodePoint(), [s.Comma, ",", o.representationStart, o.representationEnd, void 0];
|
|
924
972
|
case 58:
|
|
925
|
-
return o.advanceCodePoint(), [
|
|
973
|
+
return o.advanceCodePoint(), [s.Colon, ":", o.representationStart, o.representationEnd, void 0];
|
|
926
974
|
case 59:
|
|
927
|
-
return o.advanceCodePoint(), [
|
|
975
|
+
return o.advanceCodePoint(), [s.Semicolon, ";", o.representationStart, o.representationEnd, void 0];
|
|
928
976
|
case 40:
|
|
929
|
-
return o.advanceCodePoint(), [
|
|
977
|
+
return o.advanceCodePoint(), [s.OpenParen, "(", o.representationStart, o.representationEnd, void 0];
|
|
930
978
|
case 41:
|
|
931
|
-
return o.advanceCodePoint(), [
|
|
979
|
+
return o.advanceCodePoint(), [s.CloseParen, ")", o.representationStart, o.representationEnd, void 0];
|
|
932
980
|
case 91:
|
|
933
|
-
return o.advanceCodePoint(), [
|
|
981
|
+
return o.advanceCodePoint(), [s.OpenSquare, "[", o.representationStart, o.representationEnd, void 0];
|
|
934
982
|
case 93:
|
|
935
|
-
return o.advanceCodePoint(), [
|
|
983
|
+
return o.advanceCodePoint(), [s.CloseSquare, "]", o.representationStart, o.representationEnd, void 0];
|
|
936
984
|
case 123:
|
|
937
|
-
return o.advanceCodePoint(), [
|
|
985
|
+
return o.advanceCodePoint(), [s.OpenCurly, "{", o.representationStart, o.representationEnd, void 0];
|
|
938
986
|
case 125:
|
|
939
|
-
return o.advanceCodePoint(), [
|
|
987
|
+
return o.advanceCodePoint(), [s.CloseCurly, "}", o.representationStart, o.representationEnd, void 0];
|
|
940
988
|
case 39:
|
|
941
989
|
case 34:
|
|
942
990
|
return xt(i, o);
|
|
@@ -944,7 +992,7 @@ function Wt(t, e) {
|
|
|
944
992
|
return Ft(i, o);
|
|
945
993
|
case oe:
|
|
946
994
|
case 46:
|
|
947
|
-
return Ye(o) ? Me(i, o) : (o.advanceCodePoint(), [
|
|
995
|
+
return Ye(o) ? Me(i, o) : (o.advanceCodePoint(), [s.Delim, o.source[o.representationStart], o.representationStart, o.representationEnd, { value: o.source[o.representationStart] }]);
|
|
948
996
|
case re:
|
|
949
997
|
case ne:
|
|
950
998
|
case 12:
|
|
@@ -952,23 +1000,23 @@ function Wt(t, e) {
|
|
|
952
1000
|
case 32:
|
|
953
1001
|
return wt(o);
|
|
954
1002
|
case A:
|
|
955
|
-
return Ye(o) ? Me(i, o) : St(o) ? (o.advanceCodePoint(3), [
|
|
1003
|
+
return Ye(o) ? Me(i, o) : St(o) ? (o.advanceCodePoint(3), [s.CDC, "-->", o.representationStart, o.representationEnd, void 0]) : Se(0, o) ? Ue(i, o) : (o.advanceCodePoint(), [s.Delim, "-", o.representationStart, o.representationEnd, { value: "-" }]);
|
|
956
1004
|
case 60:
|
|
957
|
-
return Ct(o) ? (o.advanceCodePoint(4), [
|
|
1005
|
+
return Ct(o) ? (o.advanceCodePoint(4), [s.CDO, "<!--", o.representationStart, o.representationEnd, void 0]) : (o.advanceCodePoint(), [s.Delim, "<", o.representationStart, o.representationEnd, { value: "<" }]);
|
|
958
1006
|
case 64:
|
|
959
1007
|
if (o.advanceCodePoint(), Se(0, o)) {
|
|
960
1008
|
const c = Fe(i, o);
|
|
961
|
-
return [
|
|
1009
|
+
return [s.AtKeyword, o.source.slice(o.representationStart, o.representationEnd + 1), o.representationStart, o.representationEnd, { value: String.fromCodePoint(...c) }];
|
|
962
1010
|
}
|
|
963
|
-
return [
|
|
1011
|
+
return [s.Delim, "@", o.representationStart, o.representationEnd, { value: "@" }];
|
|
964
1012
|
case 92: {
|
|
965
|
-
if (
|
|
1013
|
+
if (pe(o)) return Ue(i, o);
|
|
966
1014
|
o.advanceCodePoint();
|
|
967
|
-
const c = [
|
|
1015
|
+
const c = [s.Delim, "\\", o.representationStart, o.representationEnd, { value: "\\" }];
|
|
968
1016
|
return i.onParseError(new Y(H.InvalidEscapeSequenceAfterBackslash, o.representationStart, o.representationEnd, ["4.3.1. Consume a token", "U+005C REVERSE SOLIDUS (\\)", "The input stream does not start with a valid escape sequence"], c)), c;
|
|
969
1017
|
}
|
|
970
1018
|
}
|
|
971
|
-
return o.advanceCodePoint(), [
|
|
1019
|
+
return o.advanceCodePoint(), [s.Delim, o.source[o.representationStart], o.representationStart, o.representationEnd, { value: o.source[o.representationStart] }];
|
|
972
1020
|
}, endOfFile: function() {
|
|
973
1021
|
return o.source.codePointAt(o.cursor) === void 0;
|
|
974
1022
|
} };
|
|
@@ -980,8 +1028,8 @@ function $t(t, e) {
|
|
|
980
1028
|
for (const u of e) n.push(u.codePointAt(0));
|
|
981
1029
|
const r = qt(n);
|
|
982
1030
|
r[0] === 101 && Le(r, 0, r[0]);
|
|
983
|
-
const o = String.fromCodePoint(...r), i = t[4].signCharacter === "+" ? t[4].signCharacter : "",
|
|
984
|
-
t[1] = `${i}${
|
|
1031
|
+
const o = String.fromCodePoint(...r), i = t[4].signCharacter === "+" ? t[4].signCharacter : "", a = t[4].value.toString();
|
|
1032
|
+
t[1] = `${i}${a}${o}`, t[4].unit = e;
|
|
985
1033
|
}
|
|
986
1034
|
function qt(t) {
|
|
987
1035
|
let e = 0;
|
|
@@ -1003,16 +1051,16 @@ function Le(t, e, n) {
|
|
|
1003
1051
|
for (const i of r) o.push(i.codePointAt(0));
|
|
1004
1052
|
return t.splice(e, 1, 92, ...o, 32), 1 + o.length;
|
|
1005
1053
|
}
|
|
1006
|
-
const Vt = Object.values(
|
|
1054
|
+
const Vt = Object.values(s);
|
|
1007
1055
|
function et(t) {
|
|
1008
1056
|
return !!Array.isArray(t) && !(t.length < 4) && !!Vt.includes(t[0]) && typeof t[1] == "string" && typeof t[2] == "number" && typeof t[3] == "number";
|
|
1009
1057
|
}
|
|
1010
1058
|
function D(t) {
|
|
1011
1059
|
if (!t) return !1;
|
|
1012
1060
|
switch (t[0]) {
|
|
1013
|
-
case
|
|
1014
|
-
case
|
|
1015
|
-
case
|
|
1061
|
+
case s.Dimension:
|
|
1062
|
+
case s.Number:
|
|
1063
|
+
case s.Percentage:
|
|
1016
1064
|
return !0;
|
|
1017
1065
|
default:
|
|
1018
1066
|
return !1;
|
|
@@ -1021,61 +1069,61 @@ function D(t) {
|
|
|
1021
1069
|
function tt(t) {
|
|
1022
1070
|
if (!t) return !1;
|
|
1023
1071
|
switch (t[0]) {
|
|
1024
|
-
case
|
|
1025
|
-
case
|
|
1072
|
+
case s.Whitespace:
|
|
1073
|
+
case s.Comment:
|
|
1026
1074
|
return !0;
|
|
1027
1075
|
default:
|
|
1028
1076
|
return !1;
|
|
1029
1077
|
}
|
|
1030
1078
|
}
|
|
1031
|
-
function
|
|
1032
|
-
return !!t && t[0] ===
|
|
1079
|
+
function ae(t) {
|
|
1080
|
+
return !!t && t[0] === s.Comma;
|
|
1033
1081
|
}
|
|
1034
1082
|
function nt(t) {
|
|
1035
|
-
return !!t && t[0] ===
|
|
1083
|
+
return !!t && t[0] === s.Comment;
|
|
1036
1084
|
}
|
|
1037
1085
|
function Ze(t) {
|
|
1038
|
-
return !!t && t[0] ===
|
|
1086
|
+
return !!t && t[0] === s.Delim;
|
|
1039
1087
|
}
|
|
1040
|
-
function
|
|
1041
|
-
return !!t && t[0] ===
|
|
1088
|
+
function P(t) {
|
|
1089
|
+
return !!t && t[0] === s.Dimension;
|
|
1042
1090
|
}
|
|
1043
1091
|
function K(t) {
|
|
1044
|
-
return !!t && t[0] ===
|
|
1092
|
+
return !!t && t[0] === s.EOF;
|
|
1045
1093
|
}
|
|
1046
1094
|
function jt(t) {
|
|
1047
|
-
return !!t && t[0] ===
|
|
1095
|
+
return !!t && t[0] === s.Function;
|
|
1048
1096
|
}
|
|
1049
|
-
function
|
|
1050
|
-
return !!t && t[0] ===
|
|
1097
|
+
function ve(t) {
|
|
1098
|
+
return !!t && t[0] === s.Ident;
|
|
1051
1099
|
}
|
|
1052
|
-
function
|
|
1053
|
-
return !!t && t[0] ===
|
|
1100
|
+
function v(t) {
|
|
1101
|
+
return !!t && t[0] === s.Number;
|
|
1054
1102
|
}
|
|
1055
1103
|
function b(t) {
|
|
1056
|
-
return !!t && t[0] ===
|
|
1104
|
+
return !!t && t[0] === s.Percentage;
|
|
1057
1105
|
}
|
|
1058
1106
|
function ze(t) {
|
|
1059
|
-
return !!t && t[0] ===
|
|
1107
|
+
return !!t && t[0] === s.Whitespace;
|
|
1060
1108
|
}
|
|
1061
1109
|
function rt(t) {
|
|
1062
|
-
return !!t && t[0] ===
|
|
1110
|
+
return !!t && t[0] === s.OpenParen;
|
|
1063
1111
|
}
|
|
1064
1112
|
function Ht(t) {
|
|
1065
|
-
return !!t && t[0] ===
|
|
1113
|
+
return !!t && t[0] === s.CloseParen;
|
|
1066
1114
|
}
|
|
1067
1115
|
function Gt(t) {
|
|
1068
|
-
return !!t && t[0] ===
|
|
1116
|
+
return !!t && t[0] === s.OpenSquare;
|
|
1069
1117
|
}
|
|
1070
1118
|
function Jt(t) {
|
|
1071
|
-
return !!t && t[0] ===
|
|
1119
|
+
return !!t && t[0] === s.OpenCurly;
|
|
1072
1120
|
}
|
|
1073
1121
|
var $;
|
|
1074
1122
|
function ot(t) {
|
|
1075
1123
|
let e = t.slice();
|
|
1076
1124
|
return (n, r, o) => {
|
|
1077
1125
|
let i = -1;
|
|
1078
|
-
for (let
|
|
1126
|
+
for (let a = e.indexOf(r); a < e.length && (i = n.indexOf(e[a]), i === -1 || i < o); a++) ;
|
|
1079
1127
|
return i === -1 || i === o && r === n[o] && (i++, i >= n.length) ? -1 : (e = n.slice(), i);
|
|
1080
1128
|
};
|
|
1081
1129
|
}
|
|
@@ -1090,7 +1138,7 @@ function Ve(t, e) {
|
|
|
1090
1138
|
return { advance: r.advance, node: r.node };
|
|
1091
1139
|
}
|
|
1092
1140
|
if (ze(n)) {
|
|
1093
|
-
const r =
|
|
1141
|
+
const r = st(t, e);
|
|
1094
1142
|
return { advance: r.advance, node: r.node };
|
|
1095
1143
|
}
|
|
1096
1144
|
if (nt(n)) {
|
|
@@ -1118,8 +1166,8 @@ class it {
|
|
|
1118
1166
|
let o = 0;
|
|
1119
1167
|
for (; o < this.value.length; ) {
|
|
1120
1168
|
const i = this.value[o];
|
|
1121
|
-
let
|
|
1122
|
-
if (n && (
|
|
1169
|
+
let a;
|
|
1170
|
+
if (n && (a = { ...n }), e({ node: i, parent: this, state: a }, o) === !1) return !1;
|
|
1123
1171
|
if (o = r(this.value, i, o), o === -1) break;
|
|
1124
1172
|
}
|
|
1125
1173
|
}
|
|
@@ -1139,7 +1187,7 @@ class N extends it {
|
|
|
1139
1187
|
return this.name[4].value;
|
|
1140
1188
|
}
|
|
1141
1189
|
normalize() {
|
|
1142
|
-
K(this.endToken) && (this.endToken = [
|
|
1190
|
+
K(this.endToken) && (this.endToken = [s.CloseParen, ")", -1, -1, void 0]);
|
|
1143
1191
|
}
|
|
1144
1192
|
tokens() {
|
|
1145
1193
|
return K(this.endToken) ? [this.name, ...this.value.flatMap(((n) => n.tokens()))] : [this.name, ...this.value.flatMap(((n) => n.tokens())), this.endToken];
|
|
@@ -1166,8 +1214,8 @@ function Yt(t, e) {
|
|
|
1166
1214
|
if (!o || K(o)) return t.onParseError(new De("Unexpected EOF while consuming a function.", e[0][2], e[e.length - 1][3], ["5.4.9. Consume a function", "Unexpected EOF"])), { advance: e.length, node: new N(e[0], o, n) };
|
|
1167
1215
|
if (Ht(o)) return { advance: r + 1, node: new N(e[0], o, n) };
|
|
1168
1216
|
if (tt(o)) {
|
|
1169
|
-
const
|
|
1170
|
-
r +=
|
|
1217
|
+
const a = at(t, e.slice(r));
|
|
1218
|
+
r += a.advance, n.push(...a.nodes);
|
|
1171
1219
|
continue;
|
|
1172
1220
|
}
|
|
1173
1221
|
const i = Ve(t, e.slice(r));
|
|
@@ -1215,12 +1263,12 @@ function Zt(t, e) {
|
|
|
1215
1263
|
if (!i || K(i)) return t.onParseError(new De("Unexpected EOF while consuming a simple block.", e[0][2], e[e.length - 1][3], ["5.4.8. Consume a simple block", "Unexpected EOF"])), { advance: e.length, node: new ue(e[0], i, r) };
|
|
1216
1264
|
if (i[0] === n) return { advance: o + 1, node: new ue(e[0], i, r) };
|
|
1217
1265
|
if (tt(i)) {
|
|
1218
|
-
const u =
|
|
1266
|
+
const u = at(t, e.slice(o));
|
|
1219
1267
|
o += u.advance, r.push(...u.nodes);
|
|
1220
1268
|
continue;
|
|
1221
1269
|
}
|
|
1222
|
-
const
|
|
1223
|
-
o +=
|
|
1270
|
+
const a = Ve(t, e.slice(o));
|
|
1271
|
+
o += a.advance, r.push(a.node);
|
|
1224
1272
|
}
|
|
1225
1273
|
}
|
|
1226
1274
|
class T {
|
|
@@ -1245,7 +1293,7 @@ class T {
|
|
|
1245
1293
|
return !!e && e instanceof T && e.type === $.Whitespace;
|
|
1246
1294
|
}
|
|
1247
1295
|
}
|
|
1248
|
-
function
|
|
1296
|
+
function st(t, e) {
|
|
1249
1297
|
let n = 0;
|
|
1250
1298
|
for (; ; ) {
|
|
1251
1299
|
const r = e[n];
|
|
@@ -1278,11 +1326,11 @@ class ce {
|
|
|
1278
1326
|
function Kt(t, e) {
|
|
1279
1327
|
return { advance: 1, node: new ce(e[0]) };
|
|
1280
1328
|
}
|
|
1281
|
-
function
|
|
1329
|
+
function at(t, e) {
|
|
1282
1330
|
const n = [];
|
|
1283
1331
|
let r = 0;
|
|
1284
1332
|
for (; ; ) if (ze(e[r])) {
|
|
1285
|
-
const o =
|
|
1333
|
+
const o = st(0, e.slice(r));
|
|
1286
1334
|
r += o.advance, n.push(o.node);
|
|
1287
1335
|
} else {
|
|
1288
1336
|
if (!nt(e[r])) return { advance: r, nodes: n };
|
|
@@ -1315,17 +1363,17 @@ function Qt(t, e) {
|
|
|
1315
1363
|
const n = { onParseError: (e == null ? void 0 : e.onParseError) ?? (() => {
|
|
1316
1364
|
}) }, r = [...t];
|
|
1317
1365
|
if (t.length === 0) return [];
|
|
1318
|
-
K(r[r.length - 1]) && r.push([
|
|
1366
|
+
K(r[r.length - 1]) && r.push([s.EOF, "", r[r.length - 1][2], r[r.length - 1][3], void 0]);
|
|
1319
1367
|
const o = [];
|
|
1320
|
-
let i = [],
|
|
1368
|
+
let i = [], a = 0;
|
|
1321
1369
|
for (; ; ) {
|
|
1322
|
-
if (!r[
|
|
1323
|
-
if (
|
|
1324
|
-
o.push(i), i = [],
|
|
1370
|
+
if (!r[a] || K(r[a])) return i.length && o.push(i), o;
|
|
1371
|
+
if (ae(r[a])) {
|
|
1372
|
+
o.push(i), i = [], a++;
|
|
1325
1373
|
continue;
|
|
1326
1374
|
}
|
|
1327
|
-
const u = Ve(n, t.slice(
|
|
1328
|
-
i.push(u.node),
|
|
1375
|
+
const u = Ve(n, t.slice(a));
|
|
1376
|
+
i.push(u.node), a += u.advance;
|
|
1329
1377
|
}
|
|
1330
1378
|
}
|
|
1331
1379
|
function Xt(t, e, n) {
|
|
@@ -1353,7 +1401,7 @@ function en(t, e) {
|
|
|
1353
1401
|
function tn(t) {
|
|
1354
1402
|
return ue.isSimpleBlockNode(t);
|
|
1355
1403
|
}
|
|
1356
|
-
function
|
|
1404
|
+
function de(t) {
|
|
1357
1405
|
return N.isFunctionNode(t);
|
|
1358
1406
|
}
|
|
1359
1407
|
function ut(t) {
|
|
@@ -1372,50 +1420,50 @@ const nn = /[A-Z]/g;
|
|
|
1372
1420
|
function M(t) {
|
|
1373
1421
|
return t.replace(nn, ((e) => String.fromCharCode(e.charCodeAt(0) + 32)));
|
|
1374
1422
|
}
|
|
1375
|
-
const rn = /* @__PURE__ */ new Map([["cm", (t) => t], ["mm", (t) => 10 * t], ["q", (t) => 40 * t], ["in", (t) => t / 2.54], ["pc", (t) => t / 2.54 * 6], ["pt", (t) => t / 2.54 * 72], ["px", (t) => t / 2.54 * 96]]), Ne = /* @__PURE__ */ new Map([["deg", (t) => t], ["grad", (t) => t / 0.9], ["rad", (t) => t / 180 * Math.PI], ["turn", (t) => t / 360]]), me = /* @__PURE__ */ new Map([["deg", (t) => 0.9 * t], ["grad", (t) => t], ["rad", (t) => 0.9 * t / 180 * Math.PI], ["turn", (t) => 0.9 * t / 360]]), on = /* @__PURE__ */ new Map([["hz", (t) => t], ["khz", (t) => t / 1e3]]),
|
|
1423
|
+
const rn = /* @__PURE__ */ new Map([["cm", (t) => t], ["mm", (t) => 10 * t], ["q", (t) => 40 * t], ["in", (t) => t / 2.54], ["pc", (t) => t / 2.54 * 6], ["pt", (t) => t / 2.54 * 72], ["px", (t) => t / 2.54 * 96]]), Ne = /* @__PURE__ */ new Map([["deg", (t) => t], ["grad", (t) => t / 0.9], ["rad", (t) => t / 180 * Math.PI], ["turn", (t) => t / 360]]), me = /* @__PURE__ */ new Map([["deg", (t) => 0.9 * t], ["grad", (t) => t], ["rad", (t) => 0.9 * t / 180 * Math.PI], ["turn", (t) => 0.9 * t / 360]]), on = /* @__PURE__ */ new Map([["hz", (t) => t], ["khz", (t) => t / 1e3]]), sn = /* @__PURE__ */ new Map([["cm", (t) => 2.54 * t], ["mm", (t) => 25.4 * t], ["q", (t) => 25.4 * t * 4], ["in", (t) => t], ["pc", (t) => 6 * t], ["pt", (t) => 72 * t], ["px", (t) => 96 * t]]), an = /* @__PURE__ */ new Map([["hz", (t) => 1e3 * t], ["khz", (t) => t]]), un = /* @__PURE__ */ new Map([["cm", (t) => t / 10], ["mm", (t) => t], ["q", (t) => 4 * t], ["in", (t) => t / 25.4], ["pc", (t) => t / 25.4 * 6], ["pt", (t) => t / 25.4 * 72], ["px", (t) => t / 25.4 * 96]]), cn = /* @__PURE__ */ new Map([["ms", (t) => t], ["s", (t) => t / 1e3]]), ln = /* @__PURE__ */ new Map([["cm", (t) => t / 6 * 2.54], ["mm", (t) => t / 6 * 25.4], ["q", (t) => t / 6 * 25.4 * 4], ["in", (t) => t / 6], ["pc", (t) => t], ["pt", (t) => t / 6 * 72], ["px", (t) => t / 6 * 96]]), pn = /* @__PURE__ */ new Map([["cm", (t) => t / 72 * 2.54], ["mm", (t) => t / 72 * 25.4], ["q", (t) => t / 72 * 25.4 * 4], ["in", (t) => t / 72], ["pc", (t) => t / 72 * 6], ["pt", (t) => t], ["px", (t) => t / 72 * 96]]), dn = /* @__PURE__ */ new Map([["cm", (t) => t / 96 * 2.54], ["mm", (t) => t / 96 * 25.4], ["q", (t) => t / 96 * 25.4 * 4], ["in", (t) => t / 96], ["pc", (t) => t / 96 * 6], ["pt", (t) => t / 96 * 72], ["px", (t) => t]]), fn = /* @__PURE__ */ new Map([["cm", (t) => t / 4 / 10], ["mm", (t) => t / 4], ["q", (t) => t], ["in", (t) => t / 4 / 25.4], ["pc", (t) => t / 4 / 25.4 * 6], ["pt", (t) => t / 4 / 25.4 * 72], ["px", (t) => t / 4 / 25.4 * 96]]), lt = /* @__PURE__ */ new Map([["deg", (t) => 180 * t / Math.PI], ["grad", (t) => 180 * t / Math.PI / 0.9], ["rad", (t) => t], ["turn", (t) => 180 * t / Math.PI / 360]]), gn = /* @__PURE__ */ new Map([["ms", (t) => 1e3 * t], ["s", (t) => t]]), he = /* @__PURE__ */ new Map([["deg", (t) => 360 * t], ["grad", (t) => 360 * t / 0.9], ["rad", (t) => 360 * t / 180 * Math.PI], ["turn", (t) => t]]), vn = /* @__PURE__ */ new Map([["cm", rn], ["mm", un], ["q", fn], ["in", sn], ["pc", ln], ["pt", pn], ["px", dn], ["ms", cn], ["s", gn], ["deg", Ne], ["grad", me], ["rad", lt], ["turn", he], ["hz", on], ["khz", an]]);
|
|
1376
1424
|
function R(t, e) {
|
|
1377
|
-
if (!
|
|
1425
|
+
if (!P(t) || !P(e)) return e;
|
|
1378
1426
|
const n = M(t[4].unit), r = M(e[4].unit);
|
|
1379
1427
|
if (n === r) return e;
|
|
1380
|
-
const o =
|
|
1428
|
+
const o = vn.get(r);
|
|
1381
1429
|
if (!o) return e;
|
|
1382
1430
|
const i = o.get(n);
|
|
1383
1431
|
if (!i) return e;
|
|
1384
|
-
const
|
|
1432
|
+
const a = i(e[4].value), u = [s.Dimension, "", e[2], e[3], { ...e[4], signCharacter: a < 0 ? "-" : void 0, type: Number.isInteger(a) ? p.Integer : p.Number, value: a }];
|
|
1385
1433
|
return $t(u, t[4].unit), u;
|
|
1386
1434
|
}
|
|
1387
1435
|
function mn(t) {
|
|
1388
1436
|
if (t.length !== 2) return -1;
|
|
1389
1437
|
const e = t[0].value;
|
|
1390
1438
|
let n = t[1].value;
|
|
1391
|
-
if (
|
|
1439
|
+
if (v(e) && v(n)) {
|
|
1392
1440
|
const r = e[4].value + n[4].value;
|
|
1393
|
-
return new f([
|
|
1441
|
+
return new f([s.Number, r.toString(), e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number }]);
|
|
1394
1442
|
}
|
|
1395
1443
|
if (b(e) && b(n)) {
|
|
1396
1444
|
const r = e[4].value + n[4].value;
|
|
1397
|
-
return new f([
|
|
1445
|
+
return new f([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1398
1446
|
}
|
|
1399
|
-
if (
|
|
1447
|
+
if (P(e) && P(n) && (n = R(e, n), M(e[4].unit) === M(n[4].unit))) {
|
|
1400
1448
|
const r = e[4].value + n[4].value;
|
|
1401
|
-
return new f([
|
|
1449
|
+
return new f([s.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number, unit: e[4].unit }]);
|
|
1402
1450
|
}
|
|
1403
1451
|
return -1;
|
|
1404
1452
|
}
|
|
1405
1453
|
function hn(t) {
|
|
1406
1454
|
if (t.length !== 2) return -1;
|
|
1407
1455
|
const e = t[0].value, n = t[1].value;
|
|
1408
|
-
if (
|
|
1456
|
+
if (v(e) && v(n)) {
|
|
1409
1457
|
const r = e[4].value / n[4].value;
|
|
1410
|
-
return new f([
|
|
1458
|
+
return new f([s.Number, r.toString(), e[2], n[3], { value: r, type: Number.isInteger(r) ? p.Integer : p.Number }]);
|
|
1411
1459
|
}
|
|
1412
|
-
if (b(e) &&
|
|
1460
|
+
if (b(e) && v(n)) {
|
|
1413
1461
|
const r = e[4].value / n[4].value;
|
|
1414
|
-
return new f([
|
|
1462
|
+
return new f([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1415
1463
|
}
|
|
1416
|
-
if (
|
|
1464
|
+
if (P(e) && v(n)) {
|
|
1417
1465
|
const r = e[4].value / n[4].value;
|
|
1418
|
-
return new f([
|
|
1466
|
+
return new f([s.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: Number.isInteger(r) ? p.Integer : p.Number, unit: e[4].unit }]);
|
|
1419
1467
|
}
|
|
1420
1468
|
return -1;
|
|
1421
1469
|
}
|
|
@@ -1440,25 +1488,25 @@ function w(t) {
|
|
|
1440
1488
|
function Cn(t) {
|
|
1441
1489
|
if (t.length !== 2) return -1;
|
|
1442
1490
|
const e = t[0].value, n = t[1].value;
|
|
1443
|
-
if (
|
|
1491
|
+
if (v(e) && v(n)) {
|
|
1444
1492
|
const r = e[4].value * n[4].value;
|
|
1445
|
-
return new f([
|
|
1493
|
+
return new f([s.Number, r.toString(), e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number }]);
|
|
1446
1494
|
}
|
|
1447
|
-
if (b(e) &&
|
|
1495
|
+
if (b(e) && v(n)) {
|
|
1448
1496
|
const r = e[4].value * n[4].value;
|
|
1449
|
-
return new f([
|
|
1497
|
+
return new f([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1450
1498
|
}
|
|
1451
|
-
if (
|
|
1499
|
+
if (v(e) && b(n)) {
|
|
1452
1500
|
const r = e[4].value * n[4].value;
|
|
1453
|
-
return new f([
|
|
1501
|
+
return new f([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1454
1502
|
}
|
|
1455
|
-
if (
|
|
1503
|
+
if (P(e) && v(n)) {
|
|
1456
1504
|
const r = e[4].value * n[4].value;
|
|
1457
|
-
return new f([
|
|
1505
|
+
return new f([s.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number, unit: e[4].unit }]);
|
|
1458
1506
|
}
|
|
1459
|
-
if (
|
|
1507
|
+
if (v(e) && P(n)) {
|
|
1460
1508
|
const r = e[4].value * n[4].value;
|
|
1461
|
-
return new f([
|
|
1509
|
+
return new f([s.Dimension, r.toString() + n[4].unit, e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number, unit: n[4].unit }]);
|
|
1462
1510
|
}
|
|
1463
1511
|
return -1;
|
|
1464
1512
|
}
|
|
@@ -1467,28 +1515,28 @@ function le(t, e) {
|
|
|
1467
1515
|
const r = t[n];
|
|
1468
1516
|
if (!h(r)) continue;
|
|
1469
1517
|
const o = r.value;
|
|
1470
|
-
if (!
|
|
1518
|
+
if (!ve(o)) continue;
|
|
1471
1519
|
const i = M(o[4].value);
|
|
1472
1520
|
switch (i) {
|
|
1473
1521
|
case "e":
|
|
1474
|
-
t.splice(n, 1, new f([
|
|
1522
|
+
t.splice(n, 1, new f([s.Number, Math.E.toString(), o[2], o[3], { value: Math.E, type: p.Number }]));
|
|
1475
1523
|
break;
|
|
1476
1524
|
case "pi":
|
|
1477
|
-
t.splice(n, 1, new f([
|
|
1525
|
+
t.splice(n, 1, new f([s.Number, Math.PI.toString(), o[2], o[3], { value: Math.PI, type: p.Number }]));
|
|
1478
1526
|
break;
|
|
1479
1527
|
case "infinity":
|
|
1480
|
-
t.splice(n, 1, new f([
|
|
1528
|
+
t.splice(n, 1, new f([s.Number, "infinity", o[2], o[3], { value: 1 / 0, type: p.Number }]));
|
|
1481
1529
|
break;
|
|
1482
1530
|
case "-infinity":
|
|
1483
|
-
t.splice(n, 1, new f([
|
|
1531
|
+
t.splice(n, 1, new f([s.Number, "-infinity", o[2], o[3], { value: -1 / 0, type: p.Number }]));
|
|
1484
1532
|
break;
|
|
1485
1533
|
case "nan":
|
|
1486
|
-
t.splice(n, 1, new f([
|
|
1534
|
+
t.splice(n, 1, new f([s.Number, "NaN", o[2], o[3], { value: Number.NaN, type: p.Number }]));
|
|
1487
1535
|
break;
|
|
1488
1536
|
default:
|
|
1489
1537
|
if (e.has(i)) {
|
|
1490
|
-
const
|
|
1491
|
-
t.splice(n, 1, new f(
|
|
1538
|
+
const a = e.get(i);
|
|
1539
|
+
t.splice(n, 1, new f(a));
|
|
1492
1540
|
}
|
|
1493
1541
|
}
|
|
1494
1542
|
}
|
|
@@ -1500,41 +1548,41 @@ function we(t) {
|
|
|
1500
1548
|
return D(e) ? t[0] : -1;
|
|
1501
1549
|
}
|
|
1502
1550
|
function I(t, e, n) {
|
|
1503
|
-
return
|
|
1551
|
+
return P(e) ? Ce(t, e[4].unit, n) : b(e) ? yn(t, n) : v(e) ? j(t, n) : -1;
|
|
1504
1552
|
}
|
|
1505
1553
|
function Ce(t, e, n) {
|
|
1506
1554
|
const r = t.tokens();
|
|
1507
|
-
return { inputs: [new f([
|
|
1555
|
+
return { inputs: [new f([s.Dimension, n.toString() + e, r[0][2], r[r.length - 1][3], { value: n, type: Number.isInteger(n) ? p.Integer : p.Number, unit: e }])], operation: we };
|
|
1508
1556
|
}
|
|
1509
1557
|
function yn(t, e) {
|
|
1510
1558
|
const n = t.tokens();
|
|
1511
|
-
return { inputs: [new f([
|
|
1559
|
+
return { inputs: [new f([s.Percentage, e.toString() + "%", n[0][2], n[n.length - 1][3], { value: e }])], operation: we };
|
|
1512
1560
|
}
|
|
1513
1561
|
function j(t, e) {
|
|
1514
1562
|
const n = t.tokens();
|
|
1515
|
-
return { inputs: [new f([
|
|
1563
|
+
return { inputs: [new f([s.Number, e.toString(), n[0][2], n[n.length - 1][3], { value: e, type: Number.isInteger(e) ? p.Integer : p.Number }])], operation: we };
|
|
1516
1564
|
}
|
|
1517
|
-
function
|
|
1565
|
+
function kn(t, e) {
|
|
1518
1566
|
const n = e.value;
|
|
1519
|
-
return
|
|
1567
|
+
return v(n) ? Ce(t, "rad", Math.acos(n[4].value)) : -1;
|
|
1520
1568
|
}
|
|
1521
|
-
function
|
|
1569
|
+
function En(t, e) {
|
|
1522
1570
|
const n = e.value;
|
|
1523
|
-
return
|
|
1571
|
+
return v(n) ? Ce(t, "rad", Math.asin(n[4].value)) : -1;
|
|
1524
1572
|
}
|
|
1525
|
-
function
|
|
1573
|
+
function Pn(t, e) {
|
|
1526
1574
|
const n = e.value;
|
|
1527
|
-
return
|
|
1575
|
+
return v(n) ? Ce(t, "rad", Math.atan(n[4].value)) : -1;
|
|
1528
1576
|
}
|
|
1529
1577
|
function Ie(t) {
|
|
1530
|
-
return
|
|
1578
|
+
return P(t) || v(t);
|
|
1531
1579
|
}
|
|
1532
1580
|
function je(t) {
|
|
1533
1581
|
if (t.length === 0) return !0;
|
|
1534
1582
|
const e = t[0];
|
|
1535
1583
|
if (!D(e)) return !1;
|
|
1536
1584
|
if (t.length === 1) return !0;
|
|
1537
|
-
if (
|
|
1585
|
+
if (P(e)) {
|
|
1538
1586
|
const n = M(e[4].unit);
|
|
1539
1587
|
for (let r = 1; r < t.length; r++) {
|
|
1540
1588
|
const o = t[r];
|
|
@@ -1549,7 +1597,7 @@ function je(t) {
|
|
|
1549
1597
|
return !0;
|
|
1550
1598
|
}
|
|
1551
1599
|
function J(t, e) {
|
|
1552
|
-
return !!D(t) && (
|
|
1600
|
+
return !!D(t) && (P(t) ? t[0] === e[0] && M(t[4].unit) === M(e[4].unit) : t[0] === e[0]);
|
|
1553
1601
|
}
|
|
1554
1602
|
function bn(t, e, n) {
|
|
1555
1603
|
const r = e.value;
|
|
@@ -1565,16 +1613,16 @@ function An(t, e, n, r, o) {
|
|
|
1565
1613
|
if (!h(e) || !h(n) || !h(r)) return -1;
|
|
1566
1614
|
const i = e.value;
|
|
1567
1615
|
if (!D(i) || !o.rawPercentages && b(i)) return -1;
|
|
1568
|
-
const
|
|
1569
|
-
if (!J(i,
|
|
1616
|
+
const a = R(i, n.value);
|
|
1617
|
+
if (!J(i, a)) return -1;
|
|
1570
1618
|
const u = R(i, r.value);
|
|
1571
|
-
return J(i, u) ? I(t, i, Math.max(i[4].value, Math.min(
|
|
1619
|
+
return J(i, u) ? I(t, i, Math.max(i[4].value, Math.min(a[4].value, u[4].value))) : -1;
|
|
1572
1620
|
}
|
|
1573
1621
|
function Dn(t, e) {
|
|
1574
1622
|
const n = e.value;
|
|
1575
1623
|
if (!Ie(n)) return -1;
|
|
1576
1624
|
let r = n[4].value;
|
|
1577
|
-
if (
|
|
1625
|
+
if (P(n)) switch (n[4].unit.toLowerCase()) {
|
|
1578
1626
|
case "rad":
|
|
1579
1627
|
break;
|
|
1580
1628
|
case "deg":
|
|
@@ -1593,7 +1641,7 @@ function Dn(t, e) {
|
|
|
1593
1641
|
}
|
|
1594
1642
|
function Bn(t, e) {
|
|
1595
1643
|
const n = e.value;
|
|
1596
|
-
return
|
|
1644
|
+
return v(n) ? j(t, Math.exp(n[4].value)) : -1;
|
|
1597
1645
|
}
|
|
1598
1646
|
function Fn(t, e, n) {
|
|
1599
1647
|
if (!e.every(h)) return -1;
|
|
@@ -1601,8 +1649,8 @@ function Fn(t, e, n) {
|
|
|
1601
1649
|
if (!D(r) || !n.rawPercentages && b(r)) return -1;
|
|
1602
1650
|
const o = e.map(((u) => R(r, u.value)));
|
|
1603
1651
|
if (!je(o)) return -1;
|
|
1604
|
-
const i = o.map(((u) => u[4].value)),
|
|
1605
|
-
return I(t, r,
|
|
1652
|
+
const i = o.map(((u) => u[4].value)), a = Math.hypot(...i);
|
|
1653
|
+
return I(t, r, a);
|
|
1606
1654
|
}
|
|
1607
1655
|
function Ke(t, e, n) {
|
|
1608
1656
|
if (!e.every(h)) return -1;
|
|
@@ -1610,8 +1658,8 @@ function Ke(t, e, n) {
|
|
|
1610
1658
|
if (!D(r) || !n.rawPercentages && b(r)) return -1;
|
|
1611
1659
|
const o = e.map(((u) => R(r, u.value)));
|
|
1612
1660
|
if (!je(o)) return -1;
|
|
1613
|
-
const i = o.map(((u) => u[4].value)),
|
|
1614
|
-
return I(t, r,
|
|
1661
|
+
const i = o.map(((u) => u[4].value)), a = Math.max(...i);
|
|
1662
|
+
return I(t, r, a);
|
|
1615
1663
|
}
|
|
1616
1664
|
function Qe(t, e, n) {
|
|
1617
1665
|
if (!e.every(h)) return -1;
|
|
@@ -1619,8 +1667,8 @@ function Qe(t, e, n) {
|
|
|
1619
1667
|
if (!D(r) || !n.rawPercentages && b(r)) return -1;
|
|
1620
1668
|
const o = e.map(((u) => R(r, u.value)));
|
|
1621
1669
|
if (!je(o)) return -1;
|
|
1622
|
-
const i = o.map(((u) => u[4].value)),
|
|
1623
|
-
return I(t, r,
|
|
1670
|
+
const i = o.map(((u) => u[4].value)), a = Math.min(...i);
|
|
1671
|
+
return I(t, r, a);
|
|
1624
1672
|
}
|
|
1625
1673
|
function Nn(t, e, n) {
|
|
1626
1674
|
const r = e.value;
|
|
@@ -1632,7 +1680,7 @@ function Nn(t, e, n) {
|
|
|
1632
1680
|
}
|
|
1633
1681
|
function wn(t, e, n) {
|
|
1634
1682
|
const r = e.value, o = n.value;
|
|
1635
|
-
return !
|
|
1683
|
+
return !v(r) || !J(r, o) ? -1 : j(t, Math.pow(r[4].value, o[4].value));
|
|
1636
1684
|
}
|
|
1637
1685
|
function In(t, e, n) {
|
|
1638
1686
|
const r = e.value;
|
|
@@ -1645,12 +1693,12 @@ function In(t, e, n) {
|
|
|
1645
1693
|
function xn(t, e, n, r, o) {
|
|
1646
1694
|
const i = n.value;
|
|
1647
1695
|
if (!D(i) || !o.rawPercentages && b(i)) return -1;
|
|
1648
|
-
const
|
|
1649
|
-
if (!J(i,
|
|
1696
|
+
const a = R(i, r.value);
|
|
1697
|
+
if (!J(i, a)) return -1;
|
|
1650
1698
|
let u;
|
|
1651
|
-
if (
|
|
1652
|
-
else if (Number.isFinite(i[4].value) || Number.isFinite(
|
|
1653
|
-
else if (Number.isFinite(i[4].value) && !Number.isFinite(
|
|
1699
|
+
if (a[4].value === 0) u = Number.NaN;
|
|
1700
|
+
else if (Number.isFinite(i[4].value) || Number.isFinite(a[4].value)) if (!Number.isFinite(i[4].value) && Number.isFinite(a[4].value)) u = i[4].value;
|
|
1701
|
+
else if (Number.isFinite(i[4].value) && !Number.isFinite(a[4].value)) switch (e) {
|
|
1654
1702
|
case "down":
|
|
1655
1703
|
u = i[4].value < 0 ? -1 / 0 : Object.is(-0, 0 * i[4].value) ? -0 : 0;
|
|
1656
1704
|
break;
|
|
@@ -1660,24 +1708,24 @@ function xn(t, e, n, r, o) {
|
|
|
1660
1708
|
default:
|
|
1661
1709
|
u = Object.is(0, 0 * i[4].value) ? 0 : -0;
|
|
1662
1710
|
}
|
|
1663
|
-
else if (Number.isFinite(
|
|
1711
|
+
else if (Number.isFinite(a[4].value)) switch (e) {
|
|
1664
1712
|
case "down":
|
|
1665
|
-
u = Math.floor(i[4].value /
|
|
1713
|
+
u = Math.floor(i[4].value / a[4].value) * a[4].value;
|
|
1666
1714
|
break;
|
|
1667
1715
|
case "up":
|
|
1668
|
-
u = Math.ceil(i[4].value /
|
|
1716
|
+
u = Math.ceil(i[4].value / a[4].value) * a[4].value;
|
|
1669
1717
|
break;
|
|
1670
1718
|
case "to-zero":
|
|
1671
|
-
u = Math.trunc(i[4].value /
|
|
1719
|
+
u = Math.trunc(i[4].value / a[4].value) * a[4].value;
|
|
1672
1720
|
break;
|
|
1673
1721
|
default: {
|
|
1674
|
-
let c = Math.floor(i[4].value /
|
|
1675
|
-
if (c >
|
|
1722
|
+
let c = Math.floor(i[4].value / a[4].value) * a[4].value, d = Math.ceil(i[4].value / a[4].value) * a[4].value;
|
|
1723
|
+
if (c > d) {
|
|
1676
1724
|
const y = c;
|
|
1677
|
-
c =
|
|
1725
|
+
c = d, d = y;
|
|
1678
1726
|
}
|
|
1679
|
-
const l = Math.abs(i[4].value - c),
|
|
1680
|
-
u = l ===
|
|
1727
|
+
const l = Math.abs(i[4].value - c), g = Math.abs(i[4].value - d);
|
|
1728
|
+
u = l === g ? d : l < g ? c : d;
|
|
1681
1729
|
break;
|
|
1682
1730
|
}
|
|
1683
1731
|
}
|
|
@@ -1693,7 +1741,7 @@ function Tn(t, e) {
|
|
|
1693
1741
|
const n = e.value;
|
|
1694
1742
|
if (!Ie(n)) return -1;
|
|
1695
1743
|
let r = n[4].value;
|
|
1696
|
-
if (
|
|
1744
|
+
if (P(n)) switch (M(n[4].unit)) {
|
|
1697
1745
|
case "rad":
|
|
1698
1746
|
break;
|
|
1699
1747
|
case "deg":
|
|
@@ -1712,14 +1760,14 @@ function Tn(t, e) {
|
|
|
1712
1760
|
}
|
|
1713
1761
|
function Mn(t, e) {
|
|
1714
1762
|
const n = e.value;
|
|
1715
|
-
return
|
|
1763
|
+
return v(n) ? j(t, Math.sqrt(n[4].value)) : -1;
|
|
1716
1764
|
}
|
|
1717
1765
|
function Rn(t, e) {
|
|
1718
1766
|
const n = e.value;
|
|
1719
1767
|
if (!Ie(n)) return -1;
|
|
1720
1768
|
const r = n[4].value;
|
|
1721
1769
|
let o = 0, i = n[4].value;
|
|
1722
|
-
if (
|
|
1770
|
+
if (P(n)) switch (M(n[4].unit)) {
|
|
1723
1771
|
case "rad":
|
|
1724
1772
|
o = lt.get("deg")(r);
|
|
1725
1773
|
break;
|
|
@@ -1735,24 +1783,24 @@ function Rn(t, e) {
|
|
|
1735
1783
|
default:
|
|
1736
1784
|
return -1;
|
|
1737
1785
|
}
|
|
1738
|
-
const
|
|
1739
|
-
return i = o % 90 == 0 &&
|
|
1786
|
+
const a = o / 90;
|
|
1787
|
+
return i = o % 90 == 0 && a % 2 != 0 ? a > 0 ? 1 / 0 : -1 / 0 : Math.tan(i), j(t, i);
|
|
1740
1788
|
}
|
|
1741
1789
|
function Un(t) {
|
|
1742
1790
|
if (t.length !== 2) return -1;
|
|
1743
1791
|
const e = t[0].value;
|
|
1744
1792
|
let n = t[1].value;
|
|
1745
|
-
if (
|
|
1793
|
+
if (v(e) && v(n)) {
|
|
1746
1794
|
const r = e[4].value - n[4].value;
|
|
1747
|
-
return new f([
|
|
1795
|
+
return new f([s.Number, r.toString(), e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number }]);
|
|
1748
1796
|
}
|
|
1749
1797
|
if (b(e) && b(n)) {
|
|
1750
1798
|
const r = e[4].value - n[4].value;
|
|
1751
|
-
return new f([
|
|
1799
|
+
return new f([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1752
1800
|
}
|
|
1753
|
-
if (
|
|
1801
|
+
if (P(e) && P(n) && (n = R(e, n), M(e[4].unit) === M(n[4].unit))) {
|
|
1754
1802
|
const r = e[4].value - n[4].value;
|
|
1755
|
-
return new f([
|
|
1803
|
+
return new f([s.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: e[4].type === p.Integer && n[4].type === p.Integer ? p.Integer : p.Number, unit: e[4].unit }]);
|
|
1756
1804
|
}
|
|
1757
1805
|
return -1;
|
|
1758
1806
|
}
|
|
@@ -1761,17 +1809,17 @@ function Wn(t, e) {
|
|
|
1761
1809
|
const n = e[0];
|
|
1762
1810
|
if (!n || !h(n)) return -1;
|
|
1763
1811
|
const r = n.value;
|
|
1764
|
-
return
|
|
1812
|
+
return v(r) ? j(t, Math.log(r[4].value)) : -1;
|
|
1765
1813
|
}
|
|
1766
1814
|
if (e.length === 2) {
|
|
1767
1815
|
const n = e[0];
|
|
1768
1816
|
if (!n || !h(n)) return -1;
|
|
1769
1817
|
const r = n.value;
|
|
1770
|
-
if (!
|
|
1818
|
+
if (!v(r)) return -1;
|
|
1771
1819
|
const o = e[1];
|
|
1772
1820
|
if (!o || !h(o)) return -1;
|
|
1773
1821
|
const i = o.value;
|
|
1774
|
-
return
|
|
1822
|
+
return v(i) ? j(t, Math.log(r[4].value) / Math.log(i[4].value)) : -1;
|
|
1775
1823
|
}
|
|
1776
1824
|
return -1;
|
|
1777
1825
|
}
|
|
@@ -1783,40 +1831,40 @@ function $e(t) {
|
|
|
1783
1831
|
}
|
|
1784
1832
|
if (!h(t)) return !1;
|
|
1785
1833
|
const e = t.value;
|
|
1786
|
-
return !!
|
|
1834
|
+
return !!ve(e) && Ln.test(e[4].value);
|
|
1787
1835
|
}
|
|
1788
1836
|
const $n = String.fromCodePoint(0);
|
|
1789
1837
|
function qn(t, e, n, r, o, i) {
|
|
1790
|
-
var
|
|
1838
|
+
var k;
|
|
1791
1839
|
if (e.fixed === -1 && !i.randomCaching) return -1;
|
|
1792
1840
|
i.randomCaching || (i.randomCaching = { propertyName: "", propertyN: 0, elementID: "", documentID: "" }), i.randomCaching && !i.randomCaching.propertyN && (i.randomCaching.propertyN = 0);
|
|
1793
|
-
const
|
|
1794
|
-
if (!D(
|
|
1795
|
-
const u = R(
|
|
1796
|
-
if (!J(
|
|
1841
|
+
const a = n.value;
|
|
1842
|
+
if (!D(a)) return -1;
|
|
1843
|
+
const u = R(a, r.value);
|
|
1844
|
+
if (!J(a, u)) return -1;
|
|
1797
1845
|
let c = null;
|
|
1798
|
-
if (o && (c = R(
|
|
1799
|
-
if (!Number.isFinite(
|
|
1800
|
-
if (c && !Number.isFinite(c[4].value)) return I(t,
|
|
1801
|
-
const
|
|
1802
|
-
let l =
|
|
1803
|
-
if (l >
|
|
1804
|
-
const
|
|
1846
|
+
if (o && (c = R(a, o.value), !J(a, c))) return -1;
|
|
1847
|
+
if (!Number.isFinite(a[4].value) || !Number.isFinite(u[4].value) || !Number.isFinite(u[4].value - a[4].value)) return I(t, a, Number.NaN);
|
|
1848
|
+
if (c && !Number.isFinite(c[4].value)) return I(t, a, a[4].value);
|
|
1849
|
+
const d = e.fixed === -1 ? zn(Vn([e.dashedIdent ? e.dashedIdent : `${(k = i.randomCaching) == null ? void 0 : k.propertyName} ${i.randomCaching.propertyN++}`, e.elementShared ? "" : i.randomCaching.elementID, i.randomCaching.documentID].join($n))) : () => e.fixed;
|
|
1850
|
+
let l = a[4].value, g = u[4].value;
|
|
1851
|
+
if (l > g && ([l, g] = [g, l]), c && (c[4].value <= 0 || Math.abs(l - g) / c[4].value > 1e10) && (c = null), c) {
|
|
1852
|
+
const E = Math.max(c[4].value / 1e3, 1e-9), m = [l];
|
|
1805
1853
|
let z = 0;
|
|
1806
1854
|
for (; ; ) {
|
|
1807
1855
|
z += c[4].value;
|
|
1808
1856
|
const x = l + z;
|
|
1809
|
-
if (!(x +
|
|
1810
|
-
m.push(
|
|
1857
|
+
if (!(x + E < g)) {
|
|
1858
|
+
m.push(g);
|
|
1811
1859
|
break;
|
|
1812
1860
|
}
|
|
1813
|
-
if (m.push(x), x + c[4].value -
|
|
1861
|
+
if (m.push(x), x + c[4].value - E > g) break;
|
|
1814
1862
|
}
|
|
1815
|
-
const U =
|
|
1816
|
-
return I(t,
|
|
1863
|
+
const U = d();
|
|
1864
|
+
return I(t, a, Number(m[Math.floor(m.length * U)].toFixed(5)));
|
|
1817
1865
|
}
|
|
1818
|
-
const y =
|
|
1819
|
-
return I(t,
|
|
1866
|
+
const y = d();
|
|
1867
|
+
return I(t, a, Number((y * (g - l) + l).toFixed(5)));
|
|
1820
1868
|
}
|
|
1821
1869
|
function zn(t = 0.34944106645296036, e = 0.19228640875738723, n = 0.8784393832007205, r = 0.04850964319275053) {
|
|
1822
1870
|
return () => {
|
|
@@ -1833,27 +1881,27 @@ function Vn(t) {
|
|
|
1833
1881
|
const He = /* @__PURE__ */ new Map([["abs", function(e, n, r) {
|
|
1834
1882
|
return V(e, n, r, Sn);
|
|
1835
1883
|
}], ["acos", function(e, n, r) {
|
|
1836
|
-
return V(e, n, r,
|
|
1884
|
+
return V(e, n, r, kn);
|
|
1837
1885
|
}], ["asin", function(e, n, r) {
|
|
1838
|
-
return V(e, n, r,
|
|
1886
|
+
return V(e, n, r, En);
|
|
1839
1887
|
}], ["atan", function(e, n, r) {
|
|
1840
|
-
return V(e, n, r,
|
|
1888
|
+
return V(e, n, r, Pn);
|
|
1841
1889
|
}], ["atan2", function(e, n, r) {
|
|
1842
|
-
return
|
|
1890
|
+
return ke(e, n, r, bn);
|
|
1843
1891
|
}], ["calc", F], ["clamp", function(e, n, r) {
|
|
1844
|
-
const o = le([...e.value.filter(((m) => !_(m)))], n), i = [],
|
|
1892
|
+
const o = le([...e.value.filter(((m) => !_(m)))], n), i = [], a = [], u = [];
|
|
1845
1893
|
{
|
|
1846
1894
|
let m = i;
|
|
1847
1895
|
for (let z = 0; z < o.length; z++) {
|
|
1848
1896
|
const U = o[z];
|
|
1849
|
-
if (h(U) &&
|
|
1897
|
+
if (h(U) && ae(U.value)) {
|
|
1850
1898
|
if (m === u) return -1;
|
|
1851
|
-
if (m ===
|
|
1899
|
+
if (m === a) {
|
|
1852
1900
|
m = u;
|
|
1853
1901
|
continue;
|
|
1854
1902
|
}
|
|
1855
1903
|
if (m === i) {
|
|
1856
|
-
m =
|
|
1904
|
+
m = a;
|
|
1857
1905
|
continue;
|
|
1858
1906
|
}
|
|
1859
1907
|
return -1;
|
|
@@ -1861,80 +1909,80 @@ const He = /* @__PURE__ */ new Map([["abs", function(e, n, r) {
|
|
|
1861
1909
|
m.push(U);
|
|
1862
1910
|
}
|
|
1863
1911
|
}
|
|
1864
|
-
const c = $e(i),
|
|
1865
|
-
if (c &&
|
|
1866
|
-
const l = w(F(O(
|
|
1912
|
+
const c = $e(i), d = $e(u);
|
|
1913
|
+
if (c && d) return F(O(a), n, r);
|
|
1914
|
+
const l = w(F(O(a), n, r));
|
|
1867
1915
|
if (l === -1) return -1;
|
|
1868
1916
|
if (c) {
|
|
1869
1917
|
const m = w(F(O(u), n, r));
|
|
1870
|
-
return m === -1 ? -1 : Qe((
|
|
1918
|
+
return m === -1 ? -1 : Qe((g = l, y = m, new N([s.Function, "min(", -1, -1, { value: "min" }], [s.CloseParen, ")", -1, -1, void 0], [g, new f([s.Comma, ",", -1, -1, void 0]), y])), [l, m], r);
|
|
1871
1919
|
}
|
|
1872
|
-
if (
|
|
1920
|
+
if (d) {
|
|
1873
1921
|
const m = w(F(O(i), n, r));
|
|
1874
1922
|
return m === -1 ? -1 : Ke(Yn(m, l), [m, l], r);
|
|
1875
1923
|
}
|
|
1876
|
-
var
|
|
1877
|
-
const
|
|
1878
|
-
if (
|
|
1879
|
-
const
|
|
1880
|
-
return
|
|
1924
|
+
var g, y;
|
|
1925
|
+
const k = w(F(O(i), n, r));
|
|
1926
|
+
if (k === -1) return -1;
|
|
1927
|
+
const E = w(F(O(u), n, r));
|
|
1928
|
+
return E === -1 ? -1 : An(e, k, l, E, r);
|
|
1881
1929
|
}], ["cos", function(e, n, r) {
|
|
1882
1930
|
return V(e, n, r, Dn);
|
|
1883
1931
|
}], ["exp", function(e, n, r) {
|
|
1884
1932
|
return V(e, n, r, Bn);
|
|
1885
1933
|
}], ["hypot", function(e, n, r) {
|
|
1886
|
-
return
|
|
1934
|
+
return Ee(e, e.value, n, r, Fn);
|
|
1887
1935
|
}], ["log", function(e, n, r) {
|
|
1888
|
-
return
|
|
1936
|
+
return Ee(e, e.value, n, r, Wn);
|
|
1889
1937
|
}], ["max", function(e, n, r) {
|
|
1890
|
-
return
|
|
1938
|
+
return Ee(e, e.value, n, r, Ke);
|
|
1891
1939
|
}], ["min", function(e, n, r) {
|
|
1892
|
-
return
|
|
1940
|
+
return Ee(e, e.value, n, r, Qe);
|
|
1893
1941
|
}], ["mod", function(e, n, r) {
|
|
1894
|
-
return
|
|
1942
|
+
return ke(e, n, r, Nn);
|
|
1895
1943
|
}], ["pow", function(e, n, r) {
|
|
1896
|
-
return
|
|
1944
|
+
return ke(e, n, r, wn);
|
|
1897
1945
|
}], ["random", function(e, n, r) {
|
|
1898
|
-
const o = Jn(e.value.filter(((
|
|
1946
|
+
const o = Jn(e.value.filter(((g) => !_(g))), n, r);
|
|
1899
1947
|
if (o === -1) return -1;
|
|
1900
|
-
const [i,
|
|
1948
|
+
const [i, a] = o, u = pt(a, n, r);
|
|
1901
1949
|
if (u === -1) return -1;
|
|
1902
|
-
const [c,
|
|
1903
|
-
return !c || !
|
|
1950
|
+
const [c, d, l] = u;
|
|
1951
|
+
return !c || !d ? -1 : qn(e, i, c, d, l, r);
|
|
1904
1952
|
}], ["rem", function(e, n, r) {
|
|
1905
|
-
return
|
|
1953
|
+
return ke(e, n, r, In);
|
|
1906
1954
|
}], ["round", function(e, n, r) {
|
|
1907
|
-
const o = le([...e.value.filter(((
|
|
1908
|
-
let i = "",
|
|
1955
|
+
const o = le([...e.value.filter(((g) => !_(g)))], n);
|
|
1956
|
+
let i = "", a = !1;
|
|
1909
1957
|
const u = [], c = [];
|
|
1910
1958
|
{
|
|
1911
|
-
let
|
|
1959
|
+
let g = u;
|
|
1912
1960
|
for (let y = 0; y < o.length; y++) {
|
|
1913
|
-
const
|
|
1914
|
-
if (!i && u.length === 0 && c.length === 0 && h(
|
|
1915
|
-
const
|
|
1916
|
-
if (Gn.has(
|
|
1917
|
-
i =
|
|
1961
|
+
const k = o[y];
|
|
1962
|
+
if (!i && u.length === 0 && c.length === 0 && h(k) && ve(k.value)) {
|
|
1963
|
+
const E = k.value[4].value.toLowerCase();
|
|
1964
|
+
if (Gn.has(E)) {
|
|
1965
|
+
i = E;
|
|
1918
1966
|
continue;
|
|
1919
1967
|
}
|
|
1920
1968
|
}
|
|
1921
|
-
if (h(
|
|
1922
|
-
if (
|
|
1923
|
-
if (
|
|
1924
|
-
if (
|
|
1925
|
-
|
|
1969
|
+
if (h(k) && ae(k.value)) {
|
|
1970
|
+
if (g === c) return -1;
|
|
1971
|
+
if (g === u && i && u.length === 0) continue;
|
|
1972
|
+
if (g === u) {
|
|
1973
|
+
a = !0, g = c;
|
|
1926
1974
|
continue;
|
|
1927
1975
|
}
|
|
1928
1976
|
return -1;
|
|
1929
1977
|
}
|
|
1930
|
-
|
|
1978
|
+
g.push(k);
|
|
1931
1979
|
}
|
|
1932
1980
|
}
|
|
1933
|
-
const
|
|
1934
|
-
if (
|
|
1935
|
-
|
|
1981
|
+
const d = w(F(O(u), n, r));
|
|
1982
|
+
if (d === -1) return -1;
|
|
1983
|
+
a || c.length !== 0 || c.push(new f([s.Number, "1", -1, -1, { value: 1, type: p.Integer }]));
|
|
1936
1984
|
const l = w(F(O(c), n, r));
|
|
1937
|
-
return l === -1 ? -1 : (i || (i = "nearest"), xn(e, i,
|
|
1985
|
+
return l === -1 ? -1 : (i || (i = "nearest"), xn(e, i, d, l, r));
|
|
1938
1986
|
}], ["sign", function(e, n, r) {
|
|
1939
1987
|
return V(e, n, r, On);
|
|
1940
1988
|
}], ["sin", function(e, n, r) {
|
|
@@ -1951,13 +1999,13 @@ function F(t, e, n) {
|
|
|
1951
1999
|
for (; o < r.length; ) {
|
|
1952
2000
|
const i = r[o];
|
|
1953
2001
|
if (tn(i) && rt(i.startToken)) {
|
|
1954
|
-
const
|
|
1955
|
-
if (
|
|
1956
|
-
r.splice(o, 1,
|
|
1957
|
-
} else if (
|
|
1958
|
-
const
|
|
1959
|
-
if (!
|
|
1960
|
-
const u =
|
|
2002
|
+
const a = F(i, e, n);
|
|
2003
|
+
if (a === -1) return -1;
|
|
2004
|
+
r.splice(o, 1, a);
|
|
2005
|
+
} else if (de(i)) {
|
|
2006
|
+
const a = He.get(i.getName().toLowerCase());
|
|
2007
|
+
if (!a) return -1;
|
|
2008
|
+
const u = a(i, e, n);
|
|
1961
2009
|
if (u === -1) return -1;
|
|
1962
2010
|
r.splice(o, 1, u);
|
|
1963
2011
|
} else o++;
|
|
@@ -1969,12 +2017,12 @@ function F(t, e, n) {
|
|
|
1969
2017
|
o++;
|
|
1970
2018
|
continue;
|
|
1971
2019
|
}
|
|
1972
|
-
const
|
|
1973
|
-
if (!
|
|
2020
|
+
const a = r[o + 1];
|
|
2021
|
+
if (!a || !h(a)) {
|
|
1974
2022
|
o++;
|
|
1975
2023
|
continue;
|
|
1976
2024
|
}
|
|
1977
|
-
const u =
|
|
2025
|
+
const u = a.value;
|
|
1978
2026
|
if (!Ze(u) || u[4].value !== "*" && u[4].value !== "/") {
|
|
1979
2027
|
o++;
|
|
1980
2028
|
continue;
|
|
@@ -1990,12 +2038,12 @@ function F(t, e, n) {
|
|
|
1990
2038
|
o++;
|
|
1991
2039
|
continue;
|
|
1992
2040
|
}
|
|
1993
|
-
const
|
|
1994
|
-
if (!
|
|
2041
|
+
const a = r[o + 1];
|
|
2042
|
+
if (!a || !h(a)) {
|
|
1995
2043
|
o++;
|
|
1996
2044
|
continue;
|
|
1997
2045
|
}
|
|
1998
|
-
const u =
|
|
2046
|
+
const u = a.value;
|
|
1999
2047
|
if (!Ze(u) || u[4].value !== "+" && u[4].value !== "-") {
|
|
2000
2048
|
o++;
|
|
2001
2049
|
continue;
|
|
@@ -2014,19 +2062,19 @@ function jn(t, e, n) {
|
|
|
2014
2062
|
const r = w(F(O(le([...t.filter(((o) => !_(o)))], e)), e, n));
|
|
2015
2063
|
return r === -1 ? -1 : r;
|
|
2016
2064
|
}
|
|
2017
|
-
function
|
|
2065
|
+
function ke(t, e, n, r) {
|
|
2018
2066
|
const o = Hn(t.value, e, n);
|
|
2019
2067
|
if (o === -1) return -1;
|
|
2020
|
-
const [i,
|
|
2021
|
-
return r(t, i,
|
|
2068
|
+
const [i, a] = o;
|
|
2069
|
+
return r(t, i, a, n);
|
|
2022
2070
|
}
|
|
2023
2071
|
function Hn(t, e, n) {
|
|
2024
2072
|
const r = le([...t.filter(((c) => !_(c)))], e), o = [], i = [];
|
|
2025
2073
|
{
|
|
2026
2074
|
let c = o;
|
|
2027
|
-
for (let
|
|
2028
|
-
const l = r[
|
|
2029
|
-
if (h(l) &&
|
|
2075
|
+
for (let d = 0; d < r.length; d++) {
|
|
2076
|
+
const l = r[d];
|
|
2077
|
+
if (h(l) && ae(l.value)) {
|
|
2030
2078
|
if (c === i) return -1;
|
|
2031
2079
|
if (c === o) {
|
|
2032
2080
|
c = i;
|
|
@@ -2037,25 +2085,25 @@ function Hn(t, e, n) {
|
|
|
2037
2085
|
c.push(l);
|
|
2038
2086
|
}
|
|
2039
2087
|
}
|
|
2040
|
-
const
|
|
2041
|
-
if (
|
|
2088
|
+
const a = w(F(O(o), e, n));
|
|
2089
|
+
if (a === -1) return -1;
|
|
2042
2090
|
const u = w(F(O(i), e, n));
|
|
2043
|
-
return u === -1 ? -1 : [
|
|
2091
|
+
return u === -1 ? -1 : [a, u];
|
|
2044
2092
|
}
|
|
2045
|
-
function
|
|
2046
|
-
const i =
|
|
2093
|
+
function Ee(t, e, n, r, o) {
|
|
2094
|
+
const i = pt(t.value, n, r);
|
|
2047
2095
|
return i === -1 ? -1 : o(t, i, r);
|
|
2048
2096
|
}
|
|
2049
|
-
function
|
|
2097
|
+
function pt(t, e, n) {
|
|
2050
2098
|
const r = le([...t.filter(((i) => !_(i)))], e), o = [];
|
|
2051
2099
|
{
|
|
2052
2100
|
const i = [];
|
|
2053
|
-
let
|
|
2101
|
+
let a = [];
|
|
2054
2102
|
for (let u = 0; u < r.length; u++) {
|
|
2055
2103
|
const c = r[u];
|
|
2056
|
-
h(c) &&
|
|
2104
|
+
h(c) && ae(c.value) ? (i.push(a), a = []) : a.push(c);
|
|
2057
2105
|
}
|
|
2058
|
-
i.push(
|
|
2106
|
+
i.push(a);
|
|
2059
2107
|
for (let u = 0; u < i.length; u++) {
|
|
2060
2108
|
if (i[u].length === 0) return -1;
|
|
2061
2109
|
const c = w(F(O(i[u]), e, n));
|
|
@@ -2068,13 +2116,13 @@ function dt(t, e, n) {
|
|
|
2068
2116
|
const Gn = /* @__PURE__ */ new Set(["nearest", "up", "down", "to-zero"]);
|
|
2069
2117
|
function Jn(t, e, n) {
|
|
2070
2118
|
const r = { isAuto: !1, dashedIdent: "", fixed: -1, elementShared: !1 }, o = t[0];
|
|
2071
|
-
if (!h(o) || !
|
|
2119
|
+
if (!h(o) || !ve(o.value)) return [r, t];
|
|
2072
2120
|
for (let i = 0; i < t.length; i++) {
|
|
2073
|
-
const
|
|
2074
|
-
if (!h(
|
|
2075
|
-
if (
|
|
2076
|
-
if (!
|
|
2077
|
-
const u =
|
|
2121
|
+
const a = t[i];
|
|
2122
|
+
if (!h(a)) return -1;
|
|
2123
|
+
if (ae(a.value)) return [r, t.slice(i + 1)];
|
|
2124
|
+
if (!ve(a.value)) return -1;
|
|
2125
|
+
const u = a.value[4].value.toLowerCase();
|
|
2078
2126
|
if (u !== "element-shared") if (u !== "fixed") if (u !== "auto") {
|
|
2079
2127
|
if (u.startsWith("--")) {
|
|
2080
2128
|
if (r.fixed !== -1 || r.isAuto) return -1;
|
|
@@ -2089,9 +2137,9 @@ function Jn(t, e, n) {
|
|
|
2089
2137
|
i++;
|
|
2090
2138
|
const c = t[i];
|
|
2091
2139
|
if (!c) return -1;
|
|
2092
|
-
const
|
|
2093
|
-
if (
|
|
2094
|
-
r.fixed = Math.max(0, Math.min(
|
|
2140
|
+
const d = w(F(O([c]), e, n));
|
|
2141
|
+
if (d === -1 || !v(d.value) || d.value[4].value < 0 || d.value[4].value > 1) return -1;
|
|
2142
|
+
r.fixed = Math.max(0, Math.min(d.value[4].value, 1 - 1e-9));
|
|
2095
2143
|
}
|
|
2096
2144
|
else {
|
|
2097
2145
|
if (r.fixed !== -1) return -1;
|
|
@@ -2101,38 +2149,38 @@ function Jn(t, e, n) {
|
|
|
2101
2149
|
return -1;
|
|
2102
2150
|
}
|
|
2103
2151
|
function O(t) {
|
|
2104
|
-
return new N([
|
|
2152
|
+
return new N([s.Function, "calc(", -1, -1, { value: "calc" }], [s.CloseParen, ")", -1, -1, void 0], t);
|
|
2105
2153
|
}
|
|
2106
2154
|
function Yn(t, e) {
|
|
2107
|
-
return new N([
|
|
2155
|
+
return new N([s.Function, "max(", -1, -1, { value: "max" }], [s.CloseParen, ")", -1, -1, void 0], [t, new f([s.Comma, ",", -1, -1, void 0]), e]);
|
|
2108
2156
|
}
|
|
2109
2157
|
function Zn(t) {
|
|
2110
2158
|
if (t === -1) return -1;
|
|
2111
|
-
if (
|
|
2159
|
+
if (de(t)) return t;
|
|
2112
2160
|
const e = t.value;
|
|
2113
|
-
return D(e) && Number.isNaN(e[4].value) ?
|
|
2161
|
+
return D(e) && Number.isNaN(e[4].value) ? v(e) ? new N([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new f([s.Ident, "NaN", e[2], e[3], { value: "NaN" }])]) : P(e) ? new N([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new f([s.Ident, "NaN", e[2], e[3], { value: "NaN" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Delim, "*", e[2], e[3], { value: "*" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Dimension, "1" + e[4].unit, e[2], e[3], { value: 1, type: p.Integer, unit: e[4].unit }])]) : b(e) ? new N([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new f([s.Ident, "NaN", e[2], e[3], { value: "NaN" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Delim, "*", e[2], e[3], { value: "*" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Percentage, "1%", e[2], e[3], { value: 1 }])]) : -1 : t;
|
|
2114
2162
|
}
|
|
2115
2163
|
function Kn(t) {
|
|
2116
2164
|
if (t === -1) return -1;
|
|
2117
|
-
if (
|
|
2165
|
+
if (de(t)) return t;
|
|
2118
2166
|
const e = t.value;
|
|
2119
2167
|
if (!D(e) || Number.isFinite(e[4].value) || Number.isNaN(e[4].value)) return t;
|
|
2120
2168
|
let n = "";
|
|
2121
|
-
return Number.NEGATIVE_INFINITY === e[4].value && (n = "-"),
|
|
2169
|
+
return Number.NEGATIVE_INFINITY === e[4].value && (n = "-"), v(e) ? new N([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new f([s.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }])]) : P(e) ? new N([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new f([s.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Delim, "*", e[2], e[3], { value: "*" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Dimension, "1" + e[4].unit, e[2], e[3], { value: 1, type: p.Integer, unit: e[4].unit }])]) : new N([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new f([s.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Delim, "*", e[2], e[3], { value: "*" }]), new T([[s.Whitespace, " ", e[2], e[3], void 0]]), new f([s.Percentage, "1%", e[2], e[3], { value: 1 }])]);
|
|
2122
2170
|
}
|
|
2123
2171
|
function Qn(t) {
|
|
2124
2172
|
if (t === -1) return -1;
|
|
2125
|
-
if (
|
|
2173
|
+
if (de(t)) return t;
|
|
2126
2174
|
const e = t.value;
|
|
2127
|
-
return D(e) && Object.is(-0, e[4].value) && (e[1] === "-0" || (b(e) ? e[1] = "-0%" :
|
|
2175
|
+
return D(e) && Object.is(-0, e[4].value) && (e[1] === "-0" || (b(e) ? e[1] = "-0%" : P(e) ? e[1] = "-0" + e[4].unit : e[1] = "-0")), t;
|
|
2128
2176
|
}
|
|
2129
2177
|
function Xn(t, e = 13) {
|
|
2130
2178
|
if (t === -1) return -1;
|
|
2131
|
-
if (e <= 0 ||
|
|
2179
|
+
if (e <= 0 || de(t)) return t;
|
|
2132
2180
|
const n = t.value;
|
|
2133
2181
|
if (!D(n) || Number.isInteger(n[4].value)) return t;
|
|
2134
2182
|
const r = Number(n[4].value.toFixed(e)).toString();
|
|
2135
|
-
return
|
|
2183
|
+
return v(n) ? n[1] = r : b(n) ? n[1] = r + "%" : P(n) && (n[1] = r + n[4].unit), t;
|
|
2136
2184
|
}
|
|
2137
2185
|
function _n(t, e) {
|
|
2138
2186
|
let n = t;
|
|
@@ -2147,7 +2195,7 @@ function tr(t, e) {
|
|
|
2147
2195
|
function nr(t, e) {
|
|
2148
2196
|
const n = er();
|
|
2149
2197
|
return en(t, ((r) => {
|
|
2150
|
-
if (!
|
|
2198
|
+
if (!de(r)) return;
|
|
2151
2199
|
const o = He.get(r.getName().toLowerCase());
|
|
2152
2200
|
if (!o) return;
|
|
2153
2201
|
const i = _n(w(o(r, n, {})), e);
|
|
@@ -2181,66 +2229,67 @@ const L = (t) => {
|
|
|
2181
2229
|
}
|
|
2182
2230
|
}
|
|
2183
2231
|
return e;
|
|
2184
|
-
},
|
|
2232
|
+
}, ge = (t, e, n, r = null) => t.number === e.number ? (ee.error(
|
|
2185
2233
|
`Same value for start an end${r ? ` (${r})` : ""}: "clamp-[${n}]".`
|
|
2186
2234
|
), null) : t.unit !== e.unit && t.unit !== "zero" && e.unit !== "zero" ? (ee.error(
|
|
2187
2235
|
`Units need to match${r ? ` (${r})` : ""}: "clamp-[${n}]" ${t.unit} !== ${e.unit}.`
|
|
2188
2236
|
), null) : t.unit === "unsupported" || e.unit === "unsupported" ? (ee.error(
|
|
2189
2237
|
`Only px, rem and em units are supported${r ? ` (${r})` : ""}: "clamp-[${n}]".`
|
|
2190
2238
|
), null) : !0, We = (t, e, n = { number: 23.4375, unit: "rem" }, r = { number: 90, unit: "rem" }, o = !1) => {
|
|
2191
|
-
const i = t.unit === "zero" ? e.unit : t.unit,
|
|
2192
|
-
let u = t.number, c = e.number,
|
|
2193
|
-
n.unit !== "px" &&
|
|
2194
|
-
const y = (c - u) / (
|
|
2195
|
-
return
|
|
2239
|
+
const i = t.unit === "zero" ? e.unit : t.unit, a = i === "px";
|
|
2240
|
+
let u = t.number, c = e.number, d = !1, l = n.number, g = r.number;
|
|
2241
|
+
n.unit !== "px" && a && (l = n.number * 16), n.unit === "px" && !a && (l = n.number / 16), r.unit !== "px" && a && (g = r.number * 16), r.unit === "px" && !a && (g = r.number / 16), c < u && u < 0 && c < 0 ? (u = Math.abs(u), c = Math.abs(c), d = !0) : c < u && u > 0 && c > 0 ? (u = u * -1, c = c * -1, d = !0) : c < u && (u = Math.abs(u) * -1, c = Math.abs(c), d = !0);
|
|
2242
|
+
const y = (c - u) / (g - l), k = `${(u - l * y).toFixed(6)}${i} + ${(100 * y).toFixed(6)}${o ? "cqw" : "vw"}`, E = `clamp(${u}${i}, ${k}, ${c}${i})`;
|
|
2243
|
+
return d ? `calc(${E} * -1)` : E;
|
|
2196
2244
|
}, rr = {
|
|
2197
2245
|
minSize: "23.4375rem",
|
|
2198
2246
|
maxSize: "90rem"
|
|
2199
2247
|
};
|
|
2200
|
-
function
|
|
2248
|
+
function Pe(t, e, n, r) {
|
|
2201
2249
|
if (!t)
|
|
2202
2250
|
return {
|
|
2203
2251
|
...L(e),
|
|
2204
2252
|
isContainer: !1
|
|
2205
2253
|
};
|
|
2206
|
-
const o = t.startsWith("@"), i = o ? t.slice(1) : t,
|
|
2254
|
+
const o = t.startsWith("@"), i = o ? t.slice(1) : t, a = o ? r[i] || i : n[i] || i;
|
|
2207
2255
|
return {
|
|
2208
|
-
...L(
|
|
2256
|
+
...L(a),
|
|
2209
2257
|
isContainer: o
|
|
2210
2258
|
};
|
|
2211
2259
|
}
|
|
2212
|
-
const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
|
|
2260
|
+
const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0", ar = mt.withOptions(function(t = {}) {
|
|
2213
2261
|
const e = { ...rr, ...t };
|
|
2214
2262
|
return function({ matchUtilities: n, addBase: r, theme: o, config: i }) {
|
|
2215
|
-
const
|
|
2216
|
-
for (const [
|
|
2217
|
-
|
|
2218
|
-
|
|
2263
|
+
const a = o("clamp") || {}, u = {}, c = {};
|
|
2264
|
+
for (const [d, l] of Object.entries(a)) {
|
|
2265
|
+
if (typeof l != "string") continue;
|
|
2266
|
+
const g = l.split(",")[0];
|
|
2267
|
+
or(g) ? c[d] = l : u[d] = l;
|
|
2219
2268
|
}
|
|
2220
2269
|
if (Object.keys(c).length > 0) {
|
|
2221
|
-
const
|
|
2222
|
-
for (const [y,
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2270
|
+
const d = o("screens"), l = o("containers"), g = {};
|
|
2271
|
+
for (const [y, k] of Object.entries(c)) {
|
|
2272
|
+
const E = k.split(",").map((ye) => ye.trim());
|
|
2273
|
+
if (E.length < 2) {
|
|
2225
2274
|
ee.error(
|
|
2226
2275
|
`Theme clamp variable "--clamp-${y}" requires at least 2 values (start, end).`
|
|
2227
2276
|
);
|
|
2228
2277
|
continue;
|
|
2229
2278
|
}
|
|
2230
|
-
const m = L(
|
|
2231
|
-
|
|
2279
|
+
const m = L(E[0]), z = L(E[1]), U = Pe(
|
|
2280
|
+
E[2],
|
|
2232
2281
|
e.minSize,
|
|
2233
|
-
|
|
2282
|
+
d,
|
|
2234
2283
|
l
|
|
2235
|
-
), x =
|
|
2236
|
-
|
|
2284
|
+
), x = Pe(
|
|
2285
|
+
E[3],
|
|
2237
2286
|
e.maxSize,
|
|
2238
|
-
|
|
2287
|
+
d,
|
|
2239
2288
|
l
|
|
2240
2289
|
);
|
|
2241
|
-
if (!
|
|
2290
|
+
if (!ge(U, x, `--clamp-${y}`) || !ge(m, z, `--clamp-${y}`)) continue;
|
|
2242
2291
|
const xe = U.isContainer;
|
|
2243
|
-
|
|
2292
|
+
g[`--clamp-${y}`] = We(
|
|
2244
2293
|
m,
|
|
2245
2294
|
z,
|
|
2246
2295
|
U,
|
|
@@ -2248,34 +2297,34 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
|
|
|
2248
2297
|
xe
|
|
2249
2298
|
);
|
|
2250
2299
|
}
|
|
2251
|
-
Object.keys(
|
|
2300
|
+
Object.keys(g).length > 0 && r({ ":root": g });
|
|
2252
2301
|
}
|
|
2253
2302
|
n(
|
|
2254
2303
|
{
|
|
2255
|
-
clamp: (
|
|
2304
|
+
clamp: (d) => {
|
|
2256
2305
|
var Ge, Je;
|
|
2257
|
-
const l =
|
|
2306
|
+
const l = d.split(",");
|
|
2258
2307
|
if (l.length < 3)
|
|
2259
2308
|
return ee.error(
|
|
2260
|
-
`The clamp utility requires at least 3 arguments: "clamp-[${
|
|
2309
|
+
`The clamp utility requires at least 3 arguments: "clamp-[${d}]".`
|
|
2261
2310
|
), {};
|
|
2262
|
-
const
|
|
2311
|
+
const g = o("screens"), y = o("containers"), k = Pe(
|
|
2263
2312
|
l[3],
|
|
2264
2313
|
e.minSize,
|
|
2265
|
-
|
|
2314
|
+
g,
|
|
2266
2315
|
y
|
|
2267
|
-
),
|
|
2316
|
+
), E = Pe(
|
|
2268
2317
|
l[4],
|
|
2269
2318
|
e.maxSize,
|
|
2270
|
-
|
|
2319
|
+
g,
|
|
2271
2320
|
y
|
|
2272
2321
|
);
|
|
2273
|
-
if (!
|
|
2322
|
+
if (!ge(k, E, d))
|
|
2274
2323
|
return {};
|
|
2275
|
-
const m =
|
|
2324
|
+
const m = k.isContainer, U = l[0].startsWith("--") ? { type: "regular", key: null, props: [l[0]] } : ht(l[0]);
|
|
2276
2325
|
if (!U)
|
|
2277
2326
|
return ee.error(
|
|
2278
|
-
`Property "${l[0]}" is not supported: "clamp-[${
|
|
2327
|
+
`Property "${l[0]}" is not supported: "clamp-[${d}]".`
|
|
2279
2328
|
), {};
|
|
2280
2329
|
const { key: x, props: xe, type: ye } = U;
|
|
2281
2330
|
if (ye === "fontSize") {
|
|
@@ -2288,12 +2337,12 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
|
|
|
2288
2337
|
if (B in q) {
|
|
2289
2338
|
if ((B === "letterSpacing" || B === "lineHeight") && S[B].number === q[B].number && S[B].unit === q[B].unit)
|
|
2290
2339
|
fe[B] = `${S[B].number}${S[B].unit}`;
|
|
2291
|
-
else if (
|
|
2340
|
+
else if (ge(S[B], q[B], d, B)) {
|
|
2292
2341
|
const ft = We(
|
|
2293
2342
|
S[B],
|
|
2294
2343
|
q[B],
|
|
2344
|
+
k,
|
|
2295
2345
|
E,
|
|
2296
|
-
P,
|
|
2297
2346
|
m
|
|
2298
2347
|
);
|
|
2299
2348
|
fe[B] = ft;
|
|
@@ -2301,7 +2350,11 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
|
|
|
2301
2350
|
}
|
|
2302
2351
|
}), fe;
|
|
2303
2352
|
}
|
|
2304
|
-
let Oe = L(
|
|
2353
|
+
let Oe = L(
|
|
2354
|
+
x && ((Ge = i().theme[x]) == null ? void 0 : Ge[l[1]]) || l[1]
|
|
2355
|
+
), Te = L(
|
|
2356
|
+
x && ((Je = i().theme[x]) == null ? void 0 : Je[l[2]]) || l[2]
|
|
2357
|
+
);
|
|
2305
2358
|
if (ye === "spacing") {
|
|
2306
2359
|
const S = L(
|
|
2307
2360
|
typeof o("spacing") == "string" ? o("spacing") : o("spacing.1")
|
|
@@ -2314,10 +2367,10 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
|
|
|
2314
2367
|
unit: S.unit
|
|
2315
2368
|
});
|
|
2316
2369
|
}
|
|
2317
|
-
if (!
|
|
2370
|
+
if (!ge(Oe, Te, d))
|
|
2318
2371
|
return {};
|
|
2319
|
-
const
|
|
2320
|
-
return xe.reduce((S, q) => (typeof q == "string" ? S[q] =
|
|
2372
|
+
const dt = We(Oe, Te, k, E, m);
|
|
2373
|
+
return xe.reduce((S, q) => (typeof q == "string" ? S[q] = dt : S = { ...S, ...q }, S), {});
|
|
2321
2374
|
}
|
|
2322
2375
|
},
|
|
2323
2376
|
{ values: u },
|
|
@@ -2332,6 +2385,6 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
|
|
|
2332
2385
|
};
|
|
2333
2386
|
});
|
|
2334
2387
|
export {
|
|
2335
|
-
|
|
2388
|
+
ar as default
|
|
2336
2389
|
};
|
|
2337
2390
|
//# sourceMappingURL=index.js.map
|