@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.mjs CHANGED
@@ -2,7 +2,7 @@ import { n as creator, t as CSS_MACRO_POSTCSS_PLUGIN_NAME } from "./postcss-BebU
2
2
  import postcssHtmlTransform from "./html-transform.mjs";
3
3
  import "./types.mjs";
4
4
  import { createRequire } from "node:module";
5
- import postcss, { Declaration, Rule, default as postcss$1 } from "postcss";
5
+ import postcss, { Declaration, Rule, rule, default as postcss$1 } from "postcss";
6
6
  import valueParser from "postcss-value-parser";
7
7
  import path from "node:path";
8
8
  import process$1 from "node:process";
@@ -4520,7 +4520,7 @@ function replaceComponentValues(n, r) {
4520
4520
  }
4521
4521
  const Q$1 = new Set(J.keys());
4522
4522
  //#endregion
4523
- //#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
4523
+ //#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
4524
4524
  var he, me;
4525
4525
  function convertNaNToZero(e) {
4526
4526
  return [
@@ -4616,7 +4616,7 @@ function colorData_to_XYZ_D50(e) {
4616
4616
  })(he || (he = {})), function(e) {
4617
4617
  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";
4618
4618
  }(me || (me = {}));
4619
- const pe = new Set([
4619
+ const Ne = new Set([
4620
4620
  he.A98_RGB,
4621
4621
  he.Display_P3,
4622
4622
  he.Linear_Display_P3,
@@ -4630,6 +4630,7 @@ const pe = new Set([
4630
4630
  he.XYZ_D65
4631
4631
  ]);
4632
4632
  function colorDataTo(e, a) {
4633
+ (e = { ...e }).channels = convertPowerlessComponentsToMissingComponents(e.channels, e.colorNotation);
4633
4634
  const n = { ...e };
4634
4635
  if (e.colorNotation !== a) {
4635
4636
  const e = colorData_to_XYZ_D50(n);
@@ -4695,7 +4696,7 @@ function colorDataTo(e, a) {
4695
4696
  1,
4696
4697
  2
4697
4698
  ], []);
4698
- else if (pe.has(a) && pe.has(e.colorNotation)) n.channels = carryForwardMissingComponents(e.channels, [
4699
+ else if (Ne.has(a) && Ne.has(e.colorNotation)) n.channels = carryForwardMissingComponents(e.channels, [
4699
4700
  0,
4700
4701
  1,
4701
4702
  2
@@ -4804,7 +4805,7 @@ function colorDataTo(e, a) {
4804
4805
  break;
4805
4806
  default: n.channels = carryForwardMissingComponents(e.channels, [], [], n.channels, [], []);
4806
4807
  }
4807
- return n.channels = convertPowerlessComponentsToMissingComponents(n.channels, a), n;
4808
+ return n;
4808
4809
  }
4809
4810
  function convertPowerlessComponentsToMissingComponents(e, a) {
4810
4811
  const n = [...e];
@@ -4844,16 +4845,16 @@ function convertPowerlessComponentsToZeroValuesForDisplay(e, a) {
4844
4845
  }
4845
4846
  return n;
4846
4847
  }
4847
- function carryForwardMissingComponents(e, a, n, r, o, l) {
4848
+ function carryForwardMissingComponents(e, a, n, r, o, t) {
4848
4849
  if (a.length < 3 && e.every(Number.isNaN)) return [
4849
4850
  NaN,
4850
4851
  NaN,
4851
4852
  NaN
4852
4853
  ];
4853
- const t = [...r];
4854
- for (let n = 0; n < a.length; n++) Number.isNaN(e[a[n]]) && (t[o[n]] = NaN);
4855
- if (n.length && n.every((a) => Number.isNaN(e[a]))) for (let e = 0; e < l.length; e++) t[l[e]] = NaN;
4856
- return t;
4854
+ const l = [...r];
4855
+ for (let n = 0; n < a.length; n++) Number.isNaN(e[a[n]]) && (l[o[n]] = NaN);
4856
+ if (n.length && n.every((a) => Number.isNaN(e[a]))) for (let e = 0; e < t.length; e++) l[t[e]] = NaN;
4857
+ return l;
4857
4858
  }
4858
4859
  function normalizeRelativeColorDataChannels(e) {
4859
4860
  const a = /* @__PURE__ */ new Map();
@@ -4940,43 +4941,43 @@ function colorDataFitsDisplayP3_Gamut(e) {
4940
4941
  function normalize(e, a, n, r) {
4941
4942
  return Math.min(Math.max(e / a, n), r);
4942
4943
  }
4943
- const Ne = /[A-Z]/g;
4944
+ const pe = /[A-Z]/g;
4944
4945
  function toLowerCaseAZ(e) {
4945
- return e.replace(Ne, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
4946
+ return e.replace(pe, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
4946
4947
  }
4947
- function normalize_Color_ChannelValues(l, t, s) {
4948
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
4948
+ function normalize_Color_ChannelValues(t, l, s) {
4949
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
4949
4950
  c$7.Number,
4950
4951
  "none",
4951
- l[2],
4952
- l[3],
4952
+ t[2],
4953
+ t[3],
4953
4954
  {
4954
4955
  value: NaN,
4955
4956
  type: a$8.Number
4956
4957
  }
4957
4958
  ];
4958
- if (isTokenPercentage(l)) {
4959
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
4960
- let n = normalize(l[4].value, 100, -2147483647, 2147483647);
4961
- return 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
4959
+ if (isTokenPercentage(t)) {
4960
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
4961
+ let n = normalize(t[4].value, 100, -2147483647, 2147483647);
4962
+ return 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
4962
4963
  c$7.Number,
4963
4964
  n.toString(),
4964
- l[2],
4965
- l[3],
4965
+ t[2],
4966
+ t[3],
4966
4967
  {
4967
4968
  value: n,
4968
4969
  type: a$8.Number
4969
4970
  }
4970
4971
  ];
4971
4972
  }
4972
- if (isTokenNumber(l)) {
4973
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
4974
- let n = normalize(l[4].value, 1, -2147483647, 2147483647);
4975
- return 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
4973
+ if (isTokenNumber(t)) {
4974
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
4975
+ let n = normalize(t[4].value, 1, -2147483647, 2147483647);
4976
+ return 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
4976
4977
  c$7.Number,
4977
4978
  n.toString(),
4978
- l[2],
4979
- l[3],
4979
+ t[2],
4980
+ t[3],
4980
4981
  {
4981
4982
  value: n,
4982
4983
  type: a$8.Number
@@ -4999,8 +5000,8 @@ const be = new Set([
4999
5000
  ]);
5000
5001
  function color$1(e, a) {
5001
5002
  const r = [], s = [], u = [], i = [];
5002
- let c, h, m = !1, p = !1;
5003
- const N = {
5003
+ let c, h, m = !1, N = !1;
5004
+ const p = {
5004
5005
  colorNotation: he.sRGB,
5005
5006
  channels: [
5006
5007
  0,
@@ -5012,19 +5013,19 @@ function color$1(e, a) {
5012
5013
  };
5013
5014
  let b = r;
5014
5015
  for (let o = 0; o < e.value.length; o++) {
5015
- let g = e.value[o];
5016
- if (isWhitespaceNode(g) || isCommentNode(g)) for (; isWhitespaceNode(e.value[o + 1]) || isCommentNode(e.value[o + 1]);) o++;
5017
- else if (b === r && r.length && (b = s), b === s && s.length && (b = u), isTokenNode(g) && isTokenDelim(g.value) && "/" === g.value[4].value) {
5016
+ let v = e.value[o];
5017
+ if (isWhitespaceNode(v) || isCommentNode(v)) for (; isWhitespaceNode(e.value[o + 1]) || isCommentNode(e.value[o + 1]);) o++;
5018
+ else if (b === r && r.length && (b = s), b === s && s.length && (b = u), isTokenNode(v) && isTokenDelim(v.value) && "/" === v.value[4].value) {
5018
5019
  if (b === i) return !1;
5019
5020
  b = i;
5020
5021
  } else {
5021
- if (isFunctionNode(g)) {
5022
- if (b === i && "var" === toLowerCaseAZ(g.getName())) {
5023
- N.syntaxFlags.add(me.HasVariableAlpha), b.push(g);
5022
+ if (isFunctionNode(v)) {
5023
+ if (b === i && "var" === toLowerCaseAZ(v.getName())) {
5024
+ p.syntaxFlags.add(me.HasVariableAlpha), b.push(v);
5024
5025
  continue;
5025
5026
  }
5026
- if (!Q$1.has(toLowerCaseAZ(g.getName()))) return !1;
5027
- const [[e]] = calcFromComponentValues([[g]], {
5027
+ if (!Q$1.has(toLowerCaseAZ(v.getName()))) return !1;
5028
+ const [[e]] = calcFromComponentValues([[v]], {
5028
5029
  censorIntoStandardRepresentableValues: !0,
5029
5030
  globals: h,
5030
5031
  precision: -1,
@@ -5032,24 +5033,24 @@ function color$1(e, a) {
5032
5033
  rawPercentages: !0
5033
5034
  });
5034
5035
  if (!e || !isTokenNode(e) || !isTokenNumeric(e.value)) return !1;
5035
- Number.isNaN(e.value[4].value) && (e.value[4].value = 0), g = e;
5036
+ Number.isNaN(e.value[4].value) && (e.value[4].value = 0), v = e;
5036
5037
  }
5037
- if (b === r && 0 === r.length && isTokenNode(g) && isTokenIdent(g.value) && be.has(toLowerCaseAZ(g.value[4].value))) {
5038
+ if (b === r && 0 === r.length && isTokenNode(v) && isTokenIdent(v.value) && be.has(toLowerCaseAZ(v.value[4].value))) {
5038
5039
  if (m) return !1;
5039
- 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));
5040
- } else if (b === r && 0 === r.length && isTokenNode(g) && isTokenIdent(g.value) && "from" === toLowerCaseAZ(g.value[4].value)) {
5041
- if (p) return !1;
5040
+ 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));
5041
+ } else if (b === r && 0 === r.length && isTokenNode(v) && isTokenIdent(v.value) && "from" === toLowerCaseAZ(v.value[4].value)) {
5042
+ if (N) return !1;
5042
5043
  if (m) return !1;
5043
5044
  for (; isWhitespaceNode(e.value[o + 1]) || isCommentNode(e.value[o + 1]);) o++;
5044
- if (o++, g = e.value[o], p = a(g), !1 === p) return !1;
5045
- p.syntaxFlags.has(me.Experimental) && N.syntaxFlags.add(me.Experimental), N.syntaxFlags.add(me.RelativeColorSyntax);
5045
+ if (o++, v = e.value[o], N = a(v), !1 === N) return !1;
5046
+ N.syntaxFlags.has(me.Experimental) && p.syntaxFlags.add(me.Experimental), p.syntaxFlags.add(me.RelativeColorSyntax);
5046
5047
  } else {
5047
- if (!isTokenNode(g)) return !1;
5048
- if (isTokenIdent(g.value) && c && c.has(toLowerCaseAZ(g.value[4].value))) {
5049
- b.push(new TokenNode(c.get(toLowerCaseAZ(g.value[4].value))));
5048
+ if (!isTokenNode(v)) return !1;
5049
+ if (isTokenIdent(v.value) && c && c.has(toLowerCaseAZ(v.value[4].value))) {
5050
+ b.push(new TokenNode(c.get(toLowerCaseAZ(v.value[4].value))));
5050
5051
  continue;
5051
5052
  }
5052
- b.push(g);
5053
+ b.push(v);
5053
5054
  }
5054
5055
  }
5055
5056
  }
@@ -5058,32 +5059,32 @@ function color$1(e, a) {
5058
5059
  if (1 !== r.length || 1 !== s.length || 1 !== u.length) return !1;
5059
5060
  if (!isTokenNode(r[0]) || !isTokenNode(s[0]) || !isTokenNode(u[0])) return !1;
5060
5061
  if (c && !c.has("alpha")) return !1;
5061
- const g = normalize_Color_ChannelValues(r[0].value, 0, N);
5062
- if (!g || !isTokenNumber(g)) return !1;
5063
- const v = normalize_Color_ChannelValues(s[0].value, 1, N);
5062
+ const v = normalize_Color_ChannelValues(r[0].value, 0, p);
5064
5063
  if (!v || !isTokenNumber(v)) return !1;
5065
- const f = normalize_Color_ChannelValues(u[0].value, 2, N);
5064
+ const f = normalize_Color_ChannelValues(s[0].value, 1, p);
5066
5065
  if (!f || !isTokenNumber(f)) return !1;
5066
+ const g = normalize_Color_ChannelValues(u[0].value, 2, p);
5067
+ if (!g || !isTokenNumber(g)) return !1;
5067
5068
  const y = [
5068
- g,
5069
5069
  v,
5070
- f
5070
+ f,
5071
+ g
5071
5072
  ];
5072
- if (1 === i.length) if (N.syntaxFlags.add(me.HasAlpha), isTokenNode(i[0])) {
5073
- const e = normalize_Color_ChannelValues(i[0].value, 3, N);
5073
+ if (1 === i.length) if (p.syntaxFlags.add(me.HasAlpha), isTokenNode(i[0])) {
5074
+ const e = normalize_Color_ChannelValues(i[0].value, 3, p);
5074
5075
  if (!e || !isTokenNumber(e)) return !1;
5075
5076
  y.push(e);
5076
- } else N.alpha = i[0];
5077
+ } else p.alpha = i[0];
5077
5078
  else if (c && c.has("alpha")) {
5078
- const e = normalize_Color_ChannelValues(c.get("alpha"), 3, N);
5079
+ const e = normalize_Color_ChannelValues(c.get("alpha"), 3, p);
5079
5080
  if (!e || !isTokenNumber(e)) return !1;
5080
5081
  y.push(e);
5081
5082
  }
5082
- return N.channels = [
5083
+ return p.channels = [
5083
5084
  y[0][4].value,
5084
5085
  y[1][4].value,
5085
5086
  y[2][4].value
5086
- ], 4 === y.length && (N.alpha = y[3][4].value), N;
5087
+ ], 4 === y.length && (p.alpha = y[3][4].value), p;
5087
5088
  }
5088
5089
  function colorSpaceNameToColorNotation(e) {
5089
5090
  switch (e) {
@@ -5100,7 +5101,7 @@ function colorSpaceNameToColorNotation(e) {
5100
5101
  default: throw new Error("Unknown color space name: " + e);
5101
5102
  }
5102
5103
  }
5103
- const ge = new Set([
5104
+ const ve = new Set([
5104
5105
  "srgb",
5105
5106
  "srgb-linear",
5106
5107
  "display-p3",
@@ -5113,19 +5114,19 @@ const ge = new Set([
5113
5114
  "xyz",
5114
5115
  "xyz-d50",
5115
5116
  "xyz-d65"
5116
- ]), ve = new Set([
5117
+ ]), fe = new Set([
5117
5118
  "hsl",
5118
5119
  "hwb",
5119
5120
  "lch",
5120
5121
  "oklch"
5121
- ]), fe = new Set([
5122
+ ]), ge = new Set([
5122
5123
  "shorter",
5123
5124
  "longer",
5124
5125
  "increasing",
5125
5126
  "decreasing"
5126
5127
  ]);
5127
5128
  function colorMix(e, a) {
5128
- let r = null, o = null, l = null, t = !1;
5129
+ let r = null, o = null, t = null, l = !1;
5129
5130
  for (let u = 0; u < e.value.length; u++) {
5130
5131
  const i = e.value[u];
5131
5132
  if (!isWhiteSpaceOrCommentNode(i)) {
@@ -5139,36 +5140,36 @@ function colorMix(e, a) {
5139
5140
  o = toLowerCaseAZ(i.value[4].value);
5140
5141
  continue;
5141
5142
  }
5142
- if (r && o && !l && ve.has(o)) {
5143
- l = toLowerCaseAZ(i.value[4].value);
5143
+ if (r && o && !t && fe.has(o)) {
5144
+ t = toLowerCaseAZ(i.value[4].value);
5144
5145
  continue;
5145
5146
  }
5146
- if (r && o && l && !t && "hue" === toLowerCaseAZ(i.value[4].value)) {
5147
- t = !0;
5147
+ if (r && o && t && !l && "hue" === toLowerCaseAZ(i.value[4].value)) {
5148
+ l = !0;
5148
5149
  continue;
5149
5150
  }
5150
5151
  return !1;
5151
5152
  }
5152
- 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)));
5153
+ 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)));
5153
5154
  }
5154
5155
  }
5155
5156
  return !1;
5156
5157
  }
5157
5158
  function colorMixComponents(e, a) {
5158
5159
  const n = [];
5159
- let o = 1, l = !1, u = !1;
5160
- for (let o = 0; o < e.length; o++) {
5161
- let i = e[o];
5160
+ let o = !1, t = !1;
5161
+ for (let u = 0; u < e.length; u++) {
5162
+ let i = e[u];
5162
5163
  if (!isWhiteSpaceOrCommentNode(i)) {
5163
5164
  if (!isTokenNode(i) || !isTokenComma(i.value)) {
5164
- if (!l) {
5165
+ if (!o) {
5165
5166
  const e = a(i);
5166
5167
  if (e) {
5167
- l = e;
5168
+ o = e;
5168
5169
  continue;
5169
5170
  }
5170
5171
  }
5171
- if (!u) {
5172
+ if (!t) {
5172
5173
  if (isFunctionNode(i) && Q$1.has(toLowerCaseAZ(i.getName()))) {
5173
5174
  if ([[i]] = calcFromComponentValues([[i]], {
5174
5175
  censorIntoStandardRepresentableValues: !0,
@@ -5179,242 +5180,202 @@ function colorMixComponents(e, a) {
5179
5180
  Number.isNaN(i.value[4].value) && (i.value[4].value = 0);
5180
5181
  }
5181
5182
  if (isTokenNode(i) && isTokenPercentage(i.value) && i.value[4].value >= 0) {
5182
- u = i.value[4].value;
5183
+ t = i.value[4].value;
5183
5184
  continue;
5184
5185
  }
5185
5186
  }
5186
5187
  return !1;
5187
5188
  }
5188
- if (!l) return !1;
5189
+ if (!o) return !1;
5189
5190
  n.push({
5190
- color: l,
5191
- percentage: u
5192
- }), l = !1, u = !1;
5191
+ color: o,
5192
+ percentage: t
5193
+ }), o = !1, t = !1;
5193
5194
  }
5194
5195
  }
5195
- if (!l) return !1;
5196
- n.push({
5197
- color: l,
5198
- percentage: u
5199
- });
5200
- let i = 0, c = 0;
5201
- for (let e = 0; e < n.length; e++) {
5202
- const a = n[e].percentage;
5203
- if (!1 !== a) {
5204
- if (a < 0 || a > 100) return !1;
5205
- i += a;
5206
- } else c++;
5207
- }
5208
- const h = Math.max(0, 100 - i);
5209
- i = 0;
5210
- for (let e = 0; e < n.length; e++) !1 === n[e].percentage && (n[e].percentage = h / c), i += n[e].percentage;
5211
- if (0 === i) return {
5212
- colors: [{
5213
- color: {
5214
- channels: [
5215
- 0,
5216
- 0,
5217
- 0
5218
- ],
5219
- colorNotation: he.sRGB,
5220
- alpha: 0,
5221
- syntaxFlags: /* @__PURE__ */ new Set()
5222
- },
5223
- percentage: 0
5224
- }],
5225
- alphaMultiplier: 0
5226
- };
5227
- if (i > 100) for (let e = 0; e < n.length; e++) {
5228
- let a = n[e].percentage;
5229
- a = a / i * 100, n[e].percentage = a;
5230
- }
5231
- if (i < 100) {
5232
- o = i / 100;
5233
- for (let e = 0; e < n.length; e++) {
5234
- let a = n[e].percentage;
5235
- a = a / i * 100, n[e].percentage = a;
5236
- }
5237
- }
5238
- return {
5239
- colors: n,
5240
- alphaMultiplier: o
5241
- };
5196
+ return !!o && (n.push({
5197
+ color: o,
5198
+ percentage: t
5199
+ }), n);
5242
5200
  }
5243
5201
  function colorMixRectangular(e, a) {
5244
- if (!a || !a.colors.length) return !1;
5245
- const n = a.colors.slice();
5246
- let r;
5247
- switch (n.reverse(), e) {
5202
+ if (!a || !a.length) return !1;
5203
+ for (const e of a) if (e.percentage && (e.percentage < 0 || e.percentage > 100)) return !1;
5204
+ const { items: n, leftover: r } = normalizeMixPercentages(a, !0), o = 1 - r / 100;
5205
+ let t;
5206
+ switch (e) {
5248
5207
  case "srgb":
5249
- r = he.RGB;
5208
+ t = he.RGB;
5250
5209
  break;
5251
5210
  case "srgb-linear":
5252
- r = he.Linear_sRGB;
5211
+ t = he.Linear_sRGB;
5253
5212
  break;
5254
5213
  case "display-p3":
5255
- r = he.Display_P3;
5214
+ t = he.Display_P3;
5256
5215
  break;
5257
5216
  case "display-p3-linear":
5258
- r = he.Linear_Display_P3;
5217
+ t = he.Linear_Display_P3;
5259
5218
  break;
5260
5219
  case "a98-rgb":
5261
- r = he.A98_RGB;
5220
+ t = he.A98_RGB;
5262
5221
  break;
5263
5222
  case "prophoto-rgb":
5264
- r = he.ProPhoto_RGB;
5223
+ t = he.ProPhoto_RGB;
5265
5224
  break;
5266
5225
  case "rec2020":
5267
- r = he.Rec2020;
5226
+ t = he.Rec2020;
5268
5227
  break;
5269
5228
  case "lab":
5270
- r = he.Lab;
5229
+ t = he.Lab;
5271
5230
  break;
5272
5231
  case "oklab":
5273
- r = he.OKLab;
5232
+ t = he.OKLab;
5274
5233
  break;
5275
5234
  case "xyz-d50":
5276
- r = he.XYZ_D50;
5235
+ t = he.XYZ_D50;
5277
5236
  break;
5278
5237
  case "xyz":
5279
5238
  case "xyz-d65":
5280
- r = he.XYZ_D65;
5239
+ t = he.XYZ_D65;
5281
5240
  break;
5282
5241
  default: return !1;
5283
5242
  }
5284
5243
  if (1 === n.length) {
5285
- const e = colorDataTo(n[0].color, r);
5286
- return e.colorNotation = r, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * a.alphaMultiplier, e);
5244
+ const e = colorDataTo(n[0].color, t);
5245
+ return e.colorNotation = t, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * o, e);
5287
5246
  }
5288
- for (; n.length >= 2;) {
5247
+ for (n.reverse(); n.length >= 2;) {
5289
5248
  const e = n.pop(), a = n.pop();
5290
5249
  if (!e || !a) return !1;
5291
- const o = colorMixRectangularPair(r, e.color, e.percentage, a.color, a.percentage);
5292
- if (!o) return !1;
5250
+ const r = e.percentage + a.percentage, o = r > 0 ? a.percentage / r : .5, l = colorMixRectangularPair(t, e.color, a.color, o);
5251
+ if (!l) return !1;
5293
5252
  n.push({
5294
- color: o,
5295
- percentage: e.percentage + a.percentage
5253
+ color: l,
5254
+ percentage: r
5296
5255
  });
5297
5256
  }
5298
- const o = n[0]?.color;
5299
- 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));
5257
+ const l = n[0]?.color;
5258
+ 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);
5300
5259
  }
5301
- function colorMixRectangularPair(e, a, n, r, o) {
5302
- const l = n / (n + o);
5303
- let t = a.alpha;
5260
+ function colorMixRectangularPair(e, a, n, r) {
5261
+ let o = a.alpha;
5262
+ if ("number" != typeof o) return !1;
5263
+ let t = n.alpha;
5304
5264
  if ("number" != typeof t) return !1;
5305
- let s = r.alpha;
5306
- if ("number" != typeof s) return !1;
5307
- t = Number.isNaN(t) ? s : t, s = Number.isNaN(s) ? t : s;
5308
- const u = colorDataTo(a, e).channels, i = colorDataTo(r, e).channels;
5309
- 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);
5310
- const c = interpolate(t, s, l);
5265
+ o = Number.isNaN(o) ? t : o, t = Number.isNaN(t) ? o : t;
5266
+ const l = colorDataTo(a, e).channels, s = colorDataTo(n, e).channels;
5267
+ 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);
5268
+ const u = interpolate(o, t, r);
5311
5269
  return {
5312
5270
  colorNotation: e,
5313
5271
  channels: [
5314
- un_premultiply(interpolate(u[0], i[0], l), c),
5315
- un_premultiply(interpolate(u[1], i[1], l), c),
5316
- un_premultiply(interpolate(u[2], i[2], l), c)
5272
+ un_premultiply(interpolate(l[0], s[0], r), u),
5273
+ un_premultiply(interpolate(l[1], s[1], r), u),
5274
+ un_premultiply(interpolate(l[2], s[2], r), u)
5317
5275
  ],
5318
- alpha: c,
5276
+ alpha: u,
5319
5277
  syntaxFlags: new Set([me.ColorMix])
5320
5278
  };
5321
5279
  }
5322
5280
  function colorMixPolar(e, a, n) {
5323
- if (!n || !n.colors.length) return !1;
5324
- const r = n.colors.slice();
5325
- let o;
5326
- switch (r.reverse(), e) {
5281
+ if (!n || !n.length) return !1;
5282
+ for (const e of n) if (e.percentage && (e.percentage < 0 || e.percentage > 100)) return !1;
5283
+ const { items: r, leftover: o } = normalizeMixPercentages(n, !0), t = 1 - o / 100;
5284
+ let l;
5285
+ switch (e) {
5327
5286
  case "hsl":
5328
- o = he.HSL;
5287
+ l = he.HSL;
5329
5288
  break;
5330
5289
  case "hwb":
5331
- o = he.HWB;
5290
+ l = he.HWB;
5332
5291
  break;
5333
5292
  case "lch":
5334
- o = he.LCH;
5293
+ l = he.LCH;
5335
5294
  break;
5336
5295
  case "oklch":
5337
- o = he.OKLCH;
5296
+ l = he.OKLCH;
5338
5297
  break;
5339
5298
  default: return !1;
5340
5299
  }
5341
5300
  if (1 === r.length) {
5342
- const e = colorDataTo(r[0].color, o);
5343
- return e.colorNotation = o, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * n.alphaMultiplier, e);
5301
+ const e = colorDataTo(r[0].color, l);
5302
+ return e.colorNotation = l, e.syntaxFlags.add(me.ColorMixVariadic), "number" != typeof e.alpha ? !1 : (e.alpha = e.alpha * t, e);
5344
5303
  }
5345
- for (; r.length >= 2;) {
5304
+ for (r.reverse(); r.length >= 2;) {
5346
5305
  const e = r.pop(), n = r.pop();
5347
5306
  if (!e || !n) return !1;
5348
- const l = colorMixPolarPair(o, a, e.color, e.percentage, n.color, n.percentage);
5349
- if (!l) return !1;
5307
+ const o = e.percentage + n.percentage, t = o > 0 ? n.percentage / o : .5, s = colorMixPolarPair(l, a, e.color, n.color, t);
5308
+ if (!s) return !1;
5350
5309
  r.push({
5351
- color: l,
5352
- percentage: e.percentage + n.percentage
5310
+ color: s,
5311
+ percentage: o
5353
5312
  });
5354
5313
  }
5355
- const l = r[0]?.color;
5356
- 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));
5357
- }
5358
- function colorMixPolarPair(e, a, n, r, o, l) {
5359
- const t = r / (r + l);
5360
- let s = 0, u = 0, i = 0, c = 0, h = 0, m = 0, p = n.alpha;
5361
- if ("number" != typeof p) return !1;
5362
- let N = o.alpha;
5363
- if ("number" != typeof N) return !1;
5364
- p = Number.isNaN(p) ? N : p, N = Number.isNaN(N) ? p : N;
5365
- const b = colorDataTo(n, e).channels, g = colorDataTo(o, e).channels;
5314
+ const s = r[0]?.color;
5315
+ 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);
5316
+ }
5317
+ function colorMixPolarPair(e, a, n, r, o) {
5318
+ let t = 0, l = 0, s = 0, u = 0, i = 0, c = 0, h = n.alpha;
5319
+ if ("number" != typeof h) return !1;
5320
+ let m = r.alpha;
5321
+ if ("number" != typeof m) return !1;
5322
+ h = Number.isNaN(h) ? m : h, m = Number.isNaN(m) ? h : m;
5323
+ const N = colorDataTo(n, e).channels, p = colorDataTo(r, e).channels;
5366
5324
  switch (e) {
5367
5325
  case he.HSL:
5368
5326
  case he.HWB:
5369
- s = b[0], u = g[0], i = b[1], c = g[1], h = b[2], m = g[2];
5327
+ t = N[0], l = p[0], s = N[1], u = p[1], i = N[2], c = p[2];
5370
5328
  break;
5371
5329
  case he.LCH:
5372
- case he.OKLCH: i = b[0], c = g[0], h = b[1], m = g[1], s = b[2], u = g[2];
5330
+ case he.OKLCH: s = N[0], u = p[0], i = N[1], c = p[1], t = N[2], l = p[2];
5373
5331
  }
5374
- 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);
5375
- const v = u - s;
5376
- switch (a) {
5377
- case "shorter":
5378
- v > 180 ? s += 360 : v < -180 && (u += 360);
5379
- break;
5380
- case "longer":
5381
- -180 < v && v < 180 && (v > 0 ? s += 360 : u += 360);
5382
- break;
5383
- case "increasing":
5384
- v < 0 && (u += 360);
5385
- break;
5386
- case "decreasing":
5387
- v > 0 && (s += 360);
5388
- break;
5389
- default: throw new Error("Unknown hue interpolation method");
5332
+ 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));
5333
+ else {
5334
+ Number.isNaN(t) ? t = 0 : Number.isNaN(l) && (l = 0);
5335
+ const e = l - t;
5336
+ switch (a) {
5337
+ case "shorter":
5338
+ e > 180 ? t += 360 : e < -180 && (l += 360);
5339
+ break;
5340
+ case "longer":
5341
+ -180 < e && e < 180 && (e > 0 ? t += 360 : l += 360);
5342
+ break;
5343
+ case "increasing":
5344
+ e < 0 && (l += 360);
5345
+ break;
5346
+ case "decreasing":
5347
+ e > 0 && (t += 360);
5348
+ break;
5349
+ default: throw new Error("Unknown hue interpolation method");
5350
+ }
5390
5351
  }
5391
- i = premultiply(i, p), h = premultiply(h, p), c = premultiply(c, N), m = premultiply(m, N);
5392
- let f = [
5352
+ s = premultiply(s, h), i = premultiply(i, h), u = premultiply(u, m), c = premultiply(c, m);
5353
+ let b = [
5393
5354
  0,
5394
5355
  0,
5395
5356
  0
5396
5357
  ];
5397
- const y = interpolate(p, N, t);
5358
+ const v = interpolate(h, m, o);
5398
5359
  switch (e) {
5399
5360
  case he.HSL:
5400
5361
  case he.HWB:
5401
- f = [
5402
- interpolate(s, u, t),
5403
- un_premultiply(interpolate(i, c, t), y),
5404
- un_premultiply(interpolate(h, m, t), y)
5362
+ b = [
5363
+ interpolate(t, l, o),
5364
+ un_premultiply(interpolate(s, u, o), v),
5365
+ un_premultiply(interpolate(i, c, o), v)
5405
5366
  ];
5406
5367
  break;
5407
5368
  case he.LCH:
5408
- case he.OKLCH: f = [
5409
- un_premultiply(interpolate(i, c, t), y),
5410
- un_premultiply(interpolate(h, m, t), y),
5411
- interpolate(s, u, t)
5369
+ case he.OKLCH: b = [
5370
+ un_premultiply(interpolate(s, u, o), v),
5371
+ un_premultiply(interpolate(i, c, o), v),
5372
+ interpolate(t, l, o)
5412
5373
  ];
5413
5374
  }
5414
5375
  return {
5415
5376
  colorNotation: e,
5416
- channels: f,
5417
- alpha: y,
5377
+ channels: b,
5378
+ alpha: v,
5418
5379
  syntaxFlags: new Set([me.ColorMix])
5419
5380
  };
5420
5381
  }
@@ -5422,7 +5383,7 @@ function fillInMissingComponent(e, a) {
5422
5383
  return Number.isNaN(e) ? a : e;
5423
5384
  }
5424
5385
  function interpolate(e, a, n) {
5425
- return e * n + a * (1 - n);
5386
+ return e * (1 - n) + a * n;
5426
5387
  }
5427
5388
  function premultiply(e, a) {
5428
5389
  return Number.isNaN(a) ? e : Number.isNaN(e) ? NaN : e * a;
@@ -5430,6 +5391,21 @@ function premultiply(e, a) {
5430
5391
  function un_premultiply(e, a) {
5431
5392
  return 0 === a || Number.isNaN(a) ? e : Number.isNaN(e) ? NaN : e / a;
5432
5393
  }
5394
+ function normalizeMixPercentages(e, a = !1) {
5395
+ let n = 0, r = 0;
5396
+ for (const a of e) a.percentage && (n += a.percentage), !1 === a.percentage && r++;
5397
+ n = Math.min(100, n);
5398
+ for (const a of e) !1 === a.percentage && (a.percentage = (100 - n) / r);
5399
+ const o = e.slice();
5400
+ let t = 0;
5401
+ for (const e of o) t += e.percentage;
5402
+ if (t > 100 || t > 0 && a) for (const e of o) e.percentage = e.percentage * (100 / t);
5403
+ let l = 0;
5404
+ return t < 100 && (l = 100 - t), {
5405
+ items: o,
5406
+ leftover: l
5407
+ };
5408
+ }
5433
5409
  function hex(e) {
5434
5410
  const a = toLowerCaseAZ(e[4].value);
5435
5411
  if (a.match(/[^a-f0-9]/)) return !1;
@@ -5460,25 +5436,25 @@ function hex(e) {
5460
5436
  ], n;
5461
5437
  }
5462
5438
  if (4 === r) {
5463
- const e = a[0], r = a[1], o = a[2], l = a[3];
5439
+ const e = a[0], r = a[1], o = a[2], t = a[3];
5464
5440
  return n.channels = [
5465
5441
  parseInt(e + e, 16) / 255,
5466
5442
  parseInt(r + r, 16) / 255,
5467
5443
  parseInt(o + o, 16) / 255
5468
- ], n.alpha = parseInt(l + l, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5444
+ ], n.alpha = parseInt(t + t, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5469
5445
  }
5470
5446
  if (8 === r) {
5471
- const e = a[0] + a[1], r = a[2] + a[3], o = a[4] + a[5], l = a[6] + a[7];
5447
+ const e = a[0] + a[1], r = a[2] + a[3], o = a[4] + a[5], t = a[6] + a[7];
5472
5448
  return n.channels = [
5473
5449
  parseInt(e, 16) / 255,
5474
5450
  parseInt(r, 16) / 255,
5475
5451
  parseInt(o, 16) / 255
5476
- ], n.alpha = parseInt(l, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5452
+ ], n.alpha = parseInt(t, 16) / 255, n.syntaxFlags.add(me.HasAlpha), n;
5477
5453
  }
5478
5454
  return !1;
5479
5455
  }
5480
5456
  function normalizeHue(n) {
5481
- if (isTokenNumber(n)) return n[4].value = n[4].value % 360, n[1] = n[4].value.toString(), n;
5457
+ 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;
5482
5458
  if (isTokenDimension(n)) {
5483
5459
  let r = n[4].value;
5484
5460
  switch (toLowerCaseAZ(n[4].unit)) {
@@ -5494,7 +5470,7 @@ function normalizeHue(n) {
5494
5470
  break;
5495
5471
  default: return !1;
5496
5472
  }
5497
- return r %= 360, [
5473
+ return Number.isNaN(n[4].value) || Number.isFinite(n[4].value) || (n[4].value = 0), r %= 360, r < 0 && (r += 360), [
5498
5474
  c$7.Number,
5499
5475
  r.toString(),
5500
5476
  n[2],
@@ -5507,15 +5483,15 @@ function normalizeHue(n) {
5507
5483
  }
5508
5484
  return !1;
5509
5485
  }
5510
- function normalize_legacy_HSL_ChannelValues(n, l, t) {
5511
- if (0 === l) {
5486
+ function normalize_legacy_HSL_ChannelValues(n, t, l) {
5487
+ if (0 === t) {
5512
5488
  const e = normalizeHue(n);
5513
- return !1 !== e && (isTokenDimension(n) && t.syntaxFlags.add(me.HasDimensionValues), e);
5489
+ return !1 !== e && (isTokenDimension(n) && l.syntaxFlags.add(me.HasDimensionValues), e);
5514
5490
  }
5515
5491
  if (isTokenPercentage(n)) {
5516
- 3 === l ? t.syntaxFlags.add(me.HasPercentageAlpha) : t.syntaxFlags.add(me.HasPercentageValues);
5492
+ 3 === t ? l.syntaxFlags.add(me.HasPercentageAlpha) : l.syntaxFlags.add(me.HasPercentageValues);
5517
5493
  let r = normalize(n[4].value, 1, 0, 100);
5518
- return 3 === l && (r = normalize(n[4].value, 100, 0, 1)), [
5494
+ return 3 === t && (r = normalize(n[4].value, 100, 0, 1)), [
5519
5495
  c$7.Number,
5520
5496
  r.toString(),
5521
5497
  n[2],
@@ -5527,9 +5503,9 @@ function normalize_legacy_HSL_ChannelValues(n, l, t) {
5527
5503
  ];
5528
5504
  }
5529
5505
  if (isTokenNumber(n)) {
5530
- if (3 !== l) return !1;
5506
+ if (3 !== t) return !1;
5531
5507
  let r = normalize(n[4].value, 1, 0, 100);
5532
- return 3 === l && (r = normalize(n[4].value, 1, 0, 1)), [
5508
+ return 3 === t && (r = normalize(n[4].value, 1, 0, 1)), [
5533
5509
  c$7.Number,
5534
5510
  r.toString(),
5535
5511
  n[2],
@@ -5542,43 +5518,43 @@ function normalize_legacy_HSL_ChannelValues(n, l, t) {
5542
5518
  }
5543
5519
  return !1;
5544
5520
  }
5545
- function normalize_modern_HSL_ChannelValues(l, t, s) {
5546
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5521
+ function normalize_modern_HSL_ChannelValues(t, l, s) {
5522
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5547
5523
  c$7.Number,
5548
5524
  "none",
5549
- l[2],
5550
- l[3],
5525
+ t[2],
5526
+ t[3],
5551
5527
  {
5552
5528
  value: NaN,
5553
5529
  type: a$8.Number
5554
5530
  }
5555
5531
  ];
5556
- if (0 === t) {
5557
- const e = normalizeHue(l);
5558
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5532
+ if (0 === l) {
5533
+ const e = normalizeHue(t);
5534
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5559
5535
  }
5560
- if (isTokenPercentage(l)) {
5561
- 3 === t ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5562
- let n = l[4].value;
5563
- return 3 === t ? n = normalize(l[4].value, 100, 0, 1) : 1 === t && (n = normalize(l[4].value, 1, 0, 2147483647)), [
5536
+ if (isTokenPercentage(t)) {
5537
+ 3 === l ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5538
+ let n = t[4].value;
5539
+ return 3 === l ? n = normalize(t[4].value, 100, 0, 1) : 1 === l && (n = normalize(t[4].value, 1, 0, 2147483647)), [
5564
5540
  c$7.Number,
5565
5541
  n.toString(),
5566
- l[2],
5567
- l[3],
5542
+ t[2],
5543
+ t[3],
5568
5544
  {
5569
5545
  value: n,
5570
5546
  type: a$8.Number
5571
5547
  }
5572
5548
  ];
5573
5549
  }
5574
- if (isTokenNumber(l)) {
5575
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5576
- let n = l[4].value;
5577
- return 3 === t ? n = normalize(l[4].value, 1, 0, 1) : 1 === t && (n = normalize(l[4].value, 1, 0, 2147483647)), [
5550
+ if (isTokenNumber(t)) {
5551
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5552
+ let n = t[4].value;
5553
+ return 3 === l ? n = normalize(t[4].value, 1, 0, 1) : 1 === l && (n = normalize(t[4].value, 1, 0, 2147483647)), [
5578
5554
  c$7.Number,
5579
5555
  n.toString(),
5580
- l[2],
5581
- l[3],
5556
+ t[2],
5557
+ t[3],
5582
5558
  {
5583
5559
  value: n,
5584
5560
  type: a$8.Number
@@ -5588,7 +5564,7 @@ function normalize_modern_HSL_ChannelValues(l, t, s) {
5588
5564
  return !1;
5589
5565
  }
5590
5566
  function threeChannelLegacySyntax(e, a, n, r) {
5591
- const l = [], u = [], i = [], c = [], h = {
5567
+ const t = [], u = [], i = [], c = [], h = {
5592
5568
  colorNotation: n,
5593
5569
  channels: [
5594
5570
  0,
@@ -5598,12 +5574,12 @@ function threeChannelLegacySyntax(e, a, n, r) {
5598
5574
  alpha: 1,
5599
5575
  syntaxFlags: new Set(r)
5600
5576
  };
5601
- let m = l;
5577
+ let m = t;
5602
5578
  for (let a = 0; a < e.value.length; a++) {
5603
5579
  let n = e.value[a];
5604
5580
  if (!isWhitespaceNode(n) && !isCommentNode(n)) {
5605
5581
  if (isTokenNode(n) && isTokenComma(n.value)) {
5606
- if (m === l) {
5582
+ if (m === t) {
5607
5583
  m = u;
5608
5584
  continue;
5609
5585
  }
@@ -5637,34 +5613,34 @@ function threeChannelLegacySyntax(e, a, n, r) {
5637
5613
  }
5638
5614
  }
5639
5615
  if (1 !== m.length) return !1;
5640
- if (1 !== l.length || 1 !== u.length || 1 !== i.length) return !1;
5641
- if (!isTokenNode(l[0]) || !isTokenNode(u[0]) || !isTokenNode(i[0])) return !1;
5642
- const p = a(l[0].value, 0, h);
5643
- if (!p || !isTokenNumber(p)) return !1;
5644
- const N = a(u[0].value, 1, h);
5616
+ if (1 !== t.length || 1 !== u.length || 1 !== i.length) return !1;
5617
+ if (!isTokenNode(t[0]) || !isTokenNode(u[0]) || !isTokenNode(i[0])) return !1;
5618
+ const N = a(t[0].value, 0, h);
5645
5619
  if (!N || !isTokenNumber(N)) return !1;
5620
+ const p = a(u[0].value, 1, h);
5621
+ if (!p || !isTokenNumber(p)) return !1;
5646
5622
  const b = a(i[0].value, 2, h);
5647
5623
  if (!b || !isTokenNumber(b)) return !1;
5648
- const g = [
5649
- p,
5624
+ const v = [
5650
5625
  N,
5626
+ p,
5651
5627
  b
5652
5628
  ];
5653
5629
  if (1 === c.length) if (h.syntaxFlags.add(me.HasAlpha), isTokenNode(c[0])) {
5654
5630
  const e = a(c[0].value, 3, h);
5655
5631
  if (!e || !isTokenNumber(e)) return !1;
5656
- g.push(e);
5632
+ v.push(e);
5657
5633
  } else h.alpha = c[0];
5658
5634
  return h.channels = [
5659
- g[0][4].value,
5660
- g[1][4].value,
5661
- g[2][4].value
5662
- ], 4 === g.length && (h.alpha = g[3][4].value), h;
5635
+ v[0][4].value,
5636
+ v[1][4].value,
5637
+ v[2][4].value
5638
+ ], 4 === v.length && (h.alpha = v[3][4].value), h;
5663
5639
  }
5664
5640
  function threeChannelSpaceSeparated(e, a, r, s, u) {
5665
5641
  const i = [], c = [], h = [], m = [];
5666
- let p, N, b = !1;
5667
- const g = {
5642
+ let N, p, b = !1;
5643
+ const v = {
5668
5644
  colorNotation: r,
5669
5645
  channels: [
5670
5646
  0,
@@ -5674,23 +5650,23 @@ function threeChannelSpaceSeparated(e, a, r, s, u) {
5674
5650
  alpha: 1,
5675
5651
  syntaxFlags: new Set(s)
5676
5652
  };
5677
- let v = i;
5653
+ let f = i;
5678
5654
  for (let a = 0; a < e.value.length; a++) {
5679
5655
  let o = e.value[a];
5680
5656
  if (isWhitespaceNode(o) || isCommentNode(o)) for (; isWhitespaceNode(e.value[a + 1]) || isCommentNode(e.value[a + 1]);) a++;
5681
- else if (v === i && i.length && (v = c), v === c && c.length && (v = h), isTokenNode(o) && isTokenDelim(o.value) && "/" === o.value[4].value) {
5682
- if (v === m) return !1;
5683
- v = m;
5657
+ else if (f === i && i.length && (f = c), f === c && c.length && (f = h), isTokenNode(o) && isTokenDelim(o.value) && "/" === o.value[4].value) {
5658
+ if (f === m) return !1;
5659
+ f = m;
5684
5660
  } else {
5685
5661
  if (isFunctionNode(o)) {
5686
- if (v === m && "var" === o.getName().toLowerCase()) {
5687
- g.syntaxFlags.add(me.HasVariableAlpha), v.push(o);
5662
+ if (f === m && "var" === o.getName().toLowerCase()) {
5663
+ v.syntaxFlags.add(me.HasVariableAlpha), f.push(o);
5688
5664
  continue;
5689
5665
  }
5690
5666
  if (!Q$1.has(o.getName().toLowerCase())) return !1;
5691
5667
  const [[e]] = calcFromComponentValues([[o]], {
5692
5668
  censorIntoStandardRepresentableValues: !0,
5693
- globals: N,
5669
+ globals: p,
5694
5670
  precision: -1,
5695
5671
  toCanonicalUnits: !0,
5696
5672
  rawPercentages: !0
@@ -5698,54 +5674,54 @@ function threeChannelSpaceSeparated(e, a, r, s, u) {
5698
5674
  if (!e || !isTokenNode(e) || !isTokenNumeric(e.value)) return !1;
5699
5675
  Number.isNaN(e.value[4].value) && (e.value[4].value = 0), o = e;
5700
5676
  }
5701
- if (v === i && 0 === i.length && isTokenNode(o) && isTokenIdent(o.value) && "from" === o.value[4].value.toLowerCase()) {
5677
+ if (f === i && 0 === i.length && isTokenNode(o) && isTokenIdent(o.value) && "from" === o.value[4].value.toLowerCase()) {
5702
5678
  if (b) return !1;
5703
5679
  for (; isWhitespaceNode(e.value[a + 1]) || isCommentNode(e.value[a + 1]);) a++;
5704
5680
  if (a++, o = e.value[a], b = u(o), !1 === b) return !1;
5705
- 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);
5681
+ 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);
5706
5682
  } else {
5707
5683
  if (!isTokenNode(o)) return !1;
5708
- if (isTokenIdent(o.value) && p) {
5684
+ if (isTokenIdent(o.value) && N) {
5709
5685
  const e = o.value[4].value.toLowerCase();
5710
- if (p.has(e)) {
5711
- v.push(new TokenNode(p.get(e)));
5686
+ if (N.has(e)) {
5687
+ f.push(new TokenNode(N.get(e)));
5712
5688
  continue;
5713
5689
  }
5714
5690
  }
5715
- v.push(o);
5691
+ f.push(o);
5716
5692
  }
5717
5693
  }
5718
5694
  }
5719
- if (1 !== v.length) return !1;
5695
+ if (1 !== f.length) return !1;
5720
5696
  if (1 !== i.length || 1 !== c.length || 1 !== h.length) return !1;
5721
5697
  if (!isTokenNode(i[0]) || !isTokenNode(c[0]) || !isTokenNode(h[0])) return !1;
5722
- if (p && !p.has("alpha")) return !1;
5723
- const f = a(i[0].value, 0, g);
5724
- if (!f || !isTokenNumber(f)) return !1;
5725
- const y = a(c[0].value, 1, g);
5698
+ if (N && !N.has("alpha")) return !1;
5699
+ const g = a(i[0].value, 0, v);
5700
+ if (!g || !isTokenNumber(g)) return !1;
5701
+ const y = a(c[0].value, 1, v);
5726
5702
  if (!y || !isTokenNumber(y)) return !1;
5727
- const d = a(h[0].value, 2, g);
5703
+ const d = a(h[0].value, 2, v);
5728
5704
  if (!d || !isTokenNumber(d)) return !1;
5729
5705
  const _ = [
5730
- f,
5706
+ g,
5731
5707
  y,
5732
5708
  d
5733
5709
  ];
5734
- if (1 === m.length) if (g.syntaxFlags.add(me.HasAlpha), isTokenNode(m[0])) {
5735
- const e = a(m[0].value, 3, g);
5710
+ if (1 === m.length) if (v.syntaxFlags.add(me.HasAlpha), isTokenNode(m[0])) {
5711
+ const e = a(m[0].value, 3, v);
5736
5712
  if (!e || !isTokenNumber(e)) return !1;
5737
5713
  _.push(e);
5738
- } else g.alpha = m[0];
5739
- else if (p && p.has("alpha")) {
5740
- const e = a(p.get("alpha"), 3, g);
5714
+ } else v.alpha = m[0];
5715
+ else if (N && N.has("alpha")) {
5716
+ const e = a(N.get("alpha"), 3, v);
5741
5717
  if (!e || !isTokenNumber(e)) return !1;
5742
5718
  _.push(e);
5743
5719
  }
5744
- return g.channels = [
5720
+ return v.channels = [
5745
5721
  _[0][4].value,
5746
5722
  _[1][4].value,
5747
5723
  _[2][4].value
5748
- ], 4 === _.length && (g.alpha = _[3][4].value), g;
5724
+ ], 4 === _.length && (v.alpha = _[3][4].value), v;
5749
5725
  }
5750
5726
  function hsl(e, a) {
5751
5727
  if (e.value.some((e) => isTokenNode(e) && isTokenComma(e.value))) {
@@ -5764,43 +5740,43 @@ function hslCommaSeparated(e) {
5764
5740
  function hslSpaceSeparated(e, a) {
5765
5741
  return threeChannelSpaceSeparated(e, normalize_modern_HSL_ChannelValues, he.HSL, [], a);
5766
5742
  }
5767
- function normalize_HWB_ChannelValues(l, t, s) {
5768
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5743
+ function normalize_HWB_ChannelValues(t, l, s) {
5744
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5769
5745
  c$7.Number,
5770
5746
  "none",
5771
- l[2],
5772
- l[3],
5747
+ t[2],
5748
+ t[3],
5773
5749
  {
5774
5750
  value: NaN,
5775
5751
  type: a$8.Number
5776
5752
  }
5777
5753
  ];
5778
- if (0 === t) {
5779
- const e = normalizeHue(l);
5780
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5754
+ if (0 === l) {
5755
+ const e = normalizeHue(t);
5756
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5781
5757
  }
5782
- if (isTokenPercentage(l)) {
5783
- 3 === t ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5784
- let n = l[4].value;
5785
- return 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5758
+ if (isTokenPercentage(t)) {
5759
+ 3 === l ? s.syntaxFlags.add(me.HasPercentageAlpha) : s.syntaxFlags.add(me.HasPercentageValues);
5760
+ let n = t[4].value;
5761
+ return 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5786
5762
  c$7.Number,
5787
5763
  n.toString(),
5788
- l[2],
5789
- l[3],
5764
+ t[2],
5765
+ t[3],
5790
5766
  {
5791
5767
  value: n,
5792
5768
  type: a$8.Number
5793
5769
  }
5794
5770
  ];
5795
5771
  }
5796
- if (isTokenNumber(l)) {
5797
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5798
- let n = l[4].value;
5799
- return 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5772
+ if (isTokenNumber(t)) {
5773
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5774
+ let n = t[4].value;
5775
+ return 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5800
5776
  c$7.Number,
5801
5777
  n.toString(),
5802
- l[2],
5803
- l[3],
5778
+ t[2],
5779
+ t[3],
5804
5780
  {
5805
5781
  value: n,
5806
5782
  type: a$8.Number
@@ -5809,39 +5785,39 @@ function normalize_HWB_ChannelValues(l, t, s) {
5809
5785
  }
5810
5786
  return !1;
5811
5787
  }
5812
- function normalize_Lab_ChannelValues(l, t, s) {
5813
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5788
+ function normalize_Lab_ChannelValues(t, l, s) {
5789
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5814
5790
  c$7.Number,
5815
5791
  "none",
5816
- l[2],
5817
- l[3],
5792
+ t[2],
5793
+ t[3],
5818
5794
  {
5819
5795
  value: NaN,
5820
5796
  type: a$8.Number
5821
5797
  }
5822
5798
  ];
5823
- if (isTokenPercentage(l)) {
5824
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5825
- let n = normalize(l[4].value, 1, 0, 100);
5826
- return 1 === t || 2 === t ? n = normalize(l[4].value, .8, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5799
+ if (isTokenPercentage(t)) {
5800
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5801
+ let n = normalize(t[4].value, 1, 0, 100);
5802
+ return 1 === l || 2 === l ? n = normalize(t[4].value, .8, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5827
5803
  c$7.Number,
5828
5804
  n.toString(),
5829
- l[2],
5830
- l[3],
5805
+ t[2],
5806
+ t[3],
5831
5807
  {
5832
5808
  value: n,
5833
5809
  type: a$8.Number
5834
5810
  }
5835
5811
  ];
5836
5812
  }
5837
- if (isTokenNumber(l)) {
5838
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5839
- let n = normalize(l[4].value, 1, 0, 100);
5840
- return 1 === t || 2 === t ? n = normalize(l[4].value, 1, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5813
+ if (isTokenNumber(t)) {
5814
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5815
+ let n = normalize(t[4].value, 1, 0, 100);
5816
+ return 1 === l || 2 === l ? n = normalize(t[4].value, 1, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5841
5817
  c$7.Number,
5842
5818
  n.toString(),
5843
- l[2],
5844
- l[3],
5819
+ t[2],
5820
+ t[3],
5845
5821
  {
5846
5822
  value: n,
5847
5823
  type: a$8.Number
@@ -5853,43 +5829,43 @@ function normalize_Lab_ChannelValues(l, t, s) {
5853
5829
  function lab(e, a) {
5854
5830
  return threeChannelSpaceSeparated(e, normalize_Lab_ChannelValues, he.Lab, [], a);
5855
5831
  }
5856
- function normalize_LCH_ChannelValues(l, t, s) {
5857
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5832
+ function normalize_LCH_ChannelValues(t, l, s) {
5833
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5858
5834
  c$7.Number,
5859
5835
  "none",
5860
- l[2],
5861
- l[3],
5836
+ t[2],
5837
+ t[3],
5862
5838
  {
5863
5839
  value: NaN,
5864
5840
  type: a$8.Number
5865
5841
  }
5866
5842
  ];
5867
- if (2 === t) {
5868
- const e = normalizeHue(l);
5869
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5870
- }
5871
- if (isTokenPercentage(l)) {
5872
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5873
- let n = normalize(l[4].value, 1, 0, 100);
5874
- return 1 === t ? n = normalize(l[4].value, 100 / 150, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5843
+ if (2 === l) {
5844
+ const e = normalizeHue(t);
5845
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5846
+ }
5847
+ if (isTokenPercentage(t)) {
5848
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5849
+ let n = normalize(t[4].value, 1, 0, 100);
5850
+ return 1 === l ? n = normalize(t[4].value, 100 / 150, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5875
5851
  c$7.Number,
5876
5852
  n.toString(),
5877
- l[2],
5878
- l[3],
5853
+ t[2],
5854
+ t[3],
5879
5855
  {
5880
5856
  value: n,
5881
5857
  type: a$8.Number
5882
5858
  }
5883
5859
  ];
5884
5860
  }
5885
- if (isTokenNumber(l)) {
5886
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5887
- let n = normalize(l[4].value, 1, 0, 100);
5888
- return 1 === t ? n = normalize(l[4].value, 1, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5861
+ if (isTokenNumber(t)) {
5862
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5863
+ let n = normalize(t[4].value, 1, 0, 100);
5864
+ return 1 === l ? n = normalize(t[4].value, 1, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5889
5865
  c$7.Number,
5890
5866
  n.toString(),
5891
- l[2],
5892
- l[3],
5867
+ t[2],
5868
+ t[3],
5893
5869
  {
5894
5870
  value: n,
5895
5871
  type: a$8.Number
@@ -5916,39 +5892,39 @@ function namedColor(e) {
5916
5892
  syntaxFlags: new Set([me.ColorKeyword, me.NamedColor])
5917
5893
  };
5918
5894
  }
5919
- function normalize_OKLab_ChannelValues(l, t, s) {
5920
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5895
+ function normalize_OKLab_ChannelValues(t, l, s) {
5896
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5921
5897
  c$7.Number,
5922
5898
  "none",
5923
- l[2],
5924
- l[3],
5899
+ t[2],
5900
+ t[3],
5925
5901
  {
5926
5902
  value: NaN,
5927
5903
  type: a$8.Number
5928
5904
  }
5929
5905
  ];
5930
- if (isTokenPercentage(l)) {
5931
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5932
- let n = normalize(l[4].value, 100, 0, 1);
5933
- return 1 === t || 2 === t ? n = normalize(l[4].value, 250, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5906
+ if (isTokenPercentage(t)) {
5907
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5908
+ let n = normalize(t[4].value, 100, 0, 1);
5909
+ return 1 === l || 2 === l ? n = normalize(t[4].value, 250, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5934
5910
  c$7.Number,
5935
5911
  n.toString(),
5936
- l[2],
5937
- l[3],
5912
+ t[2],
5913
+ t[3],
5938
5914
  {
5939
5915
  value: n,
5940
5916
  type: a$8.Number
5941
5917
  }
5942
5918
  ];
5943
5919
  }
5944
- if (isTokenNumber(l)) {
5945
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5946
- let n = normalize(l[4].value, 1, 0, 1);
5947
- return 1 === t || 2 === t ? n = normalize(l[4].value, 1, -2147483647, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5920
+ if (isTokenNumber(t)) {
5921
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5922
+ let n = normalize(t[4].value, 1, 0, 1);
5923
+ return 1 === l || 2 === l ? n = normalize(t[4].value, 1, -2147483647, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5948
5924
  c$7.Number,
5949
5925
  n.toString(),
5950
- l[2],
5951
- l[3],
5926
+ t[2],
5927
+ t[3],
5952
5928
  {
5953
5929
  value: n,
5954
5930
  type: a$8.Number
@@ -5960,43 +5936,43 @@ function normalize_OKLab_ChannelValues(l, t, s) {
5960
5936
  function oklab(e, a) {
5961
5937
  return threeChannelSpaceSeparated(e, normalize_OKLab_ChannelValues, he.OKLab, [], a);
5962
5938
  }
5963
- function normalize_OKLCH_ChannelValues(l, t, s) {
5964
- if (isTokenIdent(l) && "none" === toLowerCaseAZ(l[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5939
+ function normalize_OKLCH_ChannelValues(t, l, s) {
5940
+ if (isTokenIdent(t) && "none" === toLowerCaseAZ(t[4].value)) return s.syntaxFlags.add(me.HasNoneKeywords), [
5965
5941
  c$7.Number,
5966
5942
  "none",
5967
- l[2],
5968
- l[3],
5943
+ t[2],
5944
+ t[3],
5969
5945
  {
5970
5946
  value: NaN,
5971
5947
  type: a$8.Number
5972
5948
  }
5973
5949
  ];
5974
- if (2 === t) {
5975
- const e = normalizeHue(l);
5976
- return !1 !== e && (isTokenDimension(l) && s.syntaxFlags.add(me.HasDimensionValues), e);
5977
- }
5978
- if (isTokenPercentage(l)) {
5979
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
5980
- let n = normalize(l[4].value, 100, 0, 1);
5981
- return 1 === t ? n = normalize(l[4].value, 250, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
5950
+ if (2 === l) {
5951
+ const e = normalizeHue(t);
5952
+ return !1 !== e && (isTokenDimension(t) && s.syntaxFlags.add(me.HasDimensionValues), e);
5953
+ }
5954
+ if (isTokenPercentage(t)) {
5955
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
5956
+ let n = normalize(t[4].value, 100, 0, 1);
5957
+ return 1 === l ? n = normalize(t[4].value, 250, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
5982
5958
  c$7.Number,
5983
5959
  n.toString(),
5984
- l[2],
5985
- l[3],
5960
+ t[2],
5961
+ t[3],
5986
5962
  {
5987
5963
  value: n,
5988
5964
  type: a$8.Number
5989
5965
  }
5990
5966
  ];
5991
5967
  }
5992
- if (isTokenNumber(l)) {
5993
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
5994
- let n = normalize(l[4].value, 1, 0, 1);
5995
- return 1 === t ? n = normalize(l[4].value, 1, 0, 2147483647) : 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
5968
+ if (isTokenNumber(t)) {
5969
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
5970
+ let n = normalize(t[4].value, 1, 0, 1);
5971
+ return 1 === l ? n = normalize(t[4].value, 1, 0, 2147483647) : 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
5996
5972
  c$7.Number,
5997
5973
  n.toString(),
5998
- l[2],
5999
- l[3],
5974
+ t[2],
5975
+ t[3],
6000
5976
  {
6001
5977
  value: n,
6002
5978
  type: a$8.Number
@@ -6008,9 +5984,9 @@ function normalize_OKLCH_ChannelValues(l, t, s) {
6008
5984
  function oklch(e, a) {
6009
5985
  return threeChannelSpaceSeparated(e, normalize_OKLCH_ChannelValues, he.OKLCH, [], a);
6010
5986
  }
6011
- function normalize_legacy_sRGB_ChannelValues(n, l, t) {
5987
+ function normalize_legacy_sRGB_ChannelValues(n, t, l) {
6012
5988
  if (isTokenPercentage(n)) {
6013
- 3 === l ? t.syntaxFlags.add(me.HasPercentageAlpha) : t.syntaxFlags.add(me.HasPercentageValues);
5989
+ 3 === t ? l.syntaxFlags.add(me.HasPercentageAlpha) : l.syntaxFlags.add(me.HasPercentageValues);
6014
5990
  const r = normalize(n[4].value, 100, 0, 1);
6015
5991
  return [
6016
5992
  c$7.Number,
@@ -6024,9 +6000,9 @@ function normalize_legacy_sRGB_ChannelValues(n, l, t) {
6024
6000
  ];
6025
6001
  }
6026
6002
  if (isTokenNumber(n)) {
6027
- 3 !== l && t.syntaxFlags.add(me.HasNumberValues);
6003
+ 3 !== t && l.syntaxFlags.add(me.HasNumberValues);
6028
6004
  let r = normalize(n[4].value, 255, 0, 1);
6029
- return 3 === l && (r = normalize(n[4].value, 1, 0, 1)), [
6005
+ return 3 === t && (r = normalize(n[4].value, 1, 0, 1)), [
6030
6006
  c$7.Number,
6031
6007
  r.toString(),
6032
6008
  n[2],
@@ -6039,39 +6015,39 @@ function normalize_legacy_sRGB_ChannelValues(n, l, t) {
6039
6015
  }
6040
6016
  return !1;
6041
6017
  }
6042
- function normalize_modern_sRGB_ChannelValues(l, t, s) {
6043
- if (isTokenIdent(l) && "none" === l[4].value.toLowerCase()) return s.syntaxFlags.add(me.HasNoneKeywords), [
6018
+ function normalize_modern_sRGB_ChannelValues(t, l, s) {
6019
+ if (isTokenIdent(t) && "none" === t[4].value.toLowerCase()) return s.syntaxFlags.add(me.HasNoneKeywords), [
6044
6020
  c$7.Number,
6045
6021
  "none",
6046
- l[2],
6047
- l[3],
6022
+ t[2],
6023
+ t[3],
6048
6024
  {
6049
6025
  value: NaN,
6050
6026
  type: a$8.Number
6051
6027
  }
6052
6028
  ];
6053
- if (isTokenPercentage(l)) {
6054
- 3 !== t && s.syntaxFlags.add(me.HasPercentageValues);
6055
- let n = normalize(l[4].value, 100, -2147483647, 2147483647);
6056
- return 3 === t && (n = normalize(l[4].value, 100, 0, 1)), [
6029
+ if (isTokenPercentage(t)) {
6030
+ 3 !== l && s.syntaxFlags.add(me.HasPercentageValues);
6031
+ let n = normalize(t[4].value, 100, -2147483647, 2147483647);
6032
+ return 3 === l && (n = normalize(t[4].value, 100, 0, 1)), [
6057
6033
  c$7.Number,
6058
6034
  n.toString(),
6059
- l[2],
6060
- l[3],
6035
+ t[2],
6036
+ t[3],
6061
6037
  {
6062
6038
  value: n,
6063
6039
  type: a$8.Number
6064
6040
  }
6065
6041
  ];
6066
6042
  }
6067
- if (isTokenNumber(l)) {
6068
- 3 !== t && s.syntaxFlags.add(me.HasNumberValues);
6069
- let n = normalize(l[4].value, 255, -2147483647, 2147483647);
6070
- return 3 === t && (n = normalize(l[4].value, 1, 0, 1)), [
6043
+ if (isTokenNumber(t)) {
6044
+ 3 !== l && s.syntaxFlags.add(me.HasNumberValues);
6045
+ let n = normalize(t[4].value, 255, -2147483647, 2147483647);
6046
+ return 3 === l && (n = normalize(t[4].value, 1, 0, 1)), [
6071
6047
  c$7.Number,
6072
6048
  n.toString(),
6073
- l[2],
6074
- l[3],
6049
+ t[2],
6050
+ t[3],
6075
6051
  {
6076
6052
  value: n,
6077
6053
  type: a$8.Number
@@ -6125,7 +6101,7 @@ function contrastColor(e, a) {
6125
6101
  if (!n) return !1;
6126
6102
  n.channels = convertNaNToZero(n.channels), n.channels = XYZ_D50_to_sRGB_Gamut(colorData_to_XYZ_D50(n).channels), n.colorNotation = he.sRGB;
6127
6103
  const r = {
6128
- colorNotation: he.sRGB,
6104
+ colorNotation: he.RGB,
6129
6105
  channels: [
6130
6106
  0,
6131
6107
  0,
@@ -6165,12 +6141,12 @@ function alpha(e, a) {
6165
6141
  syntaxFlags: /* @__PURE__ */ new Set([])
6166
6142
  };
6167
6143
  for (let m = 0; m < e.value.length; m++) {
6168
- let p = e.value[m];
6169
- if (isWhitespaceNode(p) || isCommentNode(p)) for (; isWhitespaceNode(e.value[m + 1]) || isCommentNode(e.value[m + 1]);) m++;
6170
- else if (c && !u && !i && isTokenNode(p) && isTokenDelim(p.value) && "/" === p.value[4].value) u = !0;
6144
+ let N = e.value[m];
6145
+ if (isWhitespaceNode(N) || isCommentNode(N)) for (; isWhitespaceNode(e.value[m + 1]) || isCommentNode(e.value[m + 1]);) m++;
6146
+ else if (c && !u && !i && isTokenNode(N) && isTokenDelim(N.value) && "/" === N.value[4].value) u = !0;
6171
6147
  else {
6172
- if (isFunctionNode(p) && Q$1.has(toLowerCaseAZ(p.getName()))) {
6173
- const [[e]] = calcFromComponentValues([[p]], {
6148
+ if (isFunctionNode(N) && Q$1.has(toLowerCaseAZ(N.getName()))) {
6149
+ const [[e]] = calcFromComponentValues([[N]], {
6174
6150
  censorIntoStandardRepresentableValues: !0,
6175
6151
  globals: s,
6176
6152
  precision: -1,
@@ -6178,23 +6154,23 @@ function alpha(e, a) {
6178
6154
  rawPercentages: !0
6179
6155
  });
6180
6156
  if (!e || !isTokenNode(e) || !isTokenNumeric(e.value)) return !1;
6181
- Number.isNaN(e.value[4].value) && (e.value[4].value = 0), p = e;
6157
+ Number.isNaN(e.value[4].value) && (e.value[4].value = 0), N = e;
6182
6158
  }
6183
- if (u || i || !isTokenNode(p) || !isTokenIdent(p.value) || "from" !== toLowerCaseAZ(p.value[4].value)) {
6159
+ if (u || i || !isTokenNode(N) || !isTokenIdent(N.value) || "from" !== toLowerCaseAZ(N.value[4].value)) {
6184
6160
  if (!u) return !1;
6185
6161
  if (i) return !1;
6186
- if (isTokenNode(p)) {
6187
- if (isTokenIdent(p.value) && "alpha" === toLowerCaseAZ(p.value[4].value) && r && r.has("alpha")) {
6162
+ if (isTokenNode(N)) {
6163
+ if (isTokenIdent(N.value) && "alpha" === toLowerCaseAZ(N.value[4].value) && r && r.has("alpha")) {
6188
6164
  h.alpha = r.get("alpha")[4].value, i = !0;
6189
6165
  continue;
6190
6166
  }
6191
- const e = normalize_Color_ChannelValues(p.value, 3, h);
6167
+ const e = normalize_Color_ChannelValues(N.value, 3, h);
6192
6168
  if (!e || !isTokenNumber(e)) return !1;
6193
- h.alpha = new TokenNode(e), i = !0;
6169
+ h.alpha = e[4].value, i = !0;
6194
6170
  continue;
6195
6171
  }
6196
- if (isFunctionNode(p)) {
6197
- h.alpha = replaceComponentValues$1([[p]], (e) => {
6172
+ if (isFunctionNode(N)) {
6173
+ h.alpha = replaceComponentValues$1([[N]], (e) => {
6198
6174
  if (isTokenNode(e) && isTokenIdent(e.value) && "alpha" === toLowerCaseAZ(e.value[4].value) && r && r.has("alpha")) return new TokenNode(r.get("alpha"));
6199
6175
  })[0][0], i = !0;
6200
6176
  continue;
@@ -6203,7 +6179,7 @@ function alpha(e, a) {
6203
6179
  }
6204
6180
  if (c) return !1;
6205
6181
  for (; isWhitespaceNode(e.value[m + 1]) || isCommentNode(e.value[m + 1]);) m++;
6206
- if (m++, p = e.value[m], c = a(p), !1 === c) return !1;
6182
+ if (m++, N = e.value[m], c = a(N), !1 === c) return !1;
6207
6183
  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;
6208
6184
  }
6209
6185
  }
@@ -6238,8 +6214,8 @@ function toPrecision(e, a = 7) {
6238
6214
  return Math.round(e / r) * r;
6239
6215
  }
6240
6216
  }
6241
- function serializeWithAlpha(n, r, o, l) {
6242
- const t = [
6217
+ function serializeWithAlpha(n, r, o, t) {
6218
+ const l = [
6243
6219
  c$7.CloseParen,
6244
6220
  ")",
6245
6221
  -1,
@@ -6248,8 +6224,8 @@ function serializeWithAlpha(n, r, o, l) {
6248
6224
  ];
6249
6225
  if ("number" == typeof n.alpha) {
6250
6226
  const s = Math.min(1, Math.max(0, toPrecision(Number.isNaN(n.alpha) ? 0 : n.alpha)));
6251
- return 1 === toPrecision(s, 4) ? new FunctionNode(r, t, l) : new FunctionNode(r, t, [
6252
- ...l,
6227
+ return 1 === toPrecision(s, 4) ? new FunctionNode(r, l, t) : new FunctionNode(r, l, [
6228
+ ...t,
6253
6229
  new WhitespaceNode([o]),
6254
6230
  new TokenNode([
6255
6231
  c$7.Delim,
@@ -6271,8 +6247,8 @@ function serializeWithAlpha(n, r, o, l) {
6271
6247
  ])
6272
6248
  ]);
6273
6249
  }
6274
- return new FunctionNode(r, t, [
6275
- ...l,
6250
+ return new FunctionNode(r, l, [
6251
+ ...t,
6276
6252
  new WhitespaceNode([o]),
6277
6253
  new TokenNode([
6278
6254
  c$7.Delim,
@@ -6289,7 +6265,7 @@ function serializeP3(n, r = !0) {
6289
6265
  n.channels = convertPowerlessComponentsToZeroValuesForDisplay(n.channels, n.colorNotation);
6290
6266
  let o = n.channels.map((e) => Number.isNaN(e) ? 0 : e);
6291
6267
  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));
6292
- 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 = [
6268
+ 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 = [
6293
6269
  c$7.Function,
6294
6270
  "color(",
6295
6271
  -1,
@@ -6313,7 +6289,7 @@ function serializeP3(n, r = !0) {
6313
6289
  new WhitespaceNode([i]),
6314
6290
  new TokenNode([
6315
6291
  c$7.Number,
6316
- l.toString(),
6292
+ t.toString(),
6317
6293
  -1,
6318
6294
  -1,
6319
6295
  {
@@ -6324,7 +6300,7 @@ function serializeP3(n, r = !0) {
6324
6300
  new WhitespaceNode([i]),
6325
6301
  new TokenNode([
6326
6302
  c$7.Number,
6327
- t.toString(),
6303
+ l.toString(),
6328
6304
  -1,
6329
6305
  -1,
6330
6306
  {
@@ -6348,7 +6324,7 @@ function serializeP3(n, r = !0) {
6348
6324
  function serializeRGB(n, r = !0) {
6349
6325
  let o;
6350
6326
  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);
6351
- 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 = [
6327
+ 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 = [
6352
6328
  c$7.CloseParen,
6353
6329
  ")",
6354
6330
  -1,
@@ -6369,7 +6345,7 @@ function serializeRGB(n, r = !0) {
6369
6345
  ], h = [
6370
6346
  new TokenNode([
6371
6347
  c$7.Number,
6372
- l.toString(),
6348
+ t.toString(),
6373
6349
  -1,
6374
6350
  -1,
6375
6351
  {
@@ -6381,7 +6357,7 @@ function serializeRGB(n, r = !0) {
6381
6357
  new WhitespaceNode([i]),
6382
6358
  new TokenNode([
6383
6359
  c$7.Number,
6384
- t.toString(),
6360
+ l.toString(),
6385
6361
  -1,
6386
6362
  -1,
6387
6363
  {
@@ -6448,7 +6424,7 @@ function serializeRGB(n, r = !0) {
6448
6424
  function serializeHSL(n, r = !0) {
6449
6425
  let o;
6450
6426
  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);
6451
- 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 = [
6427
+ 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 = [
6452
6428
  c$7.CloseParen,
6453
6429
  ")",
6454
6430
  -1,
@@ -6469,7 +6445,7 @@ function serializeHSL(n, r = !0) {
6469
6445
  ], h = [
6470
6446
  new TokenNode([
6471
6447
  c$7.Number,
6472
- l.toString(),
6448
+ t.toString(),
6473
6449
  -1,
6474
6450
  -1,
6475
6451
  {
@@ -6481,7 +6457,7 @@ function serializeHSL(n, r = !0) {
6481
6457
  new WhitespaceNode([i]),
6482
6458
  new TokenNode([
6483
6459
  c$7.Percentage,
6484
- t.toString() + "%",
6460
+ l.toString() + "%",
6485
6461
  -1,
6486
6462
  -1,
6487
6463
  { value: o[1] }
@@ -7106,10 +7082,21 @@ const LINEAR_GRADIENT_LAB_RE = /background-image\s*:\s*linear-gradient\(\s*in\s+
7106
7082
  const DISPLAY_P3_COLOR_RE = /color\s*:\s*color\(\s*display-p3\s+0\s+0\s+0%\s*\)/;
7107
7083
  const DISPLAY_P3_VALUE_RE$1 = /color\(\s*display-p3\b/i;
7108
7084
  const COLOR_GAMUT_P3_RE$1 = /\(\s*color-gamut\s*:\s*p3\s*\)/i;
7085
+ const GRADIENT_BACKGROUND_RE = /^(linear|radial|conic)-gradient\(/i;
7086
+ const GRADIENT_STOPS_VAR_RE = /^(?:linear|radial|conic)-gradient\(\s*var\(\s*--tw-gradient-stops\b/i;
7087
+ const SIMPLE_CLASS_SELECTOR_RE = /^\.([_a-z\u00A0-\uFFFF\\-][\w\u00A0-\uFFFF\\-]*)$/i;
7088
+ const COLOR_VAR_RE = /^var\(\s*(--color-[\w-]+)\s*\)$/i;
7089
+ const GRADIENT_DIRECTION_CLASS_RE = /^(?:-?bg-linear|bg-gradient-to-|-?bg-conic|bg-radial)/;
7109
7090
  const RADIUS_VALUE_RE = /\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi;
7110
7091
  const SCIENTIFIC_NOTATION_RE = /e/i;
7111
7092
  const TW_VAR_FUNCTION_RE = /var\(\s*(--tw-[\w-]+)\b/g;
7112
7093
  const TW_CONTENT_VAR_RE$1 = /var\(\s*--tw-content\b/;
7094
+ const TW_GRADIENT_POSITION_PROPS = new Set([
7095
+ "--tw-gradient-from-position",
7096
+ "--tw-gradient-via-position",
7097
+ "--tw-gradient-to-position"
7098
+ ]);
7099
+ const UNSUPPORTED_CUSTOM_PROPERTY_DEFAULT_PROPS = new Set(["--tw-gradient-via-stops"]);
7113
7100
  const DEFAULT_VARIABLE_SCOPE_SELECTORS = new Set([
7114
7101
  "*",
7115
7102
  ":root",
@@ -7158,7 +7145,7 @@ function usesTailwindcssV4ContentVariable(root) {
7158
7145
  return used;
7159
7146
  }
7160
7147
  function createUsedCssVarsV4Nodes(usedProps) {
7161
- return nodes.filter((def) => usedProps.has(def.prop)).map((def) => new Declaration({
7148
+ return nodes.filter((def) => usedProps.has(def.prop) && !UNSUPPORTED_CUSTOM_PROPERTY_DEFAULT_PROPS.has(def.prop)).map((def) => new Declaration({
7162
7149
  prop: def.prop,
7163
7150
  value: def.value
7164
7151
  }));
@@ -7193,11 +7180,250 @@ function collectScopedTailwindcssV4DefaultVariables(root) {
7193
7180
  }
7194
7181
  function createMissingCssVarsV4Nodes(root, usedProps) {
7195
7182
  const scopedProps = collectScopedTailwindcssV4DefaultVariables(root);
7196
- return nodes.filter((def) => usedProps.has(def.prop) && !scopedProps.has(def.prop)).map((def) => new Declaration({
7183
+ return nodes.filter((def) => usedProps.has(def.prop) && !scopedProps.has(def.prop) && !UNSUPPORTED_CUSTOM_PROPERTY_DEFAULT_PROPS.has(def.prop)).map((def) => new Declaration({
7197
7184
  prop: def.prop,
7198
7185
  value: def.value
7199
7186
  }));
7200
7187
  }
7188
+ function collectTailwindcssV4ThemeVariables(root) {
7189
+ const variables = /* @__PURE__ */ new Map();
7190
+ root.walkRules((rule) => {
7191
+ if (!testIfRootHostForV4(rule) && !rule.selector.includes("page") && !rule.selector.includes(".tw-root")) return;
7192
+ rule.walkDecls((decl) => {
7193
+ if (decl.prop.startsWith("--color-")) variables.set(decl.prop, decl.value);
7194
+ });
7195
+ });
7196
+ return variables;
7197
+ }
7198
+ function resolveTailwindcssV4GradientColor(value, themeVariables) {
7199
+ const trimmed = value.trim();
7200
+ const match = COLOR_VAR_RE.exec(trimmed);
7201
+ if (!match) return trimmed;
7202
+ return themeVariables.get(match[1]) ?? trimmed;
7203
+ }
7204
+ function getSingleClassSelector(selector) {
7205
+ const match = SIMPLE_CLASS_SELECTOR_RE.exec(selector.trim());
7206
+ return match ? match[1] : void 0;
7207
+ }
7208
+ function normalizeDeclarationValue(value) {
7209
+ return value.replace(/\s+/g, " ").trim();
7210
+ }
7211
+ function normalizeTailwindcssV4GradientPosition(value) {
7212
+ 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();
7213
+ }
7214
+ function normalizeTailwindcssV4GradientDirectionDeclaration(rule, decl) {
7215
+ const normalized = normalizeTailwindcssV4GradientPosition(decl.value);
7216
+ if (normalized) return normalized;
7217
+ const backgroundImageDecl = rule.nodes.find((node) => {
7218
+ return node.type === "decl" && node.prop === "background-image";
7219
+ });
7220
+ if (!backgroundImageDecl) return normalized;
7221
+ if (/^radial-gradient\(/i.test(backgroundImageDecl.value)) return "at center";
7222
+ if (/^conic-gradient\(/i.test(backgroundImageDecl.value)) return "from 0deg";
7223
+ return normalized;
7224
+ }
7225
+ function appendStopPosition(color, position) {
7226
+ const normalizedPosition = position?.trim();
7227
+ return normalizedPosition ? `${color} ${normalizedPosition}` : color;
7228
+ }
7229
+ function getGradientStopsFallback(value) {
7230
+ if (!value.includes("var(") || !value.includes("--tw-gradient-stops")) return;
7231
+ const parsed = valueParser(value);
7232
+ let fallback;
7233
+ parsed.walk((node) => {
7234
+ if (fallback || node.type !== "function" || node.value.toLowerCase() !== "var") return;
7235
+ const firstCommaIndex = node.nodes.findIndex((child) => child.type === "div" && child.value === ",");
7236
+ const firstArg = node.nodes.find((child) => child.type !== "space");
7237
+ if (firstArg?.type !== "word" || firstArg.value !== "--tw-gradient-stops" || firstCommaIndex < 0) return;
7238
+ fallback = valueParser.stringify(node.nodes.slice(firstCommaIndex + 1)).trim();
7239
+ });
7240
+ return fallback;
7241
+ }
7242
+ function isTailwindcssV4GradientDirectionRule(rule) {
7243
+ const classSelector = getSingleClassSelector(rule.selector);
7244
+ if (!classSelector || !GRADIENT_DIRECTION_CLASS_RE.test(classSelector)) return false;
7245
+ return rule.nodes.some((node) => {
7246
+ return node.type === "decl" && (node.prop === "--tw-gradient-position" || node.prop === "background-image" && node.value.includes("linear-gradient("));
7247
+ });
7248
+ }
7249
+ function reorderTailwindcssV4GradientDirectionRule(rule) {
7250
+ const gradientPositionDecls = [];
7251
+ const gradientBackgroundDecls = [];
7252
+ for (const node of rule.nodes) {
7253
+ if (node.type !== "decl") continue;
7254
+ if (node.prop === "--tw-gradient-position") gradientPositionDecls.push(node);
7255
+ else if (node.prop === "background-image" && node.value.includes("linear-gradient(")) gradientBackgroundDecls.push(node);
7256
+ }
7257
+ if (gradientPositionDecls.length === 0 || gradientBackgroundDecls.length === 0) return;
7258
+ const anchor = rule.nodes.find((node) => {
7259
+ return node.type === "decl" && (node.prop === "--tw-gradient-position" || node.prop === "background-image" && node.value.includes("linear-gradient("));
7260
+ });
7261
+ if (!anchor) return;
7262
+ const ordered = [...gradientPositionDecls, ...gradientBackgroundDecls];
7263
+ const orderedClones = ordered.map((decl) => decl.clone());
7264
+ anchor.replaceWith(...orderedClones);
7265
+ for (const decl of ordered) if (decl.parent) decl.remove();
7266
+ }
7267
+ function mergeTailwindcssV4GradientDirectionRules(root) {
7268
+ const seen = /* @__PURE__ */ new Map();
7269
+ root.walkRules((rule) => {
7270
+ if (!isTailwindcssV4GradientDirectionRule(rule)) return;
7271
+ const selector = rule.selector.trim();
7272
+ const previous = seen.get(selector);
7273
+ if (!previous || previous.parent !== rule.parent) {
7274
+ seen.set(selector, rule);
7275
+ return;
7276
+ }
7277
+ for (const node of [...rule.nodes]) {
7278
+ if (node.type !== "decl") continue;
7279
+ if (node.prop !== "--tw-gradient-position" && node.prop !== "background-image") continue;
7280
+ previous.append(node.clone());
7281
+ }
7282
+ reorderTailwindcssV4GradientDirectionRule(previous);
7283
+ rule.remove();
7284
+ });
7285
+ }
7286
+ function createTailwindcssV4MiniProgramGradientValue(gradient, from, to, via) {
7287
+ const stops = [gradient.position, appendStopPosition(from.color, from.position)];
7288
+ if (via) stops.push(appendStopPosition(via.color, via.position));
7289
+ stops.push(appendStopPosition(to.color, to.position));
7290
+ return `${gradient.type}-gradient(${stops.filter(Boolean).join(", ")})`;
7291
+ }
7292
+ function appendTailwindcssV4MiniProgramGradientRules(root) {
7293
+ const themeVariables = collectTailwindcssV4ThemeVariables(root);
7294
+ const gradients = [];
7295
+ const fromColors = /* @__PURE__ */ new Map();
7296
+ const viaColors = /* @__PURE__ */ new Map();
7297
+ const toColors = /* @__PURE__ */ new Map();
7298
+ const fromPositions = [];
7299
+ const viaPositions = [];
7300
+ const toPositions = [];
7301
+ const directBackgroundImages = [];
7302
+ const existingBackgroundImages = /* @__PURE__ */ new Map();
7303
+ const ruleOrder = /* @__PURE__ */ new Map();
7304
+ let order = 0;
7305
+ root.walkRules((rule) => {
7306
+ const classSelector = getSingleClassSelector(rule.selector);
7307
+ const currentOrder = order++;
7308
+ if (classSelector) ruleOrder.set(classSelector, currentOrder);
7309
+ rule.walkDecls("background-image", (decl) => {
7310
+ const selector = rule.selector.trim();
7311
+ const values = existingBackgroundImages.get(selector);
7312
+ if (values) values.add(normalizeDeclarationValue(decl.value));
7313
+ else existingBackgroundImages.set(selector, new Set([normalizeDeclarationValue(decl.value)]));
7314
+ });
7315
+ if (classSelector) {
7316
+ const gradientPositionDecl = rule.nodes.find((node) => {
7317
+ return node.type === "decl" && node.prop === "--tw-gradient-position";
7318
+ });
7319
+ const gradientBackgroundDecl = rule.nodes.find((node) => {
7320
+ return node.type === "decl" && node.prop === "background-image" && GRADIENT_BACKGROUND_RE.test(node.value);
7321
+ });
7322
+ if (gradientPositionDecl && gradientBackgroundDecl) {
7323
+ const gradientType = GRADIENT_BACKGROUND_RE.exec(gradientBackgroundDecl.value)?.[1];
7324
+ if (gradientType) {
7325
+ gradients.push({
7326
+ classSelector,
7327
+ order: currentOrder,
7328
+ position: normalizeTailwindcssV4GradientDirectionDeclaration(rule, gradientPositionDecl),
7329
+ type: gradientType
7330
+ });
7331
+ const fallback = GRADIENT_STOPS_VAR_RE.test(gradientBackgroundDecl.value) ? getGradientStopsFallback(gradientBackgroundDecl.value) : void 0;
7332
+ if (fallback) directBackgroundImages.push({
7333
+ selector: rule.selector.trim(),
7334
+ value: `${gradientType}-gradient(${fallback})`
7335
+ });
7336
+ }
7337
+ }
7338
+ rule.walkDecls((decl) => {
7339
+ if (decl.prop === "--tw-gradient-from") fromColors.set(classSelector, {
7340
+ classSelector,
7341
+ color: resolveTailwindcssV4GradientColor(decl.value, themeVariables),
7342
+ order: currentOrder
7343
+ });
7344
+ else if (decl.prop === "--tw-gradient-from-position") fromPositions.push({
7345
+ classSelector,
7346
+ position: decl.value
7347
+ });
7348
+ else if (decl.prop === "--tw-gradient-via") viaColors.set(classSelector, {
7349
+ classSelector,
7350
+ color: resolveTailwindcssV4GradientColor(decl.value, themeVariables),
7351
+ order: currentOrder
7352
+ });
7353
+ else if (decl.prop === "--tw-gradient-via-position") viaPositions.push({
7354
+ classSelector,
7355
+ position: decl.value
7356
+ });
7357
+ else if (decl.prop === "--tw-gradient-to") toColors.set(classSelector, {
7358
+ classSelector,
7359
+ color: resolveTailwindcssV4GradientColor(decl.value, themeVariables),
7360
+ order: currentOrder
7361
+ });
7362
+ else if (decl.prop === "--tw-gradient-to-position") toPositions.push({
7363
+ classSelector,
7364
+ position: decl.value
7365
+ });
7366
+ });
7367
+ }
7368
+ });
7369
+ const fromVariants = [];
7370
+ const viaVariants = [];
7371
+ const toVariants = [];
7372
+ const positionedFromVariants = [];
7373
+ const positionedViaVariants = [];
7374
+ const positionedToVariants = [];
7375
+ for (const color of fromColors.values()) {
7376
+ fromVariants.push(color);
7377
+ for (const position of fromPositions) positionedFromVariants.push({
7378
+ ...color,
7379
+ classSelector: `${color.classSelector}.${position.classSelector}`,
7380
+ order: Math.max(color.order, ruleOrder.get(position.classSelector) ?? color.order),
7381
+ position: position.position
7382
+ });
7383
+ }
7384
+ for (const color of viaColors.values()) {
7385
+ viaVariants.push(color);
7386
+ for (const position of viaPositions) positionedViaVariants.push({
7387
+ ...color,
7388
+ classSelector: `${color.classSelector}.${position.classSelector}`,
7389
+ order: Math.max(color.order, ruleOrder.get(position.classSelector) ?? color.order),
7390
+ position: position.position
7391
+ });
7392
+ }
7393
+ for (const color of toColors.values()) {
7394
+ toVariants.push(color);
7395
+ for (const position of toPositions) positionedToVariants.push({
7396
+ ...color,
7397
+ classSelector: `${color.classSelector}.${position.classSelector}`,
7398
+ order: Math.max(color.order, ruleOrder.get(position.classSelector) ?? color.order),
7399
+ position: position.position
7400
+ });
7401
+ }
7402
+ function appendGradientRule(selector, value) {
7403
+ const normalizedValue = normalizeDeclarationValue(value);
7404
+ if (existingBackgroundImages.get(selector)?.has(normalizedValue)) return;
7405
+ existingBackgroundImages.set(selector, new Set([...existingBackgroundImages.get(selector) ?? [], normalizedValue]));
7406
+ root.append(rule({
7407
+ selector,
7408
+ nodes: [new Declaration({
7409
+ prop: "background-image",
7410
+ value
7411
+ })]
7412
+ }));
7413
+ }
7414
+ for (const { selector, value } of directBackgroundImages) appendGradientRule(selector, value);
7415
+ function appendGradientCombinations(gradient, fromRules, viaRules, toRules) {
7416
+ for (const from of fromRules) for (const to of toRules) {
7417
+ appendGradientRule(`.${gradient.classSelector}.${from.classSelector}.${to.classSelector}`, createTailwindcssV4MiniProgramGradientValue(gradient, from, to));
7418
+ for (const via of viaRules) appendGradientRule(`.${gradient.classSelector}.${from.classSelector}.${via.classSelector}.${to.classSelector}`, createTailwindcssV4MiniProgramGradientValue(gradient, from, to, via));
7419
+ }
7420
+ }
7421
+ for (const gradient of gradients) {
7422
+ if (gradient.position.includes(",") || /^var\(/i.test(gradient.position)) continue;
7423
+ appendGradientCombinations(gradient, fromVariants, viaVariants, toVariants);
7424
+ appendGradientCombinations(gradient, positionedFromVariants, positionedViaVariants, positionedToVariants);
7425
+ }
7426
+ }
7201
7427
  function isTailwindcssV4ModernCheck(atRule) {
7202
7428
  return atRule.name === "supports" && [
7203
7429
  MODERN_CHECK_WEBKIT_HYPHENS_RE,
@@ -7232,15 +7458,108 @@ function normalizeTailwindcssV4EmptyVarFallback(value) {
7232
7458
  });
7233
7459
  return changed ? parsed.toString() : value;
7234
7460
  }
7461
+ function normalizeTailwindcssV4GradientStopsFallback(value) {
7462
+ if (!value.includes("var(") || !value.includes("--tw-gradient-via-stops")) return value;
7463
+ const parsed = valueParser(value);
7464
+ let changed = false;
7465
+ function normalizeNodes(nodes) {
7466
+ for (let index = 0; index < nodes.length; index++) {
7467
+ const node = nodes[index];
7468
+ if (!node) continue;
7469
+ if (node.type === "function" && node.value.toLowerCase() !== "var") {
7470
+ normalizeNodes(node.nodes);
7471
+ continue;
7472
+ }
7473
+ if (node.type !== "function") continue;
7474
+ const firstArg = node.nodes.filter((child) => child.type !== "space")[0];
7475
+ if (firstArg?.type !== "word" || firstArg.value !== "--tw-gradient-via-stops") {
7476
+ normalizeNodes(node.nodes);
7477
+ continue;
7478
+ }
7479
+ const firstCommaIndex = node.nodes.findIndex((child) => child.type === "div" && child.value === ",");
7480
+ if (firstCommaIndex < 0) continue;
7481
+ const fallbackNodes = node.nodes.slice(firstCommaIndex + 1);
7482
+ const splitIndex = fallbackNodes.findIndex((child) => child.type === "div" && child.value === ",");
7483
+ if (splitIndex < 0) continue;
7484
+ const viaFallbackNodes = fallbackNodes.slice(0, splitIndex);
7485
+ const stopNodes = fallbackNodes.slice(splitIndex);
7486
+ const nextVarNode = {
7487
+ ...node,
7488
+ nodes: [
7489
+ {
7490
+ type: "word",
7491
+ value: "--tw-gradient-via-stops"
7492
+ },
7493
+ {
7494
+ type: "div",
7495
+ value: ",",
7496
+ before: "",
7497
+ after: " "
7498
+ },
7499
+ ...viaFallbackNodes
7500
+ ],
7501
+ sourceEndIndex: void 0,
7502
+ sourceIndex: void 0
7503
+ };
7504
+ nodes.splice(index, 1, nextVarNode, ...stopNodes);
7505
+ changed = true;
7506
+ index += stopNodes.length;
7507
+ }
7508
+ }
7509
+ normalizeNodes(parsed.nodes);
7510
+ return changed ? parsed.toString() : value;
7511
+ }
7512
+ function normalizeTailwindcssV4GradientPositionFallback(value) {
7513
+ if (!value.includes("var(") || !value.includes("--tw-gradient-")) return value;
7514
+ const parsed = valueParser(value);
7515
+ let changed = false;
7516
+ parsed.walk((node) => {
7517
+ if (node.type !== "function" || node.value.toLowerCase() !== "var") return;
7518
+ const args = node.nodes.filter((child) => child.type !== "space");
7519
+ const firstArg = args[0];
7520
+ if (firstArg?.type !== "word" || !TW_GRADIENT_POSITION_PROPS.has(firstArg.value)) return;
7521
+ const commaIndex = args.findIndex((child) => child.type === "div" && child.value === ",");
7522
+ if (commaIndex === -1 ? void 0 : args[commaIndex]) {
7523
+ if (!args.slice(commaIndex + 1).some((child) => child.type !== "space") && node.after !== " ") {
7524
+ node.after = " ";
7525
+ changed = true;
7526
+ }
7527
+ return;
7528
+ }
7529
+ node.nodes.push({
7530
+ type: "div",
7531
+ value: ",",
7532
+ before: "",
7533
+ after: ""
7534
+ });
7535
+ node.after = " ";
7536
+ changed = true;
7537
+ });
7538
+ return changed ? parsed.toString() : value;
7539
+ }
7235
7540
  function normalizeTailwindcssV4Declaration(decl) {
7236
7541
  let changed = false;
7542
+ if (decl.prop === "--tw-gradient-via-stops" && decl.value.trim() === "initial") {
7543
+ decl.remove();
7544
+ return true;
7545
+ }
7237
7546
  const normalizedEmptyVarFallback = normalizeTailwindcssV4EmptyVarFallback(decl.value);
7238
7547
  if (normalizedEmptyVarFallback !== decl.value) {
7239
7548
  decl.value = normalizedEmptyVarFallback;
7240
7549
  changed = true;
7241
7550
  }
7551
+ const normalizedGradientStopsFallback = normalizeTailwindcssV4GradientStopsFallback(decl.value);
7552
+ if (normalizedGradientStopsFallback !== decl.value) {
7553
+ decl.value = normalizedGradientStopsFallback;
7554
+ changed = true;
7555
+ }
7556
+ const normalizedGradientPositionFallback = normalizeTailwindcssV4GradientPositionFallback(decl.value);
7557
+ if (normalizedGradientPositionFallback !== decl.value) {
7558
+ decl.value = normalizedGradientPositionFallback;
7559
+ changed = true;
7560
+ }
7242
7561
  if (decl.prop === "--tw-gradient-position" && decl.value.endsWith(OKLAB_SUFFIX)) {
7243
- decl.value = decl.value.slice(0, decl.value.length - 8).trimEnd();
7562
+ decl.value = decl.parent?.type === "rule" ? normalizeTailwindcssV4GradientDirectionDeclaration(decl.parent, decl) : normalizeTailwindcssV4GradientPosition(decl.value);
7244
7563
  return true;
7245
7564
  }
7246
7565
  if (INFINITY_CALC_REGEXP.test(decl.value)) {
@@ -7841,6 +8160,10 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
7841
8160
  root.walkAtRules((atRule) => {
7842
8161
  removeUnsupportedMiniProgramPrefixedAtRule(atRule);
7843
8162
  });
8163
+ if (shouldInjectTailwindcssV4Defaults) {
8164
+ mergeTailwindcssV4GradientDirectionRules(root);
8165
+ if (options.tailwindcssV4GradientFallback === true) appendTailwindcssV4MiniProgramGradientRules(root);
8166
+ }
7844
8167
  const hoistAnchor = createHoistInsertionAnchor(root);
7845
8168
  const preflightRules = collectPreflightRules(root, options);
7846
8169
  if (preflightRules.length === 0) {
@@ -9160,6 +9483,25 @@ function fingerprintOptions(value, state = {
9160
9483
  //#region src/options-resolver.ts
9161
9484
  const BASE_CACHE_KEY = "base";
9162
9485
  const SIMPLE_OVERRIDE_UNSET = "__unset__";
9486
+ const CSS_OPTION_KEYS = [
9487
+ "cssPreflight",
9488
+ "cssPreflightRange",
9489
+ "cssChildCombinatorReplaceValue",
9490
+ "cssPresetEnv",
9491
+ "autoprefixer",
9492
+ "injectAdditionalCssVarScope",
9493
+ "cssSelectorReplacement",
9494
+ "rem2rpx",
9495
+ "px2rpx",
9496
+ "unitsToPx",
9497
+ "unitConversion",
9498
+ "platform",
9499
+ "cssRemoveHoverPseudoClass",
9500
+ "cssRemoveProperty",
9501
+ "cssCalc",
9502
+ "atRules",
9503
+ "tailwindcssV4GradientFallback"
9504
+ ];
9163
9505
  function getSimpleOverrideCacheKey(options) {
9164
9506
  let isMainChunk = SIMPLE_OVERRIDE_UNSET;
9165
9507
  let majorVersion = SIMPLE_OVERRIDE_UNSET;
@@ -9270,20 +9612,48 @@ function getSimpleOverrideCacheKey(options) {
9270
9612
  function hasOverrides(options) {
9271
9613
  return Boolean(options && Object.keys(options).length > 0);
9272
9614
  }
9615
+ function normalizeCssOptions(options, mirrorTopLevel = false) {
9616
+ let changed = false;
9617
+ const normalized = { ...options };
9618
+ const hasCssOptions = options.cssOptions !== void 0;
9619
+ const cssOptions = { ...options.cssOptions ?? {} };
9620
+ for (const key of CSS_OPTION_KEYS) {
9621
+ const hasNestedValue = hasCssOptions && key in options.cssOptions;
9622
+ const hasTopLevelValue = key in options;
9623
+ if (!hasNestedValue && !hasTopLevelValue) continue;
9624
+ const nestedValue = hasNestedValue ? options.cssOptions?.[key] : void 0;
9625
+ const topLevelValue = hasTopLevelValue ? options[key] : void 0;
9626
+ const value = hasNestedValue ? nestedValue : topLevelValue;
9627
+ if (value !== topLevelValue) {
9628
+ normalized[key] = value;
9629
+ changed = true;
9630
+ }
9631
+ if ((hasCssOptions || mirrorTopLevel) && value !== nestedValue) {
9632
+ cssOptions[key] = value;
9633
+ changed = true;
9634
+ }
9635
+ }
9636
+ if (!changed) return options;
9637
+ return {
9638
+ ...normalized,
9639
+ ...hasCssOptions || mirrorTopLevel ? { cssOptions } : {}
9640
+ };
9641
+ }
9273
9642
  function createOptionsResolver(baseOptions) {
9643
+ const normalizedBaseOptions = normalizeCssOptions(baseOptions);
9274
9644
  const cacheByKey = /* @__PURE__ */ new Map();
9275
9645
  const cacheByRef = /* @__PURE__ */ new WeakMap();
9276
9646
  const cacheKeyByRef = /* @__PURE__ */ new WeakMap();
9277
9647
  const emptyOverrideRefs = /* @__PURE__ */ new WeakSet();
9278
- cacheByKey.set(BASE_CACHE_KEY, baseOptions);
9648
+ cacheByKey.set(BASE_CACHE_KEY, normalizedBaseOptions);
9279
9649
  const resolve = (overrides) => {
9280
- if (!overrides) return baseOptions;
9650
+ if (!overrides) return normalizedBaseOptions;
9281
9651
  const refCached = cacheByRef.get(overrides);
9282
9652
  if (refCached) return refCached;
9283
- if (emptyOverrideRefs.has(overrides)) return baseOptions;
9653
+ if (emptyOverrideRefs.has(overrides)) return normalizedBaseOptions;
9284
9654
  if (!hasOverrides(overrides)) {
9285
9655
  emptyOverrideRefs.add(overrides);
9286
- return baseOptions;
9656
+ return normalizedBaseOptions;
9287
9657
  }
9288
9658
  let key = cacheKeyByRef.get(overrides);
9289
9659
  if (!key) {
@@ -9295,10 +9665,10 @@ function createOptionsResolver(baseOptions) {
9295
9665
  cacheByRef.set(overrides, cached);
9296
9666
  return cached;
9297
9667
  }
9298
- const merged = defuOverrideArray({ ...overrides }, baseOptions);
9299
- cacheByKey.set(key, merged);
9300
- cacheByRef.set(overrides, merged);
9301
- return merged;
9668
+ const normalized = normalizeCssOptions(defuOverrideArray(normalizeCssOptions({ ...overrides }, true), normalizedBaseOptions));
9669
+ cacheByKey.set(key, normalized);
9670
+ cacheByRef.set(overrides, normalized);
9671
+ return normalized;
9302
9672
  };
9303
9673
  return { resolve };
9304
9674
  }
@@ -43841,7 +44211,7 @@ function hasSupportsAtRuleAncestor(e, t) {
43841
44211
  return !1;
43842
44212
  }
43843
44213
  //#endregion
43844
- //#region ../../node_modules/.pnpm/@csstools+postcss-alpha-function@2.0.5_postcss@8.5.15/node_modules/@csstools/postcss-alpha-function/dist/index.mjs
44214
+ //#region ../../node_modules/.pnpm/@csstools+postcss-alpha-function@2.0.6_postcss@8.5.15/node_modules/@csstools/postcss-alpha-function/dist/index.mjs
43845
44215
  const b$1 = /\balpha\(/i, m$9 = /^alpha$/i, w$3 = new Set([
43846
44216
  "srgb",
43847
44217
  "srgb-linear",
@@ -44234,7 +44604,7 @@ const n$9 = "js-blank-pseudo", t$12 = ":blank", creator$49 = (s) => {
44234
44604
  };
44235
44605
  creator$49.postcss = !0;
44236
44606
  //#endregion
44237
- //#region ../../node_modules/.pnpm/@csstools+selector-specificity@6.0.0_postcss-selector-parser@7.1.2/node_modules/@csstools/selector-specificity/dist/index.mjs
44607
+ //#region ../../node_modules/.pnpm/@csstools+selector-specificity@6.0.0_postcss-selector-parser@7.1.4/node_modules/@csstools/selector-specificity/dist/index.mjs
44238
44608
  var import_postcss_page_break = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
44239
44609
  module.exports = function(options) {
44240
44610
  return {
@@ -44263,10 +44633,10 @@ var import_postcss_page_break = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commo
44263
44633
  };
44264
44634
  module.exports.postcss = true;
44265
44635
  })))(), 1);
44266
- function compare(e, t) {
44636
+ function compare$1(e, t) {
44267
44637
  return e.a === t.a ? e.b === t.b ? e.c - t.c : e.b - t.b : e.a - t.a;
44268
44638
  }
44269
- function selectorSpecificity(t, s) {
44639
+ function selectorSpecificity$1(t, s) {
44270
44640
  const i = s?.customSpecificity?.(t);
44271
44641
  if (i) return i;
44272
44642
  if (!t) return {
@@ -44284,17 +44654,17 @@ function selectorSpecificity(t, s) {
44284
44654
  else if ("tag" === t.type) o += 1;
44285
44655
  else if ("class" === t.type) n += 1;
44286
44656
  else if ("attribute" === t.type) n += 1;
44287
- else if (isPseudoElement(t)) switch (t.value.toLowerCase()) {
44657
+ else if (isPseudoElement$1(t)) switch (t.value.toLowerCase()) {
44288
44658
  case "::slotted":
44289
44659
  if (o += 1, t.nodes && t.nodes.length > 0) {
44290
- const e = specificityOfMostSpecificListItem(t.nodes, s);
44660
+ const e = specificityOfMostSpecificListItem$1(t.nodes, s);
44291
44661
  c += e.a, n += e.b, o += e.c;
44292
44662
  }
44293
44663
  break;
44294
44664
  case "::view-transition-group":
44295
44665
  case "::view-transition-image-pair":
44296
44666
  case "::view-transition-old":
44297
- case "::view-transition-new": return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal(t.nodes[0]) ? {
44667
+ case "::view-transition-new": return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal$1(t.nodes[0]) ? {
44298
44668
  a: 0,
44299
44669
  b: 0,
44300
44670
  c: 0
@@ -44317,7 +44687,7 @@ function selectorSpecificity(t, s) {
44317
44687
  case ":matches":
44318
44688
  case ":not":
44319
44689
  if (t.nodes && t.nodes.length > 0) {
44320
- const e = specificityOfMostSpecificListItem(t.nodes, s);
44690
+ const e = specificityOfMostSpecificListItem$1(t.nodes, s);
44321
44691
  c += e.a, n += e.b, o += e.c;
44322
44692
  }
44323
44693
  break;
@@ -44336,7 +44706,7 @@ function selectorSpecificity(t, s) {
44336
44706
  });
44337
44707
  const r = [a];
44338
44708
  t.nodes.length > 1 && r.push(...t.nodes.slice(1));
44339
- const l = specificityOfMostSpecificListItem(r, s);
44709
+ const l = specificityOfMostSpecificListItem$1(r, s);
44340
44710
  c += l.a, n += l.b, o += l.c;
44341
44711
  }
44342
44712
  }
@@ -44344,14 +44714,14 @@ function selectorSpecificity(t, s) {
44344
44714
  case ":local":
44345
44715
  case ":global":
44346
44716
  t.nodes && t.nodes.length > 0 && t.nodes.forEach((e) => {
44347
- const t = selectorSpecificity(e, s);
44717
+ const t = selectorSpecificity$1(e, s);
44348
44718
  c += t.a, n += t.b, o += t.c;
44349
44719
  });
44350
44720
  break;
44351
44721
  case ":host":
44352
44722
  case ":host-context":
44353
44723
  if (n += 1, t.nodes && t.nodes.length > 0) {
44354
- const e = specificityOfMostSpecificListItem(t.nodes, s);
44724
+ const e = specificityOfMostSpecificListItem$1(t.nodes, s);
44355
44725
  c += e.a, n += e.b, o += e.c;
44356
44726
  }
44357
44727
  break;
@@ -44363,7 +44733,7 @@ function selectorSpecificity(t, s) {
44363
44733
  };
44364
44734
  }
44365
44735
  else selectorParser.isContainer(t) && t.nodes?.length > 0 && t.nodes.forEach((e) => {
44366
- const t = selectorSpecificity(e, s);
44736
+ const t = selectorSpecificity$1(e, s);
44367
44737
  c += t.a, n += t.b, o += t.c;
44368
44738
  });
44369
44739
  return {
@@ -44372,21 +44742,21 @@ function selectorSpecificity(t, s) {
44372
44742
  c: o
44373
44743
  };
44374
44744
  }
44375
- function specificityOfMostSpecificListItem(e, t) {
44745
+ function specificityOfMostSpecificListItem$1(e, t) {
44376
44746
  let s = {
44377
44747
  a: 0,
44378
44748
  b: 0,
44379
44749
  c: 0
44380
44750
  };
44381
44751
  return e.forEach((e) => {
44382
- const i = selectorSpecificity(e, t);
44383
- compare(i, s) < 0 || (s = i);
44752
+ const i = selectorSpecificity$1(e, t);
44753
+ compare$1(i, s) < 0 || (s = i);
44384
44754
  }), s;
44385
44755
  }
44386
- function isPseudoElement(t) {
44756
+ function isPseudoElement$1(t) {
44387
44757
  return selectorParser.isPseudoElement(t);
44388
44758
  }
44389
- function selectorNodeContainsNothingOrOnlyUniversal(e) {
44759
+ function selectorNodeContainsNothingOrOnlyUniversal$1(e) {
44390
44760
  if (!e) return !1;
44391
44761
  if (!e.nodes) return !1;
44392
44762
  const t = e.nodes.filter((e) => "comment" !== e.type);
@@ -44672,7 +45042,7 @@ const creator$48 = (a) => {
44672
45042
  for (a.walkRules((t) => {
44673
45043
  t.selectors.forEach((a) => {
44674
45044
  try {
44675
- const t = selectorSpecificity(selectorParser().astSync(a));
45045
+ const t = selectorSpecificity$1(selectorParser().astSync(a));
44676
45046
  p = Math.max(p, t.a + 1);
44677
45047
  } catch (e) {
44678
45048
  t.warn(n, `Failed to parse selector : "${a}" with message: "${e instanceof Error ? e.message : e}"`);
@@ -44779,7 +45149,7 @@ const creator$47 = (t) => {
44779
45149
  };
44780
45150
  creator$47.postcss = !0;
44781
45151
  //#endregion
44782
- //#region ../../node_modules/.pnpm/@csstools+postcss-color-function@5.0.4_postcss@8.5.15/node_modules/@csstools/postcss-color-function/dist/index.mjs
45152
+ //#region ../../node_modules/.pnpm/@csstools+postcss-color-function@5.0.5_postcss@8.5.15/node_modules/@csstools/postcss-color-function/dist/index.mjs
44783
45153
  var import_postcss_clamp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
44784
45154
  let valueParser$1 = __require("postcss-value-parser");
44785
45155
  function parseValue(value) {
@@ -44884,7 +45254,7 @@ const postcssPlugin$15 = (o) => {
44884
45254
  };
44885
45255
  postcssPlugin$15.postcss = !0;
44886
45256
  //#endregion
44887
- //#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
45257
+ //#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
44888
45258
  const m$6 = /\bdisplay-p3-linear\b/i, f$7 = /^color$/i, basePlugin$14 = (s) => ({
44889
45259
  postcssPlugin: "postcss-color-function-display-p3-linear",
44890
45260
  Declaration(g) {
@@ -44913,7 +45283,7 @@ const postcssPlugin$14 = (o) => {
44913
45283
  };
44914
45284
  postcssPlugin$14.postcss = !0;
44915
45285
  //#endregion
44916
- //#region ../../node_modules/.pnpm/postcss-color-functional-notation@8.0.4_postcss@8.5.15/node_modules/postcss-color-functional-notation/dist/index.mjs
45286
+ //#region ../../node_modules/.pnpm/postcss-color-functional-notation@8.0.5_postcss@8.5.15/node_modules/postcss-color-functional-notation/dist/index.mjs
44917
45287
  const m$5 = /^(?:rgb|hsl)a?$/i, f$6 = /\b(?:rgb|hsl)a?\(/i, basePlugin$13 = (s) => ({
44918
45288
  postcssPlugin: "postcss-color-functional-notation",
44919
45289
  Declaration(v) {
@@ -44942,7 +45312,7 @@ const postcssPlugin$13 = (o) => {
44942
45312
  };
44943
45313
  postcssPlugin$13.postcss = !0;
44944
45314
  //#endregion
44945
- //#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
45315
+ //#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
44946
45316
  const f$5 = /\bcolor-mix\(/i, g$6 = /^color-mix$/i, basePlugin$12 = (s) => ({
44947
45317
  postcssPlugin: "postcss-color-mix-function",
44948
45318
  Declaration(v) {
@@ -44978,7 +45348,7 @@ const postcssPlugin$12 = (e) => {
44978
45348
  };
44979
45349
  postcssPlugin$12.postcss = !0;
44980
45350
  //#endregion
44981
- //#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
45351
+ //#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
44982
45352
  const f$4 = /\bcolor-mix\(/i, g$5 = /^color-mix$/i, basePlugin$11 = (s) => ({
44983
45353
  postcssPlugin: "color-mix-variadic-function-arguments",
44984
45354
  Declaration(v) {
@@ -45076,7 +45446,7 @@ const creator$45 = (t) => {
45076
45446
  };
45077
45447
  creator$45.postcss = !0;
45078
45448
  //#endregion
45079
- //#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
45449
+ //#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
45080
45450
  const u$6 = /\bcontrast-color\(/i, m$4 = /^contrast-color$/i, basePlugin$9 = (s) => ({
45081
45451
  postcssPlugin: "postcss-contrast-color-function",
45082
45452
  prepare: () => ({
@@ -48432,7 +48802,7 @@ function hasFallback(t) {
48432
48802
  }
48433
48803
  creator$34.postcss = !0;
48434
48804
  //#endregion
48435
- //#region ../../node_modules/.pnpm/@csstools+postcss-gamut-mapping@3.0.4_postcss@8.5.15/node_modules/@csstools/postcss-gamut-mapping/dist/index.mjs
48805
+ //#region ../../node_modules/.pnpm/@csstools+postcss-gamut-mapping@3.0.5_postcss@8.5.15/node_modules/@csstools/postcss-gamut-mapping/dist/index.mjs
48436
48806
  const p = /\bcolor-gamut\b/i;
48437
48807
  function hasConditionalAncestor(e) {
48438
48808
  let o = e.parent;
@@ -48546,7 +48916,7 @@ const e$6 = [
48546
48916
  };
48547
48917
  creator$32.postcss = !0;
48548
48918
  //#endregion
48549
- //#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
48919
+ //#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
48550
48920
  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;
48551
48921
  function interpolateColorsInColorStopsList(o, e, t, s = !1) {
48552
48922
  const l = [], a = [];
@@ -48917,7 +49287,7 @@ const creator$31 = (t) => {
48917
49287
  }) : (delete e.parent, c.append(e));
48918
49288
  });
48919
49289
  }
48920
- const i = "[" + encodeCSS(c.toString()) + "]", l = selectorSpecificity(c);
49290
+ const i = "[" + encodeCSS(c.toString()) + "]", l = selectorSpecificity$1(c);
48921
49291
  let u = i;
48922
49292
  for (let e = 0; e < l.a; e++) u += r;
48923
49293
  const p = Math.max(1, l.b) - 1;
@@ -48975,7 +49345,7 @@ function hexa2rgba(e) {
48975
49345
  e.value = `rgba(${r},${l},${n},${c})`;
48976
49346
  }
48977
49347
  //#endregion
48978
- //#region ../../node_modules/.pnpm/@csstools+postcss-hwb-function@5.0.4_postcss@8.5.15/node_modules/@csstools/postcss-hwb-function/dist/index.mjs
49348
+ //#region ../../node_modules/.pnpm/@csstools+postcss-hwb-function@5.0.5_postcss@8.5.15/node_modules/@csstools/postcss-hwb-function/dist/index.mjs
48979
49349
  const u$3 = /\bhwb\(/i, m$2 = /^hwb$/i, basePlugin$6 = (s) => ({
48980
49350
  postcssPlugin: "postcss-hwb-function",
48981
49351
  Declaration(f) {
@@ -49197,6 +49567,137 @@ const handleInvalidation = (e, t, n) => {
49197
49567
  };
49198
49568
  creator$29.postcss = !0;
49199
49569
  //#endregion
49570
+ //#region ../../node_modules/.pnpm/@csstools+selector-specificity@6.0.0_postcss-selector-parser@7.1.2/node_modules/@csstools/selector-specificity/dist/index.mjs
49571
+ function compare(e, t) {
49572
+ return e.a === t.a ? e.b === t.b ? e.c - t.c : e.b - t.b : e.a - t.a;
49573
+ }
49574
+ function selectorSpecificity(t, s) {
49575
+ const i = s?.customSpecificity?.(t);
49576
+ if (i) return i;
49577
+ if (!t) return {
49578
+ a: 0,
49579
+ b: 0,
49580
+ c: 0
49581
+ };
49582
+ let c = 0, n = 0, o = 0;
49583
+ if ("universal" == t.type) return {
49584
+ a: 0,
49585
+ b: 0,
49586
+ c: 0
49587
+ };
49588
+ if ("id" === t.type) c += 1;
49589
+ else if ("tag" === t.type) o += 1;
49590
+ else if ("class" === t.type) n += 1;
49591
+ else if ("attribute" === t.type) n += 1;
49592
+ else if (isPseudoElement(t)) switch (t.value.toLowerCase()) {
49593
+ case "::slotted":
49594
+ if (o += 1, t.nodes && t.nodes.length > 0) {
49595
+ const e = specificityOfMostSpecificListItem(t.nodes, s);
49596
+ c += e.a, n += e.b, o += e.c;
49597
+ }
49598
+ break;
49599
+ case "::view-transition-group":
49600
+ case "::view-transition-image-pair":
49601
+ case "::view-transition-old":
49602
+ case "::view-transition-new": return t.nodes && 1 === t.nodes.length && "selector" === t.nodes[0].type && selectorNodeContainsNothingOrOnlyUniversal(t.nodes[0]) ? {
49603
+ a: 0,
49604
+ b: 0,
49605
+ c: 0
49606
+ } : {
49607
+ a: 0,
49608
+ b: 0,
49609
+ c: 1
49610
+ };
49611
+ default: o += 1;
49612
+ }
49613
+ else if (selectorParser.isPseudoClass(t)) switch (t.value.toLowerCase()) {
49614
+ case ":-webkit-any":
49615
+ case ":any":
49616
+ default:
49617
+ n += 1;
49618
+ break;
49619
+ case ":-moz-any":
49620
+ case ":has":
49621
+ case ":is":
49622
+ case ":matches":
49623
+ case ":not":
49624
+ if (t.nodes && t.nodes.length > 0) {
49625
+ const e = specificityOfMostSpecificListItem(t.nodes, s);
49626
+ c += e.a, n += e.b, o += e.c;
49627
+ }
49628
+ break;
49629
+ case ":where": break;
49630
+ case ":nth-child":
49631
+ case ":nth-last-child":
49632
+ if (n += 1, t.nodes && t.nodes.length > 0) {
49633
+ const i = t.nodes[0].nodes.findIndex((e) => "tag" === e.type && "of" === e.value.toLowerCase());
49634
+ if (i > -1) {
49635
+ const a = selectorParser.selector({
49636
+ nodes: [],
49637
+ value: ""
49638
+ });
49639
+ t.nodes[0].nodes.slice(i + 1).forEach((e) => {
49640
+ a.append(e.clone());
49641
+ });
49642
+ const r = [a];
49643
+ t.nodes.length > 1 && r.push(...t.nodes.slice(1));
49644
+ const l = specificityOfMostSpecificListItem(r, s);
49645
+ c += l.a, n += l.b, o += l.c;
49646
+ }
49647
+ }
49648
+ break;
49649
+ case ":local":
49650
+ case ":global":
49651
+ t.nodes && t.nodes.length > 0 && t.nodes.forEach((e) => {
49652
+ const t = selectorSpecificity(e, s);
49653
+ c += t.a, n += t.b, o += t.c;
49654
+ });
49655
+ break;
49656
+ case ":host":
49657
+ case ":host-context":
49658
+ if (n += 1, t.nodes && t.nodes.length > 0) {
49659
+ const e = specificityOfMostSpecificListItem(t.nodes, s);
49660
+ c += e.a, n += e.b, o += e.c;
49661
+ }
49662
+ break;
49663
+ case ":active-view-transition":
49664
+ case ":active-view-transition-type": return {
49665
+ a: 0,
49666
+ b: 1,
49667
+ c: 0
49668
+ };
49669
+ }
49670
+ else selectorParser.isContainer(t) && t.nodes?.length > 0 && t.nodes.forEach((e) => {
49671
+ const t = selectorSpecificity(e, s);
49672
+ c += t.a, n += t.b, o += t.c;
49673
+ });
49674
+ return {
49675
+ a: c,
49676
+ b: n,
49677
+ c: o
49678
+ };
49679
+ }
49680
+ function specificityOfMostSpecificListItem(e, t) {
49681
+ let s = {
49682
+ a: 0,
49683
+ b: 0,
49684
+ c: 0
49685
+ };
49686
+ return e.forEach((e) => {
49687
+ const i = selectorSpecificity(e, t);
49688
+ compare(i, s) < 0 || (s = i);
49689
+ }), s;
49690
+ }
49691
+ function isPseudoElement(t) {
49692
+ return selectorParser.isPseudoElement(t);
49693
+ }
49694
+ function selectorNodeContainsNothingOrOnlyUniversal(e) {
49695
+ if (!e) return !1;
49696
+ if (!e.nodes) return !1;
49697
+ const t = e.nodes.filter((e) => "comment" !== e.type);
49698
+ return 0 === t.length || 1 === t.length && "universal" === t[0].type;
49699
+ }
49700
+ //#endregion
49200
49701
  //#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
49201
49702
  function alwaysValidSelector(s) {
49202
49703
  const o = selectorParser().astSync(s);
@@ -49466,7 +49967,7 @@ const n$3 = /:is\(/i, creator$28 = (e) => {
49466
49967
  };
49467
49968
  creator$28.postcss = !0;
49468
49969
  //#endregion
49469
- //#region ../../node_modules/.pnpm/postcss-lab-function@8.0.4_postcss@8.5.15/node_modules/postcss-lab-function/dist/index.mjs
49970
+ //#region ../../node_modules/.pnpm/postcss-lab-function@8.0.5_postcss@8.5.15/node_modules/postcss-lab-function/dist/index.mjs
49470
49971
  const g$2 = /\b(?:lab|lch)\(/i, f$2 = /^(?:lab|lch)$/i, basePlugin$3 = (s) => ({
49471
49972
  postcssPlugin: "postcss-lab-function",
49472
49973
  Declaration(b) {
@@ -51029,7 +51530,7 @@ const creator$19 = (s) => {
51029
51530
  };
51030
51531
  creator$19.postcss = !0;
51031
51532
  //#endregion
51032
- //#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
51533
+ //#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
51033
51534
  function sourceFrom(e) {
51034
51535
  return {
51035
51536
  sourceIndex: e.sourceIndex ?? 0,
@@ -51286,7 +51787,7 @@ function combinationsWithSizeN(e, t) {
51286
51787
  }
51287
51788
  }
51288
51789
  function nodesAreEquallySpecific(n) {
51289
- const r = n.map((t) => selectorParser().astSync(t)).map((e) => selectorSpecificity(e)), o = r[0];
51790
+ const r = n.map((t) => selectorParser().astSync(t)).map((e) => selectorSpecificity$1(e)), o = r[0];
51290
51791
  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;
51291
51792
  return !0;
51292
51793
  }
@@ -51536,7 +52037,7 @@ const creator$17 = () => ({
51536
52037
  });
51537
52038
  creator$17.postcss = !0;
51538
52039
  //#endregion
51539
- //#region ../../node_modules/.pnpm/@csstools+postcss-oklab-function@5.0.4_postcss@8.5.15/node_modules/@csstools/postcss-oklab-function/dist/index.mjs
52040
+ //#region ../../node_modules/.pnpm/@csstools+postcss-oklab-function@5.0.5_postcss@8.5.15/node_modules/@csstools/postcss-oklab-function/dist/index.mjs
51540
52041
  const g$1 = /\b(?:oklab|oklch)\(/i, f$1 = /^(?:oklab|oklch)$/i, basePlugin$1 = (s) => ({
51541
52042
  postcssPlugin: "postcss-oklab-function",
51542
52043
  Declaration(b) {
@@ -51769,7 +52270,7 @@ const s$3 = /rebeccapurple/i, t$1 = /^rebeccapurple$/i, creator$10 = (o) => {
51769
52270
  };
51770
52271
  creator$10.postcss = !0;
51771
52272
  //#endregion
51772
- //#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
52273
+ //#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
51773
52274
  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) => ({
51774
52275
  postcssPlugin: "postcss-relative-color-syntax",
51775
52276
  Declaration(f) {
@@ -52761,7 +53262,7 @@ const e$1 = new Set([
52761
53262
  };
52762
53263
  creator$2.postcss = !0;
52763
53264
  //#endregion
52764
- //#region ../../node_modules/.pnpm/postcss-preset-env@11.3.0_postcss@8.5.15/node_modules/postcss-preset-env/dist/index.mjs
53265
+ //#region ../../node_modules/.pnpm/postcss-preset-env@11.3.1_postcss@8.5.15/node_modules/postcss-preset-env/dist/index.mjs
52765
53266
  const ks = {
52766
53267
  "blank-pseudo-class": "https://github.com/csstools/postcss-plugins/blob/main/plugins/css-blank-pseudo/README.md#browser",
52767
53268
  "focus-visible-pseudo-class": "https://github.com/WICG/focus-visible",
@@ -53666,7 +54167,7 @@ function getCalcDuplicateCleaner(options) {
53666
54167
  return calcDuplicateCleanerPlugin;
53667
54168
  }
53668
54169
  //#endregion
53669
- //#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/object/omit.mjs
54170
+ //#region ../../node_modules/.pnpm/es-toolkit@1.47.1/node_modules/es-toolkit/dist/object/omit.mjs
53670
54171
  /**
53671
54172
  * Creates a new object with specified keys omitted.
53672
54173
  *
@@ -53675,9 +54176,9 @@ function getCalcDuplicateCleaner(options) {
53675
54176
  *
53676
54177
  * @template T - The type of object.
53677
54178
  * @template K - The type of keys in object.
53678
- * @param {T} obj - The object to omit keys from.
53679
- * @param {K[]} keys - An array of keys to be omitted from the object.
53680
- * @returns {Omit<T, K>} A new object with the specified keys omitted.
54179
+ * @param obj - The object to omit keys from.
54180
+ * @param keys - An array of keys to be omitted from the object.
54181
+ * @returns A new object with the specified keys omitted.
53681
54182
  *
53682
54183
  * @example
53683
54184
  * const obj = { a: 1, b: 2, c: 3 };
@@ -54919,6 +55420,13 @@ function injectMissingTailwindcssV4Defaults(root) {
54919
55420
  nodes
54920
55421
  });
54921
55422
  }
55423
+ function hasTailwindcssV4GradientRuntime(root) {
55424
+ let found = false;
55425
+ root.walkDecls((decl) => {
55426
+ if (decl.prop === "--tw-gradient-position" || decl.prop === "--tw-gradient-from" || decl.prop === "--tw-gradient-to") found = true;
55427
+ });
55428
+ return found;
55429
+ }
54922
55430
  const postcssWeappTailwindcssPostPlugin = (options) => {
54923
55431
  const opts = defu(options, { isMainChunk: true });
54924
55432
  const p = { postcssPlugin };
@@ -54959,6 +55467,10 @@ const postcssWeappTailwindcssPostPlugin = (options) => {
54959
55467
  root.walkRules((rule) => {
54960
55468
  removeRedundantTransitionPropertyFallbacks(rule);
54961
55469
  });
55470
+ if (opts.majorVersion === 4 || hasTailwindcssV4GradientRuntime(root)) {
55471
+ mergeTailwindcssV4GradientDirectionRules(root);
55472
+ if (opts.tailwindcssV4GradientFallback === true) appendTailwindcssV4MiniProgramGradientRules(root);
55473
+ }
54962
55474
  root.walkAtRules((atRule) => {
54963
55475
  removeUnsupportedMiniProgramPrefixedAtRule(atRule);
54964
55476
  });