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