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