@projectwallace/css-analyzer 9.3.0 → 9.4.0

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