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