@projectwallace/css-analyzer 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css-analyzer.js +710 -698
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/css-analyzer.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Cr = Object.defineProperty;
|
|
2
|
+
var Ai = (r) => {
|
|
3
3
|
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var m = (r, e, t) =>
|
|
7
|
-
var w = (r, e, t) => (
|
|
8
|
-
var
|
|
5
|
+
var br = (r, e, t) => e in r ? Cr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
6
|
+
var m = (r, e, t) => br(r, typeof e != "symbol" ? e + "" : e, t), Ei = (r, e, t) => e.has(r) || Ai("Cannot " + t);
|
|
7
|
+
var w = (r, e, t) => (Ei(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Y = (r, e, t) => e.has(r) ? Ai("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), q = (r, e, t, s) => (Ei(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t);
|
|
8
|
+
var Xt = (r, e, t, s) => ({
|
|
9
9
|
set _(i) {
|
|
10
|
-
|
|
10
|
+
q(r, e, i, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
13
|
return w(r, e, s);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { walk as
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
if (t.type ===
|
|
16
|
+
import { walk as z, SUPPORTS_QUERY as Ki, BREAK as Q, MEDIA_TYPE as Rr, MEDIA_FEATURE as $i, str_equals as ge, DIMENSION as mt, NUMBER as gs, IDENTIFIER as _e, SELECTOR as me, NTH_SELECTOR as vr, PSEUDO_ELEMENT_SELECTOR as Qe, TYPE_SELECTOR as xs, PSEUDO_CLASS_SELECTOR as Le, ATTRIBUTE_SELECTOR as kt, SKIP as P, str_starts_with as Bi, COMBINATOR as ns, SELECTOR_LIST as ms, NTH_OF_SELECTOR as Tr, CLASS_SELECTOR as Sr, ID_SELECTOR as Or, FUNCTION as ks, OPERATOR as Re, is_custom as ws, is_vendor_prefixed as As, parse as Nr, AT_RULE as Lr, BLOCK as Ur, DECLARATION as Zt, LAYER_NAME as Ir, CONTAINER_QUERY as Hr, STYLE_RULE as Pr, HASH as Dr, URL as Fr } from "@projectwallace/css-parser";
|
|
17
|
+
function Mr(r, e) {
|
|
18
|
+
z(r, function(t) {
|
|
19
|
+
if (t.type === Ki) {
|
|
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 zr(r, e) {
|
|
29
|
+
z(r, function(t) {
|
|
30
|
+
if (t.type === Rr) {
|
|
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 === $i) {
|
|
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
47
|
if (i.type === mt && i.value === 1e-3 && ge("dpcm", i.unit || ""))
|
|
48
|
-
return e("min-resolution: .001dpcm"),
|
|
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 === gs && (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 Gi(r) {
|
|
73
73
|
return r.replaceAll(/(?:^['"])|(?:['"]$)/g, "");
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function qr(r, e) {
|
|
76
76
|
return e >= 65 && e <= 90 && (e = e | 32), r === e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ls(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 (qr(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 Kr = new W(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
|
|
89
|
+
function $r(r, e) {
|
|
90
|
+
z(r, function(t) {
|
|
91
|
+
if ((t.type === Qe || t.type === Le || t.type === xs) && t.is_vendor_prefixed) {
|
|
92
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 Br(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 + '"' + Gi(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 === kt) {
|
|
105
105
|
const i = s.name || "";
|
|
106
|
-
(ge("role", i) ||
|
|
106
|
+
(ge("role", i) || Bi(i, "aria-")) && e(t(s));
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
110
|
+
function Gr(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 Wr(r, e) {
|
|
116
|
+
z(r, function(t) {
|
|
117
|
+
t.type === Qe && t.name && e(t.name);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function os(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(os(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 === vr) {
|
|
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 === xs || i === Le) && s.is_vendor_prefixed && e++, i === kt)
|
|
135
|
+
return s.value && e++, P;
|
|
131
136
|
if (i === Le) {
|
|
132
137
|
const n = s.name || "";
|
|
133
|
-
if (
|
|
138
|
+
if (Kr.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(os(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 Yr(r, e) {
|
|
154
|
+
z(r, function(t) {
|
|
150
155
|
var s;
|
|
151
|
-
t.type ===
|
|
156
|
+
t.type === ns && 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 Es = 1,
|
|
167
|
+
let Es = 1, $ = 2, wt = 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] |= wt;
|
|
167
172
|
for (let r = 65; r <= 70; r++)
|
|
168
|
-
|
|
173
|
+
y[r] = wt;
|
|
169
174
|
for (let r = 97; r <= 102; r++)
|
|
170
|
-
|
|
175
|
+
y[r] = wt;
|
|
171
176
|
for (let r = 65; r <= 90; r++)
|
|
172
|
-
|
|
177
|
+
y[r] |= Es;
|
|
173
178
|
for (let r = 97; r <= 122; r++)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
function
|
|
181
|
-
return r < 128 && (
|
|
179
|
+
y[r] |= Es;
|
|
180
|
+
y[32] = ve;
|
|
181
|
+
y[9] = ve;
|
|
182
|
+
y[10] = ke;
|
|
183
|
+
y[13] = ke;
|
|
184
|
+
y[12] = ke;
|
|
185
|
+
function Qr(r) {
|
|
186
|
+
return r < 128 && (y[r] & $) !== 0;
|
|
182
187
|
}
|
|
183
188
|
function pe(r) {
|
|
184
|
-
return r < 128 && (
|
|
189
|
+
return r < 128 && (y[r] & wt) !== 0;
|
|
185
190
|
}
|
|
186
|
-
function
|
|
187
|
-
return r < 128 && (
|
|
191
|
+
function Vr(r) {
|
|
192
|
+
return r < 128 && (y[r] & Es) !== 0;
|
|
188
193
|
}
|
|
189
|
-
function
|
|
190
|
-
return r < 128 && (
|
|
194
|
+
function yi(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 : Vr(r);
|
|
197
202
|
}
|
|
198
|
-
function
|
|
199
|
-
return r === 45 ? !0 : Ke(r) ||
|
|
203
|
+
function ot(r) {
|
|
204
|
+
return r === 45 ? !0 : Ke(r) || Qr(r);
|
|
200
205
|
}
|
|
201
|
-
const ae = 1,
|
|
202
|
-
class
|
|
206
|
+
const ae = 1, ht = 2, jr = 3, Wi = 4, Yi = 5, Ci = 6, xe = 9, ct = 10, Qi = 11, Vi = 12, as = 13, Xr = 14, Zr = 15, ji = 16, Jr = 17, $e = 18, hs = 19, Xi = 20, Zi = 21, Ji = 22, en = 23, tn = 24, cs = 26, bi = 27, sn = 123, rn = 125, nn = 58, ln = 59, on = 44, an = 91, hn = 93, Ri = 40, cn = 41, vi = 47, Ti = 42, _n = 34, un = 39, Jt = 46, fn = 60, pn = 33, K = 45, dn = 62, gn = 64, xn = 35, es = 92, Me = 43, mn = 37, kn = 101, wn = 69, An = 117, En = 85, yn = 63, Si = 13, Oi = 10;
|
|
207
|
+
class er {
|
|
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 = cs, 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(cs, 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
234
|
case sn:
|
|
236
|
-
return this.advance(), this.make_token(
|
|
235
|
+
return this.advance(), this.make_token(en, s, this.pos, i, n);
|
|
237
236
|
case rn:
|
|
238
|
-
return this.advance(), this.make_token(
|
|
237
|
+
return this.advance(), this.make_token(tn, s, this.pos, i, n);
|
|
239
238
|
case nn:
|
|
240
|
-
return this.advance(), this.make_token(as, s, this.pos, i, n);
|
|
241
|
-
case ln:
|
|
242
|
-
return this.advance(), this.make_token(Vi, s, this.pos, i, n);
|
|
243
|
-
case yi:
|
|
244
239
|
return this.advance(), this.make_token(ji, s, this.pos, i, n);
|
|
240
|
+
case ln:
|
|
241
|
+
return this.advance(), this.make_token(Jr, s, this.pos, i, n);
|
|
245
242
|
case on:
|
|
243
|
+
return this.advance(), this.make_token($e, s, this.pos, i, n);
|
|
244
|
+
case an:
|
|
245
|
+
return this.advance(), this.make_token(hs, s, this.pos, i, n);
|
|
246
|
+
case hn:
|
|
246
247
|
return this.advance(), this.make_token(Xi, s, this.pos, i, n);
|
|
248
|
+
case Ri:
|
|
249
|
+
return this.advance(), this.make_token(Zi, s, this.pos, i, n);
|
|
250
|
+
case cn:
|
|
251
|
+
return this.advance(), this.make_token(Ji, s, this.pos, i, n);
|
|
247
252
|
}
|
|
248
|
-
if (t < 128 && (
|
|
253
|
+
if (t < 128 && (y[t] & (ve | ke)) !== 0)
|
|
249
254
|
return this.consume_whitespace(i, n);
|
|
250
|
-
if (t ===
|
|
255
|
+
if (t === vi && this.peek() === Ti) {
|
|
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) === Ti && this.peek() === vi) {
|
|
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 === _n || t === un)
|
|
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 === Jt) {
|
|
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 === fn && this.pos + 3 < this.source.length && this.peek() === pn && this.peek(2) === K && this.peek(3) === K)
|
|
283
|
+
return this.advance(4), this.make_token(Xr, s, this.pos, i, n);
|
|
284
|
+
if (t === K && this.pos + 2 < this.source.length && this.peek() === K && this.peek(2) === dn)
|
|
285
|
+
return this.advance(3), this.make_token(Zr, s, this.pos, i, n);
|
|
286
|
+
if (t === gn)
|
|
282
287
|
return this.consume_at_keyword(i, n);
|
|
283
|
-
if (t ===
|
|
288
|
+
if (t === xn)
|
|
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 === es) {
|
|
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 === Jt) {
|
|
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(as, 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(Yi, i, this.pos, t, s);
|
|
324
329
|
if (ne(n))
|
|
325
|
-
return this.make_token(
|
|
326
|
-
if (n ===
|
|
330
|
+
return this.make_token(Ci, i, this.pos, t, s);
|
|
331
|
+
if (n === es) {
|
|
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(Ci, 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
|
+
(yi(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) === Jt && 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 === kn || n === wn) {
|
|
373
|
+
let l = this.peek(), a = l < 128 && (y[l] & $) !== 0, h = this.peek(2), o = h < 128 && (y[h] & $) !== 0;
|
|
374
|
+
if (a || (l === Me || l === K) && o) {
|
|
370
375
|
if (this.advance(), this.pos < this.source.length) {
|
|
371
376
|
let _ = this.source.charCodeAt(this.pos);
|
|
372
|
-
(_ === Me || _ ===
|
|
377
|
+
(_ === Me || _ === K) && this.advance();
|
|
373
378
|
}
|
|
374
379
|
for (; this.pos < this.source.length; ) {
|
|
375
380
|
let _ = this.source.charCodeAt(this.pos);
|
|
376
|
-
if (_ >= 128 || (
|
|
381
|
+
if (_ >= 128 || (y[_] & $) === 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 === mn)
|
|
390
|
+
return this.advance(), this.make_token(Qi, s, this.pos, e, t);
|
|
391
|
+
if (Ke(n) || n === K && Ke(this.peek())) {
|
|
392
|
+
for (; this.pos < this.source.length && ot(this.source.charCodeAt(this.pos)); )
|
|
388
393
|
this.advance();
|
|
389
|
-
return this.make_token(
|
|
394
|
+
return this.make_token(Vi, s, this.pos, e, t);
|
|
390
395
|
}
|
|
391
396
|
}
|
|
392
|
-
return this.make_token(
|
|
397
|
+
return this.make_token(ct, 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 === es) {
|
|
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
|
+
(yi(l) || ne(l)) && this.advance();
|
|
409
414
|
}
|
|
410
415
|
} else
|
|
411
416
|
this.advance();
|
|
412
|
-
} else if (
|
|
417
|
+
} else if (ot(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 === An || i === En) && 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) === Ri ? (this.advance(), this.make_token(ht, 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 === yn)
|
|
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(bi, e, this.pos, t, s);
|
|
445
|
+
if (this.pos < this.source.length && this.source.charCodeAt(this.pos) === K && this.pos + 1 < this.source.length && pe(this.source.charCodeAt(this.pos + 1))) {
|
|
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(bi, 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 && ot(this.source.charCodeAt(this.pos)); )
|
|
456
461
|
this.advance();
|
|
457
|
-
return this.make_token(
|
|
462
|
+
return this.make_token(jr, 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 && ot(this.source.charCodeAt(this.pos)); )
|
|
462
467
|
this.advance();
|
|
463
|
-
return this.make_token(
|
|
468
|
+
return this.make_token(Wi, 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 === Si && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Oi && 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 === Si && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Oi && (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 at = 36;
|
|
524
|
+
const Cn = 1, _t = 2, Be = 3, J = 4, ys = 5, tr = 6, ut = 7, sr = 10, _s = 11, Ge = 12, ir = 13, bn = 14, rr = 15, us = 16, Rn = 17, nr = 18, vn = 19, At = 20, fs = 21, lr = 22, or = 23, We = 24, Te = 25, Ve = 26, ft = 27, ps = 28, ar = 29, Ye = 30, le = 31, hr = 56, Tn = 32, cr = 33, Sn = 34, On = 35, Nn = 36, Ln = 37, Un = 38, In = 39, _r = 40, Hn = 50, Pn = 1, Dn = 2, Ni = 4, Fn = 8, Mn = 32, ur = 64, zn = 128, ds = 0, fr = 1, pr = 2, dr = 3, gr = 4, xr = 5, mr = 6, Ce = 0, kr = 1, wr = 2, oe = class oe {
|
|
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 * at), 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 * at;
|
|
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, Ni)) {
|
|
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, Ni), 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 * at);
|
|
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 * at;
|
|
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 ---
|
|
@@ -716,17 +721,17 @@ m(oe, "GROWTH_FACTOR", 1.3), // Estimated nodes per KB of CSS (based on real-wor
|
|
|
716
721
|
m(oe, "NODES_PER_KB", 325), // Buffer to avoid frequent growth (15%)
|
|
717
722
|
m(oe, "CAPACITY_BUFFER", 1.2);
|
|
718
723
|
let dt = oe;
|
|
719
|
-
const
|
|
720
|
-
function
|
|
721
|
-
return r ===
|
|
724
|
+
const qn = 32, Kn = 9, $n = 10, Bn = 13, Gn = 12, Ue = 47, j = 42, M = 45, Wn = 39, Yn = 34, ie = 43, Ar = 46, pt = 126, Er = 62, Qn = 38, de = 61, ze = 124, Li = 36, Ui = 94, Vn = 58;
|
|
725
|
+
function re(r) {
|
|
726
|
+
return r === qn || r === Kn || r === $n || r === Bn || r === Gn;
|
|
722
727
|
}
|
|
723
|
-
function
|
|
724
|
-
return r ===
|
|
728
|
+
function jn(r) {
|
|
729
|
+
return r === Er || r === ie || r === pt;
|
|
725
730
|
}
|
|
726
|
-
function
|
|
731
|
+
function ts(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 Xn(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 Zn(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 Jn(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 el(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 ss(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 (ts(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 (ts(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 (ts(l) || l === Ar || 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 tl = {
|
|
865
|
+
[Cn]: "StyleSheet",
|
|
866
|
+
[_t]: "Rule",
|
|
862
867
|
[Be]: "Atrule",
|
|
863
|
-
[
|
|
864
|
-
[
|
|
865
|
-
[
|
|
866
|
-
[
|
|
867
|
-
[
|
|
868
|
-
[
|
|
868
|
+
[J]: "Declaration",
|
|
869
|
+
[ys]: "Selector",
|
|
870
|
+
[tr]: "Comment",
|
|
871
|
+
[ut]: "Block",
|
|
872
|
+
[sr]: "Identifier",
|
|
873
|
+
[_s]: "Number",
|
|
869
874
|
[Ge]: "Dimension",
|
|
870
|
-
[
|
|
871
|
-
[
|
|
872
|
-
[
|
|
873
|
-
[
|
|
874
|
-
[
|
|
875
|
-
[
|
|
876
|
-
[
|
|
877
|
-
[
|
|
878
|
-
[
|
|
879
|
-
[
|
|
880
|
-
[
|
|
881
|
-
[
|
|
875
|
+
[ir]: "String",
|
|
876
|
+
[bn]: "Hash",
|
|
877
|
+
[rr]: "Function",
|
|
878
|
+
[us]: "Operator",
|
|
879
|
+
[Rn]: "Parentheses",
|
|
880
|
+
[nr]: "Url",
|
|
881
|
+
[vn]: "UnicodeRange",
|
|
882
|
+
[Hn]: "Value",
|
|
883
|
+
[At]: "SelectorList",
|
|
884
|
+
[fs]: "TypeSelector",
|
|
885
|
+
[lr]: "ClassSelector",
|
|
886
|
+
[or]: "IdSelector",
|
|
882
887
|
[We]: "AttributeSelector",
|
|
883
888
|
[Te]: "PseudoClassSelector",
|
|
884
|
-
[
|
|
885
|
-
[
|
|
886
|
-
[
|
|
887
|
-
[
|
|
889
|
+
[Ve]: "PseudoElementSelector",
|
|
890
|
+
[ft]: "Combinator",
|
|
891
|
+
[ps]: "UniversalSelector",
|
|
892
|
+
[ar]: "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
|
+
[hr]: "Lang",
|
|
896
|
+
[Tn]: "MediaQuery",
|
|
897
|
+
[cr]: "Feature",
|
|
898
|
+
[Sn]: "MediaType",
|
|
899
|
+
[On]: "ContainerQuery",
|
|
900
|
+
[Nn]: "SupportsQuery",
|
|
901
|
+
[Ln]: "Layer",
|
|
902
|
+
[Un]: "Operator",
|
|
903
|
+
[In]: "MediaFeatureRange",
|
|
904
|
+
[_r]: "AtrulePrelude"
|
|
905
|
+
}, sl = {
|
|
906
|
+
[ds]: null,
|
|
907
|
+
[fr]: "=",
|
|
908
|
+
[pr]: "~=",
|
|
909
|
+
[dr]: "|=",
|
|
910
|
+
[gr]: "^=",
|
|
911
|
+
[xr]: "$=",
|
|
912
|
+
[mr]: "*="
|
|
913
|
+
}, il = {
|
|
914
|
+
[Ce]: null,
|
|
915
|
+
[kr]: "i",
|
|
916
|
+
[wr]: "s"
|
|
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 tl[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 === us || e === ys))
|
|
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 !== cr))
|
|
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 ss(t).value;
|
|
977
|
+
if (e === _s)
|
|
973
978
|
return Number.parseFloat(t);
|
|
974
|
-
if (e ===
|
|
975
|
-
if ((s == null ? void 0 : s.type) ===
|
|
979
|
+
if (e === nr) {
|
|
980
|
+
if ((s == null ? void 0 : s.type) === ir)
|
|
976
981
|
return s.text;
|
|
977
|
-
if (
|
|
982
|
+
if (Xn(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 === us)
|
|
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 === _s ? Number.parseFloat(e) : t === Ge ? ss(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 === _r ? e : null;
|
|
1004
1009
|
}
|
|
1005
|
-
if (this.type ===
|
|
1010
|
+
if (this.type === _t)
|
|
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 ss(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, Pn);
|
|
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, zn);
|
|
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 rr:
|
|
1050
1055
|
return qe(this.get_content());
|
|
1051
|
-
case
|
|
1056
|
+
case sr:
|
|
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, Dn);
|
|
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 === _t ? 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, Fn);
|
|
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, Mn);
|
|
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 === _t) {
|
|
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) === ut ? 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 === ut && !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 !== ut) return;
|
|
1097
1102
|
let e = this.first_child;
|
|
1098
1103
|
for (; e; ) {
|
|
1099
|
-
if (e.type !==
|
|
1104
|
+
if (e.type !== tr)
|
|
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, ur) ? !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 === At)
|
|
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
1245
|
let { is_vendor_prefixed: _, has_error: p } = this;
|
|
1241
|
-
if (_ && (o.is_vendor_prefixed = !0), p && (o.has_error = !0), i === We && (o.attr_operator =
|
|
1246
|
+
if (_ && (o.is_vendor_prefixed = !0), p && (o.has_error = !0), i === We && (o.attr_operator = sl[this.attr_operator], o.attr_flags = il[this.attr_flags]), (i === Ye || i === le) && (o.nth_a = this.nth_a, o.nth_b = this.nth_b), s && (o.line = this.line, o.column = this.column, o.start = this.start, o.length = this.length, o.end = this.end), t && i !== J) {
|
|
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 Ii {
|
|
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 er(t), this.expr_end = 0;
|
|
1256
1261
|
}
|
|
1257
1262
|
/**
|
|
1258
1263
|
* Parse An+B expression
|
|
@@ -1266,29 +1271,29 @@ class Li {
|
|
|
1266
1271
|
return null;
|
|
1267
1272
|
if (this.lexer.next_token_fast(!0), this.lexer.token_type === ae) {
|
|
1268
1273
|
const _ = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
1269
|
-
if (
|
|
1274
|
+
if (V("odd", _) || V("even", _))
|
|
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) ===
|
|
1279
|
+
if (this.lexer.token_type === xe && this.source.charCodeAt(this.lexer.token_start) === ie) {
|
|
1275
1280
|
const _ = 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 = _.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) ===
|
|
1282
|
+
return n = _.pos - 1, l = this.lexer.token_start + 1, this.lexer.token_end > this.lexer.token_start + 1 && this.source.charCodeAt(this.lexer.token_start + 1) === M ? (i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), a = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(o, n, l, a, h)) : (i = this.parse_b_part(), i !== null && (a = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(o, n, l, i !== null ? a : 0, i !== null ? h : 0));
|
|
1278
1283
|
this.lexer.restore_position(_);
|
|
1279
1284
|
}
|
|
1280
|
-
if (this.lexer.token_type ===
|
|
1281
|
-
const _ = this.source.substring(this.lexer.token_start, this.lexer.token_end), p =
|
|
1285
|
+
if (this.lexer.token_type === Vi) {
|
|
1286
|
+
const _ = this.source.substring(this.lexer.token_start, this.lexer.token_end), p = Zn(_, "n");
|
|
1282
1287
|
if (p !== -1) {
|
|
1283
1288
|
if (n = this.lexer.token_start, l = this.lexer.token_start + p + 1, p + 1 < _.length) {
|
|
1284
1289
|
const d = _.substring(p + 1);
|
|
1285
|
-
if (d.charCodeAt(0) ===
|
|
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 === ct ? (i = this.source.substring(this.lexer.token_start, this.lexer.token_end), a = this.lexer.token_start, h = this.lexer.token_end, this.create_anplusb_node(o, 0, 0, a, h)) : null;
|
|
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 === ct) {
|
|
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 === ct) {
|
|
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 rl {
|
|
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 er(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
|
|
@@ -1343,16 +1348,16 @@ class tl {
|
|
|
1343
1348
|
let l = this.lexer.pos, a = this.lexer.line, h = this.lexer.column, o = this.parse_complex_selector(e);
|
|
1344
1349
|
if (o !== null) {
|
|
1345
1350
|
let p = this.arena.create_node(
|
|
1346
|
-
|
|
1351
|
+
ys,
|
|
1347
1352
|
l,
|
|
1348
1353
|
this.lexer.pos - l,
|
|
1349
1354
|
a,
|
|
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(At, 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 === Er || n === ie || n === pt) {
|
|
1381
1386
|
let l = this.create_node_at(
|
|
1382
|
-
|
|
1387
|
+
ft,
|
|
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 === cs) 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 Wi:
|
|
1458
|
+
return this.create_node(or, t, s);
|
|
1454
1459
|
case xe:
|
|
1455
1460
|
let i = this.source.charCodeAt(t);
|
|
1456
|
-
return i ===
|
|
1457
|
-
case
|
|
1461
|
+
return i === Ar ? this.parse_class_selector(t) : i === j ? this.parse_universal_or_namespace_selector(t, s) : i === Qn ? this.create_node(ar, t, s) : i === ze ? this.parse_empty_namespace_selector(t) : null;
|
|
1462
|
+
case hs:
|
|
1458
1463
|
return this.parse_attribute_selector(t);
|
|
1459
|
-
case
|
|
1464
|
+
case ji:
|
|
1460
1465
|
return this.parse_pseudo(t);
|
|
1461
|
-
case
|
|
1466
|
+
case ht:
|
|
1462
1467
|
return this.parse_pseudo_function(t, s);
|
|
1463
|
-
case
|
|
1468
|
+
case Qi:
|
|
1464
1469
|
return this.create_node(Ge, t, s);
|
|
1465
|
-
case
|
|
1470
|
+
case as:
|
|
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 = us;
|
|
1480
|
-
else if (this.lexer.token_type === xe && this.source.charCodeAt(this.lexer.token_start) === V)
|
|
1481
1484
|
n = fs;
|
|
1485
|
+
else if (this.lexer.token_type === xe && this.source.charCodeAt(this.lexer.token_start) === j)
|
|
1486
|
+
n = ps;
|
|
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(fs, 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(ps, 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 (jn(n))
|
|
1531
|
+
return this.create_node_at(ft, this.lexer.token_start, this.lexer.token_end, this.lexer.token_line, this.lexer.token_column);
|
|
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(ft, 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(lr, 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 === hs)
|
|
1542
1547
|
t++;
|
|
1543
|
-
else if (a ===
|
|
1548
|
+
else if (a === Xi && (t--, t === 0)) {
|
|
1544
1549
|
n = this.lexer.token_start, s = this.lexer.token_end;
|
|
1545
1550
|
break;
|
|
1546
1551
|
}
|
|
@@ -1550,48 +1555,48 @@ 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 = el(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 === pt || f === ze || f === Ui || f === Li || 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, ds), this.arena.set_attr_flags(e, Ce);
|
|
1565
1570
|
return;
|
|
1566
1571
|
}
|
|
1567
1572
|
let _ = this.source.charCodeAt(o), p = o + 1 < s ? this.source.charCodeAt(o + 1) : 0;
|
|
1568
1573
|
if (_ === de)
|
|
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)
|
|
1574
|
+
l = o + 1, this.arena.set_attr_operator(e, fr);
|
|
1575
|
+
else if (_ === pt && p === de)
|
|
1575
1576
|
l = o + 2, this.arena.set_attr_operator(e, pr);
|
|
1576
|
-
else if (_ ===
|
|
1577
|
+
else if (_ === ze && p === de)
|
|
1577
1578
|
l = o + 2, this.arena.set_attr_operator(e, dr);
|
|
1578
|
-
else if (_ ===
|
|
1579
|
+
else if (_ === Ui && p === de)
|
|
1579
1580
|
l = o + 2, this.arena.set_attr_operator(e, gr);
|
|
1581
|
+
else if (_ === Li && p === de)
|
|
1582
|
+
l = o + 2, this.arena.set_attr_operator(e, xr);
|
|
1583
|
+
else if (_ === j && p === de)
|
|
1584
|
+
l = o + 2, this.arena.set_attr_operator(e, mr);
|
|
1580
1585
|
else {
|
|
1581
|
-
this.arena.set_attr_operator(e,
|
|
1586
|
+
this.arena.set_attr_operator(e, ds), 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 === Wn || d === Yn) {
|
|
1596
|
+
let f = d;
|
|
1592
1597
|
for (a = o, o++; o < s; ) {
|
|
1593
1598
|
let N = this.source.charCodeAt(o);
|
|
1594
|
-
if (N ===
|
|
1599
|
+
if (N === f) {
|
|
1595
1600
|
o++;
|
|
1596
1601
|
break;
|
|
1597
1602
|
}
|
|
@@ -1600,30 +1605,30 @@ class tl {
|
|
|
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, kr) : f === 115 || f === 83 ? this.arena.set_attr_flags(e, wr) : 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) === Vn ? (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 === ht)
|
|
1627
1632
|
return this.parse_pseudo_function_after_colon(e, i);
|
|
1628
1633
|
return this.lexer.restore_position(t), null;
|
|
1629
1634
|
}
|
|
@@ -1637,25 +1642,25 @@ class tl {
|
|
|
1637
1642
|
for (; this.lexer.pos < this.selector_end && a > 0; ) {
|
|
1638
1643
|
this.lexer.next_token_fast(!1);
|
|
1639
1644
|
let _ = this.lexer.token_type;
|
|
1640
|
-
if (_ ===
|
|
1645
|
+
if (_ === Zi || _ === ht)
|
|
1641
1646
|
a++;
|
|
1642
|
-
else if (_ ===
|
|
1647
|
+
else if (_ === Ji && (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,
|
|
1652
|
+
let o = this.create_node(t ? Ve : Te, e, h);
|
|
1653
|
+
if (this.arena.set_content_start_delta(o, s - e), this.arena.set_content_length(o, i - s), this.arena.set_flag(o, ur), l > n) {
|
|
1649
1654
|
let _ = this.source.substring(s, i);
|
|
1650
1655
|
if (this.is_nth_pseudo(_)) {
|
|
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", _))
|
|
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
|
|
1663
|
+
let f = V("has", _), N = this.parse_selector(n, l, this.lexer.line, this.lexer.column, f);
|
|
1659
1664
|
this.selector_end = p, this.lexer.restore_position(d), N !== null && this.arena.set_first_child(o, N);
|
|
1660
1665
|
}
|
|
1661
1666
|
}
|
|
@@ -1663,7 +1668,7 @@ class tl {
|
|
|
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)
|
|
@@ -1675,9 +1680,9 @@ class tl {
|
|
|
1675
1680
|
for (; this.lexer.pos < t; ) {
|
|
1676
1681
|
this.lexer.next_token_fast(!1);
|
|
1677
1682
|
let h = this.lexer.token_type, o = this.lexer.token_start, _ = this.lexer.token_end;
|
|
1678
|
-
if (h !==
|
|
1679
|
-
if (h ===
|
|
1680
|
-
let p = this.create_node(
|
|
1683
|
+
if (h !== as && h !== $e) {
|
|
1684
|
+
if (h === Yi || h === ae) {
|
|
1685
|
+
let p = this.create_node(hr, o, _);
|
|
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,8 +1696,8 @@ 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 Ii(this.arena, this.source).parse_anplusb(e, s, this.lexer.line), l = s + 2;
|
|
1700
|
+
l = Jn(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;
|
|
@@ -1701,7 +1706,7 @@ class tl {
|
|
|
1701
1706
|
let _ = this.arena.create_node(le, e, t - e, this.lexer.line, 1);
|
|
1702
1707
|
return n !== null && o !== null ? (this.arena.set_first_child(_, n), this.arena.set_next_sibling(n, o)) : n !== null && this.arena.set_first_child(_, n), _;
|
|
1703
1708
|
} else
|
|
1704
|
-
return new
|
|
1709
|
+
return new Ii(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 dt(dt.capacity_for_source(r.length)), s = new
|
|
1755
|
+
function nl(r) {
|
|
1756
|
+
const e = new dt(dt.capacity_for_source(r.length)), s = new rl(e, r).parse_selector(0, r.length);
|
|
1752
1757
|
if (s === null) {
|
|
1753
|
-
const i = e.create_node(
|
|
1754
|
-
return new
|
|
1758
|
+
const i = e.create_node(At, 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 ll(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 Hi(r) {
|
|
1767
|
+
return r.sort(ll).at(-1);
|
|
1763
1768
|
}
|
|
1764
1769
|
const gt = (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 Or:
|
|
1770
1775
|
e += 1;
|
|
1771
1776
|
break;
|
|
1772
|
-
case
|
|
1773
|
-
case
|
|
1777
|
+
case kt:
|
|
1778
|
+
case Sr:
|
|
1774
1779
|
t += 1;
|
|
1775
1780
|
break;
|
|
1776
1781
|
case Le:
|
|
@@ -1789,9 +1794,9 @@ const gt = (r) => {
|
|
|
1789
1794
|
case "not":
|
|
1790
1795
|
case "has":
|
|
1791
1796
|
if (i.has_children) {
|
|
1792
|
-
const
|
|
1793
|
-
if ((
|
|
1794
|
-
const N =
|
|
1797
|
+
const f = i.first_child;
|
|
1798
|
+
if ((f == null ? void 0 : f.type) === ms) {
|
|
1799
|
+
const N = Hi(Pi(f));
|
|
1795
1800
|
e += N[0], t += N[1], s += N[2];
|
|
1796
1801
|
}
|
|
1797
1802
|
}
|
|
@@ -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) === Tr && p.selector) {
|
|
1810
|
+
const f = Hi(Pi(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 (;
|
|
1821
|
+
let f = d.first_child;
|
|
1822
|
+
for (; f && f.type !== ns; ) {
|
|
1818
1823
|
const N = gt({
|
|
1819
|
-
first_child:
|
|
1824
|
+
first_child: f
|
|
1820
1825
|
});
|
|
1821
|
-
e += N[0] ?? 0, t += N[1] ?? 0, s += N[2] ?? 0,
|
|
1826
|
+
e += N[0] ?? 0, t += N[1] ?? 0, s += N[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 !== ns; ) {
|
|
1852
|
+
const f = gt({
|
|
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,7 +1869,7 @@ const gt = (r) => {
|
|
|
1864
1869
|
break;
|
|
1865
1870
|
}
|
|
1866
1871
|
break;
|
|
1867
|
-
case
|
|
1872
|
+
case xs:
|
|
1868
1873
|
let _ = i.name ?? "";
|
|
1869
1874
|
_.includes("|") && (_ = _.split("|")[1] ?? ""), _ !== "*" && (s += 1);
|
|
1870
1875
|
break;
|
|
@@ -1872,10 +1877,10 @@ const gt = (r) => {
|
|
|
1872
1877
|
i = i.next_sibling;
|
|
1873
1878
|
}
|
|
1874
1879
|
return [e, t, s];
|
|
1875
|
-
},
|
|
1880
|
+
}, ol = (r) => {
|
|
1876
1881
|
if (typeof r == "string")
|
|
1877
1882
|
try {
|
|
1878
|
-
return
|
|
1883
|
+
return nl(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}`);
|
|
@@ -1886,15 +1891,15 @@ const gt = (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
|
+
}, Pi = (r) => {
|
|
1890
1895
|
if (!r)
|
|
1891
1896
|
return [];
|
|
1892
|
-
const e =
|
|
1897
|
+
const e = ol(r), t = [];
|
|
1893
1898
|
let s = e.first_child;
|
|
1894
1899
|
for (; s; )
|
|
1895
1900
|
t.push(gt(s)), s = s.next_sibling;
|
|
1896
1901
|
return t;
|
|
1897
|
-
},
|
|
1902
|
+
}, al = 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
|
+
]), hl = 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
|
+
]), cl = new W(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), _l = new W(["transparent", "currentcolor"]), xt = 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 ul(r) {
|
|
2083
2088
|
for (let e of r.children)
|
|
2084
|
-
if (!(e.type ===
|
|
2089
|
+
if (!(e.type === gs && e.value === 0) && !(e.type === mt && e.value === 0))
|
|
2085
2090
|
return !1;
|
|
2086
2091
|
return !0;
|
|
2087
2092
|
}
|
|
2088
|
-
const
|
|
2093
|
+
const is = new W(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), fl = new W([
|
|
2089
2094
|
/* <absolute-size> values */
|
|
2090
2095
|
"xx-small",
|
|
2091
2096
|
"x-small",
|
|
@@ -2098,8 +2103,8 @@ 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
|
+
]), pl = 44, Di = 47;
|
|
2107
|
+
function dl(r, e) {
|
|
2103
2108
|
var a;
|
|
2104
2109
|
let t = [void 0, void 0], s, i;
|
|
2105
2110
|
if (r.first_child.type === ks && ((a = r.first_child.name) == null ? void 0 : a.toLowerCase()) === "var")
|
|
@@ -2110,15 +2115,15 @@ function ul(r, e) {
|
|
|
2110
2115
|
if (h.type === _e && xt.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) === Di) {
|
|
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) === Di) {
|
|
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) === pl && !t[0]) {
|
|
2122
2127
|
t[0] = h, !s && n && (s = n.text), n = h;
|
|
2123
2128
|
continue;
|
|
2124
2129
|
}
|
|
@@ -2126,13 +2131,13 @@ 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 === gs) {
|
|
2130
2135
|
n = h;
|
|
2131
2136
|
continue;
|
|
2132
2137
|
}
|
|
2133
2138
|
if (h.type === _e) {
|
|
2134
2139
|
let _ = h.name;
|
|
2135
|
-
if (_ &&
|
|
2140
|
+
if (_ && fl.has(_)) {
|
|
2136
2141
|
s = _, n = h;
|
|
2137
2142
|
continue;
|
|
2138
2143
|
}
|
|
@@ -2151,57 +2156,57 @@ function ul(r, e) {
|
|
|
2151
2156
|
font_family: l
|
|
2152
2157
|
};
|
|
2153
2158
|
}
|
|
2154
|
-
const
|
|
2155
|
-
function
|
|
2159
|
+
const gl = new W(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), xl = new W(["cubic-bezier", "steps"]);
|
|
2160
|
+
function ml(r, e) {
|
|
2156
2161
|
let t = !1;
|
|
2157
2162
|
for (let s of r) {
|
|
2158
2163
|
let i = s.type, n = s.name;
|
|
2159
2164
|
i === Re ? t = !1 : i === mt && t === !1 ? (t = !0, e({
|
|
2160
2165
|
type: "duration",
|
|
2161
2166
|
value: s
|
|
2162
|
-
})) : i === _e && n ?
|
|
2167
|
+
})) : i === _e && n ? gl.has(n) ? e({
|
|
2163
2168
|
type: "fn",
|
|
2164
2169
|
value: s
|
|
2165
2170
|
}) : xt.has(n) && e({
|
|
2166
2171
|
type: "keyword",
|
|
2167
2172
|
value: s
|
|
2168
|
-
}) : i === ks && n &&
|
|
2173
|
+
}) : i === ks && n && xl.has(n) && e({
|
|
2169
2174
|
type: "fn",
|
|
2170
2175
|
value: s
|
|
2171
2176
|
});
|
|
2172
2177
|
}
|
|
2173
2178
|
}
|
|
2174
|
-
function
|
|
2175
|
-
|
|
2179
|
+
function kl(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 u {
|
|
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 = w(this,
|
|
2190
|
-
if (w(this,
|
|
2194
|
+
let s = w(this, ee);
|
|
2195
|
+
if (w(this, Se)) {
|
|
2191
2196
|
let i = s * 4;
|
|
2192
|
-
w(this,
|
|
2197
|
+
w(this, te)[i] = t.line, w(this, te)[i + 1] = t.column, w(this, te)[i + 2] = t.offset, w(this, te)[i + 3] = t.length;
|
|
2193
2198
|
}
|
|
2194
2199
|
if (w(this, he).has(e)) {
|
|
2195
|
-
w(this, he).get(e).push(s),
|
|
2200
|
+
w(this, he).get(e).push(s), Xt(this, ee)._++;
|
|
2196
2201
|
return;
|
|
2197
2202
|
}
|
|
2198
|
-
w(this, he).set(e, [s]),
|
|
2203
|
+
w(this, he).set(e, [s]), Xt(this, ee)._++;
|
|
2199
2204
|
}
|
|
2200
2205
|
size() {
|
|
2201
|
-
return w(this,
|
|
2206
|
+
return w(this, ee);
|
|
2202
2207
|
}
|
|
2203
2208
|
c() {
|
|
2204
|
-
let e = /* @__PURE__ */ new Map(), t = {}, s = w(this,
|
|
2209
|
+
let e = /* @__PURE__ */ new Map(), t = {}, s = w(this, Se), i = w(this, he), n = w(this, te), l = i.size;
|
|
2205
2210
|
i.forEach((h, o) => {
|
|
2206
2211
|
if (s) {
|
|
2207
2212
|
let _ = h.map(function(p) {
|
|
@@ -2217,7 +2222,7 @@ class f {
|
|
|
2217
2222
|
} else
|
|
2218
2223
|
t[o] = h.length;
|
|
2219
2224
|
});
|
|
2220
|
-
let a = w(this,
|
|
2225
|
+
let a = w(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 rs {
|
|
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 u(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
|
-
w(this,
|
|
2257
|
+
w(this, Oe).p(e, s), w(this, ce).has(t) || w(this, ce).set(t, new u(w(this, Xe))), w(this, ce).get(t).p(e, s);
|
|
2253
2258
|
}
|
|
2254
2259
|
count() {
|
|
2255
2260
|
let e = /* @__PURE__ */ new Map();
|
|
2256
2261
|
for (let [t, s] of w(this, ce).entries())
|
|
2257
2262
|
e.set(t, s.c());
|
|
2258
|
-
return Object.assign(w(this,
|
|
2263
|
+
return Object.assign(w(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 wl(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
|
-
w(this,
|
|
2289
|
+
w(this, se).push(e), q(this, Ne, w(this, Ne) + e);
|
|
2285
2290
|
}
|
|
2286
2291
|
size() {
|
|
2287
|
-
return w(this,
|
|
2292
|
+
return w(this, se).length;
|
|
2288
2293
|
}
|
|
2289
2294
|
aggregate() {
|
|
2290
|
-
let e = w(this,
|
|
2295
|
+
let e = w(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 = w(this,
|
|
2305
|
+
let t = w(this, se).slice().sort((a, h) => a - h), s = t[0], i = t[e - 1], n = wl(t), l = w(this, Ne);
|
|
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 w(this,
|
|
2316
|
+
return w(this, se);
|
|
2312
2317
|
}
|
|
2313
2318
|
}
|
|
2314
|
-
|
|
2315
|
-
function
|
|
2319
|
+
se = new WeakMap(), Ne = new WeakMap();
|
|
2320
|
+
function Al(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 Fi(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 && ls("\\9", t.text));
|
|
2324
2329
|
}
|
|
2325
2330
|
return !1;
|
|
2326
2331
|
}
|
|
2327
|
-
const
|
|
2332
|
+
const El = /* @__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
|
+
]), yl = new W([
|
|
2351
2356
|
"border-radius",
|
|
2352
2357
|
"border-top-left-radius",
|
|
2353
2358
|
"border-top-right-radius",
|
|
@@ -2358,7 +2363,7 @@ const kl = /* @__PURE__ */ new Set([
|
|
|
2358
2363
|
"border-end-end-radius",
|
|
2359
2364
|
"border-end-start-radius"
|
|
2360
2365
|
]);
|
|
2361
|
-
function
|
|
2366
|
+
function Cl(r) {
|
|
2362
2367
|
if (ws(r) || As(r)) return !1;
|
|
2363
2368
|
let e = r.charCodeAt(0);
|
|
2364
2369
|
return e === 47 || // /
|
|
@@ -2369,27 +2374,27 @@ function Al(r) {
|
|
|
2369
2374
|
e === 36 || // $
|
|
2370
2375
|
e === 35;
|
|
2371
2376
|
}
|
|
2372
|
-
function
|
|
2373
|
-
return ws(r) ? r : As(r) ? r.slice(r.indexOf("-", 2) + 1).toLowerCase() :
|
|
2377
|
+
function Mi(r) {
|
|
2378
|
+
return ws(r) ? r : As(r) ? r.slice(r.indexOf("-", 2) + 1).toLowerCase() : Cl(r) ? r.slice(1).toLowerCase() : r.toLowerCase();
|
|
2374
2379
|
}
|
|
2375
|
-
function
|
|
2380
|
+
function vl(r) {
|
|
2376
2381
|
return As(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 Tl(r, e = {}) {
|
|
2387
|
+
return e.useLocations === !0 ? zi(r, e, !0) : zi(r, e, !1);
|
|
2383
2388
|
}
|
|
2384
|
-
function
|
|
2389
|
+
function zi(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(), _ = Nr(r, {
|
|
2389
2394
|
on_comment({ length: c }) {
|
|
2390
2395
|
n++, l += c;
|
|
2391
2396
|
}
|
|
2392
|
-
}), p = Date.now(), d = new
|
|
2397
|
+
}), p = Date.now(), d = new u(t), f = new I(), N = [], Cs = new u(t), Ze = new u(t), bs = new u(t), Rs = new u(t), vs = new u(t), Ts = new u(t), Ss = new u(t), Et = new u(t), Os = new u(t), yt = new u(t), Ct = new u(t), Ns = new u(t), Je = new u(t), Ls = new u(t), bt = new I(), Us = new u(t), Rt = 0, vt = 0, Tt = new I(), St = new I(), Ot = new I(), Is = new u(t), Hs = new u(t), Ps = new u(t), Nt = new I(), Ds = new u(t), Lt = new u(t), Fs = /* @__PURE__ */ new Set(), Ut = new u(t), ue, fe, Ms = new I(), zs = new I(), qs = new I(), Ks = new u(t), et = new I(), $s = new u(t), Bs = [], It = new u(t), Ht = new u(t), Gs = new u(t), Ws = new u(t), Ys = new u(t), Qs = new u(t), Pt = new I(), Vs = new u(t), js = /* @__PURE__ */ new Set(), Ie = 0, Xs = new I(), tt = 0, Dt = 0, Ft = new u(t), Mt = new I(), Zs = new u(t), He = new u(t), zt = new u(t), qt = new u(t), st = new u(t), Pe = new I(), Kt = new I(), Js = new u(t), $t = new u(t), ei = new u(t), ti = new u(t), si = new u(t), Bt = new u(t), it = new u(t), rt = new u(t), Gt = new u(t), nt = new u(t), we = new rs(t), Ae = new u(t), ii = new rs(t), ri = new u(t), De = new u(t), ni = new rs(t), li = new u(t);
|
|
2393
2398
|
function A(c) {
|
|
2394
2399
|
return {
|
|
2395
2400
|
line: c.line,
|
|
@@ -2399,205 +2404,210 @@ 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
|
|
2408
|
-
|
|
2409
|
-
let
|
|
2410
|
-
if (d.p(
|
|
2407
|
+
z(_, (c, F) => {
|
|
2408
|
+
var gi, xi, mi, ki, wi;
|
|
2409
|
+
Ee >= 0 && F <= Ee && (Ee = -1);
|
|
2410
|
+
let jt = Ee >= 0 && F > Ee;
|
|
2411
|
+
if (c.type === Lr) {
|
|
2412
|
+
let R = A(c);
|
|
2413
|
+
bt.push(F), Us.p(F, R);
|
|
2414
|
+
let C = Mi(c.name ?? "");
|
|
2415
|
+
if (d.p(C, R), C === "font-face") {
|
|
2411
2416
|
let k = /* @__PURE__ */ Object.create(null);
|
|
2412
|
-
t &&
|
|
2413
|
-
let g = c.children.find((E) => E.type ===
|
|
2417
|
+
t && Cs.p(c.start, A(c));
|
|
2418
|
+
let g = c.children.find((E) => E.type === Ur);
|
|
2414
2419
|
for (let E of (g == null ? void 0 : g.children) || [])
|
|
2415
|
-
E.type ===
|
|
2416
|
-
|
|
2420
|
+
E.type === Zt && E.value && (k[E.property] = E.value.text);
|
|
2421
|
+
f.push(1), N.push(k);
|
|
2417
2422
|
}
|
|
2418
2423
|
if (c.prelude === null || c.prelude === void 0)
|
|
2419
|
-
|
|
2424
|
+
C === "layer" && (Ze.p("<anonymous>", A(c)), f.push(2));
|
|
2420
2425
|
else {
|
|
2421
2426
|
let k = 1;
|
|
2422
|
-
if (
|
|
2423
|
-
Rs.p(c.prelude.text, A(c)),
|
|
2427
|
+
if (C === "media")
|
|
2428
|
+
Rs.p(c.prelude.text, A(c)), zr(c.prelude, (g) => {
|
|
2424
2429
|
vs.p(g, A(c)), k++;
|
|
2425
2430
|
});
|
|
2426
|
-
else if (
|
|
2427
|
-
|
|
2428
|
-
|
|
2431
|
+
else if (C === "supports")
|
|
2432
|
+
Et.p(c.prelude.text, A(c)), Mr(c.prelude, (g) => {
|
|
2433
|
+
Os.p(g, A(c)), k++;
|
|
2429
2434
|
});
|
|
2430
|
-
else if (
|
|
2435
|
+
else if (C.endsWith("keyframes")) {
|
|
2431
2436
|
let g = c.prelude.text;
|
|
2432
|
-
|
|
2433
|
-
} else if (
|
|
2437
|
+
yt.p(g, A(c)), c.is_vendor_prefixed && (Ct.p(`@${(gi = c.name) == null ? void 0 : gi.toLowerCase()} ${c.prelude.text}`, A(c)), k++), Ee = F;
|
|
2438
|
+
} else if (C === "layer")
|
|
2434
2439
|
for (let g of c.prelude.text.split(",").map((E) => E.trim()))
|
|
2435
|
-
|
|
2436
|
-
else if (
|
|
2440
|
+
Ze.p(g, A(c));
|
|
2441
|
+
else if (C === "import") {
|
|
2437
2442
|
if (bs.p(c.prelude.text, A(c)), c.prelude.has_children)
|
|
2438
2443
|
for (let g of c.prelude)
|
|
2439
|
-
g.type ===
|
|
2440
|
-
} else
|
|
2441
|
-
|
|
2444
|
+
g.type === Ki && typeof g.value == "string" ? Et.p(g.value, A(g)) : g.type === Ir && typeof g.value == "string" && Ze.p(g.value, A(g));
|
|
2445
|
+
} else C === "container" ? (Ns.p(c.prelude.text, A(c)), ((xi = c.prelude.first_child) == null ? void 0 : xi.type) === Hr && ((mi = c.prelude.first_child.first_child) == null ? void 0 : mi.type) === _e && Je.p(c.prelude.first_child.first_child.text, A(c))) : C === "property" ? Ls.p(c.prelude.text, A(c)) : C === "charset" && Ss.p(c.prelude.text.toLowerCase(), A(c));
|
|
2446
|
+
f.push(k);
|
|
2442
2447
|
}
|
|
2443
|
-
} else if (c.type ===
|
|
2444
|
-
if (
|
|
2448
|
+
} else if (c.type === Pr)
|
|
2449
|
+
if (jt && c.prelude) {
|
|
2445
2450
|
if (c.prelude.type === ms && c.prelude.children.length > 0)
|
|
2446
|
-
for (let
|
|
2447
|
-
|
|
2451
|
+
for (let R of c.prelude.children)
|
|
2452
|
+
Lt.p(R.text, A(R));
|
|
2448
2453
|
} else {
|
|
2449
|
-
|
|
2450
|
-
let
|
|
2454
|
+
Rt++, (ki = c.block) != null && ki.is_empty && vt++;
|
|
2455
|
+
let R = 0, C = 0, k = A(c);
|
|
2451
2456
|
if (c.prelude)
|
|
2452
2457
|
for (const g of c.prelude.children)
|
|
2453
|
-
g.type === me &&
|
|
2458
|
+
g.type === me && R++;
|
|
2454
2459
|
if (c.block)
|
|
2455
2460
|
for (const g of c.block.children)
|
|
2456
|
-
g.type ===
|
|
2457
|
-
|
|
2461
|
+
g.type === Zt && C++;
|
|
2462
|
+
Tt.push(R + C), Is.p(R + C, k), St.push(R), Hs.p(R, k), Ot.push(C), Ps.p(C, k), Nt.push(F), Ds.p(F, k);
|
|
2458
2463
|
}
|
|
2459
2464
|
else if (c.type === me) {
|
|
2460
|
-
if (
|
|
2461
|
-
return
|
|
2462
|
-
let
|
|
2463
|
-
|
|
2464
|
-
let
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
}),
|
|
2468
|
-
|
|
2469
|
-
}),
|
|
2470
|
-
Gs.p(
|
|
2471
|
-
}),
|
|
2472
|
-
|
|
2473
|
-
|
|
2465
|
+
if (jt)
|
|
2466
|
+
return P;
|
|
2467
|
+
let R = A(c);
|
|
2468
|
+
Pt.push(F > 0 ? F - 1 : 0), Vs.p(F > 0 ? F - 1 : 0, R), Fs.add(c.text);
|
|
2469
|
+
let C = os(c);
|
|
2470
|
+
et.push(C), $s.p(C, R), $r(c, (U) => {
|
|
2471
|
+
Ut.p(U.toLowerCase(), R);
|
|
2472
|
+
}), Br(c, (U) => {
|
|
2473
|
+
Ht.p(U, R);
|
|
2474
|
+
}), Gr(c, (U) => {
|
|
2475
|
+
Gs.p(U.toLowerCase(), R);
|
|
2476
|
+
}), Wr(c, (U) => {
|
|
2477
|
+
Ws.p(U.toLowerCase(), R);
|
|
2478
|
+
}), z(c, (U) => {
|
|
2479
|
+
var G;
|
|
2480
|
+
U.type === kt && Ys.p(((G = U.name) == null ? void 0 : G.toLowerCase()) ?? "", R);
|
|
2481
|
+
}), Yr(c, (U) => {
|
|
2482
|
+
let G = U.name.trim() === "" ? " " : U.name;
|
|
2483
|
+
Qs.p(G, U.loc);
|
|
2474
2484
|
});
|
|
2475
|
-
let k = gt(c), [g, E,
|
|
2476
|
-
return Ks.p(k.toString(),
|
|
2477
|
-
} else if (c.type ===
|
|
2478
|
-
Ie++,
|
|
2479
|
-
let
|
|
2480
|
-
|
|
2485
|
+
let k = gt(c), [g, E, B] = k;
|
|
2486
|
+
return Ks.p(k.toString(), R), Ms.push(g), zs.push(E), qs.push(B), ue === void 0 && (ue = k), fe === void 0 && (fe = k), fe !== void 0 && qi(fe, k) < 0 && (fe = k), ue !== void 0 && qi(ue, k) > 0 && (ue = k), Bs.push(k), g > 0 && It.p(c.text, R), P;
|
|
2487
|
+
} else if (c.type === Zt) {
|
|
2488
|
+
Ie++, js.add(c.text);
|
|
2489
|
+
let R = A(c), C = F > 0 ? F - 1 : 0;
|
|
2490
|
+
Mt.push(C), Zs.p(C, R);
|
|
2481
2491
|
let k = 1;
|
|
2482
|
-
c.is_important && (k++, c.text.toLowerCase().includes("!important") ||
|
|
2483
|
-
let { is_important: g, property: E, is_browserhack:
|
|
2492
|
+
c.is_important && (k++, c.text.toLowerCase().includes("!important") || $t.p("!ie", A(c.value)), jt && (Dt++, k++)), Xs.push(k);
|
|
2493
|
+
let { is_important: g, property: E, is_browserhack: B, is_vendor_prefixed: U } = c;
|
|
2484
2494
|
if (!E) return;
|
|
2485
2495
|
let G = A(c);
|
|
2486
2496
|
G.length = E.length;
|
|
2487
|
-
let
|
|
2488
|
-
He.p(
|
|
2497
|
+
let O = Mi(E);
|
|
2498
|
+
He.p(O, G), g && tt++, U ? (Pe.push(2), qt.p(E, G)) : ws(E) ? (st.p(E, G), Pe.push(g ? 3 : 2), g && Ft.p(E, G)) : B ? (zt.p(E.charAt(0), G), Pe.push(2)) : Pe.push(1);
|
|
2489
2499
|
{
|
|
2490
|
-
let
|
|
2500
|
+
let D = c.value, { text: L } = D, v = A(D), lt = 1;
|
|
2491
2501
|
if (xt.has(L)) {
|
|
2492
|
-
De.p(L.toLowerCase(),
|
|
2502
|
+
De.p(L.toLowerCase(), v), Kt.push(lt);
|
|
2493
2503
|
return;
|
|
2494
2504
|
}
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2497
|
-
}),
|
|
2498
|
-
|
|
2505
|
+
if (kl(D, (x) => {
|
|
2506
|
+
Js.p(x.toLowerCase(), v), lt++;
|
|
2507
|
+
}), Fi(D) && ($t.p("\\9", v), L = L.slice(0, -2), lt++), Kt.push(lt), El.has(O))
|
|
2508
|
+
ul(D) && li.p(O, v);
|
|
2499
2509
|
else {
|
|
2500
|
-
if (
|
|
2501
|
-
return
|
|
2502
|
-
if (
|
|
2503
|
-
if (!
|
|
2504
|
-
let x =
|
|
2505
|
-
|
|
2510
|
+
if (O === "z-index")
|
|
2511
|
+
return ei.p(L, v), P;
|
|
2512
|
+
if (O === "font") {
|
|
2513
|
+
if (!is.has(L)) {
|
|
2514
|
+
let x = dl(D, function(Z) {
|
|
2515
|
+
Z.type === "keyword" && De.p(Z.value.toLowerCase(), v);
|
|
2506
2516
|
});
|
|
2507
2517
|
if (!x)
|
|
2508
|
-
return
|
|
2509
|
-
let { font_size:
|
|
2510
|
-
|
|
2518
|
+
return P;
|
|
2519
|
+
let { font_size: X, line_height: S, font_family: T } = x;
|
|
2520
|
+
T && Bt.p(T, v), X && it.p(X.toLowerCase(), v), S && rt.p(S.toLowerCase(), v);
|
|
2511
2521
|
}
|
|
2512
|
-
} else if (
|
|
2513
|
-
if (!
|
|
2522
|
+
} else if (O === "font-size") {
|
|
2523
|
+
if (!is.has(L)) {
|
|
2514
2524
|
let x = L.toLowerCase();
|
|
2515
|
-
x.includes("var(") ?
|
|
2525
|
+
x.includes("var(") ? it.p(L, v) : it.p(x, v);
|
|
2516
2526
|
}
|
|
2517
2527
|
} else {
|
|
2518
|
-
if (
|
|
2519
|
-
return
|
|
2520
|
-
if (
|
|
2528
|
+
if (O === "font-family")
|
|
2529
|
+
return is.has(L) || Bt.p(L, v), P;
|
|
2530
|
+
if (O === "line-height") {
|
|
2521
2531
|
let x = L.toLowerCase();
|
|
2522
|
-
x.includes("var(") ?
|
|
2532
|
+
x.includes("var(") ? rt.p(L, v) : rt.p(x, v);
|
|
2523
2533
|
} else {
|
|
2524
|
-
if (
|
|
2525
|
-
return
|
|
2526
|
-
x.type === "fn" ?
|
|
2527
|
-
}),
|
|
2528
|
-
if (
|
|
2529
|
-
for (let x of
|
|
2534
|
+
if (O === "transition" || O === "animation")
|
|
2535
|
+
return ml(D.children, function(x) {
|
|
2536
|
+
x.type === "fn" ? Gt.p(x.value.text.toLowerCase(), v) : x.type === "duration" ? nt.p(x.value.text.toLowerCase(), v) : x.type === "keyword" && De.p(x.value.text.toLowerCase(), v);
|
|
2537
|
+
}), P;
|
|
2538
|
+
if (O === "animation-duration" || O === "transition-duration") {
|
|
2539
|
+
for (let x of D.children)
|
|
2530
2540
|
if (x.type !== Re) {
|
|
2531
|
-
let
|
|
2532
|
-
/var\(/i.test(
|
|
2541
|
+
let X = x.text;
|
|
2542
|
+
/var\(/i.test(X) ? nt.p(X, v) : nt.p(X.toLowerCase(), v);
|
|
2533
2543
|
}
|
|
2534
|
-
} else if (
|
|
2535
|
-
for (let x of
|
|
2536
|
-
x.type !== Re &&
|
|
2537
|
-
else
|
|
2544
|
+
} else if (O === "transition-timing-function" || O === "animation-timing-function")
|
|
2545
|
+
for (let x of D.children)
|
|
2546
|
+
x.type !== Re && Gt.p(x.text, v);
|
|
2547
|
+
else O === "container-name" ? Je.p(L, v) : O === "container" ? ((wi = D.first_child) == null ? void 0 : wi.type) === _e && Je.p(D.first_child.text, v) : yl.has(O) ? ni.push(L, E, v) : O === "text-shadow" ? ti.p(L, v) : O === "box-shadow" && si.p(L, v);
|
|
2538
2548
|
}
|
|
2539
2549
|
}
|
|
2540
2550
|
}
|
|
2541
|
-
let
|
|
2542
|
-
|
|
2543
|
-
var
|
|
2551
|
+
let yr = Fi(D);
|
|
2552
|
+
z(D, (x) => {
|
|
2553
|
+
var X;
|
|
2544
2554
|
switch (x.type) {
|
|
2545
2555
|
case mt: {
|
|
2546
|
-
let S = ((
|
|
2547
|
-
return
|
|
2556
|
+
let S = ((X = x.unit) == null ? void 0 : X.toLowerCase()) ?? "", T = A(x);
|
|
2557
|
+
return ii.push(S, E, T), P;
|
|
2548
2558
|
}
|
|
2549
|
-
case
|
|
2559
|
+
case Dr: {
|
|
2550
2560
|
let S = x.text;
|
|
2551
2561
|
if (!S || !S.startsWith("#"))
|
|
2552
|
-
return
|
|
2553
|
-
let
|
|
2554
|
-
|
|
2555
|
-
let
|
|
2556
|
-
|
|
2562
|
+
return P;
|
|
2563
|
+
let T = S.toLowerCase();
|
|
2564
|
+
yr && !T.endsWith("\\9") && (T = T + "\\9");
|
|
2565
|
+
let Z = T.length - 1;
|
|
2566
|
+
ls("\\9", T) && (Z = Z - 2);
|
|
2557
2567
|
let Fe = A(x);
|
|
2558
|
-
return we.push(
|
|
2568
|
+
return we.push(T, E, Fe), Ae.p("hex" + Z, Fe), P;
|
|
2559
2569
|
}
|
|
2560
2570
|
case _e: {
|
|
2561
|
-
let S = x.text,
|
|
2562
|
-
if (
|
|
2563
|
-
return
|
|
2564
|
-
xt.has(S) && De.p(S.toLowerCase(),
|
|
2565
|
-
let
|
|
2566
|
-
if (
|
|
2567
|
-
return
|
|
2568
|
-
if (
|
|
2571
|
+
let S = x.text, T = A(x);
|
|
2572
|
+
if (O === "font" || O === "font-family")
|
|
2573
|
+
return P;
|
|
2574
|
+
xt.has(S) && De.p(S.toLowerCase(), T);
|
|
2575
|
+
let Z = S.length;
|
|
2576
|
+
if (Z > 20 || Z < 3)
|
|
2577
|
+
return P;
|
|
2578
|
+
if (_l.has(S)) {
|
|
2569
2579
|
let Fe = S.toLowerCase();
|
|
2570
|
-
we.push(Fe, E,
|
|
2580
|
+
we.push(Fe, E, T), Ae.p(Fe, T);
|
|
2571
2581
|
return;
|
|
2572
2582
|
}
|
|
2573
|
-
if (
|
|
2574
|
-
we.push(S.toLowerCase(), E,
|
|
2583
|
+
if (al.has(S)) {
|
|
2584
|
+
we.push(S.toLowerCase(), E, T), Ae.p("named", T);
|
|
2575
2585
|
return;
|
|
2576
2586
|
}
|
|
2577
|
-
if (
|
|
2578
|
-
we.push(S.toLowerCase(), E,
|
|
2587
|
+
if (hl.has(S)) {
|
|
2588
|
+
we.push(S.toLowerCase(), E, T), Ae.p("system", T);
|
|
2579
2589
|
return;
|
|
2580
2590
|
}
|
|
2581
|
-
return
|
|
2591
|
+
return P;
|
|
2582
2592
|
}
|
|
2583
2593
|
case ks: {
|
|
2584
|
-
let S = x.name,
|
|
2585
|
-
if (
|
|
2586
|
-
we.push(x.text, E,
|
|
2594
|
+
let S = x.name, T = A(x);
|
|
2595
|
+
if (cl.has(S)) {
|
|
2596
|
+
we.push(x.text, E, T), Ae.p(S.toLowerCase(), T);
|
|
2587
2597
|
return;
|
|
2588
2598
|
}
|
|
2589
|
-
if (
|
|
2590
|
-
|
|
2599
|
+
if (ls("gradient", S)) {
|
|
2600
|
+
ri.p(x.text, T);
|
|
2591
2601
|
return;
|
|
2592
2602
|
}
|
|
2593
2603
|
}
|
|
2594
2604
|
}
|
|
2595
2605
|
});
|
|
2596
2606
|
}
|
|
2597
|
-
} else if (c.type ===
|
|
2598
|
-
let { value:
|
|
2599
|
-
if (
|
|
2600
|
-
let k =
|
|
2607
|
+
} else if (c.type === Fr) {
|
|
2608
|
+
let { value: R } = c, C = Gi(R || "");
|
|
2609
|
+
if (Bi(C, "data:")) {
|
|
2610
|
+
let k = C.length, g = Al(C);
|
|
2601
2611
|
h.total++, a += k;
|
|
2602
2612
|
let E = {
|
|
2603
2613
|
line: c.line,
|
|
@@ -2606,27 +2616,27 @@ function Fi(r, e, t) {
|
|
|
2606
2616
|
length: c.length
|
|
2607
2617
|
};
|
|
2608
2618
|
if (h.unique.has(g)) {
|
|
2609
|
-
let
|
|
2610
|
-
|
|
2619
|
+
let B = h.unique.get(g);
|
|
2620
|
+
B.count++, B.size += k, h.unique.set(g, B), t && B.uniqueWithLocations && B.uniqueWithLocations.push(E);
|
|
2611
2621
|
} else {
|
|
2612
|
-
let
|
|
2622
|
+
let B = {
|
|
2613
2623
|
count: 1,
|
|
2614
2624
|
size: k,
|
|
2615
2625
|
uniqueWithLocations: t ? [E] : void 0
|
|
2616
2626
|
};
|
|
2617
|
-
h.unique.set(g,
|
|
2627
|
+
h.unique.set(g, B);
|
|
2618
2628
|
}
|
|
2619
2629
|
}
|
|
2620
|
-
} else if (c.type ===
|
|
2621
|
-
return c.name && Ts.p(c.name.toLowerCase(), A(c)),
|
|
2630
|
+
} else if (c.type === $i)
|
|
2631
|
+
return c.name && Ts.p(c.name.toLowerCase(), A(c)), P;
|
|
2622
2632
|
});
|
|
2623
|
-
let
|
|
2633
|
+
let oi = js.size, ye = et.size(), Wt = Ms.aggregate(), Yt = zs.aggregate(), Qt = qs.aggregate(), ai = Fs.size, b = Object.assign, hi = r.length, Vt = N.length, ci = f.aggregate(), _i = et.aggregate(), ui = Xs.aggregate(), fi = Pe.aggregate(), pi = Kt.aggregate(), di = d.c();
|
|
2624
2634
|
return {
|
|
2625
2635
|
stylesheet: {
|
|
2626
|
-
sourceLinesOfCode:
|
|
2636
|
+
sourceLinesOfCode: di.total + ye + Ie + Lt.size(),
|
|
2627
2637
|
linesOfCode: i,
|
|
2628
|
-
size:
|
|
2629
|
-
complexity:
|
|
2638
|
+
size: hi,
|
|
2639
|
+
complexity: ci.sum + _i.sum + ui.sum + fi.sum + pi.sum,
|
|
2630
2640
|
comments: {
|
|
2631
2641
|
total: n,
|
|
2632
2642
|
size: l
|
|
@@ -2634,26 +2644,26 @@ function Fi(r, e, t) {
|
|
|
2634
2644
|
embeddedContent: {
|
|
2635
2645
|
size: {
|
|
2636
2646
|
total: a,
|
|
2637
|
-
ratio:
|
|
2647
|
+
ratio: H(a, hi)
|
|
2638
2648
|
},
|
|
2639
2649
|
types: {
|
|
2640
2650
|
total: h.total,
|
|
2641
2651
|
totalUnique: h.unique.size,
|
|
2642
|
-
uniquenessRatio:
|
|
2652
|
+
uniquenessRatio: H(h.unique.size, h.total),
|
|
2643
2653
|
unique: Object.fromEntries(h.unique)
|
|
2644
2654
|
}
|
|
2645
2655
|
}
|
|
2646
2656
|
},
|
|
2647
|
-
atrules: b(
|
|
2657
|
+
atrules: b(di, {
|
|
2648
2658
|
fontface: b(
|
|
2649
2659
|
{
|
|
2650
|
-
total:
|
|
2651
|
-
totalUnique:
|
|
2660
|
+
total: Vt,
|
|
2661
|
+
totalUnique: Vt,
|
|
2652
2662
|
unique: N,
|
|
2653
|
-
uniquenessRatio:
|
|
2663
|
+
uniquenessRatio: Vt === 0 ? 0 : 1
|
|
2654
2664
|
},
|
|
2655
2665
|
t ? {
|
|
2656
|
-
uniqueWithLocations:
|
|
2666
|
+
uniqueWithLocations: Cs.c().uniqueWithLocations
|
|
2657
2667
|
} : {}
|
|
2658
2668
|
),
|
|
2659
2669
|
import: bs.c(),
|
|
@@ -2661,53 +2671,53 @@ function Fi(r, e, t) {
|
|
|
2661
2671
|
browserhacks: vs.c(),
|
|
2662
2672
|
features: Ts.c()
|
|
2663
2673
|
}),
|
|
2664
|
-
charset:
|
|
2665
|
-
supports: b(
|
|
2666
|
-
browserhacks:
|
|
2674
|
+
charset: Ss.c(),
|
|
2675
|
+
supports: b(Et.c(), {
|
|
2676
|
+
browserhacks: Os.c()
|
|
2667
2677
|
}),
|
|
2668
|
-
keyframes: b(
|
|
2678
|
+
keyframes: b(yt.c(), {
|
|
2669
2679
|
prefixed: b(Ct.c(), {
|
|
2670
|
-
ratio:
|
|
2680
|
+
ratio: H(Ct.size(), yt.size())
|
|
2671
2681
|
})
|
|
2672
2682
|
}),
|
|
2673
2683
|
container: b(Ns.c(), {
|
|
2674
|
-
names:
|
|
2684
|
+
names: Je.c()
|
|
2675
2685
|
}),
|
|
2676
|
-
layer:
|
|
2686
|
+
layer: Ze.c(),
|
|
2677
2687
|
property: Ls.c(),
|
|
2678
|
-
complexity:
|
|
2688
|
+
complexity: ci,
|
|
2679
2689
|
nesting: b(
|
|
2680
|
-
|
|
2690
|
+
bt.aggregate(),
|
|
2681
2691
|
{
|
|
2682
|
-
items:
|
|
2692
|
+
items: bt.toArray()
|
|
2683
2693
|
},
|
|
2684
2694
|
Us.c()
|
|
2685
2695
|
)
|
|
2686
2696
|
}),
|
|
2687
2697
|
rules: {
|
|
2688
|
-
total:
|
|
2698
|
+
total: Rt,
|
|
2689
2699
|
empty: {
|
|
2690
|
-
total:
|
|
2691
|
-
ratio:
|
|
2700
|
+
total: vt,
|
|
2701
|
+
ratio: H(vt, Rt)
|
|
2692
2702
|
},
|
|
2693
2703
|
sizes: b(
|
|
2694
|
-
|
|
2704
|
+
Tt.aggregate(),
|
|
2695
2705
|
{
|
|
2696
|
-
items:
|
|
2706
|
+
items: Tt.toArray()
|
|
2697
2707
|
},
|
|
2698
2708
|
Is.c()
|
|
2699
2709
|
),
|
|
2700
2710
|
nesting: b(
|
|
2701
|
-
|
|
2711
|
+
Nt.aggregate(),
|
|
2702
2712
|
{
|
|
2703
|
-
items:
|
|
2713
|
+
items: Nt.toArray()
|
|
2704
2714
|
},
|
|
2705
2715
|
Ds.c()
|
|
2706
2716
|
),
|
|
2707
2717
|
selectors: b(
|
|
2708
|
-
|
|
2718
|
+
St.aggregate(),
|
|
2709
2719
|
{
|
|
2710
|
-
items:
|
|
2720
|
+
items: St.toArray()
|
|
2711
2721
|
},
|
|
2712
2722
|
Hs.c()
|
|
2713
2723
|
),
|
|
@@ -2720,9 +2730,9 @@ function Fi(r, e, t) {
|
|
|
2720
2730
|
)
|
|
2721
2731
|
},
|
|
2722
2732
|
selectors: {
|
|
2723
|
-
total:
|
|
2724
|
-
totalUnique:
|
|
2725
|
-
uniquenessRatio:
|
|
2733
|
+
total: ye,
|
|
2734
|
+
totalUnique: ai,
|
|
2735
|
+
uniquenessRatio: H(ai, ye),
|
|
2726
2736
|
specificity: b(
|
|
2727
2737
|
{
|
|
2728
2738
|
/** @type Specificity */
|
|
@@ -2730,97 +2740,99 @@ function Fi(r, e, t) {
|
|
|
2730
2740
|
/** @type Specificity */
|
|
2731
2741
|
max: ue === void 0 ? [0, 0, 0] : ue,
|
|
2732
2742
|
/** @type Specificity */
|
|
2733
|
-
sum: [
|
|
2743
|
+
sum: [Wt.sum, Yt.sum, Qt.sum],
|
|
2734
2744
|
/** @type Specificity */
|
|
2735
|
-
mean: [
|
|
2745
|
+
mean: [Wt.mean, Yt.mean, Qt.mean],
|
|
2736
2746
|
/** @type Specificity */
|
|
2737
|
-
mode: [
|
|
2747
|
+
mode: [Wt.mode, Yt.mode, Qt.mode],
|
|
2738
2748
|
/** @type Specificity */
|
|
2739
2749
|
items: Bs
|
|
2740
2750
|
},
|
|
2741
2751
|
Ks.c()
|
|
2742
2752
|
),
|
|
2743
|
-
complexity: b(
|
|
2744
|
-
items:
|
|
2753
|
+
complexity: b(_i, $s.c(), {
|
|
2754
|
+
items: et.toArray()
|
|
2745
2755
|
}),
|
|
2746
2756
|
nesting: b(
|
|
2747
|
-
|
|
2757
|
+
Pt.aggregate(),
|
|
2748
2758
|
{
|
|
2749
|
-
items:
|
|
2759
|
+
items: Pt.toArray()
|
|
2750
2760
|
},
|
|
2751
|
-
|
|
2761
|
+
Vs.c()
|
|
2752
2762
|
),
|
|
2753
|
-
id: b(
|
|
2754
|
-
ratio:
|
|
2763
|
+
id: b(It.c(), {
|
|
2764
|
+
ratio: H(It.size(), ye)
|
|
2755
2765
|
}),
|
|
2756
2766
|
pseudoClasses: Gs.c(),
|
|
2757
|
-
|
|
2758
|
-
|
|
2767
|
+
pseudoElements: Ws.c(),
|
|
2768
|
+
accessibility: b(Ht.c(), {
|
|
2769
|
+
ratio: H(Ht.size(), ye)
|
|
2759
2770
|
}),
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2771
|
+
attributes: Ys.c(),
|
|
2772
|
+
keyframes: Lt.c(),
|
|
2773
|
+
prefixed: b(Ut.c(), {
|
|
2774
|
+
ratio: H(Ut.size(), ye)
|
|
2763
2775
|
}),
|
|
2764
|
-
combinators:
|
|
2776
|
+
combinators: Qs.c()
|
|
2765
2777
|
},
|
|
2766
2778
|
declarations: {
|
|
2767
2779
|
total: Ie,
|
|
2768
|
-
totalUnique:
|
|
2769
|
-
uniquenessRatio:
|
|
2780
|
+
totalUnique: oi,
|
|
2781
|
+
uniquenessRatio: H(oi, Ie),
|
|
2770
2782
|
importants: {
|
|
2771
|
-
total:
|
|
2772
|
-
ratio:
|
|
2783
|
+
total: tt,
|
|
2784
|
+
ratio: H(tt, Ie),
|
|
2773
2785
|
inKeyframes: {
|
|
2774
|
-
total:
|
|
2775
|
-
ratio:
|
|
2786
|
+
total: Dt,
|
|
2787
|
+
ratio: H(Dt, tt)
|
|
2776
2788
|
}
|
|
2777
2789
|
},
|
|
2778
|
-
complexity:
|
|
2790
|
+
complexity: ui,
|
|
2779
2791
|
nesting: b(
|
|
2780
|
-
|
|
2792
|
+
Mt.aggregate(),
|
|
2781
2793
|
{
|
|
2782
|
-
items:
|
|
2794
|
+
items: Mt.toArray()
|
|
2783
2795
|
},
|
|
2784
|
-
|
|
2796
|
+
Zs.c()
|
|
2785
2797
|
)
|
|
2786
2798
|
},
|
|
2787
2799
|
properties: b(He.c(), {
|
|
2788
|
-
prefixed: b(
|
|
2789
|
-
ratio:
|
|
2800
|
+
prefixed: b(qt.c(), {
|
|
2801
|
+
ratio: H(qt.size(), He.size())
|
|
2790
2802
|
}),
|
|
2791
|
-
custom: b(
|
|
2792
|
-
ratio:
|
|
2793
|
-
importants: b(
|
|
2794
|
-
ratio:
|
|
2803
|
+
custom: b(st.c(), {
|
|
2804
|
+
ratio: H(st.size(), He.size()),
|
|
2805
|
+
importants: b(Ft.c(), {
|
|
2806
|
+
ratio: H(Ft.size(), st.size())
|
|
2795
2807
|
})
|
|
2796
2808
|
}),
|
|
2797
|
-
browserhacks: b(
|
|
2798
|
-
ratio:
|
|
2809
|
+
browserhacks: b(zt.c(), {
|
|
2810
|
+
ratio: H(zt.size(), He.size())
|
|
2799
2811
|
}),
|
|
2800
|
-
complexity:
|
|
2812
|
+
complexity: fi
|
|
2801
2813
|
}),
|
|
2802
2814
|
values: {
|
|
2803
2815
|
colors: b(we.count(), {
|
|
2804
2816
|
formats: Ae.c()
|
|
2805
2817
|
}),
|
|
2806
|
-
gradients:
|
|
2807
|
-
fontFamilies:
|
|
2808
|
-
fontSizes:
|
|
2809
|
-
lineHeights:
|
|
2810
|
-
zindexes:
|
|
2811
|
-
textShadows:
|
|
2812
|
-
boxShadows:
|
|
2813
|
-
borderRadiuses:
|
|
2818
|
+
gradients: ri.c(),
|
|
2819
|
+
fontFamilies: Bt.c(),
|
|
2820
|
+
fontSizes: it.c(),
|
|
2821
|
+
lineHeights: rt.c(),
|
|
2822
|
+
zindexes: ei.c(),
|
|
2823
|
+
textShadows: ti.c(),
|
|
2824
|
+
boxShadows: si.c(),
|
|
2825
|
+
borderRadiuses: ni.count(),
|
|
2814
2826
|
animations: {
|
|
2815
|
-
durations:
|
|
2816
|
-
timingFunctions:
|
|
2827
|
+
durations: nt.c(),
|
|
2828
|
+
timingFunctions: Gt.c()
|
|
2817
2829
|
},
|
|
2818
|
-
prefixes:
|
|
2819
|
-
browserhacks:
|
|
2820
|
-
units:
|
|
2821
|
-
complexity:
|
|
2830
|
+
prefixes: Js.c(),
|
|
2831
|
+
browserhacks: $t.c(),
|
|
2832
|
+
units: ii.count(),
|
|
2833
|
+
complexity: pi,
|
|
2822
2834
|
keywords: De.c(),
|
|
2823
|
-
resets:
|
|
2835
|
+
resets: li.c()
|
|
2824
2836
|
},
|
|
2825
2837
|
__meta__: {
|
|
2826
2838
|
parseTime: p - o,
|
|
@@ -2829,25 +2841,25 @@ function Fi(r, e, t) {
|
|
|
2829
2841
|
}
|
|
2830
2842
|
};
|
|
2831
2843
|
}
|
|
2832
|
-
function
|
|
2844
|
+
function qi(r, e) {
|
|
2833
2845
|
return r[0] === e[0] ? r[1] === e[1] ? e[2] - r[2] : e[1] - r[1] : e[0] - r[0];
|
|
2834
2846
|
}
|
|
2835
2847
|
export {
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2848
|
+
W as KeywordSet,
|
|
2849
|
+
Tl as analyze,
|
|
2850
|
+
Pi as calculateSpecificity,
|
|
2851
|
+
cl as colorFunctions,
|
|
2852
|
+
_l as colorKeywords,
|
|
2853
|
+
qi as compareSpecificity,
|
|
2842
2854
|
xt as cssKeywords,
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2855
|
+
vl as hasVendorPrefix,
|
|
2856
|
+
Br as isAccessibilitySelector,
|
|
2857
|
+
zr as isMediaBrowserhack,
|
|
2858
|
+
Cl as isPropertyHack,
|
|
2859
|
+
$r as isSelectorPrefixed,
|
|
2860
|
+
Mr as isSupportsBrowserhack,
|
|
2861
|
+
kl as isValuePrefixed,
|
|
2862
|
+
al as namedColors,
|
|
2863
|
+
os as selectorComplexity,
|
|
2864
|
+
hl as systemColors
|
|
2853
2865
|
};
|