@projectwallace/css-analyzer 7.2.0 → 7.4.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.
@@ -1,71 +1,71 @@
1
- import Ht from "css-tree/parser";
1
+ import Xt from "css-tree/parser";
2
2
  import q from "css-tree/walker";
3
- import { calculateForAST as Wt } from "@bramus/specificity/core";
4
- function De(i, t) {
5
- return t >= 65 && t <= 90 && (t = t | 32), i === t;
3
+ import { calculateForAST as $t } from "@bramus/specificity/core";
4
+ function We(r, t) {
5
+ return t >= 65 && t <= 90 && (t = t | 32), r === t;
6
6
  }
7
- function z(i, t) {
8
- if (i === t) return !0;
9
- let r = i.length;
10
- if (r !== t.length) return !1;
11
- for (let e = 0; e < r; e++)
12
- if (De(i.charCodeAt(e), t.charCodeAt(e)) === !1)
7
+ function S(r, t) {
8
+ if (r === t) return !0;
9
+ let s = r.length;
10
+ if (s !== t.length) return !1;
11
+ for (let e = 0; e < s; e++)
12
+ if (We(r.charCodeAt(e), t.charCodeAt(e)) === !1)
13
13
  return !1;
14
14
  return !0;
15
15
  }
16
- function L(i, t) {
17
- if (i === t) return !0;
18
- let r = t.length, e = r - i.length;
16
+ function R(r, t) {
17
+ if (r === t) return !0;
18
+ let s = t.length, e = s - r.length;
19
19
  if (e < 0)
20
20
  return !1;
21
- for (let n = r - 1; n >= e; n--)
22
- if (De(i.charCodeAt(n - e), t.charCodeAt(n)) === !1)
21
+ for (let n = s - 1; n >= e; n--)
22
+ if (We(r.charCodeAt(n - e), t.charCodeAt(n)) === !1)
23
23
  return !1;
24
24
  return !0;
25
25
  }
26
- function Te(i, t) {
27
- if (i === t) return !0;
28
- let r = i.length;
29
- if (t.length < r) return !1;
30
- for (let e = 0; e < r; e++)
31
- if (De(i.charCodeAt(e), t.charCodeAt(e)) === !1)
26
+ function Ke(r, t) {
27
+ if (r === t) return !0;
28
+ let s = r.length;
29
+ if (t.length < s) return !1;
30
+ for (let e = 0; e < s; e++)
31
+ if (We(r.charCodeAt(e), t.charCodeAt(e)) === !1)
32
32
  return !1;
33
33
  return !0;
34
34
  }
35
- const Kt = "Atrule", jt = "MediaQuery", Bt = "Rule", Me = "Selector", Ot = "TypeSelector", G = "PseudoClassSelector", Rt = "AttributeSelector", Et = "PseudoElementSelector", Fe = "Declaration", Yt = "Value", O = "Identifier", Gt = "Nth", Qt = "Combinator", Ft = "Number", Ie = "Dimension", H = "Operator", Zt = "Hash", Nt = "Url", Ue = "Function";
36
- function vt(i, t, r) {
37
- let e = i.value.children.first;
38
- return z(t, i.property) && e.type === O && z(r, e.name);
35
+ const Me = "Atrule", ei = "MediaQuery", Ie = "Rule", Ne = "Selector", Wt = "TypeSelector", G = "PseudoClassSelector", Kt = "AttributeSelector", Nt = "PseudoElementSelector", He = "Declaration", ti = "Value", O = "Identifier", ii = "Nth", ri = "Combinator", jt = "Number", je = "Dimension", W = "Operator", si = "Hash", li = "Url", Be = "Function";
36
+ function Mt(r, t, s) {
37
+ let e = r.value.children.first;
38
+ return S(t, r.property) && e.type === O && S(s, e.name);
39
39
  }
40
- function Jt(i) {
40
+ function ni(r) {
41
41
  let t = !1;
42
- return q(i, function(r) {
43
- if (r.type === Fe && (vt(r, "-webkit-appearance", "none") || vt(r, "-moz-appearance", "meterbar")))
42
+ return q(r, function(s) {
43
+ if (s.type === He && (Mt(s, "-webkit-appearance", "none") || Mt(s, "-moz-appearance", "meterbar")))
44
44
  return t = !0, this.break;
45
45
  }), t;
46
46
  }
47
- function Xt(i) {
47
+ function ai(r) {
48
48
  let t = !1;
49
- return q(i, function(r) {
50
- let e = r.name, n = r.value;
51
- if (r.type === jt && r.mediaType !== null) {
52
- if (Te("\\0", r.mediaType) || L("\\9 ", r.mediaType))
49
+ return q(r, function(s) {
50
+ let e = s.name, n = s.value;
51
+ if (s.type === ei && s.mediaType !== null) {
52
+ if (Ke("\\0", s.mediaType) || R("\\9 ", s.mediaType))
53
53
  return t = !0, this.break;
54
- } else if (r.type === "Feature" && r.kind === "media") {
54
+ } else if (s.type === "Feature" && s.kind === "media") {
55
55
  if (n && n.unit && n.unit === "\\0")
56
56
  return t = !0, this.break;
57
- if (z("-moz-images-in-menus", e) || z("min--moz-device-pixel-ratio", e) || z("-ms-high-contrast", e))
57
+ if (S("-moz-images-in-menus", e) || S("min--moz-device-pixel-ratio", e) || S("-ms-high-contrast", e))
58
58
  return t = !0, this.break;
59
- if (z("min-resolution", e) && n && z(".001", n.value) && z("dpcm", n.unit))
59
+ if (S("min-resolution", e) && n && S(".001", n.value) && S("dpcm", n.unit))
60
60
  return t = !0, this.break;
61
- if (z("-webkit-min-device-pixel-ratio", e) && n && n.value && (z("0", n.value) || z("10000", n.value)))
61
+ if (S("-webkit-min-device-pixel-ratio", e) && n && n.value && (S("0", n.value) || S("10000", n.value)))
62
62
  return t = !0, this.break;
63
63
  }
64
64
  }), t;
65
65
  }
66
- const qt = 45;
67
- function F(i) {
68
- return i.charCodeAt(0) === qt && i.charCodeAt(1) !== qt && i.indexOf("-", 2) !== -1;
66
+ const It = 45;
67
+ function F(r) {
68
+ return r.charCodeAt(0) === It && r.charCodeAt(1) !== It && r.indexOf("-", 2) !== -1;
69
69
  }
70
70
  class A {
71
71
  /** @param {string[]} items */
@@ -77,16 +77,16 @@ class A {
77
77
  return this.set.has(t.toLowerCase());
78
78
  }
79
79
  }
80
- function Dt(i, t) {
81
- let r = [];
82
- return q(i, {
83
- visit: Me,
80
+ function Bt(r, t) {
81
+ let s = [];
82
+ return q(r, {
83
+ visit: Ne,
84
84
  enter: function(e) {
85
- r.push(t(e));
85
+ s.push(t(e));
86
86
  }
87
- }), r;
87
+ }), s;
88
88
  }
89
- const Tt = new A([
89
+ const Yt = new A([
90
90
  "nth-child",
91
91
  "where",
92
92
  "not",
@@ -97,15 +97,15 @@ const Tt = new A([
97
97
  "-webkit-any",
98
98
  "-moz-any"
99
99
  ]);
100
- function Mt(i) {
100
+ function Gt(r) {
101
101
  let t = !1;
102
- return q(i, function(r) {
103
- if (r.type === Rt) {
104
- let e = r.name.name;
105
- if (z("role", e) || Te("aria-", e))
102
+ return q(r, function(s) {
103
+ if (s.type === Kt) {
104
+ let e = s.name.name;
105
+ if (S("role", e) || Ke("aria-", e))
106
106
  return t = !0, this.break;
107
- } else if (r.type === G && Tt.has(r.name)) {
108
- let e = Dt(r, Mt);
107
+ } else if (s.type === G && Yt.has(s.name)) {
108
+ let e = Bt(s, Gt);
109
109
  for (let n of e)
110
110
  if (n === !0) {
111
111
  t = !0;
@@ -115,29 +115,29 @@ function Mt(i) {
115
115
  }
116
116
  }), t;
117
117
  }
118
- function $t(i) {
118
+ function oi(r) {
119
119
  let t = !1;
120
- return q(i, function(r) {
121
- let e = r.type;
122
- if ((e === Et || e === Ot || e === G) && F(r.name))
120
+ return q(r, function(s) {
121
+ let e = s.type;
122
+ if ((e === Nt || e === Wt || e === G) && F(s.name))
123
123
  return t = !0, this.break;
124
124
  }), t;
125
125
  }
126
- function ei(i) {
126
+ function ui(r) {
127
127
  let t = [];
128
- return q(i, function(r) {
129
- r.type === G && t.push(r.name);
128
+ return q(r, function(s) {
129
+ s.type === G && t.push(s.name);
130
130
  }), t.length === 0 ? !1 : t;
131
131
  }
132
- function It(i) {
132
+ function Qt(r) {
133
133
  let t = 0;
134
- return q(i, function(r) {
135
- let e = r.type;
136
- if (!(e === Me || e === Gt)) {
137
- if (t++, (e === Et || e === Ot || e === G) && F(r.name) && t++, e === Rt)
138
- return r.value && t++, this.skip;
139
- if (e === G && Tt.has(r.name)) {
140
- let n = Dt(r, It);
134
+ return q(r, function(s) {
135
+ let e = s.type;
136
+ if (!(e === Ne || e === ii)) {
137
+ if (t++, (e === Nt || e === Wt || e === G) && F(s.name) && t++, e === Kt)
138
+ return s.value && t++, this.skip;
139
+ if (e === G && Yt.has(s.name)) {
140
+ let n = Bt(s, Qt);
141
141
  if (n.length === 0) return;
142
142
  for (let a of n)
143
143
  t += a;
@@ -146,24 +146,24 @@ function It(i) {
146
146
  }
147
147
  }), t;
148
148
  }
149
- function ti(i, t) {
150
- q(i, function(r, e) {
151
- if (r.type === Qt) {
152
- let n = r.loc, a = r.name;
149
+ function ci(r, t) {
150
+ q(r, function(s, e) {
151
+ if (s.type === ri) {
152
+ let n = s.loc, a = s.name;
153
153
  if (n === null) {
154
- let d = e.prev.data.loc.end, b = {
155
- offset: d.offset,
156
- line: d.line,
157
- column: d.column
154
+ let y = e.prev.data.loc.end, k = {
155
+ offset: y.offset,
156
+ line: y.line,
157
+ column: y.column
158
158
  };
159
159
  t({
160
160
  name: a,
161
161
  loc: {
162
- start: b,
162
+ start: k,
163
163
  end: {
164
- offset: b.offset + 1,
165
- line: b.line,
166
- column: b.column + 1
164
+ offset: k.offset + 1,
165
+ line: k.line,
166
+ column: k.column + 1
167
167
  }
168
168
  }
169
169
  });
@@ -175,7 +175,7 @@ function ti(i, t) {
175
175
  }
176
176
  });
177
177
  }
178
- const ii = new A([
178
+ const fi = new A([
179
179
  // CSS Named Colors
180
180
  // Spec: https://drafts.csswg.org/css-color/#named-colors
181
181
  // Heuristic: popular names first for quick finding in set.has()
@@ -328,7 +328,7 @@ const ii = new A([
328
328
  "mediumorchid",
329
329
  "darksalmon",
330
330
  "mediumspringgreen"
331
- ]), ri = new A([
331
+ ]), pi = new A([
332
332
  // CSS System Colors
333
333
  // Spec: https://drafts.csswg.org/css-color/#css-system-colors
334
334
  "accentcolor",
@@ -350,7 +350,7 @@ const ii = new A([
350
350
  "selecteditem",
351
351
  "selecteditemtext",
352
352
  "visitedtext"
353
- ]), si = new A([
353
+ ]), hi = new A([
354
354
  "rgba",
355
355
  "rgb",
356
356
  "hsla",
@@ -361,10 +361,10 @@ const ii = new A([
361
361
  "lch",
362
362
  "lab",
363
363
  "oklab"
364
- ]), li = new A([
364
+ ]), mi = new A([
365
365
  "transparent",
366
366
  "currentcolor"
367
- ]), te = new A([
367
+ ]), ie = new A([
368
368
  "auto",
369
369
  "none",
370
370
  // for `text-shadow`, `box-shadow` and `background`
@@ -374,29 +374,29 @@ const ii = new A([
374
374
  "revert",
375
375
  "revert-layer"
376
376
  ]);
377
- function ee(i) {
378
- let t = i.children, r = t.size;
379
- if (!t || r > 1 || r === 0) return !1;
377
+ function te(r) {
378
+ let t = r.children, s = t.size;
379
+ if (!t || s > 1 || s === 0) return !1;
380
380
  let e = t.first;
381
- return e.type === O && te.has(e.name);
381
+ return e.type === O && ie.has(e.name);
382
382
  }
383
- function At(i) {
384
- return parseFloat(i) === 0;
383
+ function Ut(r) {
384
+ return parseFloat(r) === 0;
385
385
  }
386
- function ni(i) {
387
- for (let t of i.children.toArray())
388
- if (!(t.type === Ft && At(t.value)) && !(t.type === Ie && At(t.value)))
386
+ function gi(r) {
387
+ for (let t of r.children.toArray())
388
+ if (!(t.type === jt && Ut(t.value)) && !(t.type === je && Ut(t.value)))
389
389
  return !1;
390
390
  return !0;
391
391
  }
392
- const ai = new A([
392
+ const di = new A([
393
393
  "caption",
394
394
  "icon",
395
395
  "menu",
396
396
  "message-box",
397
397
  "small-caption",
398
398
  "status-bar"
399
- ]), oi = new A([
399
+ ]), yi = new A([
400
400
  /* <absolute-size> values */
401
401
  "xx-small",
402
402
  "x-small",
@@ -409,46 +409,46 @@ const ai = new A([
409
409
  /* <relative-size> values */
410
410
  "smaller",
411
411
  "larger"
412
- ]), ui = 44, Pt = 47;
413
- function Re(i) {
414
- let t = i.children.first;
415
- return t === null ? !1 : t.type === O && ai.has(t.name);
412
+ ]), wi = 44, Vt = 47;
413
+ function Ue(r) {
414
+ let t = r.children.first;
415
+ return t === null ? !1 : t.type === O && di.has(t.name);
416
416
  }
417
- function ci(i, t, r) {
418
- var b;
417
+ function bi(r, t, s) {
418
+ var k;
419
419
  let e = Array.from({ length: 2 }), n, a;
420
- i.children.forEach(function(y, _) {
421
- let w = _.prev ? _.prev.data : void 0, P = _.next ? _.next.data : void 0;
422
- if (y.type === O && te.has(y.name) && r({
420
+ r.children.forEach(function(w, _) {
421
+ let b = _.prev ? _.prev.data : void 0, P = _.next ? _.next.data : void 0;
422
+ if (w.type === O && ie.has(w.name) && s({
423
423
  type: "keyword",
424
- value: y.name
425
- }), P && P.type === H && P.value.charCodeAt(0) === Pt) {
426
- n = t(y);
424
+ value: w.name
425
+ }), P && P.type === W && P.value.charCodeAt(0) === Vt) {
426
+ n = t(w);
427
427
  return;
428
428
  }
429
- if (w && w.type === H && w.value.charCodeAt(0) === Pt) {
430
- a = t(y);
429
+ if (b && b.type === W && b.value.charCodeAt(0) === Vt) {
430
+ a = t(w);
431
431
  return;
432
432
  }
433
- if (P && P.type === H && P.value.charCodeAt(0) === ui && !e[0]) {
434
- e[0] = y, !n && w && (n = t(w));
433
+ if (P && P.type === W && P.value.charCodeAt(0) === wi && !e[0]) {
434
+ e[0] = w, !n && b && (n = t(b));
435
435
  return;
436
436
  }
437
- if (y.type !== Ft) {
437
+ if (w.type !== jt) {
438
438
  if (_.next === null) {
439
- e[1] = y, !n && !e[0] && w && (n = t(w));
439
+ e[1] = w, !n && !e[0] && b && (n = t(b));
440
440
  return;
441
441
  }
442
- if (y.type === O) {
443
- let R = y.name;
444
- if (oi.has(R)) {
445
- n = R;
442
+ if (w.type === O) {
443
+ let D = w.name;
444
+ if (yi.has(D)) {
445
+ n = D;
446
446
  return;
447
447
  }
448
448
  }
449
449
  }
450
450
  });
451
- let d = e[0] || e[1] ? t({
451
+ let y = e[0] || e[1] ? t({
452
452
  loc: {
453
453
  start: {
454
454
  offset: (e[0] || e[1]).loc.start.offset
@@ -456,17 +456,17 @@ function ci(i, t, r) {
456
456
  end: {
457
457
  // Either the node we detected as the last node, or the end of the whole value
458
458
  // It's never 0 because the first node is always a font-size or font-style
459
- offset: ((b = e[1]) == null ? void 0 : b.loc.end.offset) || i.loc.end.offset
459
+ offset: ((k = e[1]) == null ? void 0 : k.loc.end.offset) || r.loc.end.offset
460
460
  }
461
461
  }
462
462
  }) : null;
463
463
  return {
464
464
  font_size: n,
465
465
  line_height: a,
466
- font_family: d
466
+ font_family: y
467
467
  };
468
468
  }
469
- const fi = new A([
469
+ const ki = new A([
470
470
  "linear",
471
471
  "ease",
472
472
  "ease-in",
@@ -474,41 +474,41 @@ const fi = new A([
474
474
  "ease-in-out",
475
475
  "step-start",
476
476
  "step-end"
477
- ]), pi = new A([
477
+ ]), xi = new A([
478
478
  "cubic-bezier",
479
479
  "steps"
480
480
  ]);
481
- function hi(i, t) {
482
- let r = !1;
483
- for (let e of i) {
481
+ function Ci(r, t) {
482
+ let s = !1;
483
+ for (let e of r) {
484
484
  let n = e.type, a = e.name;
485
- n === H ? r = !1 : n === Ie && r === !1 ? (r = !0, t({
485
+ n === W ? s = !1 : n === je && s === !1 ? (s = !0, t({
486
486
  type: "duration",
487
487
  value: e
488
- })) : n === O ? fi.has(a) ? t({
488
+ })) : n === O ? ki.has(a) ? t({
489
489
  type: "fn",
490
490
  value: e
491
- }) : te.has(a) && t({
491
+ }) : ie.has(a) && t({
492
492
  type: "keyword",
493
493
  value: e
494
- }) : n === Ue && pi.has(a) && t({
494
+ }) : n === Be && xi.has(a) && t({
495
495
  type: "fn",
496
496
  value: e
497
497
  });
498
498
  }
499
499
  }
500
- function Ut(i) {
501
- let t = i.children;
500
+ function Zt(r) {
501
+ let t = r.children;
502
502
  if (!t)
503
503
  return !1;
504
- for (let r of t) {
505
- let { type: e, name: n } = r;
506
- if (e === O && F(n) || e === Ue && (F(n) || Ut(r)))
504
+ for (let s of t) {
505
+ let { type: e, name: n } = s;
506
+ if (e === O && F(n) || e === Be && (F(n) || Zt(s)))
507
507
  return !0;
508
508
  }
509
509
  return !1;
510
510
  }
511
- class u {
511
+ class o {
512
512
  /** @param {boolean} useLocations */
513
513
  constructor(t = !1) {
514
514
  this._items = /* @__PURE__ */ new Map(), this._total = 0, t && (this._nodes = []), this._useLocations = t;
@@ -517,11 +517,11 @@ class u {
517
517
  * @param {string | number} item
518
518
  * @param {import('css-tree').CssLocation} node_location
519
519
  */
520
- p(t, r) {
520
+ p(t, s) {
521
521
  let e = this._total;
522
522
  if (this._useLocations) {
523
- let n = r.start, a = n.offset, d = e * 4;
524
- this._nodes[d] = n.line, this._nodes[d + 1] = n.column, this._nodes[d + 2] = a, this._nodes[d + 3] = r.end.offset - a;
523
+ let n = s.start, a = n.offset, y = e * 4;
524
+ this._nodes[y] = n.line, this._nodes[y + 1] = n.column, this._nodes[y + 2] = a, this._nodes[y + 3] = s.end.offset - a;
525
525
  }
526
526
  if (this._items.has(t)) {
527
527
  this._items.get(t).push(e), this._total++;
@@ -551,35 +551,35 @@ class u {
551
551
  * })}
552
552
  */
553
553
  c() {
554
- let t = /* @__PURE__ */ new Map(), r = {}, e = this._useLocations, n = this._items, a = this._nodes, d = n.size;
555
- n.forEach((_, w) => {
554
+ let t = /* @__PURE__ */ new Map(), s = {}, e = this._useLocations, n = this._items, a = this._nodes, y = n.size;
555
+ n.forEach((_, b) => {
556
556
  if (e) {
557
- let P = _.map(function(R) {
558
- let D = R * 4;
557
+ let P = _.map(function(D) {
558
+ let T = D * 4;
559
559
  return {
560
- line: a[D],
561
- column: a[D + 1],
562
- offset: a[D + 2],
563
- length: a[D + 3]
560
+ line: a[T],
561
+ column: a[T + 1],
562
+ offset: a[T + 2],
563
+ length: a[T + 3]
564
564
  };
565
565
  });
566
- t.set(w, P);
566
+ t.set(b, P);
567
567
  } else
568
- r[w] = _.length;
568
+ s[b] = _.length;
569
569
  });
570
- let b = this._total, y = {
571
- total: b,
572
- totalUnique: d,
573
- unique: r,
574
- uniquenessRatio: b === 0 ? 0 : d / b
570
+ let k = this._total, w = {
571
+ total: k,
572
+ totalUnique: y,
573
+ unique: s,
574
+ uniquenessRatio: k === 0 ? 0 : y / k
575
575
  };
576
- return e && (y.uniqueWithLocations = Object.fromEntries(t)), y;
576
+ return e && (w.uniqueWithLocations = Object.fromEntries(t)), w;
577
577
  }
578
578
  }
579
- class Ee {
579
+ class Ve {
580
580
  /** @param {boolean} useLocations */
581
581
  constructor(t) {
582
- this._list = new u(t), this._contexts = /* @__PURE__ */ new Map(), this._useLocations = t;
582
+ this._list = new o(t), this._contexts = /* @__PURE__ */ new Map(), this._useLocations = t;
583
583
  }
584
584
  /**
585
585
  * Add an item to this _list's context
@@ -587,27 +587,27 @@ class Ee {
587
587
  * @param {string} context Context to push Item to
588
588
  * @param {import('css-tree').CssLocation} node_location
589
589
  */
590
- push(t, r, e) {
591
- this._list.p(t, e), this._contexts.has(r) || this._contexts.set(r, new u(this._useLocations)), this._contexts.get(r).p(t, e);
590
+ push(t, s, e) {
591
+ this._list.p(t, e), this._contexts.has(s) || this._contexts.set(s, new o(this._useLocations)), this._contexts.get(s).p(t, e);
592
592
  }
593
593
  count() {
594
594
  let t = /* @__PURE__ */ new Map();
595
- for (let [r, e] of this._contexts.entries())
596
- t.set(r, e.c());
595
+ for (let [s, e] of this._contexts.entries())
596
+ t.set(s, e.c());
597
597
  return Object.assign(this._list.c(), {
598
598
  itemsPerContext: Object.fromEntries(t)
599
599
  });
600
600
  }
601
601
  }
602
- function mi(i) {
603
- let t = /* @__PURE__ */ new Map(), r = -1, e = 0, n = 0, a = i.length;
604
- for (let d = 0; d < a; d++) {
605
- let b = i[d], y = (t.get(b) || 0) + 1;
606
- t.set(b, y), y > r && (r = y, e = 0, n = 0), y >= r && (e++, n += b);
602
+ function zi(r) {
603
+ let t = /* @__PURE__ */ new Map(), s = -1, e = 0, n = 0, a = r.length;
604
+ for (let y = 0; y < a; y++) {
605
+ let k = r[y], w = (t.get(k) || 0) + 1;
606
+ t.set(k, w), w > s && (s = w, e = 0, n = 0), w >= s && (e++, n += k);
607
607
  }
608
608
  return n / e;
609
609
  }
610
- class v {
610
+ class C {
611
611
  constructor() {
612
612
  this._items = [], this._sum = 0;
613
613
  }
@@ -632,14 +632,14 @@ class v {
632
632
  range: 0,
633
633
  sum: 0
634
634
  };
635
- let r = this._items.slice().sort((b, y) => b - y), e = r[0], n = r[t - 1], a = mi(r), d = this._sum;
635
+ let s = this._items.slice().sort((k, w) => k - w), e = s[0], n = s[t - 1], a = zi(s), y = this._sum;
636
636
  return {
637
637
  min: e,
638
638
  max: n,
639
- mean: d / t,
639
+ mean: y / t,
640
640
  mode: a,
641
641
  range: n - e,
642
- sum: d
642
+ sum: y
643
643
  };
644
644
  }
645
645
  /**
@@ -649,33 +649,33 @@ class v {
649
649
  return this._items;
650
650
  }
651
651
  }
652
- function gi(i) {
653
- if (Ve(i) || F(i)) return !1;
654
- let t = i.charCodeAt(0);
652
+ function Si(r) {
653
+ if (Ye(r) || F(r)) return !1;
654
+ let t = r.charCodeAt(0);
655
655
  return t === 47 || t === 42 || t === 95 || t === 43 || t === 38 || t === 36 || t === 35;
656
656
  }
657
- function Ve(i) {
658
- return i.length < 3 ? !1 : i.charCodeAt(0) === 45 && i.charCodeAt(1) === 45;
657
+ function Ye(r) {
658
+ return r.length < 3 ? !1 : r.charCodeAt(0) === 45 && r.charCodeAt(1) === 45;
659
659
  }
660
- function m(i, t) {
661
- return Ve(t) ? !1 : L(i, t);
660
+ function m(r, t) {
661
+ return Ye(t) ? !1 : R(r, t);
662
662
  }
663
- function di(i) {
664
- return F(i) ? i.slice(i.indexOf("-", 2) + 1) : i;
663
+ function _i(r) {
664
+ return F(r) ? r.slice(r.indexOf("-", 2) + 1) : r;
665
665
  }
666
- function yi(i) {
667
- let t = 5, r = i.indexOf(";"), e = i.indexOf(",");
668
- return r === -1 || e !== -1 && e < r ? i.substring(t, e) : i.substring(t, r);
666
+ function vi(r) {
667
+ let t = 5, s = r.indexOf(";"), e = r.indexOf(",");
668
+ return s === -1 || e !== -1 && e < s ? r.substring(t, e) : r.substring(t, s);
669
669
  }
670
- function wi(i) {
671
- let t = i.children;
670
+ function qi(r) {
671
+ let t = r.children;
672
672
  if (t) {
673
- let r = t.last;
674
- return r && r.type === O && L("\\9", r.name);
673
+ let s = t.last;
674
+ return s && s.type === O && R("\\9", s.name);
675
675
  }
676
676
  return !1;
677
677
  }
678
- let bi = new A([
678
+ let Ai = new A([
679
679
  "border-radius",
680
680
  "border-top-left-radius",
681
681
  "border-top-right-radius",
@@ -686,495 +686,529 @@ let bi = new A([
686
686
  "border-end-end-radius",
687
687
  "border-end-start-radius"
688
688
  ]);
689
- function C(i, t) {
690
- return t === 0 ? 0 : i / t;
689
+ function z(r, t) {
690
+ return t === 0 ? 0 : r / t;
691
691
  }
692
- let ki = {
692
+ let Pi = {
693
693
  useLocations: !1
694
694
  };
695
- function _i(i, t = {}) {
696
- let e = Object.assign({}, ki, t).useLocations === !0, n = Date.now();
697
- function a(s) {
698
- return d(s).trim();
695
+ function Di(r, t = {}) {
696
+ let e = Object.assign({}, Pi, t).useLocations === !0, n = Date.now();
697
+ function a(i) {
698
+ return y(i).trim();
699
699
  }
700
- function d(s) {
701
- let Y = s.loc;
702
- return i.substring(Y.start.offset, Y.end.offset);
700
+ function y(i) {
701
+ let Y = i.loc;
702
+ return r.substring(Y.start.offset, Y.end.offset);
703
703
  }
704
- let b = 0, y = 0, _ = 0, w = {
704
+ let k = 0, w = 0, _ = 0, b = {
705
705
  total: 0,
706
706
  /** @type {Map<string, { size: number, count: number } & ({ uniqueWithLocations?: undefined } | ({ uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */
707
707
  unique: /* @__PURE__ */ new Map()
708
- }, P = Date.now(), R = Ht(i, {
708
+ }, P = Date.now(), D = Xt(r, {
709
709
  parseCustomProperty: !0,
710
710
  // To find font-families, colors, etc.
711
711
  positions: !0,
712
712
  // So we can use stringifyNode()
713
713
  /** @param {string} comment */
714
- onComment: function(s) {
715
- b++, y += s.length;
714
+ onComment: function(i) {
715
+ k++, w += i.length;
716
716
  }
717
- }), D = Date.now(), Vt = R.loc.end.line - R.loc.start.line + 1, ie = 0, re = new v(), se = [], He = new u(e), le = new u(e), We = new u(e), Ke = new u(e), je = new u(e), Be = new u(e), Ye = new u(e), ne = new u(e), Ge = new u(e), ae = new u(e), oe = new u(e), Qe = new u(e), Q = new u(e), Ze = new u(e), ue = 0, ce = 0, fe = new v(), pe = new v(), he = new v(), Ne = new u(e), Je = new u(e), Xe = new u(e), me = new u(e), $e = /* @__PURE__ */ new Set(), ge = new u(e), T, M, et = new v(), tt = new v(), it = new v(), rt = new u(e), Z = new v(), st = new u(e), lt = [], de = new u(e), ye = new u(e), nt = new u(e), at = new u(e), ot = /* @__PURE__ */ new Set(), W = 0, ut = new v(), N = 0, we = 0, be = new u(e), K = new u(e), ke = new u(e), xe = new u(e), J = new u(e), j = new v(), Ce = new v(), ct = new u(e), ze = new u(e), ft = new u(e), pt = new u(e), ht = new u(e), _e = new u(e), Se = new u(e), ve = new u(e), X = new u(e), $ = new u(e), I = new Ee(e), U = new u(e), qe = new Ee(e), mt = new u(e), B = new u(e), gt = new Ee(e), dt = new u(e);
718
- q(R, function(s) {
719
- var Y, St;
720
- switch (s.type) {
721
- case Kt: {
722
- ie++;
723
- let p = s.name;
724
- if (p === "font-face") {
725
- let g = {};
726
- e && He.p(s.loc.start.offset, s.loc), s.block.children.forEach((c) => {
727
- c.type === Fe && (g[c.property] = a(c.value));
728
- }), se.push(g), re.push(1);
717
+ }), T = Date.now(), Jt = D.loc.end.line - D.loc.start.line + 1, re = 0, se = new C(), le = [], Ge = new o(e), ne = new o(e), Qe = new o(e), Ze = new o(e), Je = new o(e), Xe = new o(e), $e = new o(e), ae = new o(e), et = new o(e), oe = new o(e), ue = new o(e), tt = new o(e), Q = new o(e), it = new o(e), ce = new C(), rt = new o(e), fe = 0, pe = 0, he = new C(), me = new C(), ge = new C(), st = new o(e), lt = new o(e), nt = new o(e), de = new C(), at = new o(e), ye = new o(e), ot = /* @__PURE__ */ new Set(), we = new o(e), M, I, ut = new C(), ct = new C(), ft = new C(), pt = new o(e), Z = new C(), ht = new o(e), mt = [], be = new o(e), ke = new o(e), gt = new o(e), dt = new o(e), xe = new C(), yt = new o(e), wt = /* @__PURE__ */ new Set(), K = 0, bt = new C(), J = 0, Ce = 0, ze = new o(e), Se = new C(), kt = new o(e), N = new o(e), _e = new o(e), ve = new o(e), X = new o(e), j = new C(), qe = new C(), xt = new o(e), Ae = new o(e), Ct = new o(e), zt = new o(e), St = new o(e), Pe = new o(e), Le = new o(e), Re = new o(e), $ = new o(e), ee = new o(e), U = new Ve(e), V = new o(e), Oe = new Ve(e), _t = new o(e), B = new o(e), vt = new Ve(e), qt = new o(e), L = 0;
718
+ q(D, {
719
+ enter(i) {
720
+ var Y, Tt;
721
+ switch (i.type) {
722
+ case Me: {
723
+ re++, ce.push(L), rt.p(L, i.loc);
724
+ let p = i.name;
725
+ if (p === "font-face") {
726
+ let g = {};
727
+ e && Ge.p(i.loc.start.offset, i.loc), i.block.children.forEach((c) => {
728
+ c.type === He && (g[c.property] = a(c.value));
729
+ }), le.push(g), se.push(1);
730
+ break;
731
+ }
732
+ let l = 1;
733
+ if (i.prelude !== null) {
734
+ let g = i.prelude, c = g && a(i.prelude), f = g.loc;
735
+ if (p === "media")
736
+ Ze.p(c, f), ai(g) && (Je.p(c, f), l++);
737
+ else if (p === "supports")
738
+ ae.p(c, f), ni(g) && (et.p(c, f), l++);
739
+ else if (R("keyframes", p)) {
740
+ let u = "@" + p + " " + c;
741
+ F(p) && (ue.p(u, f), l++), oe.p(u, f);
742
+ } else if (p === "import")
743
+ q(i, function(u) {
744
+ if (u.type === "Condition" && u.kind === "supports") {
745
+ let h = a(u);
746
+ return ae.p(h, u.loc), this.break;
747
+ }
748
+ }), Qe.p(c, f);
749
+ else if (p === "charset")
750
+ $e.p(c, f);
751
+ else if (p === "container") {
752
+ if (tt.p(c, f), ((Y = g.children.first) == null ? void 0 : Y.type) === "Identifier") {
753
+ let u = g.children.first.name;
754
+ Q.p(u, f);
755
+ }
756
+ } else p === "property" && it.p(c, f);
757
+ } else
758
+ p === "layer" && (ne.p("<anonymous>", i.loc), l++);
759
+ se.push(l);
729
760
  break;
730
761
  }
731
- let l = 1;
732
- if (s.prelude !== null) {
733
- let g = s.prelude, c = g && a(s.prelude), f = g.loc;
734
- if (p === "media")
735
- Ke.p(c, f), Xt(g) && (je.p(c, f), l++);
736
- else if (p === "supports")
737
- ne.p(c, f), Jt(g) && (Ge.p(c, f), l++);
738
- else if (L("keyframes", p)) {
739
- let o = "@" + p + " " + c;
740
- F(p) && (oe.p(o, f), l++), ae.p(o, f);
741
- } else if (p === "import")
742
- q(s, function(o) {
743
- if (o.type === "Condition" && o.kind === "supports") {
744
- let h = a(o);
745
- return ne.p(h, o.loc), this.break;
746
- }
747
- }), We.p(c, f);
748
- else if (p === "charset")
749
- Ye.p(c, f);
750
- else if (p === "container") {
751
- if (Qe.p(c, f), ((Y = g.children.first) == null ? void 0 : Y.type) === "Identifier") {
752
- let o = g.children.first.name;
753
- Q.p(o, f);
754
- }
755
- } else p === "property" && Ze.p(c, f);
756
- } else
757
- p === "layer" && (le.p("<anonymous>", s.loc), l++);
758
- re.push(l);
759
- break;
760
- }
761
- case "Layer": {
762
- s.name !== null && le.p(s.name, s.loc);
763
- break;
764
- }
765
- case "Feature": {
766
- Be.p(s.name, s.loc);
767
- break;
768
- }
769
- case Bt: {
770
- let p = s.prelude, l = s.block, g = p.children, c = l.children, f = g ? g.size : 0, o = c ? c.size : 0;
771
- fe.push(f + o), Ne.p(f + o, s.loc), pe.push(f), Je.p(f, p.loc), he.push(o), Xe.p(o, l.loc), ue++, o === 0 && ce++;
772
- break;
773
- }
774
- case Me: {
775
- let p = a(s);
776
- if (this.atrule && L("keyframes", this.atrule.name))
777
- return me.p(p, s.loc), this.skip;
778
- Mt(s) && ye.p(p, s.loc);
779
- let l = ei(s);
780
- if (l !== !1)
781
- for (let x of l)
782
- nt.p(x, s.loc);
783
- let g = It(s);
784
- $t(s) && ge.p(p, s.loc), $e.add(p), Z.push(g), st.p(g, s.loc);
785
- let c = Wt(s).toArray(), [f, o, h] = c;
786
- return rt.p(c.toString(), s.loc), et.push(f), tt.push(o), it.push(h), T === void 0 && (T = c), M === void 0 && (M = c), M !== void 0 && Lt(M, c) < 0 && (M = c), T !== void 0 && Lt(T, c) > 0 && (T = c), lt.push(c), f > 0 && de.p(p, s.loc), ti(s, function(S) {
787
- at.p(S.name, S.loc);
788
- }), this.skip;
789
- }
790
- case Ie: {
791
- if (!this.declaration)
762
+ case "Layer": {
763
+ i.name !== null && ne.p(i.name, i.loc);
792
764
  break;
793
- let p = s.unit;
794
- return L("\\9", p) ? qe.push(p.substring(0, p.length - 2), this.declaration.property, s.loc) : qe.push(p, this.declaration.property, s.loc), this.skip;
795
- }
796
- case Nt: {
797
- if (Te("data:", s.value)) {
798
- let p = s.value, l = p.length, g = yi(p);
799
- w.total++, _ += l;
800
- let c = {
801
- /** @type {number} */
802
- line: s.loc.start.line,
803
- /** @type {number} */
804
- column: s.loc.start.column,
805
- /** @type {number} */
806
- offset: s.loc.start.offset,
807
- /** @type {number} */
808
- length: s.loc.end.offset - s.loc.start.offset
809
- };
810
- if (w.unique.has(g)) {
811
- let f = w.unique.get(g);
812
- f.count++, f.size += l, w.unique.set(g, f), e && f.uniqueWithLocations.push(c);
813
- } else {
814
- let f = {
815
- count: 1,
816
- size: l
817
- };
818
- e && (f.uniqueWithLocations = [c]), w.unique.set(g, f);
819
- }
820
765
  }
821
- break;
822
- }
823
- case Yt: {
824
- if (ee(s)) {
825
- Ce.push(1), B.p(a(s), s.loc);
766
+ case "Feature": {
767
+ Xe.p(i.name, i.loc);
826
768
  break;
827
769
  }
828
- let p = this.declaration, { property: l, important: g } = p, c = 1;
829
- Ut(s) && (ct.p(a(s), s.loc), c++), typeof g == "string" && (ze.p(d(s) + "!" + g, s.loc), c++), wi(s) && (ze.p(a(s), s.loc), c++);
830
- let f = s.children, o = s.loc;
831
- if (Ce.push(c), m("margin", l) || m("margin-block", l) || m("margin-inline", l) || m("margin-top", l) || m("margin-right", l) || m("margin-bottom", l) || m("margin-left", l) || m("padding", l) || m("padding-block", l) || m("padding-inline", l) || m("padding-top", l) || m("padding-right", l) || m("padding-bottom", l) || m("padding-left", l))
832
- ni(s) && dt.p(l, p.loc);
833
- else {
834
- if (m("z-index", l))
835
- return ft.p(a(s), o), this.skip;
836
- if (m("font", l)) {
837
- if (Re(s)) return;
838
- let { font_size: h, line_height: x, font_family: S } = ci(s, a, function(E) {
839
- E.type === "keyword" && B.p(E.value, o);
840
- });
841
- S && _e.p(S, o), h && Se.p(h, o), x && ve.p(x, o);
842
- break;
843
- } else if (m("font-size", l)) {
844
- Re(s) || Se.p(a(s), o);
845
- break;
846
- } else if (m("font-family", l)) {
847
- Re(s) || _e.p(a(s), o);
848
- break;
849
- } else if (m("line-height", l))
850
- ve.p(a(s), o);
851
- else if (m("transition", l) || m("animation", l)) {
852
- hi(f, function(h) {
853
- h.type === "fn" ? X.p(a(h.value), o) : h.type === "duration" ? $.p(a(h.value), o) : h.type === "keyword" && B.p(a(h.value), o);
854
- });
855
- break;
856
- } else if (m("animation-duration", l) || m("transition-duration", l)) {
857
- f && f.size > 1 ? f.forEach((h) => {
858
- h.type !== H && $.p(a(h), o);
859
- }) : $.p(a(s), o);
860
- break;
861
- } else if (m("transition-timing-function", l) || m("animation-timing-function", l)) {
862
- f && f.size > 1 ? f.forEach((h) => {
863
- h.type !== H && X.p(a(h), o);
864
- }) : X.p(a(s), o);
865
- break;
866
- } else if (m("container-name", l))
867
- Q.p(a(s), o);
868
- else if (m("container", l))
869
- ((St = f.first) == null ? void 0 : St.type) === "Identifier" && Q.p(f.first.name, o);
870
- else if (bi.has(di(l))) {
871
- ee(s) || gt.push(a(s), l, o);
770
+ case Ie: {
771
+ let p = i.prelude, l = i.block, g = p.children, c = l.children, f = g ? g.size : 0, u = c ? c.size : 0;
772
+ he.push(f + u), st.p(f + u, i.loc), me.push(f), lt.p(f, p.loc), ge.push(u), nt.p(u, l.loc), de.push(L), at.p(L, i.loc), fe++, u === 0 && pe++;
773
+ break;
774
+ }
775
+ case Ne: {
776
+ let p = a(i);
777
+ if (this.atrule && R("keyframes", this.atrule.name))
778
+ return ye.p(p, i.loc), this.skip;
779
+ Gt(i) && ke.p(p, i.loc);
780
+ let l = ui(i);
781
+ if (l !== !1)
782
+ for (let x of l)
783
+ gt.p(x, i.loc);
784
+ let g = Qt(i);
785
+ oi(i) && we.p(p, i.loc), ot.add(p), Z.push(g), ht.p(g, i.loc), xe.push(L - 1), yt.p(L - 1, i.loc);
786
+ let c = $t(i).toArray(), [f, u, h] = c;
787
+ return pt.p(c.toString(), i.loc), ut.push(f), ct.push(u), ft.push(h), M === void 0 && (M = c), I === void 0 && (I = c), I !== void 0 && Ht(I, c) < 0 && (I = c), M !== void 0 && Ht(M, c) > 0 && (M = c), mt.push(c), f > 0 && be.p(p, i.loc), ci(i, function(v) {
788
+ dt.p(v.name, v.loc);
789
+ }), this.skip;
790
+ }
791
+ case je: {
792
+ if (!this.declaration)
872
793
  break;
873
- } else m("text-shadow", l) ? ee(s) || pt.p(a(s), o) : m("box-shadow", l) && (ee(s) || ht.p(a(s), o));
794
+ let p = i.unit;
795
+ return R("\\9", p) ? Oe.push(p.substring(0, p.length - 2), this.declaration.property, i.loc) : Oe.push(p, this.declaration.property, i.loc), this.skip;
874
796
  }
875
- q(s, function(h) {
876
- let x = h.name;
877
- switch (h.type) {
878
- case Zt: {
879
- let S = h.value.length;
880
- return L("\\9", h.value) && (S = S - 2), I.push("#" + h.value, l, o), U.p("hex" + S, o), this.skip;
797
+ case li: {
798
+ if (Ke("data:", i.value)) {
799
+ let p = i.value, l = p.length, g = vi(p);
800
+ b.total++, _ += l;
801
+ let c = {
802
+ /** @type {number} */
803
+ line: i.loc.start.line,
804
+ /** @type {number} */
805
+ column: i.loc.start.column,
806
+ /** @type {number} */
807
+ offset: i.loc.start.offset,
808
+ /** @type {number} */
809
+ length: i.loc.end.offset - i.loc.start.offset
810
+ };
811
+ if (b.unique.has(g)) {
812
+ let f = b.unique.get(g);
813
+ f.count++, f.size += l, b.unique.set(g, f), e && f.uniqueWithLocations.push(c);
814
+ } else {
815
+ let f = {
816
+ count: 1,
817
+ size: l
818
+ };
819
+ e && (f.uniqueWithLocations = [c]), b.unique.set(g, f);
881
820
  }
882
- case O: {
883
- te.has(x) && B.p(x, o);
884
- let S = x.length;
885
- if (S > 20 || S < 3)
886
- return this.skip;
887
- if (li.has(x)) {
888
- let E = a(h);
889
- I.push(E, l, o), U.p(x.toLowerCase(), o);
890
- return;
891
- }
892
- if (ii.has(x)) {
893
- let E = a(h);
894
- I.push(E, l, o), U.p("named", o);
895
- return;
896
- }
897
- if (ri.has(x)) {
898
- let E = a(h);
899
- I.push(E, l, o), U.p("system", o);
900
- return;
821
+ }
822
+ break;
823
+ }
824
+ case ti: {
825
+ if (te(i)) {
826
+ qe.push(1), B.p(a(i), i.loc);
827
+ break;
828
+ }
829
+ let p = this.declaration, { property: l, important: g } = p, c = 1;
830
+ Zt(i) && (xt.p(a(i), i.loc), c++), typeof g == "string" && (Ae.p(y(i) + "!" + g, i.loc), c++), qi(i) && (Ae.p(a(i), i.loc), c++);
831
+ let f = i.children, u = i.loc;
832
+ if (qe.push(c), m("margin", l) || m("margin-block", l) || m("margin-inline", l) || m("margin-top", l) || m("margin-right", l) || m("margin-bottom", l) || m("margin-left", l) || m("padding", l) || m("padding-block", l) || m("padding-inline", l) || m("padding-top", l) || m("padding-right", l) || m("padding-bottom", l) || m("padding-left", l))
833
+ gi(i) && qt.p(l, p.loc);
834
+ else {
835
+ if (m("z-index", l))
836
+ return Ct.p(a(i), u), this.skip;
837
+ if (m("font", l)) {
838
+ if (Ue(i)) return;
839
+ let { font_size: h, line_height: x, font_family: v } = bi(i, a, function(E) {
840
+ E.type === "keyword" && B.p(E.value, u);
841
+ });
842
+ v && Pe.p(v, u), h && Le.p(h, u), x && Re.p(x, u);
843
+ break;
844
+ } else if (m("font-size", l)) {
845
+ Ue(i) || Le.p(a(i), u);
846
+ break;
847
+ } else if (m("font-family", l)) {
848
+ Ue(i) || Pe.p(a(i), u);
849
+ break;
850
+ } else if (m("line-height", l))
851
+ Re.p(a(i), u);
852
+ else if (m("transition", l) || m("animation", l)) {
853
+ Ci(f, function(h) {
854
+ h.type === "fn" ? $.p(a(h.value), u) : h.type === "duration" ? ee.p(a(h.value), u) : h.type === "keyword" && B.p(a(h.value), u);
855
+ });
856
+ break;
857
+ } else if (m("animation-duration", l) || m("transition-duration", l)) {
858
+ f && f.size > 1 ? f.forEach((h) => {
859
+ h.type !== W && ee.p(a(h), u);
860
+ }) : ee.p(a(i), u);
861
+ break;
862
+ } else if (m("transition-timing-function", l) || m("animation-timing-function", l)) {
863
+ f && f.size > 1 ? f.forEach((h) => {
864
+ h.type !== W && $.p(a(h), u);
865
+ }) : $.p(a(i), u);
866
+ break;
867
+ } else if (m("container-name", l))
868
+ Q.p(a(i), u);
869
+ else if (m("container", l))
870
+ ((Tt = f.first) == null ? void 0 : Tt.type) === "Identifier" && Q.p(f.first.name, u);
871
+ else if (Ai.has(_i(l))) {
872
+ te(i) || vt.push(a(i), l, u);
873
+ break;
874
+ } else m("text-shadow", l) ? te(i) || zt.p(a(i), u) : m("box-shadow", l) && (te(i) || St.p(a(i), u));
875
+ }
876
+ q(i, function(h) {
877
+ let x = h.name;
878
+ switch (h.type) {
879
+ case si: {
880
+ let v = h.value.length;
881
+ return R("\\9", h.value) && (v = v - 2), U.push("#" + h.value, l, u), V.p("hex" + v, u), this.skip;
901
882
  }
902
- return this.skip;
903
- }
904
- case Ue: {
905
- if (z("var", x))
883
+ case O: {
884
+ ie.has(x) && B.p(x, u);
885
+ let v = x.length;
886
+ if (v > 20 || v < 3)
887
+ return this.skip;
888
+ if (mi.has(x)) {
889
+ let E = a(h);
890
+ U.push(E, l, u), V.p(x.toLowerCase(), u);
891
+ return;
892
+ }
893
+ if (fi.has(x)) {
894
+ let E = a(h);
895
+ U.push(E, l, u), V.p("named", u);
896
+ return;
897
+ }
898
+ if (pi.has(x)) {
899
+ let E = a(h);
900
+ U.push(E, l, u), V.p("system", u);
901
+ return;
902
+ }
906
903
  return this.skip;
907
- if (si.has(x)) {
908
- I.push(a(h), l, h.loc), U.p(x.toLowerCase(), h.loc);
909
- return;
910
904
  }
911
- if (L("gradient", x)) {
912
- mt.p(a(h), h.loc);
913
- return;
905
+ case Be: {
906
+ if (S("var", x))
907
+ return this.skip;
908
+ if (hi.has(x)) {
909
+ U.push(a(h), l, h.loc), V.p(x.toLowerCase(), h.loc);
910
+ return;
911
+ }
912
+ if (R("gradient", x)) {
913
+ _t.p(a(h), h.loc);
914
+ return;
915
+ }
914
916
  }
915
917
  }
916
- }
917
- });
918
- break;
919
- }
920
- case Fe: {
921
- if (this.atrulePrelude !== null)
922
- return this.skip;
923
- W++;
924
- let p = 1;
925
- ot.add(a(s)), s.important === !0 && (N++, p++, this.atrule && L("keyframes", this.atrule.name) && (we++, p++)), ut.push(p);
926
- let { property: l, loc: { start: g } } = s, c = {
927
- start: {
928
- line: g.line,
929
- column: g.column,
930
- offset: g.offset
931
- },
932
- end: {
933
- offset: g.offset + l.length
934
- }
935
- };
936
- K.p(l, c), F(l) ? (xe.p(l, c), j.push(2)) : gi(l) ? (ke.p(l, c), j.push(2)) : Ve(l) ? (J.p(l, c), j.push(s.important ? 3 : 2), s.important === !0 && be.p(l, c)) : j.push(1);
937
- break;
918
+ });
919
+ break;
920
+ }
921
+ case He: {
922
+ if (this.atrulePrelude !== null)
923
+ return this.skip;
924
+ K++;
925
+ let p = 1;
926
+ wt.add(a(i)), Se.push(L - 1), kt.p(L - 1, i.loc), i.important === !0 && (J++, p++, this.atrule && R("keyframes", this.atrule.name) && (Ce++, p++)), bt.push(p);
927
+ let { property: l, loc: { start: g } } = i, c = {
928
+ start: {
929
+ line: g.line,
930
+ column: g.column,
931
+ offset: g.offset
932
+ },
933
+ end: {
934
+ offset: g.offset + l.length
935
+ }
936
+ };
937
+ N.p(l, c), F(l) ? (ve.p(l, c), j.push(2)) : Si(l) ? (_e.p(l, c), j.push(2)) : Ye(l) ? (X.p(l, c), j.push(i.important ? 3 : 2), i.important === !0 && ze.p(l, c)) : j.push(1);
938
+ break;
939
+ }
938
940
  }
941
+ (i.type === Ie || i.type === Me) && L++;
942
+ },
943
+ leave(i) {
944
+ (i.type === Ie || i.type === Me) && L--;
939
945
  }
940
946
  });
941
- let yt = ot.size, V = Z.size(), Ae = et.aggregate(), Pe = tt.aggregate(), Le = it.aggregate(), wt = $e.size, k = Object.assign, bt = i.length, Oe = se.length, kt = re.aggregate(), xt = Z.aggregate(), Ct = ut.aggregate(), zt = j.aggregate(), _t = Ce.aggregate();
947
+ let At = wt.size, H = Z.size(), De = ut.aggregate(), Ee = ct.aggregate(), Fe = ft.aggregate(), Pt = ot.size, d = Object.assign, Lt = r.length, Te = le.length, Rt = se.aggregate(), Ot = Z.aggregate(), Dt = bt.aggregate(), Et = j.aggregate(), Ft = qe.aggregate();
942
948
  return {
943
949
  stylesheet: {
944
- sourceLinesOfCode: ie + V + W + me.size(),
945
- linesOfCode: Vt,
946
- size: bt,
947
- complexity: kt.sum + xt.sum + Ct.sum + zt.sum + _t.sum,
950
+ sourceLinesOfCode: re + H + K + ye.size(),
951
+ linesOfCode: Jt,
952
+ size: Lt,
953
+ complexity: Rt.sum + Ot.sum + Dt.sum + Et.sum + Ft.sum,
948
954
  comments: {
949
- total: b,
950
- size: y
955
+ total: k,
956
+ size: w
951
957
  },
952
958
  embeddedContent: {
953
959
  size: {
954
960
  total: _,
955
- ratio: C(_, bt)
961
+ ratio: z(_, Lt)
956
962
  },
957
963
  types: {
958
- total: w.total,
959
- totalUnique: w.unique.size,
960
- uniquenessRatio: C(w.unique.size, w.total),
961
- unique: Object.fromEntries(w.unique)
964
+ total: b.total,
965
+ totalUnique: b.unique.size,
966
+ uniquenessRatio: z(b.unique.size, b.total),
967
+ unique: Object.fromEntries(b.unique)
962
968
  }
963
969
  }
964
970
  },
965
971
  atrules: {
966
- fontface: k({
967
- total: Oe,
968
- totalUnique: Oe,
969
- unique: se,
970
- uniquenessRatio: Oe === 0 ? 0 : 1
972
+ fontface: d({
973
+ total: Te,
974
+ totalUnique: Te,
975
+ unique: le,
976
+ uniquenessRatio: Te === 0 ? 0 : 1
971
977
  }, e ? {
972
- uniqueWithLocations: He.c().uniqueWithLocations
978
+ uniqueWithLocations: Ge.c().uniqueWithLocations
973
979
  } : {}),
974
- import: We.c(),
975
- media: k(
976
- Ke.c(),
980
+ import: Qe.c(),
981
+ media: d(
982
+ Ze.c(),
977
983
  {
978
- browserhacks: je.c(),
979
- features: Be.c()
984
+ browserhacks: Je.c(),
985
+ features: Xe.c()
980
986
  }
981
987
  ),
982
- charset: Ye.c(),
983
- supports: k(
984
- ne.c(),
988
+ charset: $e.c(),
989
+ supports: d(
990
+ ae.c(),
985
991
  {
986
- browserhacks: Ge.c()
992
+ browserhacks: et.c()
987
993
  }
988
994
  ),
989
- keyframes: k(
990
- ae.c(),
995
+ keyframes: d(
996
+ oe.c(),
991
997
  {
992
- prefixed: k(
993
- oe.c(),
998
+ prefixed: d(
999
+ ue.c(),
994
1000
  {
995
- ratio: C(oe.size(), ae.size())
1001
+ ratio: z(ue.size(), oe.size())
996
1002
  }
997
1003
  )
998
1004
  }
999
1005
  ),
1000
- container: k(
1001
- Qe.c(),
1006
+ container: d(
1007
+ tt.c(),
1002
1008
  {
1003
1009
  names: Q.c()
1004
1010
  }
1005
1011
  ),
1006
- layer: le.c(),
1007
- property: Ze.c(),
1008
- total: ie,
1009
- complexity: kt
1012
+ layer: ne.c(),
1013
+ property: it.c(),
1014
+ total: re,
1015
+ complexity: Rt,
1016
+ nesting: d(
1017
+ ce.aggregate(),
1018
+ {
1019
+ items: ce.toArray()
1020
+ },
1021
+ rt.c()
1022
+ )
1010
1023
  },
1011
1024
  rules: {
1012
- total: ue,
1025
+ total: fe,
1013
1026
  empty: {
1014
- total: ce,
1015
- ratio: C(ce, ue)
1027
+ total: pe,
1028
+ ratio: z(pe, fe)
1016
1029
  },
1017
- sizes: k(
1018
- fe.aggregate(),
1030
+ sizes: d(
1031
+ he.aggregate(),
1019
1032
  {
1020
- items: fe.toArray()
1033
+ items: he.toArray()
1021
1034
  },
1022
- Ne.c()
1035
+ st.c()
1023
1036
  ),
1024
- selectors: k(
1025
- pe.aggregate(),
1037
+ nesting: d(
1038
+ de.aggregate(),
1026
1039
  {
1027
- items: pe.toArray()
1040
+ items: de.toArray()
1028
1041
  },
1029
- Je.c()
1042
+ at.c()
1030
1043
  ),
1031
- declarations: k(
1032
- he.aggregate(),
1044
+ selectors: d(
1045
+ me.aggregate(),
1033
1046
  {
1034
- items: he.toArray()
1047
+ items: me.toArray()
1048
+ },
1049
+ lt.c()
1050
+ ),
1051
+ declarations: d(
1052
+ ge.aggregate(),
1053
+ {
1054
+ items: ge.toArray()
1035
1055
  },
1036
- Xe.c()
1056
+ nt.c()
1037
1057
  )
1038
1058
  },
1039
1059
  selectors: {
1040
- total: V,
1041
- totalUnique: wt,
1042
- uniquenessRatio: C(wt, V),
1043
- specificity: k(
1060
+ total: H,
1061
+ totalUnique: Pt,
1062
+ uniquenessRatio: z(Pt, H),
1063
+ specificity: d(
1044
1064
  {
1045
1065
  /** @type Specificity */
1046
- min: M === void 0 ? [0, 0, 0] : M,
1066
+ min: I === void 0 ? [0, 0, 0] : I,
1047
1067
  /** @type Specificity */
1048
- max: T === void 0 ? [0, 0, 0] : T,
1068
+ max: M === void 0 ? [0, 0, 0] : M,
1049
1069
  /** @type Specificity */
1050
- sum: [Ae.sum, Pe.sum, Le.sum],
1070
+ sum: [De.sum, Ee.sum, Fe.sum],
1051
1071
  /** @type Specificity */
1052
- mean: [Ae.mean, Pe.mean, Le.mean],
1072
+ mean: [De.mean, Ee.mean, Fe.mean],
1053
1073
  /** @type Specificity */
1054
- mode: [Ae.mode, Pe.mode, Le.mode],
1074
+ mode: [De.mode, Ee.mode, Fe.mode],
1055
1075
  /** @type Specificity */
1056
- items: lt
1076
+ items: mt
1057
1077
  },
1058
- rt.c()
1078
+ pt.c()
1059
1079
  ),
1060
- complexity: k(
1061
- xt,
1062
- st.c(),
1080
+ complexity: d(
1081
+ Ot,
1082
+ ht.c(),
1063
1083
  {
1064
1084
  items: Z.toArray()
1065
1085
  }
1066
1086
  ),
1067
- id: k(
1068
- de.c(),
1087
+ nesting: d(
1088
+ xe.aggregate(),
1069
1089
  {
1070
- ratio: C(de.size(), V)
1090
+ items: xe.toArray()
1091
+ },
1092
+ yt.c()
1093
+ ),
1094
+ id: d(
1095
+ be.c(),
1096
+ {
1097
+ ratio: z(be.size(), H)
1071
1098
  }
1072
1099
  ),
1073
- pseudoClasses: nt.c(),
1074
- accessibility: k(
1075
- ye.c(),
1100
+ pseudoClasses: gt.c(),
1101
+ accessibility: d(
1102
+ ke.c(),
1076
1103
  {
1077
- ratio: C(ye.size(), V)
1104
+ ratio: z(ke.size(), H)
1078
1105
  }
1079
1106
  ),
1080
- keyframes: me.c(),
1081
- prefixed: k(
1082
- ge.c(),
1107
+ keyframes: ye.c(),
1108
+ prefixed: d(
1109
+ we.c(),
1083
1110
  {
1084
- ratio: C(ge.size(), V)
1111
+ ratio: z(we.size(), H)
1085
1112
  }
1086
1113
  ),
1087
- combinators: at.c()
1114
+ combinators: dt.c()
1088
1115
  },
1089
1116
  declarations: {
1090
- total: W,
1091
- totalUnique: yt,
1092
- uniquenessRatio: C(yt, W),
1117
+ total: K,
1118
+ totalUnique: At,
1119
+ uniquenessRatio: z(At, K),
1093
1120
  importants: {
1094
- total: N,
1095
- ratio: C(N, W),
1121
+ total: J,
1122
+ ratio: z(J, K),
1096
1123
  inKeyframes: {
1097
- total: we,
1098
- ratio: C(we, N)
1124
+ total: Ce,
1125
+ ratio: z(Ce, J)
1099
1126
  }
1100
1127
  },
1101
- complexity: Ct
1128
+ complexity: Dt,
1129
+ nesting: d(
1130
+ Se.aggregate(),
1131
+ {
1132
+ items: Se.toArray()
1133
+ },
1134
+ kt.c()
1135
+ )
1102
1136
  },
1103
- properties: k(
1104
- K.c(),
1137
+ properties: d(
1138
+ N.c(),
1105
1139
  {
1106
- prefixed: k(
1107
- xe.c(),
1140
+ prefixed: d(
1141
+ ve.c(),
1108
1142
  {
1109
- ratio: C(xe.size(), K.size())
1143
+ ratio: z(ve.size(), N.size())
1110
1144
  }
1111
1145
  ),
1112
- custom: k(
1113
- J.c(),
1146
+ custom: d(
1147
+ X.c(),
1114
1148
  {
1115
- ratio: C(J.size(), K.size()),
1116
- importants: k(
1117
- be.c(),
1149
+ ratio: z(X.size(), N.size()),
1150
+ importants: d(
1151
+ ze.c(),
1118
1152
  {
1119
- ratio: C(be.size(), J.size())
1153
+ ratio: z(ze.size(), X.size())
1120
1154
  }
1121
1155
  )
1122
1156
  }
1123
1157
  ),
1124
- browserhacks: k(
1125
- ke.c(),
1158
+ browserhacks: d(
1159
+ _e.c(),
1126
1160
  {
1127
- ratio: C(ke.size(), K.size())
1161
+ ratio: z(_e.size(), N.size())
1128
1162
  }
1129
1163
  ),
1130
- complexity: zt
1164
+ complexity: Et
1131
1165
  }
1132
1166
  ),
1133
1167
  values: {
1134
- colors: k(
1135
- I.count(),
1168
+ colors: d(
1169
+ U.count(),
1136
1170
  {
1137
- formats: U.c()
1171
+ formats: V.c()
1138
1172
  }
1139
1173
  ),
1140
- gradients: mt.c(),
1141
- fontFamilies: _e.c(),
1142
- fontSizes: Se.c(),
1143
- lineHeights: ve.c(),
1144
- zindexes: ft.c(),
1145
- textShadows: pt.c(),
1146
- boxShadows: ht.c(),
1147
- borderRadiuses: gt.count(),
1174
+ gradients: _t.c(),
1175
+ fontFamilies: Pe.c(),
1176
+ fontSizes: Le.c(),
1177
+ lineHeights: Re.c(),
1178
+ zindexes: Ct.c(),
1179
+ textShadows: zt.c(),
1180
+ boxShadows: St.c(),
1181
+ borderRadiuses: vt.count(),
1148
1182
  animations: {
1149
- durations: $.c(),
1150
- timingFunctions: X.c()
1183
+ durations: ee.c(),
1184
+ timingFunctions: $.c()
1151
1185
  },
1152
- prefixes: ct.c(),
1153
- browserhacks: ze.c(),
1154
- units: qe.count(),
1155
- complexity: _t,
1186
+ prefixes: xt.c(),
1187
+ browserhacks: Ae.c(),
1188
+ units: Oe.count(),
1189
+ complexity: Ft,
1156
1190
  keywords: B.c(),
1157
- resets: dt.c()
1191
+ resets: qt.c()
1158
1192
  },
1159
1193
  __meta__: {
1160
- parseTime: D - P,
1161
- analyzeTime: Date.now() - D,
1194
+ parseTime: T - P,
1195
+ analyzeTime: Date.now() - T,
1162
1196
  total: Date.now() - n
1163
1197
  }
1164
1198
  };
1165
1199
  }
1166
- function Lt(i, t) {
1167
- return i[0] === t[0] ? i[1] === t[1] ? t[2] - i[2] : t[1] - i[1] : t[0] - i[0];
1200
+ function Ht(r, t) {
1201
+ return r[0] === t[0] ? r[1] === t[1] ? t[2] - r[2] : t[1] - r[1] : t[0] - r[0];
1168
1202
  }
1169
1203
  export {
1170
- _i as analyze,
1171
- Lt as compareSpecificity,
1204
+ Di as analyze,
1205
+ Ht as compareSpecificity,
1172
1206
  F as hasVendorPrefix,
1173
- Mt as isAccessibilitySelector,
1174
- Xt as isMediaBrowserhack,
1175
- gi as isPropertyHack,
1176
- $t as isSelectorPrefixed,
1177
- Jt as isSupportsBrowserhack,
1178
- Ut as isValuePrefixed,
1179
- It as selectorComplexity
1207
+ Gt as isAccessibilitySelector,
1208
+ ai as isMediaBrowserhack,
1209
+ Si as isPropertyHack,
1210
+ oi as isSelectorPrefixed,
1211
+ ni as isSupportsBrowserhack,
1212
+ Zt as isValuePrefixed,
1213
+ Qt as selectorComplexity
1180
1214
  };