@weapp-tailwindcss/postcss 3.0.7 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -84,7 +84,7 @@ var ParseErrorWithToken = class extends ParseError$1 {
84
84
  super(e, n, t, o), this.token = r;
85
85
  }
86
86
  };
87
- const e$37 = {
87
+ const e$38 = {
88
88
  UnexpectedNewLineInString: "Unexpected newline while consuming a string token.",
89
89
  UnexpectedEOFInString: "Unexpected EOF while consuming a string token.",
90
90
  UnexpectedEOFInComment: "Unexpected EOF while consuming a comment.",
@@ -227,7 +227,7 @@ function consumeComment$1(n, t) {
227
227
  t.representationEnd,
228
228
  void 0
229
229
  ];
230
- return n.onParseError(new ParseErrorWithToken(e$37.UnexpectedEOFInComment, t.representationStart, t.representationEnd, ["4.3.2. Consume comments", "Unexpected EOF"], o)), o;
230
+ return n.onParseError(new ParseErrorWithToken(e$38.UnexpectedEOFInComment, t.representationStart, t.representationEnd, ["4.3.2. Consume comments", "Unexpected EOF"], o)), o;
231
231
  }
232
232
  if (42 === o && void 0 !== t.source.codePointAt(t.cursor) && 47 === t.source.codePointAt(t.cursor)) {
233
233
  t.advanceCodePoint();
@@ -244,7 +244,7 @@ function consumeComment$1(n, t) {
244
244
  }
245
245
  function consumeEscapedCodePoint(n, o) {
246
246
  const i = o.readCodePoint();
247
- if (void 0 === i) return n.onParseError(new ParseError$1(e$37.UnexpectedEOFInEscapedCodePoint, o.representationStart, o.representationEnd, ["4.3.7. Consume an escaped code point", "Unexpected EOF"])), s$17;
247
+ if (void 0 === i) return n.onParseError(new ParseError$1(e$38.UnexpectedEOFInEscapedCodePoint, o.representationStart, o.representationEnd, ["4.3.7. Consume an escaped code point", "Unexpected EOF"])), s$17;
248
248
  if (isHexDigitCodePoint(i)) {
249
249
  const e = [i];
250
250
  let n;
@@ -402,7 +402,7 @@ function consumeStringToken(n, o) {
402
402
  o.representationEnd,
403
403
  { value: i }
404
404
  ];
405
- return n.onParseError(new ParseErrorWithToken(e$37.UnexpectedEOFInString, o.representationStart, o.representationEnd, ["4.3.5. Consume a string token", "Unexpected EOF"], t)), t;
405
+ return n.onParseError(new ParseErrorWithToken(e$38.UnexpectedEOFInString, o.representationStart, o.representationEnd, ["4.3.5. Consume a string token", "Unexpected EOF"], t)), t;
406
406
  }
407
407
  if (isNewLine(u)) {
408
408
  o.unreadCodePoint();
@@ -413,7 +413,7 @@ function consumeStringToken(n, o) {
413
413
  o.representationEnd,
414
414
  void 0
415
415
  ];
416
- return n.onParseError(new ParseErrorWithToken(e$37.UnexpectedNewLineInString, o.representationStart, o.source.codePointAt(o.cursor) === t$19 && o.source.codePointAt(o.cursor + 1) === r$12 ? o.representationEnd + 2 : o.representationEnd + 1, ["4.3.5. Consume a string token", "Unexpected newline"], i)), i;
416
+ return n.onParseError(new ParseErrorWithToken(e$38.UnexpectedNewLineInString, o.representationStart, o.source.codePointAt(o.cursor) === t$19 && o.source.codePointAt(o.cursor + 1) === r$12 ? o.representationEnd + 2 : o.representationEnd + 1, ["4.3.5. Consume a string token", "Unexpected newline"], i)), i;
417
417
  }
418
418
  if (u === a) return [
419
419
  c$7.String,
@@ -456,7 +456,7 @@ function consumeUrlToken(n, t) {
456
456
  t.representationEnd,
457
457
  { value: o }
458
458
  ];
459
- return n.onParseError(new ParseErrorWithToken(e$37.UnexpectedEOFInURL, t.representationStart, t.representationEnd, ["4.3.6. Consume a url token", "Unexpected EOF"], r)), r;
459
+ return n.onParseError(new ParseErrorWithToken(e$38.UnexpectedEOFInURL, t.representationStart, t.representationEnd, ["4.3.6. Consume a url token", "Unexpected EOF"], r)), r;
460
460
  }
461
461
  if (41 === t.source.codePointAt(t.cursor)) return t.advanceCodePoint(), [
462
462
  c$7.URL,
@@ -475,7 +475,7 @@ function consumeUrlToken(n, t) {
475
475
  t.representationEnd,
476
476
  { value: o }
477
477
  ];
478
- return n.onParseError(new ParseErrorWithToken(e$37.UnexpectedEOFInURL, t.representationStart, t.representationEnd, [
478
+ return n.onParseError(new ParseErrorWithToken(e$38.UnexpectedEOFInURL, t.representationStart, t.representationEnd, [
479
479
  "4.3.6. Consume a url token",
480
480
  "Consume as much whitespace as possible",
481
481
  "Unexpected EOF"
@@ -505,7 +505,7 @@ function consumeUrlToken(n, t) {
505
505
  t.representationEnd,
506
506
  void 0
507
507
  ];
508
- return n.onParseError(new ParseErrorWithToken(e$37.UnexpectedCharacterInURL, t.representationStart, t.representationEnd, ["4.3.6. Consume a url token", "Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"], o)), o;
508
+ return n.onParseError(new ParseErrorWithToken(e$38.UnexpectedCharacterInURL, t.representationStart, t.representationEnd, ["4.3.6. Consume a url token", "Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"], o)), o;
509
509
  }
510
510
  if (92 === r) {
511
511
  if (checkIfTwoCodePointsAreAValidEscape(t)) {
@@ -520,7 +520,7 @@ function consumeUrlToken(n, t) {
520
520
  t.representationEnd,
521
521
  void 0
522
522
  ];
523
- return n.onParseError(new ParseErrorWithToken(e$37.InvalidEscapeSequenceInURL, t.representationStart, t.representationEnd, [
523
+ return n.onParseError(new ParseErrorWithToken(e$38.InvalidEscapeSequenceInURL, t.representationStart, t.representationEnd, [
524
524
  "4.3.6. Consume a url token",
525
525
  "U+005C REVERSE SOLIDUS (\\)",
526
526
  "The input stream does not start with a valid escape sequence"
@@ -758,7 +758,7 @@ function tokenizer(n, s) {
758
758
  d.representationEnd,
759
759
  { value: "\\" }
760
760
  ];
761
- return p.onParseError(new ParseErrorWithToken(e$37.InvalidEscapeSequenceAfterBackslash, d.representationStart, d.representationEnd, [
761
+ return p.onParseError(new ParseErrorWithToken(e$38.InvalidEscapeSequenceAfterBackslash, d.representationStart, d.representationEnd, [
762
762
  "4.3.1. Consume a token",
763
763
  "U+005C REVERSE SOLIDUS (\\)",
764
764
  "The input stream does not start with a valid escape sequence"
@@ -1062,7 +1062,7 @@ const o$26 = [
1062
1062
  -.0763729366746601,
1063
1063
  -.4214933324022432,
1064
1064
  1.5869240198367816
1065
- ], e$36 = [
1065
+ ], e$37 = [
1066
1066
  1,
1067
1067
  .3963377773761749,
1068
1068
  .2158037573099136,
@@ -1081,7 +1081,7 @@ const o$26 = [
1081
1081
  * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
1082
1082
  */
1083
1083
  function OKLab_to_XYZ(t) {
1084
- const n = multiplyMatrices(e$36, t);
1084
+ const n = multiplyMatrices(e$37, t);
1085
1085
  return multiplyMatrices(o$26, [
1086
1086
  n[0] ** 3,
1087
1087
  n[1] ** 3,
@@ -4513,7 +4513,7 @@ function replaceComponentValues(n, r) {
4513
4513
  }
4514
4514
  const Q$1 = new Set(J.keys());
4515
4515
  //#endregion
4516
- //#region ../../node_modules/.pnpm/@csstools+css-color-parser@4.1.1_@csstools+css-parser-algorithms@4.0.0_@csstools+css-to_402b4b31fb8b001854d943f6a3e18a48/node_modules/@csstools/css-color-parser/dist/index.mjs
4516
+ //#region ../../node_modules/.pnpm/@csstools+css-color-parser@4.1.7_@csstools+css-parser-algorithms@4.0.0_@csstools+css-to_c606082c5a5fca873f2359b96c9c8c0e/node_modules/@csstools/css-color-parser/dist/index.mjs
4517
4517
  var he, me;
4518
4518
  function convertNaNToZero(e) {
4519
4519
  return [
@@ -4609,7 +4609,7 @@ function colorData_to_XYZ_D50(e) {
4609
4609
  })(he || (he = {})), function(e) {
4610
4610
  e.ColorKeyword = "color-keyword", e.HasAlpha = "has-alpha", e.HasDimensionValues = "has-dimension-values", e.HasNoneKeywords = "has-none-keywords", e.HasNumberValues = "has-number-values", e.HasPercentageAlpha = "has-percentage-alpha", e.HasPercentageValues = "has-percentage-values", e.HasVariableAlpha = "has-variable-alpha", e.Hex = "hex", e.LegacyHSL = "legacy-hsl", e.LegacyRGB = "legacy-rgb", e.NamedColor = "named-color", e.RelativeColorSyntax = "relative-color-syntax", e.ColorMix = "color-mix", e.ColorMixVariadic = "color-mix-variadic", e.ContrastColor = "contrast-color", e.RelativeAlphaSyntax = "relative-alpha-syntax", e.Experimental = "experimental";
4611
4611
  }(me || (me = {}));
4612
- const pe = new Set([
4612
+ const Ne = new Set([
4613
4613
  he.A98_RGB,
4614
4614
  he.Display_P3,
4615
4615
  he.Linear_Display_P3,
@@ -4623,6 +4623,7 @@ const pe = new Set([
4623
4623
  he.XYZ_D65
4624
4624
  ]);
4625
4625
  function colorDataTo(e, a) {
4626
+ (e = { ...e }).channels = convertPowerlessComponentsToMissingComponents(e.channels, e.colorNotation);
4626
4627
  const n = { ...e };
4627
4628
  if (e.colorNotation !== a) {
4628
4629
  const e = colorData_to_XYZ_D50(n);
@@ -4688,7 +4689,7 @@ function colorDataTo(e, a) {
4688
4689
  1,
4689
4690
  2
4690
4691
  ], []);
4691
- else if (pe.has(a) && pe.has(e.colorNotation)) n.channels = carryForwardMissingComponents(e.channels, [
4692
+ else if (Ne.has(a) && Ne.has(e.colorNotation)) n.channels = carryForwardMissingComponents(e.channels, [
4692
4693
  0,
4693
4694
  1,
4694
4695
  2
@@ -4797,7 +4798,7 @@ function colorDataTo(e, a) {
4797
4798
  break;
4798
4799
  default: n.channels = carryForwardMissingComponents(e.channels, [], [], n.channels, [], []);
4799
4800
  }
4800
- return n.channels = convertPowerlessComponentsToMissingComponents(n.channels, a), n;
4801
+ return n;
4801
4802
  }
4802
4803
  function convertPowerlessComponentsToMissingComponents(e, a) {
4803
4804
  const n = [...e];
@@ -4837,16 +4838,16 @@ function convertPowerlessComponentsToZeroValuesForDisplay(e, a) {
4837
4838
  }
4838
4839
  return n;
4839
4840
  }
4840
- function carryForwardMissingComponents(e, a, n, r, o, l) {
4841
+ function carryForwardMissingComponents(e, a, n, r, o, t) {
4841
4842
  if (a.length < 3 && e.every(Number.isNaN)) return [
4842
4843
  NaN,
4843
4844
  NaN,
4844
4845
  NaN
4845
4846
  ];
4846
- const t = [...r];
4847
- for (let n = 0; n < a.length; n++) Number.isNaN(e[a[n]]) && (t[o[n]] = NaN);
4848
- if (n.length && n.every((a) => Number.isNaN(e[a]))) for (let e = 0; e < l.length; e++) t[l[e]] = NaN;
4849
- return t;
4847
+ const l = [...r];
4848
+ for (let n = 0; n < a.length; n++) Number.isNaN(e[a[n]]) && (l[o[n]] = NaN);
4849
+ if (n.length && n.every((a) => Number.isNaN(e[a]))) for (let e = 0; e < t.length; e++) l[t[e]] = NaN;
4850
+ return l;
4850
4851
  }
4851
4852
  function normalizeRelativeColorDataChannels(e) {
4852
4853
  const a = /* @__PURE__ */ new Map();
@@ -4933,43 +4934,43 @@ function colorDataFitsDisplayP3_Gamut(e) {
4933
4934
  function normalize(e, a, n, r) {
4934
4935
  return Math.min(Math.max(e / a, n), r);
4935
4936
  }
4936
- const Ne = /[A-Z]/g;
4937
+ const pe = /[A-Z]/g;
4937
4938
  function toLowerCaseAZ(e) {
4938
- return e.replace(Ne, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
4939
+ return e.replace(pe, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
4939
4940
  }
4940
- function normalize_Color_ChannelValues(l, t, s) {
4941
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
4941
+ function normalize_Color_ChannelValues(t, l, s) {
4942
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
4942
4943
  c$7.Number,
4943
4944
  "none",
4944
- l[2],
4945
- l[3],
4945
+ t[2],
4946
+ t[3],
4946
4947
  {
4947
4948
  value: NaN,
4948
4949
  type: a$8.Number
4949
4950
  }
4950
4951
  ];
4951
- if (isTokenPercentage(l)) {
4952
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
4953
- let n = normalize(l[4].value, 100, -2147483647, 2147483647);
4954
- return 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
4952
+ if (isTokenPercentage(t)) {
4953
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
4954
+ let n = normalize(t[4].value, 100, -2147483647, 2147483647);
4955
+ return 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
4955
4956
  c$7.Number,
4956
4957
  n.toString(),
4957
- l[2],
4958
- l[3],
4958
+ t[2],
4959
+ t[3],
4959
4960
  {
4960
4961
  value: n,
4961
4962
  type: a$8.Number
4962
4963
  }
4963
4964
  ];
4964
4965
  }
4965
- if (isTokenNumber(l)) {
4966
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
4967
- let n = normalize(l[4].value, 1, -2147483647, 2147483647);
4968
- return 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
4966
+ if (isTokenNumber(t)) {
4967
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
4968
+ let n = normalize(t[4].value, 1, -2147483647, 2147483647);
4969
+ return 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
4969
4970
  c$7.Number,
4970
4971
  n.toString(),
4971
- l[2],
4972
- l[3],
4972
+ t[2],
4973
+ t[3],
4973
4974
  {
4974
4975
  value: n,
4975
4976
  type: a$8.Number
@@ -4992,8 +4993,8 @@ const be = new Set([
4992
4993
  ]);
4993
4994
  function color$1(e, a) {
4994
4995
  const r = [], s = [], u = [], i = [];
4995
- let c, h, m = !1, p = !1;
4996
- const N = {
4996
+ let c, h, m = !1, N = !1;
4997
+ const p = {
4997
4998
  colorNotation: he.sRGB,
4998
4999
  channels: [
4999
5000
  0,
@@ -5005,19 +5006,19 @@ function color$1(e, a) {
5005
5006
  };
5006
5007
  let b = r;
5007
5008
  for (let o = 0; o < e.value.length; o++) {
5008
- let g = e.value[o];
5009
- if (isWhitespaceNode(g) || isCommentNode(g)) for (; isWhitespaceNode(e.value[o + 1]) || isCommentNode(e.value[o + 1]);) o++;
5010
- else if (b === r && r.length && (b = s), b === s && s.length && (b = u), isTokenNode(g) && isTokenDelim(g.value) && "/" === g.value[4].value) {
5009
+ let v = e.value[o];
5010
+ if (isWhitespaceNode(v) || isCommentNode(v)) for (; isWhitespaceNode(e.value[o + 1]) || isCommentNode(e.value[o + 1]);) o++;
5011
+ else if (b === r && r.length && (b = s), b === s && s.length && (b = u), isTokenNode(v) && isTokenDelim(v.value) && "/" === v.value[4].value) {
5011
5012
  if (b === i) return !1;
5012
5013
  b = i;
5013
5014
  } else {
5014
- if (isFunctionNode(g)) {
5015
- if (b === i && "var" === toLowerCaseAZ(g.getName())) {
5016
- N.syntaxFlags.add(me.HasVariableAlpha), b.push(g);
5015
+ if (isFunctionNode(v)) {
5016
+ if (b === i && "var" === toLowerCaseAZ(v.getName())) {
5017
+ p.syntaxFlags.add(me.HasVariableAlpha), b.push(v);
5017
5018
  continue;
5018
5019
  }
5019
- if (!Q$1.has(toLowerCaseAZ(g.getName()))) return !1;
5020
- const [[e]] = calcFromComponentValues([[g]], {
5020
+ if (!Q$1.has(toLowerCaseAZ(v.getName()))) return !1;
5021
+ const [[e]] = calcFromComponentValues([[v]], {
5021
5022
  censorIntoStandardRepresentableValues: !0,
5022
5023
  globals: h,
5023
5024
  precision: -1,
@@ -5025,24 +5026,24 @@ function color$1(e, a) {
5025
5026
  rawPercentages: !0
5026
5027
  });
5027
5028
  if (!e || !isTokenNode(e) || !isTokenNumeric(e.value)) return !1;
5028
- Number.isNaN(e.value[4].value) && (e.value[4].value = 0), g = e;
5029
+ Number.isNaN(e.value[4].value) && (e.value[4].value = 0), v = e;
5029
5030
  }
5030
- if (b === r && 0 === r.length && isTokenNode(g) && isTokenIdent(g.value) && be.has(toLowerCaseAZ(g.value[4].value))) {
5031
+ if (b === r && 0 === r.length && isTokenNode(v) && isTokenIdent(v.value) && be.has(toLowerCaseAZ(v.value[4].value))) {
5031
5032
  if (m) return !1;
5032
- m = toLowerCaseAZ(g.value[4].value), N.colorNotation = colorSpaceNameToColorNotation(m), p && (p.colorNotation !== N.colorNotation && (p = colorDataTo(p, N.colorNotation)), c = normalizeRelativeColorDataChannels(p), h = noneToZeroInRelativeColorDataChannels(c));
5033
- } else if (b === r && 0 === r.length && isTokenNode(g) && isTokenIdent(g.value) && "from" === toLowerCaseAZ(g.value[4].value)) {
5034
- if (p) return !1;
5033
+ m = toLowerCaseAZ(v.value[4].value), p.colorNotation = colorSpaceNameToColorNotation(m), N && (N.colorNotation !== p.colorNotation && (N = colorDataTo(N, p.colorNotation)), c = normalizeRelativeColorDataChannels(N), h = noneToZeroInRelativeColorDataChannels(c));
5034
+ } else if (b === r && 0 === r.length && isTokenNode(v) && isTokenIdent(v.value) && "from" === toLowerCaseAZ(v.value[4].value)) {
5035
+ if (N) return !1;
5035
5036
  if (m) return !1;
5036
5037
  for (; isWhitespaceNode(e.value[o + 1]) || isCommentNode(e.value[o + 1]);) o++;
5037
- if (o++, g = e.value[o], p = a(g), !1 === p) return !1;
5038
- p.syntaxFlags.has(me.Experimental) && N.syntaxFlags.add(me.Experimental), N.syntaxFlags.add(me.RelativeColorSyntax);
5038
+ if (o++, v = e.value[o], N = a(v), !1 === N) return !1;
5039
+ N.syntaxFlags.has(me.Experimental) && p.syntaxFlags.add(me.Experimental), p.syntaxFlags.add(me.RelativeColorSyntax);
5039
5040
  } else {
5040
- if (!isTokenNode(g)) return !1;
5041
- if (isTokenIdent(g.value) && c && c.has(toLowerCaseAZ(g.value[4].value))) {
5042
- b.push(new TokenNode(c.get(toLowerCaseAZ(g.value[4].value))));
5041
+ if (!isTokenNode(v)) return !1;
5042
+ if (isTokenIdent(v.value) && c && c.has(toLowerCaseAZ(v.value[4].value))) {
5043
+ b.push(new TokenNode(c.get(toLowerCaseAZ(v.value[4].value))));
5043
5044
  continue;
5044
5045
  }
5045
- b.push(g);
5046
+ b.push(v);
5046
5047
  }
5047
5048
  }
5048
5049
  }
@@ -5051,32 +5052,32 @@ function color$1(e, a) {
5051
5052
  if (1 !== r.length || 1 !== s.length || 1 !== u.length) return !1;
5052
5053
  if (!isTokenNode(r[0]) || !isTokenNode(s[0]) || !isTokenNode(u[0])) return !1;
5053
5054
  if (c && !c.has("alpha")) return !1;
5054
- const g = normalize_Color_ChannelValues(r[0].value, 0, N);
5055
- if (!g || !isTokenNumber(g)) return !1;
5056
- const v = normalize_Color_ChannelValues(s[0].value, 1, N);
5055
+ const v = normalize_Color_ChannelValues(r[0].value, 0, p);
5057
5056
  if (!v || !isTokenNumber(v)) return !1;
5058
- const f = normalize_Color_ChannelValues(u[0].value, 2, N);
5057
+ const f = normalize_Color_ChannelValues(s[0].value, 1, p);
5059
5058
  if (!f || !isTokenNumber(f)) return !1;
5059
+ const g = normalize_Color_ChannelValues(u[0].value, 2, p);
5060
+ if (!g || !isTokenNumber(g)) return !1;
5060
5061
  const y = [
5061
- g,
5062
5062
  v,
5063
- f
5063
+ f,
5064
+ g
5064
5065
  ];
5065
- if (1 === i.length) if (N.syntaxFlags.add(me.HasAlpha), isTokenNode(i[0])) {
5066
- const e = normalize_Color_ChannelValues(i[0].value, 3, N);
5066
+ if (1 === i.length) if (p.syntaxFlags.add(me.HasAlpha), isTokenNode(i[0])) {
5067
+ const e = normalize_Color_ChannelValues(i[0].value, 3, p);
5067
5068
  if (!e || !isTokenNumber(e)) return !1;
5068
5069
  y.push(e);
5069
- } else N.alpha = i[0];
5070
+ } else p.alpha = i[0];
5070
5071
  else if (c && c.has("alpha")) {
5071
- const e = normalize_Color_ChannelValues(c.get("alpha"), 3, N);
5072
+ const e = normalize_Color_ChannelValues(c.get("alpha"), 3, p);
5072
5073
  if (!e || !isTokenNumber(e)) return !1;
5073
5074
  y.push(e);
5074
5075
  }
5075
- return N.channels = [
5076
+ return p.channels = [
5076
5077
  y[0][4].value,
5077
5078
  y[1][4].value,
5078
5079
  y[2][4].value
5079
- ], 4 === y.length && (N.alpha = y[3][4].value), N;
5080
+ ], 4 === y.length && (p.alpha = y[3][4].value), p;
5080
5081
  }
5081
5082
  function colorSpaceNameToColorNotation(e) {
5082
5083
  switch (e) {
@@ -5093,7 +5094,7 @@ function colorSpaceNameToColorNotation(e) {
5093
5094
  default: throw new Error("Unknown color space name: " + e);
5094
5095
  }
5095
5096
  }
5096
- const ge = new Set([
5097
+ const ve = new Set([
5097
5098
  "srgb",
5098
5099
  "srgb-linear",
5099
5100
  "display-p3",
@@ -5106,19 +5107,19 @@ const ge = new Set([
5106
5107
  "xyz",
5107
5108
  "xyz-d50",
5108
5109
  "xyz-d65"
5109
- ]), ve = new Set([
5110
+ ]), fe = new Set([
5110
5111
  "hsl",
5111
5112
  "hwb",
5112
5113
  "lch",
5113
5114
  "oklch"
5114
- ]), fe = new Set([
5115
+ ]), ge = new Set([
5115
5116
  "shorter",
5116
5117
  "longer",
5117
5118
  "increasing",
5118
5119
  "decreasing"
5119
5120
  ]);
5120
5121
  function colorMix(e, a) {
5121
- let r = null, o = null, l = null, t = !1;
5122
+ let r = null, o = null, t = null, l = !1;
5122
5123
  for (let u = 0; u < e.value.length; u++) {
5123
5124
  const i = e.value[u];
5124
5125
  if (!isWhiteSpaceOrCommentNode(i)) {
@@ -5132,36 +5133,36 @@ function colorMix(e, a) {
5132
5133
  o = toLowerCaseAZ(i.value[4].value);
5133
5134
  continue;
5134
5135
  }
5135
- if (r && o && !l && ve.has(o)) {
5136
- l = toLowerCaseAZ(i.value[4].value);
5136
+ if (r && o && !t && fe.has(o)) {
5137
+ t = toLowerCaseAZ(i.value[4].value);
5137
5138
  continue;
5138
5139
  }
5139
- if (r && o && l && !t && "hue" === toLowerCaseAZ(i.value[4].value)) {
5140
- t = !0;
5140
+ if (r && o && t && !l && "hue" === toLowerCaseAZ(i.value[4].value)) {
5141
+ l = !0;
5141
5142
  continue;
5142
5143
  }
5143
5144
  return !1;
5144
5145
  }
5145
- return !(!isTokenNode(i) || !isTokenComma(i.value)) && !!o && (l || t ? !!(l && t && ve.has(o) && fe.has(l)) && colorMixPolar(o, l, colorMixComponents(e.value.slice(u + 1), a)) : ge.has(o) ? colorMixRectangular(o, colorMixComponents(e.value.slice(u + 1), a)) : !!ve.has(o) && colorMixPolar(o, "shorter", colorMixComponents(e.value.slice(u + 1), a)));
5146
+ return !(!isTokenNode(i) || !isTokenComma(i.value)) && !!o && (t || l ? !!(t && l && fe.has(o) && ge.has(t)) && colorMixPolar(o, t, colorMixComponents(e.value.slice(u + 1), a)) : ve.has(o) ? colorMixRectangular(o, colorMixComponents(e.value.slice(u + 1), a)) : !!fe.has(o) && colorMixPolar(o, "shorter", colorMixComponents(e.value.slice(u + 1), a)));
5146
5147
  }
5147
5148
  }
5148
5149
  return !1;
5149
5150
  }
5150
5151
  function colorMixComponents(e, a) {
5151
5152
  const n = [];
5152
- let o = 1, l = !1, u = !1;
5153
- for (let o = 0; o < e.length; o++) {
5154
- let i = e[o];
5153
+ let o = !1, t = !1;
5154
+ for (let u = 0; u < e.length; u++) {
5155
+ let i = e[u];
5155
5156
  if (!isWhiteSpaceOrCommentNode(i)) {
5156
5157
  if (!isTokenNode(i) || !isTokenComma(i.value)) {
5157
- if (!l) {
5158
+ if (!o) {
5158
5159
  const e = a(i);
5159
5160
  if (e) {
5160
- l = e;
5161
+ o = e;
5161
5162
  continue;
5162
5163
  }
5163
5164
  }
5164
- if (!u) {
5165
+ if (!t) {
5165
5166
  if (isFunctionNode(i) && Q$1.has(toLowerCaseAZ(i.getName()))) {
5166
5167
  if ([[i]] = calcFromComponentValues([[i]], {
5167
5168
  censorIntoStandardRepresentableValues: !0,
@@ -5172,242 +5173,202 @@ function colorMixComponents(e, a) {
5172
5173
  Number.isNaN(i.value[4].value) && (i.value[4].value = 0);
5173
5174
  }
5174
5175
  if (isTokenNode(i) && isTokenPercentage(i.value) && i.value[4].value >= 0) {
5175
- u = i.value[4].value;
5176
+ t = i.value[4].value;
5176
5177
  continue;
5177
5178
  }
5178
5179
  }
5179
5180
  return !1;
5180
5181
  }
5181
- if (!l) return !1;
5182
+ if (!o) return !1;
5182
5183
  n.push({
5183
- color: l,
5184
- percentage: u
5185
- }), l = !1, u = !1;
5184
+ color: o,
5185
+ percentage: t
5186
+ }), o = !1, t = !1;
5186
5187
  }
5187
5188
  }
5188
- if (!l) return !1;
5189
- n.push({
5190
- color: l,
5191
- percentage: u
5192
- });
5193
- let i = 0, c = 0;
5194
- for (let e = 0; e < n.length; e++) {
5195
- const a = n[e].percentage;
5196
- if (!1 !== a) {
5197
- if (a < 0 || a > 100) return !1;
5198
- i += a;
5199
- } else c++;
5200
- }
5201
- const h = Math.max(0, 100 - i);
5202
- i = 0;
5203
- for (let e = 0; e < n.length; e++) !1 === n[e].percentage && (n[e].percentage = h / c), i += n[e].percentage;
5204
- if (0 === i) return {
5205
- colors: [{
5206
- color: {
5207
- channels: [
5208
- 0,
5209
- 0,
5210
- 0
5211
- ],
5212
- colorNotation: he.sRGB,
5213
- alpha: 0,
5214
- syntaxFlags: /* @__PURE__ */ new Set()
5215
- },
5216
- percentage: 0
5217
- }],
5218
- alphaMultiplier: 0
5219
- };
5220
- if (i > 100) for (let e = 0; e < n.length; e++) {
5221
- let a = n[e].percentage;
5222
- a = a / i * 100, n[e].percentage = a;
5223
- }
5224
- if (i < 100) {
5225
- o = i / 100;
5226
- for (let e = 0; e < n.length; e++) {
5227
- let a = n[e].percentage;
5228
- a = a / i * 100, n[e].percentage = a;
5229
- }
5230
- }
5231
- return {
5232
- colors: n,
5233
- alphaMultiplier: o
5234
- };
5189
+ return !!o && (n.push({
5190
+ color: o,
5191
+ percentage: t
5192
+ }), n);
5235
5193
  }
5236
5194
  function colorMixRectangular(e, a) {
5237
- if (!a || !a.colors.length) return !1;
5238
- const n = a.colors.slice();
5239
- let r;
5240
- switch (n.reverse(), e) {
5195
+ if (!a || !a.length) return !1;
5196
+ for (const e of a) if (e.percentage && (e.percentage < 0 || e.percentage > 100)) return !1;
5197
+ const { items: n, leftover: r } = normalizeMixPercentages(a, !0), o = 1 - r / 100;
5198
+ let t;
5199
+ switch (e) {
5241
5200
  case "srgb":
5242
- r = he.RGB;
5201
+ t = he.RGB;
5243
5202
  break;
5244
5203
  case "srgb-linear":
5245
- r = he.Linear_sRGB;
5204
+ t = he.Linear_sRGB;
5246
5205
  break;
5247
5206
  case "display-p3":
5248
- r = he.Display_P3;
5207
+ t = he.Display_P3;
5249
5208
  break;
5250
5209
  case "display-p3-linear":
5251
- r = he.Linear_Display_P3;
5210
+ t = he.Linear_Display_P3;
5252
5211
  break;
5253
5212
  case "a98-rgb":
5254
- r = he.A98_RGB;
5213
+ t = he.A98_RGB;
5255
5214
  break;
5256
5215
  case "prophoto-rgb":
5257
- r = he.ProPhoto_RGB;
5216
+ t = he.ProPhoto_RGB;
5258
5217
  break;
5259
5218
  case "rec2020":
5260
- r = he.Rec2020;
5219
+ t = he.Rec2020;
5261
5220
  break;
5262
5221
  case "lab":
5263
- r = he.Lab;
5222
+ t = he.Lab;
5264
5223
  break;
5265
5224
  case "oklab":
5266
- r = he.OKLab;
5225
+ t = he.OKLab;
5267
5226
  break;
5268
5227
  case "xyz-d50":
5269
- r = he.XYZ_D50;
5228
+ t = he.XYZ_D50;
5270
5229
  break;
5271
5230
  case "xyz":
5272
5231
  case "xyz-d65":
5273
- r = he.XYZ_D65;
5232
+ t = he.XYZ_D65;
5274
5233
  break;
5275
5234
  default: return !1;
5276
5235
  }
5277
5236
  if (1 === n.length) {
5278
- const e = colorDataTo(n[0].color, r);
5279
- return e.colorNotation = r, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * a.alphaMultiplier, e);
5237
+ const e = colorDataTo(n[0].color, t);
5238
+ return e.colorNotation = t, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * o, e);
5280
5239
  }
5281
- for (; n.length >= 2;) {
5240
+ for (n.reverse(); n.length >= 2;) {
5282
5241
  const e = n.pop(), a = n.pop();
5283
5242
  if (!e || !a) return !1;
5284
- const o = colorMixRectangularPair(r, e.color, e.percentage, a.color, a.percentage);
5285
- if (!o) return !1;
5243
+ const r = e.percentage + a.percentage, o = r > 0 ? a.percentage / r : .5, l = colorMixRectangularPair(t, e.color, a.color, o);
5244
+ if (!l) return !1;
5286
5245
  n.push({
5287
- color: o,
5288
- percentage: e.percentage + a.percentage
5246
+ color: l,
5247
+ percentage: r
5289
5248
  });
5290
5249
  }
5291
- const o = n[0]?.color;
5292
- return !!o && (a.colors.some((e) => e.color.syntaxFlags.has(me.Experimental)) && o.syntaxFlags.add(me.Experimental), "number" == typeof o.alpha && (o.alpha = o.alpha * a.alphaMultiplier, 2 !== a.colors.length && o.syntaxFlags.add(me.ColorMixVariadic), o));
5250
+ const l = n[0]?.color;
5251
+ return !!l && "number" == typeof l.alpha && (l.alpha = l.alpha * o, a.some((e) => e.color.syntaxFlags.has(me.Experimental)) && l.syntaxFlags.add(me.Experimental), 2 !== a.length && l.syntaxFlags.add(me.ColorMixVariadic), l);
5293
5252
  }
5294
- function colorMixRectangularPair(e, a, n, r, o) {
5295
- const l = n / (n + o);
5296
- let t = a.alpha;
5253
+ function colorMixRectangularPair(e, a, n, r) {
5254
+ let o = a.alpha;
5255
+ if ("number" != typeof o) return !1;
5256
+ let t = n.alpha;
5297
5257
  if ("number" != typeof t) return !1;
5298
- let s = r.alpha;
5299
- if ("number" != typeof s) return !1;
5300
- t = Number.isNaN(t) ? s : t, s = Number.isNaN(s) ? t : s;
5301
- const u = colorDataTo(a, e).channels, i = colorDataTo(r, e).channels;
5302
- u[0] = fillInMissingComponent(u[0], i[0]), i[0] = fillInMissingComponent(i[0], u[0]), u[1] = fillInMissingComponent(u[1], i[1]), i[1] = fillInMissingComponent(i[1], u[1]), u[2] = fillInMissingComponent(u[2], i[2]), i[2] = fillInMissingComponent(i[2], u[2]), u[0] = premultiply(u[0], t), u[1] = premultiply(u[1], t), u[2] = premultiply(u[2], t), i[0] = premultiply(i[0], s), i[1] = premultiply(i[1], s), i[2] = premultiply(i[2], s);
5303
- const c = interpolate(t, s, l);
5258
+ o = Number.isNaN(o) ? t : o, t = Number.isNaN(t) ? o : t;
5259
+ const l = colorDataTo(a, e).channels, s = colorDataTo(n, e).channels;
5260
+ l[0] = fillInMissingComponent(l[0], s[0]), s[0] = fillInMissingComponent(s[0], l[0]), l[1] = fillInMissingComponent(l[1], s[1]), s[1] = fillInMissingComponent(s[1], l[1]), l[2] = fillInMissingComponent(l[2], s[2]), s[2] = fillInMissingComponent(s[2], l[2]), l[0] = premultiply(l[0], o), l[1] = premultiply(l[1], o), l[2] = premultiply(l[2], o), s[0] = premultiply(s[0], t), s[1] = premultiply(s[1], t), s[2] = premultiply(s[2], t);
5261
+ const u = interpolate(o, t, r);
5304
5262
  return {
5305
5263
  colorNotation: e,
5306
5264
  channels: [
5307
- un_premultiply(interpolate(u[0], i[0], l), c),
5308
- un_premultiply(interpolate(u[1], i[1], l), c),
5309
- un_premultiply(interpolate(u[2], i[2], l), c)
5265
+ un_premultiply(interpolate(l[0], s[0], r), u),
5266
+ un_premultiply(interpolate(l[1], s[1], r), u),
5267
+ un_premultiply(interpolate(l[2], s[2], r), u)
5310
5268
  ],
5311
- alpha: c,
5269
+ alpha: u,
5312
5270
  syntaxFlags: new Set([me.ColorMix])
5313
5271
  };
5314
5272
  }
5315
5273
  function colorMixPolar(e, a, n) {
5316
- if (!n || !n.colors.length) return !1;
5317
- const r = n.colors.slice();
5318
- let o;
5319
- switch (r.reverse(), e) {
5274
+ if (!n || !n.length) return !1;
5275
+ for (const e of n) if (e.percentage && (e.percentage < 0 || e.percentage > 100)) return !1;
5276
+ const { items: r, leftover: o } = normalizeMixPercentages(n, !0), t = 1 - o / 100;
5277
+ let l;
5278
+ switch (e) {
5320
5279
  case "hsl":
5321
- o = he.HSL;
5280
+ l = he.HSL;
5322
5281
  break;
5323
5282
  case "hwb":
5324
- o = he.HWB;
5283
+ l = he.HWB;
5325
5284
  break;
5326
5285
  case "lch":
5327
- o = he.LCH;
5286
+ l = he.LCH;
5328
5287
  break;
5329
5288
  case "oklch":
5330
- o = he.OKLCH;
5289
+ l = he.OKLCH;
5331
5290
  break;
5332
5291
  default: return !1;
5333
5292
  }
5334
5293
  if (1 === r.length) {
5335
- const e = colorDataTo(r[0].color, o);
5336
- return e.colorNotation = o, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * n.alphaMultiplier, e);
5294
+ const e = colorDataTo(r[0].color, l);
5295
+ return e.colorNotation = l, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * t, e);
5337
5296
  }
5338
- for (; r.length >= 2;) {
5297
+ for (r.reverse(); r.length >= 2;) {
5339
5298
  const e = r.pop(), n = r.pop();
5340
5299
  if (!e || !n) return !1;
5341
- const l = colorMixPolarPair(o, a, e.color, e.percentage, n.color, n.percentage);
5342
- if (!l) return !1;
5300
+ const o = e.percentage + n.percentage, t = o > 0 ? n.percentage / o : .5, s = colorMixPolarPair(l, a, e.color, n.color, t);
5301
+ if (!s) return !1;
5343
5302
  r.push({
5344
- color: l,
5345
- percentage: e.percentage + n.percentage
5303
+ color: s,
5304
+ percentage: o
5346
5305
  });
5347
5306
  }
5348
- const l = r[0]?.color;
5349
- return !!l && (n.colors.some((e) => e.color.syntaxFlags.has(me.Experimental)) && l.syntaxFlags.add(me.Experimental), "number" == typeof l.alpha && (l.alpha = l.alpha * n.alphaMultiplier, 2 !== n.colors.length && l.syntaxFlags.add(me.ColorMixVariadic), l));
5350
- }
5351
- function colorMixPolarPair(e, a, n, r, o, l) {
5352
- const t = r / (r + l);
5353
- let s = 0, u = 0, i = 0, c = 0, h = 0, m = 0, p = n.alpha;
5354
- if ("number" != typeof p) return !1;
5355
- let N = o.alpha;
5356
- if ("number" != typeof N) return !1;
5357
- p = Number.isNaN(p) ? N : p, N = Number.isNaN(N) ? p : N;
5358
- const b = colorDataTo(n, e).channels, g = colorDataTo(o, e).channels;
5307
+ const s = r[0]?.color;
5308
+ return !!s && "number" == typeof s.alpha && (s.alpha = s.alpha * t, n.some((e) => e.color.syntaxFlags.has(me.Experimental)) && s.syntaxFlags.add(me.Experimental), 2 !== n.length && s.syntaxFlags.add(me.ColorMixVariadic), s);
5309
+ }
5310
+ function colorMixPolarPair(e, a, n, r, o) {
5311
+ let t = 0, l = 0, s = 0, u = 0, i = 0, c = 0, h = n.alpha;
5312
+ if ("number" != typeof h) return !1;
5313
+ let m = r.alpha;
5314
+ if ("number" != typeof m) return !1;
5315
+ h = Number.isNaN(h) ? m : h, m = Number.isNaN(m) ? h : m;
5316
+ const N = colorDataTo(n, e).channels, p = colorDataTo(r, e).channels;
5359
5317
  switch (e) {
5360
5318
  case he.HSL:
5361
5319
  case he.HWB:
5362
- s = b[0], u = g[0], i = b[1], c = g[1], h = b[2], m = g[2];
5320
+ t = N[0], l = p[0], s = N[1], u = p[1], i = N[2], c = p[2];
5363
5321
  break;
5364
5322
  case he.LCH:
5365
- case he.OKLCH: i = b[0], c = g[0], h = b[1], m = g[1], s = b[2], u = g[2];
5323
+ case he.OKLCH: s = N[0], u = p[0], i = N[1], c = p[1], t = N[2], l = p[2];
5366
5324
  }
5367
- s = fillInMissingComponent(s, u), Number.isNaN(s) && (s = 0), u = fillInMissingComponent(u, s), Number.isNaN(u) && (u = 0), i = fillInMissingComponent(i, c), c = fillInMissingComponent(c, i), h = fillInMissingComponent(h, m), m = fillInMissingComponent(m, h);
5368
- const v = u - s;
5369
- switch (a) {
5370
- case "shorter":
5371
- v > 180 ? s += 360 : v < -180 && (u += 360);
5372
- break;
5373
- case "longer":
5374
- -180 < v && v < 180 && (v > 0 ? s += 360 : u += 360);
5375
- break;
5376
- case "increasing":
5377
- v < 0 && (u += 360);
5378
- break;
5379
- case "decreasing":
5380
- v > 0 && (s += 360);
5381
- break;
5382
- default: throw new Error("Unknown hue interpolation method");
5325
+ if (s = fillInMissingComponent(s, u), u = fillInMissingComponent(u, s), i = fillInMissingComponent(i, c), c = fillInMissingComponent(c, i), t = fillInMissingComponent(t, l), l = fillInMissingComponent(l, t), Number.isNaN(t) && Number.isNaN(l));
5326
+ else {
5327
+ Number.isNaN(t) ? t = 0 : Number.isNaN(l) && (l = 0);
5328
+ const e = l - t;
5329
+ switch (a) {
5330
+ case "shorter":
5331
+ e > 180 ? t += 360 : e < -180 && (l += 360);
5332
+ break;
5333
+ case "longer":
5334
+ -180 < e && e < 180 && (e > 0 ? t += 360 : l += 360);
5335
+ break;
5336
+ case "increasing":
5337
+ e < 0 && (l += 360);
5338
+ break;
5339
+ case "decreasing":
5340
+ e > 0 && (t += 360);
5341
+ break;
5342
+ default: throw new Error("Unknown hue interpolation method");
5343
+ }
5383
5344
  }
5384
- i = premultiply(i, p), h = premultiply(h, p), c = premultiply(c, N), m = premultiply(m, N);
5385
- let f = [
5345
+ s = premultiply(s, h), i = premultiply(i, h), u = premultiply(u, m), c = premultiply(c, m);
5346
+ let b = [
5386
5347
  0,
5387
5348
  0,
5388
5349
  0
5389
5350
  ];
5390
- const y = interpolate(p, N, t);
5351
+ const v = interpolate(h, m, o);
5391
5352
  switch (e) {
5392
5353
  case he.HSL:
5393
5354
  case he.HWB:
5394
- f = [
5395
- interpolate(s, u, t),
5396
- un_premultiply(interpolate(i, c, t), y),
5397
- un_premultiply(interpolate(h, m, t), y)
5355
+ b = [
5356
+ interpolate(t, l, o),
5357
+ un_premultiply(interpolate(s, u, o), v),
5358
+ un_premultiply(interpolate(i, c, o), v)
5398
5359
  ];
5399
5360
  break;
5400
5361
  case he.LCH:
5401
- case he.OKLCH: f = [
5402
- un_premultiply(interpolate(i, c, t), y),
5403
- un_premultiply(interpolate(h, m, t), y),
5404
- interpolate(s, u, t)
5362
+ case he.OKLCH: b = [
5363
+ un_premultiply(interpolate(s, u, o), v),
5364
+ un_premultiply(interpolate(i, c, o), v),
5365
+ interpolate(t, l, o)
5405
5366
  ];
5406
5367
  }
5407
5368
  return {
5408
5369
  colorNotation: e,
5409
- channels: f,
5410
- alpha: y,
5370
+ channels: b,
5371
+ alpha: v,
5411
5372
  syntaxFlags: new Set([me.ColorMix])
5412
5373
  };
5413
5374
  }
@@ -5415,7 +5376,7 @@ function fillInMissingComponent(e, a) {
5415
5376
  return Number.isNaN(e) ? a : e;
5416
5377
  }
5417
5378
  function interpolate(e, a, n) {
5418
- return e * n + a * (1 - n);
5379
+ return e * (1 - n) + a * n;
5419
5380
  }
5420
5381
  function premultiply(e, a) {
5421
5382
  return Number.isNaN(a) ? e : Number.isNaN(e) ? NaN : e * a;
@@ -5423,6 +5384,21 @@ function premultiply(e, a) {
5423
5384
  function un_premultiply(e, a) {
5424
5385
  return 0 === a || Number.isNaN(a) ? e : Number.isNaN(e) ? NaN : e / a;
5425
5386
  }
5387
+ function normalizeMixPercentages(e, a = !1) {
5388
+ let n = 0, r = 0;
5389
+ for (const a of e) a.percentage && (n += a.percentage), !1 === a.percentage && r++;
5390
+ n = Math.min(100, n);
5391
+ for (const a of e) !1 === a.percentage && (a.percentage = (100 - n) / r);
5392
+ const o = e.slice();
5393
+ let t = 0;
5394
+ for (const e of o) t += e.percentage;
5395
+ if (t > 100 || t > 0 && a) for (const e of o) e.percentage = e.percentage * (100 / t);
5396
+ let l = 0;
5397
+ return t < 100 && (l = 100 - t), {
5398
+ items: o,
5399
+ leftover: l
5400
+ };
5401
+ }
5426
5402
  function hex(e) {
5427
5403
  const a = toLowerCaseAZ(e[4].value);
5428
5404
  if (a.match(/[^a-f0-9]/)) return !1;
@@ -5453,25 +5429,25 @@ function hex(e) {
5453
5429
  ], n;
5454
5430
  }
5455
5431
  if (4 === r) {
5456
- const e = a[0], r = a[1], o = a[2], l = a[3];
5432
+ const e = a[0], r = a[1], o = a[2], t = a[3];
5457
5433
  return n.channels = [
5458
5434
  parseInt(e + e, 16) / 255,
5459
5435
  parseInt(r + r, 16) / 255,
5460
5436
  parseInt(o + o, 16) / 255
5461
- ], n.alpha = parseInt(l + l, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5437
+ ], n.alpha = parseInt(t + t, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5462
5438
  }
5463
5439
  if (8 === r) {
5464
- const e = a[0] + a[1], r = a[2] + a[3], o = a[4] + a[5], l = a[6] + a[7];
5440
+ const e = a[0] + a[1], r = a[2] + a[3], o = a[4] + a[5], t = a[6] + a[7];
5465
5441
  return n.channels = [
5466
5442
  parseInt(e, 16) / 255,
5467
5443
  parseInt(r, 16) / 255,
5468
5444
  parseInt(o, 16) / 255
5469
- ], n.alpha = parseInt(l, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5445
+ ], n.alpha = parseInt(t, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5470
5446
  }
5471
5447
  return !1;
5472
5448
  }
5473
5449
  function normalizeHue(n) {
5474
- if (isTokenNumber(n)) return n[4].value = n[4].value % 360, n[1] = n[4].value.toString(), n;
5450
+ if (isTokenNumber(n)) return Number.isNaN(n[4].value) || Number.isFinite(n[4].value) || (n[4].value = 0), n[4].value = n[4].value % 360, n[4].value < 0 && (n[4].value += 360), n[1] = n[4].value.toString(), n;
5475
5451
  if (isTokenDimension(n)) {
5476
5452
  let r = n[4].value;
5477
5453
  switch (toLowerCaseAZ(n[4].unit)) {
@@ -5487,7 +5463,7 @@ function normalizeHue(n) {
5487
5463
  break;
5488
5464
  default: return !1;
5489
5465
  }
5490
- return r %= 360, [
5466
+ return Number.isNaN(n[4].value) || Number.isFinite(n[4].value) || (n[4].value = 0), r %= 360, r < 0 && (r += 360), [
5491
5467
  c$7.Number,
5492
5468
  r.toString(),
5493
5469
  n[2],
@@ -5500,15 +5476,15 @@ function normalizeHue(n) {
5500
5476
  }
5501
5477
  return !1;
5502
5478
  }
5503
- function normalize_legacy_HSL_ChannelValues(n, l, t) {
5504
- if (0 === l) {
5479
+ function normalize_legacy_HSL_ChannelValues(n, t, l) {
5480
+ if (0 === t) {
5505
5481
  const e = normalizeHue(n);
5506
- return !1 !== e && (isTokenDimension(n) && t.syntaxFlags.add(me.HasDimensionValues), e);
5482
+ return !1 !== e && (isTokenDimension(n) && l.syntaxFlags.add(me.HasDimensionValues), e);
5507
5483
  }
5508
5484
  if (isTokenPercentage(n)) {
5509
- 3 === l ? t.syntaxFlags.add(me.HasPercentageAlpha) : t.syntaxFlags.add(me.HasPercentageValues);
5485
+ 3 === t ? l.syntaxFlags.add(me.HasPercentageAlpha) : l.syntaxFlags.add(me.HasPercentageValues);
5510
5486
  let r = normalize(n[4].value, 1, 0, 100);
5511
- return 3 === l && (r = normalize(n[4].value, 100, 0, 1)), [
5487
+ return 3 === t && (r = normalize(n[4].value, 100, 0, 1)), [
5512
5488
  c$7.Number,
5513
5489
  r.toString(),
5514
5490
  n[2],
@@ -5520,9 +5496,9 @@ function normalize_legacy_HSL_ChannelValues(n, l, t) {
5520
5496
  ];
5521
5497
  }
5522
5498
  if (isTokenNumber(n)) {
5523
- if (3 !== l) return !1;
5499
+ if (3 !== t) return !1;
5524
5500
  let r = normalize(n[4].value, 1, 0, 100);
5525
- return 3 === l && (r = normalize(n[4].value, 1, 0, 1)), [
5501
+ return 3 === t && (r = normalize(n[4].value, 1, 0, 1)), [
5526
5502
  c$7.Number,
5527
5503
  r.toString(),
5528
5504
  n[2],
@@ -5535,43 +5511,43 @@ function normalize_legacy_HSL_ChannelValues(n, l, t) {
5535
5511
  }
5536
5512
  return !1;
5537
5513
  }
5538
- function normalize_modern_HSL_ChannelValues(l, t, s) {
5539
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5514
+ function normalize_modern_HSL_ChannelValues(t, l, s) {
5515
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5540
5516
  c$7.Number,
5541
5517
  "none",
5542
- l[2],
5543
- l[3],
5518
+ t[2],
5519
+ t[3],
5544
5520
  {
5545
5521
  value: NaN,
5546
5522
  type: a$8.Number
5547
5523
  }
5548
5524
  ];
5549
- if (0 === t) {
5550
- const e = normalizeHue(l);
5551
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5525
+ if (0 === l) {
5526
+ const e = normalizeHue(t);
5527
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5552
5528
  }
5553
- if (isTokenPercentage(l)) {
5554
- 3 === t ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5555
- let n = l[4].value;
5556
- return 3 === t ? n = normalize(l[4].value, 100, 0, 1) : 1 === t && (n = normalize(l[4].value, 1, 0, 2147483647)), [
5529
+ if (isTokenPercentage(t)) {
5530
+ 3 === l ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5531
+ let n = t[4].value;
5532
+ return 3 === l ? n = normalize(t[4].value, 100, 0, 1) : 1 === l && (n = normalize(t[4].value, 1, 0, 2147483647)), [
5557
5533
  c$7.Number,
5558
5534
  n.toString(),
5559
- l[2],
5560
- l[3],
5535
+ t[2],
5536
+ t[3],
5561
5537
  {
5562
5538
  value: n,
5563
5539
  type: a$8.Number
5564
5540
  }
5565
5541
  ];
5566
5542
  }
5567
- if (isTokenNumber(l)) {
5568
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5569
- let n = l[4].value;
5570
- return 3 === t ? n = normalize(l[4].value, 1, 0, 1) : 1 === t && (n = normalize(l[4].value, 1, 0, 2147483647)), [
5543
+ if (isTokenNumber(t)) {
5544
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5545
+ let n = t[4].value;
5546
+ return 3 === l ? n = normalize(t[4].value, 1, 0, 1) : 1 === l && (n = normalize(t[4].value, 1, 0, 2147483647)), [
5571
5547
  c$7.Number,
5572
5548
  n.toString(),
5573
- l[2],
5574
- l[3],
5549
+ t[2],
5550
+ t[3],
5575
5551
  {
5576
5552
  value: n,
5577
5553
  type: a$8.Number
@@ -5581,7 +5557,7 @@ function normalize_modern_HSL_ChannelValues(l, t, s) {
5581
5557
  return !1;
5582
5558
  }
5583
5559
  function threeChannelLegacySyntax(e, a, n, r) {
5584
- const l = [], u = [], i = [], c = [], h = {
5560
+ const t = [], u = [], i = [], c = [], h = {
5585
5561
  colorNotation: n,
5586
5562
  channels: [
5587
5563
  0,
@@ -5591,12 +5567,12 @@ function threeChannelLegacySyntax(e, a, n, r) {
5591
5567
  alpha: 1,
5592
5568
  syntaxFlags: new Set(r)
5593
5569
  };
5594
- let m = l;
5570
+ let m = t;
5595
5571
  for (let a = 0; a < e.value.length; a++) {
5596
5572
  let n = e.value[a];
5597
5573
  if (!isWhitespaceNode(n) && !isCommentNode(n)) {
5598
5574
  if (isTokenNode(n) && isTokenComma(n.value)) {
5599
- if (m === l) {
5575
+ if (m === t) {
5600
5576
  m = u;
5601
5577
  continue;
5602
5578
  }
@@ -5630,34 +5606,34 @@ function threeChannelLegacySyntax(e, a, n, r) {
5630
5606
  }
5631
5607
  }
5632
5608
  if (1 !== m.length) return !1;
5633
- if (1 !== l.length || 1 !== u.length || 1 !== i.length) return !1;
5634
- if (!isTokenNode(l[0]) || !isTokenNode(u[0]) || !isTokenNode(i[0])) return !1;
5635
- const p = a(l[0].value, 0, h);
5636
- if (!p || !isTokenNumber(p)) return !1;
5637
- const N = a(u[0].value, 1, h);
5609
+ if (1 !== t.length || 1 !== u.length || 1 !== i.length) return !1;
5610
+ if (!isTokenNode(t[0]) || !isTokenNode(u[0]) || !isTokenNode(i[0])) return !1;
5611
+ const N = a(t[0].value, 0, h);
5638
5612
  if (!N || !isTokenNumber(N)) return !1;
5613
+ const p = a(u[0].value, 1, h);
5614
+ if (!p || !isTokenNumber(p)) return !1;
5639
5615
  const b = a(i[0].value, 2, h);
5640
5616
  if (!b || !isTokenNumber(b)) return !1;
5641
- const g = [
5642
- p,
5617
+ const v = [
5643
5618
  N,
5619
+ p,
5644
5620
  b
5645
5621
  ];
5646
5622
  if (1 === c.length) if (h.syntaxFlags.add(me.HasAlpha), isTokenNode(c[0])) {
5647
5623
  const e = a(c[0].value, 3, h);
5648
5624
  if (!e || !isTokenNumber(e)) return !1;
5649
- g.push(e);
5625
+ v.push(e);
5650
5626
  } else h.alpha = c[0];
5651
5627
  return h.channels = [
5652
- g[0][4].value,
5653
- g[1][4].value,
5654
- g[2][4].value
5655
- ], 4 === g.length && (h.alpha = g[3][4].value), h;
5628
+ v[0][4].value,
5629
+ v[1][4].value,
5630
+ v[2][4].value
5631
+ ], 4 === v.length && (h.alpha = v[3][4].value), h;
5656
5632
  }
5657
5633
  function threeChannelSpaceSeparated(e, a, r, s, u) {
5658
5634
  const i = [], c = [], h = [], m = [];
5659
- let p, N, b = !1;
5660
- const g = {
5635
+ let N, p, b = !1;
5636
+ const v = {
5661
5637
  colorNotation: r,
5662
5638
  channels: [
5663
5639
  0,
@@ -5667,23 +5643,23 @@ function threeChannelSpaceSeparated(e, a, r, s, u) {
5667
5643
  alpha: 1,
5668
5644
  syntaxFlags: new Set(s)
5669
5645
  };
5670
- let v = i;
5646
+ let f = i;
5671
5647
  for (let a = 0; a < e.value.length; a++) {
5672
5648
  let o = e.value[a];
5673
5649
  if (isWhitespaceNode(o) || isCommentNode(o)) for (; isWhitespaceNode(e.value[a + 1]) || isCommentNode(e.value[a + 1]);) a++;
5674
- else if (v === i && i.length && (v = c), v === c && c.length && (v = h), isTokenNode(o) && isTokenDelim(o.value) && "/" === o.value[4].value) {
5675
- if (v === m) return !1;
5676
- v = m;
5650
+ else if (f === i && i.length && (f = c), f === c && c.length && (f = h), isTokenNode(o) && isTokenDelim(o.value) && "/" === o.value[4].value) {
5651
+ if (f === m) return !1;
5652
+ f = m;
5677
5653
  } else {
5678
5654
  if (isFunctionNode(o)) {
5679
- if (v === m && "var" === o.getName().toLowerCase()) {
5680
- g.syntaxFlags.add(me.HasVariableAlpha), v.push(o);
5655
+ if (f === m && "var" === o.getName().toLowerCase()) {
5656
+ v.syntaxFlags.add(me.HasVariableAlpha), f.push(o);
5681
5657
  continue;
5682
5658
  }
5683
5659
  if (!Q$1.has(o.getName().toLowerCase())) return !1;
5684
5660
  const [[e]] = calcFromComponentValues([[o]], {
5685
5661
  censorIntoStandardRepresentableValues: !0,
5686
- globals: N,
5662
+ globals: p,
5687
5663
  precision: -1,
5688
5664
  toCanonicalUnits: !0,
5689
5665
  rawPercentages: !0
@@ -5691,54 +5667,54 @@ function threeChannelSpaceSeparated(e, a, r, s, u) {
5691
5667
  if (!e || !isTokenNode(e) || !isTokenNumeric(e.value)) return !1;
5692
5668
  Number.isNaN(e.value[4].value) && (e.value[4].value = 0), o = e;
5693
5669
  }
5694
- if (v === i && 0 === i.length && isTokenNode(o) && isTokenIdent(o.value) && "from" === o.value[4].value.toLowerCase()) {
5670
+ if (f === i && 0 === i.length && isTokenNode(o) && isTokenIdent(o.value) && "from" === o.value[4].value.toLowerCase()) {
5695
5671
  if (b) return !1;
5696
5672
  for (; isWhitespaceNode(e.value[a + 1]) || isCommentNode(e.value[a + 1]);) a++;
5697
5673
  if (a++, o = e.value[a], b = u(o), !1 === b) return !1;
5698
- b.syntaxFlags.has(me.Experimental) && g.syntaxFlags.add(me.Experimental), g.syntaxFlags.add(me.RelativeColorSyntax), b.colorNotation !== r && (b = colorDataTo(b, r)), p = normalizeRelativeColorDataChannels(b), N = noneToZeroInRelativeColorDataChannels(p);
5674
+ b.syntaxFlags.has(me.Experimental) && v.syntaxFlags.add(me.Experimental), v.syntaxFlags.add(me.RelativeColorSyntax), b.colorNotation !== r && (b = colorDataTo(b, r)), N = normalizeRelativeColorDataChannels(b), p = noneToZeroInRelativeColorDataChannels(N);
5699
5675
  } else {
5700
5676
  if (!isTokenNode(o)) return !1;
5701
- if (isTokenIdent(o.value) && p) {
5677
+ if (isTokenIdent(o.value) && N) {
5702
5678
  const e = o.value[4].value.toLowerCase();
5703
- if (p.has(e)) {
5704
- v.push(new TokenNode(p.get(e)));
5679
+ if (N.has(e)) {
5680
+ f.push(new TokenNode(N.get(e)));
5705
5681
  continue;
5706
5682
  }
5707
5683
  }
5708
- v.push(o);
5684
+ f.push(o);
5709
5685
  }
5710
5686
  }
5711
5687
  }
5712
- if (1 !== v.length) return !1;
5688
+ if (1 !== f.length) return !1;
5713
5689
  if (1 !== i.length || 1 !== c.length || 1 !== h.length) return !1;
5714
5690
  if (!isTokenNode(i[0]) || !isTokenNode(c[0]) || !isTokenNode(h[0])) return !1;
5715
- if (p && !p.has("alpha")) return !1;
5716
- const f = a(i[0].value, 0, g);
5717
- if (!f || !isTokenNumber(f)) return !1;
5718
- const y = a(c[0].value, 1, g);
5691
+ if (N && !N.has("alpha")) return !1;
5692
+ const g = a(i[0].value, 0, v);
5693
+ if (!g || !isTokenNumber(g)) return !1;
5694
+ const y = a(c[0].value, 1, v);
5719
5695
  if (!y || !isTokenNumber(y)) return !1;
5720
- const d = a(h[0].value, 2, g);
5696
+ const d = a(h[0].value, 2, v);
5721
5697
  if (!d || !isTokenNumber(d)) return !1;
5722
5698
  const _ = [
5723
- f,
5699
+ g,
5724
5700
  y,
5725
5701
  d
5726
5702
  ];
5727
- if (1 === m.length) if (g.syntaxFlags.add(me.HasAlpha), isTokenNode(m[0])) {
5728
- const e = a(m[0].value, 3, g);
5703
+ if (1 === m.length) if (v.syntaxFlags.add(me.HasAlpha), isTokenNode(m[0])) {
5704
+ const e = a(m[0].value, 3, v);
5729
5705
  if (!e || !isTokenNumber(e)) return !1;
5730
5706
  _.push(e);
5731
- } else g.alpha = m[0];
5732
- else if (p && p.has("alpha")) {
5733
- const e = a(p.get("alpha"), 3, g);
5707
+ } else v.alpha = m[0];
5708
+ else if (N && N.has("alpha")) {
5709
+ const e = a(N.get("alpha"), 3, v);
5734
5710
  if (!e || !isTokenNumber(e)) return !1;
5735
5711
  _.push(e);
5736
5712
  }
5737
- return g.channels = [
5713
+ return v.channels = [
5738
5714
  _[0][4].value,
5739
5715
  _[1][4].value,
5740
5716
  _[2][4].value
5741
- ], 4 === _.length && (g.alpha = _[3][4].value), g;
5717
+ ], 4 === _.length && (v.alpha = _[3][4].value), v;
5742
5718
  }
5743
5719
  function hsl(e, a) {
5744
5720
  if (e.value.some((e) => isTokenNode(e) && isTokenComma(e.value))) {
@@ -5757,43 +5733,43 @@ function hslCommaSeparated(e) {
5757
5733
  function hslSpaceSeparated(e, a) {
5758
5734
  return threeChannelSpaceSeparated(e, normalize_modern_HSL_ChannelValues, he.HSL, [], a);
5759
5735
  }
5760
- function normalize_HWB_ChannelValues(l, t, s) {
5761
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5736
+ function normalize_HWB_ChannelValues(t, l, s) {
5737
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5762
5738
  c$7.Number,
5763
5739
  "none",
5764
- l[2],
5765
- l[3],
5740
+ t[2],
5741
+ t[3],
5766
5742
  {
5767
5743
  value: NaN,
5768
5744
  type: a$8.Number
5769
5745
  }
5770
5746
  ];
5771
- if (0 === t) {
5772
- const e = normalizeHue(l);
5773
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5747
+ if (0 === l) {
5748
+ const e = normalizeHue(t);
5749
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5774
5750
  }
5775
- if (isTokenPercentage(l)) {
5776
- 3 === t ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5777
- let n = l[4].value;
5778
- return 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5751
+ if (isTokenPercentage(t)) {
5752
+ 3 === l ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5753
+ let n = t[4].value;
5754
+ return 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5779
5755
  c$7.Number,
5780
5756
  n.toString(),
5781
- l[2],
5782
- l[3],
5757
+ t[2],
5758
+ t[3],
5783
5759
  {
5784
5760
  value: n,
5785
5761
  type: a$8.Number
5786
5762
  }
5787
5763
  ];
5788
5764
  }
5789
- if (isTokenNumber(l)) {
5790
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5791
- let n = l[4].value;
5792
- return 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5765
+ if (isTokenNumber(t)) {
5766
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5767
+ let n = t[4].value;
5768
+ return 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5793
5769
  c$7.Number,
5794
5770
  n.toString(),
5795
- l[2],
5796
- l[3],
5771
+ t[2],
5772
+ t[3],
5797
5773
  {
5798
5774
  value: n,
5799
5775
  type: a$8.Number
@@ -5802,39 +5778,39 @@ function normalize_HWB_ChannelValues(l, t, s) {
5802
5778
  }
5803
5779
  return !1;
5804
5780
  }
5805
- function normalize_Lab_ChannelValues(l, t, s) {
5806
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5781
+ function normalize_Lab_ChannelValues(t, l, s) {
5782
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5807
5783
  c$7.Number,
5808
5784
  "none",
5809
- l[2],
5810
- l[3],
5785
+ t[2],
5786
+ t[3],
5811
5787
  {
5812
5788
  value: NaN,
5813
5789
  type: a$8.Number
5814
5790
  }
5815
5791
  ];
5816
- if (isTokenPercentage(l)) {
5817
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5818
- let n = normalize(l[4].value, 1, 0, 100);
5819
- return 1 === t || 2 === t ? n = normalize(l[4].value, .8, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5792
+ if (isTokenPercentage(t)) {
5793
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5794
+ let n = normalize(t[4].value, 1, 0, 100);
5795
+ return 1 === l || 2 === l ? n = normalize(t[4].value, .8, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5820
5796
  c$7.Number,
5821
5797
  n.toString(),
5822
- l[2],
5823
- l[3],
5798
+ t[2],
5799
+ t[3],
5824
5800
  {
5825
5801
  value: n,
5826
5802
  type: a$8.Number
5827
5803
  }
5828
5804
  ];
5829
5805
  }
5830
- if (isTokenNumber(l)) {
5831
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5832
- let n = normalize(l[4].value, 1, 0, 100);
5833
- return 1 === t || 2 === t ? n = normalize(l[4].value, 1, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5806
+ if (isTokenNumber(t)) {
5807
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5808
+ let n = normalize(t[4].value, 1, 0, 100);
5809
+ return 1 === l || 2 === l ? n = normalize(t[4].value, 1, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5834
5810
  c$7.Number,
5835
5811
  n.toString(),
5836
- l[2],
5837
- l[3],
5812
+ t[2],
5813
+ t[3],
5838
5814
  {
5839
5815
  value: n,
5840
5816
  type: a$8.Number
@@ -5846,43 +5822,43 @@ function normalize_Lab_ChannelValues(l, t, s) {
5846
5822
  function lab(e, a) {
5847
5823
  return threeChannelSpaceSeparated(e, normalize_Lab_ChannelValues, he.Lab, [], a);
5848
5824
  }
5849
- function normalize_LCH_ChannelValues(l, t, s) {
5850
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5825
+ function normalize_LCH_ChannelValues(t, l, s) {
5826
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5851
5827
  c$7.Number,
5852
5828
  "none",
5853
- l[2],
5854
- l[3],
5829
+ t[2],
5830
+ t[3],
5855
5831
  {
5856
5832
  value: NaN,
5857
5833
  type: a$8.Number
5858
5834
  }
5859
5835
  ];
5860
- if (2 === t) {
5861
- const e = normalizeHue(l);
5862
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5863
- }
5864
- if (isTokenPercentage(l)) {
5865
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5866
- let n = normalize(l[4].value, 1, 0, 100);
5867
- return 1 === t ? n = normalize(l[4].value, 100 / 150, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5836
+ if (2 === l) {
5837
+ const e = normalizeHue(t);
5838
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5839
+ }
5840
+ if (isTokenPercentage(t)) {
5841
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5842
+ let n = normalize(t[4].value, 1, 0, 100);
5843
+ return 1 === l ? n = normalize(t[4].value, 100 / 150, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5868
5844
  c$7.Number,
5869
5845
  n.toString(),
5870
- l[2],
5871
- l[3],
5846
+ t[2],
5847
+ t[3],
5872
5848
  {
5873
5849
  value: n,
5874
5850
  type: a$8.Number
5875
5851
  }
5876
5852
  ];
5877
5853
  }
5878
- if (isTokenNumber(l)) {
5879
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5880
- let n = normalize(l[4].value, 1, 0, 100);
5881
- return 1 === t ? n = normalize(l[4].value, 1, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5854
+ if (isTokenNumber(t)) {
5855
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5856
+ let n = normalize(t[4].value, 1, 0, 100);
5857
+ return 1 === l ? n = normalize(t[4].value, 1, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5882
5858
  c$7.Number,
5883
5859
  n.toString(),
5884
- l[2],
5885
- l[3],
5860
+ t[2],
5861
+ t[3],
5886
5862
  {
5887
5863
  value: n,
5888
5864
  type: a$8.Number
@@ -5909,39 +5885,39 @@ function namedColor(e) {
5909
5885
  syntaxFlags: new Set([me.ColorKeyword, me.NamedColor])
5910
5886
  };
5911
5887
  }
5912
- function normalize_OKLab_ChannelValues(l, t, s) {
5913
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5888
+ function normalize_OKLab_ChannelValues(t, l, s) {
5889
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5914
5890
  c$7.Number,
5915
5891
  "none",
5916
- l[2],
5917
- l[3],
5892
+ t[2],
5893
+ t[3],
5918
5894
  {
5919
5895
  value: NaN,
5920
5896
  type: a$8.Number
5921
5897
  }
5922
5898
  ];
5923
- if (isTokenPercentage(l)) {
5924
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5925
- let n = normalize(l[4].value, 100, 0, 1);
5926
- return 1 === t || 2 === t ? n = normalize(l[4].value, 250, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5899
+ if (isTokenPercentage(t)) {
5900
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5901
+ let n = normalize(t[4].value, 100, 0, 1);
5902
+ return 1 === l || 2 === l ? n = normalize(t[4].value, 250, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5927
5903
  c$7.Number,
5928
5904
  n.toString(),
5929
- l[2],
5930
- l[3],
5905
+ t[2],
5906
+ t[3],
5931
5907
  {
5932
5908
  value: n,
5933
5909
  type: a$8.Number
5934
5910
  }
5935
5911
  ];
5936
5912
  }
5937
- if (isTokenNumber(l)) {
5938
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5939
- let n = normalize(l[4].value, 1, 0, 1);
5940
- return 1 === t || 2 === t ? n = normalize(l[4].value, 1, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5913
+ if (isTokenNumber(t)) {
5914
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5915
+ let n = normalize(t[4].value, 1, 0, 1);
5916
+ return 1 === l || 2 === l ? n = normalize(t[4].value, 1, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5941
5917
  c$7.Number,
5942
5918
  n.toString(),
5943
- l[2],
5944
- l[3],
5919
+ t[2],
5920
+ t[3],
5945
5921
  {
5946
5922
  value: n,
5947
5923
  type: a$8.Number
@@ -5953,43 +5929,43 @@ function normalize_OKLab_ChannelValues(l, t, s) {
5953
5929
  function oklab(e, a) {
5954
5930
  return threeChannelSpaceSeparated(e, normalize_OKLab_ChannelValues, he.OKLab, [], a);
5955
5931
  }
5956
- function normalize_OKLCH_ChannelValues(l, t, s) {
5957
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5932
+ function normalize_OKLCH_ChannelValues(t, l, s) {
5933
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5958
5934
  c$7.Number,
5959
5935
  "none",
5960
- l[2],
5961
- l[3],
5936
+ t[2],
5937
+ t[3],
5962
5938
  {
5963
5939
  value: NaN,
5964
5940
  type: a$8.Number
5965
5941
  }
5966
5942
  ];
5967
- if (2 === t) {
5968
- const e = normalizeHue(l);
5969
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5970
- }
5971
- if (isTokenPercentage(l)) {
5972
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5973
- let n = normalize(l[4].value, 100, 0, 1);
5974
- return 1 === t ? n = normalize(l[4].value, 250, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5943
+ if (2 === l) {
5944
+ const e = normalizeHue(t);
5945
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5946
+ }
5947
+ if (isTokenPercentage(t)) {
5948
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5949
+ let n = normalize(t[4].value, 100, 0, 1);
5950
+ return 1 === l ? n = normalize(t[4].value, 250, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5975
5951
  c$7.Number,
5976
5952
  n.toString(),
5977
- l[2],
5978
- l[3],
5953
+ t[2],
5954
+ t[3],
5979
5955
  {
5980
5956
  value: n,
5981
5957
  type: a$8.Number
5982
5958
  }
5983
5959
  ];
5984
5960
  }
5985
- if (isTokenNumber(l)) {
5986
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5987
- let n = normalize(l[4].value, 1, 0, 1);
5988
- return 1 === t ? n = normalize(l[4].value, 1, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5961
+ if (isTokenNumber(t)) {
5962
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5963
+ let n = normalize(t[4].value, 1, 0, 1);
5964
+ return 1 === l ? n = normalize(t[4].value, 1, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5989
5965
  c$7.Number,
5990
5966
  n.toString(),
5991
- l[2],
5992
- l[3],
5967
+ t[2],
5968
+ t[3],
5993
5969
  {
5994
5970
  value: n,
5995
5971
  type: a$8.Number
@@ -6001,9 +5977,9 @@ function normalize_OKLCH_ChannelValues(l, t, s) {
6001
5977
  function oklch(e, a) {
6002
5978
  return threeChannelSpaceSeparated(e, normalize_OKLCH_ChannelValues, he.OKLCH, [], a);
6003
5979
  }
6004
- function normalize_legacy_sRGB_ChannelValues(n, l, t) {
5980
+ function normalize_legacy_sRGB_ChannelValues(n, t, l) {
6005
5981
  if (isTokenPercentage(n)) {
6006
- 3 === l ? t.syntaxFlags.add(me.HasPercentageAlpha) : t.syntaxFlags.add(me.HasPercentageValues);
5982
+ 3 === t ? l.syntaxFlags.add(me.HasPercentageAlpha) : l.syntaxFlags.add(me.HasPercentageValues);
6007
5983
  const r = normalize(n[4].value, 100, 0, 1);
6008
5984
  return [
6009
5985
  c$7.Number,
@@ -6017,9 +5993,9 @@ function normalize_legacy_sRGB_ChannelValues(n, l, t) {
6017
5993
  ];
6018
5994
  }
6019
5995
  if (isTokenNumber(n)) {
6020
- 3 !== l && t.syntaxFlags.add(me.HasNumberValues);
5996
+ 3 !== t && l.syntaxFlags.add(me.HasNumberValues);
6021
5997
  let r = normalize(n[4].value, 255, 0, 1);
6022
- return 3 === l && (r = normalize(n[4].value, 1, 0, 1)), [
5998
+ return 3 === t && (r = normalize(n[4].value, 1, 0, 1)), [
6023
5999
  c$7.Number,
6024
6000
  r.toString(),
6025
6001
  n[2],
@@ -6032,39 +6008,39 @@ function normalize_legacy_sRGB_ChannelValues(n, l, t) {
6032
6008
  }
6033
6009
  return !1;
6034
6010
  }
6035
- function normalize_modern_sRGB_ChannelValues(l, t, s) {
6036
- if (isTokenIdent(l) && "none" === l[4].value.toLowerCase()) return s.syntaxFlags.add(me.HasNoneKeywords), [
6011
+ function normalize_modern_sRGB_ChannelValues(t, l, s) {
6012
+ if (isTokenIdent(t) && "none" === t[4].value.toLowerCase()) return s.syntaxFlags.add(me.HasNoneKeywords), [
6037
6013
  c$7.Number,
6038
6014
  "none",
6039
- l[2],
6040
- l[3],
6015
+ t[2],
6016
+ t[3],
6041
6017
  {
6042
6018
  value: NaN,
6043
6019
  type: a$8.Number
6044
6020
  }
6045
6021
  ];
6046
- if (isTokenPercentage(l)) {
6047
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
6048
- let n = normalize(l[4].value, 100, -2147483647, 2147483647);
6049
- return 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
6022
+ if (isTokenPercentage(t)) {
6023
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
6024
+ let n = normalize(t[4].value, 100, -2147483647, 2147483647);
6025
+ return 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
6050
6026
  c$7.Number,
6051
6027
  n.toString(),
6052
- l[2],
6053
- l[3],
6028
+ t[2],
6029
+ t[3],
6054
6030
  {
6055
6031
  value: n,
6056
6032
  type: a$8.Number
6057
6033
  }
6058
6034
  ];
6059
6035
  }
6060
- if (isTokenNumber(l)) {
6061
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
6062
- let n = normalize(l[4].value, 255, -2147483647, 2147483647);
6063
- return 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
6036
+ if (isTokenNumber(t)) {
6037
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
6038
+ let n = normalize(t[4].value, 255, -2147483647, 2147483647);
6039
+ return 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
6064
6040
  c$7.Number,
6065
6041
  n.toString(),
6066
- l[2],
6067
- l[3],
6042
+ t[2],
6043
+ t[3],
6068
6044
  {
6069
6045
  value: n,
6070
6046
  type: a$8.Number
@@ -6118,7 +6094,7 @@ function contrastColor(e, a) {
6118
6094
  if (!n) return !1;
6119
6095
  n.channels = convertNaNToZero(n.channels), n.channels = XYZ_D50_to_sRGB_Gamut(colorData_to_XYZ_D50(n).channels), n.colorNotation = he.sRGB;
6120
6096
  const r = {
6121
- colorNotation: he.sRGB,
6097
+ colorNotation: he.RGB,
6122
6098
  channels: [
6123
6099
  0,
6124
6100
  0,
@@ -6158,12 +6134,12 @@ function alpha(e, a) {
6158
6134
  syntaxFlags: /* @__PURE__ */ new Set([])
6159
6135
  };
6160
6136
  for (let m = 0; m < e.value.length; m++) {
6161
- let p = e.value[m];
6162
- if (isWhitespaceNode(p) || isCommentNode(p)) for (; isWhitespaceNode(e.value[m + 1]) || isCommentNode(e.value[m + 1]);) m++;
6163
- else if (c && !u && !i && isTokenNode(p) && isTokenDelim(p.value) && "/" === p.value[4].value) u = !0;
6137
+ let N = e.value[m];
6138
+ if (isWhitespaceNode(N) || isCommentNode(N)) for (; isWhitespaceNode(e.value[m + 1]) || isCommentNode(e.value[m + 1]);) m++;
6139
+ else if (c && !u && !i && isTokenNode(N) && isTokenDelim(N.value) && "/" === N.value[4].value) u = !0;
6164
6140
  else {
6165
- if (isFunctionNode(p) && Q$1.has(toLowerCaseAZ(p.getName()))) {
6166
- const [[e]] = calcFromComponentValues([[p]], {
6141
+ if (isFunctionNode(N) && Q$1.has(toLowerCaseAZ(N.getName()))) {
6142
+ const [[e]] = calcFromComponentValues([[N]], {
6167
6143
  censorIntoStandardRepresentableValues: !0,
6168
6144
  globals: s,
6169
6145
  precision: -1,
@@ -6171,23 +6147,23 @@ function alpha(e, a) {
6171
6147
  rawPercentages: !0
6172
6148
  });
6173
6149
  if (!e || !isTokenNode(e) || !isTokenNumeric(e.value)) return !1;
6174
- Number.isNaN(e.value[4].value) && (e.value[4].value = 0), p = e;
6150
+ Number.isNaN(e.value[4].value) && (e.value[4].value = 0), N = e;
6175
6151
  }
6176
- if (u || i || !isTokenNode(p) || !isTokenIdent(p.value) || "from" !== toLowerCaseAZ(p.value[4].value)) {
6152
+ if (u || i || !isTokenNode(N) || !isTokenIdent(N.value) || "from" !== toLowerCaseAZ(N.value[4].value)) {
6177
6153
  if (!u) return !1;
6178
6154
  if (i) return !1;
6179
- if (isTokenNode(p)) {
6180
- if (isTokenIdent(p.value) && "alpha" === toLowerCaseAZ(p.value[4].value) && r && r.has("alpha")) {
6155
+ if (isTokenNode(N)) {
6156
+ if (isTokenIdent(N.value) && "alpha" === toLowerCaseAZ(N.value[4].value) && r && r.has("alpha")) {
6181
6157
  h.alpha = r.get("alpha")[4].value, i = !0;
6182
6158
  continue;
6183
6159
  }
6184
- const e = normalize_Color_ChannelValues(p.value, 3, h);
6160
+ const e = normalize_Color_ChannelValues(N.value, 3, h);
6185
6161
  if (!e || !isTokenNumber(e)) return !1;
6186
- h.alpha = new TokenNode(e), i = !0;
6162
+ h.alpha = e[4].value, i = !0;
6187
6163
  continue;
6188
6164
  }
6189
- if (isFunctionNode(p)) {
6190
- h.alpha = replaceComponentValues$1([[p]], (e) => {
6165
+ if (isFunctionNode(N)) {
6166
+ h.alpha = replaceComponentValues$1([[N]], (e) => {
6191
6167
  if (isTokenNode(e) && isTokenIdent(e.value) && "alpha" === toLowerCaseAZ(e.value[4].value) && r && r.has("alpha")) return new TokenNode(r.get("alpha"));
6192
6168
  })[0][0], i = !0;
6193
6169
  continue;
@@ -6196,7 +6172,7 @@ function alpha(e, a) {
6196
6172
  }
6197
6173
  if (c) return !1;
6198
6174
  for (; isWhitespaceNode(e.value[m + 1]) || isCommentNode(e.value[m + 1]);) m++;
6199
- if (m++, p = e.value[m], c = a(p), !1 === c) return !1;
6175
+ if (m++, N = e.value[m], c = a(N), !1 === c) return !1;
6200
6176
  r = normalizeRelativeColorDataChannels(c), s = noneToZeroInRelativeColorDataChannels(r), h.syntaxFlags = new Set(c.syntaxFlags), h.syntaxFlags.add(me.RelativeAlphaSyntax), h.channels = [...c.channels], h.colorNotation = c.colorNotation, h.alpha = c.alpha;
6201
6177
  }
6202
6178
  }
@@ -6231,8 +6207,8 @@ function toPrecision(e, a = 7) {
6231
6207
  return Math.round(e / r) * r;
6232
6208
  }
6233
6209
  }
6234
- function serializeWithAlpha(n, r, o, l) {
6235
- const t = [
6210
+ function serializeWithAlpha(n, r, o, t) {
6211
+ const l = [
6236
6212
  c$7.CloseParen,
6237
6213
  ")",
6238
6214
  -1,
@@ -6241,8 +6217,8 @@ function serializeWithAlpha(n, r, o, l) {
6241
6217
  ];
6242
6218
  if ("number" == typeof n.alpha) {
6243
6219
  const s = Math.min(1, Math.max(0, toPrecision(Number.isNaN(n.alpha) ? 0 : n.alpha)));
6244
- return 1 === toPrecision(s, 4) ? new FunctionNode(r, t, l) : new FunctionNode(r, t, [
6245
- ...l,
6220
+ return 1 === toPrecision(s, 4) ? new FunctionNode(r, l, t) : new FunctionNode(r, l, [
6221
+ ...t,
6246
6222
  new WhitespaceNode([o]),
6247
6223
  new TokenNode([
6248
6224
  c$7.Delim,
@@ -6264,8 +6240,8 @@ function serializeWithAlpha(n, r, o, l) {
6264
6240
  ])
6265
6241
  ]);
6266
6242
  }
6267
- return new FunctionNode(r, t, [
6268
- ...l,
6243
+ return new FunctionNode(r, l, [
6244
+ ...t,
6269
6245
  new WhitespaceNode([o]),
6270
6246
  new TokenNode([
6271
6247
  c$7.Delim,
@@ -6282,7 +6258,7 @@ function serializeP3(n, r = !0) {
6282
6258
  n.channels = convertPowerlessComponentsToZeroValuesForDisplay(n.channels, n.colorNotation);
6283
6259
  let o = n.channels.map((e) => Number.isNaN(e) ? 0 : e);
6284
6260
  r ? o = XYZ_D50_to_P3_Gamut(colorData_to_XYZ_D50(n).channels) : n.colorNotation !== he.Display_P3 && (o = XYZ_D50_to_P3(colorData_to_XYZ_D50(n).channels));
6285
- const l = r ? Math.min(1, Math.max(0, toPrecision(o[0], 6))) : toPrecision(o[0], 6), t = r ? Math.min(1, Math.max(0, toPrecision(o[1], 6))) : toPrecision(o[1], 6), s = r ? Math.min(1, Math.max(0, toPrecision(o[2], 6))) : toPrecision(o[2], 6), u = [
6261
+ const t = r ? Math.min(1, Math.max(0, toPrecision(o[0], 6))) : toPrecision(o[0], 6), l = r ? Math.min(1, Math.max(0, toPrecision(o[1], 6))) : toPrecision(o[1], 6), s = r ? Math.min(1, Math.max(0, toPrecision(o[2], 6))) : toPrecision(o[2], 6), u = [
6286
6262
  c$7.Function,
6287
6263
  "color(",
6288
6264
  -1,
@@ -6306,7 +6282,7 @@ function serializeP3(n, r = !0) {
6306
6282
  new WhitespaceNode([i]),
6307
6283
  new TokenNode([
6308
6284
  c$7.Number,
6309
- l.toString(),
6285
+ t.toString(),
6310
6286
  -1,
6311
6287
  -1,
6312
6288
  {
@@ -6317,7 +6293,7 @@ function serializeP3(n, r = !0) {
6317
6293
  new WhitespaceNode([i]),
6318
6294
  new TokenNode([
6319
6295
  c$7.Number,
6320
- t.toString(),
6296
+ l.toString(),
6321
6297
  -1,
6322
6298
  -1,
6323
6299
  {
@@ -6341,7 +6317,7 @@ function serializeP3(n, r = !0) {
6341
6317
  function serializeRGB(n, r = !0) {
6342
6318
  let o;
6343
6319
  n.channels = convertPowerlessComponentsToZeroValuesForDisplay(n.channels, n.colorNotation), o = r ? XYZ_D50_to_sRGB_Gamut(colorData_to_XYZ_D50(n).channels) : XYZ_D50_to_sRGB(colorData_to_XYZ_D50(n).channels);
6344
- const l = Math.min(255, Math.max(0, Math.round(255 * toPrecision(o[0])))), t = Math.min(255, Math.max(0, Math.round(255 * toPrecision(o[1])))), s = Math.min(255, Math.max(0, Math.round(255 * toPrecision(o[2])))), u = [
6320
+ const t = Math.min(255, Math.max(0, Math.round(255 * toPrecision(o[0])))), l = Math.min(255, Math.max(0, Math.round(255 * toPrecision(o[1])))), s = Math.min(255, Math.max(0, Math.round(255 * toPrecision(o[2])))), u = [
6345
6321
  c$7.CloseParen,
6346
6322
  ")",
6347
6323
  -1,
@@ -6362,7 +6338,7 @@ function serializeRGB(n, r = !0) {
6362
6338
  ], h = [
6363
6339
  new TokenNode([
6364
6340
  c$7.Number,
6365
- l.toString(),
6341
+ t.toString(),
6366
6342
  -1,
6367
6343
  -1,
6368
6344
  {
@@ -6374,7 +6350,7 @@ function serializeRGB(n, r = !0) {
6374
6350
  new WhitespaceNode([i]),
6375
6351
  new TokenNode([
6376
6352
  c$7.Number,
6377
- t.toString(),
6353
+ l.toString(),
6378
6354
  -1,
6379
6355
  -1,
6380
6356
  {
@@ -6441,7 +6417,7 @@ function serializeRGB(n, r = !0) {
6441
6417
  function serializeHSL(n, r = !0) {
6442
6418
  let o;
6443
6419
  n.channels = convertPowerlessComponentsToZeroValuesForDisplay(n.channels, n.colorNotation), o = XYZ_D50_to_HSL(r ? sRGB_to_XYZ_D50(XYZ_D50_to_sRGB_Gamut(colorData_to_XYZ_D50(n).channels)) : colorData_to_XYZ_D50(n).channels), o = o.map((e) => Number.isNaN(e) ? 0 : e);
6444
- const l = Math.min(360, Math.max(0, Math.round(toPrecision(o[0])))), t = Math.min(100, Math.max(0, Math.round(toPrecision(o[1])))), s = Math.min(100, Math.max(0, Math.round(toPrecision(o[2])))), u = [
6420
+ const t = Math.min(360, Math.max(0, Math.round(toPrecision(o[0])))), l = Math.min(100, Math.max(0, Math.round(toPrecision(o[1])))), s = Math.min(100, Math.max(0, Math.round(toPrecision(o[2])))), u = [
6445
6421
  c$7.CloseParen,
6446
6422
  ")",
6447
6423
  -1,
@@ -6462,7 +6438,7 @@ function serializeHSL(n, r = !0) {
6462
6438
  ], h = [
6463
6439
  new TokenNode([
6464
6440
  c$7.Number,
6465
- l.toString(),
6441
+ t.toString(),
6466
6442
  -1,
6467
6443
  -1,
6468
6444
  {
@@ -6474,7 +6450,7 @@ function serializeHSL(n, r = !0) {
6474
6450
  new WhitespaceNode([i]),
6475
6451
  new TokenNode([
6476
6452
  c$7.Percentage,
6477
- t.toString() + "%",
6453
+ l.toString() + "%",
6478
6454
  -1,
6479
6455
  -1,
6480
6456
  { value: o[1] }
@@ -7099,10 +7075,21 @@ const LINEAR_GRADIENT_LAB_RE = /background-image\s*:\s*linear-gradient\(\s*in\s+
7099
7075
  const DISPLAY_P3_COLOR_RE = /color\s*:\s*color\(\s*display-p3\s+0\s+0\s+0%\s*\)/;
7100
7076
  const DISPLAY_P3_VALUE_RE$1 = /color\(\s*display-p3\b/i;
7101
7077
  const COLOR_GAMUT_P3_RE$1 = /\(\s*color-gamut\s*:\s*p3\s*\)/i;
7078
+ const GRADIENT_BACKGROUND_RE = /^(linear|radial|conic)-gradient\(/i;
7079
+ const GRADIENT_STOPS_VAR_RE = /^(?:linear|radial|conic)-gradient\(\s*var\(\s*--tw-gradient-stops\b/i;
7080
+ const SIMPLE_CLASS_SELECTOR_RE = /^\.([_a-z\u00A0-\uFFFF\\-][\w\u00A0-\uFFFF\\-]*)$/i;
7081
+ const COLOR_VAR_RE = /^var\(\s*(--color-[\w-]+)\s*\)$/i;
7082
+ const GRADIENT_DIRECTION_CLASS_RE = /^(?:-?bg-linear|bg-gradient-to-|-?bg-conic|bg-radial)/;
7102
7083
  const RADIUS_VALUE_RE = /\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi;
7103
7084
  const SCIENTIFIC_NOTATION_RE = /e/i;
7104
7085
  const TW_VAR_FUNCTION_RE = /var\(\s*(--tw-[\w-]+)\b/g;
7105
7086
  const TW_CONTENT_VAR_RE$1 = /var\(\s*--tw-content\b/;
7087
+ const TW_GRADIENT_POSITION_PROPS = new Set([
7088
+ "--tw-gradient-from-position",
7089
+ "--tw-gradient-via-position",
7090
+ "--tw-gradient-to-position"
7091
+ ]);
7092
+ const UNSUPPORTED_CUSTOM_PROPERTY_DEFAULT_PROPS = new Set(["--tw-gradient-via-stops"]);
7106
7093
  const DEFAULT_VARIABLE_SCOPE_SELECTORS = new Set([
7107
7094
  "*",
7108
7095
  ":root",
@@ -7151,7 +7138,7 @@ function usesTailwindcssV4ContentVariable(root) {
7151
7138
  return used;
7152
7139
  }
7153
7140
  function createUsedCssVarsV4Nodes(usedProps) {
7154
- return nodes.filter((def) => usedProps.has(def.prop)).map((def) => new postcss.Declaration({
7141
+ return nodes.filter((def) => usedProps.has(def.prop) && !UNSUPPORTED_CUSTOM_PROPERTY_DEFAULT_PROPS.has(def.prop)).map((def) => new postcss.Declaration({
7155
7142
  prop: def.prop,
7156
7143
  value: def.value
7157
7144
  }));
@@ -7186,11 +7173,250 @@ function collectScopedTailwindcssV4DefaultVariables(root) {
7186
7173
  }
7187
7174
  function createMissingCssVarsV4Nodes(root, usedProps) {
7188
7175
  const scopedProps = collectScopedTailwindcssV4DefaultVariables(root);
7189
- return nodes.filter((def) => usedProps.has(def.prop) && !scopedProps.has(def.prop)).map((def) => new postcss.Declaration({
7176
+ return nodes.filter((def) => usedProps.has(def.prop) && !scopedProps.has(def.prop) && !UNSUPPORTED_CUSTOM_PROPERTY_DEFAULT_PROPS.has(def.prop)).map((def) => new postcss.Declaration({
7190
7177
  prop: def.prop,
7191
7178
  value: def.value
7192
7179
  }));
7193
7180
  }
7181
+ function collectTailwindcssV4ThemeVariables(root) {
7182
+ const variables = /* @__PURE__ */ new Map();
7183
+ root.walkRules((rule) => {
7184
+ if (!testIfRootHostForV4(rule) && !rule.selector.includes("page") && !rule.selector.includes(".tw-root")) return;
7185
+ rule.walkDecls((decl) => {
7186
+ if (decl.prop.startsWith("--color-")) variables.set(decl.prop, decl.value);
7187
+ });
7188
+ });
7189
+ return variables;
7190
+ }
7191
+ function resolveTailwindcssV4GradientColor(value, themeVariables) {
7192
+ const trimmed = value.trim();
7193
+ const match = COLOR_VAR_RE.exec(trimmed);
7194
+ if (!match) return trimmed;
7195
+ return themeVariables.get(match[1]) ?? trimmed;
7196
+ }
7197
+ function getSingleClassSelector(selector) {
7198
+ const match = SIMPLE_CLASS_SELECTOR_RE.exec(selector.trim());
7199
+ return match ? match[1] : void 0;
7200
+ }
7201
+ function normalizeDeclarationValue(value) {
7202
+ return value.replace(/\s+/g, " ").trim();
7203
+ }
7204
+ function normalizeTailwindcssV4GradientPosition(value) {
7205
+ return value.replace(/calc\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:deg|grad|rad|turn))\s*\*\s*-1\s*\)/gi, "-$1").replace(/^in\s+(?:oklab|oklch|hsl|srgb)(?:\s+(?:longer|shorter|increasing|decreasing)\s+hue)?$/i, "").replace(/\s+in\s+(?:oklab|oklch|hsl|srgb)(?:\s+(?:longer|shorter|increasing|decreasing)\s+hue)?\s*$/i, "").replace(/\s+(?:longer|shorter|increasing|decreasing)\s*$/i, "").trim();
7206
+ }
7207
+ function normalizeTailwindcssV4GradientDirectionDeclaration(rule, decl) {
7208
+ const normalized = normalizeTailwindcssV4GradientPosition(decl.value);
7209
+ if (normalized) return normalized;
7210
+ const backgroundImageDecl = rule.nodes.find((node) => {
7211
+ return node.type === "decl" && node.prop === "background-image";
7212
+ });
7213
+ if (!backgroundImageDecl) return normalized;
7214
+ if (/^radial-gradient\(/i.test(backgroundImageDecl.value)) return "at center";
7215
+ if (/^conic-gradient\(/i.test(backgroundImageDecl.value)) return "from 0deg";
7216
+ return normalized;
7217
+ }
7218
+ function appendStopPosition(color, position) {
7219
+ const normalizedPosition = position?.trim();
7220
+ return normalizedPosition ? `${color} ${normalizedPosition}` : color;
7221
+ }
7222
+ function getGradientStopsFallback(value) {
7223
+ if (!value.includes("var(") || !value.includes("--tw-gradient-stops")) return;
7224
+ const parsed = (0, postcss_value_parser.default)(value);
7225
+ let fallback;
7226
+ parsed.walk((node) => {
7227
+ if (fallback || node.type !== "function" || node.value.toLowerCase() !== "var") return;
7228
+ const firstCommaIndex = node.nodes.findIndex((child) => child.type === "div" && child.value === ",");
7229
+ const firstArg = node.nodes.find((child) => child.type !== "space");
7230
+ if (firstArg?.type !== "word" || firstArg.value !== "--tw-gradient-stops" || firstCommaIndex < 0) return;
7231
+ fallback = postcss_value_parser.default.stringify(node.nodes.slice(firstCommaIndex + 1)).trim();
7232
+ });
7233
+ return fallback;
7234
+ }
7235
+ function isTailwindcssV4GradientDirectionRule(rule) {
7236
+ const classSelector = getSingleClassSelector(rule.selector);
7237
+ if (!classSelector || !GRADIENT_DIRECTION_CLASS_RE.test(classSelector)) return false;
7238
+ return rule.nodes.some((node) => {
7239
+ return node.type === "decl" && (node.prop === "--tw-gradient-position" || node.prop === "background-image" && node.value.includes("linear-gradient("));
7240
+ });
7241
+ }
7242
+ function reorderTailwindcssV4GradientDirectionRule(rule) {
7243
+ const gradientPositionDecls = [];
7244
+ const gradientBackgroundDecls = [];
7245
+ for (const node of rule.nodes) {
7246
+ if (node.type !== "decl") continue;
7247
+ if (node.prop === "--tw-gradient-position") gradientPositionDecls.push(node);
7248
+ else if (node.prop === "background-image" && node.value.includes("linear-gradient(")) gradientBackgroundDecls.push(node);
7249
+ }
7250
+ if (gradientPositionDecls.length === 0 || gradientBackgroundDecls.length === 0) return;
7251
+ const anchor = rule.nodes.find((node) => {
7252
+ return node.type === "decl" && (node.prop === "--tw-gradient-position" || node.prop === "background-image" && node.value.includes("linear-gradient("));
7253
+ });
7254
+ if (!anchor) return;
7255
+ const ordered = [...gradientPositionDecls, ...gradientBackgroundDecls];
7256
+ const orderedClones = ordered.map((decl) => decl.clone());
7257
+ anchor.replaceWith(...orderedClones);
7258
+ for (const decl of ordered) if (decl.parent) decl.remove();
7259
+ }
7260
+ function mergeTailwindcssV4GradientDirectionRules(root) {
7261
+ const seen = /* @__PURE__ */ new Map();
7262
+ root.walkRules((rule) => {
7263
+ if (!isTailwindcssV4GradientDirectionRule(rule)) return;
7264
+ const selector = rule.selector.trim();
7265
+ const previous = seen.get(selector);
7266
+ if (!previous || previous.parent !== rule.parent) {
7267
+ seen.set(selector, rule);
7268
+ return;
7269
+ }
7270
+ for (const node of [...rule.nodes]) {
7271
+ if (node.type !== "decl") continue;
7272
+ if (node.prop !== "--tw-gradient-position" && node.prop !== "background-image") continue;
7273
+ previous.append(node.clone());
7274
+ }
7275
+ reorderTailwindcssV4GradientDirectionRule(previous);
7276
+ rule.remove();
7277
+ });
7278
+ }
7279
+ function createTailwindcssV4MiniProgramGradientValue(gradient, from, to, via) {
7280
+ const stops = [gradient.position, appendStopPosition(from.color, from.position)];
7281
+ if (via) stops.push(appendStopPosition(via.color, via.position));
7282
+ stops.push(appendStopPosition(to.color, to.position));
7283
+ return `${gradient.type}-gradient(${stops.filter(Boolean).join(", ")})`;
7284
+ }
7285
+ function appendTailwindcssV4MiniProgramGradientRules(root) {
7286
+ const themeVariables = collectTailwindcssV4ThemeVariables(root);
7287
+ const gradients = [];
7288
+ const fromColors = /* @__PURE__ */ new Map();
7289
+ const viaColors = /* @__PURE__ */ new Map();
7290
+ const toColors = /* @__PURE__ */ new Map();
7291
+ const fromPositions = [];
7292
+ const viaPositions = [];
7293
+ const toPositions = [];
7294
+ const directBackgroundImages = [];
7295
+ const existingBackgroundImages = /* @__PURE__ */ new Map();
7296
+ const ruleOrder = /* @__PURE__ */ new Map();
7297
+ let order = 0;
7298
+ root.walkRules((rule) => {
7299
+ const classSelector = getSingleClassSelector(rule.selector);
7300
+ const currentOrder = order++;
7301
+ if (classSelector) ruleOrder.set(classSelector, currentOrder);
7302
+ rule.walkDecls("background-image", (decl) => {
7303
+ const selector = rule.selector.trim();
7304
+ const values = existingBackgroundImages.get(selector);
7305
+ if (values) values.add(normalizeDeclarationValue(decl.value));
7306
+ else existingBackgroundImages.set(selector, new Set([normalizeDeclarationValue(decl.value)]));
7307
+ });
7308
+ if (classSelector) {
7309
+ const gradientPositionDecl = rule.nodes.find((node) => {
7310
+ return node.type === "decl" && node.prop === "--tw-gradient-position";
7311
+ });
7312
+ const gradientBackgroundDecl = rule.nodes.find((node) => {
7313
+ return node.type === "decl" && node.prop === "background-image" && GRADIENT_BACKGROUND_RE.test(node.value);
7314
+ });
7315
+ if (gradientPositionDecl && gradientBackgroundDecl) {
7316
+ const gradientType = GRADIENT_BACKGROUND_RE.exec(gradientBackgroundDecl.value)?.[1];
7317
+ if (gradientType) {
7318
+ gradients.push({
7319
+ classSelector,
7320
+ order: currentOrder,
7321
+ position: normalizeTailwindcssV4GradientDirectionDeclaration(rule, gradientPositionDecl),
7322
+ type: gradientType
7323
+ });
7324
+ const fallback = GRADIENT_STOPS_VAR_RE.test(gradientBackgroundDecl.value) ? getGradientStopsFallback(gradientBackgroundDecl.value) : void 0;
7325
+ if (fallback) directBackgroundImages.push({
7326
+ selector: rule.selector.trim(),
7327
+ value: `${gradientType}-gradient(${fallback})`
7328
+ });
7329
+ }
7330
+ }
7331
+ rule.walkDecls((decl) => {
7332
+ if (decl.prop === "--tw-gradient-from") fromColors.set(classSelector, {
7333
+ classSelector,
7334
+ color: resolveTailwindcssV4GradientColor(decl.value, themeVariables),
7335
+ order: currentOrder
7336
+ });
7337
+ else if (decl.prop === "--tw-gradient-from-position") fromPositions.push({
7338
+ classSelector,
7339
+ position: decl.value
7340
+ });
7341
+ else if (decl.prop === "--tw-gradient-via") viaColors.set(classSelector, {
7342
+ classSelector,
7343
+ color: resolveTailwindcssV4GradientColor(decl.value, themeVariables),
7344
+ order: currentOrder
7345
+ });
7346
+ else if (decl.prop === "--tw-gradient-via-position") viaPositions.push({
7347
+ classSelector,
7348
+ position: decl.value
7349
+ });
7350
+ else if (decl.prop === "--tw-gradient-to") toColors.set(classSelector, {
7351
+ classSelector,
7352
+ color: resolveTailwindcssV4GradientColor(decl.value, themeVariables),
7353
+ order: currentOrder
7354
+ });
7355
+ else if (decl.prop === "--tw-gradient-to-position") toPositions.push({
7356
+ classSelector,
7357
+ position: decl.value
7358
+ });
7359
+ });
7360
+ }
7361
+ });
7362
+ const fromVariants = [];
7363
+ const viaVariants = [];
7364
+ const toVariants = [];
7365
+ const positionedFromVariants = [];
7366
+ const positionedViaVariants = [];
7367
+ const positionedToVariants = [];
7368
+ for (const color of fromColors.values()) {
7369
+ fromVariants.push(color);
7370
+ for (const position of fromPositions) positionedFromVariants.push({
7371
+ ...color,
7372
+ classSelector: `${color.classSelector}.${position.classSelector}`,
7373
+ order: Math.max(color.order, ruleOrder.get(position.classSelector) ?? color.order),
7374
+ position: position.position
7375
+ });
7376
+ }
7377
+ for (const color of viaColors.values()) {
7378
+ viaVariants.push(color);
7379
+ for (const position of viaPositions) positionedViaVariants.push({
7380
+ ...color,
7381
+ classSelector: `${color.classSelector}.${position.classSelector}`,
7382
+ order: Math.max(color.order, ruleOrder.get(position.classSelector) ?? color.order),
7383
+ position: position.position
7384
+ });
7385
+ }
7386
+ for (const color of toColors.values()) {
7387
+ toVariants.push(color);
7388
+ for (const position of toPositions) positionedToVariants.push({
7389
+ ...color,
7390
+ classSelector: `${color.classSelector}.${position.classSelector}`,
7391
+ order: Math.max(color.order, ruleOrder.get(position.classSelector) ?? color.order),
7392
+ position: position.position
7393
+ });
7394
+ }
7395
+ function appendGradientRule(selector, value) {
7396
+ const normalizedValue = normalizeDeclarationValue(value);
7397
+ if (existingBackgroundImages.get(selector)?.has(normalizedValue)) return;
7398
+ existingBackgroundImages.set(selector, new Set([...existingBackgroundImages.get(selector) ?? [], normalizedValue]));
7399
+ root.append((0, postcss.rule)({
7400
+ selector,
7401
+ nodes: [new postcss.Declaration({
7402
+ prop: "background-image",
7403
+ value
7404
+ })]
7405
+ }));
7406
+ }
7407
+ for (const { selector, value } of directBackgroundImages) appendGradientRule(selector, value);
7408
+ function appendGradientCombinations(gradient, fromRules, viaRules, toRules) {
7409
+ for (const from of fromRules) for (const to of toRules) {
7410
+ appendGradientRule(`.${gradient.classSelector}.${from.classSelector}.${to.classSelector}`, createTailwindcssV4MiniProgramGradientValue(gradient, from, to));
7411
+ for (const via of viaRules) appendGradientRule(`.${gradient.classSelector}.${from.classSelector}.${via.classSelector}.${to.classSelector}`, createTailwindcssV4MiniProgramGradientValue(gradient, from, to, via));
7412
+ }
7413
+ }
7414
+ for (const gradient of gradients) {
7415
+ if (gradient.position.includes(",") || /^var\(/i.test(gradient.position)) continue;
7416
+ appendGradientCombinations(gradient, fromVariants, viaVariants, toVariants);
7417
+ appendGradientCombinations(gradient, positionedFromVariants, positionedViaVariants, positionedToVariants);
7418
+ }
7419
+ }
7194
7420
  function isTailwindcssV4ModernCheck(atRule) {
7195
7421
  return atRule.name === "supports" && [
7196
7422
  MODERN_CHECK_WEBKIT_HYPHENS_RE,
@@ -7225,15 +7451,108 @@ function normalizeTailwindcssV4EmptyVarFallback(value) {
7225
7451
  });
7226
7452
  return changed ? parsed.toString() : value;
7227
7453
  }
7454
+ function normalizeTailwindcssV4GradientStopsFallback(value) {
7455
+ if (!value.includes("var(") || !value.includes("--tw-gradient-via-stops")) return value;
7456
+ const parsed = (0, postcss_value_parser.default)(value);
7457
+ let changed = false;
7458
+ function normalizeNodes(nodes) {
7459
+ for (let index = 0; index < nodes.length; index++) {
7460
+ const node = nodes[index];
7461
+ if (!node) continue;
7462
+ if (node.type === "function" && node.value.toLowerCase() !== "var") {
7463
+ normalizeNodes(node.nodes);
7464
+ continue;
7465
+ }
7466
+ if (node.type !== "function") continue;
7467
+ const firstArg = node.nodes.filter((child) => child.type !== "space")[0];
7468
+ if (firstArg?.type !== "word" || firstArg.value !== "--tw-gradient-via-stops") {
7469
+ normalizeNodes(node.nodes);
7470
+ continue;
7471
+ }
7472
+ const firstCommaIndex = node.nodes.findIndex((child) => child.type === "div" && child.value === ",");
7473
+ if (firstCommaIndex < 0) continue;
7474
+ const fallbackNodes = node.nodes.slice(firstCommaIndex + 1);
7475
+ const splitIndex = fallbackNodes.findIndex((child) => child.type === "div" && child.value === ",");
7476
+ if (splitIndex < 0) continue;
7477
+ const viaFallbackNodes = fallbackNodes.slice(0, splitIndex);
7478
+ const stopNodes = fallbackNodes.slice(splitIndex);
7479
+ const nextVarNode = {
7480
+ ...node,
7481
+ nodes: [
7482
+ {
7483
+ type: "word",
7484
+ value: "--tw-gradient-via-stops"
7485
+ },
7486
+ {
7487
+ type: "div",
7488
+ value: ",",
7489
+ before: "",
7490
+ after: " "
7491
+ },
7492
+ ...viaFallbackNodes
7493
+ ],
7494
+ sourceEndIndex: void 0,
7495
+ sourceIndex: void 0
7496
+ };
7497
+ nodes.splice(index, 1, nextVarNode, ...stopNodes);
7498
+ changed = true;
7499
+ index += stopNodes.length;
7500
+ }
7501
+ }
7502
+ normalizeNodes(parsed.nodes);
7503
+ return changed ? parsed.toString() : value;
7504
+ }
7505
+ function normalizeTailwindcssV4GradientPositionFallback(value) {
7506
+ if (!value.includes("var(") || !value.includes("--tw-gradient-")) return value;
7507
+ const parsed = (0, postcss_value_parser.default)(value);
7508
+ let changed = false;
7509
+ parsed.walk((node) => {
7510
+ if (node.type !== "function" || node.value.toLowerCase() !== "var") return;
7511
+ const args = node.nodes.filter((child) => child.type !== "space");
7512
+ const firstArg = args[0];
7513
+ if (firstArg?.type !== "word" || !TW_GRADIENT_POSITION_PROPS.has(firstArg.value)) return;
7514
+ const commaIndex = args.findIndex((child) => child.type === "div" && child.value === ",");
7515
+ if (commaIndex === -1 ? void 0 : args[commaIndex]) {
7516
+ if (!args.slice(commaIndex + 1).some((child) => child.type !== "space") && node.after !== " ") {
7517
+ node.after = " ";
7518
+ changed = true;
7519
+ }
7520
+ return;
7521
+ }
7522
+ node.nodes.push({
7523
+ type: "div",
7524
+ value: ",",
7525
+ before: "",
7526
+ after: ""
7527
+ });
7528
+ node.after = " ";
7529
+ changed = true;
7530
+ });
7531
+ return changed ? parsed.toString() : value;
7532
+ }
7228
7533
  function normalizeTailwindcssV4Declaration(decl) {
7229
7534
  let changed = false;
7535
+ if (decl.prop === "--tw-gradient-via-stops" && decl.value.trim() === "initial") {
7536
+ decl.remove();
7537
+ return true;
7538
+ }
7230
7539
  const normalizedEmptyVarFallback = normalizeTailwindcssV4EmptyVarFallback(decl.value);
7231
7540
  if (normalizedEmptyVarFallback !== decl.value) {
7232
7541
  decl.value = normalizedEmptyVarFallback;
7233
7542
  changed = true;
7234
7543
  }
7544
+ const normalizedGradientStopsFallback = normalizeTailwindcssV4GradientStopsFallback(decl.value);
7545
+ if (normalizedGradientStopsFallback !== decl.value) {
7546
+ decl.value = normalizedGradientStopsFallback;
7547
+ changed = true;
7548
+ }
7549
+ const normalizedGradientPositionFallback = normalizeTailwindcssV4GradientPositionFallback(decl.value);
7550
+ if (normalizedGradientPositionFallback !== decl.value) {
7551
+ decl.value = normalizedGradientPositionFallback;
7552
+ changed = true;
7553
+ }
7235
7554
  if (decl.prop === "--tw-gradient-position" && decl.value.endsWith(OKLAB_SUFFIX)) {
7236
- decl.value = decl.value.slice(0, decl.value.length - 8).trimEnd();
7555
+ decl.value = decl.parent?.type === "rule" ? normalizeTailwindcssV4GradientDirectionDeclaration(decl.parent, decl) : normalizeTailwindcssV4GradientPosition(decl.value);
7237
7556
  return true;
7238
7557
  }
7239
7558
  if (INFINITY_CALC_REGEXP.test(decl.value)) {
@@ -7834,6 +8153,10 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
7834
8153
  root.walkAtRules((atRule) => {
7835
8154
  removeUnsupportedMiniProgramPrefixedAtRule(atRule);
7836
8155
  });
8156
+ if (shouldInjectTailwindcssV4Defaults) {
8157
+ mergeTailwindcssV4GradientDirectionRules(root);
8158
+ if (options.tailwindcssV4GradientFallback === true) appendTailwindcssV4MiniProgramGradientRules(root);
8159
+ }
7837
8160
  const hoistAnchor = createHoistInsertionAnchor(root);
7838
8161
  const preflightRules = collectPreflightRules(root, options);
7839
8162
  if (preflightRules.length === 0) {
@@ -9153,6 +9476,25 @@ function fingerprintOptions(value, state = {
9153
9476
  //#region src/options-resolver.ts
9154
9477
  const BASE_CACHE_KEY = "base";
9155
9478
  const SIMPLE_OVERRIDE_UNSET = "__unset__";
9479
+ const CSS_OPTION_KEYS = [
9480
+ "cssPreflight",
9481
+ "cssPreflightRange",
9482
+ "cssChildCombinatorReplaceValue",
9483
+ "cssPresetEnv",
9484
+ "autoprefixer",
9485
+ "injectAdditionalCssVarScope",
9486
+ "cssSelectorReplacement",
9487
+ "rem2rpx",
9488
+ "px2rpx",
9489
+ "unitsToPx",
9490
+ "unitConversion",
9491
+ "platform",
9492
+ "cssRemoveHoverPseudoClass",
9493
+ "cssRemoveProperty",
9494
+ "cssCalc",
9495
+ "atRules",
9496
+ "tailwindcssV4GradientFallback"
9497
+ ];
9156
9498
  function getSimpleOverrideCacheKey(options) {
9157
9499
  let isMainChunk = SIMPLE_OVERRIDE_UNSET;
9158
9500
  let majorVersion = SIMPLE_OVERRIDE_UNSET;
@@ -9263,20 +9605,48 @@ function getSimpleOverrideCacheKey(options) {
9263
9605
  function hasOverrides(options) {
9264
9606
  return Boolean(options && Object.keys(options).length > 0);
9265
9607
  }
9608
+ function normalizeCssOptions(options, mirrorTopLevel = false) {
9609
+ let changed = false;
9610
+ const normalized = { ...options };
9611
+ const hasCssOptions = options.cssOptions !== void 0;
9612
+ const cssOptions = { ...options.cssOptions ?? {} };
9613
+ for (const key of CSS_OPTION_KEYS) {
9614
+ const hasNestedValue = hasCssOptions && key in options.cssOptions;
9615
+ const hasTopLevelValue = key in options;
9616
+ if (!hasNestedValue && !hasTopLevelValue) continue;
9617
+ const nestedValue = hasNestedValue ? options.cssOptions?.[key] : void 0;
9618
+ const topLevelValue = hasTopLevelValue ? options[key] : void 0;
9619
+ const value = hasNestedValue ? nestedValue : topLevelValue;
9620
+ if (value !== topLevelValue) {
9621
+ normalized[key] = value;
9622
+ changed = true;
9623
+ }
9624
+ if ((hasCssOptions || mirrorTopLevel) && value !== nestedValue) {
9625
+ cssOptions[key] = value;
9626
+ changed = true;
9627
+ }
9628
+ }
9629
+ if (!changed) return options;
9630
+ return {
9631
+ ...normalized,
9632
+ ...hasCssOptions || mirrorTopLevel ? { cssOptions } : {}
9633
+ };
9634
+ }
9266
9635
  function createOptionsResolver(baseOptions) {
9636
+ const normalizedBaseOptions = normalizeCssOptions(baseOptions);
9267
9637
  const cacheByKey = /* @__PURE__ */ new Map();
9268
9638
  const cacheByRef = /* @__PURE__ */ new WeakMap();
9269
9639
  const cacheKeyByRef = /* @__PURE__ */ new WeakMap();
9270
9640
  const emptyOverrideRefs = /* @__PURE__ */ new WeakSet();
9271
- cacheByKey.set(BASE_CACHE_KEY, baseOptions);
9641
+ cacheByKey.set(BASE_CACHE_KEY, normalizedBaseOptions);
9272
9642
  const resolve = (overrides) => {
9273
- if (!overrides) return baseOptions;
9643
+ if (!overrides) return normalizedBaseOptions;
9274
9644
  const refCached = cacheByRef.get(overrides);
9275
9645
  if (refCached) return refCached;
9276
- if (emptyOverrideRefs.has(overrides)) return baseOptions;
9646
+ if (emptyOverrideRefs.has(overrides)) return normalizedBaseOptions;
9277
9647
  if (!hasOverrides(overrides)) {
9278
9648
  emptyOverrideRefs.add(overrides);
9279
- return baseOptions;
9649
+ return normalizedBaseOptions;
9280
9650
  }
9281
9651
  let key = cacheKeyByRef.get(overrides);
9282
9652
  if (!key) {
@@ -9288,10 +9658,10 @@ function createOptionsResolver(baseOptions) {
9288
9658
  cacheByRef.set(overrides, cached);
9289
9659
  return cached;
9290
9660
  }
9291
- const merged = (0, _weapp_tailwindcss_shared.defuOverrideArray)({ ...overrides }, baseOptions);
9292
- cacheByKey.set(key, merged);
9293
- cacheByRef.set(overrides, merged);
9294
- return merged;
9661
+ const normalized = normalizeCssOptions((0, _weapp_tailwindcss_shared.defuOverrideArray)(normalizeCssOptions({ ...overrides }, true), normalizedBaseOptions));
9662
+ cacheByKey.set(key, normalized);
9663
+ cacheByRef.set(overrides, normalized);
9664
+ return normalized;
9295
9665
  };
9296
9666
  return { resolve };
9297
9667
  }
@@ -40755,7 +41125,7 @@ function hasExactFallback(o, t) {
40755
41125
  }
40756
41126
  return !1;
40757
41127
  }
40758
- const e$35 = /^\s?initial\s?$/i, n$11 = /^font$/i, r$10 = /^all$/i, i$10 = [
41128
+ const e$36 = /^\s?initial\s?$/i, n$11 = /^font$/i, r$10 = /^all$/i, i$10 = [
40759
41129
  "font-family",
40760
41130
  "font-size",
40761
41131
  "font-style",
@@ -40769,7 +41139,7 @@ const e$35 = /^\s?initial\s?$/i, n$11 = /^font$/i, r$10 = /^all$/i, i$10 = [
40769
41139
  postcssPlugin: "postcss-initial",
40770
41140
  Declaration(a) {
40771
41141
  if (a.variable) return;
40772
- if (!e$35.test(a.value)) return;
41142
+ if (!e$36.test(a.value)) return;
40773
41143
  let s;
40774
41144
  s = n$11.test(a.prop) ? i$10 : r$10.test(a.prop) ? t$17 : [a.prop.toLowerCase()];
40775
41145
  let c = !1;
@@ -43837,7 +44207,7 @@ function hasSupportsAtRuleAncestor(e, t) {
43837
44207
  return !1;
43838
44208
  }
43839
44209
  //#endregion
43840
- //#region ../../node_modules/.pnpm/@csstools+postcss-alpha-function@2.0.5_postcss@8.5.15/node_modules/@csstools/postcss-alpha-function/dist/index.mjs
44210
+ //#region ../../node_modules/.pnpm/@csstools+postcss-alpha-function@2.0.6_postcss@8.5.15/node_modules/@csstools/postcss-alpha-function/dist/index.mjs
43841
44211
  const b$1 = /\balpha\(/i, m$9 = /^alpha$/i, w$3 = new Set([
43842
44212
  "srgb",
43843
44213
  "srgb-linear",
@@ -44260,12 +44630,12 @@ var require_postcss_page_break = /* @__PURE__ */ require_html_transform.__common
44260
44630
  module.exports.postcss = true;
44261
44631
  }));
44262
44632
  //#endregion
44263
- //#region ../../node_modules/.pnpm/@csstools+selector-specificity@6.0.0_postcss-selector-parser@7.1.2/node_modules/@csstools/selector-specificity/dist/index.mjs
44633
+ //#region ../../node_modules/.pnpm/@csstools+selector-specificity@6.0.0_postcss-selector-parser@7.1.4/node_modules/@csstools/selector-specificity/dist/index.mjs
44264
44634
  var import_postcss_page_break = /* @__PURE__ */ require_html_transform.__toESM(require_postcss_page_break(), 1);
44265
- function compare(e, t) {
44635
+ function compare$1(e, t) {
44266
44636
  return e.a === t.a ? e.b === t.b ? e.c - t.c : e.b - t.b : e.a - t.a;
44267
44637
  }
44268
- function selectorSpecificity(t, s) {
44638
+ function selectorSpecificity$1(t, s) {
44269
44639
  const i = s?.customSpecificity?.(t);
44270
44640
  if (i) return i;
44271
44641
  if (!t) return {
@@ -44283,17 +44653,17 @@ function selectorSpecificity(t, s) {
44283
44653
  else if ("tag" === t.type) o += 1;
44284
44654
  else if ("class" === t.type) n += 1;
44285
44655
  else if ("attribute" === t.type) n += 1;
44286
- else if (isPseudoElement(t)) switch (t.value.toLowerCase()) {
44656
+ else if (isPseudoElement$1(t)) switch (t.value.toLowerCase()) {
44287
44657
  case "::slotted":
44288
44658
  if (o += 1, t.nodes && t.nodes.length > 0) {
44289
- const e = specificityOfMostSpecificListItem(t.nodes, s);
44659
+ const e = specificityOfMostSpecificListItem$1(t.nodes, s);
44290
44660
  c += e.a, n += e.b, o += e.c;
44291
44661
  }
44292
44662
  break;
44293
44663
  case "::view-transition-group":
44294
44664
  case "::view-transition-image-pair":
44295
44665
  case "::view-transition-old":
44296
- case "::view-transition-new": return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal(t.nodes[0]) ? {
44666
+ case "::view-transition-new": return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal$1(t.nodes[0]) ? {
44297
44667
  a: 0,
44298
44668
  b: 0,
44299
44669
  c: 0
@@ -44316,7 +44686,7 @@ function selectorSpecificity(t, s) {
44316
44686
  case ":matches":
44317
44687
  case ":not":
44318
44688
  if (t.nodes && t.nodes.length > 0) {
44319
- const e = specificityOfMostSpecificListItem(t.nodes, s);
44689
+ const e = specificityOfMostSpecificListItem$1(t.nodes, s);
44320
44690
  c += e.a, n += e.b, o += e.c;
44321
44691
  }
44322
44692
  break;
@@ -44335,7 +44705,7 @@ function selectorSpecificity(t, s) {
44335
44705
  });
44336
44706
  const r = [a];
44337
44707
  t.nodes.length > 1 && r.push(...t.nodes.slice(1));
44338
- const l = specificityOfMostSpecificListItem(r, s);
44708
+ const l = specificityOfMostSpecificListItem$1(r, s);
44339
44709
  c += l.a, n += l.b, o += l.c;
44340
44710
  }
44341
44711
  }
@@ -44343,14 +44713,14 @@ function selectorSpecificity(t, s) {
44343
44713
  case ":local":
44344
44714
  case ":global":
44345
44715
  t.nodes && t.nodes.length > 0 && t.nodes.forEach((e) => {
44346
- const t = selectorSpecificity(e, s);
44716
+ const t = selectorSpecificity$1(e, s);
44347
44717
  c += t.a, n += t.b, o += t.c;
44348
44718
  });
44349
44719
  break;
44350
44720
  case ":host":
44351
44721
  case ":host-context":
44352
44722
  if (n += 1, t.nodes && t.nodes.length > 0) {
44353
- const e = specificityOfMostSpecificListItem(t.nodes, s);
44723
+ const e = specificityOfMostSpecificListItem$1(t.nodes, s);
44354
44724
  c += e.a, n += e.b, o += e.c;
44355
44725
  }
44356
44726
  break;
@@ -44362,7 +44732,7 @@ function selectorSpecificity(t, s) {
44362
44732
  };
44363
44733
  }
44364
44734
  else postcss_selector_parser$1.default.isContainer(t) && t.nodes?.length > 0 && t.nodes.forEach((e) => {
44365
- const t = selectorSpecificity(e, s);
44735
+ const t = selectorSpecificity$1(e, s);
44366
44736
  c += t.a, n += t.b, o += t.c;
44367
44737
  });
44368
44738
  return {
@@ -44371,21 +44741,21 @@ function selectorSpecificity(t, s) {
44371
44741
  c: o
44372
44742
  };
44373
44743
  }
44374
- function specificityOfMostSpecificListItem(e, t) {
44744
+ function specificityOfMostSpecificListItem$1(e, t) {
44375
44745
  let s = {
44376
44746
  a: 0,
44377
44747
  b: 0,
44378
44748
  c: 0
44379
44749
  };
44380
44750
  return e.forEach((e) => {
44381
- const i = selectorSpecificity(e, t);
44382
- compare(i, s) < 0 || (s = i);
44751
+ const i = selectorSpecificity$1(e, t);
44752
+ compare$1(i, s) < 0 || (s = i);
44383
44753
  }), s;
44384
44754
  }
44385
- function isPseudoElement(t) {
44755
+ function isPseudoElement$1(t) {
44386
44756
  return postcss_selector_parser$1.default.isPseudoElement(t);
44387
44757
  }
44388
- function selectorNodeContainsNothingOrOnlyUniversal(e) {
44758
+ function selectorNodeContainsNothingOrOnlyUniversal$1(e) {
44389
44759
  if (!e) return !1;
44390
44760
  if (!e.nodes) return !1;
44391
44761
  const t = e.nodes.filter((e) => "comment" !== e.type);
@@ -44671,7 +45041,7 @@ const creator$48 = (a) => {
44671
45041
  for (a.walkRules((t) => {
44672
45042
  t.selectors.forEach((a) => {
44673
45043
  try {
44674
- const t = selectorSpecificity((0, postcss_selector_parser$1.default)().astSync(a));
45044
+ const t = selectorSpecificity$1((0, postcss_selector_parser$1.default)().astSync(a));
44675
45045
  p = Math.max(p, t.a + 1);
44676
45046
  } catch (e) {
44677
45047
  t.warn(n, `Failed to parse selector : "${a}" with message: "${e instanceof Error ? e.message : e}"`);
@@ -44856,7 +45226,7 @@ var require_postcss_clamp = /* @__PURE__ */ require_html_transform.__commonJSMin
44856
45226
  module.exports.postcss = true;
44857
45227
  }));
44858
45228
  //#endregion
44859
- //#region ../../node_modules/.pnpm/@csstools+postcss-color-function@5.0.4_postcss@8.5.15/node_modules/@csstools/postcss-color-function/dist/index.mjs
45229
+ //#region ../../node_modules/.pnpm/@csstools+postcss-color-function@5.0.5_postcss@8.5.15/node_modules/@csstools/postcss-color-function/dist/index.mjs
44860
45230
  var import_postcss_clamp = /* @__PURE__ */ require_html_transform.__toESM(require_postcss_clamp(), 1);
44861
45231
  const u$7 = /\bcolor\(/i, m$7 = /^color$/i, basePlugin$15 = (s) => ({
44862
45232
  postcssPlugin: "postcss-color-function",
@@ -44886,7 +45256,7 @@ const postcssPlugin$15 = (o) => {
44886
45256
  };
44887
45257
  postcssPlugin$15.postcss = !0;
44888
45258
  //#endregion
44889
- //#region ../../node_modules/.pnpm/@csstools+postcss-color-function-display-p3-linear@2.0.4_postcss@8.5.15/node_modules/@csstools/postcss-color-function-display-p3-linear/dist/index.mjs
45259
+ //#region ../../node_modules/.pnpm/@csstools+postcss-color-function-display-p3-linear@2.0.5_postcss@8.5.15/node_modules/@csstools/postcss-color-function-display-p3-linear/dist/index.mjs
44890
45260
  const m$6 = /\bdisplay-p3-linear\b/i, f$7 = /^color$/i, basePlugin$14 = (s) => ({
44891
45261
  postcssPlugin: "postcss-color-function-display-p3-linear",
44892
45262
  Declaration(g) {
@@ -44915,7 +45285,7 @@ const postcssPlugin$14 = (o) => {
44915
45285
  };
44916
45286
  postcssPlugin$14.postcss = !0;
44917
45287
  //#endregion
44918
- //#region ../../node_modules/.pnpm/postcss-color-functional-notation@8.0.4_postcss@8.5.15/node_modules/postcss-color-functional-notation/dist/index.mjs
45288
+ //#region ../../node_modules/.pnpm/postcss-color-functional-notation@8.0.5_postcss@8.5.15/node_modules/postcss-color-functional-notation/dist/index.mjs
44919
45289
  const m$5 = /^(?:rgb|hsl)a?$/i, f$6 = /\b(?:rgb|hsl)a?\(/i, basePlugin$13 = (s) => ({
44920
45290
  postcssPlugin: "postcss-color-functional-notation",
44921
45291
  Declaration(v) {
@@ -44944,7 +45314,7 @@ const postcssPlugin$13 = (o) => {
44944
45314
  };
44945
45315
  postcssPlugin$13.postcss = !0;
44946
45316
  //#endregion
44947
- //#region ../../node_modules/.pnpm/@csstools+postcss-color-mix-function@4.0.4_postcss@8.5.15/node_modules/@csstools/postcss-color-mix-function/dist/index.mjs
45317
+ //#region ../../node_modules/.pnpm/@csstools+postcss-color-mix-function@4.0.5_postcss@8.5.15/node_modules/@csstools/postcss-color-mix-function/dist/index.mjs
44948
45318
  const f$5 = /\bcolor-mix\(/i, g$6 = /^color-mix$/i, basePlugin$12 = (s) => ({
44949
45319
  postcssPlugin: "postcss-color-mix-function",
44950
45320
  Declaration(v) {
@@ -44980,7 +45350,7 @@ const postcssPlugin$12 = (e) => {
44980
45350
  };
44981
45351
  postcssPlugin$12.postcss = !0;
44982
45352
  //#endregion
44983
- //#region ../../node_modules/.pnpm/@csstools+postcss-color-mix-variadic-function-arguments@2.0.4_postcss@8.5.15/node_modules/@csstools/postcss-color-mix-variadic-function-arguments/dist/index.mjs
45353
+ //#region ../../node_modules/.pnpm/@csstools+postcss-color-mix-variadic-function-arguments@2.0.5_postcss@8.5.15/node_modules/@csstools/postcss-color-mix-variadic-function-arguments/dist/index.mjs
44984
45354
  const f$4 = /\bcolor-mix\(/i, g$5 = /^color-mix$/i, basePlugin$11 = (s) => ({
44985
45355
  postcssPlugin: "color-mix-variadic-function-arguments",
44986
45356
  Declaration(v) {
@@ -45078,7 +45448,7 @@ const creator$45 = (t) => {
45078
45448
  };
45079
45449
  creator$45.postcss = !0;
45080
45450
  //#endregion
45081
- //#region ../../node_modules/.pnpm/@csstools+postcss-contrast-color-function@3.0.4_postcss@8.5.15/node_modules/@csstools/postcss-contrast-color-function/dist/index.mjs
45451
+ //#region ../../node_modules/.pnpm/@csstools+postcss-contrast-color-function@3.0.5_postcss@8.5.15/node_modules/@csstools/postcss-contrast-color-function/dist/index.mjs
45082
45452
  const u$6 = /\bcontrast-color\(/i, m$4 = /^contrast-color$/i, basePlugin$9 = (s) => ({
45083
45453
  postcssPlugin: "postcss-contrast-color-function",
45084
45454
  prepare: () => ({
@@ -48006,12 +48376,12 @@ function transform$2(e) {
48006
48376
  if (n.length <= 1) return e;
48007
48377
  return l$5.get(n.join(",")) || e;
48008
48378
  }
48009
- const e$26 = /^display$/i, t$11 = /\b\s\b/, creator$40 = (i) => {
48379
+ const e$27 = /^display$/i, t$11 = /\b\s\b/, creator$40 = (i) => {
48010
48380
  const l = !("preserve" in Object(i)) || Boolean(i?.preserve);
48011
48381
  return {
48012
48382
  postcssPlugin: "postcss-normalize-display-values",
48013
48383
  Declaration(i) {
48014
- if (!e$26.test(i.prop)) return;
48384
+ if (!e$27.test(i.prop)) return;
48015
48385
  const n = i.value;
48016
48386
  if (!n) return;
48017
48387
  if (!t$11.test(n)) return;
@@ -48117,13 +48487,13 @@ creator$39.postcss = !0;
48117
48487
  //#endregion
48118
48488
  //#region ../../node_modules/.pnpm/@csstools+postcss-logical-float-and-clear@4.0.0_postcss@8.5.15/node_modules/@csstools/postcss-logical-float-and-clear/dist/index.mjs
48119
48489
  const t$9 = "inline-start", o$18 = "inline-end";
48120
- var e$25, n$6;
48490
+ var e$26, n$6;
48121
48491
  function directionFlowToAxes$2(t) {
48122
48492
  switch (t) {
48123
- case e$25.TopToBottom: return [n$6.Top, n$6.Bottom];
48124
- case e$25.BottomToTop: return [n$6.Bottom, n$6.Top];
48125
- case e$25.RightToLeft: return [n$6.Right, n$6.Left];
48126
- case e$25.LeftToRight: return [n$6.Left, n$6.Right];
48493
+ case e$26.TopToBottom: return [n$6.Top, n$6.Bottom];
48494
+ case e$26.BottomToTop: return [n$6.Bottom, n$6.Top];
48495
+ case e$26.RightToLeft: return [n$6.Right, n$6.Left];
48496
+ case e$26.LeftToRight: return [n$6.Left, n$6.Right];
48127
48497
  }
48128
48498
  }
48129
48499
  function cloneDeclaration$2(t, o, e) {
@@ -48134,13 +48504,13 @@ function cloneDeclaration$2(t, o, e) {
48134
48504
  }
48135
48505
  (function(t) {
48136
48506
  t.TopToBottom = "top-to-bottom", t.BottomToTop = "bottom-to-top", t.RightToLeft = "right-to-left", t.LeftToRight = "left-to-right";
48137
- })(e$25 || (e$25 = {})), function(t) {
48507
+ })(e$26 || (e$26 = {})), function(t) {
48138
48508
  t.Top = "top", t.Right = "right", t.Bottom = "bottom", t.Left = "left";
48139
48509
  }(n$6 || (n$6 = {}));
48140
48510
  const creator$38 = (n) => {
48141
- const i = Object.assign({ inlineDirection: e$25.LeftToRight }, n), c = Object.values(e$25);
48511
+ const i = Object.assign({ inlineDirection: e$26.LeftToRight }, n), c = Object.values(e$26);
48142
48512
  if (!c.includes(i.inlineDirection)) throw new Error(`[postcss-logical-float-and-clear] "inlineDirection" must be one of ${c.join(", ")}`);
48143
- if (![e$25.LeftToRight, e$25.RightToLeft].includes(i.inlineDirection)) return {
48513
+ if (![e$26.LeftToRight, e$26.RightToLeft].includes(i.inlineDirection)) return {
48144
48514
  postcssPlugin: "postcss-logical-float-and-clear",
48145
48515
  Once() {}
48146
48516
  };
@@ -48420,12 +48790,12 @@ var require_postcss_font_variant = /* @__PURE__ */ require_html_transform.__comm
48420
48790
  //#endregion
48421
48791
  //#region ../../node_modules/.pnpm/@csstools+postcss-font-width-property@1.0.0_postcss@8.5.15/node_modules/@csstools/postcss-font-width-property/dist/index.mjs
48422
48792
  var import_postcss_font_variant = /* @__PURE__ */ require_html_transform.__toESM(require_postcss_font_variant(), 1);
48423
- const e$21 = /^font-width$/i, o$16 = /\bfont-width\b/i, s$7 = /^font-stretch$/i, creator$34 = (s) => {
48793
+ const e$22 = /^font-width$/i, o$16 = /\bfont-width\b/i, s$7 = /^font-stretch$/i, creator$34 = (s) => {
48424
48794
  const r = Object.assign({ preserve: !1 }, s);
48425
48795
  return {
48426
48796
  postcssPlugin: "postcss-font-width-property",
48427
48797
  Declaration(s) {
48428
- e$21.test(s.prop) && (hasFallback(s) || hasSupportsAtRuleAncestor(s, o$16) || (s.cloneBefore({ prop: "font-stretch" }), r.preserve || s.remove()));
48798
+ e$22.test(s.prop) && (hasFallback(s) || hasSupportsAtRuleAncestor(s, o$16) || (s.cloneBefore({ prop: "font-stretch" }), r.preserve || s.remove()));
48429
48799
  }
48430
48800
  };
48431
48801
  };
@@ -48437,7 +48807,7 @@ function hasFallback(t) {
48437
48807
  }
48438
48808
  creator$34.postcss = !0;
48439
48809
  //#endregion
48440
- //#region ../../node_modules/.pnpm/@csstools+postcss-gamut-mapping@3.0.4_postcss@8.5.15/node_modules/@csstools/postcss-gamut-mapping/dist/index.mjs
48810
+ //#region ../../node_modules/.pnpm/@csstools+postcss-gamut-mapping@3.0.5_postcss@8.5.15/node_modules/@csstools/postcss-gamut-mapping/dist/index.mjs
48441
48811
  const p = /\bcolor-gamut\b/i;
48442
48812
  function hasConditionalAncestor(e) {
48443
48813
  let o = e.parent;
@@ -48533,7 +48903,7 @@ const d = /\b(?:color|lab|lch|oklab|oklch)\(/i, u$4 = /^(?:color|lab|lch|oklab|o
48533
48903
  creator$33.postcss = !0;
48534
48904
  //#endregion
48535
48905
  //#region ../../node_modules/.pnpm/postcss-gap-properties@7.0.0_postcss@8.5.15/node_modules/postcss-gap-properties/dist/index.mjs
48536
- const e$20 = [
48906
+ const e$21 = [
48537
48907
  "column-gap",
48538
48908
  "gap",
48539
48909
  "row-gap"
@@ -48542,7 +48912,7 @@ const e$20 = [
48542
48912
  return {
48543
48913
  postcssPlugin: "postcss-gap-properties",
48544
48914
  Declaration(o) {
48545
- if (!e$20.includes(o.prop.toLowerCase())) return;
48915
+ if (!e$21.includes(o.prop.toLowerCase())) return;
48546
48916
  if (!o.parent?.some((e) => "decl" === e.type && "display" === e.prop.toLowerCase() && "grid" === e.value.toLowerCase())) return;
48547
48917
  const s = `grid-${o.prop.toLowerCase()}`;
48548
48918
  o.parent?.some((e) => "decl" === e.type && e.prop.toLowerCase() === s) || (o.cloneBefore({ prop: s }), r.preserve || o.remove());
@@ -48551,7 +48921,7 @@ const e$20 = [
48551
48921
  };
48552
48922
  creator$32.postcss = !0;
48553
48923
  //#endregion
48554
- //#region ../../node_modules/.pnpm/@csstools+postcss-gradients-interpolation-method@6.0.4_postcss@8.5.15/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.mjs
48924
+ //#region ../../node_modules/.pnpm/@csstools+postcss-gradients-interpolation-method@6.0.5_postcss@8.5.15/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.mjs
48555
48925
  const x = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/i, W = /\bin\b/i, P$1 = { test: (o) => x.test(o) && W.test(o) }, A$1 = /^(repeating-)?(linear|radial|conic)-gradient$/i;
48556
48926
  function interpolateColorsInColorStopsList(o, e, t, s = !1) {
48557
48927
  const l = [], a = [];
@@ -48922,7 +49292,7 @@ const creator$31 = (t) => {
48922
49292
  }) : (delete e.parent, c.append(e));
48923
49293
  });
48924
49294
  }
48925
- const i = "[" + encodeCSS(c.toString()) + "]", l = selectorSpecificity(c);
49295
+ const i = "[" + encodeCSS(c.toString()) + "]", l = selectorSpecificity$1(c);
48926
49296
  let u = i;
48927
49297
  for (let e = 0; e < l.a; e++) u += r;
48928
49298
  const p = Math.max(1, l.b) - 1;
@@ -48980,7 +49350,7 @@ function hexa2rgba(e) {
48980
49350
  e.value = `rgba(${r},${l},${n},${c})`;
48981
49351
  }
48982
49352
  //#endregion
48983
- //#region ../../node_modules/.pnpm/@csstools+postcss-hwb-function@5.0.4_postcss@8.5.15/node_modules/@csstools/postcss-hwb-function/dist/index.mjs
49353
+ //#region ../../node_modules/.pnpm/@csstools+postcss-hwb-function@5.0.5_postcss@8.5.15/node_modules/@csstools/postcss-hwb-function/dist/index.mjs
48984
49354
  const u$3 = /\bhwb\(/i, m$2 = /^hwb$/i, basePlugin$6 = (s) => ({
48985
49355
  postcssPlugin: "postcss-hwb-function",
48986
49356
  Declaration(f) {
@@ -49202,6 +49572,137 @@ const handleInvalidation = (e, t, n) => {
49202
49572
  };
49203
49573
  creator$29.postcss = !0;
49204
49574
  //#endregion
49575
+ //#region ../../node_modules/.pnpm/@csstools+selector-specificity@6.0.0_postcss-selector-parser@7.1.2/node_modules/@csstools/selector-specificity/dist/index.mjs
49576
+ function compare(e, t) {
49577
+ return e.a === t.a ? e.b === t.b ? e.c - t.c : e.b - t.b : e.a - t.a;
49578
+ }
49579
+ function selectorSpecificity(t, s) {
49580
+ const i = s?.customSpecificity?.(t);
49581
+ if (i) return i;
49582
+ if (!t) return {
49583
+ a: 0,
49584
+ b: 0,
49585
+ c: 0
49586
+ };
49587
+ let c = 0, n = 0, o = 0;
49588
+ if ("universal" == t.type) return {
49589
+ a: 0,
49590
+ b: 0,
49591
+ c: 0
49592
+ };
49593
+ if ("id" === t.type) c += 1;
49594
+ else if ("tag" === t.type) o += 1;
49595
+ else if ("class" === t.type) n += 1;
49596
+ else if ("attribute" === t.type) n += 1;
49597
+ else if (isPseudoElement(t)) switch (t.value.toLowerCase()) {
49598
+ case "::slotted":
49599
+ if (o += 1, t.nodes && t.nodes.length > 0) {
49600
+ const e = specificityOfMostSpecificListItem(t.nodes, s);
49601
+ c += e.a, n += e.b, o += e.c;
49602
+ }
49603
+ break;
49604
+ case "::view-transition-group":
49605
+ case "::view-transition-image-pair":
49606
+ case "::view-transition-old":
49607
+ case "::view-transition-new": return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal(t.nodes[0]) ? {
49608
+ a: 0,
49609
+ b: 0,
49610
+ c: 0
49611
+ } : {
49612
+ a: 0,
49613
+ b: 0,
49614
+ c: 1
49615
+ };
49616
+ default: o += 1;
49617
+ }
49618
+ else if (postcss_selector_parser$1.default.isPseudoClass(t)) switch (t.value.toLowerCase()) {
49619
+ case ":-webkit-any":
49620
+ case ":any":
49621
+ default:
49622
+ n += 1;
49623
+ break;
49624
+ case ":-moz-any":
49625
+ case ":has":
49626
+ case ":is":
49627
+ case ":matches":
49628
+ case ":not":
49629
+ if (t.nodes && t.nodes.length > 0) {
49630
+ const e = specificityOfMostSpecificListItem(t.nodes, s);
49631
+ c += e.a, n += e.b, o += e.c;
49632
+ }
49633
+ break;
49634
+ case ":where": break;
49635
+ case ":nth-child":
49636
+ case ":nth-last-child":
49637
+ if (n += 1, t.nodes && t.nodes.length > 0) {
49638
+ const i = t.nodes[0].nodes.findIndex((e) => "tag" === e.type && "of" === e.value.toLowerCase());
49639
+ if (i > -1) {
49640
+ const a = postcss_selector_parser$1.default.selector({
49641
+ nodes: [],
49642
+ value: ""
49643
+ });
49644
+ t.nodes[0].nodes.slice(i + 1).forEach((e) => {
49645
+ a.append(e.clone());
49646
+ });
49647
+ const r = [a];
49648
+ t.nodes.length > 1 && r.push(...t.nodes.slice(1));
49649
+ const l = specificityOfMostSpecificListItem(r, s);
49650
+ c += l.a, n += l.b, o += l.c;
49651
+ }
49652
+ }
49653
+ break;
49654
+ case ":local":
49655
+ case ":global":
49656
+ t.nodes && t.nodes.length > 0 && t.nodes.forEach((e) => {
49657
+ const t = selectorSpecificity(e, s);
49658
+ c += t.a, n += t.b, o += t.c;
49659
+ });
49660
+ break;
49661
+ case ":host":
49662
+ case ":host-context":
49663
+ if (n += 1, t.nodes && t.nodes.length > 0) {
49664
+ const e = specificityOfMostSpecificListItem(t.nodes, s);
49665
+ c += e.a, n += e.b, o += e.c;
49666
+ }
49667
+ break;
49668
+ case ":active-view-transition":
49669
+ case ":active-view-transition-type": return {
49670
+ a: 0,
49671
+ b: 1,
49672
+ c: 0
49673
+ };
49674
+ }
49675
+ else postcss_selector_parser$1.default.isContainer(t) && t.nodes?.length > 0 && t.nodes.forEach((e) => {
49676
+ const t = selectorSpecificity(e, s);
49677
+ c += t.a, n += t.b, o += t.c;
49678
+ });
49679
+ return {
49680
+ a: c,
49681
+ b: n,
49682
+ c: o
49683
+ };
49684
+ }
49685
+ function specificityOfMostSpecificListItem(e, t) {
49686
+ let s = {
49687
+ a: 0,
49688
+ b: 0,
49689
+ c: 0
49690
+ };
49691
+ return e.forEach((e) => {
49692
+ const i = selectorSpecificity(e, t);
49693
+ compare(i, s) < 0 || (s = i);
49694
+ }), s;
49695
+ }
49696
+ function isPseudoElement(t) {
49697
+ return postcss_selector_parser$1.default.isPseudoElement(t);
49698
+ }
49699
+ function selectorNodeContainsNothingOrOnlyUniversal(e) {
49700
+ if (!e) return !1;
49701
+ if (!e.nodes) return !1;
49702
+ const t = e.nodes.filter((e) => "comment" !== e.type);
49703
+ return 0 === t.length || 1 === t.length && "universal" === t[0].type;
49704
+ }
49705
+ //#endregion
49205
49706
  //#region ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@6.0.0_postcss@8.5.15/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
49206
49707
  function alwaysValidSelector(s) {
49207
49708
  const o = (0, postcss_selector_parser$1.default)().astSync(s);
@@ -49471,7 +49972,7 @@ const n$3 = /:is\(/i, creator$28 = (e) => {
49471
49972
  };
49472
49973
  creator$28.postcss = !0;
49473
49974
  //#endregion
49474
- //#region ../../node_modules/.pnpm/postcss-lab-function@8.0.4_postcss@8.5.15/node_modules/postcss-lab-function/dist/index.mjs
49975
+ //#region ../../node_modules/.pnpm/postcss-lab-function@8.0.5_postcss@8.5.15/node_modules/postcss-lab-function/dist/index.mjs
49475
49976
  const g$2 = /\b(?:lab|lch)\(/i, f$2 = /^(?:lab|lch)$/i, basePlugin$3 = (s) => ({
49476
49977
  postcssPlugin: "postcss-lab-function",
49477
49978
  Declaration(b) {
@@ -51034,7 +51535,7 @@ const creator$19 = (s) => {
51034
51535
  };
51035
51536
  creator$19.postcss = !0;
51036
51537
  //#endregion
51037
- //#region ../../node_modules/.pnpm/@csstools+selector-resolve-nested@4.0.0_postcss-selector-parser@7.1.2/node_modules/@csstools/selector-resolve-nested/dist/index.mjs
51538
+ //#region ../../node_modules/.pnpm/@csstools+selector-resolve-nested@4.0.0_postcss-selector-parser@7.1.4/node_modules/@csstools/selector-resolve-nested/dist/index.mjs
51038
51539
  function sourceFrom(e) {
51039
51540
  return {
51040
51541
  sourceIndex: e.sourceIndex ?? 0,
@@ -51291,7 +51792,7 @@ function combinationsWithSizeN(e, t) {
51291
51792
  }
51292
51793
  }
51293
51794
  function nodesAreEquallySpecific(n) {
51294
- const r = n.map((t) => (0, postcss_selector_parser$1.default)().astSync(t)).map((e) => selectorSpecificity(e)), o = r[0];
51795
+ const r = n.map((t) => (0, postcss_selector_parser$1.default)().astSync(t)).map((e) => selectorSpecificity$1(e)), o = r[0];
51295
51796
  for (let e = 1; e < r.length; e++) if (o.a !== r[e].a || o.b !== r[e].b || o.c !== r[e].c) return !1;
51296
51797
  return !0;
51297
51798
  }
@@ -51541,7 +52042,7 @@ const creator$17 = () => ({
51541
52042
  });
51542
52043
  creator$17.postcss = !0;
51543
52044
  //#endregion
51544
- //#region ../../node_modules/.pnpm/@csstools+postcss-oklab-function@5.0.4_postcss@8.5.15/node_modules/@csstools/postcss-oklab-function/dist/index.mjs
52045
+ //#region ../../node_modules/.pnpm/@csstools+postcss-oklab-function@5.0.5_postcss@8.5.15/node_modules/@csstools/postcss-oklab-function/dist/index.mjs
51545
52046
  const g$1 = /\b(?:oklab|oklch)\(/i, f$1 = /^(?:oklab|oklch)$/i, basePlugin$1 = (s) => ({
51546
52047
  postcssPlugin: "postcss-oklab-function",
51547
52048
  Declaration(b) {
@@ -51780,7 +52281,7 @@ const s$3 = /rebeccapurple/i, t$1 = /^rebeccapurple$/i, creator$10 = (o) => {
51780
52281
  };
51781
52282
  creator$10.postcss = !0;
51782
52283
  //#endregion
51783
- //#region ../../node_modules/.pnpm/@csstools+postcss-relative-color-syntax@4.0.4_postcss@8.5.15/node_modules/@csstools/postcss-relative-color-syntax/dist/index.mjs
52284
+ //#region ../../node_modules/.pnpm/@csstools+postcss-relative-color-syntax@4.0.5_postcss@8.5.15/node_modules/@csstools/postcss-relative-color-syntax/dist/index.mjs
51784
52285
  const g = /\b(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklch|oklab|color)\(/i, h = /\b(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklch|oklab|color)\(\s*from/i, m$1 = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklch|oklab|color)$/i, y = /from/i, basePlugin = (s) => ({
51785
52286
  postcssPlugin: "postcss-relative-color-syntax",
51786
52287
  Declaration(f) {
@@ -52772,7 +53273,7 @@ const e$1 = new Set([
52772
53273
  };
52773
53274
  creator$2.postcss = !0;
52774
53275
  //#endregion
52775
- //#region ../../node_modules/.pnpm/postcss-preset-env@11.3.0_postcss@8.5.15/node_modules/postcss-preset-env/dist/index.mjs
53276
+ //#region ../../node_modules/.pnpm/postcss-preset-env@11.3.1_postcss@8.5.15/node_modules/postcss-preset-env/dist/index.mjs
52776
53277
  const ks = {
52777
53278
  "blank-pseudo-class": "https://github.com/csstools/postcss-plugins/blob/main/plugins/css-blank-pseudo/README.md#browser",
52778
53279
  "focus-visible-pseudo-class": "https://github.com/WICG/focus-visible",
@@ -53677,7 +54178,7 @@ function getCalcDuplicateCleaner(options) {
53677
54178
  return calcDuplicateCleanerPlugin;
53678
54179
  }
53679
54180
  //#endregion
53680
- //#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/object/omit.mjs
54181
+ //#region ../../node_modules/.pnpm/es-toolkit@1.47.1/node_modules/es-toolkit/dist/object/omit.mjs
53681
54182
  /**
53682
54183
  * Creates a new object with specified keys omitted.
53683
54184
  *
@@ -53686,9 +54187,9 @@ function getCalcDuplicateCleaner(options) {
53686
54187
  *
53687
54188
  * @template T - The type of object.
53688
54189
  * @template K - The type of keys in object.
53689
- * @param {T} obj - The object to omit keys from.
53690
- * @param {K[]} keys - An array of keys to be omitted from the object.
53691
- * @returns {Omit<T, K>} A new object with the specified keys omitted.
54190
+ * @param obj - The object to omit keys from.
54191
+ * @param keys - An array of keys to be omitted from the object.
54192
+ * @returns A new object with the specified keys omitted.
53692
54193
  *
53693
54194
  * @example
53694
54195
  * const obj = { a: 1, b: 2, c: 3 };
@@ -54930,6 +55431,13 @@ function injectMissingTailwindcssV4Defaults(root) {
54930
55431
  nodes
54931
55432
  });
54932
55433
  }
55434
+ function hasTailwindcssV4GradientRuntime(root) {
55435
+ let found = false;
55436
+ root.walkDecls((decl) => {
55437
+ if (decl.prop === "--tw-gradient-position" || decl.prop === "--tw-gradient-from" || decl.prop === "--tw-gradient-to") found = true;
55438
+ });
55439
+ return found;
55440
+ }
54933
55441
  const postcssWeappTailwindcssPostPlugin = (options) => {
54934
55442
  const opts = (0, _weapp_tailwindcss_shared.defu)(options, { isMainChunk: true });
54935
55443
  const p = { postcssPlugin };
@@ -54970,6 +55478,10 @@ const postcssWeappTailwindcssPostPlugin = (options) => {
54970
55478
  root.walkRules((rule) => {
54971
55479
  removeRedundantTransitionPropertyFallbacks(rule);
54972
55480
  });
55481
+ if (opts.majorVersion === 4 || hasTailwindcssV4GradientRuntime(root)) {
55482
+ mergeTailwindcssV4GradientDirectionRules(root);
55483
+ if (opts.tailwindcssV4GradientFallback === true) appendTailwindcssV4MiniProgramGradientRules(root);
55484
+ }
54973
55485
  root.walkAtRules((atRule) => {
54974
55486
  removeUnsupportedMiniProgramPrefixedAtRule(atRule);
54975
55487
  });