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