@projectwallace/css-analyzer 5.14.0 → 6.0.0-beta.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.
@@ -0,0 +1,3549 @@
1
+ import ii from "css-tree/parser";
2
+ import ue from "css-tree/walker";
3
+ let $e = null;
4
+ class V {
5
+ static createItem(e) {
6
+ return {
7
+ prev: null,
8
+ next: null,
9
+ data: e
10
+ };
11
+ }
12
+ constructor() {
13
+ this.head = null, this.tail = null, this.cursor = null;
14
+ }
15
+ createItem(e) {
16
+ return V.createItem(e);
17
+ }
18
+ // cursor helpers
19
+ allocateCursor(e, n) {
20
+ let r;
21
+ return $e !== null ? (r = $e, $e = $e.cursor, r.prev = e, r.next = n, r.cursor = this.cursor) : r = {
22
+ prev: e,
23
+ next: n,
24
+ cursor: this.cursor
25
+ }, this.cursor = r, r;
26
+ }
27
+ releaseCursor() {
28
+ const { cursor: e } = this;
29
+ this.cursor = e.cursor, e.prev = null, e.next = null, e.cursor = $e, $e = e;
30
+ }
31
+ updateCursors(e, n, r, i) {
32
+ let { cursor: o } = this;
33
+ for (; o !== null; )
34
+ o.prev === e && (o.prev = n), o.next === r && (o.next = i), o = o.cursor;
35
+ }
36
+ *[Symbol.iterator]() {
37
+ for (let e = this.head; e !== null; e = e.next)
38
+ yield e.data;
39
+ }
40
+ // getters
41
+ get size() {
42
+ let e = 0;
43
+ for (let n = this.head; n !== null; n = n.next)
44
+ e++;
45
+ return e;
46
+ }
47
+ get isEmpty() {
48
+ return this.head === null;
49
+ }
50
+ get first() {
51
+ return this.head && this.head.data;
52
+ }
53
+ get last() {
54
+ return this.tail && this.tail.data;
55
+ }
56
+ // convertors
57
+ fromArray(e) {
58
+ let n = null;
59
+ this.head = null;
60
+ for (let r of e) {
61
+ const i = V.createItem(r);
62
+ n !== null ? n.next = i : this.head = i, i.prev = n, n = i;
63
+ }
64
+ return this.tail = n, this;
65
+ }
66
+ toArray() {
67
+ return [...this];
68
+ }
69
+ toJSON() {
70
+ return [...this];
71
+ }
72
+ // array-like methods
73
+ forEach(e, n = this) {
74
+ const r = this.allocateCursor(null, this.head);
75
+ for (; r.next !== null; ) {
76
+ const i = r.next;
77
+ r.next = i.next, e.call(n, i.data, i, this);
78
+ }
79
+ this.releaseCursor();
80
+ }
81
+ forEachRight(e, n = this) {
82
+ const r = this.allocateCursor(this.tail, null);
83
+ for (; r.prev !== null; ) {
84
+ const i = r.prev;
85
+ r.prev = i.prev, e.call(n, i.data, i, this);
86
+ }
87
+ this.releaseCursor();
88
+ }
89
+ reduce(e, n, r = this) {
90
+ let i = this.allocateCursor(null, this.head), o = n, a;
91
+ for (; i.next !== null; )
92
+ a = i.next, i.next = a.next, o = e.call(r, o, a.data, a, this);
93
+ return this.releaseCursor(), o;
94
+ }
95
+ reduceRight(e, n, r = this) {
96
+ let i = this.allocateCursor(this.tail, null), o = n, a;
97
+ for (; i.prev !== null; )
98
+ a = i.prev, i.prev = a.prev, o = e.call(r, o, a.data, a, this);
99
+ return this.releaseCursor(), o;
100
+ }
101
+ some(e, n = this) {
102
+ for (let r = this.head; r !== null; r = r.next)
103
+ if (e.call(n, r.data, r, this))
104
+ return !0;
105
+ return !1;
106
+ }
107
+ map(e, n = this) {
108
+ const r = new V();
109
+ for (let i = this.head; i !== null; i = i.next)
110
+ r.appendData(e.call(n, i.data, i, this));
111
+ return r;
112
+ }
113
+ filter(e, n = this) {
114
+ const r = new V();
115
+ for (let i = this.head; i !== null; i = i.next)
116
+ e.call(n, i.data, i, this) && r.appendData(i.data);
117
+ return r;
118
+ }
119
+ nextUntil(e, n, r = this) {
120
+ if (e === null)
121
+ return;
122
+ const i = this.allocateCursor(null, e);
123
+ for (; i.next !== null; ) {
124
+ const o = i.next;
125
+ if (i.next = o.next, n.call(r, o.data, o, this))
126
+ break;
127
+ }
128
+ this.releaseCursor();
129
+ }
130
+ prevUntil(e, n, r = this) {
131
+ if (e === null)
132
+ return;
133
+ const i = this.allocateCursor(e, null);
134
+ for (; i.prev !== null; ) {
135
+ const o = i.prev;
136
+ if (i.prev = o.prev, n.call(r, o.data, o, this))
137
+ break;
138
+ }
139
+ this.releaseCursor();
140
+ }
141
+ // mutation
142
+ clear() {
143
+ this.head = null, this.tail = null;
144
+ }
145
+ copy() {
146
+ const e = new V();
147
+ for (let n of this)
148
+ e.appendData(n);
149
+ return e;
150
+ }
151
+ prepend(e) {
152
+ return this.updateCursors(null, e, this.head, e), this.head !== null ? (this.head.prev = e, e.next = this.head) : this.tail = e, this.head = e, this;
153
+ }
154
+ prependData(e) {
155
+ return this.prepend(V.createItem(e));
156
+ }
157
+ append(e) {
158
+ return this.insert(e);
159
+ }
160
+ appendData(e) {
161
+ return this.insert(V.createItem(e));
162
+ }
163
+ insert(e, n = null) {
164
+ if (n !== null)
165
+ if (this.updateCursors(n.prev, e, n, e), n.prev === null) {
166
+ if (this.head !== n)
167
+ throw new Error("before doesn't belong to list");
168
+ this.head = e, n.prev = e, e.next = n, this.updateCursors(null, e);
169
+ } else
170
+ n.prev.next = e, e.prev = n.prev, n.prev = e, e.next = n;
171
+ else
172
+ this.updateCursors(this.tail, e, null, e), this.tail !== null ? (this.tail.next = e, e.prev = this.tail) : this.head = e, this.tail = e;
173
+ return this;
174
+ }
175
+ insertData(e, n) {
176
+ return this.insert(V.createItem(e), n);
177
+ }
178
+ remove(e) {
179
+ if (this.updateCursors(e, e.prev, e, e.next), e.prev !== null)
180
+ e.prev.next = e.next;
181
+ else {
182
+ if (this.head !== e)
183
+ throw new Error("item doesn't belong to list");
184
+ this.head = e.next;
185
+ }
186
+ if (e.next !== null)
187
+ e.next.prev = e.prev;
188
+ else {
189
+ if (this.tail !== e)
190
+ throw new Error("item doesn't belong to list");
191
+ this.tail = e.prev;
192
+ }
193
+ return e.prev = null, e.next = null, e;
194
+ }
195
+ push(e) {
196
+ this.insert(V.createItem(e));
197
+ }
198
+ pop() {
199
+ return this.tail !== null ? this.remove(this.tail) : null;
200
+ }
201
+ unshift(e) {
202
+ this.prepend(V.createItem(e));
203
+ }
204
+ shift() {
205
+ return this.head !== null ? this.remove(this.head) : null;
206
+ }
207
+ prependList(e) {
208
+ return this.insertList(e, this.head);
209
+ }
210
+ appendList(e) {
211
+ return this.insertList(e);
212
+ }
213
+ insertList(e, n) {
214
+ return e.head === null ? this : (n != null ? (this.updateCursors(n.prev, e.tail, n, e.head), n.prev !== null ? (n.prev.next = e.head, e.head.prev = n.prev) : this.head = e.head, n.prev = e.tail, e.tail.next = n) : (this.updateCursors(this.tail, e.tail, null, e.head), this.tail !== null ? (this.tail.next = e.head, e.head.prev = this.tail) : this.head = e.head, this.tail = e.tail), e.head = null, e.tail = null, this);
215
+ }
216
+ replace(e, n) {
217
+ "head" in n ? this.insertList(n, e) : this.insert(n, e), this.remove(e);
218
+ }
219
+ }
220
+ function si(t, e) {
221
+ const n = Object.create(SyntaxError.prototype), r = new Error();
222
+ return Object.assign(n, {
223
+ name: t,
224
+ message: e,
225
+ get stack() {
226
+ return (r.stack || "").replace(/^(.+\n){1,3}/, `${t}: ${e}
227
+ `);
228
+ }
229
+ });
230
+ }
231
+ const Vt = 100, Zn = 60, er = " ";
232
+ function tr({ source: t, line: e, column: n }, r) {
233
+ function i(l, m) {
234
+ return o.slice(l, m).map(
235
+ (S, b) => String(l + b + 1).padStart(c) + " |" + S
236
+ ).join(`
237
+ `);
238
+ }
239
+ const o = t.split(/\r\n?|\n|\f/), a = Math.max(1, e - r) - 1, f = Math.min(e + r, o.length + 1), c = Math.max(4, String(f).length) + 1;
240
+ let s = 0;
241
+ n += (er.length - 1) * (o[e - 1].substr(0, n - 1).match(/\t/g) || []).length, n > Vt && (s = n - Zn + 3, n = Zn - 2);
242
+ for (let l = a; l <= f; l++)
243
+ l >= 0 && l < o.length && (o[l] = o[l].replace(/\t/g, er), o[l] = (s > 0 && o[l].length > s ? "…" : "") + o[l].substr(s, Vt - 2) + (o[l].length > s + Vt - 1 ? "…" : ""));
244
+ return [
245
+ i(a, e),
246
+ new Array(n + c + 2).join("-") + "^",
247
+ i(e, f)
248
+ ].filter(Boolean).join(`
249
+ `);
250
+ }
251
+ function nr(t, e, n, r, i) {
252
+ return Object.assign(si("SyntaxError", t), {
253
+ source: e,
254
+ offset: n,
255
+ line: r,
256
+ column: i,
257
+ sourceFragment(a) {
258
+ return tr({ source: e, line: r, column: i }, isNaN(a) ? 0 : a);
259
+ },
260
+ get formattedMessage() {
261
+ return `Parse error: ${t}
262
+ ` + tr({ source: e, line: r, column: i }, 2);
263
+ }
264
+ });
265
+ }
266
+ const Gt = 0, k = 1, N = 2, j = 3, M = 4, We = 5, oi = 6, ie = 7, se = 8, O = 9, E = 10, D = 11, T = 12, ae = 13, Ar = 14, oe = 15, Z = 16, St = 17, xt = 18, Ke = 19, pt = 20, _e = 21, F = 22, Ct = 23, fn = 24, Ee = 25, ai = 0;
267
+ function W(t) {
268
+ return t >= 48 && t <= 57;
269
+ }
270
+ function Ve(t) {
271
+ return W(t) || // 0 .. 9
272
+ t >= 65 && t <= 70 || // A .. F
273
+ t >= 97 && t <= 102;
274
+ }
275
+ function pn(t) {
276
+ return t >= 65 && t <= 90;
277
+ }
278
+ function li(t) {
279
+ return t >= 97 && t <= 122;
280
+ }
281
+ function ci(t) {
282
+ return pn(t) || li(t);
283
+ }
284
+ function ui(t) {
285
+ return t >= 128;
286
+ }
287
+ function dt(t) {
288
+ return ci(t) || ui(t) || t === 95;
289
+ }
290
+ function Lr(t) {
291
+ return dt(t) || W(t) || t === 45;
292
+ }
293
+ function hi(t) {
294
+ return t >= 0 && t <= 8 || t === 11 || t >= 14 && t <= 31 || t === 127;
295
+ }
296
+ function mt(t) {
297
+ return t === 10 || t === 13 || t === 12;
298
+ }
299
+ function Qe(t) {
300
+ return mt(t) || t === 32 || t === 9;
301
+ }
302
+ function de(t, e) {
303
+ return !(t !== 92 || mt(e) || e === ai);
304
+ }
305
+ function Ht(t, e, n) {
306
+ return t === 45 ? dt(e) || e === 45 || de(e, n) : dt(t) ? !0 : t === 92 ? de(t, e) : !1;
307
+ }
308
+ function Wt(t, e, n) {
309
+ return t === 43 || t === 45 ? W(e) ? 2 : e === 46 && W(n) ? 3 : 0 : t === 46 ? W(e) ? 2 : 0 : W(t) ? 1 : 0;
310
+ }
311
+ function Er(t) {
312
+ return t === 65279 || t === 65534 ? 1 : 0;
313
+ }
314
+ const on = new Array(128), fi = 128, ct = 130, _r = 131, dn = 132, Tr = 133;
315
+ for (let t = 0; t < on.length; t++)
316
+ on[t] = Qe(t) && ct || W(t) && _r || dt(t) && dn || hi(t) && Tr || t || fi;
317
+ function Kt(t) {
318
+ return t < 128 ? on[t] : dn;
319
+ }
320
+ function Me(t, e) {
321
+ return e < t.length ? t.charCodeAt(e) : 0;
322
+ }
323
+ function an(t, e, n) {
324
+ return n === 13 && Me(t, e + 1) === 10 ? 2 : 1;
325
+ }
326
+ function Or(t, e, n) {
327
+ let r = t.charCodeAt(e);
328
+ return pn(r) && (r = r | 32), r === n;
329
+ }
330
+ function gt(t, e, n, r) {
331
+ if (n - e !== r.length || e < 0 || n > t.length)
332
+ return !1;
333
+ for (let i = e; i < n; i++) {
334
+ const o = r.charCodeAt(i - e);
335
+ let a = t.charCodeAt(i);
336
+ if (pn(a) && (a = a | 32), a !== o)
337
+ return !1;
338
+ }
339
+ return !0;
340
+ }
341
+ function pi(t, e) {
342
+ for (; e >= 0 && Qe(t.charCodeAt(e)); e--)
343
+ ;
344
+ return e + 1;
345
+ }
346
+ function st(t, e) {
347
+ for (; e < t.length && Qe(t.charCodeAt(e)); e++)
348
+ ;
349
+ return e;
350
+ }
351
+ function Qt(t, e) {
352
+ for (; e < t.length && W(t.charCodeAt(e)); e++)
353
+ ;
354
+ return e;
355
+ }
356
+ function Ge(t, e) {
357
+ if (e += 2, Ve(Me(t, e - 1))) {
358
+ for (const r = Math.min(t.length, e + 5); e < r && Ve(Me(t, e)); e++)
359
+ ;
360
+ const n = Me(t, e);
361
+ Qe(n) && (e += an(t, e, n));
362
+ }
363
+ return e;
364
+ }
365
+ function ot(t, e) {
366
+ for (; e < t.length; e++) {
367
+ const n = t.charCodeAt(e);
368
+ if (!Lr(n)) {
369
+ if (de(n, Me(t, e + 1))) {
370
+ e = Ge(t, e) - 1;
371
+ continue;
372
+ }
373
+ break;
374
+ }
375
+ }
376
+ return e;
377
+ }
378
+ function Ir(t, e) {
379
+ let n = t.charCodeAt(e);
380
+ if ((n === 43 || n === 45) && (n = t.charCodeAt(e += 1)), W(n) && (e = Qt(t, e + 1), n = t.charCodeAt(e)), n === 46 && W(t.charCodeAt(e + 1)) && (e += 2, e = Qt(t, e)), Or(
381
+ t,
382
+ e,
383
+ 101
384
+ /* e */
385
+ )) {
386
+ let r = 0;
387
+ n = t.charCodeAt(e + 1), (n === 45 || n === 43) && (r = 1, n = t.charCodeAt(e + 2)), W(n) && (e = Qt(t, e + 1 + r + 1));
388
+ }
389
+ return e;
390
+ }
391
+ function Yt(t, e) {
392
+ for (; e < t.length; e++) {
393
+ const n = t.charCodeAt(e);
394
+ if (n === 41) {
395
+ e++;
396
+ break;
397
+ }
398
+ de(n, Me(t, e + 1)) && (e = Ge(t, e));
399
+ }
400
+ return e;
401
+ }
402
+ function di(t) {
403
+ if (t.length === 1 && !Ve(t.charCodeAt(0)))
404
+ return t[0];
405
+ let e = parseInt(t, 16);
406
+ return (e === 0 || // If this number is zero,
407
+ e >= 55296 && e <= 57343 || // or is for a surrogate,
408
+ e > 1114111) && (e = 65533), String.fromCodePoint(e);
409
+ }
410
+ const Nr = [
411
+ "EOF-token",
412
+ "ident-token",
413
+ "function-token",
414
+ "at-keyword-token",
415
+ "hash-token",
416
+ "string-token",
417
+ "bad-string-token",
418
+ "url-token",
419
+ "bad-url-token",
420
+ "delim-token",
421
+ "number-token",
422
+ "percentage-token",
423
+ "dimension-token",
424
+ "whitespace-token",
425
+ "CDO-token",
426
+ "CDC-token",
427
+ "colon-token",
428
+ "semicolon-token",
429
+ "comma-token",
430
+ "[-token",
431
+ "]-token",
432
+ "(-token",
433
+ ")-token",
434
+ "{-token",
435
+ "}-token"
436
+ ], mi = 16 * 1024;
437
+ function kt(t = null, e) {
438
+ return t === null || t.length < e ? new Uint32Array(Math.max(e + 1024, mi)) : t;
439
+ }
440
+ const rr = 10, gi = 12, ir = 13;
441
+ function sr(t) {
442
+ const e = t.source, n = e.length, r = e.length > 0 ? Er(e.charCodeAt(0)) : 0, i = kt(t.lines, n), o = kt(t.columns, n);
443
+ let a = t.startLine, f = t.startColumn;
444
+ for (let c = r; c < n; c++) {
445
+ const s = e.charCodeAt(c);
446
+ i[c] = a, o[c] = f++, (s === rr || s === ir || s === gi) && (s === ir && c + 1 < n && e.charCodeAt(c + 1) === rr && (c++, i[c] = a, o[c] = f), a++, f = 1);
447
+ }
448
+ i[n] = a, o[n] = f, t.lines = i, t.columns = o, t.computed = !0;
449
+ }
450
+ class ki {
451
+ constructor() {
452
+ this.lines = null, this.columns = null, this.computed = !1;
453
+ }
454
+ setSource(e, n = 0, r = 1, i = 1) {
455
+ this.source = e, this.startOffset = n, this.startLine = r, this.startColumn = i, this.computed = !1;
456
+ }
457
+ getLocation(e, n) {
458
+ return this.computed || sr(this), {
459
+ source: n,
460
+ offset: this.startOffset + e,
461
+ line: this.lines[e],
462
+ column: this.columns[e]
463
+ };
464
+ }
465
+ getLocationRange(e, n, r) {
466
+ return this.computed || sr(this), {
467
+ source: r,
468
+ start: {
469
+ offset: this.startOffset + e,
470
+ line: this.lines[e],
471
+ column: this.columns[e]
472
+ },
473
+ end: {
474
+ offset: this.startOffset + n,
475
+ line: this.lines[n],
476
+ column: this.columns[n]
477
+ }
478
+ };
479
+ }
480
+ }
481
+ const X = 16777215, ye = 24, yi = /* @__PURE__ */ new Map([
482
+ [N, F],
483
+ [_e, F],
484
+ [Ke, pt],
485
+ [Ct, fn]
486
+ ]);
487
+ class Si {
488
+ constructor(e, n) {
489
+ this.setSource(e, n);
490
+ }
491
+ reset() {
492
+ this.eof = !1, this.tokenIndex = -1, this.tokenType = 0, this.tokenStart = this.firstCharOffset, this.tokenEnd = this.firstCharOffset;
493
+ }
494
+ setSource(e = "", n = () => {
495
+ }) {
496
+ e = String(e || "");
497
+ const r = e.length, i = kt(this.offsetAndType, e.length + 1), o = kt(this.balance, e.length + 1);
498
+ let a = 0, f = 0, c = 0, s = -1;
499
+ for (this.offsetAndType = null, this.balance = null, n(e, (l, m, S) => {
500
+ switch (l) {
501
+ default:
502
+ o[a] = r;
503
+ break;
504
+ case f: {
505
+ let b = c & X;
506
+ for (c = o[b], f = c >> ye, o[a] = b, o[b++] = a; b < a; b++)
507
+ o[b] === r && (o[b] = a);
508
+ break;
509
+ }
510
+ case _e:
511
+ case N:
512
+ case Ke:
513
+ case Ct:
514
+ o[a] = c, f = yi.get(l), c = f << ye | a;
515
+ break;
516
+ }
517
+ i[a++] = l << ye | S, s === -1 && (s = m);
518
+ }), i[a] = Gt << ye | r, o[a] = r, o[r] = r; c !== 0; ) {
519
+ const l = c & X;
520
+ c = o[l], o[l] = r;
521
+ }
522
+ this.source = e, this.firstCharOffset = s === -1 ? 0 : s, this.tokenCount = a, this.offsetAndType = i, this.balance = o, this.reset(), this.next();
523
+ }
524
+ lookupType(e) {
525
+ return e += this.tokenIndex, e < this.tokenCount ? this.offsetAndType[e] >> ye : Gt;
526
+ }
527
+ lookupOffset(e) {
528
+ return e += this.tokenIndex, e < this.tokenCount ? this.offsetAndType[e - 1] & X : this.source.length;
529
+ }
530
+ lookupValue(e, n) {
531
+ return e += this.tokenIndex, e < this.tokenCount ? gt(
532
+ this.source,
533
+ this.offsetAndType[e - 1] & X,
534
+ this.offsetAndType[e] & X,
535
+ n
536
+ ) : !1;
537
+ }
538
+ getTokenStart(e) {
539
+ return e === this.tokenIndex ? this.tokenStart : e > 0 ? e < this.tokenCount ? this.offsetAndType[e - 1] & X : this.offsetAndType[this.tokenCount] & X : this.firstCharOffset;
540
+ }
541
+ substrToCursor(e) {
542
+ return this.source.substring(e, this.tokenStart);
543
+ }
544
+ isBalanceEdge(e) {
545
+ return this.balance[this.tokenIndex] < e;
546
+ }
547
+ isDelim(e, n) {
548
+ return n ? this.lookupType(n) === O && this.source.charCodeAt(this.lookupOffset(n)) === e : this.tokenType === O && this.source.charCodeAt(this.tokenStart) === e;
549
+ }
550
+ skip(e) {
551
+ let n = this.tokenIndex + e;
552
+ n < this.tokenCount ? (this.tokenIndex = n, this.tokenStart = this.offsetAndType[n - 1] & X, n = this.offsetAndType[n], this.tokenType = n >> ye, this.tokenEnd = n & X) : (this.tokenIndex = this.tokenCount, this.next());
553
+ }
554
+ next() {
555
+ let e = this.tokenIndex + 1;
556
+ e < this.tokenCount ? (this.tokenIndex = e, this.tokenStart = this.tokenEnd, e = this.offsetAndType[e], this.tokenType = e >> ye, this.tokenEnd = e & X) : (this.eof = !0, this.tokenIndex = this.tokenCount, this.tokenType = Gt, this.tokenStart = this.tokenEnd = this.source.length);
557
+ }
558
+ skipSC() {
559
+ for (; this.tokenType === ae || this.tokenType === Ee; )
560
+ this.next();
561
+ }
562
+ skipUntilBalanced(e, n) {
563
+ let r = e, i, o;
564
+ e:
565
+ for (; r < this.tokenCount; r++) {
566
+ if (i = this.balance[r], i < e)
567
+ break e;
568
+ switch (o = r > 0 ? this.offsetAndType[r - 1] & X : this.firstCharOffset, n(this.source.charCodeAt(o))) {
569
+ case 1:
570
+ break e;
571
+ case 2:
572
+ r++;
573
+ break e;
574
+ default:
575
+ this.balance[i] === r && (r = i);
576
+ }
577
+ }
578
+ this.skip(r - this.tokenIndex);
579
+ }
580
+ forEachToken(e) {
581
+ for (let n = 0, r = this.firstCharOffset; n < this.tokenCount; n++) {
582
+ const i = r, o = this.offsetAndType[n], a = o & X, f = o >> ye;
583
+ r = a, e(f, i, a, n);
584
+ }
585
+ }
586
+ dump() {
587
+ const e = new Array(this.tokenCount);
588
+ return this.forEachToken((n, r, i, o) => {
589
+ e[o] = {
590
+ idx: o,
591
+ type: Nr[n],
592
+ chunk: this.source.substring(r, i),
593
+ balance: this.balance[o]
594
+ };
595
+ }), e;
596
+ }
597
+ }
598
+ function $r(t, e) {
599
+ function n(m) {
600
+ return m < f ? t.charCodeAt(m) : 0;
601
+ }
602
+ function r() {
603
+ if (s = Ir(t, s), Ht(n(s), n(s + 1), n(s + 2))) {
604
+ l = T, s = ot(t, s);
605
+ return;
606
+ }
607
+ if (n(s) === 37) {
608
+ l = D, s++;
609
+ return;
610
+ }
611
+ l = E;
612
+ }
613
+ function i() {
614
+ const m = s;
615
+ if (s = ot(t, s), gt(t, m, s, "url") && n(s) === 40) {
616
+ if (s = st(t, s + 1), n(s) === 34 || n(s) === 39) {
617
+ l = N, s = m + 4;
618
+ return;
619
+ }
620
+ a();
621
+ return;
622
+ }
623
+ if (n(s) === 40) {
624
+ l = N, s++;
625
+ return;
626
+ }
627
+ l = k;
628
+ }
629
+ function o(m) {
630
+ for (m || (m = n(s++)), l = We; s < t.length; s++) {
631
+ const S = t.charCodeAt(s);
632
+ switch (Kt(S)) {
633
+ case m:
634
+ s++;
635
+ return;
636
+ case ct:
637
+ if (mt(S)) {
638
+ s += an(t, s, S), l = oi;
639
+ return;
640
+ }
641
+ break;
642
+ case 92:
643
+ if (s === t.length - 1)
644
+ break;
645
+ const b = n(s + 1);
646
+ mt(b) ? s += an(t, s + 1, b) : de(S, b) && (s = Ge(t, s) - 1);
647
+ break;
648
+ }
649
+ }
650
+ }
651
+ function a() {
652
+ for (l = ie, s = st(t, s); s < t.length; s++) {
653
+ const m = t.charCodeAt(s);
654
+ switch (Kt(m)) {
655
+ case 41:
656
+ s++;
657
+ return;
658
+ case ct:
659
+ if (s = st(t, s), n(s) === 41 || s >= t.length) {
660
+ s < t.length && s++;
661
+ return;
662
+ }
663
+ s = Yt(t, s), l = se;
664
+ return;
665
+ case 34:
666
+ case 39:
667
+ case 40:
668
+ case Tr:
669
+ s = Yt(t, s), l = se;
670
+ return;
671
+ case 92:
672
+ if (de(m, n(s + 1))) {
673
+ s = Ge(t, s) - 1;
674
+ break;
675
+ }
676
+ s = Yt(t, s), l = se;
677
+ return;
678
+ }
679
+ }
680
+ }
681
+ t = String(t || "");
682
+ const f = t.length;
683
+ let c = Er(n(0)), s = c, l;
684
+ for (; s < f; ) {
685
+ const m = t.charCodeAt(s);
686
+ switch (Kt(m)) {
687
+ case ct:
688
+ l = ae, s = st(t, s + 1);
689
+ break;
690
+ case 34:
691
+ o();
692
+ break;
693
+ case 35:
694
+ Lr(n(s + 1)) || de(n(s + 1), n(s + 2)) ? (l = M, s = ot(t, s + 1)) : (l = O, s++);
695
+ break;
696
+ case 39:
697
+ o();
698
+ break;
699
+ case 40:
700
+ l = _e, s++;
701
+ break;
702
+ case 41:
703
+ l = F, s++;
704
+ break;
705
+ case 43:
706
+ Wt(m, n(s + 1), n(s + 2)) ? r() : (l = O, s++);
707
+ break;
708
+ case 44:
709
+ l = xt, s++;
710
+ break;
711
+ case 45:
712
+ Wt(m, n(s + 1), n(s + 2)) ? r() : n(s + 1) === 45 && n(s + 2) === 62 ? (l = oe, s = s + 3) : Ht(m, n(s + 1), n(s + 2)) ? i() : (l = O, s++);
713
+ break;
714
+ case 46:
715
+ Wt(m, n(s + 1), n(s + 2)) ? r() : (l = O, s++);
716
+ break;
717
+ case 47:
718
+ n(s + 1) === 42 ? (l = Ee, s = t.indexOf("*/", s + 2), s = s === -1 ? t.length : s + 2) : (l = O, s++);
719
+ break;
720
+ case 58:
721
+ l = Z, s++;
722
+ break;
723
+ case 59:
724
+ l = St, s++;
725
+ break;
726
+ case 60:
727
+ n(s + 1) === 33 && n(s + 2) === 45 && n(s + 3) === 45 ? (l = Ar, s = s + 4) : (l = O, s++);
728
+ break;
729
+ case 64:
730
+ Ht(n(s + 1), n(s + 2), n(s + 3)) ? (l = j, s = ot(t, s + 1)) : (l = O, s++);
731
+ break;
732
+ case 91:
733
+ l = Ke, s++;
734
+ break;
735
+ case 92:
736
+ de(m, n(s + 1)) ? i() : (l = O, s++);
737
+ break;
738
+ case 93:
739
+ l = pt, s++;
740
+ break;
741
+ case 123:
742
+ l = Ct, s++;
743
+ break;
744
+ case 125:
745
+ l = fn, s++;
746
+ break;
747
+ case _r:
748
+ r();
749
+ break;
750
+ case dn:
751
+ i();
752
+ break;
753
+ default:
754
+ l = O, s++;
755
+ }
756
+ e(l, c, c = s);
757
+ }
758
+ }
759
+ function xi(t) {
760
+ const e = this.createList();
761
+ let n = !1;
762
+ const r = {
763
+ recognizer: t
764
+ };
765
+ for (; !this.eof; ) {
766
+ switch (this.tokenType) {
767
+ case Ee:
768
+ this.next();
769
+ continue;
770
+ case ae:
771
+ n = !0, this.next();
772
+ continue;
773
+ }
774
+ let i = t.getNode.call(this, r);
775
+ if (i === void 0)
776
+ break;
777
+ n && (t.onWhiteSpace && t.onWhiteSpace.call(this, i, e, r), n = !1), e.push(i);
778
+ }
779
+ return n && t.onWhiteSpace && t.onWhiteSpace.call(this, null, e, r), e;
780
+ }
781
+ const or = () => {
782
+ }, Ci = 33, bi = 35, Jt = 59, ar = 123, lr = 0;
783
+ function wi(t) {
784
+ return function() {
785
+ return this[t]();
786
+ };
787
+ }
788
+ function Xt(t) {
789
+ const e = /* @__PURE__ */ Object.create(null);
790
+ for (const n in t) {
791
+ const r = t[n], i = r.parse || r;
792
+ i && (e[n] = i);
793
+ }
794
+ return e;
795
+ }
796
+ function vi(t) {
797
+ const e = {
798
+ context: /* @__PURE__ */ Object.create(null),
799
+ scope: Object.assign(/* @__PURE__ */ Object.create(null), t.scope),
800
+ atrule: Xt(t.atrule),
801
+ pseudo: Xt(t.pseudo),
802
+ node: Xt(t.node)
803
+ };
804
+ for (const n in t.parseContext)
805
+ switch (typeof t.parseContext[n]) {
806
+ case "function":
807
+ e.context[n] = t.parseContext[n];
808
+ break;
809
+ case "string":
810
+ e.context[n] = wi(t.parseContext[n]);
811
+ break;
812
+ }
813
+ return {
814
+ config: e,
815
+ ...e,
816
+ ...e.node
817
+ };
818
+ }
819
+ function Ai(t) {
820
+ let e = "", n = "<unknown>", r = !1, i = or, o = !1;
821
+ const a = new ki(), f = Object.assign(new Si(), vi(t || {}), {
822
+ parseAtrulePrelude: !0,
823
+ parseRulePrelude: !0,
824
+ parseValue: !0,
825
+ parseCustomProperty: !1,
826
+ readSequence: xi,
827
+ consumeUntilBalanceEnd: () => 0,
828
+ consumeUntilLeftCurlyBracket(s) {
829
+ return s === ar ? 1 : 0;
830
+ },
831
+ consumeUntilLeftCurlyBracketOrSemicolon(s) {
832
+ return s === ar || s === Jt ? 1 : 0;
833
+ },
834
+ consumeUntilExclamationMarkOrSemicolon(s) {
835
+ return s === Ci || s === Jt ? 1 : 0;
836
+ },
837
+ consumeUntilSemicolonIncluded(s) {
838
+ return s === Jt ? 2 : 0;
839
+ },
840
+ createList() {
841
+ return new V();
842
+ },
843
+ createSingleNodeList(s) {
844
+ return new V().appendData(s);
845
+ },
846
+ getFirstListNode(s) {
847
+ return s && s.first;
848
+ },
849
+ getLastListNode(s) {
850
+ return s && s.last;
851
+ },
852
+ parseWithFallback(s, l) {
853
+ const m = this.tokenIndex;
854
+ try {
855
+ return s.call(this);
856
+ } catch (S) {
857
+ if (o)
858
+ throw S;
859
+ const b = l.call(this, m);
860
+ return o = !0, i(S, b), o = !1, b;
861
+ }
862
+ },
863
+ lookupNonWSType(s) {
864
+ let l;
865
+ do
866
+ if (l = this.lookupType(s++), l !== ae)
867
+ return l;
868
+ while (l !== lr);
869
+ return lr;
870
+ },
871
+ charCodeAt(s) {
872
+ return s >= 0 && s < e.length ? e.charCodeAt(s) : 0;
873
+ },
874
+ substring(s, l) {
875
+ return e.substring(s, l);
876
+ },
877
+ substrToCursor(s) {
878
+ return this.source.substring(s, this.tokenStart);
879
+ },
880
+ cmpChar(s, l) {
881
+ return Or(e, s, l);
882
+ },
883
+ cmpStr(s, l, m) {
884
+ return gt(e, s, l, m);
885
+ },
886
+ consume(s) {
887
+ const l = this.tokenStart;
888
+ return this.eat(s), this.substrToCursor(l);
889
+ },
890
+ consumeFunctionName() {
891
+ const s = e.substring(this.tokenStart, this.tokenEnd - 1);
892
+ return this.eat(N), s;
893
+ },
894
+ consumeNumber(s) {
895
+ const l = e.substring(this.tokenStart, Ir(e, this.tokenStart));
896
+ return this.eat(s), l;
897
+ },
898
+ eat(s) {
899
+ if (this.tokenType !== s) {
900
+ const l = Nr[s].slice(0, -6).replace(/-/g, " ").replace(/^./, (b) => b.toUpperCase());
901
+ let m = `${/[[\](){}]/.test(l) ? `"${l}"` : l} is expected`, S = this.tokenStart;
902
+ switch (s) {
903
+ case k:
904
+ this.tokenType === N || this.tokenType === ie ? (S = this.tokenEnd - 1, m = "Identifier is expected but function found") : m = "Identifier is expected";
905
+ break;
906
+ case M:
907
+ this.isDelim(bi) && (this.next(), S++, m = "Name is expected");
908
+ break;
909
+ case D:
910
+ this.tokenType === E && (S = this.tokenEnd, m = "Percent sign is expected");
911
+ break;
912
+ }
913
+ this.error(m, S);
914
+ }
915
+ this.next();
916
+ },
917
+ eatIdent(s) {
918
+ (this.tokenType !== k || this.lookupValue(0, s) === !1) && this.error(`Identifier "${s}" is expected`), this.next();
919
+ },
920
+ eatDelim(s) {
921
+ this.isDelim(s) || this.error(`Delim "${String.fromCharCode(s)}" is expected`), this.next();
922
+ },
923
+ getLocation(s, l) {
924
+ return r ? a.getLocationRange(
925
+ s,
926
+ l,
927
+ n
928
+ ) : null;
929
+ },
930
+ getLocationFromList(s) {
931
+ if (r) {
932
+ const l = this.getFirstListNode(s), m = this.getLastListNode(s);
933
+ return a.getLocationRange(
934
+ l !== null ? l.loc.start.offset - a.startOffset : this.tokenStart,
935
+ m !== null ? m.loc.end.offset - a.startOffset : this.tokenStart,
936
+ n
937
+ );
938
+ }
939
+ return null;
940
+ },
941
+ error(s, l) {
942
+ const m = typeof l < "u" && l < e.length ? a.getLocation(l) : this.eof ? a.getLocation(pi(e, e.length - 1)) : a.getLocation(this.tokenStart);
943
+ throw new nr(
944
+ s || "Unexpected input",
945
+ e,
946
+ m.offset,
947
+ m.line,
948
+ m.column
949
+ );
950
+ }
951
+ });
952
+ return Object.assign(function(s, l) {
953
+ e = s, l = l || {}, f.setSource(e, $r), a.setSource(
954
+ e,
955
+ l.offset,
956
+ l.line,
957
+ l.column
958
+ ), n = l.filename || "<unknown>", r = !!l.positions, i = typeof l.onParseError == "function" ? l.onParseError : or, o = !1, f.parseAtrulePrelude = "parseAtrulePrelude" in l ? !!l.parseAtrulePrelude : !0, f.parseRulePrelude = "parseRulePrelude" in l ? !!l.parseRulePrelude : !0, f.parseValue = "parseValue" in l ? !!l.parseValue : !0, f.parseCustomProperty = "parseCustomProperty" in l ? !!l.parseCustomProperty : !1;
959
+ const { context: m = "default", onComment: S } = l;
960
+ if (!(m in f.context))
961
+ throw new Error("Unknown context `" + m + "`");
962
+ typeof S == "function" && f.forEachToken((K, q, te) => {
963
+ if (K === Ee) {
964
+ const Ce = f.getLocation(q, te), Te = gt(e, te - 2, te, "*/") ? e.slice(q + 2, te - 2) : e.slice(q + 2, te);
965
+ S(Te, Ce);
966
+ }
967
+ });
968
+ const b = f.context[m].call(f, l);
969
+ return f.eof || f.error(), b;
970
+ }, {
971
+ SyntaxError: nr,
972
+ config: f.config
973
+ });
974
+ }
975
+ const Li = 35, Ei = 38, _i = 42, Ti = 43, Oi = 47, cr = 46, Ii = 62, Ni = 124, $i = 126;
976
+ function Di(t, e) {
977
+ e.last !== null && e.last.type !== "Combinator" && t !== null && t.type !== "Combinator" && e.push({
978
+ // FIXME: this.Combinator() should be used instead
979
+ type: "Combinator",
980
+ loc: null,
981
+ name: " "
982
+ });
983
+ }
984
+ function Pi() {
985
+ switch (this.tokenType) {
986
+ case Ke:
987
+ return this.AttributeSelector();
988
+ case M:
989
+ return this.IdSelector();
990
+ case Z:
991
+ return this.lookupType(1) === Z ? this.PseudoElementSelector() : this.PseudoClassSelector();
992
+ case k:
993
+ return this.TypeSelector();
994
+ case E:
995
+ case D:
996
+ return this.Percentage();
997
+ case T:
998
+ this.charCodeAt(this.tokenStart) === cr && this.error("Identifier is expected", this.tokenStart + 1);
999
+ break;
1000
+ case O: {
1001
+ switch (this.charCodeAt(this.tokenStart)) {
1002
+ case Ti:
1003
+ case Ii:
1004
+ case $i:
1005
+ case Oi:
1006
+ return this.Combinator();
1007
+ case cr:
1008
+ return this.ClassSelector();
1009
+ case _i:
1010
+ case Ni:
1011
+ return this.TypeSelector();
1012
+ case Li:
1013
+ return this.IdSelector();
1014
+ case Ei:
1015
+ return this.NestingSelector();
1016
+ }
1017
+ break;
1018
+ }
1019
+ }
1020
+ }
1021
+ const Mi = {
1022
+ onWhiteSpace: Di,
1023
+ getNode: Pi
1024
+ }, ve = {
1025
+ parse() {
1026
+ return this.createSingleNodeList(
1027
+ this.SelectorList()
1028
+ );
1029
+ }
1030
+ }, Zt = {
1031
+ parse() {
1032
+ return this.createSingleNodeList(
1033
+ this.Selector()
1034
+ );
1035
+ }
1036
+ }, ur = {
1037
+ parse() {
1038
+ return this.createSingleNodeList(
1039
+ this.Identifier()
1040
+ );
1041
+ }
1042
+ }, at = {
1043
+ parse() {
1044
+ return this.createSingleNodeList(
1045
+ this.Nth()
1046
+ );
1047
+ }
1048
+ }, zi = {
1049
+ dir: ur,
1050
+ has: ve,
1051
+ lang: ur,
1052
+ matches: ve,
1053
+ is: ve,
1054
+ "-moz-any": ve,
1055
+ "-webkit-any": ve,
1056
+ where: ve,
1057
+ not: ve,
1058
+ "nth-child": at,
1059
+ "nth-last-child": at,
1060
+ "nth-last-of-type": at,
1061
+ "nth-of-type": at,
1062
+ slotted: Zt,
1063
+ host: Zt,
1064
+ "host-context": Zt
1065
+ }, ce = 43, H = 45, ut = 110, Ae = !0, Fi = !1;
1066
+ function ht(t, e) {
1067
+ let n = this.tokenStart + t;
1068
+ const r = this.charCodeAt(n);
1069
+ for ((r === ce || r === H) && (e && this.error("Number sign is not allowed"), n++); n < this.tokenEnd; n++)
1070
+ W(this.charCodeAt(n)) || this.error("Integer is expected", n);
1071
+ }
1072
+ function De(t) {
1073
+ return ht.call(this, 0, t);
1074
+ }
1075
+ function Se(t, e) {
1076
+ if (!this.cmpChar(this.tokenStart + t, e)) {
1077
+ let n = "";
1078
+ switch (e) {
1079
+ case ut:
1080
+ n = "N is expected";
1081
+ break;
1082
+ case H:
1083
+ n = "HyphenMinus is expected";
1084
+ break;
1085
+ }
1086
+ this.error(n, this.tokenStart + t);
1087
+ }
1088
+ }
1089
+ function en() {
1090
+ let t = 0, e = 0, n = this.tokenType;
1091
+ for (; n === ae || n === Ee; )
1092
+ n = this.lookupType(++t);
1093
+ if (n !== E)
1094
+ if (this.isDelim(ce, t) || this.isDelim(H, t)) {
1095
+ e = this.isDelim(ce, t) ? ce : H;
1096
+ do
1097
+ n = this.lookupType(++t);
1098
+ while (n === ae || n === Ee);
1099
+ n !== E && (this.skip(t), De.call(this, Ae));
1100
+ } else
1101
+ return null;
1102
+ return t > 0 && this.skip(t), e === 0 && (n = this.charCodeAt(this.tokenStart), n !== ce && n !== H && this.error("Number sign is expected")), De.call(this, e !== 0), e === H ? "-" + this.consume(E) : this.consume(E);
1103
+ }
1104
+ function Ri() {
1105
+ const t = this.tokenStart;
1106
+ let e = null, n = null;
1107
+ if (this.tokenType === E)
1108
+ De.call(this, Fi), n = this.consume(E);
1109
+ else if (this.tokenType === k && this.cmpChar(this.tokenStart, H))
1110
+ switch (e = "-1", Se.call(this, 1, ut), this.tokenEnd - this.tokenStart) {
1111
+ case 2:
1112
+ this.next(), n = en.call(this);
1113
+ break;
1114
+ case 3:
1115
+ Se.call(this, 2, H), this.next(), this.skipSC(), De.call(this, Ae), n = "-" + this.consume(E);
1116
+ break;
1117
+ default:
1118
+ Se.call(this, 2, H), ht.call(this, 3, Ae), this.next(), n = this.substrToCursor(t + 2);
1119
+ }
1120
+ else if (this.tokenType === k || this.isDelim(ce) && this.lookupType(1) === k) {
1121
+ let r = 0;
1122
+ switch (e = "1", this.isDelim(ce) && (r = 1, this.next()), Se.call(this, 0, ut), this.tokenEnd - this.tokenStart) {
1123
+ case 1:
1124
+ this.next(), n = en.call(this);
1125
+ break;
1126
+ case 2:
1127
+ Se.call(this, 1, H), this.next(), this.skipSC(), De.call(this, Ae), n = "-" + this.consume(E);
1128
+ break;
1129
+ default:
1130
+ Se.call(this, 1, H), ht.call(this, 2, Ae), this.next(), n = this.substrToCursor(t + r + 1);
1131
+ }
1132
+ } else if (this.tokenType === T) {
1133
+ const r = this.charCodeAt(this.tokenStart), i = r === ce || r === H;
1134
+ let o = this.tokenStart + i;
1135
+ for (; o < this.tokenEnd && W(this.charCodeAt(o)); o++)
1136
+ ;
1137
+ o === this.tokenStart + i && this.error("Integer is expected", this.tokenStart + i), Se.call(this, o - this.tokenStart, ut), e = this.substring(t, o), o + 1 === this.tokenEnd ? (this.next(), n = en.call(this)) : (Se.call(this, o - this.tokenStart + 1, H), o + 2 === this.tokenEnd ? (this.next(), this.skipSC(), De.call(this, Ae), n = "-" + this.consume(E)) : (ht.call(this, o - this.tokenStart + 2, Ae), this.next(), n = this.substrToCursor(o + 1)));
1138
+ } else
1139
+ this.error();
1140
+ return e !== null && e.charCodeAt(0) === ce && (e = e.substr(1)), n !== null && n.charCodeAt(0) === ce && (n = n.substr(1)), {
1141
+ type: "AnPlusB",
1142
+ loc: this.getLocation(t, this.tokenStart),
1143
+ a: e,
1144
+ b: n
1145
+ };
1146
+ }
1147
+ function qi(t) {
1148
+ if (t.a) {
1149
+ const e = t.a === "+1" && "n" || t.a === "1" && "n" || t.a === "-1" && "-n" || t.a + "n";
1150
+ if (t.b) {
1151
+ const n = t.b[0] === "-" || t.b[0] === "+" ? t.b : "+" + t.b;
1152
+ this.tokenize(e + n);
1153
+ } else
1154
+ this.tokenize(e);
1155
+ } else
1156
+ this.tokenize(t.b);
1157
+ }
1158
+ const Bi = 36, Dr = 42, ft = 61, ji = 94, ln = 124, Ui = 126;
1159
+ function Vi() {
1160
+ this.eof && this.error("Unexpected end of input");
1161
+ const t = this.tokenStart;
1162
+ let e = !1;
1163
+ return this.isDelim(Dr) ? (e = !0, this.next()) : this.isDelim(ln) || this.eat(k), this.isDelim(ln) ? this.charCodeAt(this.tokenStart + 1) !== ft ? (this.next(), this.eat(k)) : e && this.error("Identifier is expected", this.tokenEnd) : e && this.error("Vertical line is expected"), {
1164
+ type: "Identifier",
1165
+ loc: this.getLocation(t, this.tokenStart),
1166
+ name: this.substrToCursor(t)
1167
+ };
1168
+ }
1169
+ function Gi() {
1170
+ const t = this.tokenStart, e = this.charCodeAt(t);
1171
+ return e !== ft && // =
1172
+ e !== Ui && // ~=
1173
+ e !== ji && // ^=
1174
+ e !== Bi && // $=
1175
+ e !== Dr && // *=
1176
+ e !== ln && this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"), this.next(), e !== ft && (this.isDelim(ft) || this.error("Equal sign is expected"), this.next()), this.substrToCursor(t);
1177
+ }
1178
+ function Hi() {
1179
+ const t = this.tokenStart;
1180
+ let e, n = null, r = null, i = null;
1181
+ return this.eat(Ke), this.skipSC(), e = Vi.call(this), this.skipSC(), this.tokenType !== pt && (this.tokenType !== k && (n = Gi.call(this), this.skipSC(), r = this.tokenType === We ? this.String() : this.Identifier(), this.skipSC()), this.tokenType === k && (i = this.consume(k), this.skipSC())), this.eat(pt), {
1182
+ type: "AttributeSelector",
1183
+ loc: this.getLocation(t, this.tokenStart),
1184
+ name: e,
1185
+ matcher: n,
1186
+ value: r,
1187
+ flags: i
1188
+ };
1189
+ }
1190
+ function Wi(t) {
1191
+ this.token(O, "["), this.node(t.name), t.matcher !== null && (this.tokenize(t.matcher), this.node(t.value)), t.flags !== null && this.token(k, t.flags), this.token(O, "]");
1192
+ }
1193
+ const Ki = 46;
1194
+ function Qi() {
1195
+ return this.eatDelim(Ki), {
1196
+ type: "ClassSelector",
1197
+ loc: this.getLocation(this.tokenStart - 1, this.tokenEnd),
1198
+ name: this.consume(k)
1199
+ };
1200
+ }
1201
+ function Yi(t) {
1202
+ this.token(O, "."), this.token(k, t.name);
1203
+ }
1204
+ const Ji = 43, hr = 47, Xi = 62, Zi = 126;
1205
+ function es() {
1206
+ const t = this.tokenStart;
1207
+ let e;
1208
+ switch (this.tokenType) {
1209
+ case ae:
1210
+ e = " ";
1211
+ break;
1212
+ case O:
1213
+ switch (this.charCodeAt(this.tokenStart)) {
1214
+ case Xi:
1215
+ case Ji:
1216
+ case Zi:
1217
+ this.next();
1218
+ break;
1219
+ case hr:
1220
+ this.next(), this.eatIdent("deep"), this.eatDelim(hr);
1221
+ break;
1222
+ default:
1223
+ this.error("Combinator is expected");
1224
+ }
1225
+ e = this.substrToCursor(t);
1226
+ break;
1227
+ }
1228
+ return {
1229
+ type: "Combinator",
1230
+ loc: this.getLocation(t, this.tokenStart),
1231
+ name: e
1232
+ };
1233
+ }
1234
+ function ts(t) {
1235
+ this.tokenize(t.name);
1236
+ }
1237
+ function ns() {
1238
+ return {
1239
+ type: "Identifier",
1240
+ loc: this.getLocation(this.tokenStart, this.tokenEnd),
1241
+ name: this.consume(k)
1242
+ };
1243
+ }
1244
+ function rs(t) {
1245
+ this.token(k, t.name);
1246
+ }
1247
+ function is() {
1248
+ const t = this.tokenStart;
1249
+ return this.eat(M), {
1250
+ type: "IdSelector",
1251
+ loc: this.getLocation(t, this.tokenStart),
1252
+ name: this.substrToCursor(t + 1)
1253
+ };
1254
+ }
1255
+ function ss(t) {
1256
+ this.token(O, "#" + t.name);
1257
+ }
1258
+ const os = 38;
1259
+ function as() {
1260
+ const t = this.tokenStart;
1261
+ return this.eatDelim(os), {
1262
+ type: "NestingSelector",
1263
+ loc: this.getLocation(t, this.tokenStart)
1264
+ };
1265
+ }
1266
+ function ls() {
1267
+ this.token(O, "&");
1268
+ }
1269
+ function cs() {
1270
+ this.skipSC();
1271
+ const t = this.tokenStart;
1272
+ let e = t, n = null, r;
1273
+ return this.lookupValue(0, "odd") || this.lookupValue(0, "even") ? r = this.Identifier() : r = this.AnPlusB(), e = this.tokenStart, this.skipSC(), this.lookupValue(0, "of") && (this.next(), n = this.SelectorList(), e = this.tokenStart), {
1274
+ type: "Nth",
1275
+ loc: this.getLocation(t, e),
1276
+ nth: r,
1277
+ selector: n
1278
+ };
1279
+ }
1280
+ function us(t) {
1281
+ this.node(t.nth), t.selector !== null && (this.token(k, "of"), this.node(t.selector));
1282
+ }
1283
+ function hs() {
1284
+ return {
1285
+ type: "Percentage",
1286
+ loc: this.getLocation(this.tokenStart, this.tokenEnd),
1287
+ value: this.consumeNumber(D)
1288
+ };
1289
+ }
1290
+ function fs(t) {
1291
+ this.token(D, t.value + "%");
1292
+ }
1293
+ function ps() {
1294
+ const t = this.tokenStart;
1295
+ let e = null, n, r;
1296
+ return this.eat(Z), this.tokenType === N ? (n = this.consumeFunctionName(), r = n.toLowerCase(), hasOwnProperty.call(this.pseudo, r) ? (this.skipSC(), e = this.pseudo[r].call(this), this.skipSC()) : (e = this.createList(), e.push(
1297
+ this.Raw(this.tokenIndex, null, !1)
1298
+ )), this.eat(F)) : n = this.consume(k), {
1299
+ type: "PseudoClassSelector",
1300
+ loc: this.getLocation(t, this.tokenStart),
1301
+ name: n,
1302
+ children: e
1303
+ };
1304
+ }
1305
+ function ds(t) {
1306
+ this.token(Z, ":"), t.children === null ? this.token(k, t.name) : (this.token(N, t.name + "("), this.children(t), this.token(F, ")"));
1307
+ }
1308
+ function ms() {
1309
+ const t = this.tokenStart;
1310
+ let e = null, n, r;
1311
+ return this.eat(Z), this.eat(Z), this.tokenType === N ? (n = this.consumeFunctionName(), r = n.toLowerCase(), hasOwnProperty.call(this.pseudo, r) ? (this.skipSC(), e = this.pseudo[r].call(this), this.skipSC()) : (e = this.createList(), e.push(
1312
+ this.Raw(this.tokenIndex, null, !1)
1313
+ )), this.eat(F)) : n = this.consume(k), {
1314
+ type: "PseudoElementSelector",
1315
+ loc: this.getLocation(t, this.tokenStart),
1316
+ name: n,
1317
+ children: e
1318
+ };
1319
+ }
1320
+ function gs(t) {
1321
+ this.token(Z, ":"), this.token(Z, ":"), t.children === null ? this.token(k, t.name) : (this.token(N, t.name + "("), this.children(t), this.token(F, ")"));
1322
+ }
1323
+ function ks() {
1324
+ return this.tokenIndex > 0 && this.lookupType(-1) === ae ? this.tokenIndex > 1 ? this.getTokenStart(this.tokenIndex - 1) : this.firstCharOffset : this.tokenStart;
1325
+ }
1326
+ function ys(t, e, n) {
1327
+ const r = this.getTokenStart(t);
1328
+ let i;
1329
+ return this.skipUntilBalanced(t, e || this.consumeUntilBalanceEnd), n && this.tokenStart > r ? i = ks.call(this) : i = this.tokenStart, {
1330
+ type: "Raw",
1331
+ loc: this.getLocation(r, i),
1332
+ value: this.substring(r, i)
1333
+ };
1334
+ }
1335
+ function Ss(t) {
1336
+ this.tokenize(t.value);
1337
+ }
1338
+ function xs() {
1339
+ const t = this.readSequence(this.scope.Selector);
1340
+ return this.getFirstListNode(t) === null && this.error("Selector is expected"), {
1341
+ type: "Selector",
1342
+ loc: this.getLocationFromList(t),
1343
+ children: t
1344
+ };
1345
+ }
1346
+ function Cs(t) {
1347
+ this.children(t);
1348
+ }
1349
+ function bs() {
1350
+ const t = this.createList();
1351
+ for (; !this.eof; ) {
1352
+ if (t.push(this.Selector()), this.tokenType === xt) {
1353
+ this.next();
1354
+ continue;
1355
+ }
1356
+ break;
1357
+ }
1358
+ return {
1359
+ type: "SelectorList",
1360
+ loc: this.getLocationFromList(t),
1361
+ children: t
1362
+ };
1363
+ }
1364
+ function ws(t) {
1365
+ this.children(t, () => this.token(xt, ","));
1366
+ }
1367
+ const cn = 92, Pr = 34, vs = 39;
1368
+ function As(t) {
1369
+ const e = t.length, n = t.charCodeAt(0), r = n === Pr || n === vs ? 1 : 0, i = r === 1 && e > 1 && t.charCodeAt(e - 1) === n ? e - 2 : e - 1;
1370
+ let o = "";
1371
+ for (let a = r; a <= i; a++) {
1372
+ let f = t.charCodeAt(a);
1373
+ if (f === cn) {
1374
+ if (a === i) {
1375
+ a !== e - 1 && (o = t.substr(a + 1));
1376
+ break;
1377
+ }
1378
+ if (f = t.charCodeAt(++a), de(cn, f)) {
1379
+ const c = a - 1, s = Ge(t, c);
1380
+ a = s - 1, o += di(t.substring(c + 1, s));
1381
+ } else
1382
+ f === 13 && t.charCodeAt(a + 1) === 10 && a++;
1383
+ } else
1384
+ o += t[a];
1385
+ }
1386
+ return o;
1387
+ }
1388
+ function Ls(t, e) {
1389
+ const n = '"', r = Pr;
1390
+ let i = "", o = !1;
1391
+ for (let a = 0; a < t.length; a++) {
1392
+ const f = t.charCodeAt(a);
1393
+ if (f === 0) {
1394
+ i += "�";
1395
+ continue;
1396
+ }
1397
+ if (f <= 31 || f === 127) {
1398
+ i += "\\" + f.toString(16), o = !0;
1399
+ continue;
1400
+ }
1401
+ f === r || f === cn ? (i += "\\" + t.charAt(a), o = !1) : (o && (Ve(f) || Qe(f)) && (i += " "), i += t.charAt(a), o = !1);
1402
+ }
1403
+ return n + i + n;
1404
+ }
1405
+ function Es() {
1406
+ return {
1407
+ type: "String",
1408
+ loc: this.getLocation(this.tokenStart, this.tokenEnd),
1409
+ value: As(this.consume(We))
1410
+ };
1411
+ }
1412
+ function _s(t) {
1413
+ this.token(We, Ls(t.value));
1414
+ }
1415
+ const Ts = 42, fr = 124;
1416
+ function tn() {
1417
+ this.tokenType !== k && this.isDelim(Ts) === !1 && this.error("Identifier or asterisk is expected"), this.next();
1418
+ }
1419
+ function Os() {
1420
+ const t = this.tokenStart;
1421
+ return this.isDelim(fr) ? (this.next(), tn.call(this)) : (tn.call(this), this.isDelim(fr) && (this.next(), tn.call(this))), {
1422
+ type: "TypeSelector",
1423
+ loc: this.getLocation(t, this.tokenStart),
1424
+ name: this.substrToCursor(t)
1425
+ };
1426
+ }
1427
+ function Is(t) {
1428
+ this.tokenize(t.name);
1429
+ }
1430
+ const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1431
+ __proto__: null,
1432
+ AnPlusB: Ri,
1433
+ AttributeSelector: Hi,
1434
+ ClassSelector: Qi,
1435
+ Combinator: es,
1436
+ IdSelector: is,
1437
+ Identifier: ns,
1438
+ NestingSelector: as,
1439
+ Nth: cs,
1440
+ Percentage: hs,
1441
+ PseudoClassSelector: ps,
1442
+ PseudoElementSelector: ms,
1443
+ Raw: ys,
1444
+ Selector: xs,
1445
+ SelectorList: bs,
1446
+ String: Es,
1447
+ TypeSelector: Os
1448
+ }, Symbol.toStringTag, { value: "Module" })), $s = {
1449
+ parseContext: {
1450
+ default: "SelectorList",
1451
+ selectorList: "SelectorList",
1452
+ selector: "Selector"
1453
+ },
1454
+ scope: { Selector: Mi },
1455
+ atrule: {},
1456
+ pseudo: zi,
1457
+ node: Ns
1458
+ }, pr = Ai($s);
1459
+ var mn = {}, gn = {}, dr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
1460
+ gn.encode = function(t) {
1461
+ if (0 <= t && t < dr.length)
1462
+ return dr[t];
1463
+ throw new TypeError("Must be between 0 and 63: " + t);
1464
+ };
1465
+ gn.decode = function(t) {
1466
+ var e = 65, n = 90, r = 97, i = 122, o = 48, a = 57, f = 43, c = 47, s = 26, l = 52;
1467
+ return e <= t && t <= n ? t - e : r <= t && t <= i ? t - r + s : o <= t && t <= a ? t - o + l : t == f ? 62 : t == c ? 63 : -1;
1468
+ };
1469
+ var Mr = gn, kn = 5, zr = 1 << kn, Fr = zr - 1, Rr = zr;
1470
+ function Ds(t) {
1471
+ return t < 0 ? (-t << 1) + 1 : (t << 1) + 0;
1472
+ }
1473
+ function Ps(t) {
1474
+ var e = (t & 1) === 1, n = t >> 1;
1475
+ return e ? -n : n;
1476
+ }
1477
+ mn.encode = function(e) {
1478
+ var n = "", r, i = Ds(e);
1479
+ do
1480
+ r = i & Fr, i >>>= kn, i > 0 && (r |= Rr), n += Mr.encode(r);
1481
+ while (i > 0);
1482
+ return n;
1483
+ };
1484
+ mn.decode = function(e, n, r) {
1485
+ var i = e.length, o = 0, a = 0, f, c;
1486
+ do {
1487
+ if (n >= i)
1488
+ throw new Error("Expected more digits in base 64 VLQ value.");
1489
+ if (c = Mr.decode(e.charCodeAt(n++)), c === -1)
1490
+ throw new Error("Invalid base64 digit: " + e.charAt(n - 1));
1491
+ f = !!(c & Rr), c &= Fr, o = o + (c << a), a += kn;
1492
+ } while (f);
1493
+ r.value = Ps(o), r.rest = n;
1494
+ };
1495
+ var bt = {};
1496
+ (function(t) {
1497
+ function e(u, h, g) {
1498
+ if (h in u)
1499
+ return u[h];
1500
+ if (arguments.length === 3)
1501
+ return g;
1502
+ throw new Error('"' + h + '" is a required argument.');
1503
+ }
1504
+ t.getArg = e;
1505
+ var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, r = /^data:.+\,.+$/;
1506
+ function i(u) {
1507
+ var h = u.match(n);
1508
+ return h ? {
1509
+ scheme: h[1],
1510
+ auth: h[2],
1511
+ host: h[3],
1512
+ port: h[4],
1513
+ path: h[5]
1514
+ } : null;
1515
+ }
1516
+ t.urlParse = i;
1517
+ function o(u) {
1518
+ var h = "";
1519
+ return u.scheme && (h += u.scheme + ":"), h += "//", u.auth && (h += u.auth + "@"), u.host && (h += u.host), u.port && (h += ":" + u.port), u.path && (h += u.path), h;
1520
+ }
1521
+ t.urlGenerate = o;
1522
+ var a = 32;
1523
+ function f(u) {
1524
+ var h = [];
1525
+ return function(g) {
1526
+ for (var p = 0; p < h.length; p++)
1527
+ if (h[p].input === g) {
1528
+ var Y = h[0];
1529
+ return h[0] = h[p], h[p] = Y, h[0].result;
1530
+ }
1531
+ var B = u(g);
1532
+ return h.unshift({
1533
+ input: g,
1534
+ result: B
1535
+ }), h.length > a && h.pop(), B;
1536
+ };
1537
+ }
1538
+ var c = f(function(h) {
1539
+ var g = h, p = i(h);
1540
+ if (p) {
1541
+ if (!p.path)
1542
+ return h;
1543
+ g = p.path;
1544
+ }
1545
+ for (var Y = t.isAbsolute(g), B = [], ge = 0, z = 0; ; )
1546
+ if (ge = z, z = g.indexOf("/", ge), z === -1) {
1547
+ B.push(g.slice(ge));
1548
+ break;
1549
+ } else
1550
+ for (B.push(g.slice(ge, z)); z < g.length && g[z] === "/"; )
1551
+ z++;
1552
+ for (var ke, fe = 0, z = B.length - 1; z >= 0; z--)
1553
+ ke = B[z], ke === "." ? B.splice(z, 1) : ke === ".." ? fe++ : fe > 0 && (ke === "" ? (B.splice(z + 1, fe), fe = 0) : (B.splice(z, 2), fe--));
1554
+ return g = B.join("/"), g === "" && (g = Y ? "/" : "."), p ? (p.path = g, o(p)) : g;
1555
+ });
1556
+ t.normalize = c;
1557
+ function s(u, h) {
1558
+ u === "" && (u = "."), h === "" && (h = ".");
1559
+ var g = i(h), p = i(u);
1560
+ if (p && (u = p.path || "/"), g && !g.scheme)
1561
+ return p && (g.scheme = p.scheme), o(g);
1562
+ if (g || h.match(r))
1563
+ return h;
1564
+ if (p && !p.host && !p.path)
1565
+ return p.host = h, o(p);
1566
+ var Y = h.charAt(0) === "/" ? h : c(u.replace(/\/+$/, "") + "/" + h);
1567
+ return p ? (p.path = Y, o(p)) : Y;
1568
+ }
1569
+ t.join = s, t.isAbsolute = function(u) {
1570
+ return u.charAt(0) === "/" || n.test(u);
1571
+ };
1572
+ function l(u, h) {
1573
+ u === "" && (u = "."), u = u.replace(/\/$/, "");
1574
+ for (var g = 0; h.indexOf(u + "/") !== 0; ) {
1575
+ var p = u.lastIndexOf("/");
1576
+ if (p < 0 || (u = u.slice(0, p), u.match(/^([^\/]+:\/)?\/*$/)))
1577
+ return h;
1578
+ ++g;
1579
+ }
1580
+ return Array(g + 1).join("../") + h.substr(u.length + 1);
1581
+ }
1582
+ t.relative = l;
1583
+ var m = function() {
1584
+ var u = /* @__PURE__ */ Object.create(null);
1585
+ return !("__proto__" in u);
1586
+ }();
1587
+ function S(u) {
1588
+ return u;
1589
+ }
1590
+ function b(u) {
1591
+ return q(u) ? "$" + u : u;
1592
+ }
1593
+ t.toSetString = m ? S : b;
1594
+ function K(u) {
1595
+ return q(u) ? u.slice(1) : u;
1596
+ }
1597
+ t.fromSetString = m ? S : K;
1598
+ function q(u) {
1599
+ if (!u)
1600
+ return !1;
1601
+ var h = u.length;
1602
+ if (h < 9 || u.charCodeAt(h - 1) !== 95 || u.charCodeAt(h - 2) !== 95 || u.charCodeAt(h - 3) !== 111 || u.charCodeAt(h - 4) !== 116 || u.charCodeAt(h - 5) !== 111 || u.charCodeAt(h - 6) !== 114 || u.charCodeAt(h - 7) !== 112 || u.charCodeAt(h - 8) !== 95 || u.charCodeAt(h - 9) !== 95)
1603
+ return !1;
1604
+ for (var g = h - 10; g >= 0; g--)
1605
+ if (u.charCodeAt(g) !== 36)
1606
+ return !1;
1607
+ return !0;
1608
+ }
1609
+ function te(u, h, g) {
1610
+ var p = Q(u.source, h.source);
1611
+ return p !== 0 || (p = u.originalLine - h.originalLine, p !== 0) || (p = u.originalColumn - h.originalColumn, p !== 0 || g) || (p = u.generatedColumn - h.generatedColumn, p !== 0) || (p = u.generatedLine - h.generatedLine, p !== 0) ? p : Q(u.name, h.name);
1612
+ }
1613
+ t.compareByOriginalPositions = te;
1614
+ function Ce(u, h, g) {
1615
+ var p;
1616
+ return p = u.originalLine - h.originalLine, p !== 0 || (p = u.originalColumn - h.originalColumn, p !== 0 || g) || (p = u.generatedColumn - h.generatedColumn, p !== 0) || (p = u.generatedLine - h.generatedLine, p !== 0) ? p : Q(u.name, h.name);
1617
+ }
1618
+ t.compareByOriginalPositionsNoSource = Ce;
1619
+ function Te(u, h, g) {
1620
+ var p = u.generatedLine - h.generatedLine;
1621
+ return p !== 0 || (p = u.generatedColumn - h.generatedColumn, p !== 0 || g) || (p = Q(u.source, h.source), p !== 0) || (p = u.originalLine - h.originalLine, p !== 0) || (p = u.originalColumn - h.originalColumn, p !== 0) ? p : Q(u.name, h.name);
1622
+ }
1623
+ t.compareByGeneratedPositionsDeflated = Te;
1624
+ function Fe(u, h, g) {
1625
+ var p = u.generatedColumn - h.generatedColumn;
1626
+ return p !== 0 || g || (p = Q(u.source, h.source), p !== 0) || (p = u.originalLine - h.originalLine, p !== 0) || (p = u.originalColumn - h.originalColumn, p !== 0) ? p : Q(u.name, h.name);
1627
+ }
1628
+ t.compareByGeneratedPositionsDeflatedNoLine = Fe;
1629
+ function Q(u, h) {
1630
+ return u === h ? 0 : u === null ? 1 : h === null ? -1 : u > h ? 1 : -1;
1631
+ }
1632
+ function Je(u, h) {
1633
+ var g = u.generatedLine - h.generatedLine;
1634
+ return g !== 0 || (g = u.generatedColumn - h.generatedColumn, g !== 0) || (g = Q(u.source, h.source), g !== 0) || (g = u.originalLine - h.originalLine, g !== 0) || (g = u.originalColumn - h.originalColumn, g !== 0) ? g : Q(u.name, h.name);
1635
+ }
1636
+ t.compareByGeneratedPositionsInflated = Je;
1637
+ function Xe(u) {
1638
+ return JSON.parse(u.replace(/^\)]}'[^\n]*\n/, ""));
1639
+ }
1640
+ t.parseSourceMapInput = Xe;
1641
+ function Ze(u, h, g) {
1642
+ if (h = h || "", u && (u[u.length - 1] !== "/" && h[0] !== "/" && (u += "/"), h = u + h), g) {
1643
+ var p = i(g);
1644
+ if (!p)
1645
+ throw new Error("sourceMapURL could not be parsed");
1646
+ if (p.path) {
1647
+ var Y = p.path.lastIndexOf("/");
1648
+ Y >= 0 && (p.path = p.path.substring(0, Y + 1));
1649
+ }
1650
+ h = s(o(p), h);
1651
+ }
1652
+ return c(h);
1653
+ }
1654
+ t.computeSourceURL = Ze;
1655
+ })(bt);
1656
+ var qr = {}, yn = bt, Sn = Object.prototype.hasOwnProperty, Le = typeof Map < "u";
1657
+ function me() {
1658
+ this._array = [], this._set = Le ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
1659
+ }
1660
+ me.fromArray = function(e, n) {
1661
+ for (var r = new me(), i = 0, o = e.length; i < o; i++)
1662
+ r.add(e[i], n);
1663
+ return r;
1664
+ };
1665
+ me.prototype.size = function() {
1666
+ return Le ? this._set.size : Object.getOwnPropertyNames(this._set).length;
1667
+ };
1668
+ me.prototype.add = function(e, n) {
1669
+ var r = Le ? e : yn.toSetString(e), i = Le ? this.has(e) : Sn.call(this._set, r), o = this._array.length;
1670
+ (!i || n) && this._array.push(e), i || (Le ? this._set.set(e, o) : this._set[r] = o);
1671
+ };
1672
+ me.prototype.has = function(e) {
1673
+ if (Le)
1674
+ return this._set.has(e);
1675
+ var n = yn.toSetString(e);
1676
+ return Sn.call(this._set, n);
1677
+ };
1678
+ me.prototype.indexOf = function(e) {
1679
+ if (Le) {
1680
+ var n = this._set.get(e);
1681
+ if (n >= 0)
1682
+ return n;
1683
+ } else {
1684
+ var r = yn.toSetString(e);
1685
+ if (Sn.call(this._set, r))
1686
+ return this._set[r];
1687
+ }
1688
+ throw new Error('"' + e + '" is not in the set.');
1689
+ };
1690
+ me.prototype.at = function(e) {
1691
+ if (e >= 0 && e < this._array.length)
1692
+ return this._array[e];
1693
+ throw new Error("No element indexed by " + e);
1694
+ };
1695
+ me.prototype.toArray = function() {
1696
+ return this._array.slice();
1697
+ };
1698
+ qr.ArraySet = me;
1699
+ var Br = {}, jr = bt;
1700
+ function Ms(t, e) {
1701
+ var n = t.generatedLine, r = e.generatedLine, i = t.generatedColumn, o = e.generatedColumn;
1702
+ return r > n || r == n && o >= i || jr.compareByGeneratedPositionsInflated(t, e) <= 0;
1703
+ }
1704
+ function wt() {
1705
+ this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 };
1706
+ }
1707
+ wt.prototype.unsortedForEach = function(e, n) {
1708
+ this._array.forEach(e, n);
1709
+ };
1710
+ wt.prototype.add = function(e) {
1711
+ Ms(this._last, e) ? (this._last = e, this._array.push(e)) : (this._sorted = !1, this._array.push(e));
1712
+ };
1713
+ wt.prototype.toArray = function() {
1714
+ return this._sorted || (this._array.sort(jr.compareByGeneratedPositionsInflated), this._sorted = !0), this._array;
1715
+ };
1716
+ Br.MappingList = wt;
1717
+ var Ue = mn, $ = bt, yt = qr.ArraySet, zs = Br.MappingList;
1718
+ function ee(t) {
1719
+ t || (t = {}), this._file = $.getArg(t, "file", null), this._sourceRoot = $.getArg(t, "sourceRoot", null), this._skipValidation = $.getArg(t, "skipValidation", !1), this._ignoreInvalidMapping = $.getArg(t, "ignoreInvalidMapping", !1), this._sources = new yt(), this._names = new yt(), this._mappings = new zs(), this._sourcesContents = null;
1720
+ }
1721
+ ee.prototype._version = 3;
1722
+ ee.fromSourceMap = function(e, n) {
1723
+ var r = e.sourceRoot, i = new ee(Object.assign(n || {}, {
1724
+ file: e.file,
1725
+ sourceRoot: r
1726
+ }));
1727
+ return e.eachMapping(function(o) {
1728
+ var a = {
1729
+ generated: {
1730
+ line: o.generatedLine,
1731
+ column: o.generatedColumn
1732
+ }
1733
+ };
1734
+ o.source != null && (a.source = o.source, r != null && (a.source = $.relative(r, a.source)), a.original = {
1735
+ line: o.originalLine,
1736
+ column: o.originalColumn
1737
+ }, o.name != null && (a.name = o.name)), i.addMapping(a);
1738
+ }), e.sources.forEach(function(o) {
1739
+ var a = o;
1740
+ r !== null && (a = $.relative(r, o)), i._sources.has(a) || i._sources.add(a);
1741
+ var f = e.sourceContentFor(o);
1742
+ f != null && i.setSourceContent(o, f);
1743
+ }), i;
1744
+ };
1745
+ ee.prototype.addMapping = function(e) {
1746
+ var n = $.getArg(e, "generated"), r = $.getArg(e, "original", null), i = $.getArg(e, "source", null), o = $.getArg(e, "name", null);
1747
+ !this._skipValidation && this._validateMapping(n, r, i, o) === !1 || (i != null && (i = String(i), this._sources.has(i) || this._sources.add(i)), o != null && (o = String(o), this._names.has(o) || this._names.add(o)), this._mappings.add({
1748
+ generatedLine: n.line,
1749
+ generatedColumn: n.column,
1750
+ originalLine: r != null && r.line,
1751
+ originalColumn: r != null && r.column,
1752
+ source: i,
1753
+ name: o
1754
+ }));
1755
+ };
1756
+ ee.prototype.setSourceContent = function(e, n) {
1757
+ var r = e;
1758
+ this._sourceRoot != null && (r = $.relative(this._sourceRoot, r)), n != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[$.toSetString(r)] = n) : this._sourcesContents && (delete this._sourcesContents[$.toSetString(r)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null));
1759
+ };
1760
+ ee.prototype.applySourceMap = function(e, n, r) {
1761
+ var i = n;
1762
+ if (n == null) {
1763
+ if (e.file == null)
1764
+ throw new Error(
1765
+ `SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
1766
+ );
1767
+ i = e.file;
1768
+ }
1769
+ var o = this._sourceRoot;
1770
+ o != null && (i = $.relative(o, i));
1771
+ var a = new yt(), f = new yt();
1772
+ this._mappings.unsortedForEach(function(c) {
1773
+ if (c.source === i && c.originalLine != null) {
1774
+ var s = e.originalPositionFor({
1775
+ line: c.originalLine,
1776
+ column: c.originalColumn
1777
+ });
1778
+ s.source != null && (c.source = s.source, r != null && (c.source = $.join(r, c.source)), o != null && (c.source = $.relative(o, c.source)), c.originalLine = s.line, c.originalColumn = s.column, s.name != null && (c.name = s.name));
1779
+ }
1780
+ var l = c.source;
1781
+ l != null && !a.has(l) && a.add(l);
1782
+ var m = c.name;
1783
+ m != null && !f.has(m) && f.add(m);
1784
+ }, this), this._sources = a, this._names = f, e.sources.forEach(function(c) {
1785
+ var s = e.sourceContentFor(c);
1786
+ s != null && (r != null && (c = $.join(r, c)), o != null && (c = $.relative(o, c)), this.setSourceContent(c, s));
1787
+ }, this);
1788
+ };
1789
+ ee.prototype._validateMapping = function(e, n, r, i) {
1790
+ if (n && typeof n.line != "number" && typeof n.column != "number") {
1791
+ var o = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
1792
+ if (this._ignoreInvalidMapping)
1793
+ return typeof console < "u" && console.warn && console.warn(o), !1;
1794
+ throw new Error(o);
1795
+ }
1796
+ if (!(e && "line" in e && "column" in e && e.line > 0 && e.column >= 0 && !n && !r && !i)) {
1797
+ if (e && "line" in e && "column" in e && n && "line" in n && "column" in n && e.line > 0 && e.column >= 0 && n.line > 0 && n.column >= 0 && r)
1798
+ return;
1799
+ var o = "Invalid mapping: " + JSON.stringify({
1800
+ generated: e,
1801
+ source: r,
1802
+ original: n,
1803
+ name: i
1804
+ });
1805
+ if (this._ignoreInvalidMapping)
1806
+ return typeof console < "u" && console.warn && console.warn(o), !1;
1807
+ throw new Error(o);
1808
+ }
1809
+ };
1810
+ ee.prototype._serializeMappings = function() {
1811
+ for (var e = 0, n = 1, r = 0, i = 0, o = 0, a = 0, f = "", c, s, l, m, S = this._mappings.toArray(), b = 0, K = S.length; b < K; b++) {
1812
+ if (s = S[b], c = "", s.generatedLine !== n)
1813
+ for (e = 0; s.generatedLine !== n; )
1814
+ c += ";", n++;
1815
+ else if (b > 0) {
1816
+ if (!$.compareByGeneratedPositionsInflated(s, S[b - 1]))
1817
+ continue;
1818
+ c += ",";
1819
+ }
1820
+ c += Ue.encode(s.generatedColumn - e), e = s.generatedColumn, s.source != null && (m = this._sources.indexOf(s.source), c += Ue.encode(m - a), a = m, c += Ue.encode(s.originalLine - 1 - i), i = s.originalLine - 1, c += Ue.encode(s.originalColumn - r), r = s.originalColumn, s.name != null && (l = this._names.indexOf(s.name), c += Ue.encode(l - o), o = l)), f += c;
1821
+ }
1822
+ return f;
1823
+ };
1824
+ ee.prototype._generateSourcesContent = function(e, n) {
1825
+ return e.map(function(r) {
1826
+ if (!this._sourcesContents)
1827
+ return null;
1828
+ n != null && (r = $.relative(n, r));
1829
+ var i = $.toSetString(r);
1830
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents, i) ? this._sourcesContents[i] : null;
1831
+ }, this);
1832
+ };
1833
+ ee.prototype.toJSON = function() {
1834
+ var e = {
1835
+ version: this._version,
1836
+ sources: this._sources.toArray(),
1837
+ names: this._names.toArray(),
1838
+ mappings: this._serializeMappings()
1839
+ };
1840
+ return this._file != null && (e.file = this._file), this._sourceRoot != null && (e.sourceRoot = this._sourceRoot), this._sourcesContents && (e.sourcesContent = this._generateSourcesContent(e.sources, e.sourceRoot)), e;
1841
+ };
1842
+ ee.prototype.toString = function() {
1843
+ return JSON.stringify(this.toJSON());
1844
+ };
1845
+ var Fs = ee;
1846
+ const mr = /* @__PURE__ */ new Set(["Atrule", "Selector", "Declaration"]);
1847
+ function Rs(t) {
1848
+ const e = new Fs(), n = {
1849
+ line: 1,
1850
+ column: 0
1851
+ }, r = {
1852
+ line: 0,
1853
+ // should be zero to add first mapping
1854
+ column: 0
1855
+ }, i = {
1856
+ line: 1,
1857
+ column: 0
1858
+ }, o = {
1859
+ generated: i
1860
+ };
1861
+ let a = 1, f = 0, c = !1;
1862
+ const s = t.node;
1863
+ t.node = function(S) {
1864
+ if (S.loc && S.loc.start && mr.has(S.type)) {
1865
+ const b = S.loc.start.line, K = S.loc.start.column - 1;
1866
+ (r.line !== b || r.column !== K) && (r.line = b, r.column = K, n.line = a, n.column = f, c && (c = !1, (n.line !== i.line || n.column !== i.column) && e.addMapping(o)), c = !0, e.addMapping({
1867
+ source: S.loc.source,
1868
+ original: r,
1869
+ generated: n
1870
+ }));
1871
+ }
1872
+ s.call(this, S), c && mr.has(S.type) && (i.line = a, i.column = f);
1873
+ };
1874
+ const l = t.emit;
1875
+ t.emit = function(S, b, K) {
1876
+ for (let q = 0; q < S.length; q++)
1877
+ S.charCodeAt(q) === 10 ? (a++, f = 0) : f++;
1878
+ l(S, b, K);
1879
+ };
1880
+ const m = t.result;
1881
+ return t.result = function() {
1882
+ return c && e.addMapping(o), {
1883
+ css: m(),
1884
+ map: e
1885
+ };
1886
+ }, t;
1887
+ }
1888
+ const qs = 43, Bs = 45, nn = (t, e) => {
1889
+ if (t === O && (t = e), typeof t == "string") {
1890
+ const n = t.charCodeAt(0);
1891
+ return n > 127 ? 32768 : n << 8;
1892
+ }
1893
+ return t;
1894
+ }, Ur = [
1895
+ [k, k],
1896
+ [k, N],
1897
+ [k, ie],
1898
+ [k, se],
1899
+ [k, "-"],
1900
+ [k, E],
1901
+ [k, D],
1902
+ [k, T],
1903
+ [k, oe],
1904
+ [k, _e],
1905
+ [j, k],
1906
+ [j, N],
1907
+ [j, ie],
1908
+ [j, se],
1909
+ [j, "-"],
1910
+ [j, E],
1911
+ [j, D],
1912
+ [j, T],
1913
+ [j, oe],
1914
+ [M, k],
1915
+ [M, N],
1916
+ [M, ie],
1917
+ [M, se],
1918
+ [M, "-"],
1919
+ [M, E],
1920
+ [M, D],
1921
+ [M, T],
1922
+ [M, oe],
1923
+ [T, k],
1924
+ [T, N],
1925
+ [T, ie],
1926
+ [T, se],
1927
+ [T, "-"],
1928
+ [T, E],
1929
+ [T, D],
1930
+ [T, T],
1931
+ [T, oe],
1932
+ ["#", k],
1933
+ ["#", N],
1934
+ ["#", ie],
1935
+ ["#", se],
1936
+ ["#", "-"],
1937
+ ["#", E],
1938
+ ["#", D],
1939
+ ["#", T],
1940
+ ["#", oe],
1941
+ // https://github.com/w3c/csswg-drafts/pull/6874
1942
+ ["-", k],
1943
+ ["-", N],
1944
+ ["-", ie],
1945
+ ["-", se],
1946
+ ["-", "-"],
1947
+ ["-", E],
1948
+ ["-", D],
1949
+ ["-", T],
1950
+ ["-", oe],
1951
+ // https://github.com/w3c/csswg-drafts/pull/6874
1952
+ [E, k],
1953
+ [E, N],
1954
+ [E, ie],
1955
+ [E, se],
1956
+ [E, E],
1957
+ [E, D],
1958
+ [E, T],
1959
+ [E, "%"],
1960
+ [E, oe],
1961
+ // https://github.com/w3c/csswg-drafts/pull/6874
1962
+ ["@", k],
1963
+ ["@", N],
1964
+ ["@", ie],
1965
+ ["@", se],
1966
+ ["@", "-"],
1967
+ ["@", oe],
1968
+ // https://github.com/w3c/csswg-drafts/pull/6874
1969
+ [".", E],
1970
+ [".", D],
1971
+ [".", T],
1972
+ ["+", E],
1973
+ ["+", D],
1974
+ ["+", T],
1975
+ ["/", "*"]
1976
+ ], js = Ur.concat([
1977
+ [k, M],
1978
+ [T, M],
1979
+ [M, M],
1980
+ [j, _e],
1981
+ [j, We],
1982
+ [j, Z],
1983
+ [D, D],
1984
+ [D, T],
1985
+ [D, N],
1986
+ [D, "-"],
1987
+ [F, k],
1988
+ [F, N],
1989
+ [F, D],
1990
+ [F, T],
1991
+ [F, M],
1992
+ [F, "-"]
1993
+ ]);
1994
+ function Vr(t) {
1995
+ const e = new Set(
1996
+ t.map(([n, r]) => nn(n) << 16 | nn(r))
1997
+ );
1998
+ return function(n, r, i) {
1999
+ const o = nn(r, i), a = i.charCodeAt(0);
2000
+ return (a === Bs && r !== k && r !== N && r !== oe || a === qs ? e.has(n << 16 | a << 8) : e.has(n << 16 | o)) && this.emit(" ", ae, !0), o;
2001
+ };
2002
+ }
2003
+ const Us = Vr(Ur), Gr = Vr(js), gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2004
+ __proto__: null,
2005
+ safe: Gr,
2006
+ spec: Us
2007
+ }, Symbol.toStringTag, { value: "Module" })), Vs = 92;
2008
+ function Gs(t, e) {
2009
+ if (typeof e == "function") {
2010
+ let n = null;
2011
+ t.children.forEach((r) => {
2012
+ n !== null && e.call(this, n), this.node(r), n = r;
2013
+ });
2014
+ return;
2015
+ }
2016
+ t.children.forEach(this.node, this);
2017
+ }
2018
+ function Hs(t) {
2019
+ $r(t, (e, n, r) => {
2020
+ this.token(e, t.slice(n, r));
2021
+ });
2022
+ }
2023
+ function Ws(t) {
2024
+ const e = /* @__PURE__ */ new Map();
2025
+ for (let n in t.node) {
2026
+ const r = t.node[n];
2027
+ typeof (r.generate || r) == "function" && e.set(n, r.generate || r);
2028
+ }
2029
+ return function(n, r) {
2030
+ let i = "", o = 0, a = {
2031
+ node(c) {
2032
+ if (e.has(c.type))
2033
+ e.get(c.type).call(f, c);
2034
+ else
2035
+ throw new Error("Unknown node type: " + c.type);
2036
+ },
2037
+ tokenBefore: Gr,
2038
+ token(c, s) {
2039
+ o = this.tokenBefore(o, c, s), this.emit(s, c, !1), c === O && s.charCodeAt(0) === Vs && this.emit(`
2040
+ `, ae, !0);
2041
+ },
2042
+ emit(c) {
2043
+ i += c;
2044
+ },
2045
+ result() {
2046
+ return i;
2047
+ }
2048
+ };
2049
+ r && (typeof r.decorator == "function" && (a = r.decorator(a)), r.sourceMap && (a = Rs(a)), r.mode in gr && (a.tokenBefore = gr[r.mode]));
2050
+ const f = {
2051
+ node: (c) => a.node(c),
2052
+ children: Gs,
2053
+ token: (c, s) => a.token(c, s),
2054
+ tokenize: Hs
2055
+ };
2056
+ return a.node(n), a.result();
2057
+ };
2058
+ }
2059
+ function Ks(t) {
2060
+ this.token(j, "@" + t.name), t.prelude !== null && this.node(t.prelude), t.block ? this.node(t.block) : this.token(St, ";");
2061
+ }
2062
+ function Qs(t) {
2063
+ this.children(t);
2064
+ }
2065
+ function Ys(t) {
2066
+ this.token(Ct, "{"), this.children(t, (e) => {
2067
+ e.type === "Declaration" && this.token(St, ";");
2068
+ }), this.token(fn, "}");
2069
+ }
2070
+ function Js(t) {
2071
+ this.token(O, "["), this.children(t), this.token(O, "]");
2072
+ }
2073
+ function Xs() {
2074
+ this.token(oe, "-->");
2075
+ }
2076
+ function Zs() {
2077
+ this.token(Ar, "<!--");
2078
+ }
2079
+ function eo(t) {
2080
+ this.token(Ee, "/*" + t.value + "*/");
2081
+ }
2082
+ function to(t) {
2083
+ this.token(k, t.property), this.token(Z, ":"), this.node(t.value), t.important && (this.token(O, "!"), this.token(k, t.important === !0 ? "important" : t.important));
2084
+ }
2085
+ function no(t) {
2086
+ this.children(t, (e) => {
2087
+ e.type === "Declaration" && this.token(St, ";");
2088
+ });
2089
+ }
2090
+ function ro(t) {
2091
+ this.token(T, t.value + t.unit);
2092
+ }
2093
+ function io(t) {
2094
+ this.token(N, t.name + "("), this.children(t), this.token(F, ")");
2095
+ }
2096
+ function so(t) {
2097
+ this.token(M, "#" + t.value);
2098
+ }
2099
+ function oo(t) {
2100
+ this.token(_e, "("), this.token(k, t.name), t.value !== null && (this.token(Z, ":"), this.node(t.value)), this.token(F, ")");
2101
+ }
2102
+ function ao(t) {
2103
+ this.children(t);
2104
+ }
2105
+ function lo(t) {
2106
+ this.children(t, () => this.token(xt, ","));
2107
+ }
2108
+ function co(t) {
2109
+ this.token(E, t.value);
2110
+ }
2111
+ function uo(t) {
2112
+ this.tokenize(t.value);
2113
+ }
2114
+ function ho(t) {
2115
+ this.token(_e, "("), this.children(t), this.token(F, ")");
2116
+ }
2117
+ function fo(t) {
2118
+ this.token(E, t.left), this.token(O, "/"), this.token(E, t.right);
2119
+ }
2120
+ function po(t) {
2121
+ this.node(t.prelude), this.node(t.block);
2122
+ }
2123
+ function mo(t) {
2124
+ this.children(t);
2125
+ }
2126
+ function go(t) {
2127
+ this.tokenize(t.value);
2128
+ }
2129
+ const ko = 32, yo = 92, So = 34, xo = 39, Co = 40, bo = 41;
2130
+ function wo(t) {
2131
+ let e = "", n = !1;
2132
+ for (let r = 0; r < t.length; r++) {
2133
+ const i = t.charCodeAt(r);
2134
+ if (i === 0) {
2135
+ e += "�";
2136
+ continue;
2137
+ }
2138
+ if (i <= 31 || i === 127) {
2139
+ e += "\\" + i.toString(16), n = !0;
2140
+ continue;
2141
+ }
2142
+ i === ko || i === yo || i === So || i === xo || i === Co || i === bo ? (e += "\\" + t.charAt(r), n = !1) : (n && Ve(i) && (e += " "), e += t.charAt(r), n = !1);
2143
+ }
2144
+ return "url(" + e + ")";
2145
+ }
2146
+ function vo(t) {
2147
+ this.token(ie, wo(t.value));
2148
+ }
2149
+ function Ao(t) {
2150
+ this.children(t);
2151
+ }
2152
+ function Lo(t) {
2153
+ this.token(ae, t.value);
2154
+ }
2155
+ const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2156
+ __proto__: null,
2157
+ AnPlusB: qi,
2158
+ Atrule: Ks,
2159
+ AtrulePrelude: Qs,
2160
+ AttributeSelector: Wi,
2161
+ Block: Ys,
2162
+ Brackets: Js,
2163
+ CDC: Xs,
2164
+ CDO: Zs,
2165
+ ClassSelector: Yi,
2166
+ Combinator: ts,
2167
+ Comment: eo,
2168
+ Declaration: to,
2169
+ DeclarationList: no,
2170
+ Dimension: ro,
2171
+ Function: io,
2172
+ Hash: so,
2173
+ IdSelector: ss,
2174
+ Identifier: rs,
2175
+ MediaFeature: oo,
2176
+ MediaQuery: ao,
2177
+ MediaQueryList: lo,
2178
+ NestingSelector: ls,
2179
+ Nth: us,
2180
+ Number: co,
2181
+ Operator: uo,
2182
+ Parentheses: ho,
2183
+ Percentage: fs,
2184
+ PseudoClassSelector: ds,
2185
+ PseudoElementSelector: gs,
2186
+ Ratio: fo,
2187
+ Raw: Ss,
2188
+ Rule: po,
2189
+ Selector: Cs,
2190
+ SelectorList: ws,
2191
+ String: _s,
2192
+ StyleSheet: mo,
2193
+ TypeSelector: Is,
2194
+ UnicodeRange: go,
2195
+ Url: vo,
2196
+ Value: Ao,
2197
+ WhiteSpace: Lo
2198
+ }, Symbol.toStringTag, { value: "Module" })), _o = {
2199
+ node: Eo
2200
+ }, To = Ws(_o), Ye = (t, e) => t.a === e.a ? t.b === e.b ? t.c - e.c : t.b - e.b : t.a - e.a, kr = (t, e) => Ye(t, e) === 0, yr = (t, e) => Ye(t, e) > 0, Sr = (t, e) => Ye(t, e) < 0, Hr = (t, e = "ASC") => {
2201
+ const n = t.sort(Ye);
2202
+ return e === "DESC" ? n.reverse() : n;
2203
+ }, Wr = (...t) => Hr(t, "ASC"), Kr = (...t) => Hr(t, "DESC"), un = (...t) => Kr(...t)[0], Oo = (...t) => Wr(...t)[0];
2204
+ class Io {
2205
+ constructor(e, n = null) {
2206
+ this.value = e, this.selector = n;
2207
+ }
2208
+ get a() {
2209
+ return this.value.a;
2210
+ }
2211
+ set a(e) {
2212
+ throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value");
2213
+ }
2214
+ get b() {
2215
+ return this.value.b;
2216
+ }
2217
+ set b(e) {
2218
+ throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value");
2219
+ }
2220
+ get c() {
2221
+ return this.value.c;
2222
+ }
2223
+ set c(e) {
2224
+ throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value");
2225
+ }
2226
+ selectorString() {
2227
+ return typeof this.selector == "string" || this.selector instanceof String ? this.selector : this.selector instanceof Object && this.selector.type === "Selector" ? To(this.selector) : "";
2228
+ }
2229
+ toObject() {
2230
+ return this.value;
2231
+ }
2232
+ toArray() {
2233
+ return [this.value.a, this.value.b, this.value.c];
2234
+ }
2235
+ toString() {
2236
+ return `(${this.value.a},${this.value.b},${this.value.c})`;
2237
+ }
2238
+ toJSON() {
2239
+ return {
2240
+ selector: this.selectorString(),
2241
+ asObject: this.toObject(),
2242
+ asArray: this.toArray(),
2243
+ asString: this.toString()
2244
+ };
2245
+ }
2246
+ isEqualTo(e) {
2247
+ return kr(this, e);
2248
+ }
2249
+ isGreaterThan(e) {
2250
+ return yr(this, e);
2251
+ }
2252
+ isLessThan(e) {
2253
+ return Sr(this, e);
2254
+ }
2255
+ static calculate(e) {
2256
+ return Pe(e);
2257
+ }
2258
+ static compare(e, n) {
2259
+ return Ye(e, n);
2260
+ }
2261
+ static equals(e, n) {
2262
+ return kr(e, n);
2263
+ }
2264
+ static lessThan(e, n) {
2265
+ return Sr(e, n);
2266
+ }
2267
+ static greaterThan(e, n) {
2268
+ return yr(e, n);
2269
+ }
2270
+ static min(...e) {
2271
+ return Oo(...e);
2272
+ }
2273
+ static max(...e) {
2274
+ return un(...e);
2275
+ }
2276
+ static sortAsc(...e) {
2277
+ return Wr(...e);
2278
+ }
2279
+ static sortDesc(...e) {
2280
+ return Kr(...e);
2281
+ }
2282
+ }
2283
+ const xr = (t) => {
2284
+ const e = {
2285
+ a: 0,
2286
+ b: 0,
2287
+ c: 0
2288
+ };
2289
+ return t.children.forEach((n) => {
2290
+ switch (n.type) {
2291
+ case "IdSelector":
2292
+ e.a += 1;
2293
+ break;
2294
+ case "AttributeSelector":
2295
+ case "ClassSelector":
2296
+ e.b += 1;
2297
+ break;
2298
+ case "PseudoClassSelector":
2299
+ switch (n.name.toLowerCase()) {
2300
+ case "where":
2301
+ break;
2302
+ case "is":
2303
+ case "matches":
2304
+ case "-webkit-any":
2305
+ case "-moz-any":
2306
+ case "any":
2307
+ case "not":
2308
+ case "has":
2309
+ if (n.children) {
2310
+ const i = un(...Pe(n.children.first));
2311
+ e.a += i.a, e.b += i.b, e.c += i.c;
2312
+ }
2313
+ break;
2314
+ case "nth-child":
2315
+ case "nth-last-child":
2316
+ if (e.b += 1, n.children.first.selector) {
2317
+ const i = un(...Pe(n.children.first.selector));
2318
+ e.a += i.a, e.b += i.b, e.c += i.c;
2319
+ }
2320
+ break;
2321
+ case "host-context":
2322
+ case "host":
2323
+ if (e.b += 1, n.children) {
2324
+ const i = { type: "Selector", children: [] };
2325
+ let o = !1;
2326
+ n.children.first.children.forEach((f) => {
2327
+ if (o) return !1;
2328
+ if (f.type === "Combinator")
2329
+ return o = !0, !1;
2330
+ i.children.push(f);
2331
+ });
2332
+ const a = Pe(i)[0];
2333
+ e.a += a.a, e.b += a.b, e.c += a.c;
2334
+ }
2335
+ break;
2336
+ case "after":
2337
+ case "before":
2338
+ case "first-letter":
2339
+ case "first-line":
2340
+ e.c += 1;
2341
+ break;
2342
+ default:
2343
+ e.b += 1;
2344
+ break;
2345
+ }
2346
+ break;
2347
+ case "PseudoElementSelector":
2348
+ switch (n.name) {
2349
+ case "slotted":
2350
+ if (e.c += 1, n.children) {
2351
+ const i = { type: "Selector", children: [] };
2352
+ let o = !1;
2353
+ n.children.first.children.forEach((f) => {
2354
+ if (o) return !1;
2355
+ if (f.type === "Combinator")
2356
+ return o = !0, !1;
2357
+ i.children.push(f);
2358
+ });
2359
+ const a = Pe(i)[0];
2360
+ e.a += a.a, e.b += a.b, e.c += a.c;
2361
+ }
2362
+ break;
2363
+ case "view-transition-group":
2364
+ case "view-transition-image-pair":
2365
+ case "view-transition-old":
2366
+ case "view-transition-new":
2367
+ if (n.children && n.children.first.value === "*")
2368
+ break;
2369
+ e.c += 1;
2370
+ break;
2371
+ default:
2372
+ e.c += 1;
2373
+ break;
2374
+ }
2375
+ break;
2376
+ case "TypeSelector":
2377
+ let r = n.name;
2378
+ r.includes("|") && (r = r.split("|")[1]), r !== "*" && (e.c += 1);
2379
+ break;
2380
+ }
2381
+ }), new Io(e, t);
2382
+ }, No = (t) => {
2383
+ if (typeof t == "string" || t instanceof String)
2384
+ try {
2385
+ return pr(t, {
2386
+ context: "selectorList"
2387
+ });
2388
+ } catch (e) {
2389
+ throw new TypeError(`Could not convert passed in source '${t}' to SelectorList: ${e.message}`);
2390
+ }
2391
+ if (t instanceof Object) {
2392
+ if (t.type && ["Selector", "SelectorList"].includes(t.type))
2393
+ return t;
2394
+ if (t.type && t.type === "Raw")
2395
+ try {
2396
+ return pr(t.value, {
2397
+ context: "selectorList"
2398
+ });
2399
+ } catch (e) {
2400
+ throw new TypeError(`Could not convert passed in source to SelectorList: ${e.message}`);
2401
+ }
2402
+ throw new TypeError("Passed in source is an Object but no AST / AST of the type Selector or SelectorList");
2403
+ }
2404
+ throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.");
2405
+ }, Pe = (t) => {
2406
+ if (!t)
2407
+ return [];
2408
+ const e = No(t);
2409
+ if (e.type === "Selector")
2410
+ return [xr(t)];
2411
+ if (e.type === "SelectorList") {
2412
+ const n = [];
2413
+ return e.children.forEach((r) => {
2414
+ const i = xr(r);
2415
+ n.push(i);
2416
+ }), n;
2417
+ }
2418
+ };
2419
+ function xn(t, e) {
2420
+ return e >= 65 && e <= 90 && (e = e | 32), t === e;
2421
+ }
2422
+ function G(t, e) {
2423
+ if (t === e) return !0;
2424
+ let n = t.length;
2425
+ if (n !== e.length) return !1;
2426
+ for (let r = 0; r < n; r++)
2427
+ if (xn(t.charCodeAt(r), e.charCodeAt(r)) === !1)
2428
+ return !1;
2429
+ return !0;
2430
+ }
2431
+ function pe(t, e) {
2432
+ if (t === e) return !0;
2433
+ let n = e.length, r = n - t.length;
2434
+ if (r < 0)
2435
+ return !1;
2436
+ for (let i = n - 1; i >= r; i--)
2437
+ if (xn(t.charCodeAt(i - r), e.charCodeAt(i)) === !1)
2438
+ return !1;
2439
+ return !0;
2440
+ }
2441
+ function Cn(t, e) {
2442
+ if (t === e) return !0;
2443
+ let n = t.length;
2444
+ if (e.length < n) return !1;
2445
+ for (let r = 0; r < n; r++)
2446
+ if (xn(t.charCodeAt(r), e.charCodeAt(r)) === !1)
2447
+ return !1;
2448
+ return !0;
2449
+ }
2450
+ const $o = "Atrule", Do = "MediaQuery", Po = "MediaFeature", Mo = "Rule", bn = "Selector", Qr = "TypeSelector", He = "PseudoClassSelector", Yr = "AttributeSelector", Jr = "PseudoElementSelector", hn = "Declaration", zo = "Value", he = "Identifier", Fo = "Nth", Ro = "Combinator", qo = "Number", Xr = "Dimension", ze = "Operator", Bo = "Hash", jo = "Url", wn = "Function";
2451
+ function Cr(t, e, n) {
2452
+ let r = t.value.children.first;
2453
+ return G(e, t.property) && r.type === he && G(n, r.name);
2454
+ }
2455
+ function Uo(t) {
2456
+ let e = !1;
2457
+ return ue(t, function(n) {
2458
+ if (n.type === hn && (Cr(n, "-webkit-appearance", "none") || Cr(n, "-moz-appearance", "meterbar")))
2459
+ return e = !0, this.break;
2460
+ }), e;
2461
+ }
2462
+ function Vo(t) {
2463
+ let e = !1;
2464
+ return ue(t, function(n) {
2465
+ let r = n.children, i = n.name, o = n.value;
2466
+ if (n.type === Do && r.size === 1 && r.first.type === he) {
2467
+ let a = r.first.name;
2468
+ if (Cn("\\0", a) || pe("\\9 ", a))
2469
+ return e = !0, this.break;
2470
+ } else if (n.type === Po) {
2471
+ if (o !== null && o.unit === "\\0")
2472
+ return e = !0, this.break;
2473
+ if (G("-moz-images-in-menus", i) || G("min--moz-device-pixel-ratio", i) || G("-ms-high-contrast", i))
2474
+ return e = !0, this.break;
2475
+ if (G("min-resolution", i) && G(".001", o.value) && G("dpcm", o.unit))
2476
+ return e = !0, this.break;
2477
+ if (G("-webkit-min-device-pixel-ratio", i)) {
2478
+ let a = o.value;
2479
+ if (G("0", a) || G("10000", a))
2480
+ return e = !0, this.break;
2481
+ }
2482
+ }
2483
+ }), e;
2484
+ }
2485
+ const br = 45;
2486
+ function xe(t) {
2487
+ return t.charCodeAt(0) === br && t.charCodeAt(1) !== br && t.indexOf("-", 2) !== -1;
2488
+ }
2489
+ class le {
2490
+ /** @param {string[]} items */
2491
+ constructor(e) {
2492
+ this.set = new Set(e);
2493
+ }
2494
+ /** @param {string} item */
2495
+ has(e) {
2496
+ return this.set.has(e.toLowerCase());
2497
+ }
2498
+ }
2499
+ function Zr(t, e) {
2500
+ let n = [];
2501
+ return ue(t, {
2502
+ visit: bn,
2503
+ enter: function(r) {
2504
+ n.push(e(r));
2505
+ }
2506
+ }), n;
2507
+ }
2508
+ const ei = new le([
2509
+ "nth-child",
2510
+ "where",
2511
+ "not",
2512
+ "is",
2513
+ "has",
2514
+ "nth-last-child",
2515
+ "matches",
2516
+ "-webkit-any",
2517
+ "-moz-any"
2518
+ ]);
2519
+ function ti(t) {
2520
+ let e = !1;
2521
+ return ue(t, function(n) {
2522
+ if (n.type === Yr) {
2523
+ let r = n.name.name;
2524
+ if (G("role", r) || Cn("aria-", r))
2525
+ return e = !0, this.break;
2526
+ } else if (n.type === He && ei.has(n.name)) {
2527
+ let r = Zr(n, ti);
2528
+ for (let i of r)
2529
+ if (i === !0) {
2530
+ e = !0;
2531
+ break;
2532
+ }
2533
+ return this.skip;
2534
+ }
2535
+ }), e;
2536
+ }
2537
+ function Go(t) {
2538
+ let e = !1;
2539
+ return ue(t, function(n) {
2540
+ let r = n.type;
2541
+ if ((r === Jr || r === Qr || r === He) && xe(n.name))
2542
+ return e = !0, this.break;
2543
+ }), e;
2544
+ }
2545
+ function Ho(t) {
2546
+ let e = [];
2547
+ return ue(t, function(n) {
2548
+ n.type === He && e.push(n.name);
2549
+ }), e.length === 0 ? !1 : e;
2550
+ }
2551
+ function ni(t) {
2552
+ let e = 0;
2553
+ return ue(t, function(n) {
2554
+ let r = n.type;
2555
+ if (!(r === bn || r === Fo)) {
2556
+ if (e++, (r === Jr || r === Qr || r === He) && xe(n.name) && e++, r === Yr)
2557
+ return n.value && e++, this.skip;
2558
+ if (r === He && ei.has(n.name)) {
2559
+ let i = Zr(n, ni);
2560
+ if (i.length === 0) return;
2561
+ for (let o of i)
2562
+ e += o;
2563
+ return this.skip;
2564
+ }
2565
+ }
2566
+ }), e;
2567
+ }
2568
+ function Wo(t, e) {
2569
+ ue(t, function(n, r) {
2570
+ if (n.type === Ro) {
2571
+ let i = n.loc, o = n.name;
2572
+ if (i === null) {
2573
+ let a = r.prev.data.loc.end, f = {
2574
+ offset: a.offset,
2575
+ line: a.line,
2576
+ column: a.column
2577
+ };
2578
+ e({
2579
+ name: o,
2580
+ loc: {
2581
+ start: f,
2582
+ end: {
2583
+ offset: f.offset + 1,
2584
+ line: f.line,
2585
+ column: f.column + 1
2586
+ }
2587
+ }
2588
+ });
2589
+ } else
2590
+ e({
2591
+ name: o,
2592
+ loc: i
2593
+ });
2594
+ }
2595
+ });
2596
+ }
2597
+ const Ko = new le([
2598
+ // CSS Named Colors
2599
+ // Spec: https://drafts.csswg.org/css-color/#named-colors
2600
+ // Heuristic: popular names first for quick finding in set.has()
2601
+ // See: https://docs.google.com/spreadsheets/d/1OU8ahxC5oYU8VRryQs9BzHToaXcOntVlh6KUHjm15G4/edit#gid=2096495459
2602
+ "white",
2603
+ "black",
2604
+ "red",
2605
+ "gray",
2606
+ "silver",
2607
+ "grey",
2608
+ "green",
2609
+ "orange",
2610
+ "blue",
2611
+ "dimgray",
2612
+ "whitesmoke",
2613
+ "lightgray",
2614
+ "lightgrey",
2615
+ "yellow",
2616
+ "gold",
2617
+ "pink",
2618
+ "gainsboro",
2619
+ "magenta",
2620
+ "purple",
2621
+ "darkgray",
2622
+ "navy",
2623
+ "darkred",
2624
+ "teal",
2625
+ "maroon",
2626
+ "darkgrey",
2627
+ "tomato",
2628
+ "darkorange",
2629
+ "brown",
2630
+ "crimson",
2631
+ "lightyellow",
2632
+ "slategray",
2633
+ "salmon",
2634
+ "lightgreen",
2635
+ "lightblue",
2636
+ "orangered",
2637
+ "aliceblue",
2638
+ "dodgerblue",
2639
+ "lime",
2640
+ "darkblue",
2641
+ "darkgoldenrod",
2642
+ "skyblue",
2643
+ "royalblue",
2644
+ "darkgreen",
2645
+ "ivory",
2646
+ "olive",
2647
+ "aqua",
2648
+ "turquoise",
2649
+ "cyan",
2650
+ "khaki",
2651
+ "beige",
2652
+ "snow",
2653
+ "ghostwhite",
2654
+ "limegreen",
2655
+ "coral",
2656
+ "dimgrey",
2657
+ "hotpink",
2658
+ "midnightblue",
2659
+ "firebrick",
2660
+ "indigo",
2661
+ "wheat",
2662
+ "mediumblue",
2663
+ "lightpink",
2664
+ "plum",
2665
+ "azure",
2666
+ "violet",
2667
+ "lavender",
2668
+ "deepskyblue",
2669
+ "darkslategrey",
2670
+ "goldenrod",
2671
+ "cornflowerblue",
2672
+ "lightskyblue",
2673
+ "indianred",
2674
+ "yellowgreen",
2675
+ "saddlebrown",
2676
+ "palegreen",
2677
+ "bisque",
2678
+ "tan",
2679
+ "antiquewhite",
2680
+ "steelblue",
2681
+ "forestgreen",
2682
+ "fuchsia",
2683
+ "mediumaquamarine",
2684
+ "seagreen",
2685
+ "sienna",
2686
+ "deeppink",
2687
+ "mediumseagreen",
2688
+ "peru",
2689
+ "greenyellow",
2690
+ "lightgoldenrodyellow",
2691
+ "orchid",
2692
+ "cadetblue",
2693
+ "navajowhite",
2694
+ "lightsteelblue",
2695
+ "slategrey",
2696
+ "linen",
2697
+ "lightseagreen",
2698
+ "darkcyan",
2699
+ "lightcoral",
2700
+ "aquamarine",
2701
+ "blueviolet",
2702
+ "cornsilk",
2703
+ "lightsalmon",
2704
+ "chocolate",
2705
+ "lightslategray",
2706
+ "floralwhite",
2707
+ "darkturquoise",
2708
+ "darkslategray",
2709
+ "rebeccapurple",
2710
+ "burlywood",
2711
+ "chartreuse",
2712
+ "lightcyan",
2713
+ "lemonchiffon",
2714
+ "palevioletred",
2715
+ "darkslateblue",
2716
+ "mediumpurple",
2717
+ "lawngreen",
2718
+ "slateblue",
2719
+ "darkseagreen",
2720
+ "blanchedalmond",
2721
+ "mistyrose",
2722
+ "darkolivegreen",
2723
+ "seashell",
2724
+ "olivedrab",
2725
+ "peachpuff",
2726
+ "darkviolet",
2727
+ "powderblue",
2728
+ "darkmagenta",
2729
+ "lightslategrey",
2730
+ "honeydew",
2731
+ "palegoldenrod",
2732
+ "darkkhaki",
2733
+ "oldlace",
2734
+ "mintcream",
2735
+ "sandybrown",
2736
+ "mediumturquoise",
2737
+ "papayawhip",
2738
+ "paleturquoise",
2739
+ "mediumvioletred",
2740
+ "thistle",
2741
+ "springgreen",
2742
+ "moccasin",
2743
+ "rosybrown",
2744
+ "lavenderblush",
2745
+ "mediumslateblue",
2746
+ "darkorchid",
2747
+ "mediumorchid",
2748
+ "darksalmon",
2749
+ "mediumspringgreen"
2750
+ ]), Qo = new le([
2751
+ // CSS System Colors
2752
+ // Spec: https://drafts.csswg.org/css-color/#css-system-colors
2753
+ "accentcolor",
2754
+ "accentcolortext",
2755
+ "activetext",
2756
+ "buttonborder",
2757
+ "buttonface",
2758
+ "buttontext",
2759
+ "canvas",
2760
+ "canvastext",
2761
+ "field",
2762
+ "fieldtext",
2763
+ "graytext",
2764
+ "highlight",
2765
+ "highlighttext",
2766
+ "linktext",
2767
+ "mark",
2768
+ "marktext",
2769
+ "selecteditem",
2770
+ "selecteditemtext",
2771
+ "visitedtext"
2772
+ ]), Yo = new le([
2773
+ "rgba",
2774
+ "rgb",
2775
+ "hsla",
2776
+ "hsl",
2777
+ "oklch",
2778
+ "color",
2779
+ "hwb",
2780
+ "lch",
2781
+ "lab",
2782
+ "oklab"
2783
+ ]), Jo = new le([
2784
+ "transparent",
2785
+ "currentcolor"
2786
+ ]), vt = new le([
2787
+ "auto",
2788
+ "none",
2789
+ // for `text-shadow`, `box-shadow` and `background`
2790
+ "inherit",
2791
+ "initial",
2792
+ "unset",
2793
+ "revert",
2794
+ "revert-layer"
2795
+ ]);
2796
+ function lt(t) {
2797
+ let e = t.children, n = e.size;
2798
+ if (!e || n > 1 || n === 0) return !1;
2799
+ let r = e.first;
2800
+ return r.type === he && vt.has(r.name);
2801
+ }
2802
+ const Xo = new le([
2803
+ "caption",
2804
+ "icon",
2805
+ "menu",
2806
+ "message-box",
2807
+ "small-caption",
2808
+ "status-bar"
2809
+ ]), Zo = new le([
2810
+ /* <absolute-size> values */
2811
+ "xx-small",
2812
+ "x-small",
2813
+ "small",
2814
+ "medium",
2815
+ "large",
2816
+ "x-large",
2817
+ "xx-large",
2818
+ "xxx-large",
2819
+ /* <relative-size> values */
2820
+ "smaller",
2821
+ "larger"
2822
+ ]), ea = 44, wr = 47;
2823
+ function rn(t) {
2824
+ let e = t.children.first;
2825
+ return e === null ? !1 : e.type === he && Xo.has(e.name);
2826
+ }
2827
+ function ta(t, e, n) {
2828
+ let r = Array.from({ length: 2 }), i, o;
2829
+ t.children.forEach(function(f, c) {
2830
+ let s = c.prev ? c.prev.data : void 0, l = c.next ? c.next.data : void 0;
2831
+ if (f.type === he && vt.has(f.name) && n({
2832
+ type: "keyword",
2833
+ value: f.name
2834
+ }), l && l.type === ze && l.value.charCodeAt(0) === wr) {
2835
+ i = e(f);
2836
+ return;
2837
+ }
2838
+ if (s && s.type === ze && s.value.charCodeAt(0) === wr) {
2839
+ o = e(f);
2840
+ return;
2841
+ }
2842
+ if (l && l.type === ze && l.value.charCodeAt(0) === ea && !r[0]) {
2843
+ r[0] = f, !i && s && (i = e(s));
2844
+ return;
2845
+ }
2846
+ if (f.type !== qo) {
2847
+ if (c.next === null) {
2848
+ r[1] = f, !i && !r[0] && s && (i = e(s));
2849
+ return;
2850
+ }
2851
+ if (f.type === he) {
2852
+ let m = f.name;
2853
+ if (Zo.has(m)) {
2854
+ i = m;
2855
+ return;
2856
+ }
2857
+ }
2858
+ }
2859
+ });
2860
+ let a = r[0] || r[1] ? e({
2861
+ loc: {
2862
+ start: {
2863
+ offset: (r[0] || r[1]).loc.start.offset
2864
+ },
2865
+ end: {
2866
+ offset: r[1].loc.end.offset
2867
+ }
2868
+ }
2869
+ }) : null;
2870
+ return {
2871
+ font_size: i,
2872
+ line_height: o,
2873
+ font_family: a
2874
+ };
2875
+ }
2876
+ const na = new le([
2877
+ "linear",
2878
+ "ease",
2879
+ "ease-in",
2880
+ "ease-out",
2881
+ "ease-in-out",
2882
+ "step-start",
2883
+ "step-end"
2884
+ ]), ra = new le([
2885
+ "cubic-bezier",
2886
+ "steps"
2887
+ ]);
2888
+ function ia(t, e) {
2889
+ let n = !1;
2890
+ for (let r of t) {
2891
+ let i = r.type, o = r.name;
2892
+ i === ze ? n = !1 : i === Xr && n === !1 ? (n = !0, e({
2893
+ type: "duration",
2894
+ value: r
2895
+ })) : i === he ? na.has(o) ? e({
2896
+ type: "fn",
2897
+ value: r
2898
+ }) : vt.has(o) && e({
2899
+ type: "keyword",
2900
+ value: r
2901
+ }) : i === wn && ra.has(o) && e({
2902
+ type: "fn",
2903
+ value: r
2904
+ });
2905
+ }
2906
+ }
2907
+ function ri(t) {
2908
+ let e = t.children;
2909
+ if (!e)
2910
+ return !1;
2911
+ for (let n of e) {
2912
+ let { type: r, name: i } = n;
2913
+ if (r === he && xe(i) || r === wn && (xe(i) || ri(n)))
2914
+ return !0;
2915
+ }
2916
+ return !1;
2917
+ }
2918
+ class x {
2919
+ /** @param {boolean} useLocations */
2920
+ constructor(e = !1) {
2921
+ this._items = /* @__PURE__ */ new Map(), this._total = 0, e && (this._nodes = []), this._useLocations = e;
2922
+ }
2923
+ /**
2924
+ * @param {string} item
2925
+ * @param {import('css-tree').CssLocation} node_location
2926
+ */
2927
+ p(e, n) {
2928
+ let r = this._total;
2929
+ if (this._useLocations) {
2930
+ let i = n.start, o = i.offset, a = r * 4;
2931
+ this._nodes[a] = i.line, this._nodes[a + 1] = i.column, this._nodes[a + 2] = o, this._nodes[a + 3] = n.end.offset - o;
2932
+ }
2933
+ if (this._items.has(e)) {
2934
+ this._items.get(e).push(r), this._total++;
2935
+ return;
2936
+ }
2937
+ this._items.set(e, [r]), this._total++;
2938
+ }
2939
+ size() {
2940
+ return this._total;
2941
+ }
2942
+ /**
2943
+ * @typedef CssLocation
2944
+ * @property {number} line
2945
+ * @property {number} column
2946
+ * @property {number} offset
2947
+ * @property {number} length
2948
+ *
2949
+ * @returns {{
2950
+ * total: number;
2951
+ * totalUnique: number;
2952
+ * uniquenessRatio: number;
2953
+ * unique: Record<string, number>;
2954
+ * } & ({
2955
+ * uniqueWithLocations: Record<string, CssLocation[]>
2956
+ * } | {
2957
+ * uniqueWithLocations?: undefined
2958
+ * })}
2959
+ */
2960
+ c() {
2961
+ let e = /* @__PURE__ */ new Map(), n = {}, r = this._useLocations, i = this._items, o = this._nodes, a = i.size;
2962
+ i.forEach((s, l) => {
2963
+ if (r) {
2964
+ let m = s.map(function(S) {
2965
+ let b = S * 4;
2966
+ return {
2967
+ line: o[b],
2968
+ column: o[b + 1],
2969
+ offset: o[b + 2],
2970
+ length: o[b + 3]
2971
+ };
2972
+ });
2973
+ e.set(l, m);
2974
+ } else
2975
+ n[l] = s.length;
2976
+ });
2977
+ let f = this._total, c = {
2978
+ total: f,
2979
+ totalUnique: a,
2980
+ unique: n,
2981
+ uniquenessRatio: f === 0 ? 0 : a / f
2982
+ };
2983
+ return r && (c.uniqueWithLocations = Object.fromEntries(e)), c;
2984
+ }
2985
+ }
2986
+ class sn {
2987
+ /** @param {boolean} useLocations */
2988
+ constructor(e) {
2989
+ this._list = new x(e), this._contexts = /* @__PURE__ */ new Map(), this._useLocations = e;
2990
+ }
2991
+ /**
2992
+ * Add an item to this _list's context
2993
+ * @param {string} item Item to push
2994
+ * @param {string} context Context to push Item to
2995
+ * @param {import('css-tree').CssLocation} node_location
2996
+ */
2997
+ push(e, n, r) {
2998
+ this._list.p(e, r), this._contexts.has(n) || this._contexts.set(n, new x(this._useLocations)), this._contexts.get(n).p(e, r);
2999
+ }
3000
+ count() {
3001
+ let e = /* @__PURE__ */ new Map();
3002
+ for (let [n, r] of this._contexts.entries())
3003
+ e.set(n, r.c());
3004
+ return Object.assign(this._list.c(), {
3005
+ itemsPerContext: Object.fromEntries(e)
3006
+ });
3007
+ }
3008
+ }
3009
+ function sa(t) {
3010
+ let e = /* @__PURE__ */ new Map(), n = -1, r = 0, i = 0, o = t.length;
3011
+ for (let a = 0; a < o; a++) {
3012
+ let f = t[a], c = (e.get(f) || 0) + 1;
3013
+ e.set(f, c), c > n && (n = c, r = 0, i = 0), c >= n && (r++, i += f);
3014
+ }
3015
+ return i / r;
3016
+ }
3017
+ class re {
3018
+ constructor() {
3019
+ this._items = [], this._sum = 0;
3020
+ }
3021
+ /**
3022
+ * Add a new Integer at the end of this AggregateCollection
3023
+ * @param {number} item - The item to add
3024
+ */
3025
+ push(e) {
3026
+ this._items.push(e), this._sum += e;
3027
+ }
3028
+ size() {
3029
+ return this._items.length;
3030
+ }
3031
+ aggregate() {
3032
+ let e = this._items.length;
3033
+ if (e === 0)
3034
+ return {
3035
+ min: 0,
3036
+ max: 0,
3037
+ mean: 0,
3038
+ mode: 0,
3039
+ range: 0,
3040
+ sum: 0
3041
+ };
3042
+ let n = this._items.slice().sort((f, c) => f - c), r = n[0], i = n[e - 1], o = sa(n), a = this._sum;
3043
+ return {
3044
+ min: r,
3045
+ max: i,
3046
+ mean: a / e,
3047
+ mode: o,
3048
+ range: i - r,
3049
+ sum: a
3050
+ };
3051
+ }
3052
+ /**
3053
+ * @returns {number[]} All _items in this collection
3054
+ */
3055
+ toArray() {
3056
+ return this._items;
3057
+ }
3058
+ }
3059
+ function oa(t) {
3060
+ if (vn(t) || xe(t)) return !1;
3061
+ let e = t.charCodeAt(0);
3062
+ return e === 47 || e === 42 || e === 95 || e === 43 || e === 38 || e === 36 || e === 35;
3063
+ }
3064
+ function vn(t) {
3065
+ return t.length < 3 ? !1 : t.charCodeAt(0) === 45 && t.charCodeAt(1) === 45;
3066
+ }
3067
+ function U(t, e) {
3068
+ return vn(e) ? !1 : pe(t, e);
3069
+ }
3070
+ function aa(t) {
3071
+ return xe(t) ? t.slice(t.indexOf("-", 2) + 1) : t;
3072
+ }
3073
+ function la(t) {
3074
+ let e = 5, n = t.indexOf(";"), r = t.indexOf(",");
3075
+ return n === -1 || r !== -1 && r < n ? t.substring(e, r) : t.substring(e, n);
3076
+ }
3077
+ function ca(t) {
3078
+ let e = t.children;
3079
+ if (e) {
3080
+ let n = e.last;
3081
+ return n && n.type === he && pe("\\9", n.name);
3082
+ }
3083
+ return !1;
3084
+ }
3085
+ let ua = new le([
3086
+ "border-radius",
3087
+ "border-top-left-radius",
3088
+ "border-top-right-radius",
3089
+ "border-bottom-right-radius",
3090
+ "border-bottom-left-radius",
3091
+ "border-start-start-radius",
3092
+ "border-start-end-radius",
3093
+ "border-end-end-radius",
3094
+ "border-end-start-radius"
3095
+ ]);
3096
+ function R(t, e) {
3097
+ return e === 0 ? 0 : t / e;
3098
+ }
3099
+ let ha = {
3100
+ useLocations: !1
3101
+ };
3102
+ function da(t, e = {}) {
3103
+ let r = Object.assign({}, ha, e).useLocations === !0, i = Date.now();
3104
+ function o(d) {
3105
+ return a(d).trim();
3106
+ }
3107
+ function a(d) {
3108
+ let w = d.loc;
3109
+ return t.substring(w.start.offset, w.end.offset);
3110
+ }
3111
+ let f = 0, c = 0, s = 0, l = {
3112
+ total: 0,
3113
+ /** @type {Map<string, { size: number, count: number } & ({ uniqueWithLocations?: undefined } | ({ uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */
3114
+ unique: /* @__PURE__ */ new Map()
3115
+ }, m = Date.now(), S = ii(t, {
3116
+ parseCustomProperty: !0,
3117
+ // To find font-families, colors, etc.
3118
+ positions: !0,
3119
+ // So we can use stringifyNode()
3120
+ /** @param {string} comment */
3121
+ onComment: function(d) {
3122
+ f++, c += d.length;
3123
+ }
3124
+ }), b = Date.now(), K = S.loc.end.line - S.loc.start.line + 1, q = 0, te = new re(), Ce = [], Te = new x(r), Fe = new x(r), Q = new x(r), Je = new x(r), Xe = new x(r), Ze = new x(r), u = new x(r), h = new x(r), g = new x(r), p = new x(r), Y = new x(r), B = new x(r), ge = 0, z = 0, ke = new re(), fe = new re(), At = new re(), An = new x(r), Ln = new x(r), En = new x(r), Lt = new x(r), _n = /* @__PURE__ */ new Set(), Et = new x(r), be, we, Tn = new re(), On = new re(), In = new re(), Nn = new x(r), et = new re(), $n = new x(r), Dn = [], _t = new x(r), Tt = new x(r), Pn = new x(r), Mn = new x(r), zn = /* @__PURE__ */ new Set(), Re = 0, Fn = new re(), tt = 0, Ot = 0, It = new x(r), qe = new x(r), Nt = new x(r), $t = new x(r), nt = new x(r), Be = new re(), Dt = new re(), Rn = new x(r), Pt = new x(r), qn = new x(r), Bn = new x(r), jn = new x(r), Mt = new x(r), zt = new x(r), Ft = new x(r), rt = new x(r), it = new x(r), Oe = new sn(r), Ie = new x(r), Rt = new sn(r), Un = new x(r), je = new x(r), Vn = new sn(r);
3125
+ ue(S, function(d) {
3126
+ switch (d.type) {
3127
+ case $o: {
3128
+ q++;
3129
+ let w = d.name;
3130
+ if (w === "font-face") {
3131
+ let _ = {};
3132
+ r && Te.p(d.loc.start.offset, d.loc), d.block.children.forEach((A) => {
3133
+ A.type === hn && (_[A.property] = o(A.value));
3134
+ }), Ce.push(_), te.push(1);
3135
+ break;
3136
+ }
3137
+ let y = 1;
3138
+ if (d.prelude !== null) {
3139
+ let _ = d.prelude, A = _ && o(d.prelude), v = _.loc;
3140
+ if (w === "media")
3141
+ Je.p(A, v), Vo(_) && (Xe.p(A, v), y++);
3142
+ else if (w === "supports")
3143
+ u.p(A, v), Uo(_) && (h.p(A, v), y++);
3144
+ else if (pe("keyframes", w)) {
3145
+ let C = "@" + w + " " + A;
3146
+ xe(w) && (p.p(C, v), y++), g.p(C, v);
3147
+ } else w === "import" ? Q.p(A, v) : w === "charset" ? Ze.p(A, v) : w === "container" ? Y.p(A, v) : w === "layer" ? A.split(",").forEach((C) => Fe.p(C.trim(), v)) : w === "property" && B.p(A, v);
3148
+ } else
3149
+ w === "layer" && (Fe.p("<anonymous>", d.loc), y++);
3150
+ te.push(y);
3151
+ break;
3152
+ }
3153
+ case Mo: {
3154
+ let w = d.prelude, y = d.block, _ = w.children, A = y.children, v = _ ? _.size : 0, C = A ? A.size : 0;
3155
+ ke.push(v + C), An.p(v + C, d.loc), fe.push(v), Ln.p(v, w.loc), At.push(C), En.p(C, y.loc), ge++, C === 0 && z++;
3156
+ break;
3157
+ }
3158
+ case bn: {
3159
+ let w = o(d);
3160
+ if (this.atrule && pe("keyframes", this.atrule.name))
3161
+ return Lt.p(w, d.loc), this.skip;
3162
+ ti(d) && Tt.p(w, d.loc);
3163
+ let y = Ho(d);
3164
+ if (y !== !1)
3165
+ for (let J of y)
3166
+ Pn.p(J, d.loc);
3167
+ let _ = ni(d);
3168
+ Go(d) && Et.p(w, d.loc), _n.add(w), et.push(_), $n.p(_, d.loc);
3169
+ let [{ value: A }] = Pe(d), v = A.a, C = A.b, L = A.c, I = [v, C, L];
3170
+ return Nn.p(v + "," + C + "," + L, d.loc), Tn.push(v), On.push(C), In.push(L), be === void 0 && (be = I), we === void 0 && (we = I), we !== void 0 && vr(we, I) < 0 && (we = I), be !== void 0 && vr(be, I) > 0 && (be = I), Dn.push(I), v > 0 && _t.p(w, d.loc), Wo(d, function(ne) {
3171
+ Mn.p(ne.name, ne.loc);
3172
+ }), this.skip;
3173
+ }
3174
+ case Xr: {
3175
+ if (!this.declaration)
3176
+ break;
3177
+ let w = d.unit;
3178
+ return pe("\\9", w) ? Rt.push(w.substring(0, w.length - 2), this.declaration.property, d.loc) : Rt.push(w, this.declaration.property, d.loc), this.skip;
3179
+ }
3180
+ case jo: {
3181
+ if (Cn("data:", d.value)) {
3182
+ let w = d.value, y = w.length, _ = la(w);
3183
+ l.total++, s += y;
3184
+ let A = {
3185
+ /** @type {number} */
3186
+ line: d.loc.start.line,
3187
+ /** @type {number} */
3188
+ column: d.loc.start.column,
3189
+ /** @type {number} */
3190
+ offset: d.loc.start.offset,
3191
+ /** @type {number} */
3192
+ length: d.loc.end.offset - d.loc.start.offset
3193
+ };
3194
+ if (l.unique.has(_)) {
3195
+ let v = l.unique.get(_);
3196
+ v.count++, v.size += y, l.unique.set(_, v), r && v.uniqueWithLocations.push(A);
3197
+ } else {
3198
+ let v = {
3199
+ count: 1,
3200
+ size: y
3201
+ };
3202
+ r && (v.uniqueWithLocations = [A]), l.unique.set(_, v);
3203
+ }
3204
+ }
3205
+ break;
3206
+ }
3207
+ case zo: {
3208
+ if (lt(d)) {
3209
+ Dt.push(1), je.p(o(d), d.loc);
3210
+ break;
3211
+ }
3212
+ let w = this.declaration, { property: y, important: _ } = w, A = 1;
3213
+ ri(d) && (Rn.p(o(d), d.loc), A++), typeof _ == "string" && (Pt.p(a(d) + "!" + _, d.loc), A++), ca(d) && (Pt.p(o(d), d.loc), A++);
3214
+ let v = d.children, C = d.loc;
3215
+ if (Dt.push(A), U("z-index", y))
3216
+ return qn.p(o(d), C), this.skip;
3217
+ if (U("font", y)) {
3218
+ if (rn(d)) return;
3219
+ let { font_size: L, line_height: I, font_family: J } = ta(d, o, function(ne) {
3220
+ ne.type === "keyword" && je.p(ne.value, C);
3221
+ });
3222
+ J && Mt.p(J, C), L && zt.p(L, C), I && Ft.p(I, C);
3223
+ break;
3224
+ } else if (U("font-size", y)) {
3225
+ rn(d) || zt.p(o(d), C);
3226
+ break;
3227
+ } else if (U("font-family", y)) {
3228
+ rn(d) || Mt.p(o(d), C);
3229
+ break;
3230
+ } else if (U("line-height", y))
3231
+ Ft.p(o(d), C);
3232
+ else if (U("transition", y) || U("animation", y)) {
3233
+ ia(v, function(L) {
3234
+ L.type === "fn" ? rt.p(o(L.value), C) : L.type === "duration" ? it.p(o(L.value), C) : L.type === "keyword" && je.p(o(L.value), C);
3235
+ });
3236
+ break;
3237
+ } else if (U("animation-duration", y) || U("transition-duration", y)) {
3238
+ v && v.size > 1 ? v.forEach((L) => {
3239
+ L.type !== ze && it.p(o(L), C);
3240
+ }) : it.p(o(d), C);
3241
+ break;
3242
+ } else if (U("transition-timing-function", y) || U("animation-timing-function", y)) {
3243
+ v && v.size > 1 ? v.forEach((L) => {
3244
+ L.type !== ze && rt.p(o(L), C);
3245
+ }) : rt.p(o(d), C);
3246
+ break;
3247
+ } else if (ua.has(aa(y))) {
3248
+ lt(d) || Vn.push(o(d), y, C);
3249
+ break;
3250
+ } else U("text-shadow", y) ? lt(d) || Bn.p(o(d), C) : U("box-shadow", y) && (lt(d) || jn.p(o(d), C));
3251
+ ue(d, function(L) {
3252
+ let I = L.name;
3253
+ switch (L.type) {
3254
+ case Bo: {
3255
+ let J = L.value.length;
3256
+ return pe("\\9", L.value) && (J = J - 2), Oe.push("#" + L.value, y, C), Ie.p("hex" + J, C), this.skip;
3257
+ }
3258
+ case he: {
3259
+ vt.has(I) && je.p(I, C);
3260
+ let J = I.length;
3261
+ if (J > 20 || J < 3)
3262
+ return this.skip;
3263
+ if (Jo.has(I)) {
3264
+ let ne = o(L);
3265
+ Oe.push(ne, y, C), Ie.p(I.toLowerCase(), C);
3266
+ return;
3267
+ }
3268
+ if (Ko.has(I)) {
3269
+ let ne = o(L);
3270
+ Oe.push(ne, y, C), Ie.p("named", C);
3271
+ return;
3272
+ }
3273
+ if (Qo.has(I)) {
3274
+ let ne = o(L);
3275
+ Oe.push(ne, y, C), Ie.p("system", C);
3276
+ return;
3277
+ }
3278
+ return this.skip;
3279
+ }
3280
+ case wn: {
3281
+ if (G("var", I))
3282
+ return this.skip;
3283
+ if (Yo.has(I)) {
3284
+ Oe.push(o(L), y, L.loc), Ie.p(I.toLowerCase(), L.loc);
3285
+ return;
3286
+ }
3287
+ if (pe("gradient", I)) {
3288
+ Un.p(o(L), L.loc);
3289
+ return;
3290
+ }
3291
+ }
3292
+ }
3293
+ });
3294
+ break;
3295
+ }
3296
+ case hn: {
3297
+ if (this.atrulePrelude !== null)
3298
+ return this.skip;
3299
+ Re++;
3300
+ let w = 1;
3301
+ zn.add(o(d)), d.important === !0 && (tt++, w++, this.atrule && pe("keyframes", this.atrule.name) && (Ot++, w++)), Fn.push(w);
3302
+ let { property: y, loc: { start: _ } } = d, A = {
3303
+ start: {
3304
+ line: _.line,
3305
+ column: _.column,
3306
+ offset: _.offset
3307
+ },
3308
+ end: {
3309
+ offset: _.offset + y.length
3310
+ }
3311
+ };
3312
+ qe.p(y, A), xe(y) ? ($t.p(y, A), Be.push(2)) : oa(y) ? (Nt.p(y, A), Be.push(2)) : vn(y) ? (nt.p(y, A), Be.push(d.important ? 3 : 2), d.important === !0 && It.p(y, A)) : Be.push(1);
3313
+ break;
3314
+ }
3315
+ }
3316
+ });
3317
+ let Gn = zn.size, Ne = et.size(), qt = Tn.aggregate(), Bt = On.aggregate(), jt = In.aggregate(), Hn = _n.size, P = Object.assign, Wn = t.length, Ut = Ce.length, Kn = te.aggregate(), Qn = et.aggregate(), Yn = Fn.aggregate(), Jn = Be.aggregate(), Xn = Dt.aggregate();
3318
+ return {
3319
+ stylesheet: {
3320
+ sourceLinesOfCode: q + Ne + Re + Lt.size(),
3321
+ linesOfCode: K,
3322
+ size: Wn,
3323
+ complexity: Kn.sum + Qn.sum + Yn.sum + Jn.sum + Xn.sum,
3324
+ comments: {
3325
+ total: f,
3326
+ size: c
3327
+ },
3328
+ embeddedContent: {
3329
+ size: {
3330
+ total: s,
3331
+ ratio: R(s, Wn)
3332
+ },
3333
+ types: {
3334
+ total: l.total,
3335
+ totalUnique: l.unique.size,
3336
+ uniquenessRatio: R(l.unique.size, l.total),
3337
+ unique: Object.fromEntries(l.unique)
3338
+ }
3339
+ }
3340
+ },
3341
+ atrules: {
3342
+ fontface: P({
3343
+ total: Ut,
3344
+ totalUnique: Ut,
3345
+ unique: Ce,
3346
+ uniquenessRatio: Ut === 0 ? 0 : 1
3347
+ }, r ? {
3348
+ uniqueWithLocations: Te.c().uniqueWithLocations
3349
+ } : {}),
3350
+ import: Q.c(),
3351
+ media: P(
3352
+ Je.c(),
3353
+ {
3354
+ browserhacks: Xe.c()
3355
+ }
3356
+ ),
3357
+ charset: Ze.c(),
3358
+ supports: P(
3359
+ u.c(),
3360
+ {
3361
+ browserhacks: h.c()
3362
+ }
3363
+ ),
3364
+ keyframes: P(
3365
+ g.c(),
3366
+ {
3367
+ prefixed: P(
3368
+ p.c(),
3369
+ {
3370
+ ratio: R(p.size(), g.size())
3371
+ }
3372
+ )
3373
+ }
3374
+ ),
3375
+ container: Y.c(),
3376
+ layer: Fe.c(),
3377
+ property: B.c(),
3378
+ total: q,
3379
+ complexity: Kn
3380
+ },
3381
+ rules: {
3382
+ total: ge,
3383
+ empty: {
3384
+ total: z,
3385
+ ratio: R(z, ge)
3386
+ },
3387
+ sizes: P(
3388
+ ke.aggregate(),
3389
+ {
3390
+ items: ke.toArray()
3391
+ },
3392
+ An.c()
3393
+ ),
3394
+ selectors: P(
3395
+ fe.aggregate(),
3396
+ {
3397
+ items: fe.toArray()
3398
+ },
3399
+ Ln.c()
3400
+ ),
3401
+ declarations: P(
3402
+ At.aggregate(),
3403
+ {
3404
+ items: At.toArray()
3405
+ },
3406
+ En.c()
3407
+ )
3408
+ },
3409
+ selectors: {
3410
+ total: Ne,
3411
+ totalUnique: Hn,
3412
+ uniquenessRatio: R(Hn, Ne),
3413
+ specificity: P(
3414
+ {
3415
+ /** @type Specificity */
3416
+ min: we === void 0 ? [0, 0, 0] : we,
3417
+ /** @type Specificity */
3418
+ max: be === void 0 ? [0, 0, 0] : be,
3419
+ /** @type Specificity */
3420
+ sum: [qt.sum, Bt.sum, jt.sum],
3421
+ /** @type Specificity */
3422
+ mean: [qt.mean, Bt.mean, jt.mean],
3423
+ /** @type Specificity */
3424
+ mode: [qt.mode, Bt.mode, jt.mode],
3425
+ /** @type Specificity */
3426
+ items: Dn
3427
+ },
3428
+ Nn.c()
3429
+ ),
3430
+ complexity: P(
3431
+ Qn,
3432
+ $n.c(),
3433
+ {
3434
+ items: et.toArray()
3435
+ }
3436
+ ),
3437
+ id: P(
3438
+ _t.c(),
3439
+ {
3440
+ ratio: R(_t.size(), Ne)
3441
+ }
3442
+ ),
3443
+ pseudoClasses: Pn.c(),
3444
+ accessibility: P(
3445
+ Tt.c(),
3446
+ {
3447
+ ratio: R(Tt.size(), Ne)
3448
+ }
3449
+ ),
3450
+ keyframes: Lt.c(),
3451
+ prefixed: P(
3452
+ Et.c(),
3453
+ {
3454
+ ratio: R(Et.size(), Ne)
3455
+ }
3456
+ ),
3457
+ combinators: Mn.c()
3458
+ },
3459
+ declarations: {
3460
+ total: Re,
3461
+ totalUnique: Gn,
3462
+ uniquenessRatio: R(Gn, Re),
3463
+ importants: {
3464
+ total: tt,
3465
+ ratio: R(tt, Re),
3466
+ inKeyframes: {
3467
+ total: Ot,
3468
+ ratio: R(Ot, tt)
3469
+ }
3470
+ },
3471
+ complexity: Yn
3472
+ },
3473
+ properties: P(
3474
+ qe.c(),
3475
+ {
3476
+ prefixed: P(
3477
+ $t.c(),
3478
+ {
3479
+ ratio: R($t.size(), qe.size())
3480
+ }
3481
+ ),
3482
+ custom: P(
3483
+ nt.c(),
3484
+ {
3485
+ ratio: R(nt.size(), qe.size()),
3486
+ importants: P(
3487
+ It.c(),
3488
+ {
3489
+ ratio: R(It.size(), nt.size())
3490
+ }
3491
+ )
3492
+ }
3493
+ ),
3494
+ browserhacks: P(
3495
+ Nt.c(),
3496
+ {
3497
+ ratio: R(Nt.size(), qe.size())
3498
+ }
3499
+ ),
3500
+ complexity: Jn
3501
+ }
3502
+ ),
3503
+ values: {
3504
+ colors: P(
3505
+ Oe.count(),
3506
+ {
3507
+ formats: Ie.c()
3508
+ }
3509
+ ),
3510
+ gradients: Un.c(),
3511
+ fontFamilies: Mt.c(),
3512
+ fontSizes: zt.c(),
3513
+ lineHeights: Ft.c(),
3514
+ zindexes: qn.c(),
3515
+ textShadows: Bn.c(),
3516
+ boxShadows: jn.c(),
3517
+ borderRadiuses: Vn.count(),
3518
+ animations: {
3519
+ durations: it.c(),
3520
+ timingFunctions: rt.c()
3521
+ },
3522
+ prefixes: Rn.c(),
3523
+ browserhacks: Pt.c(),
3524
+ units: Rt.count(),
3525
+ complexity: Xn,
3526
+ keywords: je.c()
3527
+ },
3528
+ __meta__: {
3529
+ parseTime: b - m,
3530
+ analyzeTime: Date.now() - b,
3531
+ total: Date.now() - i
3532
+ }
3533
+ };
3534
+ }
3535
+ function vr(t, e) {
3536
+ return t[0] === e[0] ? t[1] === e[1] ? e[2] - t[2] : e[1] - t[1] : e[0] - t[0];
3537
+ }
3538
+ export {
3539
+ da as analyze,
3540
+ vr as compareSpecificity,
3541
+ xe as hasVendorPrefix,
3542
+ ti as isAccessibilitySelector,
3543
+ Vo as isMediaBrowserhack,
3544
+ oa as isPropertyHack,
3545
+ Go as isSelectorPrefixed,
3546
+ Uo as isSupportsBrowserhack,
3547
+ ri as isValuePrefixed,
3548
+ ni as selectorComplexity
3549
+ };