@projectwallace/css-analyzer 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css-analyzer.js +269 -267
- package/package.json +2 -2
package/dist/css-analyzer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ar = Object.defineProperty;
|
|
2
2
|
var pi = (r) => {
|
|
3
3
|
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var g = (r, e, t) =>
|
|
5
|
+
var hr = (r, e, t) => e in r ? ar(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
6
|
+
var g = (r, e, t) => hr(r, typeof e != "symbol" ? e + "" : e, t), di = (r, e, t) => e.has(r) || pi("Cannot " + t);
|
|
7
7
|
var w = (r, e, t) => (di(r, e, "read from private field"), t ? t.call(r) : e.get(r)), G = (r, e, t) => e.has(r) ? pi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), M = (r, e, t, s) => (di(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t);
|
|
8
8
|
var Vt = (r, e, t, s) => ({
|
|
9
9
|
set _(i) {
|
|
@@ -13,8 +13,8 @@ var Vt = (r, e, t, s) => ({
|
|
|
13
13
|
return w(r, e, s);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { walk as B, SUPPORTS_QUERY as Hi, BREAK as Q, MEDIA_TYPE as
|
|
17
|
-
function
|
|
16
|
+
import { walk as B, SUPPORTS_QUERY as Hi, BREAK as Q, MEDIA_TYPE as cr, MEDIA_FEATURE as Ii, str_equals as P, DIMENSION as ft, NUMBER as _s, IDENTIFIER as he, SELECTOR as ce, NTH_SELECTOR as _r, PSEUDO_ELEMENT_SELECTOR as us, TYPE_SELECTOR as fs, PSEUDO_CLASS_SELECTOR as Oe, ATTRIBUTE_SELECTOR as ps, SKIP as I, COMBINATOR as is, SELECTOR_LIST as ds, NTH_OF_SELECTOR as ur, CLASS_SELECTOR as fr, ID_SELECTOR as pr, FUNCTION as gs, OPERATOR as Ee, is_custom as xs, is_vendor_prefixed as ms, parse as dr, AT_RULE as gr, BLOCK as xr, DECLARATION as jt, LAYER_NAME as mr, CONTAINER_QUERY as kr, STYLE_RULE as wr, HASH as Ar, URL as yr, str_starts_with as Er } from "@projectwallace/css-parser";
|
|
17
|
+
function Cr(r) {
|
|
18
18
|
let e = !1;
|
|
19
19
|
return B(r, function(t) {
|
|
20
20
|
if (t.type === Hi) {
|
|
@@ -24,10 +24,10 @@ function Er(r) {
|
|
|
24
24
|
}
|
|
25
25
|
}), e;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function br(r) {
|
|
28
28
|
let e = !1;
|
|
29
29
|
return B(r, function(t) {
|
|
30
|
-
if (t.type ===
|
|
30
|
+
if (t.type === cr) {
|
|
31
31
|
const s = t.text || "";
|
|
32
32
|
if (s.startsWith("\\0") || s.includes("\\9"))
|
|
33
33
|
return e = !0, Q;
|
|
@@ -64,7 +64,7 @@ class $ {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
const Pi = new $(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
|
|
67
|
-
function
|
|
67
|
+
function Rr(r) {
|
|
68
68
|
let e = !1;
|
|
69
69
|
return B(r, function(t) {
|
|
70
70
|
if ((t.type === us || t.type === Oe || t.type === fs) && t.is_vendor_prefixed)
|
|
@@ -85,7 +85,7 @@ function Di(r) {
|
|
|
85
85
|
}
|
|
86
86
|
}), e;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function vr(r) {
|
|
89
89
|
let e = [];
|
|
90
90
|
return B(r, function(t) {
|
|
91
91
|
t.type === Oe && e.push(t.name);
|
|
@@ -101,7 +101,7 @@ function rs(r) {
|
|
|
101
101
|
return B(r, function(s) {
|
|
102
102
|
const i = s.type;
|
|
103
103
|
if (i !== ce) {
|
|
104
|
-
if (i ===
|
|
104
|
+
if (i === _r) {
|
|
105
105
|
s.text && s.text.trim() && e++;
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
@@ -124,7 +124,7 @@ function rs(r) {
|
|
|
124
124
|
}
|
|
125
125
|
}), e;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Tr(r, e) {
|
|
128
128
|
B(r, function(t) {
|
|
129
129
|
t.type === is && e({
|
|
130
130
|
name: t.name.trim() === "" ? " " : t.name,
|
|
@@ -155,13 +155,13 @@ y[9] = Ce;
|
|
|
155
155
|
y[10] = ge;
|
|
156
156
|
y[13] = ge;
|
|
157
157
|
y[12] = ge;
|
|
158
|
-
function
|
|
158
|
+
function Or(r) {
|
|
159
159
|
return r < 128 && (y[r] & q) !== 0;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function et(r) {
|
|
162
162
|
return r < 128 && (y[r] & pt) !== 0;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Sr(r) {
|
|
165
165
|
return r < 128 && (y[r] & ks) !== 0;
|
|
166
166
|
}
|
|
167
167
|
function gi(r) {
|
|
@@ -171,13 +171,13 @@ function ie(r) {
|
|
|
171
171
|
return r < 128 && (y[r] & ge) !== 0;
|
|
172
172
|
}
|
|
173
173
|
function Me(r) {
|
|
174
|
-
return r >= 128 || r === 95 ? !0 :
|
|
174
|
+
return r >= 128 || r === 95 ? !0 : Sr(r);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
return r === 45 ? !0 : Me(r) ||
|
|
176
|
+
function tt(r) {
|
|
177
|
+
return r === 45 ? !0 : Me(r) || Or(r);
|
|
178
178
|
}
|
|
179
|
-
const le = 1,
|
|
180
|
-
class
|
|
179
|
+
const le = 1, rt = 2, Nr = 3, Fi = 4, Mi = 5, xi = 6, de = 9, nt = 10, qi = 11, zi = 12, ns = 13, Ur = 14, Lr = 15, Ki = 16, Hr = 17, qe = 18, ls = 19, Bi = 20, $i = 21, Gi = 22, Ir = 23, Pr = 24, os = 26, Dr = 123, Fr = 125, Mr = 58, qr = 59, zr = 44, Kr = 91, Br = 93, mi = 40, $r = 41, ki = 47, wi = 42, Gr = 34, Yr = 39, Xt = 46, Wr = 60, Qr = 33, K = 45, Vr = 62, jr = 64, Xr = 35, Zt = 92, st = 43, Zr = 37, Jr = 101, en = 69, Ai = 13, yi = 10;
|
|
180
|
+
class Yi {
|
|
181
181
|
constructor(e, t) {
|
|
182
182
|
g(this, "source");
|
|
183
183
|
g(this, "pos");
|
|
@@ -209,7 +209,7 @@ class Gi {
|
|
|
209
209
|
case Fr:
|
|
210
210
|
return this.advance(), this.make_token(Pr, s, this.pos, i, n);
|
|
211
211
|
case Mr:
|
|
212
|
-
return this.advance(), this.make_token(
|
|
212
|
+
return this.advance(), this.make_token(Ki, s, this.pos, i, n);
|
|
213
213
|
case qr:
|
|
214
214
|
return this.advance(), this.make_token(Hr, s, this.pos, i, n);
|
|
215
215
|
case zr:
|
|
@@ -217,11 +217,11 @@ class Gi {
|
|
|
217
217
|
case Kr:
|
|
218
218
|
return this.advance(), this.make_token(ls, s, this.pos, i, n);
|
|
219
219
|
case Br:
|
|
220
|
-
return this.advance(), this.make_token(Ki, s, this.pos, i, n);
|
|
221
|
-
case mi:
|
|
222
220
|
return this.advance(), this.make_token(Bi, s, this.pos, i, n);
|
|
223
|
-
case
|
|
221
|
+
case mi:
|
|
224
222
|
return this.advance(), this.make_token($i, s, this.pos, i, n);
|
|
223
|
+
case $r:
|
|
224
|
+
return this.advance(), this.make_token(Gi, s, this.pos, i, n);
|
|
225
225
|
}
|
|
226
226
|
if (t < 128 && (y[t] & (Ce | ge)) !== 0)
|
|
227
227
|
return this.consume_whitespace(i, n);
|
|
@@ -272,7 +272,7 @@ class Gi {
|
|
|
272
272
|
if (l !== 0 && !ie(l))
|
|
273
273
|
return this.consume_ident_or_function(i, n);
|
|
274
274
|
}
|
|
275
|
-
if (t === K || t ===
|
|
275
|
+
if (t === K || t === st) {
|
|
276
276
|
let l = this.peek();
|
|
277
277
|
if (l < 128 && (y[l] & q) !== 0)
|
|
278
278
|
return this.consume_number(i, n);
|
|
@@ -304,7 +304,7 @@ class Gi {
|
|
|
304
304
|
if (n === Zt) {
|
|
305
305
|
if (this.advance(), this.pos < this.source.length) {
|
|
306
306
|
let l = this.source.charCodeAt(this.pos);
|
|
307
|
-
|
|
307
|
+
et(l) ? this.consume_hex_escape() : ie(l) ? this.advance() : this.advance();
|
|
308
308
|
}
|
|
309
309
|
continue;
|
|
310
310
|
}
|
|
@@ -316,7 +316,7 @@ class Gi {
|
|
|
316
316
|
let e = 0;
|
|
317
317
|
for (; e < 6 && this.pos < this.source.length; ) {
|
|
318
318
|
let t = this.source.charCodeAt(this.pos);
|
|
319
|
-
if (!
|
|
319
|
+
if (!et(t)) break;
|
|
320
320
|
this.advance(), e++;
|
|
321
321
|
}
|
|
322
322
|
if (this.pos < this.source.length) {
|
|
@@ -326,7 +326,7 @@ class Gi {
|
|
|
326
326
|
}
|
|
327
327
|
consume_number(e, t) {
|
|
328
328
|
let s = this.pos, i = this.source.charCodeAt(this.pos);
|
|
329
|
-
for ((i ===
|
|
329
|
+
for ((i === st || i === K) && this.advance(); this.pos < this.source.length; ) {
|
|
330
330
|
let n = this.source.charCodeAt(this.pos);
|
|
331
331
|
if (n >= 128 || (y[n] & q) === 0) break;
|
|
332
332
|
this.advance();
|
|
@@ -344,14 +344,14 @@ class Gi {
|
|
|
344
344
|
let n = this.source.charCodeAt(this.pos);
|
|
345
345
|
if (n === Jr || n === en) {
|
|
346
346
|
let l = this.peek(), o = l < 128 && (y[l] & q) !== 0, h = this.peek(2), c = h < 128 && (y[h] & q) !== 0;
|
|
347
|
-
if (o || (l ===
|
|
347
|
+
if (o || (l === st || l === K) && c) {
|
|
348
348
|
if (this.advance(), this.pos < this.source.length) {
|
|
349
|
-
let
|
|
350
|
-
(
|
|
349
|
+
let u = this.source.charCodeAt(this.pos);
|
|
350
|
+
(u === st || u === K) && this.advance();
|
|
351
351
|
}
|
|
352
352
|
for (; this.pos < this.source.length; ) {
|
|
353
|
-
let
|
|
354
|
-
if (
|
|
353
|
+
let u = this.source.charCodeAt(this.pos);
|
|
354
|
+
if (u >= 128 || (y[u] & q) === 0) break;
|
|
355
355
|
this.advance();
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -360,14 +360,14 @@ class Gi {
|
|
|
360
360
|
if (this.pos < this.source.length) {
|
|
361
361
|
let n = this.source.charCodeAt(this.pos);
|
|
362
362
|
if (n === Zr)
|
|
363
|
-
return this.advance(), this.make_token(
|
|
363
|
+
return this.advance(), this.make_token(qi, s, this.pos, e, t);
|
|
364
364
|
if (Me(n) || n === K && Me(this.peek())) {
|
|
365
|
-
for (; this.pos < this.source.length &&
|
|
365
|
+
for (; this.pos < this.source.length && tt(this.source.charCodeAt(this.pos)); )
|
|
366
366
|
this.advance();
|
|
367
|
-
return this.make_token(
|
|
367
|
+
return this.make_token(zi, s, this.pos, e, t);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
return this.make_token(
|
|
370
|
+
return this.make_token(nt, s, this.pos, e, t);
|
|
371
371
|
}
|
|
372
372
|
consume_ident_or_function(e, t) {
|
|
373
373
|
let s = this.pos;
|
|
@@ -377,9 +377,9 @@ class Gi {
|
|
|
377
377
|
if (this.pos + 1 >= this.source.length) break;
|
|
378
378
|
let n = this.peek();
|
|
379
379
|
if (ie(n)) break;
|
|
380
|
-
if (this.advance(),
|
|
380
|
+
if (this.advance(), et(n)) {
|
|
381
381
|
this.advance();
|
|
382
|
-
for (let l = 0; l < 5 && this.pos < this.source.length &&
|
|
382
|
+
for (let l = 0; l < 5 && this.pos < this.source.length && et(this.source.charCodeAt(this.pos)); l++)
|
|
383
383
|
this.advance();
|
|
384
384
|
if (this.pos < this.source.length) {
|
|
385
385
|
let l = this.source.charCodeAt(this.pos);
|
|
@@ -387,22 +387,22 @@ class Gi {
|
|
|
387
387
|
}
|
|
388
388
|
} else
|
|
389
389
|
this.advance();
|
|
390
|
-
} else if (
|
|
390
|
+
} else if (tt(i))
|
|
391
391
|
this.advance();
|
|
392
392
|
else
|
|
393
393
|
break;
|
|
394
394
|
}
|
|
395
|
-
return this.pos < this.source.length && this.source.charCodeAt(this.pos) === mi ? (this.advance(), this.make_token(
|
|
395
|
+
return this.pos < this.source.length && this.source.charCodeAt(this.pos) === mi ? (this.advance(), this.make_token(rt, s, this.pos, e, t)) : this.make_token(le, s, this.pos, e, t);
|
|
396
396
|
}
|
|
397
397
|
consume_at_keyword(e, t) {
|
|
398
398
|
let s = this.pos;
|
|
399
|
-
for (this.advance(); this.pos < this.source.length &&
|
|
399
|
+
for (this.advance(); this.pos < this.source.length && tt(this.source.charCodeAt(this.pos)); )
|
|
400
400
|
this.advance();
|
|
401
|
-
return this.make_token(
|
|
401
|
+
return this.make_token(Nr, s, this.pos, e, t);
|
|
402
402
|
}
|
|
403
403
|
consume_hash(e, t) {
|
|
404
404
|
let s = this.pos;
|
|
405
|
-
for (this.advance(); this.pos < this.source.length &&
|
|
405
|
+
for (this.advance(); this.pos < this.source.length && tt(this.source.charCodeAt(this.pos)); )
|
|
406
406
|
this.advance();
|
|
407
407
|
return this.make_token(Fi, s, this.pos, e, t);
|
|
408
408
|
}
|
|
@@ -459,8 +459,8 @@ class Gi {
|
|
|
459
459
|
this.pos = e.pos, this.line = e.line, this.column = e.column, this.token_type = e.token_type, this.token_start = e.token_start, this.token_end = e.token_end, this.token_line = e.token_line, this.token_column = e.token_column;
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
let
|
|
463
|
-
const tn = 1,
|
|
462
|
+
let it = 36;
|
|
463
|
+
const tn = 1, lt = 2, ze = 3, pe = 4, Wi = 5, Qi = 6, ot = 7, Vi = 10, as = 11, Ke = 12, ji = 13, sn = 14, Xi = 15, rn = 16, nn = 17, Zi = 18, ln = 19, dt = 20, hs = 21, Ji = 22, er = 23, Be = 24, be = 25, Ye = 26, at = 27, cs = 28, tr = 29, $e = 30, re = 31, sr = 56, on = 32, an = 33, hn = 34, cn = 35, _n = 36, un = 37, fn = 38, pn = 39, ir = 40, dn = 1, gn = 2, Ei = 4, xn = 8, mn = 32, rr = 64, kn = 128, Ci = 0, wn = 1, An = 2, yn = 3, En = 4, Cn = 5, bn = 6, Pe = 0, Rn = 1, vn = 2, ne = class ne {
|
|
464
464
|
constructor(e = 1024) {
|
|
465
465
|
g(this, "buffer");
|
|
466
466
|
g(this, "view");
|
|
@@ -471,7 +471,7 @@ const tn = 1, nt = 2, ze = 3, pe = 4, Yi = 5, Wi = 6, lt = 7, Qi = 10, as = 11,
|
|
|
471
471
|
g(this, "growth_count");
|
|
472
472
|
// Number of times the arena has grown
|
|
473
473
|
g(this, "overflow_lengths");
|
|
474
|
-
this.capacity = e, this.count = 1, this.growth_count = 0, this.buffer = new ArrayBuffer(e *
|
|
474
|
+
this.capacity = e, this.count = 1, this.growth_count = 0, this.buffer = new ArrayBuffer(e * it), this.view = new DataView(this.buffer), this.overflow_lengths = /* @__PURE__ */ new Map();
|
|
475
475
|
}
|
|
476
476
|
// Calculate recommended initial capacity based on CSS source size
|
|
477
477
|
static capacity_for_source(e) {
|
|
@@ -492,7 +492,7 @@ const tn = 1, nt = 2, ze = 3, pe = 4, Yi = 5, Wi = 6, lt = 7, Qi = 10, as = 11,
|
|
|
492
492
|
}
|
|
493
493
|
// Calculate byte offset for a node
|
|
494
494
|
node_offset(e) {
|
|
495
|
-
return e *
|
|
495
|
+
return e * it;
|
|
496
496
|
}
|
|
497
497
|
// Read node type
|
|
498
498
|
get_type(e) {
|
|
@@ -606,7 +606,7 @@ const tn = 1, nt = 2, ze = 3, pe = 4, Yi = 5, Wi = 6, lt = 7, Qi = 10, as = 11,
|
|
|
606
606
|
// Grow the arena by 1.3x when capacity is exceeded
|
|
607
607
|
grow() {
|
|
608
608
|
this.growth_count++;
|
|
609
|
-
let e = Math.ceil(this.capacity * ne.GROWTH_FACTOR), t = new ArrayBuffer(e *
|
|
609
|
+
let e = Math.ceil(this.capacity * ne.GROWTH_FACTOR), t = new ArrayBuffer(e * it);
|
|
610
610
|
new Uint8Array(t).set(new Uint8Array(this.buffer)), this.buffer = t, this.view = new DataView(t), this.capacity = e;
|
|
611
611
|
}
|
|
612
612
|
// Allocate and initialize a new node with core properties
|
|
@@ -615,7 +615,7 @@ const tn = 1, nt = 2, ze = 3, pe = 4, Yi = 5, Wi = 6, lt = 7, Qi = 10, as = 11,
|
|
|
615
615
|
this.count >= this.capacity && this.grow();
|
|
616
616
|
const l = this.count;
|
|
617
617
|
this.count++;
|
|
618
|
-
const o = l *
|
|
618
|
+
const o = l * it;
|
|
619
619
|
return this.view.setUint8(o, e), this.view.setUint32(o + 12, t, !0), this.view.setUint32(o + 24, i, !0), this.view.setUint32(o + 28, n, !0), this.set_length(l, s), l;
|
|
620
620
|
}
|
|
621
621
|
// --- Tree Building Helpers ---
|
|
@@ -660,12 +660,12 @@ g(ne, "GROWTH_FACTOR", 1.3), // Estimated nodes per KB of CSS (based on real-wor
|
|
|
660
660
|
g(ne, "NODES_PER_KB", 325), // Buffer to avoid frequent growth (15%)
|
|
661
661
|
g(ne, "CAPACITY_BUFFER", 1.2);
|
|
662
662
|
let ct = ne;
|
|
663
|
-
const Tn = 32, On = 9, Sn = 10, Nn = 13, Un = 12, Se = 47, W = 42, F = 45, Ln = 39, Hn = 34,
|
|
664
|
-
function
|
|
663
|
+
const Tn = 32, On = 9, Sn = 10, Nn = 13, Un = 12, Se = 47, W = 42, F = 45, Ln = 39, Hn = 34, te = 43, nr = 46, ht = 126, lr = 62, In = 38, fe = 61, De = 124, bi = 36, Ri = 94, Pn = 58;
|
|
664
|
+
function se(r) {
|
|
665
665
|
return r === Tn || r === On || r === Sn || r === Nn || r === Un;
|
|
666
666
|
}
|
|
667
667
|
function Dn(r) {
|
|
668
|
-
return r ===
|
|
668
|
+
return r === lr || r === te || r === ht;
|
|
669
669
|
}
|
|
670
670
|
function Jt(r) {
|
|
671
671
|
return r >= 48 && r <= 57;
|
|
@@ -725,14 +725,14 @@ function Fe(r, e, t) {
|
|
|
725
725
|
return !1;
|
|
726
726
|
}
|
|
727
727
|
function qn(r, e, t) {
|
|
728
|
-
for (; e < t &&
|
|
728
|
+
for (; e < t && se(r.charCodeAt(e)); )
|
|
729
729
|
e++;
|
|
730
730
|
return e;
|
|
731
731
|
}
|
|
732
732
|
function ye(r, e, t) {
|
|
733
733
|
for (; e < t; ) {
|
|
734
734
|
let s = r.charCodeAt(e);
|
|
735
|
-
if (
|
|
735
|
+
if (se(s)) {
|
|
736
736
|
e++;
|
|
737
737
|
continue;
|
|
738
738
|
}
|
|
@@ -753,7 +753,7 @@ function ye(r, e, t) {
|
|
|
753
753
|
function zn(r, e, t) {
|
|
754
754
|
for (; e > t; ) {
|
|
755
755
|
let s = r.charCodeAt(e - 1);
|
|
756
|
-
if (
|
|
756
|
+
if (se(s)) {
|
|
757
757
|
e--;
|
|
758
758
|
continue;
|
|
759
759
|
}
|
|
@@ -792,7 +792,7 @@ function es(r) {
|
|
|
792
792
|
}
|
|
793
793
|
break;
|
|
794
794
|
}
|
|
795
|
-
if (Jt(l) || l ===
|
|
795
|
+
if (Jt(l) || l === nr || l === F || l === te)
|
|
796
796
|
e = n + 1;
|
|
797
797
|
else
|
|
798
798
|
break;
|
|
@@ -802,35 +802,35 @@ function es(r) {
|
|
|
802
802
|
}
|
|
803
803
|
const Kn = {
|
|
804
804
|
[tn]: "StyleSheet",
|
|
805
|
-
[
|
|
805
|
+
[lt]: "Rule",
|
|
806
806
|
[ze]: "Atrule",
|
|
807
807
|
[pe]: "Declaration",
|
|
808
|
-
[
|
|
809
|
-
[
|
|
810
|
-
[
|
|
811
|
-
[
|
|
808
|
+
[Wi]: "Selector",
|
|
809
|
+
[Qi]: "Comment",
|
|
810
|
+
[ot]: "Block",
|
|
811
|
+
[Vi]: "Identifier",
|
|
812
812
|
[as]: "Number",
|
|
813
|
-
[
|
|
814
|
-
[
|
|
813
|
+
[Ke]: "Dimension",
|
|
814
|
+
[ji]: "String",
|
|
815
815
|
[sn]: "Hash",
|
|
816
|
-
[
|
|
816
|
+
[Xi]: "Function",
|
|
817
817
|
[rn]: "Operator",
|
|
818
818
|
[nn]: "Parentheses",
|
|
819
|
-
[
|
|
819
|
+
[Zi]: "Url",
|
|
820
820
|
[ln]: "Value",
|
|
821
821
|
[dt]: "SelectorList",
|
|
822
822
|
[hs]: "TypeSelector",
|
|
823
|
-
[
|
|
824
|
-
[
|
|
825
|
-
[
|
|
823
|
+
[Ji]: "ClassSelector",
|
|
824
|
+
[er]: "IdSelector",
|
|
825
|
+
[Be]: "AttributeSelector",
|
|
826
826
|
[be]: "PseudoClassSelector",
|
|
827
|
-
[
|
|
827
|
+
[Ye]: "PseudoElementSelector",
|
|
828
828
|
[at]: "Combinator",
|
|
829
829
|
[cs]: "UniversalSelector",
|
|
830
|
-
[
|
|
831
|
-
[
|
|
830
|
+
[tr]: "NestingSelector",
|
|
831
|
+
[$e]: "Nth",
|
|
832
832
|
[re]: "NthOf",
|
|
833
|
-
[
|
|
833
|
+
[sr]: "Lang",
|
|
834
834
|
[on]: "MediaQuery",
|
|
835
835
|
[an]: "Feature",
|
|
836
836
|
[hn]: "MediaType",
|
|
@@ -839,9 +839,9 @@ const Kn = {
|
|
|
839
839
|
[un]: "Layer",
|
|
840
840
|
[fn]: "Operator",
|
|
841
841
|
[pn]: "MediaFeatureRange",
|
|
842
|
-
[
|
|
842
|
+
[ir]: "AtrulePrelude"
|
|
843
843
|
};
|
|
844
|
-
class
|
|
844
|
+
class We {
|
|
845
845
|
constructor(e, t, s) {
|
|
846
846
|
g(this, "arena");
|
|
847
847
|
g(this, "source");
|
|
@@ -891,13 +891,13 @@ class Ye {
|
|
|
891
891
|
let { type: e, text: t } = this;
|
|
892
892
|
if (e === pe && this.first_child)
|
|
893
893
|
return this.first_child;
|
|
894
|
-
if (e ===
|
|
894
|
+
if (e === Ke)
|
|
895
895
|
return es(t).value;
|
|
896
896
|
if (e === as)
|
|
897
897
|
return Number.parseFloat(this.text);
|
|
898
|
-
if (e ===
|
|
898
|
+
if (e === Zi) {
|
|
899
899
|
let n = this.first_child;
|
|
900
|
-
if (n && n.type ===
|
|
900
|
+
if (n && n.type === ji)
|
|
901
901
|
return n.text;
|
|
902
902
|
if (Fn(t, "url(")) {
|
|
903
903
|
let l = t.indexOf("("), o = t.lastIndexOf(")");
|
|
@@ -912,7 +912,7 @@ class Ye {
|
|
|
912
912
|
/** Get the numeric value for NUMBER and DIMENSION nodes, or null for other node types */
|
|
913
913
|
get value_as_number() {
|
|
914
914
|
let e = this.text;
|
|
915
|
-
return this.type === as ? Number.parseFloat(e) : this.type ===
|
|
915
|
+
return this.type === as ? Number.parseFloat(e) : this.type === Ke ? es(e).value : null;
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
918
918
|
* Get the prelude node:
|
|
@@ -923,9 +923,9 @@ class Ye {
|
|
|
923
923
|
get prelude() {
|
|
924
924
|
if (this.type === ze) {
|
|
925
925
|
let e = this.first_child;
|
|
926
|
-
return e && e.type ===
|
|
926
|
+
return e && e.type === ir ? e : null;
|
|
927
927
|
}
|
|
928
|
-
if (this.type ===
|
|
928
|
+
if (this.type === lt)
|
|
929
929
|
return this.first_child;
|
|
930
930
|
}
|
|
931
931
|
/**
|
|
@@ -933,7 +933,7 @@ class Ye {
|
|
|
933
933
|
* Returns one of the ATTR_OPERATOR_* constants
|
|
934
934
|
*/
|
|
935
935
|
get attr_operator() {
|
|
936
|
-
if (this.type ===
|
|
936
|
+
if (this.type === Be)
|
|
937
937
|
return this.arena.get_attr_operator(this.index);
|
|
938
938
|
}
|
|
939
939
|
/**
|
|
@@ -941,12 +941,12 @@ class Ye {
|
|
|
941
941
|
* Returns one of the ATTR_FLAG_* constants
|
|
942
942
|
*/
|
|
943
943
|
get attr_flags() {
|
|
944
|
-
if (this.type ===
|
|
944
|
+
if (this.type === Be)
|
|
945
945
|
return this.arena.get_attr_flags(this.index);
|
|
946
946
|
}
|
|
947
947
|
/** Get the unit for dimension nodes (e.g., "px" from "100px", "%" from "50%") */
|
|
948
948
|
get unit() {
|
|
949
|
-
if (this.type ===
|
|
949
|
+
if (this.type === Ke)
|
|
950
950
|
return es(this.text).unit;
|
|
951
951
|
}
|
|
952
952
|
/** Check if this declaration has !important */
|
|
@@ -965,13 +965,13 @@ class Ye {
|
|
|
965
965
|
case pe:
|
|
966
966
|
return Fe(this.name);
|
|
967
967
|
case be:
|
|
968
|
-
case
|
|
968
|
+
case Ye:
|
|
969
969
|
return Fe(this.name);
|
|
970
970
|
case ze:
|
|
971
971
|
return Fe(this.name);
|
|
972
|
-
case
|
|
972
|
+
case Xi:
|
|
973
973
|
return Fe(this.name);
|
|
974
|
-
case
|
|
974
|
+
case Vi:
|
|
975
975
|
return Fe(this.text);
|
|
976
976
|
default:
|
|
977
977
|
return !1;
|
|
@@ -983,7 +983,7 @@ class Ye {
|
|
|
983
983
|
}
|
|
984
984
|
/** Check if this node has a prelude (at-rules and style rules) */
|
|
985
985
|
get has_prelude() {
|
|
986
|
-
return this.type === ze ? this.arena.get_value_length(this.index) > 0 : this.type ===
|
|
986
|
+
return this.type === ze ? this.arena.get_value_length(this.index) > 0 : this.type === lt ? this.first_child !== null : !1;
|
|
987
987
|
}
|
|
988
988
|
/** Check if this rule has a block { } */
|
|
989
989
|
get has_block() {
|
|
@@ -995,16 +995,16 @@ class Ye {
|
|
|
995
995
|
}
|
|
996
996
|
/** Get the block node (for style rules and at-rules with blocks) */
|
|
997
997
|
get block() {
|
|
998
|
-
if (this.type ===
|
|
998
|
+
if (this.type === lt) {
|
|
999
999
|
let e = this.first_child;
|
|
1000
1000
|
if (!e) return null;
|
|
1001
1001
|
let t = e.next_sibling;
|
|
1002
|
-
return t && t.type ===
|
|
1002
|
+
return t && t.type === ot ? t : null;
|
|
1003
1003
|
}
|
|
1004
1004
|
if (this.type === ze) {
|
|
1005
1005
|
let e = this.first_child;
|
|
1006
1006
|
for (; e; ) {
|
|
1007
|
-
if (e.type ===
|
|
1007
|
+
if (e.type === ot && !e.next_sibling)
|
|
1008
1008
|
return e;
|
|
1009
1009
|
e = e.next_sibling;
|
|
1010
1010
|
}
|
|
@@ -1014,10 +1014,10 @@ class Ye {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
/** Check if this block is empty (no declarations or rules, only comments allowed) */
|
|
1016
1016
|
get is_empty() {
|
|
1017
|
-
if (this.type !==
|
|
1017
|
+
if (this.type !== ot) return;
|
|
1018
1018
|
let e = this.first_child;
|
|
1019
1019
|
for (; e; ) {
|
|
1020
|
-
if (e.type !==
|
|
1020
|
+
if (e.type !== Qi)
|
|
1021
1021
|
return !1;
|
|
1022
1022
|
e = e.next_sibling;
|
|
1023
1023
|
}
|
|
@@ -1050,12 +1050,12 @@ class Ye {
|
|
|
1050
1050
|
/** Get first child node */
|
|
1051
1051
|
get first_child() {
|
|
1052
1052
|
let e = this.arena.get_first_child(this.index);
|
|
1053
|
-
return e === 0 ? null : new
|
|
1053
|
+
return e === 0 ? null : new We(this.arena, this.source, e);
|
|
1054
1054
|
}
|
|
1055
1055
|
/** Get next sibling node */
|
|
1056
1056
|
get next_sibling() {
|
|
1057
1057
|
let e = this.arena.get_next_sibling(this.index);
|
|
1058
|
-
return e === 0 ? null : new
|
|
1058
|
+
return e === 0 ? null : new We(this.arena, this.source, e);
|
|
1059
1059
|
}
|
|
1060
1060
|
/** Check if this node has a next sibling */
|
|
1061
1061
|
get has_next() {
|
|
@@ -1067,7 +1067,7 @@ class Ye {
|
|
|
1067
1067
|
* This allows formatters to distinguish :lang() from :hover
|
|
1068
1068
|
*/
|
|
1069
1069
|
get has_children() {
|
|
1070
|
-
return (this.type === be || this.type ===
|
|
1070
|
+
return (this.type === be || this.type === Ye) && this.arena.has_flag(this.index, rr) ? !0 : this.arena.has_children(this.index);
|
|
1071
1071
|
}
|
|
1072
1072
|
/** Get all children as an array */
|
|
1073
1073
|
get children() {
|
|
@@ -1085,7 +1085,7 @@ class Ye {
|
|
|
1085
1085
|
// --- An+B Expression Helpers (for NODE_SELECTOR_NTH) ---
|
|
1086
1086
|
/** Get the 'a' coefficient from An+B expression (e.g., "2n" from "2n+1", "odd" from "odd") */
|
|
1087
1087
|
get nth_a() {
|
|
1088
|
-
if (this.type !==
|
|
1088
|
+
if (this.type !== $e && this.type !== re) return;
|
|
1089
1089
|
let e = this.arena.get_content_length(this.index);
|
|
1090
1090
|
if (e === 0) return;
|
|
1091
1091
|
let t = this.arena.get_content_start(this.index);
|
|
@@ -1093,17 +1093,17 @@ class Ye {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
/** Get the 'b' coefficient from An+B expression (e.g., "+1" from "2n+1") */
|
|
1095
1095
|
get nth_b() {
|
|
1096
|
-
if (this.type !==
|
|
1096
|
+
if (this.type !== $e && this.type !== re) return;
|
|
1097
1097
|
let e = this.arena.get_value_length(this.index);
|
|
1098
1098
|
if (e === 0) return;
|
|
1099
1099
|
let t = this.arena.get_value_start(this.index), s = this.source.substring(t, t + e), i = t - 1;
|
|
1100
1100
|
for (; i >= 0; ) {
|
|
1101
1101
|
let n = this.source.charCodeAt(i);
|
|
1102
|
-
if (
|
|
1102
|
+
if (se(n)) {
|
|
1103
1103
|
i--;
|
|
1104
1104
|
continue;
|
|
1105
1105
|
}
|
|
1106
|
-
n === F ? s = "-" + s : n ===
|
|
1106
|
+
n === F ? s = "-" + s : n === te && (s = "+" + s);
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
1109
|
return s;
|
|
@@ -1152,7 +1152,7 @@ class Ye {
|
|
|
1152
1152
|
text: this.text,
|
|
1153
1153
|
children: []
|
|
1154
1154
|
};
|
|
1155
|
-
if (this.name && (i.name = this.name), this.type === pe && (i.property = this.name), this.value !== void 0 && this.value !== null && (i.value = this.value, this.unit && (i.unit = this.unit)), this.type === pe && (i.is_important = this.is_important, i.is_browserhack = this.is_browserhack), i.is_vendor_prefixed = this.is_vendor_prefixed, i.has_error = this.has_error, this.type ===
|
|
1155
|
+
if (this.name && (i.name = this.name), this.type === pe && (i.property = this.name), this.value !== void 0 && this.value !== null && (i.value = this.value, this.unit && (i.unit = this.unit)), this.type === pe && (i.is_important = this.is_important, i.is_browserhack = this.is_browserhack), i.is_vendor_prefixed = this.is_vendor_prefixed, i.has_error = this.has_error, this.type === Be && (i.attr_operator = this.attr_operator, i.attr_flags = this.attr_flags), (this.type === $e || this.type === re) && (i.nth_a = this.nth_a, i.nth_b = this.nth_b), s && (i.line = this.line, i.column = this.column, i.start = this.start, i.length = this.length, i.end = this.end), t)
|
|
1156
1156
|
for (let n of this.children)
|
|
1157
1157
|
i.children.push(n.clone({ deep: !0, locations: s }));
|
|
1158
1158
|
return i;
|
|
@@ -1164,7 +1164,7 @@ class vi {
|
|
|
1164
1164
|
g(this, "arena");
|
|
1165
1165
|
g(this, "source");
|
|
1166
1166
|
g(this, "expr_end");
|
|
1167
|
-
this.arena = e, this.source = t, this.lexer = new
|
|
1167
|
+
this.arena = e, this.source = t, this.lexer = new Yi(t), this.expr_end = 0;
|
|
1168
1168
|
}
|
|
1169
1169
|
/**
|
|
1170
1170
|
* Parse An+B expression
|
|
@@ -1177,30 +1177,30 @@ class vi {
|
|
|
1177
1177
|
if (this.skip_whitespace(), this.lexer.pos >= this.expr_end)
|
|
1178
1178
|
return null;
|
|
1179
1179
|
if (this.lexer.next_token_fast(!0), this.lexer.token_type === le) {
|
|
1180
|
-
const
|
|
1181
|
-
if (Y("odd",
|
|
1180
|
+
const u = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
1181
|
+
if (Y("odd", u) || Y("even", u))
|
|
1182
1182
|
return n = this.lexer.token_start, l = this.lexer.token_end, this.create_anplusb_node(c, n, l, 0, 0);
|
|
1183
1183
|
const f = this.source.charCodeAt(this.lexer.token_start), x = this.lexer.token_end > this.lexer.token_start + 1 ? this.source.charCodeAt(this.lexer.token_start + 1) : 0;
|
|
1184
1184
|
return f === F && x === 110 ? this.lexer.token_end > this.lexer.token_start + 2 && this.source.charCodeAt(this.lexer.token_start + 2) === F ? (n = this.lexer.token_start, l = this.lexer.token_start + 2, i = this.source.substring(this.lexer.token_start + 2, this.lexer.token_end), o = this.lexer.token_start + 2, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h)) : (n = this.lexer.token_start, l = this.lexer.token_start + 2, i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, i !== null ? o : 0, i !== null ? h : 0)) : f === 110 ? this.lexer.token_end > this.lexer.token_start + 1 && this.source.charCodeAt(this.lexer.token_start + 1) === F ? (n = this.lexer.token_start, l = this.lexer.token_start + 1, i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), o = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h)) : (n = this.lexer.token_start, l = this.lexer.token_start + 1, i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, i !== null ? o : 0, i !== null ? h : 0)) : null;
|
|
1185
1185
|
}
|
|
1186
|
-
if (this.lexer.token_type === de && this.source.charCodeAt(this.lexer.token_start) ===
|
|
1187
|
-
const
|
|
1186
|
+
if (this.lexer.token_type === de && this.source.charCodeAt(this.lexer.token_start) === te) {
|
|
1187
|
+
const u = this.lexer.save_position();
|
|
1188
1188
|
if (this.lexer.next_token_fast(!0), this.lexer.token_type === le && this.source.substring(this.lexer.token_start, this.lexer.token_end).charCodeAt(0) === 110)
|
|
1189
|
-
return n =
|
|
1190
|
-
this.lexer.restore_position(
|
|
1189
|
+
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) === F ? (i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), o = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h)) : (i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, i !== null ? o : 0, i !== null ? h : 0));
|
|
1190
|
+
this.lexer.restore_position(u);
|
|
1191
1191
|
}
|
|
1192
|
-
if (this.lexer.token_type ===
|
|
1193
|
-
const
|
|
1192
|
+
if (this.lexer.token_type === zi) {
|
|
1193
|
+
const u = this.source.substring(this.lexer.token_start, this.lexer.token_end), f = Mn(u, "n");
|
|
1194
1194
|
if (f !== -1) {
|
|
1195
|
-
if (n = this.lexer.token_start, l = this.lexer.token_start + f + 1, f + 1 <
|
|
1196
|
-
const x =
|
|
1195
|
+
if (n = this.lexer.token_start, l = this.lexer.token_start + f + 1, f + 1 < u.length) {
|
|
1196
|
+
const x = u.substring(f + 1);
|
|
1197
1197
|
if (x.charCodeAt(0) === F)
|
|
1198
1198
|
return i = x, o = this.lexer.token_start + f + 1, h = this.lexer.token_end, this.create_anplusb_node(c, n, l, o, h);
|
|
1199
1199
|
}
|
|
1200
1200
|
return i = this.parse_b_part(), i !== null && (o = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(c, n, l, o, h);
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
|
-
return this.lexer.token_type ===
|
|
1203
|
+
return this.lexer.token_type === nt ? (i = this.source.substring(this.lexer.token_start, this.lexer.token_end), o = this.lexer.token_start, h = this.lexer.token_end, this.create_anplusb_node(c, 0, 0, o, h)) : null;
|
|
1204
1204
|
}
|
|
1205
1205
|
/**
|
|
1206
1206
|
* Parse the b part after 'n'
|
|
@@ -1211,19 +1211,19 @@ class vi {
|
|
|
1211
1211
|
return null;
|
|
1212
1212
|
if (this.lexer.next_token_fast(!0), this.lexer.token_type === de) {
|
|
1213
1213
|
const e = this.source.charCodeAt(this.lexer.token_start);
|
|
1214
|
-
if (e ===
|
|
1214
|
+
if (e === te || e === F) {
|
|
1215
1215
|
const t = e === F ? "-" : "";
|
|
1216
|
-
if (this.skip_whitespace(), this.lexer.next_token_fast(!0), this.lexer.token_type ===
|
|
1216
|
+
if (this.skip_whitespace(), this.lexer.next_token_fast(!0), this.lexer.token_type === nt) {
|
|
1217
1217
|
let s = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
1218
|
-
return s.charCodeAt(0) ===
|
|
1218
|
+
return s.charCodeAt(0) === te && (s = s.substring(1)), t === "-" ? t + s : s;
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
}
|
|
1222
|
-
if (this.lexer.token_type ===
|
|
1222
|
+
if (this.lexer.token_type === nt) {
|
|
1223
1223
|
let e = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
1224
1224
|
const t = e.charCodeAt(0);
|
|
1225
|
-
if (t ===
|
|
1226
|
-
return t ===
|
|
1225
|
+
if (t === te || t === F)
|
|
1226
|
+
return t === te && (e = e.substring(1)), e;
|
|
1227
1227
|
}
|
|
1228
1228
|
return null;
|
|
1229
1229
|
}
|
|
@@ -1231,7 +1231,7 @@ class vi {
|
|
|
1231
1231
|
this.lexer.pos = ye(this.source, this.lexer.pos, this.expr_end);
|
|
1232
1232
|
}
|
|
1233
1233
|
create_anplusb_node(e, t, s, i, n) {
|
|
1234
|
-
const l = this.arena.create_node(
|
|
1234
|
+
const l = this.arena.create_node($e, e, this.lexer.pos - e, this.lexer.line, 1);
|
|
1235
1235
|
return s > t && (this.arena.set_content_start_delta(l, t - e), this.arena.set_content_length(l, s - t)), n > i && (this.arena.set_value_start_delta(l, i - e), this.arena.set_value_length(l, n - i)), l;
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
@@ -1241,7 +1241,7 @@ class Bn {
|
|
|
1241
1241
|
g(this, "arena");
|
|
1242
1242
|
g(this, "source");
|
|
1243
1243
|
g(this, "selector_end");
|
|
1244
|
-
this.arena = e, this.source = t, this.lexer = new
|
|
1244
|
+
this.arena = e, this.source = t, this.lexer = new Yi(t), this.selector_end = 0;
|
|
1245
1245
|
}
|
|
1246
1246
|
// Parse a selector range into selector nodes (standalone use)
|
|
1247
1247
|
// Always returns a NODE_SELECTOR_LIST with selector components as children
|
|
@@ -1255,7 +1255,7 @@ class Bn {
|
|
|
1255
1255
|
let l = this.lexer.pos, o = this.lexer.line, h = this.lexer.column, c = this.parse_complex_selector(e);
|
|
1256
1256
|
if (c !== null) {
|
|
1257
1257
|
let f = this.arena.create_node(
|
|
1258
|
-
|
|
1258
|
+
Wi,
|
|
1259
1259
|
l,
|
|
1260
1260
|
this.lexer.pos - l,
|
|
1261
1261
|
o,
|
|
@@ -1289,7 +1289,7 @@ class Bn {
|
|
|
1289
1289
|
const s = this.lexer.save_position();
|
|
1290
1290
|
if (this.lexer.next_token_fast(!1), this.lexer.token_type === de) {
|
|
1291
1291
|
let n = this.source.charCodeAt(this.lexer.token_start);
|
|
1292
|
-
if (n ===
|
|
1292
|
+
if (n === lr || n === te || n === ht) {
|
|
1293
1293
|
let l = this.create_node_at(
|
|
1294
1294
|
at,
|
|
1295
1295
|
this.lexer.token_start,
|
|
@@ -1362,16 +1362,18 @@ class Bn {
|
|
|
1362
1362
|
case le:
|
|
1363
1363
|
return this.parse_type_or_namespace_selector(t, s);
|
|
1364
1364
|
case Fi:
|
|
1365
|
-
return this.create_node(
|
|
1365
|
+
return this.create_node(er, t, s);
|
|
1366
1366
|
case de:
|
|
1367
1367
|
let i = this.source.charCodeAt(t);
|
|
1368
|
-
return i ===
|
|
1368
|
+
return i === nr ? this.parse_class_selector(t) : i === W ? this.parse_universal_or_namespace_selector(t, s) : i === In ? this.create_node(tr, t, s) : i === De ? this.parse_empty_namespace_selector(t) : null;
|
|
1369
1369
|
case ls:
|
|
1370
1370
|
return this.parse_attribute_selector(t);
|
|
1371
|
-
case
|
|
1371
|
+
case Ki:
|
|
1372
1372
|
return this.parse_pseudo(t);
|
|
1373
|
-
case
|
|
1373
|
+
case rt:
|
|
1374
1374
|
return this.parse_pseudo_function(t, s);
|
|
1375
|
+
case qi:
|
|
1376
|
+
return this.create_node(Ke, t, s);
|
|
1375
1377
|
case ns:
|
|
1376
1378
|
case qe:
|
|
1377
1379
|
return null;
|
|
@@ -1440,7 +1442,7 @@ class Bn {
|
|
|
1440
1442
|
// Parse class selector (.classname)
|
|
1441
1443
|
parse_class_selector(e) {
|
|
1442
1444
|
const t = this.lexer.save_position();
|
|
1443
|
-
return this.lexer.next_token_fast(!1), this.lexer.token_type !== le ? (this.lexer.restore_position(t), null) : this.create_node(
|
|
1445
|
+
return this.lexer.next_token_fast(!1), this.lexer.token_type !== le ? (this.lexer.restore_position(t), null) : this.create_node(Ji, e, this.lexer.token_end);
|
|
1444
1446
|
}
|
|
1445
1447
|
// Parse attribute selector ([attr], [attr=value], etc.)
|
|
1446
1448
|
parse_attribute_selector(e) {
|
|
@@ -1450,12 +1452,12 @@ class Bn {
|
|
|
1450
1452
|
let o = this.lexer.token_type;
|
|
1451
1453
|
if (o === ls)
|
|
1452
1454
|
t++;
|
|
1453
|
-
else if (o ===
|
|
1455
|
+
else if (o === Bi && (t--, t === 0)) {
|
|
1454
1456
|
n = this.lexer.token_start, s = this.lexer.token_end;
|
|
1455
1457
|
break;
|
|
1456
1458
|
}
|
|
1457
1459
|
}
|
|
1458
|
-
let l = this.create_node(
|
|
1460
|
+
let l = this.create_node(Be, e, s);
|
|
1459
1461
|
return this.parse_attribute_content(l, i, n), l;
|
|
1460
1462
|
}
|
|
1461
1463
|
// Parse attribute content to extract name, operator, and value
|
|
@@ -1464,7 +1466,7 @@ class Bn {
|
|
|
1464
1466
|
let i = t, n = t, l = -1, o = -1, h = -1;
|
|
1465
1467
|
for (; n < s; ) {
|
|
1466
1468
|
let k = this.source.charCodeAt(n);
|
|
1467
|
-
if (
|
|
1469
|
+
if (se(k) || k === fe || k === ht || k === De || k === Ri || k === bi || k === W)
|
|
1468
1470
|
break;
|
|
1469
1471
|
n++;
|
|
1470
1472
|
}
|
|
@@ -1474,18 +1476,18 @@ class Bn {
|
|
|
1474
1476
|
this.arena.set_attr_operator(e, Ci), this.arena.set_attr_flags(e, Pe);
|
|
1475
1477
|
return;
|
|
1476
1478
|
}
|
|
1477
|
-
let
|
|
1478
|
-
if (
|
|
1479
|
+
let u = this.source.charCodeAt(c), f = c + 1 < s ? this.source.charCodeAt(c + 1) : 0;
|
|
1480
|
+
if (u === fe)
|
|
1479
1481
|
l = c + 1, this.arena.set_attr_operator(e, wn);
|
|
1480
|
-
else if (
|
|
1482
|
+
else if (u === ht && f === fe)
|
|
1481
1483
|
l = c + 2, this.arena.set_attr_operator(e, An);
|
|
1482
|
-
else if (
|
|
1484
|
+
else if (u === De && f === fe)
|
|
1483
1485
|
l = c + 2, this.arena.set_attr_operator(e, yn);
|
|
1484
|
-
else if (
|
|
1486
|
+
else if (u === Ri && f === fe)
|
|
1485
1487
|
l = c + 2, this.arena.set_attr_operator(e, En);
|
|
1486
|
-
else if (
|
|
1488
|
+
else if (u === bi && f === fe)
|
|
1487
1489
|
l = c + 2, this.arena.set_attr_operator(e, Cn);
|
|
1488
|
-
else if (
|
|
1490
|
+
else if (u === W && f === fe)
|
|
1489
1491
|
l = c + 2, this.arena.set_attr_operator(e, bn);
|
|
1490
1492
|
else {
|
|
1491
1493
|
this.arena.set_attr_operator(e, Ci), this.arena.set_attr_flags(e, Pe);
|
|
@@ -1511,7 +1513,7 @@ class Bn {
|
|
|
1511
1513
|
} else {
|
|
1512
1514
|
for (; c < s; ) {
|
|
1513
1515
|
let k = this.source.charCodeAt(c);
|
|
1514
|
-
if (
|
|
1516
|
+
if (se(k))
|
|
1515
1517
|
break;
|
|
1516
1518
|
c++;
|
|
1517
1519
|
}
|
|
@@ -1531,9 +1533,9 @@ class Bn {
|
|
|
1531
1533
|
this.lexer.pos < this.selector_end && this.source.charCodeAt(this.lexer.pos) === Pn ? (i = !0, this.lexer.pos++) : this.lexer.restore_position(s), this.lexer.next_token_fast(!1);
|
|
1532
1534
|
let n = this.lexer.token_type;
|
|
1533
1535
|
if (n === le) {
|
|
1534
|
-
let l = this.create_node(i ?
|
|
1536
|
+
let l = this.create_node(i ? Ye : be, e, this.lexer.token_end);
|
|
1535
1537
|
return this.arena.set_content_start_delta(l, this.lexer.token_start - e), this.arena.set_content_length(l, this.lexer.token_end - this.lexer.token_start), l;
|
|
1536
|
-
} else if (n ===
|
|
1538
|
+
} else if (n === rt)
|
|
1537
1539
|
return this.parse_pseudo_function_after_colon(e, i);
|
|
1538
1540
|
return this.lexer.restore_position(t), null;
|
|
1539
1541
|
}
|
|
@@ -1546,26 +1548,26 @@ class Bn {
|
|
|
1546
1548
|
let s = this.lexer.token_start, i = this.lexer.token_end - 1, n = this.lexer.pos, l = n, o = 1, h = this.lexer.token_end;
|
|
1547
1549
|
for (; this.lexer.pos < this.selector_end && o > 0; ) {
|
|
1548
1550
|
this.lexer.next_token_fast(!1);
|
|
1549
|
-
let
|
|
1550
|
-
if (
|
|
1551
|
+
let u = this.lexer.token_type;
|
|
1552
|
+
if (u === $i || u === rt)
|
|
1551
1553
|
o++;
|
|
1552
|
-
else if (
|
|
1554
|
+
else if (u === Gi && (o--, o === 0)) {
|
|
1553
1555
|
l = this.lexer.token_start, h = this.lexer.token_end;
|
|
1554
1556
|
break;
|
|
1555
1557
|
}
|
|
1556
1558
|
}
|
|
1557
|
-
let c = this.create_node(t ?
|
|
1558
|
-
if (this.arena.set_content_start_delta(c, s - e), this.arena.set_content_length(c, i - s), this.arena.set_flag(c,
|
|
1559
|
-
let
|
|
1560
|
-
if (this.is_nth_pseudo(
|
|
1559
|
+
let c = this.create_node(t ? Ye : be, e, h);
|
|
1560
|
+
if (this.arena.set_content_start_delta(c, s - e), this.arena.set_content_length(c, i - s), this.arena.set_flag(c, rr), l > n) {
|
|
1561
|
+
let u = this.source.substring(s, i);
|
|
1562
|
+
if (this.is_nth_pseudo(u)) {
|
|
1561
1563
|
let f = this.parse_nth_expression(n, l);
|
|
1562
1564
|
f !== null && this.arena.set_first_child(c, f);
|
|
1563
|
-
} else if (Y("lang",
|
|
1565
|
+
} else if (Y("lang", u))
|
|
1564
1566
|
this.parse_lang_identifiers(n, l, c);
|
|
1565
1567
|
else {
|
|
1566
1568
|
let f = this.selector_end;
|
|
1567
1569
|
const x = this.lexer.save_position();
|
|
1568
|
-
let k = Y("has",
|
|
1570
|
+
let k = Y("has", u), V = this.parse_selector(n, l, this.lexer.line, this.lexer.column, k);
|
|
1569
1571
|
this.selector_end = f, this.lexer.restore_position(x), V !== null && this.arena.set_first_child(c, V);
|
|
1570
1572
|
}
|
|
1571
1573
|
}
|
|
@@ -1584,10 +1586,10 @@ class Bn {
|
|
|
1584
1586
|
let l = null, o = null;
|
|
1585
1587
|
for (; this.lexer.pos < t; ) {
|
|
1586
1588
|
this.lexer.next_token_fast(!1);
|
|
1587
|
-
let h = this.lexer.token_type, c = this.lexer.token_start,
|
|
1589
|
+
let h = this.lexer.token_type, c = this.lexer.token_start, u = this.lexer.token_end;
|
|
1588
1590
|
if (h !== ns && h !== qe) {
|
|
1589
1591
|
if (h === Mi || h === le) {
|
|
1590
|
-
let f = this.create_node(
|
|
1592
|
+
let f = this.create_node(sr, c, u);
|
|
1591
1593
|
l === null && (l = f), o !== null && this.arena.set_next_sibling(o, f), o = f;
|
|
1592
1594
|
}
|
|
1593
1595
|
if (this.lexer.pos >= t)
|
|
@@ -1608,8 +1610,8 @@ class Bn {
|
|
|
1608
1610
|
this.selector_end = t, this.lexer.pos = l;
|
|
1609
1611
|
let c = this.parse_selector_list();
|
|
1610
1612
|
this.selector_end = o, this.lexer.restore_position(h);
|
|
1611
|
-
let
|
|
1612
|
-
return n !== null && c !== null ? (this.arena.set_first_child(
|
|
1613
|
+
let u = this.arena.create_node(re, e, t - e, this.lexer.line, 1);
|
|
1614
|
+
return n !== null && c !== null ? (this.arena.set_first_child(u, n), this.arena.set_next_sibling(n, c)) : n !== null && this.arena.set_first_child(u, n), u;
|
|
1613
1615
|
} else
|
|
1614
1616
|
return new vi(this.arena, this.source).parse_anplusb(e, t, this.lexer.line);
|
|
1615
1617
|
}
|
|
@@ -1619,7 +1621,7 @@ class Bn {
|
|
|
1619
1621
|
for (; s < t - 1 && (s = ye(this.source, s, t), !(s >= t - 1)); ) {
|
|
1620
1622
|
let i = this.source.charCodeAt(s), n = this.source.charCodeAt(s + 1);
|
|
1621
1623
|
if ((i === 111 || i === 79) && (n === 102 || n === 70)) {
|
|
1622
|
-
let l = s === e ||
|
|
1624
|
+
let l = s === e || se(this.source.charCodeAt(s - 1)), o = s + 2 >= t || se(this.source.charCodeAt(s + 2));
|
|
1623
1625
|
if (l && o)
|
|
1624
1626
|
return s;
|
|
1625
1627
|
}
|
|
@@ -1639,7 +1641,7 @@ class Bn {
|
|
|
1639
1641
|
skip_whitespace() {
|
|
1640
1642
|
for (; this.lexer.pos < this.selector_end; ) {
|
|
1641
1643
|
let e = this.source.charCodeAt(this.lexer.pos);
|
|
1642
|
-
if (
|
|
1644
|
+
if (se(e)) {
|
|
1643
1645
|
this.lexer.advance();
|
|
1644
1646
|
continue;
|
|
1645
1647
|
}
|
|
@@ -1661,9 +1663,9 @@ function $n(r) {
|
|
|
1661
1663
|
const e = new ct(ct.capacity_for_source(r.length)), s = new Bn(e, r).parse_selector(0, r.length);
|
|
1662
1664
|
if (s === null) {
|
|
1663
1665
|
const i = e.create_node(dt, 0, 0, 1, 1);
|
|
1664
|
-
return new
|
|
1666
|
+
return new We(e, r, i);
|
|
1665
1667
|
}
|
|
1666
|
-
return new
|
|
1668
|
+
return new We(e, r, s);
|
|
1667
1669
|
}
|
|
1668
1670
|
function Gn(r, e) {
|
|
1669
1671
|
return r[0] === e[0] ? r[1] === e[1] ? r[2] - e[2] : r[1] - e[1] : r[0] - e[0];
|
|
@@ -1676,11 +1678,11 @@ const _t = (r) => {
|
|
|
1676
1678
|
let e = 0, t = 0, s = 0, i = r.first_child;
|
|
1677
1679
|
for (; i; ) {
|
|
1678
1680
|
switch (i.type) {
|
|
1679
|
-
case
|
|
1681
|
+
case pr:
|
|
1680
1682
|
e += 1;
|
|
1681
1683
|
break;
|
|
1682
1684
|
case ps:
|
|
1683
|
-
case
|
|
1685
|
+
case fr:
|
|
1684
1686
|
t += 1;
|
|
1685
1687
|
break;
|
|
1686
1688
|
case Oe:
|
|
@@ -1711,7 +1713,7 @@ const _t = (r) => {
|
|
|
1711
1713
|
case "nth-last-child":
|
|
1712
1714
|
t += 1;
|
|
1713
1715
|
const c = i.first_child;
|
|
1714
|
-
if ((c == null ? void 0 : c.type) ===
|
|
1716
|
+
if ((c == null ? void 0 : c.type) === ur && c.selector) {
|
|
1715
1717
|
const f = Ti(Oi(c.selector));
|
|
1716
1718
|
e += f[0], t += f[1], s += f[2];
|
|
1717
1719
|
}
|
|
@@ -1721,9 +1723,9 @@ const _t = (r) => {
|
|
|
1721
1723
|
case "host-context":
|
|
1722
1724
|
case "host":
|
|
1723
1725
|
t += 1;
|
|
1724
|
-
const
|
|
1725
|
-
if ((
|
|
1726
|
-
let f =
|
|
1726
|
+
const u = (n = i.first_child) == null ? void 0 : n.first_child;
|
|
1727
|
+
if ((u == null ? void 0 : u.type) === ce) {
|
|
1728
|
+
let f = u.first_child;
|
|
1727
1729
|
for (; f && f.type !== is; ) {
|
|
1728
1730
|
const x = _t({
|
|
1729
1731
|
first_child: f
|
|
@@ -1752,12 +1754,12 @@ const _t = (r) => {
|
|
|
1752
1754
|
s += 1;
|
|
1753
1755
|
const c = (l = i.first_child) == null ? void 0 : l.first_child;
|
|
1754
1756
|
if ((c == null ? void 0 : c.type) === ce) {
|
|
1755
|
-
let
|
|
1756
|
-
for (;
|
|
1757
|
+
let u = c.first_child;
|
|
1758
|
+
for (; u && u.type !== is; ) {
|
|
1757
1759
|
const f = _t({
|
|
1758
|
-
first_child:
|
|
1760
|
+
first_child: u
|
|
1759
1761
|
});
|
|
1760
|
-
e += f[0] ?? 0, t += f[1] ?? 0, s += f[2] ?? 0,
|
|
1762
|
+
e += f[0] ?? 0, t += f[1] ?? 0, s += f[2] ?? 0, u = u.next_sibling;
|
|
1761
1763
|
}
|
|
1762
1764
|
}
|
|
1763
1765
|
break;
|
|
@@ -2087,35 +2089,35 @@ function rl(r) {
|
|
|
2087
2089
|
return e = !0, Q;
|
|
2088
2090
|
}), e;
|
|
2089
2091
|
}
|
|
2090
|
-
var oe,
|
|
2092
|
+
var oe, Z, J, Re;
|
|
2091
2093
|
class p {
|
|
2092
2094
|
constructor(e = !1) {
|
|
2093
2095
|
G(this, oe);
|
|
2094
|
-
G(this,
|
|
2095
|
-
G(this,
|
|
2096
|
+
G(this, Z);
|
|
2097
|
+
G(this, J, []);
|
|
2096
2098
|
G(this, Re);
|
|
2097
|
-
M(this, oe, /* @__PURE__ */ new Map()), M(this,
|
|
2099
|
+
M(this, oe, /* @__PURE__ */ new Map()), M(this, Z, 0), e && M(this, J, []), M(this, Re, e);
|
|
2098
2100
|
}
|
|
2099
2101
|
p(e, t) {
|
|
2100
|
-
let s = w(this,
|
|
2102
|
+
let s = w(this, Z);
|
|
2101
2103
|
if (w(this, Re)) {
|
|
2102
2104
|
let i = s * 4;
|
|
2103
|
-
w(this,
|
|
2105
|
+
w(this, J)[i] = t.line, w(this, J)[i + 1] = t.column, w(this, J)[i + 2] = t.offset, w(this, J)[i + 3] = t.length;
|
|
2104
2106
|
}
|
|
2105
2107
|
if (w(this, oe).has(e)) {
|
|
2106
|
-
w(this, oe).get(e).push(s), Vt(this,
|
|
2108
|
+
w(this, oe).get(e).push(s), Vt(this, Z)._++;
|
|
2107
2109
|
return;
|
|
2108
2110
|
}
|
|
2109
|
-
w(this, oe).set(e, [s]), Vt(this,
|
|
2111
|
+
w(this, oe).set(e, [s]), Vt(this, Z)._++;
|
|
2110
2112
|
}
|
|
2111
2113
|
size() {
|
|
2112
|
-
return w(this,
|
|
2114
|
+
return w(this, Z);
|
|
2113
2115
|
}
|
|
2114
2116
|
c() {
|
|
2115
|
-
let e = /* @__PURE__ */ new Map(), t = {}, s = w(this, Re), i = w(this, oe), n = w(this,
|
|
2117
|
+
let e = /* @__PURE__ */ new Map(), t = {}, s = w(this, Re), i = w(this, oe), n = w(this, J), l = i.size;
|
|
2116
2118
|
i.forEach((h, c) => {
|
|
2117
2119
|
if (s) {
|
|
2118
|
-
let
|
|
2120
|
+
let u = h.map(function(f) {
|
|
2119
2121
|
let x = f * 4;
|
|
2120
2122
|
return {
|
|
2121
2123
|
line: n[x],
|
|
@@ -2124,11 +2126,11 @@ class p {
|
|
|
2124
2126
|
length: n[x + 3]
|
|
2125
2127
|
};
|
|
2126
2128
|
});
|
|
2127
|
-
e.set(c,
|
|
2129
|
+
e.set(c, u);
|
|
2128
2130
|
} else
|
|
2129
2131
|
t[c] = h.length;
|
|
2130
2132
|
});
|
|
2131
|
-
let o = w(this,
|
|
2133
|
+
let o = w(this, Z);
|
|
2132
2134
|
return s ? {
|
|
2133
2135
|
total: o,
|
|
2134
2136
|
totalUnique: l,
|
|
@@ -2144,14 +2146,14 @@ class p {
|
|
|
2144
2146
|
};
|
|
2145
2147
|
}
|
|
2146
2148
|
}
|
|
2147
|
-
oe = new WeakMap(),
|
|
2148
|
-
var ve, ae,
|
|
2149
|
+
oe = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), Re = new WeakMap();
|
|
2150
|
+
var ve, ae, Qe;
|
|
2149
2151
|
class ss {
|
|
2150
2152
|
constructor(e) {
|
|
2151
2153
|
G(this, ve);
|
|
2152
2154
|
G(this, ae);
|
|
2153
|
-
G(this,
|
|
2154
|
-
M(this, ve, new p(e)), M(this, ae, /* @__PURE__ */ new Map()), M(this,
|
|
2155
|
+
G(this, Qe);
|
|
2156
|
+
M(this, ve, new p(e)), M(this, ae, /* @__PURE__ */ new Map()), M(this, Qe, e);
|
|
2155
2157
|
}
|
|
2156
2158
|
/**
|
|
2157
2159
|
* Add an item to this #list's context
|
|
@@ -2160,7 +2162,7 @@ class ss {
|
|
|
2160
2162
|
* @param node_location
|
|
2161
2163
|
*/
|
|
2162
2164
|
push(e, t, s) {
|
|
2163
|
-
w(this, ve).p(e, s), w(this, ae).has(t) || w(this, ae).set(t, new p(w(this,
|
|
2165
|
+
w(this, ve).p(e, s), w(this, ae).has(t) || w(this, ae).set(t, new p(w(this, Qe))), w(this, ae).get(t).p(e, s);
|
|
2164
2166
|
}
|
|
2165
2167
|
count() {
|
|
2166
2168
|
let e = /* @__PURE__ */ new Map();
|
|
@@ -2171,7 +2173,7 @@ class ss {
|
|
|
2171
2173
|
});
|
|
2172
2174
|
}
|
|
2173
2175
|
}
|
|
2174
|
-
ve = new WeakMap(), ae = new WeakMap(),
|
|
2176
|
+
ve = new WeakMap(), ae = new WeakMap(), Qe = new WeakMap();
|
|
2175
2177
|
function nl(r) {
|
|
2176
2178
|
let e = /* @__PURE__ */ new Map(), t = -1, s = 0, i = 0, n = r.length;
|
|
2177
2179
|
for (let l = 0; l < n; l++) {
|
|
@@ -2180,25 +2182,25 @@ function nl(r) {
|
|
|
2180
2182
|
}
|
|
2181
2183
|
return i / s;
|
|
2182
2184
|
}
|
|
2183
|
-
var
|
|
2185
|
+
var ee, Te;
|
|
2184
2186
|
class L {
|
|
2185
2187
|
constructor() {
|
|
2186
|
-
G(this,
|
|
2188
|
+
G(this, ee);
|
|
2187
2189
|
G(this, Te);
|
|
2188
|
-
M(this,
|
|
2190
|
+
M(this, ee, []), M(this, Te, 0);
|
|
2189
2191
|
}
|
|
2190
2192
|
/**
|
|
2191
2193
|
* Add a new Integer at the end of this AggregateCollection
|
|
2192
2194
|
* @param item - The item to add
|
|
2193
2195
|
*/
|
|
2194
2196
|
push(e) {
|
|
2195
|
-
w(this,
|
|
2197
|
+
w(this, ee).push(e), M(this, Te, w(this, Te) + e);
|
|
2196
2198
|
}
|
|
2197
2199
|
size() {
|
|
2198
|
-
return w(this,
|
|
2200
|
+
return w(this, ee).length;
|
|
2199
2201
|
}
|
|
2200
2202
|
aggregate() {
|
|
2201
|
-
let e = w(this,
|
|
2203
|
+
let e = w(this, ee).length;
|
|
2202
2204
|
if (e === 0)
|
|
2203
2205
|
return {
|
|
2204
2206
|
min: 0,
|
|
@@ -2208,7 +2210,7 @@ class L {
|
|
|
2208
2210
|
range: 0,
|
|
2209
2211
|
sum: 0
|
|
2210
2212
|
};
|
|
2211
|
-
let t = w(this,
|
|
2213
|
+
let t = w(this, ee).slice().sort((o, h) => o - h), s = t[0], i = t[e - 1], n = nl(t), l = w(this, Te);
|
|
2212
2214
|
return {
|
|
2213
2215
|
min: s,
|
|
2214
2216
|
max: i,
|
|
@@ -2219,17 +2221,17 @@ class L {
|
|
|
2219
2221
|
};
|
|
2220
2222
|
}
|
|
2221
2223
|
toArray() {
|
|
2222
|
-
return w(this,
|
|
2224
|
+
return w(this, ee);
|
|
2223
2225
|
}
|
|
2224
2226
|
}
|
|
2225
|
-
|
|
2227
|
+
ee = new WeakMap(), Te = new WeakMap();
|
|
2226
2228
|
function ll(r) {
|
|
2227
2229
|
return r.replaceAll(/(?:^['"])|(?:['"]$)/g, "");
|
|
2228
2230
|
}
|
|
2229
2231
|
function ol(r, e) {
|
|
2230
2232
|
return e >= 65 && e <= 90 && (e = e | 32), r === e;
|
|
2231
2233
|
}
|
|
2232
|
-
function
|
|
2234
|
+
function Ge(r, e) {
|
|
2233
2235
|
if (r === e) return !0;
|
|
2234
2236
|
let t = e.length, s = t - r.length;
|
|
2235
2237
|
if (s < 0)
|
|
@@ -2251,7 +2253,7 @@ function fl(r) {
|
|
|
2251
2253
|
e === 35;
|
|
2252
2254
|
}
|
|
2253
2255
|
function m(r, e) {
|
|
2254
|
-
return xs(e) ? !1 :
|
|
2256
|
+
return xs(e) ? !1 : Ge(r, e);
|
|
2255
2257
|
}
|
|
2256
2258
|
function al(r) {
|
|
2257
2259
|
return ms(r) ? r.slice(r.indexOf("-", 2) + 1) : r;
|
|
@@ -2264,7 +2266,7 @@ function Ni(r) {
|
|
|
2264
2266
|
let e = r.children;
|
|
2265
2267
|
if (e) {
|
|
2266
2268
|
let t = e.at(-1);
|
|
2267
|
-
return !!(t && t.type === he &&
|
|
2269
|
+
return !!(t && t.type === he && Ge("\\9", t.text));
|
|
2268
2270
|
}
|
|
2269
2271
|
return !1;
|
|
2270
2272
|
}
|
|
@@ -2292,11 +2294,11 @@ function Ui(r, e, t) {
|
|
|
2292
2294
|
let s = Date.now(), i = (r.match(/\n/g) || []).length + 1, n = 0, l = 0, o = 0, h = {
|
|
2293
2295
|
total: 0,
|
|
2294
2296
|
unique: /* @__PURE__ */ new Map()
|
|
2295
|
-
}, c = Date.now(),
|
|
2297
|
+
}, c = Date.now(), u = dr(r, {
|
|
2296
2298
|
on_comment({ length: a }) {
|
|
2297
2299
|
n++, l += a;
|
|
2298
2300
|
}
|
|
2299
|
-
}), f = Date.now(), x = new p(t), k = new L(), V = [], ws = new p(t),
|
|
2301
|
+
}), f = Date.now(), x = new p(t), k = new L(), V = [], ws = new p(t), Ve = new p(t), As = new p(t), ys = new p(t), Es = new p(t), Cs = new p(t), bs = new p(t), gt = new p(t), Rs = new p(t), xt = new p(t), mt = new p(t), vs = new p(t), je = new p(t), Ts = new p(t), kt = new L(), Os = new p(t), wt = 0, At = 0, yt = new L(), Et = new L(), Ct = new L(), Ss = new p(t), Ns = new p(t), Us = new p(t), bt = new L(), Ls = new p(t), Rt = new p(t), Hs = /* @__PURE__ */ new Set(), vt = new p(t), _e, ue, Is = new L(), Ps = new L(), Ds = new L(), Fs = new p(t), Xe = new L(), Ms = new p(t), qs = [], Tt = new p(t), Ot = new p(t), zs = new p(t), Ks = new p(t), St = new L(), Bs = new p(t), $s = /* @__PURE__ */ new Set(), Ne = 0, Gs = new L(), Ze = 0, Nt = 0, Ut = new p(t), Lt = new L(), Ys = new p(t), Ue = new p(t), Ht = new p(t), It = new p(t), Je = new p(t), Le = new L(), Pt = new L(), Ws = new p(t), Dt = new p(t), Qs = new p(t), Vs = new p(t), js = new p(t), Ft = new p(t), Mt = new p(t), qt = new p(t), zt = new p(t), Kt = new p(t), xe = new ss(t), me = new p(t), Xs = new ss(t), Zs = new p(t), He = new p(t), Js = new ss(t), ei = new p(t);
|
|
2300
2302
|
function A(a) {
|
|
2301
2303
|
return {
|
|
2302
2304
|
line: a.line,
|
|
@@ -2306,42 +2308,42 @@ function Ui(r, e, t) {
|
|
|
2306
2308
|
};
|
|
2307
2309
|
}
|
|
2308
2310
|
let ke = -1;
|
|
2309
|
-
B(
|
|
2311
|
+
B(u, (a, D) => {
|
|
2310
2312
|
var ci, _i, ui, fi;
|
|
2311
2313
|
ke >= 0 && D <= ke && (ke = -1);
|
|
2312
2314
|
let Wt = ke >= 0 && D > ke;
|
|
2313
|
-
if (a.type ===
|
|
2315
|
+
if (a.type === gr) {
|
|
2314
2316
|
let N = A(a);
|
|
2315
2317
|
if (kt.push(D), Os.p(D, N), x.p(a.name, N), P("font-face", a.name)) {
|
|
2316
2318
|
let E = /* @__PURE__ */ Object.create(null);
|
|
2317
2319
|
t && ws.p(a.start, A(a));
|
|
2318
|
-
let R = a.children.find((d) => d.type ===
|
|
2320
|
+
let R = a.children.find((d) => d.type === xr);
|
|
2319
2321
|
for (let d of (R == null ? void 0 : R.children) || [])
|
|
2320
2322
|
d.type === jt && d.value && (E[d.property] = d.value.text);
|
|
2321
2323
|
k.push(1), V.push(E);
|
|
2322
2324
|
}
|
|
2323
2325
|
if (a.prelude === null || a.prelude === void 0)
|
|
2324
|
-
P("layer", a.name) && (
|
|
2326
|
+
P("layer", a.name) && (Ve.p("<anonymous>", A(a)), k.push(2));
|
|
2325
2327
|
else {
|
|
2326
2328
|
let { name: E } = a, R = 1;
|
|
2327
2329
|
if (P("media", E))
|
|
2328
|
-
ys.p(a.prelude.text, A(a)),
|
|
2330
|
+
ys.p(a.prelude.text, A(a)), br(a.prelude) && (Es.p(a.prelude.text, A(a)), R++);
|
|
2329
2331
|
else if (P("supports", E))
|
|
2330
|
-
gt.p(a.prelude.text, A(a)),
|
|
2331
|
-
else if (
|
|
2332
|
+
gt.p(a.prelude.text, A(a)), Cr(a.prelude) && (Rs.p(a.prelude.text, A(a)), R++);
|
|
2333
|
+
else if (Ge("keyframes", E)) {
|
|
2332
2334
|
let d = `@${E} ${a.prelude.text}`;
|
|
2333
2335
|
xt.p(d, A(a)), a.is_vendor_prefixed && (mt.p(d, A(a)), R++), ke = D;
|
|
2334
2336
|
} else if (P("layer", E))
|
|
2335
|
-
for (let d of a.prelude.text.split(",").map((
|
|
2336
|
-
|
|
2337
|
+
for (let d of a.prelude.text.split(",").map((_) => _.trim()))
|
|
2338
|
+
Ve.p(d, A(a));
|
|
2337
2339
|
else if (P("import", E)) {
|
|
2338
2340
|
if (As.p(a.prelude.text, A(a)), a.prelude.has_children)
|
|
2339
2341
|
for (let d of a.prelude)
|
|
2340
|
-
d.type === Hi && typeof d.value == "string" ? gt.p(d.value, A(d)) : d.type ===
|
|
2341
|
-
} else P("container", E) ? (vs.p(a.prelude.text, A(a)), ((ci = a.prelude.first_child) == null ? void 0 : ci.type) ===
|
|
2342
|
+
d.type === Hi && typeof d.value == "string" ? gt.p(d.value, A(d)) : d.type === mr && typeof d.value == "string" && Ve.p(d.value, A(d));
|
|
2343
|
+
} else P("container", E) ? (vs.p(a.prelude.text, A(a)), ((ci = a.prelude.first_child) == null ? void 0 : ci.type) === kr && ((_i = a.prelude.first_child.first_child) == null ? void 0 : _i.type) === he && je.p(a.prelude.first_child.first_child.text, A(a))) : P("property", E) ? Ts.p(a.prelude.text, A(a)) : P("charset", E) && bs.p(a.prelude.text, A(a));
|
|
2342
2344
|
k.push(R);
|
|
2343
2345
|
}
|
|
2344
|
-
} else if (a.type ===
|
|
2346
|
+
} else if (a.type === wr)
|
|
2345
2347
|
if (Wt && a.prelude)
|
|
2346
2348
|
a.prelude.type === ds && a.prelude.text && Rt.p(a.prelude.text, A(a.prelude));
|
|
2347
2349
|
else {
|
|
@@ -2361,17 +2363,17 @@ function Ui(r, e, t) {
|
|
|
2361
2363
|
let N = A(a);
|
|
2362
2364
|
St.push(D > 0 ? D - 1 : 0), Bs.p(D > 0 ? D - 1 : 0, N), Hs.add(a.text);
|
|
2363
2365
|
let E = rs(a);
|
|
2364
|
-
|
|
2365
|
-
let R =
|
|
2366
|
+
Xe.push(E), Ms.p(E, N), Rr(a) && vt.p(a.text, N), Di(a) && Ot.p(a.text, N);
|
|
2367
|
+
let R = vr(a);
|
|
2366
2368
|
if (R !== !1)
|
|
2367
|
-
for (let
|
|
2368
|
-
zs.p(
|
|
2369
|
-
|
|
2369
|
+
for (let j of R)
|
|
2370
|
+
zs.p(j, N);
|
|
2371
|
+
Tr(a, function(T) {
|
|
2370
2372
|
let U = T.name.trim() === "" ? " " : T.name;
|
|
2371
2373
|
Ks.p(U, T.loc);
|
|
2372
2374
|
});
|
|
2373
|
-
let d = _t(a), [
|
|
2374
|
-
return Fs.p(d.toString(), N), Is.push(
|
|
2375
|
+
let d = _t(a), [_, z, Qt] = d;
|
|
2376
|
+
return Fs.p(d.toString(), N), Is.push(_), Ps.push(z), Ds.push(Qt), _e === void 0 && (_e = d), ue === void 0 && (ue = d), ue !== void 0 && Li(ue, d) < 0 && (ue = d), _e !== void 0 && Li(_e, d) > 0 && (_e = d), qs.push(d), _ > 0 && Tt.p(a.text, N), I;
|
|
2375
2377
|
} else if (a.type === jt) {
|
|
2376
2378
|
Ne++, $s.add(a.text);
|
|
2377
2379
|
let N = A(a), E = D > 0 ? D - 1 : 0;
|
|
@@ -2387,87 +2389,87 @@ function Ui(r, e, t) {
|
|
|
2387
2389
|
Wt && (Nt++, R++);
|
|
2388
2390
|
}
|
|
2389
2391
|
Gs.push(R);
|
|
2390
|
-
let { is_important: d, property:
|
|
2391
|
-
Ue.p(
|
|
2392
|
+
let { is_important: d, property: _, is_browserhack: z, is_vendor_prefixed: Qt } = a, j = A(a);
|
|
2393
|
+
j.length = _.length, Ue.p(_, j), d && Ze++, Qt ? (Le.push(2), It.p(_, j)) : xs(_) ? (Je.p(_, j), Le.push(d ? 3 : 2), d && Ut.p(_, j)) : z ? (Ht.p(_, j), Le.push(2)) : Le.push(1);
|
|
2392
2394
|
{
|
|
2393
2395
|
let T = a.value, { text: U } = T, v = A(T), Ae = 1;
|
|
2394
2396
|
if (ut.has(U)) {
|
|
2395
2397
|
He.p(U, v), Pt.push(Ae);
|
|
2396
2398
|
return;
|
|
2397
2399
|
}
|
|
2398
|
-
if (rl(T) && (Ws.p(T.text, v), Ae++), Ni(T) && (Dt.p(U, v), U = U.slice(0, -2), Ae++), Pt.push(Ae), m("margin",
|
|
2399
|
-
Xn(T) && ei.p(
|
|
2400
|
+
if (rl(T) && (Ws.p(T.text, v), Ae++), Ni(T) && (Dt.p(U, v), U = U.slice(0, -2), Ae++), Pt.push(Ae), m("margin", _) || m("margin-block", _) || m("margin-inline", _) || m("margin-top", _) || m("margin-right", _) || m("margin-bottom", _) || m("margin-left", _) || m("padding", _) || m("padding-block", _) || m("padding-inline", _) || m("padding-top", _) || m("padding-right", _) || m("padding-bottom", _) || m("padding-left", _))
|
|
2401
|
+
Xn(T) && ei.p(_, v);
|
|
2400
2402
|
else {
|
|
2401
|
-
if (m("z-index",
|
|
2403
|
+
if (m("z-index", _))
|
|
2402
2404
|
return Qs.p(U, v), I;
|
|
2403
|
-
if (m("font",
|
|
2405
|
+
if (m("font", _)) {
|
|
2404
2406
|
if (!ts.has(U)) {
|
|
2405
2407
|
let C = el(T, function(Ie) {
|
|
2406
2408
|
Ie.type === "keyword" && He.p(Ie.value, v);
|
|
2407
2409
|
});
|
|
2408
2410
|
if (!C)
|
|
2409
2411
|
return I;
|
|
2410
|
-
let { font_size: O, line_height: S, font_family:
|
|
2411
|
-
|
|
2412
|
+
let { font_size: O, line_height: S, font_family: X } = C;
|
|
2413
|
+
X && Ft.p(X, v), O && Mt.p(O, v), S && qt.p(S, v);
|
|
2412
2414
|
}
|
|
2413
|
-
} else if (m("font-size",
|
|
2415
|
+
} else if (m("font-size", _))
|
|
2414
2416
|
ts.has(U) || Mt.p(U, v);
|
|
2415
2417
|
else {
|
|
2416
|
-
if (m("font-family",
|
|
2418
|
+
if (m("font-family", _))
|
|
2417
2419
|
return ts.has(U) || Ft.p(U, v), I;
|
|
2418
|
-
if (m("line-height",
|
|
2420
|
+
if (m("line-height", _))
|
|
2419
2421
|
qt.p(U, v);
|
|
2420
2422
|
else {
|
|
2421
|
-
if (m("transition",
|
|
2423
|
+
if (m("transition", _) || m("animation", _))
|
|
2422
2424
|
return il(T.children, function(C) {
|
|
2423
2425
|
C.type === "fn" ? zt.p(C.value.text, v) : C.type === "duration" ? Kt.p(C.value.text, v) : C.type === "keyword" && He.p(C.value.text, v);
|
|
2424
2426
|
}), I;
|
|
2425
|
-
if (m("animation-duration",
|
|
2427
|
+
if (m("animation-duration", _) || m("transition-duration", _))
|
|
2426
2428
|
for (let C of T.children)
|
|
2427
2429
|
C.type !== Ee && Kt.p(C.text, v);
|
|
2428
|
-
else if (m("transition-timing-function",
|
|
2430
|
+
else if (m("transition-timing-function", _) || m("animation-timing-function", _))
|
|
2429
2431
|
for (let C of T.children)
|
|
2430
2432
|
C.type !== Ee && zt.p(C.text, v);
|
|
2431
|
-
else m("container-name",
|
|
2433
|
+
else m("container-name", _) ? je.p(U, v) : m("container", _) ? ((fi = T.first_child) == null ? void 0 : fi.type) === he && je.p(T.first_child.text, v) : cl.has(al(_)) ? Js.push(U, _, v) : m("text-shadow", _) ? Vs.p(U, v) : m("box-shadow", _) && js.p(U, v);
|
|
2432
2434
|
}
|
|
2433
2435
|
}
|
|
2434
2436
|
}
|
|
2435
|
-
let
|
|
2437
|
+
let or = Ni(T);
|
|
2436
2438
|
B(T, (C) => {
|
|
2437
2439
|
switch (C.type) {
|
|
2438
2440
|
case ft: {
|
|
2439
2441
|
let O = C.unit, S = A(C);
|
|
2440
|
-
return Xs.push(O,
|
|
2442
|
+
return Xs.push(O, _, S), I;
|
|
2441
2443
|
}
|
|
2442
|
-
case
|
|
2444
|
+
case Ar: {
|
|
2443
2445
|
let O = C.text;
|
|
2444
2446
|
if (!O || !O.startsWith("#"))
|
|
2445
2447
|
return I;
|
|
2446
2448
|
let S = O;
|
|
2447
|
-
|
|
2448
|
-
let
|
|
2449
|
-
|
|
2449
|
+
or && !S.endsWith("\\9") && (S = S + "\\9");
|
|
2450
|
+
let X = S.length - 1;
|
|
2451
|
+
Ge("\\9", S) && (X = X - 2);
|
|
2450
2452
|
let Ie = A(C);
|
|
2451
|
-
return xe.push(S,
|
|
2453
|
+
return xe.push(S, _, Ie), me.p("hex" + X, Ie), I;
|
|
2452
2454
|
}
|
|
2453
2455
|
case he: {
|
|
2454
2456
|
let O = C.text, S = A(C);
|
|
2455
|
-
if (m("font",
|
|
2457
|
+
if (m("font", _) || m("font-family", _))
|
|
2456
2458
|
return I;
|
|
2457
2459
|
ut.has(O) && He.p(O, S);
|
|
2458
|
-
let
|
|
2459
|
-
if (
|
|
2460
|
+
let X = O.length;
|
|
2461
|
+
if (X > 20 || X < 3)
|
|
2460
2462
|
return I;
|
|
2461
2463
|
if (jn.has(O)) {
|
|
2462
|
-
xe.push(O,
|
|
2464
|
+
xe.push(O, _, S), me.p(O.toLowerCase(), S);
|
|
2463
2465
|
return;
|
|
2464
2466
|
}
|
|
2465
2467
|
if (Wn.has(O)) {
|
|
2466
|
-
xe.push(O,
|
|
2468
|
+
xe.push(O, _, S), me.p("named", S);
|
|
2467
2469
|
return;
|
|
2468
2470
|
}
|
|
2469
2471
|
if (Qn.has(O)) {
|
|
2470
|
-
xe.push(O,
|
|
2472
|
+
xe.push(O, _, S), me.p("system", S);
|
|
2471
2473
|
return;
|
|
2472
2474
|
}
|
|
2473
2475
|
return I;
|
|
@@ -2475,10 +2477,10 @@ function Ui(r, e, t) {
|
|
|
2475
2477
|
case gs: {
|
|
2476
2478
|
let O = C.name, S = A(C);
|
|
2477
2479
|
if (Vn.has(O)) {
|
|
2478
|
-
xe.push(C.text,
|
|
2480
|
+
xe.push(C.text, _, S), me.p(O.toLowerCase(), S);
|
|
2479
2481
|
return;
|
|
2480
2482
|
}
|
|
2481
|
-
if (
|
|
2483
|
+
if (Ge("gradient", O)) {
|
|
2482
2484
|
Zs.p(C.text, S);
|
|
2483
2485
|
return;
|
|
2484
2486
|
}
|
|
@@ -2486,12 +2488,12 @@ function Ui(r, e, t) {
|
|
|
2486
2488
|
}
|
|
2487
2489
|
});
|
|
2488
2490
|
}
|
|
2489
|
-
} else if (a.type ===
|
|
2491
|
+
} else if (a.type === yr) {
|
|
2490
2492
|
let { value: N } = a, E = ll(N || "");
|
|
2491
|
-
if (
|
|
2493
|
+
if (Er(E, "data:")) {
|
|
2492
2494
|
let R = E.length, d = hl(E);
|
|
2493
2495
|
h.total++, o += R;
|
|
2494
|
-
let
|
|
2496
|
+
let _ = {
|
|
2495
2497
|
line: a.line,
|
|
2496
2498
|
column: a.column,
|
|
2497
2499
|
offset: a.start,
|
|
@@ -2499,12 +2501,12 @@ function Ui(r, e, t) {
|
|
|
2499
2501
|
};
|
|
2500
2502
|
if (h.unique.has(d)) {
|
|
2501
2503
|
let z = h.unique.get(d);
|
|
2502
|
-
z.count++, z.size += R, h.unique.set(d, z), t && z.uniqueWithLocations && z.uniqueWithLocations.push(
|
|
2504
|
+
z.count++, z.size += R, h.unique.set(d, z), t && z.uniqueWithLocations && z.uniqueWithLocations.push(_);
|
|
2503
2505
|
} else {
|
|
2504
2506
|
let z = {
|
|
2505
2507
|
count: 1,
|
|
2506
2508
|
size: R,
|
|
2507
|
-
uniqueWithLocations: t ? [
|
|
2509
|
+
uniqueWithLocations: t ? [_] : void 0
|
|
2508
2510
|
};
|
|
2509
2511
|
h.unique.set(d, z);
|
|
2510
2512
|
}
|
|
@@ -2512,7 +2514,7 @@ function Ui(r, e, t) {
|
|
|
2512
2514
|
} else if (a.type === Ii)
|
|
2513
2515
|
return Cs.p(a.name, A(a)), I;
|
|
2514
2516
|
});
|
|
2515
|
-
let ti = $s.size, we =
|
|
2517
|
+
let ti = $s.size, we = Xe.size(), Bt = Is.aggregate(), $t = Ps.aggregate(), Gt = Ds.aggregate(), si = Hs.size, b = Object.assign, ii = r.length, Yt = V.length, ri = k.aggregate(), ni = Xe.aggregate(), li = Gs.aggregate(), oi = Le.aggregate(), ai = Pt.aggregate(), hi = x.c();
|
|
2516
2518
|
return {
|
|
2517
2519
|
stylesheet: {
|
|
2518
2520
|
sourceLinesOfCode: hi.total + we + Ne + Rt.size(),
|
|
@@ -2563,9 +2565,9 @@ function Ui(r, e, t) {
|
|
|
2563
2565
|
})
|
|
2564
2566
|
}),
|
|
2565
2567
|
container: b(vs.c(), {
|
|
2566
|
-
names:
|
|
2568
|
+
names: je.c()
|
|
2567
2569
|
}),
|
|
2568
|
-
layer:
|
|
2570
|
+
layer: Ve.c(),
|
|
2569
2571
|
property: Ts.c(),
|
|
2570
2572
|
complexity: ri,
|
|
2571
2573
|
nesting: b(
|
|
@@ -2633,7 +2635,7 @@ function Ui(r, e, t) {
|
|
|
2633
2635
|
Fs.c()
|
|
2634
2636
|
),
|
|
2635
2637
|
complexity: b(ni, Ms.c(), {
|
|
2636
|
-
items:
|
|
2638
|
+
items: Xe.toArray()
|
|
2637
2639
|
}),
|
|
2638
2640
|
nesting: b(
|
|
2639
2641
|
St.aggregate(),
|
|
@@ -2660,11 +2662,11 @@ function Ui(r, e, t) {
|
|
|
2660
2662
|
totalUnique: ti,
|
|
2661
2663
|
uniquenessRatio: H(ti, Ne),
|
|
2662
2664
|
importants: {
|
|
2663
|
-
total:
|
|
2664
|
-
ratio: H(
|
|
2665
|
+
total: Ze,
|
|
2666
|
+
ratio: H(Ze, Ne),
|
|
2665
2667
|
inKeyframes: {
|
|
2666
2668
|
total: Nt,
|
|
2667
|
-
ratio: H(Nt,
|
|
2669
|
+
ratio: H(Nt, Ze)
|
|
2668
2670
|
}
|
|
2669
2671
|
},
|
|
2670
2672
|
complexity: li,
|
|
@@ -2680,10 +2682,10 @@ function Ui(r, e, t) {
|
|
|
2680
2682
|
prefixed: b(It.c(), {
|
|
2681
2683
|
ratio: H(It.size(), Ue.size())
|
|
2682
2684
|
}),
|
|
2683
|
-
custom: b(
|
|
2684
|
-
ratio: H(
|
|
2685
|
+
custom: b(Je.c(), {
|
|
2686
|
+
ratio: H(Je.size(), Ue.size()),
|
|
2685
2687
|
importants: b(Ut.c(), {
|
|
2686
|
-
ratio: H(Ut.size(),
|
|
2688
|
+
ratio: H(Ut.size(), Je.size())
|
|
2687
2689
|
})
|
|
2688
2690
|
}),
|
|
2689
2691
|
browserhacks: b(Ht.c(), {
|
|
@@ -2734,10 +2736,10 @@ export {
|
|
|
2734
2736
|
ut as cssKeywords,
|
|
2735
2737
|
pl as hasVendorPrefix,
|
|
2736
2738
|
Di as isAccessibilitySelector,
|
|
2737
|
-
|
|
2739
|
+
br as isMediaBrowserhack,
|
|
2738
2740
|
fl as isPropertyHack,
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
+
Rr as isSelectorPrefixed,
|
|
2742
|
+
Cr as isSupportsBrowserhack,
|
|
2741
2743
|
rl as isValuePrefixed,
|
|
2742
2744
|
Wn as namedColors,
|
|
2743
2745
|
rs as selectorComplexity,
|