@projectwallace/css-analyzer 7.6.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,188 +1,1810 @@
1
- var pi = Object.defineProperty;
2
- var Zt = (i) => {
3
- throw TypeError(i);
1
+ var or = Object.defineProperty;
2
+ var pi = (r) => {
3
+ throw TypeError(r);
4
4
  };
5
- var hi = (i, e, t) => e in i ? pi(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
- var $t = (i, e, t) => hi(i, typeof e != "symbol" ? e + "" : e, t), Jt = (i, e, t) => e.has(i) || Zt("Cannot " + t);
7
- var h = (i, e, t) => (Jt(i, e, "read from private field"), t ? t.call(i) : e.get(i)), _ = (i, e, t) => e.has(i) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), R = (i, e, t, r) => (Jt(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t);
8
- var Ye = (i, e, t, r) => ({
9
- set _(n) {
10
- R(i, e, n, t);
5
+ var ar = (r, e, t) => e in r ? or(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
+ var g = (r, e, t) => ar(r, typeof e != "symbol" ? e + "" : e, t), di = (r, e, t) => e.has(r) || pi("Cannot " + t);
7
+ var w = (r, e, t) => (di(r, e, "read from private field"), t ? t.call(r) : e.get(r)), G = (r, e, t) => e.has(r) ? pi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), M = (r, e, t, s) => (di(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t);
8
+ var Vt = (r, e, t, s) => ({
9
+ set _(i) {
10
+ M(r, e, i, t);
11
11
  },
12
12
  get _() {
13
- return h(i, e, r);
13
+ return w(r, e, s);
14
14
  }
15
15
  });
16
- import mi from "css-tree/parser";
17
- import C from "css-tree/walker";
18
- import { calculateForAST as gi } from "@bramus/specificity/core";
19
- import { walk as li } from "css-tree";
20
- function Je(i, e) {
21
- return e >= 65 && e <= 90 && (e = e | 32), i === e;
22
- }
23
- function q(i, e) {
24
- if (i === e) return !0;
25
- let t = i.length;
26
- if (t !== e.length) return !1;
27
- for (let r = 0; r < t; r++)
28
- if (Je(i.charCodeAt(r), e.charCodeAt(r)) === !1)
29
- return !1;
30
- return !0;
31
- }
32
- function I(i, e) {
33
- if (i === e) return !0;
34
- let t = e.length, r = t - i.length;
35
- if (r < 0)
36
- return !1;
37
- for (let n = t - 1; n >= r; n--)
38
- if (Je(i.charCodeAt(n - r), e.charCodeAt(n)) === !1)
39
- return !1;
40
- return !0;
41
- }
42
- function Xe(i, e) {
43
- if (i === e) return !0;
44
- let t = i.length;
45
- if (e.length < t) return !1;
46
- for (let r = 0; r < t; r++)
47
- if (Je(i.charCodeAt(r), e.charCodeAt(r)) === !1)
48
- return !1;
49
- return !0;
50
- }
51
- const Ge = "Atrule", di = "MediaQuery", Qe = "Rule", yi = "Selector", wi = "Value", V = "Identifier", ki = "Nth", bi = "Combinator", ni = "Number", Le = "Dimension", Z = "Operator", xi = "Hash", Ci = "Url", et = "Function";
52
- function Xt(i, e, t) {
53
- let r = i.value.children.first;
54
- return q(e, i.property) && r.type === V && q(t, r.name);
55
- }
56
- function vi(i) {
16
+ import { walk as B, SUPPORTS_QUERY as Hi, BREAK as Q, MEDIA_TYPE as hr, MEDIA_FEATURE as Ii, str_equals as P, DIMENSION as ft, NUMBER as _s, IDENTIFIER as he, SELECTOR as ce, NTH_SELECTOR as cr, PSEUDO_ELEMENT_SELECTOR as us, TYPE_SELECTOR as fs, PSEUDO_CLASS_SELECTOR as Oe, ATTRIBUTE_SELECTOR as ps, SKIP as I, COMBINATOR as is, SELECTOR_LIST as ds, NTH_OF_SELECTOR as _r, CLASS_SELECTOR as ur, ID_SELECTOR as fr, FUNCTION as gs, OPERATOR as Ee, is_custom as xs, is_vendor_prefixed as ms, parse as pr, AT_RULE as dr, BLOCK as gr, DECLARATION as jt, LAYER_NAME as xr, CONTAINER_QUERY as mr, STYLE_RULE as kr, HASH as wr, URL as Ar, str_starts_with as yr } from "@projectwallace/css-parser";
17
+ function Er(r) {
57
18
  let e = !1;
58
- return li(i, function(t) {
59
- if (t.type === "Declaration" && (Xt(t, "-webkit-appearance", "none") || Xt(t, "-moz-appearance", "meterbar")))
60
- return e = !0, this.break;
19
+ return B(r, function(t) {
20
+ if (t.type === Hi) {
21
+ const i = (t.prelude || t.value || "").toString().toLowerCase().replaceAll(/\s+/g, "");
22
+ if (i.includes("-webkit-appearance:none") || i.includes("-moz-appearance:meterbar"))
23
+ return e = !0, Q;
24
+ }
61
25
  }), e;
62
26
  }
63
- function Si(i) {
27
+ function Cr(r) {
64
28
  let e = !1;
65
- return li(i, function(t) {
66
- let { mediaType: r, name: n, value: c, type: g, kind: w } = t;
67
- if (g === di && r !== null) {
68
- if (Xe("\\0", r) || I("\\9 ", r))
69
- return e = !0, this.break;
70
- } else if (g === "Feature" && w === "media") {
71
- if (c && c.unit && c.unit === "\\0")
72
- return e = !0, this.break;
73
- if (q("-moz-images-in-menus", n) || q("min--moz-device-pixel-ratio", n) || q("-ms-high-contrast", n))
74
- return e = !0, this.break;
75
- if (q("min-resolution", n) && c && q(".001", c.value) && q("dpcm", c.unit))
76
- return e = !0, this.break;
77
- if (q("-webkit-min-device-pixel-ratio", n) && c && c.value && (q("0", c.value) || q("10000", c.value)))
78
- return e = !0, this.break;
29
+ return B(r, function(t) {
30
+ if (t.type === hr) {
31
+ const s = t.text || "";
32
+ if (s.startsWith("\\0") || s.includes("\\9"))
33
+ return e = !0, Q;
34
+ }
35
+ if (t.type === Ii) {
36
+ const s = t.name || "";
37
+ if (P("-moz-images-in-menus", s) || P("min--moz-device-pixel-ratio", s) || P("-ms-high-contrast", s))
38
+ return e = !0, Q;
39
+ if (P("min-resolution", s) && t.has_children) {
40
+ for (const i of t)
41
+ if (i.type === ft && i.value === 1e-3 && P("dpcm", i.unit || ""))
42
+ return e = !0, Q;
43
+ }
44
+ if (P("-webkit-min-device-pixel-ratio", s) && t.has_children) {
45
+ for (const i of t)
46
+ if (i.type === _s && (i.value === 0 || i.value === 1e4))
47
+ return e = !0, Q;
48
+ }
49
+ if (t.has_children) {
50
+ for (const i of t)
51
+ if (i.type === he && i.text === "\\0")
52
+ return e = !0, Q;
53
+ }
79
54
  }
80
55
  }), e;
81
56
  }
82
- const Lt = 45;
83
- function N(i) {
84
- return i.charCodeAt(0) === Lt && i.charCodeAt(1) !== Lt && i.indexOf("-", 2) !== -1;
85
- }
86
- class D {
57
+ class $ {
87
58
  constructor(e) {
88
- $t(this, "set");
59
+ g(this, "set");
89
60
  this.set = new Set(e);
90
61
  }
91
62
  has(e) {
92
63
  return this.set.has(e.toLowerCase());
93
64
  }
94
65
  }
95
- function si(i, e) {
96
- let t = [];
97
- return C(i, {
98
- visit: "Selector",
99
- enter: function(r) {
100
- t.push(e(r));
101
- }
102
- }), t;
103
- }
104
- const ai = new D(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
105
- function oi(i) {
66
+ const Pi = new $(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
67
+ function br(r) {
106
68
  let e = !1;
107
- return C(i, function(t) {
108
- if (t.type === "AttributeSelector") {
109
- let r = t.name.name;
110
- if (q("role", r) || Xe("aria-", r))
111
- return e = !0, C.break;
112
- } else if (t.type === "PseudoClassSelector" && ai.has(t.name)) {
113
- let r = si(t, oi);
114
- for (let n of r)
115
- if (n === !0) {
116
- e = !0;
117
- break;
118
- }
119
- return C.skip;
120
- }
69
+ return B(r, function(t) {
70
+ if ((t.type === us || t.type === Oe || t.type === fs) && t.is_vendor_prefixed)
71
+ return e = !0, Q;
121
72
  }), e;
122
73
  }
123
- function zi(i) {
74
+ function Di(r) {
124
75
  let e = !1;
125
- return C(i, function(t) {
126
- let r = t.type;
127
- if ((r === "PseudoElementSelector" || r === "TypeSelector" || r === "PseudoClassSelector") && N(t.name))
128
- return e = !0, C.break;
76
+ return B(r, function(t) {
77
+ if (t.type === ps) {
78
+ const s = t.name || "";
79
+ if (s === "role" || s.startsWith("aria-"))
80
+ return e = !0, Q;
81
+ } else if (t.type === Oe && Pi.has(t.name || "") && t.has_children) {
82
+ for (const s of t)
83
+ if (s.type === ce && Di(s))
84
+ return e = !0, Q;
85
+ }
129
86
  }), e;
130
87
  }
131
- function qi(i) {
88
+ function Rr(r) {
132
89
  let e = [];
133
- return C(i, function(t) {
134
- t.type === "PseudoClassSelector" && e.push(t.name);
90
+ return B(r, function(t) {
91
+ t.type === Oe && e.push(t.name);
135
92
  }), e.length === 0 ? !1 : e;
136
93
  }
137
- function ui(i) {
94
+ function rs(r) {
138
95
  let e = 0;
139
- return C(i, function(t) {
140
- let r = t.type;
141
- if (!(r === "Selector" || r === ki)) {
142
- if (e++, (r === "PseudoElementSelector" || r === "TypeSelector" || r === "PseudoClassSelector") && N(t.name) && e++, r === "AttributeSelector")
143
- return t.value && e++, C.skip;
144
- if (r === "PseudoClassSelector" && ai.has(t.name)) {
145
- let n = si(t, ui);
146
- if (n.length === 0) return;
147
- for (let c of n)
148
- e += c;
149
- return C.skip;
96
+ function t(s, i) {
97
+ B(s, function(n) {
98
+ n.type === ce && i.push(rs(n));
99
+ });
100
+ }
101
+ return B(r, function(s) {
102
+ const i = s.type;
103
+ if (i !== ce) {
104
+ if (i === cr) {
105
+ s.text && s.text.trim() && e++;
106
+ return;
107
+ }
108
+ if (e++, (i === us || i === fs || i === Oe) && s.is_vendor_prefixed && e++, i === ps)
109
+ return s.value && e++, I;
110
+ if (i === Oe) {
111
+ const n = s.name || "";
112
+ if (Pi.has(n.toLowerCase())) {
113
+ const l = [];
114
+ if (s.has_children)
115
+ for (const o of s)
116
+ o.type === ce ? l.push(rs(o)) : t(o, l);
117
+ if (l.length > 0) {
118
+ for (const o of l)
119
+ e += o;
120
+ return I;
121
+ }
122
+ }
150
123
  }
151
124
  }
152
125
  }), e;
153
126
  }
154
- function Ai(i, e) {
155
- C(i, function(t, r) {
156
- if (t.type === bi) {
157
- let n = t.loc, c = t.name;
158
- if (n === null) {
159
- let g = r.prev.data.loc.end, w = {
160
- offset: g.offset,
161
- line: g.line,
162
- column: g.column
163
- };
164
- e({
165
- name: c,
166
- // @ts-expect-error TODO: fix this
167
- loc: {
168
- start: w,
169
- end: {
170
- offset: w.offset + 1,
171
- line: w.line,
172
- column: w.column + 1
173
- }
127
+ function vr(r, e) {
128
+ B(r, function(t) {
129
+ t.type === is && e({
130
+ name: t.name.trim() === "" ? " " : t.name,
131
+ loc: {
132
+ offset: t.start,
133
+ line: t.line,
134
+ column: t.column,
135
+ length: 1
136
+ }
137
+ });
138
+ });
139
+ }
140
+ let ks = 1, q = 2, pt = 4, Ce = 8, ge = 16, y = new Uint8Array(128);
141
+ for (let r = 48; r <= 57; r++)
142
+ y[r] = q;
143
+ for (let r = 48; r <= 57; r++)
144
+ y[r] |= pt;
145
+ for (let r = 65; r <= 70; r++)
146
+ y[r] = pt;
147
+ for (let r = 97; r <= 102; r++)
148
+ y[r] = pt;
149
+ for (let r = 65; r <= 90; r++)
150
+ y[r] |= ks;
151
+ for (let r = 97; r <= 122; r++)
152
+ y[r] |= ks;
153
+ y[32] = Ce;
154
+ y[9] = Ce;
155
+ y[10] = ge;
156
+ y[13] = ge;
157
+ y[12] = ge;
158
+ function Tr(r) {
159
+ return r < 128 && (y[r] & q) !== 0;
160
+ }
161
+ function Je(r) {
162
+ return r < 128 && (y[r] & pt) !== 0;
163
+ }
164
+ function Or(r) {
165
+ return r < 128 && (y[r] & ks) !== 0;
166
+ }
167
+ function gi(r) {
168
+ return r < 128 && (y[r] & Ce) !== 0;
169
+ }
170
+ function ie(r) {
171
+ return r < 128 && (y[r] & ge) !== 0;
172
+ }
173
+ function Me(r) {
174
+ return r >= 128 || r === 95 ? !0 : Or(r);
175
+ }
176
+ function et(r) {
177
+ return r === 45 ? !0 : Me(r) || Tr(r);
178
+ }
179
+ const le = 1, it = 2, Sr = 3, Fi = 4, Mi = 5, xi = 6, de = 9, rt = 10, Nr = 11, qi = 12, ns = 13, Ur = 14, Lr = 15, zi = 16, Hr = 17, qe = 18, ls = 19, Ki = 20, Bi = 21, $i = 22, Ir = 23, Pr = 24, os = 26, Dr = 123, Fr = 125, Mr = 58, qr = 59, zr = 44, Kr = 91, Br = 93, mi = 40, $r = 41, ki = 47, wi = 42, Gr = 34, Yr = 39, Xt = 46, Wr = 60, Qr = 33, K = 45, Vr = 62, jr = 64, Xr = 35, Zt = 92, tt = 43, Zr = 37, Jr = 101, en = 69, Ai = 13, yi = 10;
180
+ class Gi {
181
+ constructor(e, t) {
182
+ g(this, "source");
183
+ g(this, "pos");
184
+ g(this, "line");
185
+ g(this, "column");
186
+ g(this, "on_comment");
187
+ // Current token properties (avoiding object allocation)
188
+ g(this, "token_type");
189
+ g(this, "token_start");
190
+ g(this, "token_end");
191
+ g(this, "token_line");
192
+ g(this, "token_column");
193
+ this.source = e, this.pos = 0, this.line = 1, this.column = 1, this.on_comment = t, this.token_type = os, this.token_start = 0, this.token_end = 0, this.token_line = 1, this.token_column = 1;
194
+ }
195
+ // Fast token advancing without object allocation (for internal parser use)
196
+ next_token_fast(e = !1) {
197
+ if (e)
198
+ for (; this.pos < this.source.length; ) {
199
+ let l = this.source.charCodeAt(this.pos);
200
+ if (l >= 128 || (y[l] & (Ce | ge)) === 0) break;
201
+ this.advance();
202
+ }
203
+ if (this.pos >= this.source.length)
204
+ return this.make_token(os, this.pos, this.pos);
205
+ let t = this.source.charCodeAt(this.pos), s = this.pos, i = this.line, n = this.column;
206
+ switch (t) {
207
+ case Dr:
208
+ return this.advance(), this.make_token(Ir, s, this.pos, i, n);
209
+ case Fr:
210
+ return this.advance(), this.make_token(Pr, s, this.pos, i, n);
211
+ case Mr:
212
+ return this.advance(), this.make_token(zi, s, this.pos, i, n);
213
+ case qr:
214
+ return this.advance(), this.make_token(Hr, s, this.pos, i, n);
215
+ case zr:
216
+ return this.advance(), this.make_token(qe, s, this.pos, i, n);
217
+ case Kr:
218
+ return this.advance(), this.make_token(ls, s, this.pos, i, n);
219
+ case Br:
220
+ return this.advance(), this.make_token(Ki, s, this.pos, i, n);
221
+ case mi:
222
+ return this.advance(), this.make_token(Bi, s, this.pos, i, n);
223
+ case $r:
224
+ return this.advance(), this.make_token($i, s, this.pos, i, n);
225
+ }
226
+ if (t < 128 && (y[t] & (Ce | ge)) !== 0)
227
+ return this.consume_whitespace(i, n);
228
+ if (t === ki && this.peek() === wi) {
229
+ let l = s, o = i, h = n;
230
+ for (this.advance(2); this.pos < this.source.length - 1; ) {
231
+ if (this.source.charCodeAt(this.pos) === wi && this.peek() === ki) {
232
+ this.advance(2);
233
+ break;
234
+ }
235
+ this.advance();
236
+ }
237
+ let c = this.pos;
238
+ return this.on_comment && this.on_comment({
239
+ start: l,
240
+ end: c,
241
+ length: c - l,
242
+ line: o,
243
+ column: h
244
+ }), this.next_token_fast(e);
245
+ }
246
+ if (t === Gr || t === Yr)
247
+ return this.consume_string(t, i, n);
248
+ if (t < 128 && (y[t] & q) !== 0)
249
+ return this.consume_number(i, n);
250
+ if (t === Xt) {
251
+ let l = this.peek();
252
+ if (l < 128 && (y[l] & q) !== 0)
253
+ return this.consume_number(i, n);
254
+ }
255
+ if (t === Wr && this.pos + 3 < this.source.length && this.peek() === Qr && this.peek(2) === K && this.peek(3) === K)
256
+ return this.advance(4), this.make_token(Ur, s, this.pos, i, n);
257
+ if (t === K && this.pos + 2 < this.source.length && this.peek() === K && this.peek(2) === Vr)
258
+ return this.advance(3), this.make_token(Lr, s, this.pos, i, n);
259
+ if (t === jr)
260
+ return this.consume_at_keyword(i, n);
261
+ if (t === Xr)
262
+ return this.consume_hash(i, n);
263
+ if (Me(t))
264
+ return this.consume_ident_or_function(i, n);
265
+ if (t === K) {
266
+ let l = this.peek();
267
+ if (Me(l) || l === K)
268
+ return this.consume_ident_or_function(i, n);
269
+ }
270
+ if (t === Zt) {
271
+ let l = this.peek();
272
+ if (l !== 0 && !ie(l))
273
+ return this.consume_ident_or_function(i, n);
274
+ }
275
+ if (t === K || t === tt) {
276
+ let l = this.peek();
277
+ if (l < 128 && (y[l] & q) !== 0)
278
+ return this.consume_number(i, n);
279
+ if (l === Xt) {
280
+ let h = this.peek(2);
281
+ if (h < 128 && (y[h] & q) !== 0)
282
+ return this.consume_number(i, n);
283
+ }
284
+ }
285
+ return this.advance(), this.make_token(de, s, this.pos, i, n);
286
+ }
287
+ consume_whitespace(e, t) {
288
+ let s = this.pos;
289
+ for (; this.pos < this.source.length; ) {
290
+ let i = this.source.charCodeAt(this.pos);
291
+ if (i >= 128 || (y[i] & (Ce | ge)) === 0) break;
292
+ this.advance();
293
+ }
294
+ return this.make_token(ns, s, this.pos, e, t);
295
+ }
296
+ consume_string(e, t, s) {
297
+ let i = this.pos;
298
+ for (this.advance(); this.pos < this.source.length; ) {
299
+ let n = this.source.charCodeAt(this.pos);
300
+ if (n === e)
301
+ return this.advance(), this.make_token(Mi, i, this.pos, t, s);
302
+ if (ie(n))
303
+ return this.make_token(xi, i, this.pos, t, s);
304
+ if (n === Zt) {
305
+ if (this.advance(), this.pos < this.source.length) {
306
+ let l = this.source.charCodeAt(this.pos);
307
+ Je(l) ? this.consume_hex_escape() : ie(l) ? this.advance() : this.advance();
308
+ }
309
+ continue;
310
+ }
311
+ this.advance();
312
+ }
313
+ return this.make_token(xi, i, this.pos, t, s);
314
+ }
315
+ consume_hex_escape() {
316
+ let e = 0;
317
+ for (; e < 6 && this.pos < this.source.length; ) {
318
+ let t = this.source.charCodeAt(this.pos);
319
+ if (!Je(t)) break;
320
+ this.advance(), e++;
321
+ }
322
+ if (this.pos < this.source.length) {
323
+ let t = this.source.charCodeAt(this.pos);
324
+ (gi(t) || ie(t)) && this.advance();
325
+ }
326
+ }
327
+ consume_number(e, t) {
328
+ let s = this.pos, i = this.source.charCodeAt(this.pos);
329
+ for ((i === tt || i === K) && this.advance(); this.pos < this.source.length; ) {
330
+ let n = this.source.charCodeAt(this.pos);
331
+ if (n >= 128 || (y[n] & q) === 0) break;
332
+ this.advance();
333
+ }
334
+ if (this.pos < this.source.length && this.source.charCodeAt(this.pos) === Xt && this.pos + 1 < this.source.length) {
335
+ let n = this.peek();
336
+ if (n < 128 && (y[n] & q) !== 0)
337
+ for (this.advance(); this.pos < this.source.length; ) {
338
+ let l = this.source.charCodeAt(this.pos);
339
+ if (l >= 128 || (y[l] & q) === 0) break;
340
+ this.advance();
341
+ }
342
+ }
343
+ if (this.pos < this.source.length) {
344
+ let n = this.source.charCodeAt(this.pos);
345
+ if (n === Jr || n === en) {
346
+ let l = this.peek(), o = l < 128 && (y[l] & q) !== 0, h = this.peek(2), c = h < 128 && (y[h] & q) !== 0;
347
+ if (o || (l === tt || l === K) && c) {
348
+ if (this.advance(), this.pos < this.source.length) {
349
+ let _ = this.source.charCodeAt(this.pos);
350
+ (_ === tt || _ === K) && this.advance();
174
351
  }
175
- });
352
+ for (; this.pos < this.source.length; ) {
353
+ let _ = this.source.charCodeAt(this.pos);
354
+ if (_ >= 128 || (y[_] & q) === 0) break;
355
+ this.advance();
356
+ }
357
+ }
358
+ }
359
+ }
360
+ if (this.pos < this.source.length) {
361
+ let n = this.source.charCodeAt(this.pos);
362
+ if (n === Zr)
363
+ return this.advance(), this.make_token(Nr, s, this.pos, e, t);
364
+ if (Me(n) || n === K && Me(this.peek())) {
365
+ for (; this.pos < this.source.length && et(this.source.charCodeAt(this.pos)); )
366
+ this.advance();
367
+ return this.make_token(qi, s, this.pos, e, t);
368
+ }
369
+ }
370
+ return this.make_token(rt, s, this.pos, e, t);
371
+ }
372
+ consume_ident_or_function(e, t) {
373
+ let s = this.pos;
374
+ for (; this.pos < this.source.length; ) {
375
+ let i = this.source.charCodeAt(this.pos);
376
+ if (i === Zt) {
377
+ if (this.pos + 1 >= this.source.length) break;
378
+ let n = this.peek();
379
+ if (ie(n)) break;
380
+ if (this.advance(), Je(n)) {
381
+ this.advance();
382
+ for (let l = 0; l < 5 && this.pos < this.source.length && Je(this.source.charCodeAt(this.pos)); l++)
383
+ this.advance();
384
+ if (this.pos < this.source.length) {
385
+ let l = this.source.charCodeAt(this.pos);
386
+ (gi(l) || ie(l)) && this.advance();
387
+ }
388
+ } else
389
+ this.advance();
390
+ } else if (et(i))
391
+ this.advance();
392
+ else
393
+ break;
394
+ }
395
+ return this.pos < this.source.length && this.source.charCodeAt(this.pos) === mi ? (this.advance(), this.make_token(it, s, this.pos, e, t)) : this.make_token(le, s, this.pos, e, t);
396
+ }
397
+ consume_at_keyword(e, t) {
398
+ let s = this.pos;
399
+ for (this.advance(); this.pos < this.source.length && et(this.source.charCodeAt(this.pos)); )
400
+ this.advance();
401
+ return this.make_token(Sr, s, this.pos, e, t);
402
+ }
403
+ consume_hash(e, t) {
404
+ let s = this.pos;
405
+ for (this.advance(); this.pos < this.source.length && et(this.source.charCodeAt(this.pos)); )
406
+ this.advance();
407
+ return this.make_token(Fi, s, this.pos, e, t);
408
+ }
409
+ advance(e = 1) {
410
+ if (e === 1) {
411
+ if (this.pos >= this.source.length) return;
412
+ let t = this.source.charCodeAt(this.pos);
413
+ this.pos++, ie(t) ? (t === Ai && this.pos < this.source.length && this.source.charCodeAt(this.pos) === yi && this.pos++, this.line++, this.column = 1) : this.column++;
414
+ return;
415
+ }
416
+ for (let t = 0; t < e && !(this.pos >= this.source.length); t++) {
417
+ let s = this.source.charCodeAt(this.pos);
418
+ this.pos++, ie(s) ? (s === Ai && this.pos < this.source.length && this.source.charCodeAt(this.pos) === yi && (this.pos++, t++), this.line++, this.column = 1) : this.column++;
419
+ }
420
+ }
421
+ peek(e = 1) {
422
+ let t = this.pos + e;
423
+ return t >= this.source.length ? 0 : this.source.charCodeAt(t);
424
+ }
425
+ make_token(e, t, s, i = this.line, n = this.column) {
426
+ return this.token_type = e, this.token_start = t, this.token_end = s, this.token_line = i, this.token_column = n, e;
427
+ }
428
+ // Public API: returns Token object for backwards compatibility
429
+ next_token(e = !1) {
430
+ return this.next_token_fast(e), {
431
+ type: this.token_type,
432
+ start: this.token_start,
433
+ end: this.token_end,
434
+ line: this.token_line,
435
+ column: this.token_column
436
+ };
437
+ }
438
+ /**
439
+ * Save complete lexer state for backtracking
440
+ * @returns Object containing all lexer state
441
+ */
442
+ save_position() {
443
+ return {
444
+ pos: this.pos,
445
+ line: this.line,
446
+ column: this.column,
447
+ token_type: this.token_type,
448
+ token_start: this.token_start,
449
+ token_end: this.token_end,
450
+ token_line: this.token_line,
451
+ token_column: this.token_column
452
+ };
453
+ }
454
+ /**
455
+ * Restore lexer state from saved position
456
+ * @param saved The saved position to restore
457
+ */
458
+ restore_position(e) {
459
+ this.pos = e.pos, this.line = e.line, this.column = e.column, this.token_type = e.token_type, this.token_start = e.token_start, this.token_end = e.token_end, this.token_line = e.token_line, this.token_column = e.token_column;
460
+ }
461
+ }
462
+ let st = 36;
463
+ const tn = 1, nt = 2, ze = 3, pe = 4, Yi = 5, Wi = 6, lt = 7, Qi = 10, as = 11, ot = 12, Vi = 13, sn = 14, ji = 15, rn = 16, nn = 17, Xi = 18, ln = 19, dt = 20, hs = 21, Zi = 22, Ji = 23, Ke = 24, be = 25, Ge = 26, at = 27, cs = 28, er = 29, Be = 30, re = 31, tr = 56, on = 32, an = 33, hn = 34, cn = 35, _n = 36, un = 37, fn = 38, pn = 39, sr = 40, dn = 1, gn = 2, Ei = 4, xn = 8, mn = 32, ir = 64, kn = 128, Ci = 0, wn = 1, An = 2, yn = 3, En = 4, Cn = 5, bn = 6, Pe = 0, Rn = 1, vn = 2, ne = class ne {
464
+ constructor(e = 1024) {
465
+ g(this, "buffer");
466
+ g(this, "view");
467
+ g(this, "capacity");
468
+ // Number of nodes that can fit
469
+ g(this, "count");
470
+ // Number of nodes currently allocated
471
+ g(this, "growth_count");
472
+ // Number of times the arena has grown
473
+ g(this, "overflow_lengths");
474
+ this.capacity = e, this.count = 1, this.growth_count = 0, this.buffer = new ArrayBuffer(e * st), this.view = new DataView(this.buffer), this.overflow_lengths = /* @__PURE__ */ new Map();
475
+ }
476
+ // Calculate recommended initial capacity based on CSS source size
477
+ static capacity_for_source(e) {
478
+ let t = e / 1024, s = Math.ceil(t * ne.NODES_PER_KB), i = Math.ceil(s * ne.CAPACITY_BUFFER);
479
+ return Math.max(16, i);
480
+ }
481
+ // Get the number of nodes currently in the arena
482
+ get_count() {
483
+ return this.count;
484
+ }
485
+ // Get the capacity (max nodes without reallocation)
486
+ get_capacity() {
487
+ return this.capacity;
488
+ }
489
+ // Get the number of times the arena has grown
490
+ get_growth_count() {
491
+ return this.growth_count;
492
+ }
493
+ // Calculate byte offset for a node
494
+ node_offset(e) {
495
+ return e * st;
496
+ }
497
+ // Read node type
498
+ get_type(e) {
499
+ return this.view.getUint8(this.node_offset(e));
500
+ }
501
+ // Read node flags
502
+ get_flags(e) {
503
+ return this.view.getUint8(this.node_offset(e) + 1);
504
+ }
505
+ // Read start offset in source
506
+ get_start_offset(e) {
507
+ return this.view.getUint32(this.node_offset(e) + 12, !0);
508
+ }
509
+ // Read length in source
510
+ get_length(e) {
511
+ if (this.has_flag(e, Ei)) {
512
+ const t = this.overflow_lengths.get(e);
513
+ if (t !== void 0)
514
+ return t;
515
+ }
516
+ return this.view.getUint16(this.node_offset(e) + 2, !0);
517
+ }
518
+ // Read content start offset (stored as delta from startOffset)
519
+ get_content_start(e) {
520
+ const t = this.get_start_offset(e), s = this.view.getUint16(this.node_offset(e) + 16, !0);
521
+ return t + s;
522
+ }
523
+ // Read content length
524
+ get_content_length(e) {
525
+ return this.view.getUint16(this.node_offset(e) + 20, !0);
526
+ }
527
+ // Read attribute operator (for NODE_SELECTOR_ATTRIBUTE)
528
+ get_attr_operator(e) {
529
+ return this.view.getUint8(this.node_offset(e) + 32);
530
+ }
531
+ // Read attribute flags (for NODE_SELECTOR_ATTRIBUTE)
532
+ get_attr_flags(e) {
533
+ return this.view.getUint8(this.node_offset(e) + 33);
534
+ }
535
+ // Read first child index (0 = no children)
536
+ get_first_child(e) {
537
+ return this.view.getUint32(this.node_offset(e) + 4, !0);
538
+ }
539
+ // Read next sibling index (0 = no sibling)
540
+ get_next_sibling(e) {
541
+ return this.view.getUint32(this.node_offset(e) + 8, !0);
542
+ }
543
+ // Read start line
544
+ get_start_line(e) {
545
+ return this.view.getUint32(this.node_offset(e) + 24, !0);
546
+ }
547
+ // Read start column
548
+ get_start_column(e) {
549
+ return this.view.getUint32(this.node_offset(e) + 28, !0);
550
+ }
551
+ // Read value start offset (stored as delta from startOffset, declaration value / at-rule prelude)
552
+ get_value_start(e) {
553
+ const t = this.get_start_offset(e), s = this.view.getUint16(this.node_offset(e) + 18, !0);
554
+ return t + s;
555
+ }
556
+ // Read value length
557
+ get_value_length(e) {
558
+ return this.view.getUint16(this.node_offset(e) + 22, !0);
559
+ }
560
+ // --- Write Methods ---
561
+ // Write node type
562
+ set_type(e, t) {
563
+ this.view.setUint8(this.node_offset(e), t);
564
+ }
565
+ // Write node flags
566
+ set_flags(e, t) {
567
+ this.view.setUint8(this.node_offset(e) + 1, t);
568
+ }
569
+ // Write length in source
570
+ set_length(e, t) {
571
+ t > 65535 ? (this.view.setUint16(this.node_offset(e) + 2, 65535, !0), this.set_flag(e, Ei), this.overflow_lengths.set(e, t)) : this.view.setUint16(this.node_offset(e) + 2, t, !0);
572
+ }
573
+ // Write content start delta (offset from startOffset)
574
+ set_content_start_delta(e, t) {
575
+ this.view.setUint16(this.node_offset(e) + 16, t, !0);
576
+ }
577
+ // Write content length
578
+ set_content_length(e, t) {
579
+ this.view.setUint16(this.node_offset(e) + 20, t, !0);
580
+ }
581
+ // Write attribute operator (for NODE_SELECTOR_ATTRIBUTE)
582
+ set_attr_operator(e, t) {
583
+ this.view.setUint8(this.node_offset(e) + 32, t);
584
+ }
585
+ // Write attribute flags (for NODE_SELECTOR_ATTRIBUTE)
586
+ set_attr_flags(e, t) {
587
+ this.view.setUint8(this.node_offset(e) + 33, t);
588
+ }
589
+ // Write first child index
590
+ set_first_child(e, t) {
591
+ this.view.setUint32(this.node_offset(e) + 4, t, !0);
592
+ }
593
+ // Write next sibling index
594
+ set_next_sibling(e, t) {
595
+ this.view.setUint32(this.node_offset(e) + 8, t, !0);
596
+ }
597
+ // Write value start delta (offset from startOffset, declaration value / at-rule prelude)
598
+ set_value_start_delta(e, t) {
599
+ this.view.setUint16(this.node_offset(e) + 18, t, !0);
600
+ }
601
+ // Write value length
602
+ set_value_length(e, t) {
603
+ this.view.setUint16(this.node_offset(e) + 22, t, !0);
604
+ }
605
+ // --- Node Creation ---
606
+ // Grow the arena by 1.3x when capacity is exceeded
607
+ grow() {
608
+ this.growth_count++;
609
+ let e = Math.ceil(this.capacity * ne.GROWTH_FACTOR), t = new ArrayBuffer(e * st);
610
+ new Uint8Array(t).set(new Uint8Array(this.buffer)), this.buffer = t, this.view = new DataView(t), this.capacity = e;
611
+ }
612
+ // Allocate and initialize a new node with core properties
613
+ // Automatically grows the arena if capacity is exceeded
614
+ create_node(e, t, s, i, n) {
615
+ this.count >= this.capacity && this.grow();
616
+ const l = this.count;
617
+ this.count++;
618
+ const o = l * st;
619
+ return this.view.setUint8(o, e), this.view.setUint32(o + 12, t, !0), this.view.setUint32(o + 24, i, !0), this.view.setUint32(o + 28, n, !0), this.set_length(l, s), l;
620
+ }
621
+ // --- Tree Building Helpers ---
622
+ // Link multiple child nodes to a parent
623
+ // Children are linked as siblings in the order provided
624
+ append_children(e, t) {
625
+ if (t.length === 0) return;
626
+ const s = this.node_offset(e);
627
+ this.view.setUint32(s + 4, t[0], !0);
628
+ for (let i = 0; i < t.length - 1; i++)
629
+ this.set_next_sibling(t[i], t[i + 1]);
630
+ }
631
+ // Check if a node has any children
632
+ has_children(e) {
633
+ return this.get_first_child(e) !== 0;
634
+ }
635
+ // Check if a node has a next sibling
636
+ has_next_sibling(e) {
637
+ return this.get_next_sibling(e) !== 0;
638
+ }
639
+ // --- Flag Management Helpers ---
640
+ // Set a specific flag bit (doesn't clear other flags)
641
+ set_flag(e, t) {
642
+ let s = this.get_flags(e);
643
+ this.set_flags(e, s | t);
644
+ }
645
+ // Clear a specific flag bit (doesn't affect other flags)
646
+ clear_flag(e, t) {
647
+ let s = this.get_flags(e);
648
+ this.set_flags(e, s & ~t);
649
+ }
650
+ // Check if a specific flag is set
651
+ has_flag(e, t) {
652
+ return (this.get_flags(e) & t) !== 0;
653
+ }
654
+ };
655
+ // Stores actual lengths for nodes > 65535 chars
656
+ // Growth multiplier when capacity is exceeded
657
+ g(ne, "GROWTH_FACTOR", 1.3), // Estimated nodes per KB of CSS (based on real-world data)
658
+ // Increased from 270 to 325 to account for VALUE wrapper nodes
659
+ // (~20% of nodes are declarations, +1 VALUE node per declaration = +20% nodes)
660
+ g(ne, "NODES_PER_KB", 325), // Buffer to avoid frequent growth (15%)
661
+ g(ne, "CAPACITY_BUFFER", 1.2);
662
+ let ct = ne;
663
+ const Tn = 32, On = 9, Sn = 10, Nn = 13, Un = 12, Se = 47, W = 42, F = 45, Ln = 39, Hn = 34, ee = 43, rr = 46, ht = 126, nr = 62, In = 38, fe = 61, De = 124, bi = 36, Ri = 94, Pn = 58;
664
+ function te(r) {
665
+ return r === Tn || r === On || r === Sn || r === Nn || r === Un;
666
+ }
667
+ function Dn(r) {
668
+ return r === nr || r === ee || r === ht;
669
+ }
670
+ function Jt(r) {
671
+ return r >= 48 && r <= 57;
672
+ }
673
+ function Y(r, e) {
674
+ if (r.length !== e.length)
675
+ return !1;
676
+ for (let t = 0; t < r.length; t++) {
677
+ let s = r.charCodeAt(t), i = e.charCodeAt(t);
678
+ if (i |= 32, s !== i)
679
+ return !1;
680
+ }
681
+ return !0;
682
+ }
683
+ function Fn(r, e) {
684
+ if (r.length < e.length)
685
+ return !1;
686
+ for (let t = 0; t < e.length; t++) {
687
+ let s = r.charCodeAt(t), i = e.charCodeAt(t);
688
+ if (s >= 65 && s <= 90 && (s |= 32), s !== i)
689
+ return !1;
690
+ }
691
+ return !0;
692
+ }
693
+ function Mn(r, e) {
694
+ if (e.length === 0)
695
+ return -1;
696
+ if (e.length === 1) {
697
+ const t = e.charCodeAt(0);
698
+ for (let s = 0; s < r.length; s++) {
699
+ let i = r.charCodeAt(s);
700
+ if (i >= 65 && i <= 90 && (i |= 32), i === t)
701
+ return s;
702
+ }
703
+ return -1;
704
+ }
705
+ for (let t = 0; t <= r.length - e.length; t++) {
706
+ let s = !0;
707
+ for (let i = 0; i < e.length; i++) {
708
+ let n = r.charCodeAt(t + i), l = e.charCodeAt(i);
709
+ if (n >= 65 && n <= 90 && (n |= 32), n !== l) {
710
+ s = !1;
711
+ break;
712
+ }
713
+ }
714
+ if (s)
715
+ return t;
716
+ }
717
+ return -1;
718
+ }
719
+ function Fe(r, e, t) {
720
+ if ((e === void 0 || t === void 0) && (e = 0, t = r.length), r.charCodeAt(e) !== F || r.charCodeAt(e + 1) === F || t - e < 3)
721
+ return !1;
722
+ for (let i = e + 2; i < t; i++)
723
+ if (r.charCodeAt(i) === F)
724
+ return !0;
725
+ return !1;
726
+ }
727
+ function qn(r, e, t) {
728
+ for (; e < t && te(r.charCodeAt(e)); )
729
+ e++;
730
+ return e;
731
+ }
732
+ function ye(r, e, t) {
733
+ for (; e < t; ) {
734
+ let s = r.charCodeAt(e);
735
+ if (te(s)) {
736
+ e++;
737
+ continue;
738
+ }
739
+ if (s === Se && e + 1 < t && r.charCodeAt(e + 1) === W) {
740
+ for (e += 2; e < t; ) {
741
+ if (r.charCodeAt(e) === W && e + 1 < t && r.charCodeAt(e + 1) === Se) {
742
+ e += 2;
743
+ break;
744
+ }
745
+ e++;
746
+ }
747
+ continue;
748
+ }
749
+ break;
750
+ }
751
+ return e;
752
+ }
753
+ function zn(r, e, t) {
754
+ for (; e > t; ) {
755
+ let s = r.charCodeAt(e - 1);
756
+ if (te(s)) {
757
+ e--;
758
+ continue;
759
+ }
760
+ if (e >= 2 && s === Se && r.charCodeAt(e - 2) === W) {
761
+ for (e -= 2; e > t; ) {
762
+ if (e >= 2 && r.charCodeAt(e - 2) === Se && r.charCodeAt(e - 1) === W) {
763
+ e -= 2;
764
+ break;
765
+ }
766
+ e--;
767
+ }
768
+ continue;
769
+ }
770
+ break;
771
+ }
772
+ return e;
773
+ }
774
+ function es(r) {
775
+ let e = 0;
776
+ for (let n = 0; n < r.length; n++) {
777
+ let l = r.charCodeAt(n);
778
+ if (l === 101 || l === 69) {
779
+ if (n + 1 < r.length) {
780
+ let o = r.charCodeAt(n + 1);
781
+ if (Jt(o)) {
782
+ e = n + 1;
783
+ continue;
784
+ }
785
+ if ((o === 43 || o === 45) && n + 2 < r.length) {
786
+ let h = r.charCodeAt(n + 2);
787
+ if (Jt(h)) {
788
+ e = n + 1;
789
+ continue;
790
+ }
791
+ }
792
+ }
793
+ break;
794
+ }
795
+ if (Jt(l) || l === rr || l === F || l === ee)
796
+ e = n + 1;
797
+ else
798
+ break;
799
+ }
800
+ let t = r.substring(0, e), s = r.substring(e);
801
+ return { value: t ? parseFloat(t) : 0, unit: s };
802
+ }
803
+ const Kn = {
804
+ [tn]: "StyleSheet",
805
+ [nt]: "Rule",
806
+ [ze]: "Atrule",
807
+ [pe]: "Declaration",
808
+ [Yi]: "Selector",
809
+ [Wi]: "Comment",
810
+ [lt]: "Block",
811
+ [Qi]: "Identifier",
812
+ [as]: "Number",
813
+ [ot]: "Dimension",
814
+ [Vi]: "String",
815
+ [sn]: "Hash",
816
+ [ji]: "Function",
817
+ [rn]: "Operator",
818
+ [nn]: "Parentheses",
819
+ [Xi]: "Url",
820
+ [ln]: "Value",
821
+ [dt]: "SelectorList",
822
+ [hs]: "TypeSelector",
823
+ [Zi]: "ClassSelector",
824
+ [Ji]: "IdSelector",
825
+ [Ke]: "AttributeSelector",
826
+ [be]: "PseudoClassSelector",
827
+ [Ge]: "PseudoElementSelector",
828
+ [at]: "Combinator",
829
+ [cs]: "UniversalSelector",
830
+ [er]: "NestingSelector",
831
+ [Be]: "Nth",
832
+ [re]: "NthOf",
833
+ [tr]: "Lang",
834
+ [on]: "MediaQuery",
835
+ [an]: "Feature",
836
+ [hn]: "MediaType",
837
+ [cn]: "ContainerQuery",
838
+ [_n]: "SupportsQuery",
839
+ [un]: "Layer",
840
+ [fn]: "Operator",
841
+ [pn]: "MediaFeatureRange",
842
+ [sr]: "AtrulePrelude"
843
+ };
844
+ class Ye {
845
+ constructor(e, t, s) {
846
+ g(this, "arena");
847
+ g(this, "source");
848
+ g(this, "index");
849
+ this.arena = e, this.source = t, this.index = s;
850
+ }
851
+ /**
852
+ * @internal
853
+ * Get the arena (for internal/advanced use only)
854
+ */
855
+ __get_arena() {
856
+ return this.arena;
857
+ }
858
+ /** Get node type as number (for performance) */
859
+ get type() {
860
+ return this.arena.get_type(this.index);
861
+ }
862
+ /** Get node type as human-readable string */
863
+ get type_name() {
864
+ return Kn[this.type] || "unknown";
865
+ }
866
+ /** Get the full text of this node from source */
867
+ get text() {
868
+ let e = this.arena.get_start_offset(this.index), t = this.arena.get_length(this.index);
869
+ return this.source.substring(e, e + t);
870
+ }
871
+ /** Get the "content" text (property name for declarations, at-rule name for at-rules, layer name for import layers) */
872
+ get name() {
873
+ let e = this.arena.get_content_start(this.index), t = this.arena.get_content_length(this.index);
874
+ return t === 0 ? "" : this.source.substring(e, e + t);
875
+ }
876
+ /**
877
+ * Alias for name (for declarations: "color" in "color: blue")
878
+ * More semantic than `name` for declaration nodes
879
+ */
880
+ get property() {
881
+ return this.name;
882
+ }
883
+ /**
884
+ * Get the value text (for declarations: "blue" in "color: blue")
885
+ * For dimension/number nodes: returns the numeric value as a number
886
+ * For string nodes: returns the string content without quotes
887
+ * For URL nodes with quoted string: returns the string with quotes (consistent with STRING node)
888
+ * For URL nodes with unquoted URL: returns the URL content without quotes
889
+ */
890
+ get value() {
891
+ let { type: e, text: t } = this;
892
+ if (e === pe && this.first_child)
893
+ return this.first_child;
894
+ if (e === ot)
895
+ return es(t).value;
896
+ if (e === as)
897
+ return Number.parseFloat(this.text);
898
+ if (e === Xi) {
899
+ let n = this.first_child;
900
+ if (n && n.type === Vi)
901
+ return n.text;
902
+ if (Fn(t, "url(")) {
903
+ let l = t.indexOf("("), o = t.lastIndexOf(")");
904
+ if (l !== -1 && o !== -1 && o > l)
905
+ return t.substring(l + 1, o).trim();
906
+ } else if (t.startsWith('"') || t.startsWith("'"))
907
+ return t;
908
+ }
909
+ let s = this.arena.get_value_start(this.index), i = this.arena.get_value_length(this.index);
910
+ return i === 0 ? null : this.source.substring(s, s + i);
911
+ }
912
+ /** Get the numeric value for NUMBER and DIMENSION nodes, or null for other node types */
913
+ get value_as_number() {
914
+ let e = this.text;
915
+ return this.type === as ? Number.parseFloat(e) : this.type === ot ? es(e).value : null;
916
+ }
917
+ /**
918
+ * Get the prelude node:
919
+ * - For at-rules: AT_RULE_PRELUDE wrapper containing structured prelude children (media queries, layer names, etc.)
920
+ * - For style rules: SELECTOR_LIST or SELECTOR node
921
+ * Returns null if no prelude exists
922
+ */
923
+ get prelude() {
924
+ if (this.type === ze) {
925
+ let e = this.first_child;
926
+ return e && e.type === sr ? e : null;
927
+ }
928
+ if (this.type === nt)
929
+ return this.first_child;
930
+ }
931
+ /**
932
+ * Get the attribute operator (for attribute selectors: =, ~=, |=, ^=, $=, *=)
933
+ * Returns one of the ATTR_OPERATOR_* constants
934
+ */
935
+ get attr_operator() {
936
+ if (this.type === Ke)
937
+ return this.arena.get_attr_operator(this.index);
938
+ }
939
+ /**
940
+ * Get the attribute flags (for attribute selectors: i, s)
941
+ * Returns one of the ATTR_FLAG_* constants
942
+ */
943
+ get attr_flags() {
944
+ if (this.type === Ke)
945
+ return this.arena.get_attr_flags(this.index);
946
+ }
947
+ /** Get the unit for dimension nodes (e.g., "px" from "100px", "%" from "50%") */
948
+ get unit() {
949
+ if (this.type === ot)
950
+ return es(this.text).unit;
951
+ }
952
+ /** Check if this declaration has !important */
953
+ get is_important() {
954
+ if (this.type === pe)
955
+ return this.arena.has_flag(this.index, dn);
956
+ }
957
+ /** Check if this declaration has a browser hack prefix */
958
+ get is_browserhack() {
959
+ if (this.type === pe)
960
+ return this.arena.has_flag(this.index, kn);
961
+ }
962
+ /** Check if this has a vendor prefix (computed on-demand) */
963
+ get is_vendor_prefixed() {
964
+ switch (this.type) {
965
+ case pe:
966
+ return Fe(this.name);
967
+ case be:
968
+ case Ge:
969
+ return Fe(this.name);
970
+ case ze:
971
+ return Fe(this.name);
972
+ case ji:
973
+ return Fe(this.name);
974
+ case Qi:
975
+ return Fe(this.text);
976
+ default:
977
+ return !1;
978
+ }
979
+ }
980
+ /** Check if this node has an error */
981
+ get has_error() {
982
+ return this.arena.has_flag(this.index, gn);
983
+ }
984
+ /** Check if this node has a prelude (at-rules and style rules) */
985
+ get has_prelude() {
986
+ return this.type === ze ? this.arena.get_value_length(this.index) > 0 : this.type === nt ? this.first_child !== null : !1;
987
+ }
988
+ /** Check if this rule has a block { } */
989
+ get has_block() {
990
+ return this.arena.has_flag(this.index, xn);
991
+ }
992
+ /** Check if this style rule has declarations */
993
+ get has_declarations() {
994
+ return this.arena.has_flag(this.index, mn);
995
+ }
996
+ /** Get the block node (for style rules and at-rules with blocks) */
997
+ get block() {
998
+ if (this.type === nt) {
999
+ let e = this.first_child;
1000
+ if (!e) return null;
1001
+ let t = e.next_sibling;
1002
+ return t && t.type === lt ? t : null;
1003
+ }
1004
+ if (this.type === ze) {
1005
+ let e = this.first_child;
1006
+ for (; e; ) {
1007
+ if (e.type === lt && !e.next_sibling)
1008
+ return e;
1009
+ e = e.next_sibling;
1010
+ }
1011
+ return null;
1012
+ }
1013
+ return null;
1014
+ }
1015
+ /** Check if this block is empty (no declarations or rules, only comments allowed) */
1016
+ get is_empty() {
1017
+ if (this.type !== lt) return;
1018
+ let e = this.first_child;
1019
+ for (; e; ) {
1020
+ if (e.type !== Wi)
1021
+ return !1;
1022
+ e = e.next_sibling;
1023
+ }
1024
+ return !0;
1025
+ }
1026
+ /** Get start line number */
1027
+ get line() {
1028
+ return this.arena.get_start_line(this.index);
1029
+ }
1030
+ /** Get start column number */
1031
+ get column() {
1032
+ return this.arena.get_start_column(this.index);
1033
+ }
1034
+ /** Get start offset in source */
1035
+ get start() {
1036
+ return this.arena.get_start_offset(this.index);
1037
+ }
1038
+ /** Get length in source */
1039
+ get length() {
1040
+ return this.arena.get_length(this.index);
1041
+ }
1042
+ /**
1043
+ * Get end offset in source
1044
+ * End is not stored, must be calculated
1045
+ */
1046
+ get end() {
1047
+ return this.start + this.length;
1048
+ }
1049
+ // --- Tree Traversal ---
1050
+ /** Get first child node */
1051
+ get first_child() {
1052
+ let e = this.arena.get_first_child(this.index);
1053
+ return e === 0 ? null : new Ye(this.arena, this.source, e);
1054
+ }
1055
+ /** Get next sibling node */
1056
+ get next_sibling() {
1057
+ let e = this.arena.get_next_sibling(this.index);
1058
+ return e === 0 ? null : new Ye(this.arena, this.source, e);
1059
+ }
1060
+ /** Check if this node has a next sibling */
1061
+ get has_next() {
1062
+ return this.arena.get_next_sibling(this.index) !== 0;
1063
+ }
1064
+ /**
1065
+ * Check if this node has children
1066
+ * For pseudo-class/pseudo-element functions, returns true if FLAG_HAS_PARENS is set
1067
+ * This allows formatters to distinguish :lang() from :hover
1068
+ */
1069
+ get has_children() {
1070
+ return (this.type === be || this.type === Ge) && this.arena.has_flag(this.index, ir) ? !0 : this.arena.has_children(this.index);
1071
+ }
1072
+ /** Get all children as an array */
1073
+ get children() {
1074
+ let e = [], t = this.first_child;
1075
+ for (; t; )
1076
+ e.push(t), t = t.next_sibling;
1077
+ return e;
1078
+ }
1079
+ /** Make CSSNode iterable over its children */
1080
+ *[Symbol.iterator]() {
1081
+ let e = this.first_child;
1082
+ for (; e; )
1083
+ yield e, e = e.next_sibling;
1084
+ }
1085
+ // --- An+B Expression Helpers (for NODE_SELECTOR_NTH) ---
1086
+ /** Get the 'a' coefficient from An+B expression (e.g., "2n" from "2n+1", "odd" from "odd") */
1087
+ get nth_a() {
1088
+ if (this.type !== Be && this.type !== re) return;
1089
+ let e = this.arena.get_content_length(this.index);
1090
+ if (e === 0) return;
1091
+ let t = this.arena.get_content_start(this.index);
1092
+ return this.source.substring(t, t + e);
1093
+ }
1094
+ /** Get the 'b' coefficient from An+B expression (e.g., "+1" from "2n+1") */
1095
+ get nth_b() {
1096
+ if (this.type !== Be && this.type !== re) return;
1097
+ let e = this.arena.get_value_length(this.index);
1098
+ if (e === 0) return;
1099
+ let t = this.arena.get_value_start(this.index), s = this.source.substring(t, t + e), i = t - 1;
1100
+ for (; i >= 0; ) {
1101
+ let n = this.source.charCodeAt(i);
1102
+ if (te(n)) {
1103
+ i--;
1104
+ continue;
1105
+ }
1106
+ n === F ? s = "-" + s : n === ee && (s = "+" + s);
1107
+ break;
1108
+ }
1109
+ return s;
1110
+ }
1111
+ // --- Pseudo-Class Nth-Of Helpers (for NODE_SELECTOR_NTH_OF) ---
1112
+ /** Get the An+B formula node from :nth-child(2n+1 of .foo) */
1113
+ get nth() {
1114
+ if (this.type === re)
1115
+ return this.first_child ?? void 0;
1116
+ }
1117
+ /** Get the selector list from :nth-child(2n+1 of .foo) */
1118
+ get selector() {
1119
+ if (this.type !== re) return;
1120
+ let e = this.first_child;
1121
+ return (e == null ? void 0 : e.next_sibling) ?? void 0;
1122
+ }
1123
+ // --- Pseudo-Class Selector List Helper ---
1124
+ /**
1125
+ * Get selector list from pseudo-class functions
1126
+ * Works for :is(.a), :not(.b), :has(.c), :where(.d), :nth-child(2n of .e)
1127
+ */
1128
+ get selector_list() {
1129
+ if (this.type !== be) return;
1130
+ let e = this.first_child;
1131
+ if (e) {
1132
+ if (e.type === dt)
1133
+ return e;
1134
+ if (e.type === re)
1135
+ return e.selector;
1136
+ }
1137
+ }
1138
+ // --- Node Cloning ---
1139
+ /**
1140
+ * Clone this node as a mutable plain JavaScript object with children as arrays.
1141
+ * See API.md for examples.
1142
+ *
1143
+ * @param options - Cloning configuration
1144
+ * @param options.deep - Recursively clone children (default: true)
1145
+ * @param options.locations - Include line/column/start/length (default: false)
1146
+ */
1147
+ clone(e = {}) {
1148
+ const { deep: t = !0, locations: s = !1 } = e;
1149
+ let i = {
1150
+ type: this.type,
1151
+ type_name: this.type_name,
1152
+ text: this.text,
1153
+ children: []
1154
+ };
1155
+ if (this.name && (i.name = this.name), this.type === pe && (i.property = this.name), this.value !== void 0 && this.value !== null && (i.value = this.value, this.unit && (i.unit = this.unit)), this.type === pe && (i.is_important = this.is_important, i.is_browserhack = this.is_browserhack), i.is_vendor_prefixed = this.is_vendor_prefixed, i.has_error = this.has_error, this.type === Ke && (i.attr_operator = this.attr_operator, i.attr_flags = this.attr_flags), (this.type === Be || this.type === re) && (i.nth_a = this.nth_a, i.nth_b = this.nth_b), s && (i.line = this.line, i.column = this.column, i.start = this.start, i.length = this.length, i.end = this.end), t)
1156
+ for (let n of this.children)
1157
+ i.children.push(n.clone({ deep: !0, locations: s }));
1158
+ return i;
1159
+ }
1160
+ }
1161
+ class vi {
1162
+ constructor(e, t) {
1163
+ g(this, "lexer");
1164
+ g(this, "arena");
1165
+ g(this, "source");
1166
+ g(this, "expr_end");
1167
+ this.arena = e, this.source = t, this.lexer = new Gi(t), this.expr_end = 0;
1168
+ }
1169
+ /**
1170
+ * Parse An+B expression
1171
+ * Examples: odd, even, 3, n, -n, 2n, 2n+1, -3n-5
1172
+ */
1173
+ parse_anplusb(e, t, s = 1) {
1174
+ this.expr_end = t, this.lexer.pos = e, this.lexer.line = s;
1175
+ let i = null, n = e, l = e, o = e, h = e;
1176
+ const c = e;
1177
+ if (this.skip_whitespace(), this.lexer.pos >= this.expr_end)
1178
+ return null;
1179
+ if (this.lexer.next_token_fast(!0), this.lexer.token_type === le) {
1180
+ const _ = this.source.substring(this.lexer.token_start, this.lexer.token_end);
1181
+ if (Y("odd", _) || Y("even", _))
1182
+ return n = this.lexer.token_start, l = this.lexer.token_end, this.create_anplusb_node(c, n, l, 0, 0);
1183
+ const f = this.source.charCodeAt(this.lexer.token_start), x = this.lexer.token_end > this.lexer.token_start + 1 ? this.source.charCodeAt(this.lexer.token_start + 1) : 0;
1184
+ return f === F && x === 110 ? this.lexer.token_end > this.lexer.token_start + 2 && this.source.charCodeAt(this.lexer.token_start + 2) === F ? (n = this.lexer.token_start, l = this.lexer.token_start + 2, i = this.source.substring(this.lexer.token_start + 2, this.lexer.token_end), o = this.lexer.token_start + 2, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h)) : (n = this.lexer.token_start, l = this.lexer.token_start + 2, i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, i !== null ? o : 0, i !== null ? h : 0)) : f === 110 ? this.lexer.token_end > this.lexer.token_start + 1 && this.source.charCodeAt(this.lexer.token_start + 1) === F ? (n = this.lexer.token_start, l = this.lexer.token_start + 1, i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), o = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h)) : (n = this.lexer.token_start, l = this.lexer.token_start + 1, i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, i !== null ? o : 0, i !== null ? h : 0)) : null;
1185
+ }
1186
+ if (this.lexer.token_type === de && this.source.charCodeAt(this.lexer.token_start) === ee) {
1187
+ const _ = this.lexer.save_position();
1188
+ if (this.lexer.next_token_fast(!0), this.lexer.token_type === le && this.source.substring(this.lexer.token_start, this.lexer.token_end).charCodeAt(0) === 110)
1189
+ return n = _.pos - 1, l = this.lexer.token_start + 1, this.lexer.token_end > this.lexer.token_start + 1 && this.source.charCodeAt(this.lexer.token_start + 1) === F ? (i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), o = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h)) : (i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, i !== null ? o : 0, i !== null ? h : 0));
1190
+ this.lexer.restore_position(_);
1191
+ }
1192
+ if (this.lexer.token_type === qi) {
1193
+ const _ = this.source.substring(this.lexer.token_start, this.lexer.token_end), f = Mn(_, "n");
1194
+ if (f !== -1) {
1195
+ if (n = this.lexer.token_start, l = this.lexer.token_start + f + 1, f + 1 < _.length) {
1196
+ const x = _.substring(f + 1);
1197
+ if (x.charCodeAt(0) === F)
1198
+ return i = x, o = this.lexer.token_start + f + 1, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h);
1199
+ }
1200
+ return i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, o, h);
1201
+ }
1202
+ }
1203
+ return this.lexer.token_type === rt ? (i = this.source.substring(this.lexer.token_start, this.lexer.token_end), o = this.lexer.token_start, h = this.lexer.token_end, this.create_anplusb_node(c, 0, 0, o, h)) : null;
1204
+ }
1205
+ /**
1206
+ * Parse the b part after 'n'
1207
+ * Handles: +5, -3, whitespace variations
1208
+ */
1209
+ parse_b_part() {
1210
+ if (this.skip_whitespace(), this.lexer.pos >= this.expr_end)
1211
+ return null;
1212
+ if (this.lexer.next_token_fast(!0), this.lexer.token_type === de) {
1213
+ const e = this.source.charCodeAt(this.lexer.token_start);
1214
+ if (e === ee || e === F) {
1215
+ const t = e === F ? "-" : "";
1216
+ if (this.skip_whitespace(), this.lexer.next_token_fast(!0), this.lexer.token_type === rt) {
1217
+ let s = this.source.substring(this.lexer.token_start, this.lexer.token_end);
1218
+ return s.charCodeAt(0) === ee && (s = s.substring(1)), t === "-" ? t + s : s;
1219
+ }
1220
+ }
1221
+ }
1222
+ if (this.lexer.token_type === rt) {
1223
+ let e = this.source.substring(this.lexer.token_start, this.lexer.token_end);
1224
+ const t = e.charCodeAt(0);
1225
+ if (t === ee || t === F)
1226
+ return t === ee && (e = e.substring(1)), e;
1227
+ }
1228
+ return null;
1229
+ }
1230
+ skip_whitespace() {
1231
+ this.lexer.pos = ye(this.source, this.lexer.pos, this.expr_end);
1232
+ }
1233
+ create_anplusb_node(e, t, s, i, n) {
1234
+ const l = this.arena.create_node(Be, e, this.lexer.pos - e, this.lexer.line, 1);
1235
+ return s > t && (this.arena.set_content_start_delta(l, t - e), this.arena.set_content_length(l, s - t)), n > i && (this.arena.set_value_start_delta(l, i - e), this.arena.set_value_length(l, n - i)), l;
1236
+ }
1237
+ }
1238
+ class Bn {
1239
+ constructor(e, t) {
1240
+ g(this, "lexer");
1241
+ g(this, "arena");
1242
+ g(this, "source");
1243
+ g(this, "selector_end");
1244
+ this.arena = e, this.source = t, this.lexer = new Gi(t), this.selector_end = 0;
1245
+ }
1246
+ // Parse a selector range into selector nodes (standalone use)
1247
+ // Always returns a NODE_SELECTOR_LIST with selector components as children
1248
+ parse_selector(e, t, s = 1, i = 1, n = !0) {
1249
+ return this.selector_end = t, this.lexer.pos = e, this.lexer.line = s, this.lexer.column = i, this.parse_selector_list(n);
1250
+ }
1251
+ // Parse comma-separated selectors
1252
+ parse_selector_list(e = !0) {
1253
+ let t = [], s = this.lexer.pos, i = this.lexer.line, n = this.lexer.column;
1254
+ for (; this.lexer.pos < this.selector_end; ) {
1255
+ let l = this.lexer.pos, o = this.lexer.line, h = this.lexer.column, c = this.parse_complex_selector(e);
1256
+ if (c !== null) {
1257
+ let f = this.arena.create_node(
1258
+ Yi,
1259
+ l,
1260
+ this.lexer.pos - l,
1261
+ o,
1262
+ h
1263
+ );
1264
+ this.arena.set_content_start_delta(f, 0), this.arena.set_content_length(f, this.lexer.pos - l);
1265
+ let x = c, k = this.arena.get_next_sibling(x);
1266
+ for (; k !== 0; )
1267
+ x = k, k = this.arena.get_next_sibling(x);
1268
+ this.arena.set_first_child(f, c), t.push(f);
1269
+ }
1270
+ if (this.skip_whitespace(), this.lexer.pos >= this.selector_end) break;
1271
+ if (this.lexer.next_token_fast(!1), this.lexer.token_type === qe) {
1272
+ this.skip_whitespace();
1273
+ continue;
176
1274
  } else
177
- e({
178
- name: c,
179
- // @ts-expect-error TODO: fix this
180
- loc: n
181
- });
1275
+ break;
182
1276
  }
183
- });
1277
+ if (t.length >= 1) {
1278
+ let l = this.arena.create_node(dt, s, this.lexer.pos - s, i, n);
1279
+ return this.arena.append_children(l, t), l;
1280
+ }
1281
+ return null;
1282
+ }
1283
+ // Parse a complex selector (with combinators)
1284
+ // e.g., "div.class > p + span"
1285
+ // Also supports CSS Nesting relaxed syntax: "> a", "~ span", etc.
1286
+ parse_complex_selector(e = !0) {
1287
+ let t = [];
1288
+ if (this.skip_whitespace(), e && this.lexer.pos < this.selector_end) {
1289
+ const s = this.lexer.save_position();
1290
+ if (this.lexer.next_token_fast(!1), this.lexer.token_type === de) {
1291
+ let n = this.source.charCodeAt(this.lexer.token_start);
1292
+ if (n === nr || n === ee || n === ht) {
1293
+ let l = this.create_node_at(
1294
+ at,
1295
+ this.lexer.token_start,
1296
+ this.lexer.token_end,
1297
+ this.lexer.token_line,
1298
+ this.lexer.token_column
1299
+ );
1300
+ t.push(l), this.skip_whitespace();
1301
+ } else
1302
+ this.lexer.restore_position(s);
1303
+ } else
1304
+ this.lexer.restore_position(s);
1305
+ }
1306
+ for (; this.lexer.pos < this.selector_end; ) {
1307
+ let s = this.parse_compound_selector();
1308
+ if (s !== null)
1309
+ t.push(s);
1310
+ else
1311
+ break;
1312
+ let i = this.try_parse_combinator();
1313
+ if (i !== null) {
1314
+ t.push(i), this.skip_whitespace();
1315
+ continue;
1316
+ }
1317
+ const n = this.lexer.save_position();
1318
+ if (this.skip_whitespace(), this.lexer.pos >= this.selector_end) {
1319
+ this.lexer.restore_position(n);
1320
+ break;
1321
+ }
1322
+ if (this.lexer.next_token_fast(!1), this.lexer.token_type === qe || this.lexer.pos >= this.selector_end) {
1323
+ this.lexer.restore_position(n);
1324
+ break;
1325
+ }
1326
+ this.lexer.restore_position(n);
1327
+ break;
1328
+ }
1329
+ if (t.length === 0) return null;
1330
+ for (let s = 0; s < t.length - 1; s++) {
1331
+ let i = t[s];
1332
+ for (; this.arena.get_next_sibling(i) !== 0; )
1333
+ i = this.arena.get_next_sibling(i);
1334
+ this.arena.set_next_sibling(i, t[s + 1]);
1335
+ }
1336
+ return t[0];
1337
+ }
1338
+ // Parse a compound selector (no combinators)
1339
+ // e.g., "div.class#id[attr]:hover"
1340
+ parse_compound_selector() {
1341
+ let e = [];
1342
+ for (; this.lexer.pos < this.selector_end; ) {
1343
+ const t = this.lexer.save_position();
1344
+ if (this.lexer.next_token_fast(!1), this.lexer.token_start >= this.selector_end || this.lexer.token_type === os) break;
1345
+ let i = this.parse_simple_selector();
1346
+ if (i !== null)
1347
+ e.push(i);
1348
+ else {
1349
+ this.lexer.restore_position(t);
1350
+ break;
1351
+ }
1352
+ }
1353
+ if (e.length === 0) return null;
1354
+ for (let t = 0; t < e.length - 1; t++)
1355
+ this.arena.set_next_sibling(e[t], e[t + 1]);
1356
+ return e[0];
1357
+ }
1358
+ // Parse a simple selector (single component)
1359
+ parse_simple_selector() {
1360
+ let e = this.lexer.token_type, t = this.lexer.token_start, s = this.lexer.token_end;
1361
+ switch (e) {
1362
+ case le:
1363
+ return this.parse_type_or_namespace_selector(t, s);
1364
+ case Fi:
1365
+ return this.create_node(Ji, t, s);
1366
+ case de:
1367
+ let i = this.source.charCodeAt(t);
1368
+ return i === rr ? this.parse_class_selector(t) : i === W ? this.parse_universal_or_namespace_selector(t, s) : i === In ? this.create_node(er, t, s) : i === De ? this.parse_empty_namespace_selector(t) : null;
1369
+ case ls:
1370
+ return this.parse_attribute_selector(t);
1371
+ case zi:
1372
+ return this.parse_pseudo(t);
1373
+ case it:
1374
+ return this.parse_pseudo_function(t, s);
1375
+ case ns:
1376
+ case qe:
1377
+ return null;
1378
+ default:
1379
+ return null;
1380
+ }
1381
+ }
1382
+ // Parse the local part after | in a namespace selector (E or *)
1383
+ // Returns the node type (TYPE or UNIVERSAL) or null if invalid
1384
+ parse_namespace_local_part(e, t, s) {
1385
+ const i = this.lexer.save_position();
1386
+ this.lexer.next_token_fast(!1);
1387
+ let n;
1388
+ if (this.lexer.token_type === le)
1389
+ n = hs;
1390
+ else if (this.lexer.token_type === de && this.source.charCodeAt(this.lexer.token_start) === W)
1391
+ n = cs;
1392
+ else
1393
+ return this.lexer.restore_position(i), null;
1394
+ let l = this.create_node(n, e, this.lexer.token_end);
1395
+ return this.arena.set_content_start_delta(l, t - e), this.arena.set_content_length(l, s), l;
1396
+ }
1397
+ // Parse type selector or namespace selector (ns|E or ns|*)
1398
+ // Called when we've seen an IDENT token
1399
+ parse_type_or_namespace_selector(e, t) {
1400
+ const s = this.lexer.save_position();
1401
+ if (this.skip_whitespace(), this.lexer.pos < this.selector_end && this.source.charCodeAt(this.lexer.pos) === De) {
1402
+ this.lexer.pos++;
1403
+ let i = this.parse_namespace_local_part(e, e, t - e);
1404
+ if (i !== null) return i;
1405
+ this.lexer.pos = t;
1406
+ } else
1407
+ this.lexer.restore_position(s);
1408
+ return this.create_node(hs, e, t);
1409
+ }
1410
+ // Parse universal selector or namespace selector (*|E or *|*)
1411
+ // Called when we've seen a * DELIM token
1412
+ parse_universal_or_namespace_selector(e, t) {
1413
+ const s = this.lexer.save_position();
1414
+ if (this.skip_whitespace(), this.lexer.pos < this.selector_end && this.source.charCodeAt(this.lexer.pos) === De) {
1415
+ this.lexer.pos++;
1416
+ let i = this.parse_namespace_local_part(e, e, t - e);
1417
+ if (i !== null) return i;
1418
+ this.lexer.pos = t;
1419
+ } else
1420
+ this.lexer.restore_position(s);
1421
+ return this.create_node(cs, e, t);
1422
+ }
1423
+ // Parse empty namespace selector (|E or |*)
1424
+ // Called when we've seen a | DELIM token at the start
1425
+ parse_empty_namespace_selector(e) {
1426
+ return this.parse_namespace_local_part(e, e, 1);
1427
+ }
1428
+ // Parse combinator (>, +, ~, or descendant space)
1429
+ try_parse_combinator() {
1430
+ let e = this.lexer.pos, t = this.lexer.line, s = this.lexer.column, i = this.lexer.pos < this.selector_end;
1431
+ if (this.skip_whitespace(), i = i && this.lexer.pos > e, this.lexer.pos >= this.selector_end)
1432
+ return this.lexer.pos = e, this.lexer.line = t, this.lexer.column = s, null;
1433
+ if (this.lexer.next_token_fast(!1), this.lexer.token_type === de) {
1434
+ let n = this.source.charCodeAt(this.lexer.token_start);
1435
+ if (Dn(n))
1436
+ return this.create_node_at(at, this.lexer.token_start, this.lexer.token_end, this.lexer.token_line, this.lexer.token_column);
1437
+ }
1438
+ return i ? (this.lexer.pos = e, this.lexer.line = t, this.lexer.column = s, this.skip_whitespace(), this.create_node_at(at, e, this.lexer.pos, t, s)) : (this.lexer.pos = e, this.lexer.line = t, this.lexer.column = s, null);
1439
+ }
1440
+ // Parse class selector (.classname)
1441
+ parse_class_selector(e) {
1442
+ const t = this.lexer.save_position();
1443
+ return this.lexer.next_token_fast(!1), this.lexer.token_type !== le ? (this.lexer.restore_position(t), null) : this.create_node(Zi, e, this.lexer.token_end);
1444
+ }
1445
+ // Parse attribute selector ([attr], [attr=value], etc.)
1446
+ parse_attribute_selector(e) {
1447
+ let t = 1, s = this.lexer.token_end, i = e + 1, n = i;
1448
+ for (; this.lexer.pos < this.selector_end && t > 0; ) {
1449
+ this.lexer.next_token_fast(!1);
1450
+ let o = this.lexer.token_type;
1451
+ if (o === ls)
1452
+ t++;
1453
+ else if (o === Ki && (t--, t === 0)) {
1454
+ n = this.lexer.token_start, s = this.lexer.token_end;
1455
+ break;
1456
+ }
1457
+ }
1458
+ let l = this.create_node(Ke, e, s);
1459
+ return this.parse_attribute_content(l, i, n), l;
1460
+ }
1461
+ // Parse attribute content to extract name, operator, and value
1462
+ parse_attribute_content(e, t, s) {
1463
+ if (t = ye(this.source, t, s), s = zn(this.source, s, t), t >= s) return;
1464
+ let i = t, n = t, l = -1, o = -1, h = -1;
1465
+ for (; n < s; ) {
1466
+ let k = this.source.charCodeAt(n);
1467
+ if (te(k) || k === fe || k === ht || k === De || k === Ri || k === bi || k === W)
1468
+ break;
1469
+ n++;
1470
+ }
1471
+ n > i && (this.arena.set_content_start_delta(e, i - this.arena.get_start_offset(e)), this.arena.set_content_length(e, n - i));
1472
+ let c = ye(this.source, n, s);
1473
+ if (c >= s) {
1474
+ this.arena.set_attr_operator(e, Ci), this.arena.set_attr_flags(e, Pe);
1475
+ return;
1476
+ }
1477
+ let _ = this.source.charCodeAt(c), f = c + 1 < s ? this.source.charCodeAt(c + 1) : 0;
1478
+ if (_ === fe)
1479
+ l = c + 1, this.arena.set_attr_operator(e, wn);
1480
+ else if (_ === ht && f === fe)
1481
+ l = c + 2, this.arena.set_attr_operator(e, An);
1482
+ else if (_ === De && f === fe)
1483
+ l = c + 2, this.arena.set_attr_operator(e, yn);
1484
+ else if (_ === Ri && f === fe)
1485
+ l = c + 2, this.arena.set_attr_operator(e, En);
1486
+ else if (_ === bi && f === fe)
1487
+ l = c + 2, this.arena.set_attr_operator(e, Cn);
1488
+ else if (_ === W && f === fe)
1489
+ l = c + 2, this.arena.set_attr_operator(e, bn);
1490
+ else {
1491
+ this.arena.set_attr_operator(e, Ci), this.arena.set_attr_flags(e, Pe);
1492
+ return;
1493
+ }
1494
+ if (c = ye(this.source, l, s), c >= s) {
1495
+ this.arena.set_attr_flags(e, Pe);
1496
+ return;
1497
+ }
1498
+ o = c;
1499
+ let x = this.source.charCodeAt(c);
1500
+ if (x === Ln || x === Hn) {
1501
+ let k = x;
1502
+ for (o = c, c++; c < s; ) {
1503
+ let V = this.source.charCodeAt(c);
1504
+ if (V === k) {
1505
+ c++;
1506
+ break;
1507
+ }
1508
+ V === 92 ? c += 2 : c++;
1509
+ }
1510
+ h = c;
1511
+ } else {
1512
+ for (; c < s; ) {
1513
+ let k = this.source.charCodeAt(c);
1514
+ if (te(k))
1515
+ break;
1516
+ c++;
1517
+ }
1518
+ h = c;
1519
+ }
1520
+ if (h > o && (this.arena.set_value_start_delta(e, o - this.arena.get_start_offset(e)), this.arena.set_value_length(e, h - o)), c = ye(this.source, h, s), c < s) {
1521
+ let k = this.source.charCodeAt(c);
1522
+ k === 105 || k === 73 ? this.arena.set_attr_flags(e, Rn) : k === 115 || k === 83 ? this.arena.set_attr_flags(e, vn) : this.arena.set_attr_flags(e, Pe);
1523
+ } else
1524
+ this.arena.set_attr_flags(e, Pe);
1525
+ }
1526
+ // Parse pseudo-class or pseudo-element (:hover, ::before)
1527
+ parse_pseudo(e) {
1528
+ const t = this.lexer.save_position(), s = this.lexer.save_position();
1529
+ this.skip_whitespace();
1530
+ let i = !1;
1531
+ this.lexer.pos < this.selector_end && this.source.charCodeAt(this.lexer.pos) === Pn ? (i = !0, this.lexer.pos++) : this.lexer.restore_position(s), this.lexer.next_token_fast(!1);
1532
+ let n = this.lexer.token_type;
1533
+ if (n === le) {
1534
+ let l = this.create_node(i ? Ge : be, e, this.lexer.token_end);
1535
+ return this.arena.set_content_start_delta(l, this.lexer.token_start - e), this.arena.set_content_length(l, this.lexer.token_end - this.lexer.token_start), l;
1536
+ } else if (n === it)
1537
+ return this.parse_pseudo_function_after_colon(e, i);
1538
+ return this.lexer.restore_position(t), null;
1539
+ }
1540
+ // Parse pseudo-class function (:nth-child(), :is(), etc.)
1541
+ parse_pseudo_function(e, t) {
1542
+ return null;
1543
+ }
1544
+ // Parse pseudo-class function after we've seen the colon
1545
+ parse_pseudo_function_after_colon(e, t) {
1546
+ let s = this.lexer.token_start, i = this.lexer.token_end - 1, n = this.lexer.pos, l = n, o = 1, h = this.lexer.token_end;
1547
+ for (; this.lexer.pos < this.selector_end && o > 0; ) {
1548
+ this.lexer.next_token_fast(!1);
1549
+ let _ = this.lexer.token_type;
1550
+ if (_ === Bi || _ === it)
1551
+ o++;
1552
+ else if (_ === $i && (o--, o === 0)) {
1553
+ l = this.lexer.token_start, h = this.lexer.token_end;
1554
+ break;
1555
+ }
1556
+ }
1557
+ let c = this.create_node(t ? Ge : be, e, h);
1558
+ if (this.arena.set_content_start_delta(c, s - e), this.arena.set_content_length(c, i - s), this.arena.set_flag(c, ir), l > n) {
1559
+ let _ = this.source.substring(s, i);
1560
+ if (this.is_nth_pseudo(_)) {
1561
+ let f = this.parse_nth_expression(n, l);
1562
+ f !== null && this.arena.set_first_child(c, f);
1563
+ } else if (Y("lang", _))
1564
+ this.parse_lang_identifiers(n, l, c);
1565
+ else {
1566
+ let f = this.selector_end;
1567
+ const x = this.lexer.save_position();
1568
+ let k = Y("has", _), V = this.parse_selector(n, l, this.lexer.line, this.lexer.column, k);
1569
+ this.selector_end = f, this.lexer.restore_position(x), V !== null && this.arena.set_first_child(c, V);
1570
+ }
1571
+ }
1572
+ return c;
1573
+ }
1574
+ // Check if pseudo-class name is an nth-* pseudo
1575
+ is_nth_pseudo(e) {
1576
+ return Y("nth-child", e) || Y("nth-last-child", e) || Y("nth-of-type", e) || Y("nth-last-of-type", e) || Y("nth-col", e) || Y("nth-last-col", e);
1577
+ }
1578
+ // Parse :lang() content - comma-separated language identifiers
1579
+ // Accepts both quoted strings: :lang("en", "fr") and unquoted: :lang(en, fr)
1580
+ parse_lang_identifiers(e, t, s) {
1581
+ let i = this.selector_end;
1582
+ const n = this.lexer.save_position();
1583
+ this.lexer.pos = e, this.selector_end = t;
1584
+ let l = null, o = null;
1585
+ for (; this.lexer.pos < t; ) {
1586
+ this.lexer.next_token_fast(!1);
1587
+ let h = this.lexer.token_type, c = this.lexer.token_start, _ = this.lexer.token_end;
1588
+ if (h !== ns && h !== qe) {
1589
+ if (h === Mi || h === le) {
1590
+ let f = this.create_node(tr, c, _);
1591
+ l === null && (l = f), o !== null && this.arena.set_next_sibling(o, f), o = f;
1592
+ }
1593
+ if (this.lexer.pos >= t)
1594
+ break;
1595
+ }
1596
+ }
1597
+ l !== null && this.arena.set_first_child(s, l), this.selector_end = i, this.lexer.restore_position(n);
1598
+ }
1599
+ // Parse An+B expression for nth-* pseudo-classes
1600
+ // Handles both simple An+B and "An+B of S" syntax
1601
+ parse_nth_expression(e, t) {
1602
+ let s = this.find_of_keyword(e, t);
1603
+ if (s !== -1) {
1604
+ let n = new vi(this.arena, this.source).parse_anplusb(e, s, this.lexer.line), l = s + 2;
1605
+ l = qn(this.source, l, t);
1606
+ let o = this.selector_end;
1607
+ const h = this.lexer.save_position();
1608
+ this.selector_end = t, this.lexer.pos = l;
1609
+ let c = this.parse_selector_list();
1610
+ this.selector_end = o, this.lexer.restore_position(h);
1611
+ let _ = this.arena.create_node(re, e, t - e, this.lexer.line, 1);
1612
+ return n !== null && c !== null ? (this.arena.set_first_child(_, n), this.arena.set_next_sibling(n, c)) : n !== null && this.arena.set_first_child(_, n), _;
1613
+ } else
1614
+ return new vi(this.arena, this.source).parse_anplusb(e, t, this.lexer.line);
1615
+ }
1616
+ // Find the position of standalone "of" keyword (case-insensitive)
1617
+ find_of_keyword(e, t) {
1618
+ let s = e;
1619
+ for (; s < t - 1 && (s = ye(this.source, s, t), !(s >= t - 1)); ) {
1620
+ let i = this.source.charCodeAt(s), n = this.source.charCodeAt(s + 1);
1621
+ if ((i === 111 || i === 79) && (n === 102 || n === 70)) {
1622
+ let l = s === e || te(this.source.charCodeAt(s - 1)), o = s + 2 >= t || te(this.source.charCodeAt(s + 2));
1623
+ if (l && o)
1624
+ return s;
1625
+ }
1626
+ s++;
1627
+ }
1628
+ return -1;
1629
+ }
1630
+ create_node(e, t, s) {
1631
+ let i = this.arena.create_node(e, t, s - t, this.lexer.token_line, this.lexer.token_column);
1632
+ return this.arena.set_content_start_delta(i, 0), this.arena.set_content_length(i, s - t), i;
1633
+ }
1634
+ create_node_at(e, t, s, i, n) {
1635
+ let l = this.arena.create_node(e, t, s - t, i, n);
1636
+ return this.arena.set_content_start_delta(l, 0), this.arena.set_content_length(l, s - t), l;
1637
+ }
1638
+ // Helper to skip whitespace and comments, updating line/column
1639
+ skip_whitespace() {
1640
+ for (; this.lexer.pos < this.selector_end; ) {
1641
+ let e = this.source.charCodeAt(this.lexer.pos);
1642
+ if (te(e)) {
1643
+ this.lexer.advance();
1644
+ continue;
1645
+ }
1646
+ if (e === Se && this.lexer.pos + 1 < this.selector_end && this.source.charCodeAt(this.lexer.pos + 1) === W) {
1647
+ for (this.lexer.advance(2); this.lexer.pos < this.selector_end; ) {
1648
+ if (this.source.charCodeAt(this.lexer.pos) === W && this.lexer.pos + 1 < this.selector_end && this.source.charCodeAt(this.lexer.pos + 1) === Se) {
1649
+ this.lexer.advance(2);
1650
+ break;
1651
+ }
1652
+ this.lexer.advance();
1653
+ }
1654
+ continue;
1655
+ }
1656
+ break;
1657
+ }
1658
+ }
1659
+ }
1660
+ function $n(r) {
1661
+ const e = new ct(ct.capacity_for_source(r.length)), s = new Bn(e, r).parse_selector(0, r.length);
1662
+ if (s === null) {
1663
+ const i = e.create_node(dt, 0, 0, 1, 1);
1664
+ return new Ye(e, r, i);
1665
+ }
1666
+ return new Ye(e, r, s);
1667
+ }
1668
+ function Gn(r, e) {
1669
+ return r[0] === e[0] ? r[1] === e[1] ? r[2] - e[2] : r[1] - e[1] : r[0] - e[0];
1670
+ }
1671
+ function Ti(r) {
1672
+ return r.sort(Gn).at(-1);
184
1673
  }
185
- const Pi = new D([
1674
+ const _t = (r) => {
1675
+ var n, l, o;
1676
+ let e = 0, t = 0, s = 0, i = r.first_child;
1677
+ for (; i; ) {
1678
+ switch (i.type) {
1679
+ case fr:
1680
+ e += 1;
1681
+ break;
1682
+ case ps:
1683
+ case ur:
1684
+ t += 1;
1685
+ break;
1686
+ case Oe:
1687
+ switch (i.name.toLowerCase()) {
1688
+ // "The specificity of a :where() pseudo-class is replaced by zero."
1689
+ case "where":
1690
+ break;
1691
+ case "-webkit-any":
1692
+ case "any":
1693
+ i.first_child && (t += 1);
1694
+ break;
1695
+ // "The specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument."
1696
+ case "-moz-any":
1697
+ case "is":
1698
+ case "matches":
1699
+ case "not":
1700
+ case "has":
1701
+ if (i.has_children) {
1702
+ const f = i.first_child;
1703
+ if ((f == null ? void 0 : f.type) === ds) {
1704
+ const x = Ti(Oi(f));
1705
+ e += x[0], t += x[1], s += x[2];
1706
+ }
1707
+ }
1708
+ break;
1709
+ // "The specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument"
1710
+ case "nth-child":
1711
+ case "nth-last-child":
1712
+ t += 1;
1713
+ const c = i.first_child;
1714
+ if ((c == null ? void 0 : c.type) === _r && c.selector) {
1715
+ const f = Ti(Oi(c.selector));
1716
+ e += f[0], t += f[1], s += f[2];
1717
+ }
1718
+ break;
1719
+ // "The specificity of :host is that of a pseudo-class. The specificity of :host() is that of a pseudo-class, plus the specificity of its argument."
1720
+ // "The specificity of :host-context() is that of a pseudo-class, plus the specificity of its argument."
1721
+ case "host-context":
1722
+ case "host":
1723
+ t += 1;
1724
+ const _ = (n = i.first_child) == null ? void 0 : n.first_child;
1725
+ if ((_ == null ? void 0 : _.type) === ce) {
1726
+ let f = _.first_child;
1727
+ for (; f && f.type !== is; ) {
1728
+ const x = _t({
1729
+ first_child: f
1730
+ });
1731
+ e += x[0] ?? 0, t += x[1] ?? 0, s += x[2] ?? 0, f = f.next_sibling;
1732
+ }
1733
+ }
1734
+ break;
1735
+ // Improper use of Pseudo-Class Selectors instead of a Pseudo-Element
1736
+ // @ref https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements#index
1737
+ case "after":
1738
+ case "before":
1739
+ case "first-letter":
1740
+ case "first-line":
1741
+ s += 1;
1742
+ break;
1743
+ default:
1744
+ t += 1;
1745
+ break;
1746
+ }
1747
+ break;
1748
+ case us:
1749
+ switch (i.name.toLowerCase()) {
1750
+ // "The specificity of ::slotted() is that of a pseudo-element, plus the specificity of its argument."
1751
+ case "slotted":
1752
+ s += 1;
1753
+ const c = (l = i.first_child) == null ? void 0 : l.first_child;
1754
+ if ((c == null ? void 0 : c.type) === ce) {
1755
+ let _ = c.first_child;
1756
+ for (; _ && _.type !== is; ) {
1757
+ const f = _t({
1758
+ first_child: _
1759
+ });
1760
+ e += f[0] ?? 0, t += f[1] ?? 0, s += f[2] ?? 0, _ = _.next_sibling;
1761
+ }
1762
+ }
1763
+ break;
1764
+ case "view-transition-group":
1765
+ case "view-transition-image-pair":
1766
+ case "view-transition-old":
1767
+ case "view-transition-new":
1768
+ if (((o = i.first_child) == null ? void 0 : o.text) === "*")
1769
+ break;
1770
+ s += 1;
1771
+ break;
1772
+ default:
1773
+ s += 1;
1774
+ break;
1775
+ }
1776
+ break;
1777
+ case fs:
1778
+ let h = i.name ?? "";
1779
+ h.includes("|") && (h = h.split("|")[1] ?? ""), h !== "*" && (s += 1);
1780
+ break;
1781
+ }
1782
+ i = i.next_sibling;
1783
+ }
1784
+ return [e, t, s];
1785
+ }, Yn = (r) => {
1786
+ if (typeof r == "string")
1787
+ try {
1788
+ return $n(r);
1789
+ } catch (e) {
1790
+ const t = e instanceof Error ? e.message : String(e);
1791
+ throw new TypeError(`Could not convert passed in source '${r}' to SelectorList: ${t}`);
1792
+ }
1793
+ if (r instanceof Object) {
1794
+ if (r.type === ds)
1795
+ return r;
1796
+ throw new TypeError("Passed in source is an Object but no AST / AST of the type SelectorList");
1797
+ }
1798
+ throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.");
1799
+ }, Oi = (r) => {
1800
+ if (!r)
1801
+ return [];
1802
+ const e = Yn(r), t = [];
1803
+ let s = e.first_child;
1804
+ for (; s; )
1805
+ t.push(_t(s)), s = s.next_sibling;
1806
+ return t;
1807
+ }, Wn = new $([
186
1808
  // CSS Named Colors
187
1809
  // Spec: https://drafts.csswg.org/css-color/#named-colors
188
1810
  // Heuristic: popular names first for quick finding in set.has()
@@ -335,7 +1957,7 @@ const Pi = new D([
335
1957
  "mediumorchid",
336
1958
  "darksalmon",
337
1959
  "mediumspringgreen"
338
- ]), Ri = new D([
1960
+ ]), Qn = new $([
339
1961
  // CSS System Colors
340
1962
  // Spec: https://drafts.csswg.org/css-color/#css-system-colors
341
1963
  "accentcolor",
@@ -357,7 +1979,7 @@ const Pi = new D([
357
1979
  "selecteditem",
358
1980
  "selecteditemtext",
359
1981
  "visitedtext"
360
- ]), Oi = new D(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), Di = new D(["transparent", "currentcolor"]), pe = new D([
1982
+ ]), Vn = new $(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), jn = new $(["transparent", "currentcolor"]), ut = new $([
361
1983
  "auto",
362
1984
  "none",
363
1985
  // for `text-shadow`, `box-shadow` and `background`
@@ -367,22 +1989,13 @@ const Pi = new D([
367
1989
  "revert",
368
1990
  "revert-layer"
369
1991
  ]);
370
- function fe(i) {
371
- let e = i.children, t = e.size;
372
- if (!e || t > 1 || t === 0) return !1;
373
- let r = e.first;
374
- return r.type === V && pe.has(r.name);
375
- }
376
- function ei(i) {
377
- return parseFloat(i) === 0;
378
- }
379
- function Fi(i) {
380
- for (let e of i.children.toArray())
381
- if (!(e.type === ni && ei(e.value)) && !(e.type === Le && ei(e.value)))
1992
+ function Xn(r) {
1993
+ for (let e of r.children)
1994
+ if (!(e.type === _s && e.value === 0) && !(e.type === ft && e.value === 0))
382
1995
  return !1;
383
1996
  return !0;
384
1997
  }
385
- const Ei = new D(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), _i = new D([
1998
+ const ts = new $(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), Zn = new $([
386
1999
  /* <absolute-size> values */
387
2000
  "xx-small",
388
2001
  "x-small",
@@ -395,164 +2008,150 @@ const Ei = new D(["caption", "icon", "menu", "message-box", "small-caption", "st
395
2008
  /* <relative-size> values */
396
2009
  "smaller",
397
2010
  "larger"
398
- ]), Ii = 44, ti = 47;
399
- function Ze(i) {
400
- let e = i.children.first;
401
- return e === null ? !1 : e.type === V && Ei.has(e.name);
402
- }
403
- function Mi(i, e, t) {
404
- var w;
405
- let r = [void 0, void 0], n, c;
406
- if (i.children.first.type === "Function" && i.children.first.name.toLowerCase() === "var")
2011
+ ]), Jn = 44, Si = 47;
2012
+ function el(r, e) {
2013
+ let t = [void 0, void 0], s, i;
2014
+ if (r.first_child.type === gs && r.first_child.name.toLowerCase() === "var")
407
2015
  return null;
408
- i.children.forEach(function(b, x) {
409
- let O = x.prev ? x.prev.data : void 0, A = x.next ? x.next.data : void 0;
410
- if (b.type === V && pe.has(b.name) && t({
2016
+ let n;
2017
+ for (let o of r.children) {
2018
+ let h = o.next_sibling;
2019
+ if (o.type === he && ut.has(o.name) && e({
411
2020
  type: "keyword",
412
- value: b.name
413
- }), A && A.type === Z && A.value.charCodeAt(0) === ti) {
414
- n = e(b);
415
- return;
2021
+ value: o.name
2022
+ }), h && h.type === Ee && h.text.charCodeAt(0) === Si) {
2023
+ s = o.text, n = o;
2024
+ continue;
416
2025
  }
417
- if (O && O.type === Z && O.value.charCodeAt(0) === ti) {
418
- c = e(b);
419
- return;
2026
+ if ((n == null ? void 0 : n.type) === Ee && n.text.charCodeAt(0) === Si) {
2027
+ i = o.text, n = o;
2028
+ continue;
420
2029
  }
421
- if (A && A.type === Z && A.value.charCodeAt(0) === Ii && !r[0]) {
422
- r[0] = b, !n && O && (n = e(O));
423
- return;
2030
+ if ((h == null ? void 0 : h.type) === Ee && h.text.charCodeAt(0) === Jn && !t[0]) {
2031
+ t[0] = o, !s && n && (s = n.text), n = o;
2032
+ continue;
424
2033
  }
425
- if (b.type !== ni) {
426
- if (x.next === null) {
427
- r[1] = b, !n && !r[0] && O && (n = e(O));
428
- return;
429
- }
430
- if (b.type === V) {
431
- let F = b.name;
432
- if (_i.has(F)) {
433
- n = F;
434
- return;
435
- }
436
- }
2034
+ if (o.next_sibling === null) {
2035
+ t[1] = o, !s && !t[0] && n && (s = n.text), n = o;
2036
+ continue;
437
2037
  }
438
- });
439
- let g = r[0] || r[1] ? e({
440
- loc: {
441
- // @ts-expect-error TODO: fix this
442
- start: {
443
- // @ts-expect-error TODO: fix this
444
- offset: (r[0] || r[1]).loc.start.offset
445
- },
446
- // @ts-expect-error TODO: fix this
447
- end: {
448
- // Either the node we detected as the last node, or the end of the whole value
449
- // It's never 0 because the first node is always a font-size or font-style
450
- offset: ((w = r[1]) == null ? void 0 : w.loc.end.offset) || i.loc.end.offset
2038
+ if (o.type === _s) {
2039
+ n = o;
2040
+ continue;
2041
+ }
2042
+ if (o.type === he) {
2043
+ let c = o.name;
2044
+ if (Zn.has(c)) {
2045
+ s = c, n = o;
2046
+ continue;
451
2047
  }
452
2048
  }
453
- }) : null;
2049
+ n = o;
2050
+ }
2051
+ let l = t[0] || t[1] ? r.text.substring(
2052
+ ((t == null ? void 0 : t[0]) || (t == null ? void 0 : t[1]) || { start: r.start }).start - r.start,
2053
+ // Either the node we detected as the last node, or the end of the whole value
2054
+ // It's never 0 because the first node is always a font-size or font-style
2055
+ t[1] ? t[1].end - r.start : r.text.length
2056
+ ) : null;
454
2057
  return {
455
- font_size: n,
456
- line_height: c,
457
- font_family: g
2058
+ font_size: s,
2059
+ line_height: i,
2060
+ font_family: l
458
2061
  };
459
2062
  }
460
- const Ui = new D(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), Ti = new D(["cubic-bezier", "steps"]);
461
- function Vi(i, e) {
2063
+ const tl = new $(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), sl = new $(["cubic-bezier", "steps"]);
2064
+ function il(r, e) {
462
2065
  let t = !1;
463
- for (let r of i) {
464
- let n = r.type, c = r.name;
465
- n === Z ? t = !1 : n === Le && t === !1 ? (t = !0, e({
2066
+ for (let s of r) {
2067
+ let i = s.type, n = s.name;
2068
+ i === Ee ? t = !1 : i === ft && t === !1 ? (t = !0, e({
466
2069
  type: "duration",
467
- value: r
468
- })) : n === V ? Ui.has(c) ? e({
2070
+ value: s
2071
+ })) : i === he ? tl.has(n) ? e({
469
2072
  type: "fn",
470
- value: r
471
- }) : pe.has(c) && e({
2073
+ value: s
2074
+ }) : ut.has(n) && e({
472
2075
  type: "keyword",
473
- value: r
474
- }) : n === et && Ti.has(c) && e({
2076
+ value: s
2077
+ }) : i === gs && sl.has(n) && e({
475
2078
  type: "fn",
476
- value: r
2079
+ value: s
477
2080
  });
478
2081
  }
479
2082
  }
480
- function ci(i) {
481
- let e = i.children;
482
- if (!e)
483
- return !1;
484
- for (let t of e) {
485
- let { type: r, name: n } = t;
486
- if (r === V && N(n) || r === et && (N(n) || ci(t)))
487
- return !0;
488
- }
489
- return !1;
2083
+ function rl(r) {
2084
+ let e = !1;
2085
+ return B(r, function(t) {
2086
+ if (t.is_vendor_prefixed)
2087
+ return e = !0, Q;
2088
+ }), e;
490
2089
  }
491
- var H, M, U, $;
492
- class o {
2090
+ var oe, X, Z, Re;
2091
+ class p {
493
2092
  constructor(e = !1) {
494
- _(this, H);
495
- _(this, M);
496
- _(this, U, []);
497
- _(this, $);
498
- R(this, H, /* @__PURE__ */ new Map()), R(this, M, 0), e && R(this, U, []), R(this, $, e);
2093
+ G(this, oe);
2094
+ G(this, X);
2095
+ G(this, Z, []);
2096
+ G(this, Re);
2097
+ M(this, oe, /* @__PURE__ */ new Map()), M(this, X, 0), e && M(this, Z, []), M(this, Re, e);
499
2098
  }
500
2099
  p(e, t) {
501
- let r = h(this, M);
502
- if (h(this, $)) {
503
- let n = t.start, c = n.offset, g = r * 4;
504
- h(this, U)[g] = n.line, h(this, U)[g + 1] = n.column, h(this, U)[g + 2] = c, h(this, U)[g + 3] = t.end.offset - c;
2100
+ let s = w(this, X);
2101
+ if (w(this, Re)) {
2102
+ let i = s * 4;
2103
+ w(this, Z)[i] = t.line, w(this, Z)[i + 1] = t.column, w(this, Z)[i + 2] = t.offset, w(this, Z)[i + 3] = t.length;
505
2104
  }
506
- if (h(this, H).has(e)) {
507
- h(this, H).get(e).push(r), Ye(this, M)._++;
2105
+ if (w(this, oe).has(e)) {
2106
+ w(this, oe).get(e).push(s), Vt(this, X)._++;
508
2107
  return;
509
2108
  }
510
- h(this, H).set(e, [r]), Ye(this, M)._++;
2109
+ w(this, oe).set(e, [s]), Vt(this, X)._++;
511
2110
  }
512
2111
  size() {
513
- return h(this, M);
2112
+ return w(this, X);
514
2113
  }
515
2114
  c() {
516
- let e = /* @__PURE__ */ new Map(), t = {}, r = h(this, $), n = h(this, H), c = h(this, U), g = n.size;
517
- n.forEach((b, x) => {
518
- if (r) {
519
- let O = b.map(function(A) {
520
- let F = A * 4;
2115
+ let e = /* @__PURE__ */ new Map(), t = {}, s = w(this, Re), i = w(this, oe), n = w(this, Z), l = i.size;
2116
+ i.forEach((h, c) => {
2117
+ if (s) {
2118
+ let _ = h.map(function(f) {
2119
+ let x = f * 4;
521
2120
  return {
522
- line: c[F],
523
- column: c[F + 1],
524
- offset: c[F + 2],
525
- length: c[F + 3]
2121
+ line: n[x],
2122
+ column: n[x + 1],
2123
+ offset: n[x + 2],
2124
+ length: n[x + 3]
526
2125
  };
527
2126
  });
528
- e.set(x, O);
2127
+ e.set(c, _);
529
2128
  } else
530
- t[x] = b.length;
2129
+ t[c] = h.length;
531
2130
  });
532
- let w = h(this, M);
533
- return r ? {
534
- total: w,
535
- totalUnique: g,
2131
+ let o = w(this, X);
2132
+ return s ? {
2133
+ total: o,
2134
+ totalUnique: l,
536
2135
  unique: t,
537
- uniquenessRatio: w === 0 ? 0 : g / w,
2136
+ uniquenessRatio: o === 0 ? 0 : l / o,
538
2137
  uniqueWithLocations: Object.fromEntries(e)
539
2138
  } : {
540
- total: w,
541
- totalUnique: g,
2139
+ total: o,
2140
+ totalUnique: l,
542
2141
  unique: t,
543
- uniquenessRatio: w === 0 ? 0 : g / w,
2142
+ uniquenessRatio: o === 0 ? 0 : l / o,
544
2143
  uniqueWithLocations: void 0
545
2144
  };
546
2145
  }
547
2146
  }
548
- H = new WeakMap(), M = new WeakMap(), U = new WeakMap(), $ = new WeakMap();
549
- var J, K, le;
550
- class $e {
2147
+ oe = new WeakMap(), X = new WeakMap(), Z = new WeakMap(), Re = new WeakMap();
2148
+ var ve, ae, We;
2149
+ class ss {
551
2150
  constructor(e) {
552
- _(this, J);
553
- _(this, K);
554
- _(this, le);
555
- R(this, J, new o(e)), R(this, K, /* @__PURE__ */ new Map()), R(this, le, e);
2151
+ G(this, ve);
2152
+ G(this, ae);
2153
+ G(this, We);
2154
+ M(this, ve, new p(e)), M(this, ae, /* @__PURE__ */ new Map()), M(this, We, e);
556
2155
  }
557
2156
  /**
558
2157
  * Add an item to this #list's context
@@ -560,46 +2159,46 @@ class $e {
560
2159
  * @param context Context to push Item to
561
2160
  * @param node_location
562
2161
  */
563
- push(e, t, r) {
564
- h(this, J).p(e, r), h(this, K).has(t) || h(this, K).set(t, new o(h(this, le))), h(this, K).get(t).p(e, r);
2162
+ push(e, t, s) {
2163
+ w(this, ve).p(e, s), w(this, ae).has(t) || w(this, ae).set(t, new p(w(this, We))), w(this, ae).get(t).p(e, s);
565
2164
  }
566
2165
  count() {
567
2166
  let e = /* @__PURE__ */ new Map();
568
- for (let [t, r] of h(this, K).entries())
569
- e.set(t, r.c());
570
- return Object.assign(h(this, J).c(), {
2167
+ for (let [t, s] of w(this, ae).entries())
2168
+ e.set(t, s.c());
2169
+ return Object.assign(w(this, ve).c(), {
571
2170
  itemsPerContext: Object.fromEntries(e)
572
2171
  });
573
2172
  }
574
2173
  }
575
- J = new WeakMap(), K = new WeakMap(), le = new WeakMap();
576
- function Wi(i) {
577
- let e = /* @__PURE__ */ new Map(), t = -1, r = 0, n = 0, c = i.length;
578
- for (let g = 0; g < c; g++) {
579
- let w = i[g], b = (e.get(w) || 0) + 1;
580
- e.set(w, b), b > t && (t = b, r = 0, n = 0), b >= t && (r++, n += w);
581
- }
582
- return n / r;
2174
+ ve = new WeakMap(), ae = new WeakMap(), We = new WeakMap();
2175
+ function nl(r) {
2176
+ let e = /* @__PURE__ */ new Map(), t = -1, s = 0, i = 0, n = r.length;
2177
+ for (let l = 0; l < n; l++) {
2178
+ let o = r[l], h = (e.get(o) || 0) + 1;
2179
+ e.set(o, h), h > t && (t = h, s = 0, i = 0), h >= t && (s++, i += o);
2180
+ }
2181
+ return i / s;
583
2182
  }
584
- var T, X;
585
- class S {
2183
+ var J, Te;
2184
+ class L {
586
2185
  constructor() {
587
- _(this, T);
588
- _(this, X);
589
- R(this, T, []), R(this, X, 0);
2186
+ G(this, J);
2187
+ G(this, Te);
2188
+ M(this, J, []), M(this, Te, 0);
590
2189
  }
591
2190
  /**
592
2191
  * Add a new Integer at the end of this AggregateCollection
593
2192
  * @param item - The item to add
594
2193
  */
595
2194
  push(e) {
596
- h(this, T).push(e), R(this, X, h(this, X) + e);
2195
+ w(this, J).push(e), M(this, Te, w(this, Te) + e);
597
2196
  }
598
2197
  size() {
599
- return h(this, T).length;
2198
+ return w(this, J).length;
600
2199
  }
601
2200
  aggregate() {
602
- let e = h(this, T).length;
2201
+ let e = w(this, J).length;
603
2202
  if (e === 0)
604
2203
  return {
605
2204
  min: 0,
@@ -609,24 +2208,40 @@ class S {
609
2208
  range: 0,
610
2209
  sum: 0
611
2210
  };
612
- let t = h(this, T).slice().sort((w, b) => w - b), r = t[0], n = t[e - 1], c = Wi(t), g = h(this, X);
2211
+ let t = w(this, J).slice().sort((o, h) => o - h), s = t[0], i = t[e - 1], n = nl(t), l = w(this, Te);
613
2212
  return {
614
- min: r,
615
- max: n,
616
- mean: g / e,
617
- mode: c,
618
- range: n - r,
619
- sum: g
2213
+ min: s,
2214
+ max: i,
2215
+ mean: l / e,
2216
+ mode: n,
2217
+ range: i - s,
2218
+ sum: l
620
2219
  };
621
2220
  }
622
2221
  toArray() {
623
- return h(this, T);
2222
+ return w(this, J);
624
2223
  }
625
2224
  }
626
- T = new WeakMap(), X = new WeakMap();
627
- function Hi(i) {
628
- if (tt(i) || N(i)) return !1;
629
- let e = i.charCodeAt(0);
2225
+ J = new WeakMap(), Te = new WeakMap();
2226
+ function ll(r) {
2227
+ return r.replaceAll(/(?:^['"])|(?:['"]$)/g, "");
2228
+ }
2229
+ function ol(r, e) {
2230
+ return e >= 65 && e <= 90 && (e = e | 32), r === e;
2231
+ }
2232
+ function $e(r, e) {
2233
+ if (r === e) return !0;
2234
+ let t = e.length, s = t - r.length;
2235
+ if (s < 0)
2236
+ return !1;
2237
+ for (let i = t - 1; i >= s; i--)
2238
+ if (ol(r.charCodeAt(i - s), e.charCodeAt(i)) === !1)
2239
+ return !1;
2240
+ return !0;
2241
+ }
2242
+ function fl(r) {
2243
+ if (xs(r) || ms(r)) return !1;
2244
+ let e = r.charCodeAt(0);
630
2245
  return e === 47 || // /
631
2246
  e === 42 || // *
632
2247
  e === 95 || // _
@@ -635,28 +2250,28 @@ function Hi(i) {
635
2250
  e === 36 || // $
636
2251
  e === 35;
637
2252
  }
638
- function tt(i) {
639
- return i.length < 3 ? !1 : i.charCodeAt(0) === 45 && i.charCodeAt(1) === 45;
2253
+ function m(r, e) {
2254
+ return xs(e) ? !1 : $e(r, e);
640
2255
  }
641
- function m(i, e) {
642
- return tt(e) ? !1 : I(i, e);
2256
+ function al(r) {
2257
+ return ms(r) ? r.slice(r.indexOf("-", 2) + 1) : r;
643
2258
  }
644
- function Ki(i) {
645
- return N(i) ? i.slice(i.indexOf("-", 2) + 1) : i;
2259
+ function hl(r) {
2260
+ let e = 5, t = r.indexOf(";"), s = r.indexOf(",");
2261
+ return t === -1 || s !== -1 && s < t ? r.substring(e, s) : r.substring(e, t);
646
2262
  }
647
- function Ni(i) {
648
- let e = 5, t = i.indexOf(";"), r = i.indexOf(",");
649
- return t === -1 || r !== -1 && r < t ? i.substring(e, r) : i.substring(e, t);
650
- }
651
- function ji(i) {
652
- let e = i.children;
2263
+ function Ni(r) {
2264
+ let e = r.children;
653
2265
  if (e) {
654
- let t = e.last;
655
- return !!(t && t.type === V && I("\\9", t.name));
2266
+ let t = e.at(-1);
2267
+ return !!(t && t.type === he && $e("\\9", t.text));
656
2268
  }
657
2269
  return !1;
658
2270
  }
659
- let Bi = new D([
2271
+ function pl(r) {
2272
+ return ms(r);
2273
+ }
2274
+ let cl = new $([
660
2275
  "border-radius",
661
2276
  "border-top-left-radius",
662
2277
  "border-top-right-radius",
@@ -667,496 +2282,464 @@ let Bi = new D([
667
2282
  "border-end-end-radius",
668
2283
  "border-end-start-radius"
669
2284
  ]);
670
- function z(i, e) {
671
- return e === 0 ? 0 : i / e;
2285
+ function H(r, e) {
2286
+ return e === 0 ? 0 : r / e;
672
2287
  }
673
- function Ji(i, e = {}) {
674
- return e.useLocations === !0 ? ii(i, e, !0) : ii(i, e, !1);
2288
+ function dl(r, e = {}) {
2289
+ return e.useLocations === !0 ? Ui(r, e, !0) : Ui(r, e, !1);
675
2290
  }
676
- function ii(i, e, t) {
677
- let r = Date.now();
678
- function n(l) {
679
- return c(l).trim();
680
- }
681
- function c(l) {
682
- let re = l.loc;
683
- return i.substring(re.start.offset, re.end.offset);
684
- }
685
- let g = 0, w = 0, b = 0, x = {
2291
+ function Ui(r, e, t) {
2292
+ let s = Date.now(), i = (r.match(/\n/g) || []).length + 1, n = 0, l = 0, o = 0, h = {
686
2293
  total: 0,
687
2294
  unique: /* @__PURE__ */ new Map()
688
- }, O = Date.now(), A = mi(i, {
689
- parseCustomProperty: !0,
690
- // To find font-families, colors, etc.
691
- positions: !0,
692
- // So we can use stringifyNode()
693
- onComment: function(l) {
694
- g++, w += l.length;
695
- }
696
- }), F = Date.now(), fi = A.loc.end.line - A.loc.start.line + 1, it = new o(t), he = new S(), me = [], rt = new o(t), ge = new o(t), lt = new o(t), nt = new o(t), st = new o(t), at = new o(t), ot = new o(t), de = new o(t), ut = new o(t), ye = new o(t), we = new o(t), ct = new o(t), ne = new o(t), ft = new o(t), ke = new S(), pt = new o(t), be = 0, xe = 0, Ce = new S(), ve = new S(), Se = new S(), ht = new o(t), mt = new o(t), gt = new o(t), ze = new S(), dt = new o(t), qe = new o(t), yt = /* @__PURE__ */ new Set(), Ae = new o(t), j, B, wt = new S(), kt = new S(), bt = new S(), xt = new o(t), se = new S(), Ct = new o(t), vt = [], Pe = new o(t), Re = new o(t), St = new o(t), zt = new o(t), Oe = new S(), qt = new o(t), At = /* @__PURE__ */ new Set(), L = 0, Pt = new S(), ae = 0, De = 0, Fe = new o(t), Ee = new S(), Rt = new o(t), ee = new o(t), _e = new o(t), Ie = new o(t), oe = new o(t), te = new S(), Me = new S(), Ot = new o(t), Ue = new o(t), Dt = new o(t), Ft = new o(t), Et = new o(t), Te = new o(t), Ve = new o(t), We = new o(t), ue = new o(t), ce = new o(t), Y = new $e(t), G = new o(t), He = new $e(t), _t = new o(t), ie = new o(t), It = new $e(t), Mt = new o(t), E = 0;
697
- C(A, {
698
- enter(l) {
699
- var re, Yt, Gt;
700
- switch (l.type) {
701
- case Ge: {
702
- it.p(l.name, l.loc), ke.push(E), pt.p(E, l.loc);
703
- let s = l.name;
704
- if (s === "font-face") {
705
- let a = /* @__PURE__ */ Object.create(null);
706
- t && rt.p(l.loc.start.offset, l.loc), (re = l.block) == null || re.children.forEach((u) => {
707
- u.type === "Declaration" && (a[u.property] = n(u.value));
708
- }), me.push(a), he.push(1);
709
- break;
710
- }
711
- let d = 1;
712
- if (l.prelude !== null) {
713
- let a = l.prelude, u = a && n(l.prelude), p = a.loc;
714
- if (s === "media")
715
- nt.p(u, p), Si(a) && (st.p(u, p), d++);
716
- else if (s === "supports")
717
- de.p(u, p), vi(a) && (ut.p(u, p), d++);
718
- else if (I("keyframes", s)) {
719
- let y = "@" + s + " " + u;
720
- N(s) && (we.p(y, p), d++), ye.p(y, p);
721
- } else if (s === "import")
722
- C(l, (y) => {
723
- if (y.type === "Condition" && y.kind === "supports") {
724
- let f = n(y);
725
- return de.p(f, y.loc), C.break;
726
- }
727
- }), lt.p(u, p);
728
- else if (s === "charset")
729
- ot.p(u, p);
730
- else if (s === "container") {
731
- if (ct.p(u, p), a.type === "AtrulePrelude" && ((Yt = a.children.first) == null ? void 0 : Yt.type) === "Identifier") {
732
- let y = a.children.first.name;
733
- ne.p(y, p);
734
- }
735
- } else s === "property" && ft.p(u, p);
736
- } else
737
- s === "layer" && (ge.p("<anonymous>", l.loc), d++);
738
- he.push(d);
739
- break;
740
- }
741
- // @ts-expect-error Oudated css-tree types
742
- case "Layer": {
743
- l.name !== null && ge.p(l.name, l.loc);
744
- break;
745
- }
746
- // @ts-expect-error Oudated css-tree types
747
- case "Feature": {
748
- at.p(l.name, l.loc);
749
- break;
750
- }
751
- case Qe: {
752
- let s = l.prelude, d = l.block, a = s.children, u = d.children, p = a ? a.size : 0, y = u ? u.size : 0;
753
- Ce.push(p + y), ht.p(p + y, l.loc), ve.push(p), mt.p(p, s.loc), Se.push(y), gt.p(y, d.loc), ze.push(E), dt.p(E, l.loc), be++, y === 0 && xe++;
754
- break;
755
- }
756
- case yi: {
757
- let s = n(l);
758
- if (this.atrule && I("keyframes", this.atrule.name))
759
- return qe.p(s, l.loc), this.skip;
760
- oi(l) && Re.p(s, l.loc);
761
- let d = qi(l);
762
- if (d !== !1)
763
- for (let v of d)
764
- St.p(v, l.loc);
765
- let a = ui(l);
766
- zi(l) && Ae.p(s, l.loc), yt.add(s), se.push(a), Ct.p(a, l.loc), Oe.push(E - 1), qt.p(E - 1, l.loc);
767
- let u = gi(l).toArray(), [p, y, f] = u;
768
- return xt.p(u.toString(), l.loc), wt.push(p), kt.push(y), bt.push(f), j === void 0 && (j = u), B === void 0 && (B = u), B !== void 0 && ri(B, u) < 0 && (B = u), j !== void 0 && ri(j, u) > 0 && (j = u), vt.push(u), p > 0 && Pe.p(s, l.loc), Ai(l, function(P) {
769
- zt.p(P.name, P.loc);
770
- }), this.skip;
2295
+ }, c = Date.now(), _ = pr(r, {
2296
+ on_comment({ length: a }) {
2297
+ n++, l += a;
2298
+ }
2299
+ }), f = Date.now(), x = new p(t), k = new L(), V = [], ws = new p(t), Qe = new p(t), As = new p(t), ys = new p(t), Es = new p(t), Cs = new p(t), bs = new p(t), gt = new p(t), Rs = new p(t), xt = new p(t), mt = new p(t), vs = new p(t), Ve = new p(t), Ts = new p(t), kt = new L(), Os = new p(t), wt = 0, At = 0, yt = new L(), Et = new L(), Ct = new L(), Ss = new p(t), Ns = new p(t), Us = new p(t), bt = new L(), Ls = new p(t), Rt = new p(t), Hs = /* @__PURE__ */ new Set(), vt = new p(t), _e, ue, Is = new L(), Ps = new L(), Ds = new L(), Fs = new p(t), je = new L(), Ms = new p(t), qs = [], Tt = new p(t), Ot = new p(t), zs = new p(t), Ks = new p(t), St = new L(), Bs = new p(t), $s = /* @__PURE__ */ new Set(), Ne = 0, Gs = new L(), Xe = 0, Nt = 0, Ut = new p(t), Lt = new L(), Ys = new p(t), Ue = new p(t), Ht = new p(t), It = new p(t), Ze = new p(t), Le = new L(), Pt = new L(), Ws = new p(t), Dt = new p(t), Qs = new p(t), Vs = new p(t), js = new p(t), Ft = new p(t), Mt = new p(t), qt = new p(t), zt = new p(t), Kt = new p(t), xe = new ss(t), me = new p(t), Xs = new ss(t), Zs = new p(t), He = new p(t), Js = new ss(t), ei = new p(t);
2300
+ function A(a) {
2301
+ return {
2302
+ line: a.line,
2303
+ column: a.column,
2304
+ offset: a.start,
2305
+ length: a.length
2306
+ };
2307
+ }
2308
+ let ke = -1;
2309
+ B(_, (a, D) => {
2310
+ var ci, _i, ui, fi;
2311
+ ke >= 0 && D <= ke && (ke = -1);
2312
+ let Wt = ke >= 0 && D > ke;
2313
+ if (a.type === dr) {
2314
+ let N = A(a);
2315
+ if (kt.push(D), Os.p(D, N), x.p(a.name, N), P("font-face", a.name)) {
2316
+ let E = /* @__PURE__ */ Object.create(null);
2317
+ t && ws.p(a.start, A(a));
2318
+ let R = a.children.find((d) => d.type === gr);
2319
+ for (let d of (R == null ? void 0 : R.children) || [])
2320
+ d.type === jt && d.value && (E[d.property] = d.value.text);
2321
+ k.push(1), V.push(E);
2322
+ }
2323
+ if (a.prelude === null || a.prelude === void 0)
2324
+ P("layer", a.name) && (Qe.p("<anonymous>", A(a)), k.push(2));
2325
+ else {
2326
+ let { name: E } = a, R = 1;
2327
+ if (P("media", E))
2328
+ ys.p(a.prelude.text, A(a)), Cr(a.prelude) && (Es.p(a.prelude.text, A(a)), R++);
2329
+ else if (P("supports", E))
2330
+ gt.p(a.prelude.text, A(a)), Er(a.prelude) && (Rs.p(a.prelude.text, A(a)), R++);
2331
+ else if ($e("keyframes", E)) {
2332
+ let d = `@${E} ${a.prelude.text}`;
2333
+ xt.p(d, A(a)), a.is_vendor_prefixed && (mt.p(d, A(a)), R++), ke = D;
2334
+ } else if (P("layer", E))
2335
+ for (let d of a.prelude.text.split(",").map((u) => u.trim()))
2336
+ Qe.p(d, A(a));
2337
+ else if (P("import", E)) {
2338
+ if (As.p(a.prelude.text, A(a)), a.prelude.has_children)
2339
+ for (let d of a.prelude)
2340
+ d.type === Hi && typeof d.value == "string" ? gt.p(d.value, A(d)) : d.type === xr && typeof d.value == "string" && Qe.p(d.value, A(d));
2341
+ } else P("container", E) ? (vs.p(a.prelude.text, A(a)), ((ci = a.prelude.first_child) == null ? void 0 : ci.type) === mr && ((_i = a.prelude.first_child.first_child) == null ? void 0 : _i.type) === he && Ve.p(a.prelude.first_child.first_child.text, A(a))) : P("property", E) ? Ts.p(a.prelude.text, A(a)) : P("charset", E) && bs.p(a.prelude.text, A(a));
2342
+ k.push(R);
2343
+ }
2344
+ } else if (a.type === kr)
2345
+ if (Wt && a.prelude)
2346
+ a.prelude.type === ds && a.prelude.text && Rt.p(a.prelude.text, A(a.prelude));
2347
+ else {
2348
+ wt++, (ui = a.block) != null && ui.is_empty && At++;
2349
+ let N = 0, E = 0, R = A(a);
2350
+ if (a.prelude)
2351
+ for (const d of a.prelude.children)
2352
+ d.type === ce && N++;
2353
+ if (a.block)
2354
+ for (const d of a.block.children)
2355
+ d.type === jt && E++;
2356
+ yt.push(N + E), Ss.p(N + E, R), Et.push(N), Ns.p(N, R), Ct.push(E), Us.p(E, R), bt.push(D), Ls.p(D, R);
2357
+ }
2358
+ else if (a.type === ce) {
2359
+ if (Wt)
2360
+ return I;
2361
+ let N = A(a);
2362
+ St.push(D > 0 ? D - 1 : 0), Bs.p(D > 0 ? D - 1 : 0, N), Hs.add(a.text);
2363
+ let E = rs(a);
2364
+ je.push(E), Ms.p(E, N), br(a) && vt.p(a.text, N), Di(a) && Ot.p(a.text, N);
2365
+ let R = Rr(a);
2366
+ if (R !== !1)
2367
+ for (let se of R)
2368
+ zs.p(se, N);
2369
+ vr(a, function(T) {
2370
+ let U = T.name.trim() === "" ? " " : T.name;
2371
+ Ks.p(U, T.loc);
2372
+ });
2373
+ let d = _t(a), [u, z, Qt] = d;
2374
+ return Fs.p(d.toString(), N), Is.push(u), Ps.push(z), Ds.push(Qt), _e === void 0 && (_e = d), ue === void 0 && (ue = d), ue !== void 0 && Li(ue, d) < 0 && (ue = d), _e !== void 0 && Li(_e, d) > 0 && (_e = d), qs.push(d), u > 0 && Tt.p(a.text, N), I;
2375
+ } else if (a.type === jt) {
2376
+ Ne++, $s.add(a.text);
2377
+ let N = A(a), E = D > 0 ? D - 1 : 0;
2378
+ Lt.push(E), Ys.p(E, N);
2379
+ let R = 1;
2380
+ if (a.is_important) {
2381
+ R++;
2382
+ let T = a.text;
2383
+ if (!T.toLowerCase().includes("!important")) {
2384
+ let U = a.value.text, v = T.indexOf(U), Ae = T.slice(-1) === ";";
2385
+ Dt.p(`${T.slice(v, Ae ? -1 : void 0)}`, A(a.value));
771
2386
  }
772
- case Le: {
773
- if (!this.declaration)
774
- break;
775
- let s = l.unit;
776
- return I("\\9", s) ? He.push(s.substring(0, s.length - 2), this.declaration.property, l.loc) : He.push(s, this.declaration.property, l.loc), this.skip;
2387
+ Wt && (Nt++, R++);
2388
+ }
2389
+ Gs.push(R);
2390
+ let { is_important: d, property: u, is_browserhack: z, is_vendor_prefixed: Qt } = a, se = A(a);
2391
+ Ue.p(u, se), d && Xe++, Qt ? (Le.push(2), It.p(u, se)) : xs(u) ? (Ze.p(u, se), Le.push(d ? 3 : 2), d && Ut.p(u, se)) : z ? (Ht.p(u, se), Le.push(2)) : Le.push(1);
2392
+ {
2393
+ let T = a.value, { text: U } = T, v = A(T), Ae = 1;
2394
+ if (ut.has(U)) {
2395
+ He.p(U, v), Pt.push(Ae);
2396
+ return;
777
2397
  }
778
- case Ci: {
779
- if (Xe("data:", l.value)) {
780
- let s = l.value, d = s.length, a = Ni(s);
781
- x.total++, b += d;
782
- let u = {
783
- line: l.loc.start.line,
784
- column: l.loc.start.column,
785
- offset: l.loc.start.offset,
786
- length: l.loc.end.offset - l.loc.start.offset
787
- };
788
- if (x.unique.has(a)) {
789
- let p = x.unique.get(a);
790
- p.count++, p.size += d, x.unique.set(a, p), t && p.uniqueWithLocations && p.uniqueWithLocations.push(u);
791
- } else {
792
- let p = {
793
- count: 1,
794
- size: d,
795
- uniqueWithLocations: t ? [u] : void 0
796
- };
797
- x.unique.set(a, p);
2398
+ if (rl(T) && (Ws.p(T.text, v), Ae++), Ni(T) && (Dt.p(U, v), U = U.slice(0, -2), Ae++), Pt.push(Ae), m("margin", u) || m("margin-block", u) || m("margin-inline", u) || m("margin-top", u) || m("margin-right", u) || m("margin-bottom", u) || m("margin-left", u) || m("padding", u) || m("padding-block", u) || m("padding-inline", u) || m("padding-top", u) || m("padding-right", u) || m("padding-bottom", u) || m("padding-left", u))
2399
+ Xn(T) && ei.p(u, v);
2400
+ else {
2401
+ if (m("z-index", u))
2402
+ return Qs.p(U, v), I;
2403
+ if (m("font", u)) {
2404
+ if (!ts.has(U)) {
2405
+ let C = el(T, function(Ie) {
2406
+ Ie.type === "keyword" && He.p(Ie.value, v);
2407
+ });
2408
+ if (!C)
2409
+ return I;
2410
+ let { font_size: O, line_height: S, font_family: j } = C;
2411
+ j && Ft.p(j, v), O && Mt.p(O, v), S && qt.p(S, v);
798
2412
  }
799
- }
800
- break;
801
- }
802
- case wi: {
803
- let s = l.loc;
804
- if (fe(l)) {
805
- Me.push(1), ie.p(n(l), s);
806
- break;
807
- }
808
- let d = this.declaration, { property: a, important: u } = d, p = 1;
809
- ci(l) && (Ot.p(n(l), s), p++), typeof u == "string" && (Ue.p(c(l) + "!" + u, s), p++), ji(l) && (Ue.p(n(l), s), p++);
810
- let y = l.children;
811
- if (Me.push(p), m("margin", a) || m("margin-block", a) || m("margin-inline", a) || m("margin-top", a) || m("margin-right", a) || m("margin-bottom", a) || m("margin-left", a) || m("padding", a) || m("padding-block", a) || m("padding-inline", a) || m("padding-top", a) || m("padding-right", a) || m("padding-bottom", a) || m("padding-left", a))
812
- Fi(l) && Mt.p(a, d.loc);
2413
+ } else if (m("font-size", u))
2414
+ ts.has(U) || Mt.p(U, v);
813
2415
  else {
814
- if (m("z-index", a))
815
- return Dt.p(n(l), s), this.skip;
816
- if (m("font", a)) {
817
- if (Ze(l)) return;
818
- let f = Mi(l, n, function(Qt) {
819
- Qt.type === "keyword" && ie.p(Qt.value, s);
820
- });
821
- if (!f)
822
- return this.skip;
823
- let { font_size: v, line_height: P, font_family: W } = f;
824
- W && Te.p(W, s), v && Ve.p(v, s), P && We.p(P, s);
825
- break;
826
- } else if (m("font-size", a)) {
827
- Ze(l) || Ve.p(n(l), s);
828
- break;
829
- } else if (m("font-family", a)) {
830
- Ze(l) || Te.p(n(l), s);
831
- break;
832
- } else if (m("line-height", a))
833
- We.p(n(l), s);
834
- else if (m("transition", a) || m("animation", a)) {
835
- Vi(y, function(f) {
836
- f.type === "fn" ? ue.p(n(f.value), s) : f.type === "duration" ? ce.p(n(f.value), s) : f.type === "keyword" && ie.p(n(f.value), s);
837
- });
838
- break;
839
- } else if (m("animation-duration", a) || m("transition-duration", a)) {
840
- y && y.size > 1 ? y.forEach((f) => {
841
- f.type !== Z && ce.p(n(f), s);
842
- }) : ce.p(n(l), s);
843
- break;
844
- } else if (m("transition-timing-function", a) || m("animation-timing-function", a)) {
845
- y && y.size > 1 ? y.forEach((f) => {
846
- f.type !== Z && ue.p(n(f), s);
847
- }) : ue.p(n(l), s);
848
- break;
849
- } else if (m("container-name", a))
850
- ne.p(n(l), s);
851
- else if (m("container", a))
852
- ((Gt = y.first) == null ? void 0 : Gt.type) === "Identifier" && ne.p(y.first.name, s);
853
- else if (Bi.has(Ki(a))) {
854
- fe(l) || It.push(n(l), a, s);
855
- break;
856
- } else m("text-shadow", a) ? fe(l) || Ft.p(n(l), s) : m("box-shadow", a) && (fe(l) || Et.p(n(l), s));
2416
+ if (m("font-family", u))
2417
+ return ts.has(U) || Ft.p(U, v), I;
2418
+ if (m("line-height", u))
2419
+ qt.p(U, v);
2420
+ else {
2421
+ if (m("transition", u) || m("animation", u))
2422
+ return il(T.children, function(C) {
2423
+ C.type === "fn" ? zt.p(C.value.text, v) : C.type === "duration" ? Kt.p(C.value.text, v) : C.type === "keyword" && He.p(C.value.text, v);
2424
+ }), I;
2425
+ if (m("animation-duration", u) || m("transition-duration", u))
2426
+ for (let C of T.children)
2427
+ C.type !== Ee && Kt.p(C.text, v);
2428
+ else if (m("transition-timing-function", u) || m("animation-timing-function", u))
2429
+ for (let C of T.children)
2430
+ C.type !== Ee && zt.p(C.text, v);
2431
+ else m("container-name", u) ? Ve.p(U, v) : m("container", u) ? ((fi = T.first_child) == null ? void 0 : fi.type) === he && Ve.p(T.first_child.text, v) : cl.has(al(u)) ? Js.push(U, u, v) : m("text-shadow", u) ? Vs.p(U, v) : m("box-shadow", u) && js.p(U, v);
2432
+ }
857
2433
  }
858
- C(l, function(f) {
859
- let v = f.name;
860
- switch (f.type) {
861
- case xi: {
862
- let P = f.value.length;
863
- return I("\\9", f.value) && (P = P - 2), Y.push("#" + f.value, a, s), G.p("hex" + P, s), C.skip;
2434
+ }
2435
+ let lr = Ni(T);
2436
+ B(T, (C) => {
2437
+ switch (C.type) {
2438
+ case ft: {
2439
+ let O = C.unit, S = A(C);
2440
+ return Xs.push(O, u, S), I;
2441
+ }
2442
+ case wr: {
2443
+ let O = C.text;
2444
+ if (!O || !O.startsWith("#"))
2445
+ return I;
2446
+ let S = O;
2447
+ lr && !S.endsWith("\\9") && (S = S + "\\9");
2448
+ let j = S.length - 1;
2449
+ $e("\\9", S) && (j = j - 2);
2450
+ let Ie = A(C);
2451
+ return xe.push(S, u, Ie), me.p("hex" + j, Ie), I;
2452
+ }
2453
+ case he: {
2454
+ let O = C.text, S = A(C);
2455
+ if (m("font", u) || m("font-family", u))
2456
+ return I;
2457
+ ut.has(O) && He.p(O, S);
2458
+ let j = O.length;
2459
+ if (j > 20 || j < 3)
2460
+ return I;
2461
+ if (jn.has(O)) {
2462
+ xe.push(O, u, S), me.p(O.toLowerCase(), S);
2463
+ return;
864
2464
  }
865
- case V: {
866
- pe.has(v) && ie.p(v, s);
867
- let P = v.length;
868
- if (P > 20 || P < 3)
869
- return C.skip;
870
- if (Di.has(v)) {
871
- let W = n(f);
872
- Y.push(W, a, s), G.p(v.toLowerCase(), s);
873
- return;
874
- }
875
- if (Pi.has(v)) {
876
- let W = n(f);
877
- Y.push(W, a, s), G.p("named", s);
878
- return;
879
- }
880
- if (Ri.has(v)) {
881
- let W = n(f);
882
- Y.push(W, a, s), G.p("system", s);
883
- return;
884
- }
885
- return C.skip;
2465
+ if (Wn.has(O)) {
2466
+ xe.push(O, u, S), me.p("named", S);
2467
+ return;
886
2468
  }
887
- case et: {
888
- if (q("var", v))
889
- return C.skip;
890
- if (Oi.has(v)) {
891
- Y.push(n(f), a, f.loc), G.p(v.toLowerCase(), f.loc);
892
- return;
893
- }
894
- if (I("gradient", v)) {
895
- _t.p(n(f), f.loc);
896
- return;
897
- }
2469
+ if (Qn.has(O)) {
2470
+ xe.push(O, u, S), me.p("system", S);
2471
+ return;
898
2472
  }
2473
+ return I;
899
2474
  }
900
- });
901
- break;
902
- }
903
- case "Declaration": {
904
- if (this.atrulePrelude !== null)
905
- return this.skip;
906
- L++;
907
- let s = 1;
908
- At.add(n(l)), Ee.push(E - 1), Rt.p(E - 1, l.loc), l.important === !0 && (ae++, s++, this.atrule && I("keyframes", this.atrule.name) && (De++, s++)), Pt.push(s);
909
- let {
910
- property: d,
911
- // @ts-expect-error TODO: fix this
912
- loc: { start: a }
913
- } = l, u = {
914
- start: {
915
- line: a.line,
916
- column: a.column,
917
- offset: a.offset
918
- },
919
- end: {
920
- offset: a.offset + d.length
2475
+ case gs: {
2476
+ let O = C.name, S = A(C);
2477
+ if (Vn.has(O)) {
2478
+ xe.push(C.text, u, S), me.p(O.toLowerCase(), S);
2479
+ return;
2480
+ }
2481
+ if ($e("gradient", O)) {
2482
+ Zs.p(C.text, S);
2483
+ return;
2484
+ }
921
2485
  }
2486
+ }
2487
+ });
2488
+ }
2489
+ } else if (a.type === Ar) {
2490
+ let { value: N } = a, E = ll(N || "");
2491
+ if (yr(E, "data:")) {
2492
+ let R = E.length, d = hl(E);
2493
+ h.total++, o += R;
2494
+ let u = {
2495
+ line: a.line,
2496
+ column: a.column,
2497
+ offset: a.start,
2498
+ length: a.length
2499
+ };
2500
+ if (h.unique.has(d)) {
2501
+ let z = h.unique.get(d);
2502
+ z.count++, z.size += R, h.unique.set(d, z), t && z.uniqueWithLocations && z.uniqueWithLocations.push(u);
2503
+ } else {
2504
+ let z = {
2505
+ count: 1,
2506
+ size: R,
2507
+ uniqueWithLocations: t ? [u] : void 0
922
2508
  };
923
- ee.p(d, u), N(d) ? (Ie.p(d, u), te.push(2)) : Hi(d) ? (_e.p(d, u), te.push(2)) : tt(d) ? (oe.p(d, u), te.push(l.important ? 3 : 2), l.important === !0 && Fe.p(d, u)) : te.push(1);
924
- break;
2509
+ h.unique.set(d, z);
925
2510
  }
926
2511
  }
927
- (l.type === Qe || l.type === Ge) && E++;
928
- },
929
- leave(l) {
930
- (l.type === Qe || l.type === Ge) && E--;
931
- }
2512
+ } else if (a.type === Ii)
2513
+ return Cs.p(a.name, A(a)), I;
932
2514
  });
933
- let Ut = At.size, Q = se.size(), Ke = wt.aggregate(), Ne = kt.aggregate(), je = bt.aggregate(), Tt = yt.size, k = Object.assign, Vt = i.length, Be = me.length, Wt = he.aggregate(), Ht = se.aggregate(), Kt = Pt.aggregate(), Nt = te.aggregate(), jt = Me.aggregate(), Bt = it.c();
2515
+ let ti = $s.size, we = je.size(), Bt = Is.aggregate(), $t = Ps.aggregate(), Gt = Ds.aggregate(), si = Hs.size, b = Object.assign, ii = r.length, Yt = V.length, ri = k.aggregate(), ni = je.aggregate(), li = Gs.aggregate(), oi = Le.aggregate(), ai = Pt.aggregate(), hi = x.c();
934
2516
  return {
935
2517
  stylesheet: {
936
- sourceLinesOfCode: Bt.total + Q + L + qe.size(),
937
- linesOfCode: fi,
938
- size: Vt,
939
- complexity: Wt.sum + Ht.sum + Kt.sum + Nt.sum + jt.sum,
2518
+ sourceLinesOfCode: hi.total + we + Ne + Rt.size(),
2519
+ linesOfCode: i,
2520
+ size: ii,
2521
+ complexity: ri.sum + ni.sum + li.sum + oi.sum + ai.sum,
940
2522
  comments: {
941
- total: g,
942
- size: w
2523
+ total: n,
2524
+ size: l
943
2525
  },
944
2526
  embeddedContent: {
945
2527
  size: {
946
- total: b,
947
- ratio: z(b, Vt)
2528
+ total: o,
2529
+ ratio: H(o, ii)
948
2530
  },
949
2531
  types: {
950
- total: x.total,
951
- totalUnique: x.unique.size,
952
- uniquenessRatio: z(x.unique.size, x.total),
953
- unique: Object.fromEntries(x.unique)
2532
+ total: h.total,
2533
+ totalUnique: h.unique.size,
2534
+ uniquenessRatio: H(h.unique.size, h.total),
2535
+ unique: Object.fromEntries(h.unique)
954
2536
  }
955
2537
  }
956
2538
  },
957
- atrules: k(Bt, {
958
- fontface: k(
2539
+ atrules: b(hi, {
2540
+ fontface: b(
959
2541
  {
960
- total: Be,
961
- totalUnique: Be,
962
- unique: me,
963
- uniquenessRatio: Be === 0 ? 0 : 1
2542
+ total: Yt,
2543
+ totalUnique: Yt,
2544
+ unique: V,
2545
+ uniquenessRatio: Yt === 0 ? 0 : 1
964
2546
  },
965
2547
  t ? {
966
- uniqueWithLocations: rt.c().uniqueWithLocations
2548
+ uniqueWithLocations: ws.c().uniqueWithLocations
967
2549
  } : {}
968
2550
  ),
969
- import: lt.c(),
970
- media: k(nt.c(), {
971
- browserhacks: st.c(),
972
- features: at.c()
2551
+ import: As.c(),
2552
+ media: b(ys.c(), {
2553
+ browserhacks: Es.c(),
2554
+ features: Cs.c()
973
2555
  }),
974
- charset: ot.c(),
975
- supports: k(de.c(), {
976
- browserhacks: ut.c()
2556
+ charset: bs.c(),
2557
+ supports: b(gt.c(), {
2558
+ browserhacks: Rs.c()
977
2559
  }),
978
- keyframes: k(ye.c(), {
979
- prefixed: k(we.c(), {
980
- ratio: z(we.size(), ye.size())
2560
+ keyframes: b(xt.c(), {
2561
+ prefixed: b(mt.c(), {
2562
+ ratio: H(mt.size(), xt.size())
981
2563
  })
982
2564
  }),
983
- container: k(ct.c(), {
984
- names: ne.c()
2565
+ container: b(vs.c(), {
2566
+ names: Ve.c()
985
2567
  }),
986
- layer: ge.c(),
987
- property: ft.c(),
988
- complexity: Wt,
989
- nesting: k(
990
- ke.aggregate(),
2568
+ layer: Qe.c(),
2569
+ property: Ts.c(),
2570
+ complexity: ri,
2571
+ nesting: b(
2572
+ kt.aggregate(),
991
2573
  {
992
- items: ke.toArray()
2574
+ items: kt.toArray()
993
2575
  },
994
- pt.c()
2576
+ Os.c()
995
2577
  )
996
2578
  }),
997
2579
  rules: {
998
- total: be,
2580
+ total: wt,
999
2581
  empty: {
1000
- total: xe,
1001
- ratio: z(xe, be)
2582
+ total: At,
2583
+ ratio: H(At, wt)
1002
2584
  },
1003
- sizes: k(
1004
- Ce.aggregate(),
2585
+ sizes: b(
2586
+ yt.aggregate(),
1005
2587
  {
1006
- items: Ce.toArray()
2588
+ items: yt.toArray()
1007
2589
  },
1008
- ht.c()
2590
+ Ss.c()
1009
2591
  ),
1010
- nesting: k(
1011
- ze.aggregate(),
2592
+ nesting: b(
2593
+ bt.aggregate(),
1012
2594
  {
1013
- items: ze.toArray()
2595
+ items: bt.toArray()
1014
2596
  },
1015
- dt.c()
2597
+ Ls.c()
1016
2598
  ),
1017
- selectors: k(
1018
- ve.aggregate(),
2599
+ selectors: b(
2600
+ Et.aggregate(),
1019
2601
  {
1020
- items: ve.toArray()
2602
+ items: Et.toArray()
1021
2603
  },
1022
- mt.c()
2604
+ Ns.c()
1023
2605
  ),
1024
- declarations: k(
1025
- Se.aggregate(),
2606
+ declarations: b(
2607
+ Ct.aggregate(),
1026
2608
  {
1027
- items: Se.toArray()
2609
+ items: Ct.toArray()
1028
2610
  },
1029
- gt.c()
2611
+ Us.c()
1030
2612
  )
1031
2613
  },
1032
2614
  selectors: {
1033
- total: Q,
1034
- totalUnique: Tt,
1035
- uniquenessRatio: z(Tt, Q),
1036
- specificity: k(
2615
+ total: we,
2616
+ totalUnique: si,
2617
+ uniquenessRatio: H(si, we),
2618
+ specificity: b(
1037
2619
  {
1038
2620
  /** @type Specificity */
1039
- min: B === void 0 ? [0, 0, 0] : B,
2621
+ min: ue === void 0 ? [0, 0, 0] : ue,
1040
2622
  /** @type Specificity */
1041
- max: j === void 0 ? [0, 0, 0] : j,
2623
+ max: _e === void 0 ? [0, 0, 0] : _e,
1042
2624
  /** @type Specificity */
1043
- sum: [Ke.sum, Ne.sum, je.sum],
2625
+ sum: [Bt.sum, $t.sum, Gt.sum],
1044
2626
  /** @type Specificity */
1045
- mean: [Ke.mean, Ne.mean, je.mean],
2627
+ mean: [Bt.mean, $t.mean, Gt.mean],
1046
2628
  /** @type Specificity */
1047
- mode: [Ke.mode, Ne.mode, je.mode],
2629
+ mode: [Bt.mode, $t.mode, Gt.mode],
1048
2630
  /** @type Specificity */
1049
- items: vt
2631
+ items: qs
1050
2632
  },
1051
- xt.c()
2633
+ Fs.c()
1052
2634
  ),
1053
- complexity: k(Ht, Ct.c(), {
1054
- items: se.toArray()
2635
+ complexity: b(ni, Ms.c(), {
2636
+ items: je.toArray()
1055
2637
  }),
1056
- nesting: k(
1057
- Oe.aggregate(),
2638
+ nesting: b(
2639
+ St.aggregate(),
1058
2640
  {
1059
- items: Oe.toArray()
2641
+ items: St.toArray()
1060
2642
  },
1061
- qt.c()
2643
+ Bs.c()
1062
2644
  ),
1063
- id: k(Pe.c(), {
1064
- ratio: z(Pe.size(), Q)
2645
+ id: b(Tt.c(), {
2646
+ ratio: H(Tt.size(), we)
1065
2647
  }),
1066
- pseudoClasses: St.c(),
1067
- accessibility: k(Re.c(), {
1068
- ratio: z(Re.size(), Q)
2648
+ pseudoClasses: zs.c(),
2649
+ accessibility: b(Ot.c(), {
2650
+ ratio: H(Ot.size(), we)
1069
2651
  }),
1070
- keyframes: qe.c(),
1071
- prefixed: k(Ae.c(), {
1072
- ratio: z(Ae.size(), Q)
2652
+ keyframes: Rt.c(),
2653
+ prefixed: b(vt.c(), {
2654
+ ratio: H(vt.size(), we)
1073
2655
  }),
1074
- combinators: zt.c()
2656
+ combinators: Ks.c()
1075
2657
  },
1076
2658
  declarations: {
1077
- total: L,
1078
- totalUnique: Ut,
1079
- uniquenessRatio: z(Ut, L),
2659
+ total: Ne,
2660
+ totalUnique: ti,
2661
+ uniquenessRatio: H(ti, Ne),
1080
2662
  importants: {
1081
- total: ae,
1082
- ratio: z(ae, L),
2663
+ total: Xe,
2664
+ ratio: H(Xe, Ne),
1083
2665
  inKeyframes: {
1084
- total: De,
1085
- ratio: z(De, ae)
2666
+ total: Nt,
2667
+ ratio: H(Nt, Xe)
1086
2668
  }
1087
2669
  },
1088
- complexity: Kt,
1089
- nesting: k(
1090
- Ee.aggregate(),
2670
+ complexity: li,
2671
+ nesting: b(
2672
+ Lt.aggregate(),
1091
2673
  {
1092
- items: Ee.toArray()
2674
+ items: Lt.toArray()
1093
2675
  },
1094
- Rt.c()
2676
+ Ys.c()
1095
2677
  )
1096
2678
  },
1097
- properties: k(ee.c(), {
1098
- prefixed: k(Ie.c(), {
1099
- ratio: z(Ie.size(), ee.size())
2679
+ properties: b(Ue.c(), {
2680
+ prefixed: b(It.c(), {
2681
+ ratio: H(It.size(), Ue.size())
1100
2682
  }),
1101
- custom: k(oe.c(), {
1102
- ratio: z(oe.size(), ee.size()),
1103
- importants: k(Fe.c(), {
1104
- ratio: z(Fe.size(), oe.size())
2683
+ custom: b(Ze.c(), {
2684
+ ratio: H(Ze.size(), Ue.size()),
2685
+ importants: b(Ut.c(), {
2686
+ ratio: H(Ut.size(), Ze.size())
1105
2687
  })
1106
2688
  }),
1107
- browserhacks: k(_e.c(), {
1108
- ratio: z(_e.size(), ee.size())
2689
+ browserhacks: b(Ht.c(), {
2690
+ ratio: H(Ht.size(), Ue.size())
1109
2691
  }),
1110
- complexity: Nt
2692
+ complexity: oi
1111
2693
  }),
1112
2694
  values: {
1113
- colors: k(Y.count(), {
1114
- formats: G.c()
2695
+ colors: b(xe.count(), {
2696
+ formats: me.c()
1115
2697
  }),
1116
- gradients: _t.c(),
1117
- fontFamilies: Te.c(),
1118
- fontSizes: Ve.c(),
1119
- lineHeights: We.c(),
1120
- zindexes: Dt.c(),
1121
- textShadows: Ft.c(),
1122
- boxShadows: Et.c(),
1123
- borderRadiuses: It.count(),
2698
+ gradients: Zs.c(),
2699
+ fontFamilies: Ft.c(),
2700
+ fontSizes: Mt.c(),
2701
+ lineHeights: qt.c(),
2702
+ zindexes: Qs.c(),
2703
+ textShadows: Vs.c(),
2704
+ boxShadows: js.c(),
2705
+ borderRadiuses: Js.count(),
1124
2706
  animations: {
1125
- durations: ce.c(),
1126
- timingFunctions: ue.c()
2707
+ durations: Kt.c(),
2708
+ timingFunctions: zt.c()
1127
2709
  },
1128
- prefixes: Ot.c(),
1129
- browserhacks: Ue.c(),
1130
- units: He.count(),
1131
- complexity: jt,
1132
- keywords: ie.c(),
1133
- resets: Mt.c()
2710
+ prefixes: Ws.c(),
2711
+ browserhacks: Dt.c(),
2712
+ units: Xs.count(),
2713
+ complexity: ai,
2714
+ keywords: He.c(),
2715
+ resets: ei.c()
1134
2716
  },
1135
2717
  __meta__: {
1136
- parseTime: F - O,
1137
- analyzeTime: Date.now() - F,
1138
- total: Date.now() - r
2718
+ parseTime: f - c,
2719
+ analyzeTime: Date.now() - f,
2720
+ total: Date.now() - s
1139
2721
  }
1140
2722
  };
1141
2723
  }
1142
- function ri(i, e) {
1143
- return i[0] === e[0] ? i[1] === e[1] ? e[2] - i[2] : e[1] - i[1] : e[0] - i[0];
2724
+ function Li(r, e) {
2725
+ return r[0] === e[0] ? r[1] === e[1] ? e[2] - r[2] : e[1] - r[1] : e[0] - r[0];
1144
2726
  }
1145
2727
  export {
1146
- D as KeywordSet,
1147
- Ji as analyze,
1148
- Oi as colorFunctions,
1149
- Di as colorKeywords,
1150
- ri as compareSpecificity,
1151
- pe as cssKeywords,
1152
- N as hasVendorPrefix,
1153
- oi as isAccessibilitySelector,
1154
- Si as isMediaBrowserhack,
1155
- Hi as isPropertyHack,
1156
- zi as isSelectorPrefixed,
1157
- vi as isSupportsBrowserhack,
1158
- ci as isValuePrefixed,
1159
- Pi as namedColors,
1160
- ui as selectorComplexity,
1161
- Ri as systemColors
2728
+ $ as KeywordSet,
2729
+ dl as analyze,
2730
+ Oi as calculateSpecificity,
2731
+ Vn as colorFunctions,
2732
+ jn as colorKeywords,
2733
+ Li as compareSpecificity,
2734
+ ut as cssKeywords,
2735
+ pl as hasVendorPrefix,
2736
+ Di as isAccessibilitySelector,
2737
+ Cr as isMediaBrowserhack,
2738
+ fl as isPropertyHack,
2739
+ br as isSelectorPrefixed,
2740
+ Er as isSupportsBrowserhack,
2741
+ rl as isValuePrefixed,
2742
+ Wn as namedColors,
2743
+ rs as selectorComplexity,
2744
+ Qn as systemColors
1162
2745
  };