ipx 4.0.0-alpha.2 → 4.0.0-beta.1
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/README.md +492 -77
- package/dist/THIRD-PARTY-LICENSES.md +54 -0
- package/dist/_chunks/libs/@fastify/accept-negotiator.mjs +1 -1
- package/dist/_chunks/libs/crossws.d.mts +1 -0
- package/dist/_chunks/libs/css-select.mjs +2 -2
- package/dist/_chunks/libs/css-tree.mjs +68 -106
- package/dist/_chunks/libs/csso.mjs +16 -29
- package/dist/_chunks/libs/etag.mjs +1 -1
- package/dist/_chunks/libs/h3.d.mts +3 -0
- package/dist/_chunks/libs/h3.mjs +114 -72
- package/dist/_chunks/libs/image-meta.d.mts +0 -4
- package/dist/_chunks/libs/image-meta.mjs +6 -6
- package/dist/_chunks/libs/sax.mjs +21 -20
- package/dist/_chunks/libs/svgo.mjs +788 -756
- package/dist/_chunks/libs/ufo.mjs +17 -24
- package/dist/_chunks/node-fs.mjs +982 -158
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +184 -16
- package/dist/index.mjs +2 -2
- package/package.json +20 -17
|
@@ -38,7 +38,7 @@ var l = e(((e) => {
|
|
|
38
38
|
}, s = a.fn(e, o, t);
|
|
39
39
|
s != null && C(e, s);
|
|
40
40
|
}
|
|
41
|
-
},
|
|
41
|
+
}, ee = ({ name: e, plugins: t }) => ({
|
|
42
42
|
name: e,
|
|
43
43
|
isPreset: !0,
|
|
44
44
|
plugins: Object.freeze(t),
|
|
@@ -51,40 +51,40 @@ var l = e(((e) => {
|
|
|
51
51
|
w(n, i, t, o, s);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
function
|
|
54
|
+
function T(e) {
|
|
55
55
|
let t = /* @__PURE__ */ new Map();
|
|
56
56
|
for (let n of e.children) t.set(n, e), C(n, { element: { enter: (e, n) => {
|
|
57
57
|
t.set(e, n);
|
|
58
58
|
} } }, e);
|
|
59
59
|
return t;
|
|
60
60
|
}
|
|
61
|
-
let
|
|
61
|
+
let E = (e) => e.type === `element`, te = (e, t) => t.some(((t) => E(t) && (e(t) || te(e, D(t))))), ne = (e, t) => e.attributes[t], D = (e) => e.children || [], re = (e) => e.name, ie = (e) => e.children[0].type === `text` || e.children[0].type === `cdata` ? e.children[0].value : ``, ae = (e, t) => e.attributes[t] !== void 0, oe = (e, t) => {
|
|
62
62
|
let n = [];
|
|
63
|
-
for (let r of t)
|
|
63
|
+
for (let r of t) E(r) && (e(r) && n.push(r), n.push(...oe(e, D(r))));
|
|
64
64
|
return n;
|
|
65
|
-
},
|
|
66
|
-
for (let n of t) if (
|
|
65
|
+
}, se = (e, t) => {
|
|
66
|
+
for (let n of t) if (E(n)) {
|
|
67
67
|
if (e(n)) return n;
|
|
68
|
-
let t =
|
|
68
|
+
let t = se(e, D(n));
|
|
69
69
|
if (t) return t;
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
};
|
|
73
|
-
function
|
|
74
|
-
let n = (n) => (t ||=
|
|
73
|
+
function ce(e, t) {
|
|
74
|
+
let n = (n) => (t ||= T(e), t.get(n) || null);
|
|
75
75
|
return {
|
|
76
|
-
isTag:
|
|
77
|
-
existsOne:
|
|
78
|
-
getAttributeValue:
|
|
79
|
-
getChildren:
|
|
80
|
-
getName:
|
|
76
|
+
isTag: E,
|
|
77
|
+
existsOne: te,
|
|
78
|
+
getAttributeValue: ne,
|
|
79
|
+
getChildren: D,
|
|
80
|
+
getName: re,
|
|
81
81
|
getParent: n,
|
|
82
82
|
getSiblings: (e) => {
|
|
83
83
|
let t = n(e);
|
|
84
|
-
return t ?
|
|
84
|
+
return t ? D(t) : [];
|
|
85
85
|
},
|
|
86
|
-
getText:
|
|
87
|
-
hasAttrib:
|
|
86
|
+
getText: ie,
|
|
87
|
+
hasAttrib: ae,
|
|
88
88
|
removeSubsets: (e) => {
|
|
89
89
|
let t = e.length, r, i, a;
|
|
90
90
|
for (; --t > -1;) {
|
|
@@ -99,51 +99,51 @@ var l = e(((e) => {
|
|
|
99
99
|
}
|
|
100
100
|
return e;
|
|
101
101
|
},
|
|
102
|
-
findAll:
|
|
103
|
-
findOne:
|
|
102
|
+
findAll: oe,
|
|
103
|
+
findOne: se
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function le(e, t) {
|
|
107
107
|
return {
|
|
108
108
|
xmlMode: !0,
|
|
109
|
-
adapter:
|
|
109
|
+
adapter: ce(e, t)
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
let
|
|
112
|
+
let O = (e, t, n) => f.selectAll(t, e, le(e, n)), ue = (e, t, n) => f.selectOne(t, e, le(e, n)), de = (e, t, n) => f.is(e, t, le(e, n)), k = (e, t) => {
|
|
113
113
|
t.children = t.children.filter(((t) => t !== e));
|
|
114
114
|
};
|
|
115
|
-
var
|
|
115
|
+
var fe = Object.freeze({
|
|
116
116
|
__proto__: null,
|
|
117
117
|
description: `removes doctype declaration`,
|
|
118
118
|
fn: () => ({ doctype: { enter: (e, t) => {
|
|
119
|
-
|
|
119
|
+
k(e, t);
|
|
120
120
|
} } }),
|
|
121
121
|
name: `removeDoctype`
|
|
122
|
-
}),
|
|
122
|
+
}), pe = Object.freeze({
|
|
123
123
|
__proto__: null,
|
|
124
124
|
description: `removes XML processing instructions`,
|
|
125
125
|
fn: () => ({ instruction: { enter: (e, t) => {
|
|
126
|
-
e.name === `xml` &&
|
|
126
|
+
e.name === `xml` && k(e, t);
|
|
127
127
|
} } }),
|
|
128
128
|
name: `removeXMLProcInst`
|
|
129
129
|
});
|
|
130
|
-
let
|
|
131
|
-
var
|
|
130
|
+
let me = [/^!/];
|
|
131
|
+
var he = Object.freeze({
|
|
132
132
|
__proto__: null,
|
|
133
133
|
description: `removes comments`,
|
|
134
134
|
fn: (e, t) => {
|
|
135
|
-
let { preservePatterns: n =
|
|
135
|
+
let { preservePatterns: n = me } = t;
|
|
136
136
|
return { comment: { enter: (e, t) => {
|
|
137
137
|
if (n) {
|
|
138
138
|
if (!Array.isArray(n)) throw Error(`Expected array in removeComments preservePatterns parameter but received ${n}`);
|
|
139
139
|
if (n.some(((t) => new RegExp(t).test(e.value)))) return;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
k(e, t);
|
|
142
142
|
} } };
|
|
143
143
|
},
|
|
144
144
|
name: `removeComments`
|
|
145
145
|
});
|
|
146
|
-
let
|
|
146
|
+
let A = {
|
|
147
147
|
animation: /* @__PURE__ */ new Set([
|
|
148
148
|
`animate`,
|
|
149
149
|
`animateColor`,
|
|
@@ -253,15 +253,15 @@ var l = e(((e) => {
|
|
|
253
253
|
`feTile`,
|
|
254
254
|
`feTurbulence`
|
|
255
255
|
])
|
|
256
|
-
},
|
|
257
|
-
...
|
|
256
|
+
}, ge = /* @__PURE__ */ new Set([
|
|
257
|
+
...A.textContent,
|
|
258
258
|
`pre`,
|
|
259
259
|
`title`
|
|
260
|
-
]),
|
|
260
|
+
]), _e = /* @__PURE__ */ new Set([
|
|
261
261
|
`glyph`,
|
|
262
262
|
`missing-glyph`,
|
|
263
263
|
`path`
|
|
264
|
-
]),
|
|
264
|
+
]), j = {
|
|
265
265
|
animationAddition: /* @__PURE__ */ new Set([`additive`, `accumulate`]),
|
|
266
266
|
animationAttributeTarget: /* @__PURE__ */ new Set([`attributeType`, `attributeName`]),
|
|
267
267
|
animationEvent: /* @__PURE__ */ new Set([
|
|
@@ -354,7 +354,7 @@ var l = e(((e) => {
|
|
|
354
354
|
`tableValues`,
|
|
355
355
|
`type`
|
|
356
356
|
])
|
|
357
|
-
},
|
|
357
|
+
}, ve = {
|
|
358
358
|
core: { "xml:space": `default` },
|
|
359
359
|
presentation: {
|
|
360
360
|
clip: `auto`,
|
|
@@ -416,7 +416,7 @@ var l = e(((e) => {
|
|
|
416
416
|
exponent: `1`,
|
|
417
417
|
offset: `0`
|
|
418
418
|
}
|
|
419
|
-
},
|
|
419
|
+
}, ye = {
|
|
420
420
|
animationAttributeTarget: { unsafe: /* @__PURE__ */ new Set([`attributeType`]) },
|
|
421
421
|
conditionalProcessing: { unsafe: /* @__PURE__ */ new Set([`requiredFeatures`]) },
|
|
422
422
|
core: { unsafe: /* @__PURE__ */ new Set([
|
|
@@ -432,7 +432,7 @@ var l = e(((e) => {
|
|
|
432
432
|
`glyph-orientation-vertical`,
|
|
433
433
|
`kerning`
|
|
434
434
|
]) }
|
|
435
|
-
},
|
|
435
|
+
}, be = {
|
|
436
436
|
a: {
|
|
437
437
|
attrsGroups: /* @__PURE__ */ new Set([
|
|
438
438
|
`conditionalProcessing`,
|
|
@@ -2258,7 +2258,7 @@ var l = e(((e) => {
|
|
|
2258
2258
|
`u2`
|
|
2259
2259
|
]) }
|
|
2260
2260
|
}
|
|
2261
|
-
},
|
|
2261
|
+
}, xe = /* @__PURE__ */ new Set([
|
|
2262
2262
|
`http://creativecommons.org/ns#`,
|
|
2263
2263
|
`http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd`,
|
|
2264
2264
|
`http://krita.org/namespaces/svg/krita`,
|
|
@@ -2283,7 +2283,7 @@ var l = e(((e) => {
|
|
|
2283
2283
|
`http://www.vector.evaxdesign.sk`,
|
|
2284
2284
|
`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,
|
|
2285
2285
|
`https://boxy-svg.com`
|
|
2286
|
-
]),
|
|
2286
|
+
]), M = /* @__PURE__ */ new Set([
|
|
2287
2287
|
`clip-path`,
|
|
2288
2288
|
`color-profile`,
|
|
2289
2289
|
`fill`,
|
|
@@ -2294,7 +2294,7 @@ var l = e(((e) => {
|
|
|
2294
2294
|
`mask`,
|
|
2295
2295
|
`stroke`,
|
|
2296
2296
|
`style`
|
|
2297
|
-
]),
|
|
2297
|
+
]), N = new Set(`clip-rule.color-interpolation-filters.color-interpolation.color-profile.color-rendering.color.cursor.direction.dominant-baseline.fill-opacity.fill-rule.fill.font-family.font-size-adjust.font-size.font-stretch.font-style.font-variant.font-weight.font.glyph-orientation-horizontal.glyph-orientation-vertical.image-rendering.letter-spacing.marker-end.marker-mid.marker-start.marker.paint-order.pointer-events.shape-rendering.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.stroke.text-anchor.text-rendering.transform.visibility.word-spacing.writing-mode`.split(`.`)), Se = /* @__PURE__ */ new Set([
|
|
2298
2298
|
`clip-path`,
|
|
2299
2299
|
`display`,
|
|
2300
2300
|
`filter`,
|
|
@@ -2303,7 +2303,7 @@ var l = e(((e) => {
|
|
|
2303
2303
|
`text-decoration`,
|
|
2304
2304
|
`transform`,
|
|
2305
2305
|
`unicode-bidi`
|
|
2306
|
-
]),
|
|
2306
|
+
]), Ce = {
|
|
2307
2307
|
aliceblue: `#f0f8ff`,
|
|
2308
2308
|
antiquewhite: `#faebd7`,
|
|
2309
2309
|
aqua: `#0ff`,
|
|
@@ -2452,7 +2452,7 @@ var l = e(((e) => {
|
|
|
2452
2452
|
whitesmoke: `#f5f5f5`,
|
|
2453
2453
|
yellow: `#ff0`,
|
|
2454
2454
|
yellowgreen: `#9acd32`
|
|
2455
|
-
},
|
|
2455
|
+
}, we = {
|
|
2456
2456
|
"#f0ffff": `azure`,
|
|
2457
2457
|
"#f5f5dc": `beige`,
|
|
2458
2458
|
"#ffe4c4": `bisque`,
|
|
@@ -2485,14 +2485,14 @@ var l = e(((e) => {
|
|
|
2485
2485
|
"#ff6347": `tomato`,
|
|
2486
2486
|
"#ee82ee": `violet`,
|
|
2487
2487
|
"#f5deb3": `wheat`
|
|
2488
|
-
},
|
|
2488
|
+
}, Te = /* @__PURE__ */ new Set([
|
|
2489
2489
|
`color`,
|
|
2490
2490
|
`fill`,
|
|
2491
2491
|
`flood-color`,
|
|
2492
2492
|
`lighting-color`,
|
|
2493
2493
|
`stop-color`,
|
|
2494
2494
|
`stroke`
|
|
2495
|
-
]),
|
|
2495
|
+
]), Ee = {
|
|
2496
2496
|
displayState: /* @__PURE__ */ new Set([
|
|
2497
2497
|
`fullscreen`,
|
|
2498
2498
|
`modal`,
|
|
@@ -2561,25 +2561,25 @@ var l = e(((e) => {
|
|
|
2561
2561
|
`has`
|
|
2562
2562
|
])
|
|
2563
2563
|
};
|
|
2564
|
-
var
|
|
2564
|
+
var De = Object.freeze({
|
|
2565
2565
|
__proto__: null,
|
|
2566
|
-
attrsGroups:
|
|
2567
|
-
attrsGroupsDefaults:
|
|
2568
|
-
attrsGroupsDeprecated:
|
|
2569
|
-
colorsNames:
|
|
2570
|
-
colorsProps:
|
|
2571
|
-
colorsShortNames:
|
|
2572
|
-
editorNamespaces:
|
|
2573
|
-
elems:
|
|
2574
|
-
elemsGroups:
|
|
2575
|
-
inheritableAttrs:
|
|
2576
|
-
pathElems:
|
|
2577
|
-
presentationNonInheritableGroupAttrs:
|
|
2578
|
-
pseudoClasses:
|
|
2579
|
-
referencesProps:
|
|
2580
|
-
textElems:
|
|
2566
|
+
attrsGroups: j,
|
|
2567
|
+
attrsGroupsDefaults: ve,
|
|
2568
|
+
attrsGroupsDeprecated: ye,
|
|
2569
|
+
colorsNames: Ce,
|
|
2570
|
+
colorsProps: Te,
|
|
2571
|
+
colorsShortNames: we,
|
|
2572
|
+
editorNamespaces: xe,
|
|
2573
|
+
elems: be,
|
|
2574
|
+
elemsGroups: A,
|
|
2575
|
+
inheritableAttrs: N,
|
|
2576
|
+
pathElems: _e,
|
|
2577
|
+
presentationNonInheritableGroupAttrs: Se,
|
|
2578
|
+
pseudoClasses: Ee,
|
|
2579
|
+
referencesProps: M,
|
|
2580
|
+
textElems: ge
|
|
2581
2581
|
});
|
|
2582
|
-
let
|
|
2582
|
+
let Oe = b.walk.skip, ke = (e, t) => {
|
|
2583
2583
|
let n = [];
|
|
2584
2584
|
e.block.children.forEach(((e) => {
|
|
2585
2585
|
e.type === `Declaration` && n.push({
|
|
@@ -2602,23 +2602,23 @@ var l = e(((e) => {
|
|
|
2602
2602
|
});
|
|
2603
2603
|
}
|
|
2604
2604
|
})), r;
|
|
2605
|
-
},
|
|
2605
|
+
}, Ae = (e, t) => {
|
|
2606
2606
|
let n = [], r = b.parse(e, {
|
|
2607
2607
|
parseValue: !1,
|
|
2608
2608
|
parseAtrulePrelude: !1
|
|
2609
2609
|
});
|
|
2610
2610
|
return b.walk(r, ((e) => {
|
|
2611
|
-
if (e.type === `Rule`) return n.push(...
|
|
2611
|
+
if (e.type === `Rule`) return n.push(...ke(e, t || !1)), Oe;
|
|
2612
2612
|
if (e.type === `Atrule`) return [
|
|
2613
2613
|
`keyframes`,
|
|
2614
2614
|
`-webkit-keyframes`,
|
|
2615
2615
|
`-o-keyframes`,
|
|
2616
2616
|
`-moz-keyframes`
|
|
2617
2617
|
].includes(e.name) || b.walk(e, ((e) => {
|
|
2618
|
-
if (e.type === `Rule`) return n.push(...
|
|
2619
|
-
})),
|
|
2618
|
+
if (e.type === `Rule`) return n.push(...ke(e, t || !0)), Oe;
|
|
2619
|
+
})), Oe;
|
|
2620
2620
|
})), n;
|
|
2621
|
-
},
|
|
2621
|
+
}, je = (e) => {
|
|
2622
2622
|
let t = [], n = b.parse(e, {
|
|
2623
2623
|
context: `declarationList`,
|
|
2624
2624
|
parseValue: !1
|
|
@@ -2630,14 +2630,14 @@ var l = e(((e) => {
|
|
|
2630
2630
|
important: e.important === !0
|
|
2631
2631
|
});
|
|
2632
2632
|
})), t;
|
|
2633
|
-
},
|
|
2633
|
+
}, Me = (e, t, n) => {
|
|
2634
2634
|
let r = {}, i = /* @__PURE__ */ new Map();
|
|
2635
|
-
for (let [e, n] of Object.entries(t.attributes))
|
|
2635
|
+
for (let [e, n] of Object.entries(t.attributes)) j.presentation.has(e) && (r[e] = {
|
|
2636
2636
|
type: `static`,
|
|
2637
2637
|
inherited: !1,
|
|
2638
2638
|
value: n
|
|
2639
2639
|
}, i.set(e, !1));
|
|
2640
|
-
for (let { selector: a, declarations: o, dynamic: s } of e.rules) if (
|
|
2640
|
+
for (let { selector: a, declarations: o, dynamic: s } of e.rules) if (de(t, a, n)) for (let { name: e, value: t, important: n } of o) {
|
|
2641
2641
|
let a = r[e];
|
|
2642
2642
|
if (!(a && a.type === `dynamic`)) {
|
|
2643
2643
|
if (s) {
|
|
@@ -2654,7 +2654,7 @@ var l = e(((e) => {
|
|
|
2654
2654
|
}, i.set(e, n));
|
|
2655
2655
|
}
|
|
2656
2656
|
}
|
|
2657
|
-
let a = t.attributes.style == null ? [] :
|
|
2657
|
+
let a = t.attributes.style == null ? [] : je(t.attributes.style);
|
|
2658
2658
|
for (let { name: e, value: t, important: n } of a) {
|
|
2659
2659
|
let a = r[e];
|
|
2660
2660
|
a && a.type === `dynamic` || (a == null || n === !0 || i.get(e) === !1) && (r[e] = {
|
|
@@ -2664,40 +2664,40 @@ var l = e(((e) => {
|
|
|
2664
2664
|
}, i.set(e, n));
|
|
2665
2665
|
}
|
|
2666
2666
|
return r;
|
|
2667
|
-
},
|
|
2667
|
+
}, Ne = (e, t) => {
|
|
2668
2668
|
for (let n = 0; n < 4; n += 1) {
|
|
2669
2669
|
if (e[n] < t[n]) return -1;
|
|
2670
2670
|
if (e[n] > t[n]) return 1;
|
|
2671
2671
|
}
|
|
2672
2672
|
return 0;
|
|
2673
|
-
},
|
|
2673
|
+
}, P = (e) => {
|
|
2674
2674
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
2675
2675
|
return C(e, { element: { enter: (e, r) => {
|
|
2676
2676
|
if (n.set(e, r), e.name === `style` && (e.attributes.type == null || e.attributes.type === `` || e.attributes.type === `text/css`)) {
|
|
2677
2677
|
let n = e.attributes.media != null && e.attributes.media !== `all`;
|
|
2678
|
-
for (let r of e.children) r.type !== `text` && r.type !== `cdata` || t.push(...
|
|
2678
|
+
for (let r of e.children) r.type !== `text` && r.type !== `cdata` || t.push(...Ae(r.value, n));
|
|
2679
2679
|
}
|
|
2680
|
-
} } }), t.sort(((e, t) =>
|
|
2680
|
+
} } }), t.sort(((e, t) => Ne(e.specificity, t.specificity))), {
|
|
2681
2681
|
rules: t,
|
|
2682
2682
|
parents: n
|
|
2683
2683
|
};
|
|
2684
|
-
},
|
|
2685
|
-
let { parents: n } = e, r =
|
|
2684
|
+
}, F = (e, t) => {
|
|
2685
|
+
let { parents: n } = e, r = Me(e, t, n), i = n.get(t);
|
|
2686
2686
|
for (; i != null && i.type !== `root`;) {
|
|
2687
|
-
let t =
|
|
2688
|
-
for (let [e, n] of Object.entries(t)) r[e] == null &&
|
|
2687
|
+
let t = Me(e, i, n);
|
|
2688
|
+
for (let [e, n] of Object.entries(t)) r[e] == null && N.has(e) && !Se.has(e) && (r[e] = {
|
|
2689
2689
|
...n,
|
|
2690
2690
|
inherited: !0
|
|
2691
2691
|
});
|
|
2692
2692
|
i = n.get(i);
|
|
2693
2693
|
}
|
|
2694
2694
|
return r;
|
|
2695
|
-
},
|
|
2695
|
+
}, Pe = (e, t, n = null, r = !1) => {
|
|
2696
2696
|
let i = typeof e == `string` ? y.parse(e) : y.parse(b.generate(e.data));
|
|
2697
2697
|
for (let e of i) if (e.some(((i, a) => r && (a === e.length - 1 || !y.isTraversal(e[a + 1])) || i.type !== `attribute` || i.name !== t ? !1 : n == null || i.value === n))) return !0;
|
|
2698
2698
|
return !1;
|
|
2699
2699
|
};
|
|
2700
|
-
function
|
|
2700
|
+
function Fe(e) {
|
|
2701
2701
|
let t = /* @__PURE__ */ new Set();
|
|
2702
2702
|
return e.rules.forEach(((e) => {
|
|
2703
2703
|
y.parse(e.selector).forEach(((e) => {
|
|
@@ -2707,40 +2707,40 @@ var l = e(((e) => {
|
|
|
2707
2707
|
}));
|
|
2708
2708
|
})), t;
|
|
2709
2709
|
}
|
|
2710
|
-
function
|
|
2710
|
+
function Ie(e, t, n, r) {
|
|
2711
2711
|
t && (t.safe && t.safe.forEach(((t) => {
|
|
2712
2712
|
r.has(t) || delete e.attributes[t];
|
|
2713
2713
|
})), n.removeUnsafe && t.unsafe && t.unsafe.forEach(((t) => {
|
|
2714
2714
|
r.has(t) || delete e.attributes[t];
|
|
2715
2715
|
})));
|
|
2716
2716
|
}
|
|
2717
|
-
function
|
|
2718
|
-
let n =
|
|
2717
|
+
function Le(e, t) {
|
|
2718
|
+
let n = Fe(P(e));
|
|
2719
2719
|
return { element: { enter: (e) => {
|
|
2720
|
-
let r =
|
|
2720
|
+
let r = be[e.name];
|
|
2721
2721
|
r && (r.attrsGroups.has(`core`) && e.attributes[`xml:lang`] && !n.has(`xml:lang`) && e.attributes.lang && delete e.attributes[`xml:lang`], r.attrsGroups.forEach(((r) => {
|
|
2722
|
-
|
|
2723
|
-
})),
|
|
2722
|
+
Ie(e, ye[r], t, n);
|
|
2723
|
+
})), Ie(e, r.deprecated, t, n));
|
|
2724
2724
|
} } };
|
|
2725
2725
|
}
|
|
2726
|
-
var
|
|
2726
|
+
var Re = Object.freeze({
|
|
2727
2727
|
__proto__: null,
|
|
2728
2728
|
description: `removes deprecated attributes`,
|
|
2729
|
-
fn:
|
|
2729
|
+
fn: Le,
|
|
2730
2730
|
name: `removeDeprecatedAttrs`
|
|
2731
|
-
}),
|
|
2731
|
+
}), ze = Object.freeze({
|
|
2732
2732
|
__proto__: null,
|
|
2733
2733
|
description: `removes <metadata>`,
|
|
2734
2734
|
fn: () => ({ element: { enter: (e, t) => {
|
|
2735
|
-
e.name === `metadata` &&
|
|
2735
|
+
e.name === `metadata` && k(e, t);
|
|
2736
2736
|
} } }),
|
|
2737
2737
|
name: `removeMetadata`
|
|
2738
|
-
}),
|
|
2738
|
+
}), Be = Object.freeze({
|
|
2739
2739
|
__proto__: null,
|
|
2740
2740
|
description: `removes editors namespaces, elements and attributes`,
|
|
2741
2741
|
fn: (e, t) => {
|
|
2742
|
-
let n = [...
|
|
2743
|
-
Array.isArray(t.additionalNamespaces) && (n = [...
|
|
2742
|
+
let n = [...xe];
|
|
2743
|
+
Array.isArray(t.additionalNamespaces) && (n = [...xe, ...t.additionalNamespaces]);
|
|
2744
2744
|
let r = [];
|
|
2745
2745
|
return { element: { enter: (e, t) => {
|
|
2746
2746
|
if (e.name === `svg`) for (let [t, i] of Object.entries(e.attributes)) t.startsWith(`xmlns:`) && n.includes(i) && (r.push(t.slice(6)), delete e.attributes[t]);
|
|
@@ -2750,24 +2750,24 @@ var l = e(((e) => {
|
|
|
2750
2750
|
}
|
|
2751
2751
|
if (e.name.includes(`:`)) {
|
|
2752
2752
|
let [n] = e.name.split(`:`);
|
|
2753
|
-
r.includes(n) &&
|
|
2753
|
+
r.includes(n) && k(e, t);
|
|
2754
2754
|
}
|
|
2755
2755
|
} } };
|
|
2756
2756
|
},
|
|
2757
2757
|
name: `removeEditorsNSData`
|
|
2758
2758
|
});
|
|
2759
|
-
let
|
|
2760
|
-
var
|
|
2759
|
+
let Ve = /(\S)\r?\n(\S)/g, He = /\r?\n/g, Ue = /\s{2,}/g;
|
|
2760
|
+
var We = Object.freeze({
|
|
2761
2761
|
__proto__: null,
|
|
2762
2762
|
description: `cleanups attributes from newlines, trailing and repeating spaces`,
|
|
2763
2763
|
fn: (e, t) => {
|
|
2764
2764
|
let { newlines: n = !0, trim: r = !0, spaces: i = !0 } = t;
|
|
2765
2765
|
return { element: { enter: (e) => {
|
|
2766
|
-
for (let t of Object.keys(e.attributes)) n && (e.attributes[t] = e.attributes[t].replace(
|
|
2766
|
+
for (let t of Object.keys(e.attributes)) n && (e.attributes[t] = e.attributes[t].replace(Ve, ((e, t, n) => t + ` ` + n)), e.attributes[t] = e.attributes[t].replace(He, ``)), r && (e.attributes[t] = e.attributes[t].trim()), i && (e.attributes[t] = e.attributes[t].replace(Ue, ` `));
|
|
2767
2767
|
} } };
|
|
2768
2768
|
},
|
|
2769
2769
|
name: `cleanupAttrs`
|
|
2770
|
-
}),
|
|
2770
|
+
}), Ge = Object.freeze({
|
|
2771
2771
|
__proto__: null,
|
|
2772
2772
|
description: `merge multiple style elements into one`,
|
|
2773
2773
|
fn: () => {
|
|
@@ -2778,10 +2778,10 @@ var l = e(((e) => {
|
|
|
2778
2778
|
let a = ``;
|
|
2779
2779
|
for (let e of r.children) e.type === `text` && (a += e.value), e.type === `cdata` && (n = `cdata`, a += e.value);
|
|
2780
2780
|
if (a.trim().length === 0) {
|
|
2781
|
-
|
|
2781
|
+
k(r, i);
|
|
2782
2782
|
return;
|
|
2783
2783
|
}
|
|
2784
|
-
r.attributes.media == null ? t += a : (t += `@media ${r.attributes.media}{${a}}`, delete r.attributes.media), e == null ? e = r : (
|
|
2784
|
+
r.attributes.media == null ? t += a : (t += `@media ${r.attributes.media}{${a}}`, delete r.attributes.media), e == null ? e = r : (k(r, i), e.children = [{
|
|
2785
2785
|
type: n,
|
|
2786
2786
|
value: t
|
|
2787
2787
|
}]);
|
|
@@ -2789,8 +2789,8 @@ var l = e(((e) => {
|
|
|
2789
2789
|
},
|
|
2790
2790
|
name: `mergeStyles`
|
|
2791
2791
|
});
|
|
2792
|
-
let
|
|
2793
|
-
var
|
|
2792
|
+
let Ke = [...Ee.functional, ...Ee.treeStructural];
|
|
2793
|
+
var qe = Object.freeze({
|
|
2794
2794
|
__proto__: null,
|
|
2795
2795
|
description: `inline styles (additional options)`,
|
|
2796
2796
|
fn: (e, t) => {
|
|
@@ -2820,7 +2820,7 @@ var l = e(((e) => {
|
|
|
2820
2820
|
if (t.type === `Selector`) {
|
|
2821
2821
|
let r = [];
|
|
2822
2822
|
t.children.forEach(((e, t, n) => {
|
|
2823
|
-
(e.type === `PseudoClassSelector` || e.type === `PseudoElementSelector`) && !
|
|
2823
|
+
(e.type === `PseudoClassSelector` || e.type === `PseudoElementSelector`) && !Ke.includes(e.name) && r.push({
|
|
2824
2824
|
item: t,
|
|
2825
2825
|
list: n
|
|
2826
2826
|
});
|
|
@@ -2842,11 +2842,14 @@ var l = e(((e) => {
|
|
|
2842
2842
|
} },
|
|
2843
2843
|
root: { exit: () => {
|
|
2844
2844
|
if (o.length === 0) return;
|
|
2845
|
-
let t = s.slice().sort(((e, t) =>
|
|
2845
|
+
let t = s.slice().sort(((e, t) => {
|
|
2846
|
+
let n = h.syntax.specificity(e.item.data), r = h.syntax.specificity(t.item.data);
|
|
2847
|
+
return Ne(n, r);
|
|
2848
|
+
})).reverse();
|
|
2846
2849
|
for (let i of t) {
|
|
2847
2850
|
let t = b.generate(i.item.data), a = [];
|
|
2848
2851
|
try {
|
|
2849
|
-
for (let n of
|
|
2852
|
+
for (let n of O(e, t)) n.type === `element` && a.push(n);
|
|
2850
2853
|
} catch {
|
|
2851
2854
|
continue;
|
|
2852
2855
|
}
|
|
@@ -2867,7 +2870,7 @@ var l = e(((e) => {
|
|
|
2867
2870
|
visit: `Declaration`,
|
|
2868
2871
|
enter(i) {
|
|
2869
2872
|
let a = i.property;
|
|
2870
|
-
|
|
2873
|
+
j.presentation.has(a) && !s.some(((e) => Pe(e.item, a))) && delete e.attributes[a];
|
|
2871
2874
|
let o = n.get(a), c = t.children.createItem(i);
|
|
2872
2875
|
o == null ? t.children.insert(c, r) : o.data.important !== !0 && i.important === !0 && (t.children.replace(o, c), n.set(a, c));
|
|
2873
2876
|
}
|
|
@@ -2881,17 +2884,17 @@ var l = e(((e) => {
|
|
|
2881
2884
|
if (r) {
|
|
2882
2885
|
for (let e of t) if (e.matchedElements != null && !(n && e.matchedElements.length > 1)) for (let t of e.matchedElements) {
|
|
2883
2886
|
let n = new Set(t.attributes.class == null ? null : t.attributes.class.split(` `));
|
|
2884
|
-
for (let t of e.node.children) t.type !== `ClassSelector` || s.some(((e) =>
|
|
2887
|
+
for (let t of e.node.children) t.type !== `ClassSelector` || s.some(((e) => Pe(e.item, `class`, t.name, !0))) || n.delete(t.name);
|
|
2885
2888
|
n.size === 0 ? delete t.attributes.class : t.attributes.class = Array.from(n).join(` `);
|
|
2886
2889
|
let r = e.node.children.first;
|
|
2887
|
-
r?.type !== `IdSelector` || t.attributes.id !== r.name || s.some(((e) =>
|
|
2890
|
+
r?.type !== `IdSelector` || t.attributes.id !== r.name || s.some(((e) => Pe(e.item, `id`, r.name, !0))) || delete t.attributes.id;
|
|
2888
2891
|
}
|
|
2889
2892
|
for (let e of o) if (b.walk(e.cssAst, {
|
|
2890
2893
|
visit: `Rule`,
|
|
2891
2894
|
enter: function(e, t, n) {
|
|
2892
2895
|
e.type === `Rule` && e.prelude.type === `SelectorList` && e.prelude.children.isEmpty && n.remove(t);
|
|
2893
2896
|
}
|
|
2894
|
-
}), e.cssAst.children.isEmpty)
|
|
2897
|
+
}), e.cssAst.children.isEmpty) k(e.node, e.parentNode);
|
|
2895
2898
|
else {
|
|
2896
2899
|
let t = e.node.children[0];
|
|
2897
2900
|
t.type !== `text` && t.type !== `cdata` || (t.value = b.generate(e.cssAst));
|
|
@@ -2902,45 +2905,45 @@ var l = e(((e) => {
|
|
|
2902
2905
|
},
|
|
2903
2906
|
name: `inlineStyles`
|
|
2904
2907
|
});
|
|
2905
|
-
let
|
|
2908
|
+
let Je = /\burl\((["'])?#(.+?)\1\)/g, Ye = /^#(.+?)$/, Xe = /(\w+)\.[a-zA-Z]/, Ze = (e, t) => {
|
|
2906
2909
|
let n = `data:image/svg+xml`;
|
|
2907
2910
|
return t && t !== `base64` ? t === `enc` ? e = n + `,` + encodeURIComponent(e) : t === `unenc` && (e = n + `,` + e) : (n += `;base64,`, e = n + Buffer.from(e).toString(`base64`)), e;
|
|
2908
|
-
},
|
|
2911
|
+
}, I = (e, t, n) => {
|
|
2909
2912
|
let r = ``, i, a;
|
|
2910
2913
|
return e.forEach(((e, n) => {
|
|
2911
2914
|
i = ` `, n == 0 && (i = ``), t.noSpaceAfterFlags;
|
|
2912
|
-
let o = t.leadingZero ?
|
|
2915
|
+
let o = t.leadingZero ? L(e) : e.toString();
|
|
2913
2916
|
t.negativeExtraSpace && i != `` && (e < 0 || o.charAt(0) === `.` && a % 1 != 0) && (i = ``), a = e, r += i + o;
|
|
2914
2917
|
})), r;
|
|
2915
|
-
},
|
|
2918
|
+
}, L = (e) => {
|
|
2916
2919
|
let t = e.toString();
|
|
2917
2920
|
return 0 < e && e < 1 && t.startsWith(`0`) ? t.slice(1) : -1 < e && e < 0 && t[1] === `0` ? t[0] + t.slice(2) : t;
|
|
2918
|
-
},
|
|
2919
|
-
...
|
|
2920
|
-
...
|
|
2921
|
-
...
|
|
2922
|
-
...
|
|
2923
|
-
...
|
|
2924
|
-
],
|
|
2921
|
+
}, Qe = [
|
|
2922
|
+
...j.animationEvent,
|
|
2923
|
+
...j.documentEvent,
|
|
2924
|
+
...j.documentElementEvent,
|
|
2925
|
+
...j.globalEvent,
|
|
2926
|
+
...j.graphicalEvent
|
|
2927
|
+
], $e = (e) => e.name === `script` && e.children.length !== 0 || e.name === `a` && Object.entries(e.attributes).some((([e, t]) => (e === `href` || e.endsWith(`:href`)) && t != null && t.trimStart().toLowerCase().startsWith(`javascript:`))) ? !0 : Qe.some(((t) => e.attributes[t] != null)), et = (e) => new RegExp(Je).test(e), tt = (e) => /var\s*\(\s*--/.test(e), nt = (e, t) => {
|
|
2925
2928
|
let n = [];
|
|
2926
|
-
if (
|
|
2927
|
-
let e = t.matchAll(
|
|
2929
|
+
if (M.has(e)) {
|
|
2930
|
+
let e = t.matchAll(Je);
|
|
2928
2931
|
for (let t of e) n.push(t[2]);
|
|
2929
2932
|
}
|
|
2930
2933
|
if (e === `href` || e.endsWith(`:href`)) {
|
|
2931
|
-
let e =
|
|
2934
|
+
let e = Ye.exec(t);
|
|
2932
2935
|
e != null && n.push(e[1]);
|
|
2933
2936
|
}
|
|
2934
2937
|
if (e === `begin`) {
|
|
2935
|
-
let e =
|
|
2938
|
+
let e = Xe.exec(t);
|
|
2936
2939
|
e != null && n.push(e[1]);
|
|
2937
2940
|
}
|
|
2938
2941
|
return n.map(((e) => decodeURI(e)));
|
|
2939
|
-
},
|
|
2942
|
+
}, R = (e, t) => {
|
|
2940
2943
|
let n = 10 ** t;
|
|
2941
2944
|
return Math.round(e * n) / n;
|
|
2942
2945
|
};
|
|
2943
|
-
var
|
|
2946
|
+
var rt = Object.freeze({
|
|
2944
2947
|
__proto__: null,
|
|
2945
2948
|
description: `minifies styles and removes unused styles`,
|
|
2946
2949
|
fn: (e, { usage: t, ...n }) => {
|
|
@@ -2949,7 +2952,7 @@ var l = e(((e) => {
|
|
|
2949
2952
|
let f = !1;
|
|
2950
2953
|
return {
|
|
2951
2954
|
element: { enter: (e, t) => {
|
|
2952
|
-
if (
|
|
2955
|
+
if ($e(e) && (f = !0), a.add(e.name), e.attributes.id != null && o.add(e.attributes.id), e.attributes.class != null) for (let t of e.attributes.class.split(/\s+/)) s.add(t);
|
|
2953
2956
|
e.name === `style` && e.children.length !== 0 ? r.set(e, t) : e.attributes.style != null && i.push(e);
|
|
2954
2957
|
} },
|
|
2955
2958
|
root: { exit: () => {
|
|
@@ -2961,7 +2964,7 @@ var l = e(((e) => {
|
|
|
2961
2964
|
usage: e
|
|
2962
2965
|
}).css;
|
|
2963
2966
|
if (a.length === 0) {
|
|
2964
|
-
|
|
2967
|
+
k(t, i);
|
|
2965
2968
|
continue;
|
|
2966
2969
|
}
|
|
2967
2970
|
r.indexOf(`>`) >= 0 || r.indexOf(`<`) >= 0 ? (t.children[0].type = `cdata`, t.children[0].value = a) : (t.children[0].type = `text`, t.children[0].value = a);
|
|
@@ -2975,16 +2978,16 @@ var l = e(((e) => {
|
|
|
2975
2978
|
},
|
|
2976
2979
|
name: `minifyStyles`
|
|
2977
2980
|
});
|
|
2978
|
-
let
|
|
2981
|
+
let it = `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``), at = it.length - 1, ot = (e, t) => {
|
|
2979
2982
|
for (let n of t) if (e.startsWith(n)) return !0;
|
|
2980
2983
|
return !1;
|
|
2981
|
-
},
|
|
2984
|
+
}, st = (e) => {
|
|
2982
2985
|
if (e == null) return [0];
|
|
2983
2986
|
e[e.length - 1] += 1;
|
|
2984
|
-
for (let t = e.length - 1; t > 0; t--) e[t] >
|
|
2985
|
-
return e[0] >
|
|
2986
|
-
},
|
|
2987
|
-
var
|
|
2987
|
+
for (let t = e.length - 1; t > 0; t--) e[t] > at && (e[t] = 0, e[t - 1] !== void 0 && e[t - 1]++);
|
|
2988
|
+
return e[0] > at && (e[0] = 0, e.unshift(0)), e;
|
|
2989
|
+
}, ct = (e) => e.map(((e) => it[e])).join(``);
|
|
2990
|
+
var lt = Object.freeze({
|
|
2988
2991
|
__proto__: null,
|
|
2989
2992
|
description: `removes unused IDs and minifies used`,
|
|
2990
2993
|
fn: (e, t) => {
|
|
@@ -2992,7 +2995,7 @@ var l = e(((e) => {
|
|
|
2992
2995
|
return {
|
|
2993
2996
|
element: { enter: (e) => {
|
|
2994
2997
|
if (!o) {
|
|
2995
|
-
if (e.name === `style` && e.children.length !== 0 ||
|
|
2998
|
+
if (e.name === `style` && e.children.length !== 0 || $e(e)) {
|
|
2996
2999
|
d = !0;
|
|
2997
3000
|
return;
|
|
2998
3001
|
}
|
|
@@ -3009,7 +3012,7 @@ var l = e(((e) => {
|
|
|
3009
3012
|
let t = n;
|
|
3010
3013
|
l.has(t) ? delete e.attributes.id : l.set(t, e);
|
|
3011
3014
|
} else {
|
|
3012
|
-
let r =
|
|
3015
|
+
let r = nt(t, n);
|
|
3013
3016
|
for (let n of r) {
|
|
3014
3017
|
let r = u.get(n);
|
|
3015
3018
|
r ?? (r = [], u.set(n, r)), r.push({
|
|
@@ -3021,14 +3024,14 @@ var l = e(((e) => {
|
|
|
3021
3024
|
} },
|
|
3022
3025
|
root: { exit: () => {
|
|
3023
3026
|
if (d) return;
|
|
3024
|
-
let e = (e) => s.has(e) ||
|
|
3027
|
+
let e = (e) => s.has(e) || ot(e, c), t = null;
|
|
3025
3028
|
for (let [n, i] of u) {
|
|
3026
3029
|
let a = l.get(n);
|
|
3027
3030
|
if (a != null) {
|
|
3028
3031
|
if (r && e(n) === !1) {
|
|
3029
3032
|
let r;
|
|
3030
3033
|
do
|
|
3031
|
-
t =
|
|
3034
|
+
t = st(t), r = ct(t);
|
|
3032
3035
|
while (e(r) || u.has(r) && l.get(r) == null);
|
|
3033
3036
|
a.attributes.id = r;
|
|
3034
3037
|
for (let { element: e, name: t } of i) {
|
|
@@ -3045,21 +3048,21 @@ var l = e(((e) => {
|
|
|
3045
3048
|
},
|
|
3046
3049
|
name: `cleanupIds`
|
|
3047
3050
|
});
|
|
3048
|
-
let
|
|
3049
|
-
if (e.name === `defs` ||
|
|
3051
|
+
let ut = () => ({ element: { enter: (e, t) => {
|
|
3052
|
+
if (e.name === `defs` || A.nonRendering.has(e.name) && e.attributes.id == null) {
|
|
3050
3053
|
let n = [];
|
|
3051
|
-
|
|
3054
|
+
dt(e, n), n.length === 0 && k(e, t), e.children = n;
|
|
3052
3055
|
}
|
|
3053
|
-
} } }),
|
|
3054
|
-
for (let n of e.children) n.type === `element` && (n.attributes.id != null || n.name === `style` ? t.push(n) :
|
|
3056
|
+
} } }), dt = (e, t) => {
|
|
3057
|
+
for (let n of e.children) n.type === `element` && (n.attributes.id != null || n.name === `style` ? t.push(n) : dt(n, t));
|
|
3055
3058
|
};
|
|
3056
|
-
var
|
|
3059
|
+
var ft = Object.freeze({
|
|
3057
3060
|
__proto__: null,
|
|
3058
3061
|
description: `removes elements in <defs> without id`,
|
|
3059
|
-
fn:
|
|
3062
|
+
fn: ut,
|
|
3060
3063
|
name: `removeUselessDefs`
|
|
3061
3064
|
});
|
|
3062
|
-
let
|
|
3065
|
+
let pt = /^([-+]?\d*\.?\d+([eE][-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/, mt = {
|
|
3063
3066
|
cm: 96 / 2.54,
|
|
3064
3067
|
mm: 96 / 25.4,
|
|
3065
3068
|
in: 96,
|
|
@@ -3067,7 +3070,7 @@ var l = e(((e) => {
|
|
|
3067
3070
|
pc: 16,
|
|
3068
3071
|
px: 1
|
|
3069
3072
|
};
|
|
3070
|
-
var
|
|
3073
|
+
var ht = Object.freeze({
|
|
3071
3074
|
__proto__: null,
|
|
3072
3075
|
description: `rounds numeric values to the fixed precision, removes default "px" units`,
|
|
3073
3076
|
fn: (e, t) => {
|
|
@@ -3082,23 +3085,23 @@ var l = e(((e) => {
|
|
|
3082
3085
|
}
|
|
3083
3086
|
for (let [t, o] of Object.entries(e.attributes)) {
|
|
3084
3087
|
if (t === `version`) continue;
|
|
3085
|
-
let s =
|
|
3088
|
+
let s = pt.exec(o);
|
|
3086
3089
|
if (s) {
|
|
3087
3090
|
let o = Number(Number(s[1]).toFixed(n)), c = s[3] || ``;
|
|
3088
|
-
if (a && c !== `` && c in
|
|
3089
|
-
let e = Number((
|
|
3091
|
+
if (a && c !== `` && c in mt) {
|
|
3092
|
+
let e = Number((mt[c] * Number(s[1])).toFixed(n));
|
|
3090
3093
|
e.toString().length < s[0].length && (o = e, c = `px`);
|
|
3091
3094
|
}
|
|
3092
3095
|
let l;
|
|
3093
|
-
l = r ?
|
|
3096
|
+
l = r ? L(o) : o.toString(), i && c === `px` && (c = ``), e.attributes[t] = l + c;
|
|
3094
3097
|
}
|
|
3095
3098
|
}
|
|
3096
3099
|
} } };
|
|
3097
3100
|
},
|
|
3098
3101
|
name: `cleanupNumericValues`
|
|
3099
3102
|
});
|
|
3100
|
-
let
|
|
3101
|
-
var
|
|
3103
|
+
let gt = RegExp(`^rgb\\(\\s*([+-]?(?:\\d*\\.\\d+|\\d+\\.?)%?)(?:\\s*,\\s*|\\s+)([+-]?(?:\\d*\\.\\d+|\\d+\\.?)%?)(?:\\s*,\\s*|\\s+)([+-]?(?:\\d*\\.\\d+|\\d+\\.?)%?)\\s*\\)$`), _t = /^#(([a-fA-F0-9])\2){3}$/, vt = ([e, t, n]) => `#` + ((256 + e << 8 | t) << 8 | n).toString(16).slice(1).toUpperCase();
|
|
3104
|
+
var yt = Object.freeze({
|
|
3102
3105
|
__proto__: null,
|
|
3103
3106
|
description: `converts colors: rgb() to #rrggbb and #rrggbb to #rgb`,
|
|
3104
3107
|
fn: (e, t) => {
|
|
@@ -3106,7 +3109,7 @@ var l = e(((e) => {
|
|
|
3106
3109
|
return { element: {
|
|
3107
3110
|
enter: (e) => {
|
|
3108
3111
|
e.name === `mask` && c++;
|
|
3109
|
-
for (let [t, l] of Object.entries(e.attributes)) if (
|
|
3112
|
+
for (let [t, l] of Object.entries(e.attributes)) if (Te.has(t)) {
|
|
3110
3113
|
let u = l;
|
|
3111
3114
|
if (n && c === 0) {
|
|
3112
3115
|
let e;
|
|
@@ -3114,22 +3117,25 @@ var l = e(((e) => {
|
|
|
3114
3117
|
}
|
|
3115
3118
|
if (r) {
|
|
3116
3119
|
let e = u.toLowerCase();
|
|
3117
|
-
|
|
3120
|
+
Ce[e] != null && (u = Ce[e]);
|
|
3118
3121
|
}
|
|
3119
3122
|
if (i) {
|
|
3120
|
-
let e = u.match(
|
|
3121
|
-
e != null
|
|
3122
|
-
let t
|
|
3123
|
-
|
|
3124
|
-
|
|
3123
|
+
let e = u.match(gt);
|
|
3124
|
+
if (e != null) {
|
|
3125
|
+
let t = e.slice(1, 4).map(((e) => {
|
|
3126
|
+
let t;
|
|
3127
|
+
return t = e.indexOf(`%`) > -1 ? Math.round(parseFloat(e) * 2.55) : Number(e), Math.max(0, Math.min(t, 255));
|
|
3128
|
+
}));
|
|
3129
|
+
u = vt(t);
|
|
3130
|
+
}
|
|
3125
3131
|
}
|
|
3126
|
-
if (a
|
|
3127
|
-
let e =
|
|
3132
|
+
if (!a || et(u) || tt(u) || u === `currentColor` || (a === `lower` ? u = u.toLowerCase() : a === `upper` && (u = u.toUpperCase())), o) {
|
|
3133
|
+
let e = _t.exec(u);
|
|
3128
3134
|
e != null && (u = `#` + e[0][1] + e[0][3] + e[0][5]);
|
|
3129
3135
|
}
|
|
3130
3136
|
if (s) {
|
|
3131
3137
|
let e = u.toLowerCase();
|
|
3132
|
-
|
|
3138
|
+
we[e] != null && (u = we[e]);
|
|
3133
3139
|
}
|
|
3134
3140
|
e.attributes[t] = u;
|
|
3135
3141
|
}
|
|
@@ -3141,12 +3147,12 @@ var l = e(((e) => {
|
|
|
3141
3147
|
},
|
|
3142
3148
|
name: `convertColors`
|
|
3143
3149
|
});
|
|
3144
|
-
let
|
|
3145
|
-
for (let [e, t] of Object.entries(
|
|
3150
|
+
let bt = /* @__PURE__ */ new Map(), xt = /* @__PURE__ */ new Map(), St = /* @__PURE__ */ new Map();
|
|
3151
|
+
for (let [e, t] of Object.entries(be)) {
|
|
3146
3152
|
let n = /* @__PURE__ */ new Set();
|
|
3147
3153
|
if (t.content) for (let e of t.content) n.add(e);
|
|
3148
3154
|
if (t.contentGroups) for (let e of t.contentGroups) {
|
|
3149
|
-
let t =
|
|
3155
|
+
let t = A[e];
|
|
3150
3156
|
if (t) for (let e of t) n.add(e);
|
|
3151
3157
|
}
|
|
3152
3158
|
let r = /* @__PURE__ */ new Set();
|
|
@@ -3154,18 +3160,18 @@ var l = e(((e) => {
|
|
|
3154
3160
|
let i = /* @__PURE__ */ new Map();
|
|
3155
3161
|
if (t.defaults) for (let [e, n] of Object.entries(t.defaults)) i.set(e, n);
|
|
3156
3162
|
for (let e of t.attrsGroups) {
|
|
3157
|
-
let t =
|
|
3163
|
+
let t = j[e];
|
|
3158
3164
|
if (t) for (let e of t) r.add(e);
|
|
3159
|
-
let n =
|
|
3165
|
+
let n = ve[e];
|
|
3160
3166
|
if (n) for (let [e, t] of Object.entries(n)) i.set(e, t);
|
|
3161
3167
|
}
|
|
3162
|
-
|
|
3168
|
+
bt.set(e, n), xt.set(e, r), St.set(e, i);
|
|
3163
3169
|
}
|
|
3164
|
-
var
|
|
3170
|
+
var Ct = Object.freeze({
|
|
3165
3171
|
__proto__: null,
|
|
3166
3172
|
description: `removes unknown elements content and attributes, removes attrs with default values`,
|
|
3167
3173
|
fn: (e, t) => {
|
|
3168
|
-
let { unknownContent: n = !0, unknownAttrs: r = !0, defaultAttrs: i = !0, defaultMarkupDeclarations: a = !0, uselessOverrides: o = !0, keepDataAttrs: s = !0, keepAriaAttrs: c = !0, keepRoleAttr: l = !1 } = t, u =
|
|
3174
|
+
let { unknownContent: n = !0, unknownAttrs: r = !0, defaultAttrs: i = !0, defaultMarkupDeclarations: a = !0, uselessOverrides: o = !0, keepDataAttrs: s = !0, keepAriaAttrs: c = !0, keepRoleAttr: l = !1 } = t, u = P(e);
|
|
3169
3175
|
return {
|
|
3170
3176
|
instruction: { enter: (e) => {
|
|
3171
3177
|
a && (e.value = e.value.replace(/\s*standalone\s*=\s*(["'])no\1/, ``));
|
|
@@ -3174,52 +3180,52 @@ var l = e(((e) => {
|
|
|
3174
3180
|
if (e.name.includes(`:`)) return;
|
|
3175
3181
|
if (e.name === `foreignObject`) return S;
|
|
3176
3182
|
if (n && t.type === `element`) {
|
|
3177
|
-
let n =
|
|
3183
|
+
let n = bt.get(t.name);
|
|
3178
3184
|
if (n == null || n.size === 0) {
|
|
3179
|
-
if (
|
|
3180
|
-
|
|
3185
|
+
if (bt.get(e.name) == null) {
|
|
3186
|
+
k(e, t);
|
|
3181
3187
|
return;
|
|
3182
3188
|
}
|
|
3183
3189
|
} else if (n.has(e.name) === !1) {
|
|
3184
|
-
|
|
3190
|
+
k(e, t);
|
|
3185
3191
|
return;
|
|
3186
3192
|
}
|
|
3187
3193
|
}
|
|
3188
|
-
let a =
|
|
3194
|
+
let a = xt.get(e.name), d = St.get(e.name), f = t.type === `element` ? F(u, t) : null;
|
|
3189
3195
|
for (let [t, n] of Object.entries(e.attributes)) if (!(s && t.startsWith(`data-`)) && !(c && t.startsWith(`aria-`)) && !(l && t === `role`) && t !== `xmlns`) {
|
|
3190
3196
|
if (t.includes(`:`)) {
|
|
3191
3197
|
let [e] = t.split(`:`);
|
|
3192
3198
|
if (e !== `xml` && e !== `xlink`) continue;
|
|
3193
3199
|
}
|
|
3194
|
-
if (r && a && a.has(t) === !1 && delete e.attributes[t], i && e.attributes.id == null && d && d.get(t) === n && (f?.[t] != null || u.rules.some(((e) =>
|
|
3200
|
+
if (r && a && a.has(t) === !1 && delete e.attributes[t], i && e.attributes.id == null && d && d.get(t) === n && (f?.[t] != null || u.rules.some(((e) => Pe(e.selector, t))) || delete e.attributes[t]), o && e.attributes.id == null) {
|
|
3195
3201
|
let r = f?.[t];
|
|
3196
|
-
|
|
3202
|
+
Se.has(t) === !1 && r != null && r.type === `static` && r.value === n && delete e.attributes[t];
|
|
3197
3203
|
}
|
|
3198
3204
|
}
|
|
3199
3205
|
} }
|
|
3200
3206
|
};
|
|
3201
3207
|
},
|
|
3202
3208
|
name: `removeUnknownsAndDefaults`
|
|
3203
|
-
}),
|
|
3209
|
+
}), wt = Object.freeze({
|
|
3204
3210
|
__proto__: null,
|
|
3205
3211
|
description: `removes non-inheritable group's presentational attributes`,
|
|
3206
3212
|
fn: () => ({ element: { enter: (e) => {
|
|
3207
|
-
if (e.name === `g`) for (let t of Object.keys(e.attributes)) !
|
|
3213
|
+
if (e.name === `g`) for (let t of Object.keys(e.attributes)) !j.presentation.has(t) || N.has(t) || Se.has(t) || delete e.attributes[t];
|
|
3208
3214
|
} } }),
|
|
3209
3215
|
name: `removeNonInheritableGroupAttrs`
|
|
3210
|
-
}),
|
|
3216
|
+
}), Tt = Object.freeze({
|
|
3211
3217
|
__proto__: null,
|
|
3212
3218
|
description: `removes useless stroke and fill attributes`,
|
|
3213
3219
|
fn: (e, t) => {
|
|
3214
3220
|
let { stroke: n = !0, fill: r = !0, removeNone: i = !1 } = t, a = !1;
|
|
3215
3221
|
if (C(e, { element: { enter: (e) => {
|
|
3216
|
-
(e.name === `style` ||
|
|
3222
|
+
(e.name === `style` || $e(e)) && (a = !0);
|
|
3217
3223
|
} } }), a) return null;
|
|
3218
|
-
let o =
|
|
3224
|
+
let o = P(e);
|
|
3219
3225
|
return { element: { enter: (e, t) => {
|
|
3220
3226
|
if (e.attributes.id != null) return S;
|
|
3221
|
-
if (!
|
|
3222
|
-
let a =
|
|
3227
|
+
if (!A.shape.has(e.name)) return;
|
|
3228
|
+
let a = F(o, e), s = a.stroke, c = a[`stroke-opacity`], l = a[`stroke-width`], u = a[`marker-end`], d = a.fill, f = a[`fill-opacity`], p = t.type === `element` ? F(o, t) : null, m = p == null ? null : p.stroke;
|
|
3223
3229
|
if (n && (s == null || s.type === `static` && s.value == `none` || c != null && c.type === `static` && c.value === `0` || l != null && l.type === `static` && l.value === `0`) && (l != null && l.type === `static` && l.value === `0` || u == null)) {
|
|
3224
3230
|
for (let t of Object.keys(e.attributes)) t.startsWith(`stroke`) && delete e.attributes[t];
|
|
3225
3231
|
m != null && m.type === `static` && m.value !== `none` && (e.attributes.stroke = `none`);
|
|
@@ -3228,12 +3234,12 @@ var l = e(((e) => {
|
|
|
3228
3234
|
for (let t of Object.keys(e.attributes)) t.startsWith(`fill-`) && delete e.attributes[t];
|
|
3229
3235
|
(d == null || d.type === `static` && d.value !== `none`) && (e.attributes.fill = `none`);
|
|
3230
3236
|
}
|
|
3231
|
-
i && (s != null && e.attributes.stroke !== `none` || (d == null || d.type !== `static` || d.value !== `none`) && e.attributes.fill !== `none` ||
|
|
3237
|
+
i && (s != null && e.attributes.stroke !== `none` || (d == null || d.type !== `static` || d.value !== `none`) && e.attributes.fill !== `none` || k(e, t));
|
|
3232
3238
|
} } };
|
|
3233
3239
|
},
|
|
3234
3240
|
name: `removeUselessStrokeAndFill`
|
|
3235
3241
|
});
|
|
3236
|
-
let
|
|
3242
|
+
let Et = /^new\s0\s0\s([-+]?\d*\.?\d+([eE][-+]?\d+)?)\s([-+]?\d*\.?\d+([eE][-+]?\d+)?)$/, Dt = (e) => {
|
|
3237
3243
|
let t = !1;
|
|
3238
3244
|
return C(e, { element: { enter: (e) => {
|
|
3239
3245
|
e.name === `filter` && (t = !0);
|
|
@@ -3252,28 +3258,28 @@ var l = e(((e) => {
|
|
|
3252
3258
|
}
|
|
3253
3259
|
let i = e.attributes.width != null && e.attributes.height != null;
|
|
3254
3260
|
if ((e.name === `svg` || e.name === `mask` || e.name === `pattern`) && i) {
|
|
3255
|
-
let t = e.attributes[`enable-background`], i =
|
|
3261
|
+
let t = e.attributes[`enable-background`], i = Ot(t, e.name, e.attributes.width, e.attributes.height);
|
|
3256
3262
|
if (i ? e.attributes[`enable-background`] = i : delete e.attributes[`enable-background`], n?.type === `DeclarationList` && r) {
|
|
3257
|
-
let t =
|
|
3258
|
-
|
|
3263
|
+
let t = b.generate(r.data.value), i = Ot(t, e.name, e.attributes.width, e.attributes.height);
|
|
3264
|
+
i ? r.data.value = {
|
|
3259
3265
|
type: `Raw`,
|
|
3260
|
-
value:
|
|
3266
|
+
value: i
|
|
3261
3267
|
} : n.children.remove(r);
|
|
3262
3268
|
}
|
|
3263
3269
|
}
|
|
3264
3270
|
n?.type === `DeclarationList` && (n.children.isEmpty ? delete e.attributes.style : e.attributes.style = b.generate(n));
|
|
3265
3271
|
} } };
|
|
3266
|
-
},
|
|
3267
|
-
let i =
|
|
3272
|
+
}, Ot = (e, t, n, r) => {
|
|
3273
|
+
let i = Et.exec(e);
|
|
3268
3274
|
return i != null && n === i[1] && r === i[3] ? t === `svg` ? void 0 : `new` : e;
|
|
3269
3275
|
};
|
|
3270
|
-
var
|
|
3276
|
+
var kt = Object.freeze({
|
|
3271
3277
|
__proto__: null,
|
|
3272
3278
|
description: `remove or cleanup enable-background attribute when possible`,
|
|
3273
|
-
fn:
|
|
3279
|
+
fn: Dt,
|
|
3274
3280
|
name: `cleanupEnableBackground`
|
|
3275
3281
|
});
|
|
3276
|
-
let
|
|
3282
|
+
let At = {
|
|
3277
3283
|
M: 2,
|
|
3278
3284
|
m: 2,
|
|
3279
3285
|
Z: 0,
|
|
@@ -3294,11 +3300,11 @@ var l = e(((e) => {
|
|
|
3294
3300
|
t: 2,
|
|
3295
3301
|
A: 7,
|
|
3296
3302
|
a: 7
|
|
3297
|
-
},
|
|
3298
|
-
`,
|
|
3303
|
+
}, jt = (e) => e in At, Mt = (e) => e === ` ` || e === ` ` || e === `\r` || e === `
|
|
3304
|
+
`, Nt = (e) => {
|
|
3299
3305
|
let t = e.codePointAt(0);
|
|
3300
|
-
return t
|
|
3301
|
-
},
|
|
3306
|
+
return t != null && 48 <= t && t <= 57;
|
|
3307
|
+
}, Pt = (e, t) => {
|
|
3302
3308
|
let n = t, r = ``, i = `none`;
|
|
3303
3309
|
for (; n < e.length; n += 1) {
|
|
3304
3310
|
let t = e[n];
|
|
@@ -3312,7 +3318,7 @@ var l = e(((e) => {
|
|
|
3312
3318
|
continue;
|
|
3313
3319
|
}
|
|
3314
3320
|
}
|
|
3315
|
-
if (
|
|
3321
|
+
if (Nt(t)) {
|
|
3316
3322
|
if (i === `none` || i === `sign` || i === `whole`) {
|
|
3317
3323
|
i = `whole`, r += t;
|
|
3318
3324
|
continue;
|
|
@@ -3338,22 +3344,22 @@ var l = e(((e) => {
|
|
|
3338
3344
|
}
|
|
3339
3345
|
let a = Number.parseFloat(r);
|
|
3340
3346
|
return Number.isNaN(a) ? [t, null] : [n - 1, a];
|
|
3341
|
-
},
|
|
3347
|
+
}, Ft = (e) => {
|
|
3342
3348
|
let t = [], n = null, r = [], i = 0, a = !1, o = !1;
|
|
3343
3349
|
for (let s = 0; s < e.length; s += 1) {
|
|
3344
3350
|
let c = e.charAt(s);
|
|
3345
|
-
if (
|
|
3351
|
+
if (Mt(c)) continue;
|
|
3346
3352
|
if (a && c === `,`) {
|
|
3347
3353
|
if (o) break;
|
|
3348
3354
|
o = !0;
|
|
3349
3355
|
continue;
|
|
3350
3356
|
}
|
|
3351
|
-
if (
|
|
3357
|
+
if (jt(c)) {
|
|
3352
3358
|
if (o) return t;
|
|
3353
3359
|
if (n == null) {
|
|
3354
3360
|
if (c !== `M` && c !== `m`) return t;
|
|
3355
3361
|
} else if (r.length !== 0) return t;
|
|
3356
|
-
n = c, r = [], i =
|
|
3362
|
+
n = c, r = [], i = At[n], a = !1, i === 0 && t.push({
|
|
3357
3363
|
command: n,
|
|
3358
3364
|
args: r
|
|
3359
3365
|
});
|
|
@@ -3363,65 +3369,65 @@ var l = e(((e) => {
|
|
|
3363
3369
|
let l = s, u = null;
|
|
3364
3370
|
if (n === `A` || n === `a`) {
|
|
3365
3371
|
let t = r.length;
|
|
3366
|
-
t !== 0 && t !== 1
|
|
3367
|
-
} else [l, u] =
|
|
3372
|
+
t !== 0 && t !== 1 && t !== 2 && t !== 5 && t !== 6 || ([l, u] = Pt(e, s)), (t === 3 || t === 4) && (c === `0` && (u = 0), c === `1` && (u = 1));
|
|
3373
|
+
} else [l, u] = Pt(e, s);
|
|
3368
3374
|
if (u == null) return t;
|
|
3369
|
-
r.push(u), a = !0, o = !1, s = l, r.length === i && (t.push({
|
|
3375
|
+
r.push(u), a = !0, o = !1, s = l, r.length === i && ((n === `A` || n === `a`) && (r[0] = Math.abs(r[0]), r[1] = Math.abs(r[1])), t.push({
|
|
3370
3376
|
command: n,
|
|
3371
3377
|
args: r
|
|
3372
3378
|
}), n === `M` && (n = `L`), n === `m` && (n = `l`), r = []);
|
|
3373
3379
|
}
|
|
3374
3380
|
return t;
|
|
3375
|
-
},
|
|
3376
|
-
roundedStr:
|
|
3381
|
+
}, It = (e, t) => (t != null && (e = R(e, t)), {
|
|
3382
|
+
roundedStr: L(e),
|
|
3377
3383
|
rounded: e
|
|
3378
|
-
}),
|
|
3384
|
+
}), Lt = (e, t, n, r) => {
|
|
3379
3385
|
let i = ``, a;
|
|
3380
3386
|
for (let o = 0; o < t.length; o++) {
|
|
3381
|
-
let { roundedStr: s, rounded: c } =
|
|
3382
|
-
!r || e !== `A` && e !== `a` || o % 7 != 4 && o % 7 != 5 ? o === 0 || c < 0 ? i += s : Number.isInteger(a) ||
|
|
3387
|
+
let { roundedStr: s, rounded: c } = It(t[o], n);
|
|
3388
|
+
!r || e !== `A` && e !== `a` || o % 7 != 4 && o % 7 != 5 ? o === 0 || c < 0 ? i += s : Number.isInteger(a) || Nt(s[0]) ? i += ` ${s}` : i += s : i += s, a = c;
|
|
3383
3389
|
}
|
|
3384
3390
|
return i;
|
|
3385
|
-
},
|
|
3391
|
+
}, z = ({ pathData: e, precision: t, disableSpaceAfterFlags: n }) => {
|
|
3386
3392
|
if (e.length === 1) {
|
|
3387
3393
|
let { command: r, args: i } = e[0];
|
|
3388
|
-
return r +
|
|
3394
|
+
return r + Lt(r, i, t, n);
|
|
3389
3395
|
}
|
|
3390
3396
|
let r = ``, i = { ...e[0] };
|
|
3391
3397
|
e[1].command === `L` ? i.command = `M` : e[1].command === `l` && (i.command = `m`);
|
|
3392
3398
|
for (let a = 1; a < e.length; a++) {
|
|
3393
3399
|
let { command: o, args: s } = e[a];
|
|
3394
|
-
i.command === o && i.command !== `M` && i.command !== `m` || i.command === `M` && o === `L` || i.command === `m` && o === `l` ? (i.args = [...i.args, ...s], a === e.length - 1 && (r += i.command +
|
|
3400
|
+
i.command === o && i.command !== `M` && i.command !== `m` || i.command === `M` && o === `L` || i.command === `m` && o === `l` ? (i.args = [...i.args, ...s], a === e.length - 1 && (r += i.command + Lt(i.command, i.args, t, n))) : (r += i.command + Lt(i.command, i.args, t, n), a === e.length - 1 ? r += o + Lt(o, s, t, n) : i = {
|
|
3395
3401
|
command: o,
|
|
3396
3402
|
args: s
|
|
3397
3403
|
});
|
|
3398
3404
|
}
|
|
3399
3405
|
return r;
|
|
3400
|
-
},
|
|
3401
|
-
var
|
|
3406
|
+
}, Rt = A.nonRendering;
|
|
3407
|
+
var zt = Object.freeze({
|
|
3402
3408
|
__proto__: null,
|
|
3403
3409
|
description: `removes hidden elements (zero sized, with absent attributes)`,
|
|
3404
3410
|
fn: (e, t) => {
|
|
3405
|
-
let { isHidden: n = !0, displayNone: r = !0, opacity0: i = !0, circleR0: a = !0, ellipseRX0: o = !0, ellipseRY0: s = !0, rectWidth0: c = !0, rectHeight0: l = !0, patternWidth0: u = !0, patternHeight0: d = !0, imageWidth0: f = !0, imageHeight0: p = !0, pathEmptyD: m = !0, polylineEmptyPoints: h = !0, polygonEmptyPoints: g = !0 } = t, _ =
|
|
3406
|
-
function
|
|
3411
|
+
let { isHidden: n = !0, displayNone: r = !0, opacity0: i = !0, circleR0: a = !0, ellipseRX0: o = !0, ellipseRY0: s = !0, rectWidth0: c = !0, rectHeight0: l = !0, patternWidth0: u = !0, patternHeight0: d = !0, imageWidth0: f = !0, imageHeight0: p = !0, pathEmptyD: m = !0, polylineEmptyPoints: h = !0, polygonEmptyPoints: g = !0 } = t, _ = P(e), v = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map(), ee = !1;
|
|
3412
|
+
function T(e) {
|
|
3407
3413
|
if (x.has(e.attributes.id)) return !1;
|
|
3408
|
-
for (let t of e.children) if (t.type === `element` && !
|
|
3414
|
+
for (let t of e.children) if (t.type === `element` && !T(t)) return !1;
|
|
3409
3415
|
return !0;
|
|
3410
3416
|
}
|
|
3411
|
-
function
|
|
3412
|
-
e.type === `element` && e.attributes.id != null && t.type === `element` && t.name === `defs` && y.add(e.attributes.id),
|
|
3417
|
+
function E(e, t) {
|
|
3418
|
+
e.type === `element` && e.attributes.id != null && t.type === `element` && t.name === `defs` && y.add(e.attributes.id), k(e, t);
|
|
3413
3419
|
}
|
|
3414
3420
|
return C(e, { element: { enter: (e, t) => {
|
|
3415
|
-
if (
|
|
3416
|
-
let n =
|
|
3421
|
+
if (Rt.has(e.name)) return v.set(e, t), S;
|
|
3422
|
+
let n = F(_, e);
|
|
3417
3423
|
if (i && n.opacity && n.opacity.type === `static` && n.opacity.value === `0`) {
|
|
3418
3424
|
if (e.name === `path`) return v.set(e, t), S;
|
|
3419
|
-
|
|
3425
|
+
E(e, t);
|
|
3420
3426
|
}
|
|
3421
3427
|
} } }), {
|
|
3422
3428
|
element: { enter: (e, t) => {
|
|
3423
|
-
if (e.name === `style` && e.children.length !== 0 ||
|
|
3424
|
-
|
|
3429
|
+
if (e.name === `style` && e.children.length !== 0 || $e(e)) {
|
|
3430
|
+
ee = !0;
|
|
3425
3431
|
return;
|
|
3426
3432
|
}
|
|
3427
3433
|
if (e.name === `defs` && b.set(e, t), e.name === `use`) for (let n of Object.keys(e.attributes)) {
|
|
@@ -3433,102 +3439,102 @@ var l = e(((e) => {
|
|
|
3433
3439
|
});
|
|
3434
3440
|
}
|
|
3435
3441
|
if (a && e.name === `circle` && e.children.length === 0 && e.attributes.r === `0`) {
|
|
3436
|
-
|
|
3442
|
+
E(e, t);
|
|
3437
3443
|
return;
|
|
3438
3444
|
}
|
|
3439
3445
|
if (o && e.name === `ellipse` && e.children.length === 0 && e.attributes.rx === `0`) {
|
|
3440
|
-
|
|
3446
|
+
E(e, t);
|
|
3441
3447
|
return;
|
|
3442
3448
|
}
|
|
3443
3449
|
if (s && e.name === `ellipse` && e.children.length === 0 && e.attributes.ry === `0`) {
|
|
3444
|
-
|
|
3450
|
+
E(e, t);
|
|
3445
3451
|
return;
|
|
3446
3452
|
}
|
|
3447
3453
|
if (c && e.name === `rect` && e.children.length === 0 && e.attributes.width === `0`) {
|
|
3448
|
-
|
|
3454
|
+
E(e, t);
|
|
3449
3455
|
return;
|
|
3450
3456
|
}
|
|
3451
3457
|
if (l && c && e.name === `rect` && e.children.length === 0 && e.attributes.height === `0`) {
|
|
3452
|
-
|
|
3458
|
+
E(e, t);
|
|
3453
3459
|
return;
|
|
3454
3460
|
}
|
|
3455
3461
|
if (u && e.name === `pattern` && e.attributes.width === `0`) {
|
|
3456
|
-
|
|
3462
|
+
E(e, t);
|
|
3457
3463
|
return;
|
|
3458
3464
|
}
|
|
3459
3465
|
if (d && e.name === `pattern` && e.attributes.height === `0`) {
|
|
3460
|
-
|
|
3466
|
+
E(e, t);
|
|
3461
3467
|
return;
|
|
3462
3468
|
}
|
|
3463
3469
|
if (f && e.name === `image` && e.attributes.width === `0`) {
|
|
3464
|
-
|
|
3470
|
+
E(e, t);
|
|
3465
3471
|
return;
|
|
3466
3472
|
}
|
|
3467
3473
|
if (p && e.name === `image` && e.attributes.height === `0`) {
|
|
3468
|
-
|
|
3474
|
+
E(e, t);
|
|
3469
3475
|
return;
|
|
3470
3476
|
}
|
|
3471
3477
|
if (h && e.name === `polyline` && e.attributes.points == null) {
|
|
3472
|
-
|
|
3478
|
+
E(e, t);
|
|
3473
3479
|
return;
|
|
3474
3480
|
}
|
|
3475
3481
|
if (g && e.name === `polygon` && e.attributes.points == null) {
|
|
3476
|
-
|
|
3482
|
+
E(e, t);
|
|
3477
3483
|
return;
|
|
3478
3484
|
}
|
|
3479
|
-
let i =
|
|
3480
|
-
if (n && i.visibility && i.visibility.type === `static` && i.visibility.value === `hidden` &&
|
|
3481
|
-
|
|
3485
|
+
let i = F(_, e);
|
|
3486
|
+
if (n && i.visibility && i.visibility.type === `static` && i.visibility.value === `hidden` && ue(e, `[visibility=visible]`) == null) {
|
|
3487
|
+
E(e, t);
|
|
3482
3488
|
return;
|
|
3483
3489
|
}
|
|
3484
3490
|
if (r && i.display && i.display.type === `static` && i.display.value === `none` && e.name !== `marker`) {
|
|
3485
|
-
|
|
3491
|
+
E(e, t);
|
|
3486
3492
|
return;
|
|
3487
3493
|
}
|
|
3488
3494
|
if (m && e.name === `path`) {
|
|
3489
3495
|
if (e.attributes.d == null) {
|
|
3490
|
-
|
|
3496
|
+
E(e, t);
|
|
3491
3497
|
return;
|
|
3492
3498
|
}
|
|
3493
|
-
let n =
|
|
3499
|
+
let n = Ft(e.attributes.d);
|
|
3494
3500
|
if (n.length === 0) {
|
|
3495
|
-
|
|
3501
|
+
E(e, t);
|
|
3496
3502
|
return;
|
|
3497
3503
|
}
|
|
3498
3504
|
if (n.length === 1 && i[`marker-start`] == null && i[`marker-end`] == null) {
|
|
3499
|
-
|
|
3505
|
+
E(e, t);
|
|
3500
3506
|
return;
|
|
3501
3507
|
}
|
|
3502
3508
|
}
|
|
3503
3509
|
for (let [t, n] of Object.entries(e.attributes)) {
|
|
3504
|
-
let e =
|
|
3510
|
+
let e = nt(t, n);
|
|
3505
3511
|
for (let t of e) x.add(t);
|
|
3506
3512
|
}
|
|
3507
3513
|
} },
|
|
3508
3514
|
root: { exit: () => {
|
|
3509
3515
|
for (let e of y) {
|
|
3510
3516
|
let t = w.get(e);
|
|
3511
|
-
if (t) for (let { node: e, parentNode: n } of t)
|
|
3517
|
+
if (t) for (let { node: e, parentNode: n } of t) k(e, n);
|
|
3512
3518
|
}
|
|
3513
|
-
if (!
|
|
3514
|
-
for (let [e, t] of b.entries()) e.children.length === 0 &&
|
|
3519
|
+
if (!ee) for (let [e, t] of v.entries()) T(e) && k(e, t);
|
|
3520
|
+
for (let [e, t] of b.entries()) e.children.length === 0 && k(e, t);
|
|
3515
3521
|
} }
|
|
3516
3522
|
};
|
|
3517
3523
|
},
|
|
3518
3524
|
name: `removeHiddenElems`
|
|
3519
|
-
}),
|
|
3525
|
+
}), Bt = Object.freeze({
|
|
3520
3526
|
__proto__: null,
|
|
3521
3527
|
description: `removes empty <text> elements`,
|
|
3522
3528
|
fn: (e, t) => {
|
|
3523
3529
|
let { text: n = !0, tspan: r = !0, tref: i = !0 } = t;
|
|
3524
3530
|
return { element: { enter: (e, t) => {
|
|
3525
|
-
n && e.name === `text` && e.children.length === 0 &&
|
|
3531
|
+
n && e.name === `text` && e.children.length === 0 && k(e, t), r && e.name === `tspan` && e.children.length === 0 && k(e, t), i && e.name === `tref` && e.attributes[`xlink:href`] == null && k(e, t);
|
|
3526
3532
|
} } };
|
|
3527
3533
|
},
|
|
3528
3534
|
name: `removeEmptyText`
|
|
3529
3535
|
});
|
|
3530
|
-
let
|
|
3531
|
-
var
|
|
3536
|
+
let Vt = /[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g;
|
|
3537
|
+
var Ht = Object.freeze({
|
|
3532
3538
|
__proto__: null,
|
|
3533
3539
|
description: `converts basic shapes to more compact path form`,
|
|
3534
3540
|
fn: (e, t) => {
|
|
@@ -3559,7 +3565,7 @@ var l = e(((e) => {
|
|
|
3559
3565
|
args: []
|
|
3560
3566
|
}
|
|
3561
3567
|
];
|
|
3562
|
-
e.name = `path`, e.attributes.d =
|
|
3568
|
+
e.name = `path`, e.attributes.d = z({
|
|
3563
3569
|
pathData: o,
|
|
3564
3570
|
precision: r
|
|
3565
3571
|
}), delete e.attributes.x, delete e.attributes.y, delete e.attributes.width, delete e.attributes.height;
|
|
@@ -3574,15 +3580,15 @@ var l = e(((e) => {
|
|
|
3574
3580
|
command: `L`,
|
|
3575
3581
|
args: [i, a]
|
|
3576
3582
|
}];
|
|
3577
|
-
e.name = `path`, e.attributes.d =
|
|
3583
|
+
e.name = `path`, e.attributes.d = z({
|
|
3578
3584
|
pathData: o,
|
|
3579
3585
|
precision: r
|
|
3580
3586
|
}), delete e.attributes.x1, delete e.attributes.y1, delete e.attributes.x2, delete e.attributes.y2;
|
|
3581
3587
|
}
|
|
3582
3588
|
if ((e.name === `polyline` || e.name === `polygon`) && e.attributes.points != null) {
|
|
3583
|
-
let n = (e.attributes.points.match(
|
|
3589
|
+
let n = (e.attributes.points.match(Vt) || []).map(Number);
|
|
3584
3590
|
if (n.length < 4) {
|
|
3585
|
-
|
|
3591
|
+
k(e, t);
|
|
3586
3592
|
return;
|
|
3587
3593
|
}
|
|
3588
3594
|
let i = [];
|
|
@@ -3593,7 +3599,7 @@ var l = e(((e) => {
|
|
|
3593
3599
|
e.name === `polygon` && i.push({
|
|
3594
3600
|
command: `z`,
|
|
3595
3601
|
args: []
|
|
3596
|
-
}), e.name = `path`, e.attributes.d =
|
|
3602
|
+
}), e.name = `path`, e.attributes.d = z({
|
|
3597
3603
|
pathData: i,
|
|
3598
3604
|
precision: r
|
|
3599
3605
|
}), delete e.attributes.points;
|
|
@@ -3635,7 +3641,7 @@ var l = e(((e) => {
|
|
|
3635
3641
|
args: []
|
|
3636
3642
|
}
|
|
3637
3643
|
];
|
|
3638
|
-
e.name = `path`, e.attributes.d =
|
|
3644
|
+
e.name = `path`, e.attributes.d = z({
|
|
3639
3645
|
pathData: a,
|
|
3640
3646
|
precision: r
|
|
3641
3647
|
}), delete e.attributes.cx, delete e.attributes.cy, delete e.attributes.r;
|
|
@@ -3677,7 +3683,7 @@ var l = e(((e) => {
|
|
|
3677
3683
|
args: []
|
|
3678
3684
|
}
|
|
3679
3685
|
];
|
|
3680
|
-
e.name = `path`, e.attributes.d =
|
|
3686
|
+
e.name = `path`, e.attributes.d = z({
|
|
3681
3687
|
pathData: o,
|
|
3682
3688
|
precision: r
|
|
3683
3689
|
}), delete e.attributes.cx, delete e.attributes.cy, delete e.attributes.rx, delete e.attributes.ry;
|
|
@@ -3685,7 +3691,7 @@ var l = e(((e) => {
|
|
|
3685
3691
|
} } };
|
|
3686
3692
|
},
|
|
3687
3693
|
name: `convertShapeToPath`
|
|
3688
|
-
}),
|
|
3694
|
+
}), Ut = Object.freeze({
|
|
3689
3695
|
__proto__: null,
|
|
3690
3696
|
description: `converts non-eccentric <ellipse>s to <circle>s`,
|
|
3691
3697
|
fn: () => ({ element: { enter: (e) => {
|
|
@@ -3699,7 +3705,7 @@ var l = e(((e) => {
|
|
|
3699
3705
|
}
|
|
3700
3706
|
} } }),
|
|
3701
3707
|
name: `convertEllipseToCircle`
|
|
3702
|
-
}),
|
|
3708
|
+
}), Wt = Object.freeze({
|
|
3703
3709
|
__proto__: null,
|
|
3704
3710
|
description: `Move common attributes of group children to the group`,
|
|
3705
3711
|
fn: (e) => {
|
|
@@ -3709,9 +3715,9 @@ var l = e(((e) => {
|
|
|
3709
3715
|
} } }), { element: { exit: (e) => {
|
|
3710
3716
|
if (e.name !== `g` || e.children.length <= 1 || t) return;
|
|
3711
3717
|
let n = /* @__PURE__ */ new Map(), r = !0, i = !0;
|
|
3712
|
-
for (let t of e.children) if (t.type === `element`) if (
|
|
3718
|
+
for (let t of e.children) if (t.type === `element`) if (_e.has(t.name) || (i = !1), r) {
|
|
3713
3719
|
r = !1;
|
|
3714
|
-
for (let [e, r] of Object.entries(t.attributes))
|
|
3720
|
+
for (let [e, r] of Object.entries(t.attributes)) N.has(e) && n.set(e, r);
|
|
3715
3721
|
} else for (let [e, r] of n) t.attributes[e] !== r && n.delete(e);
|
|
3716
3722
|
e.attributes.filter == null && e.attributes[`clip-path`] == null && e.attributes.mask == null || n.delete(`transform`), i && n.delete(`transform`);
|
|
3717
3723
|
for (let [t, r] of n) t === `transform` ? e.attributes.transform == null ? e.attributes.transform = r : e.attributes.transform = `${e.attributes.transform} ${r}` : e.attributes[t] = r;
|
|
@@ -3720,16 +3726,16 @@ var l = e(((e) => {
|
|
|
3720
3726
|
},
|
|
3721
3727
|
name: `moveElemsAttrsToGroup`
|
|
3722
3728
|
});
|
|
3723
|
-
let
|
|
3724
|
-
...
|
|
3729
|
+
let Gt = [
|
|
3730
|
+
..._e,
|
|
3725
3731
|
`g`,
|
|
3726
3732
|
`text`
|
|
3727
3733
|
];
|
|
3728
|
-
var
|
|
3734
|
+
var Kt = Object.freeze({
|
|
3729
3735
|
__proto__: null,
|
|
3730
3736
|
description: `moves some group attributes to the content elements`,
|
|
3731
3737
|
fn: () => ({ element: { enter: (e) => {
|
|
3732
|
-
if (e.name === `g` && e.children.length !== 0 && e.attributes.transform != null && Object.entries(e.attributes).some((([e, t]) =>
|
|
3738
|
+
if (e.name === `g` && e.children.length !== 0 && e.attributes.transform != null && Object.entries(e.attributes).some((([e, t]) => M.has(e) && et(t))) === !1 && e.children.every(((e) => e.type === `element` && Gt.includes(e.name) && e.attributes.id == null))) {
|
|
3733
3739
|
for (let t of e.children) {
|
|
3734
3740
|
let n = e.attributes.transform;
|
|
3735
3741
|
t.type === `element` && (t.attributes.transform == null ? t.attributes.transform = n : t.attributes.transform = `${n} ${t.attributes.transform}`);
|
|
@@ -3739,36 +3745,36 @@ var l = e(((e) => {
|
|
|
3739
3745
|
} } }),
|
|
3740
3746
|
name: `moveGroupAttrsToElems`
|
|
3741
3747
|
});
|
|
3742
|
-
let
|
|
3748
|
+
let qt = (e, t) => {
|
|
3743
3749
|
if (e.type === `element`) {
|
|
3744
|
-
if (
|
|
3745
|
-
for (let n of e.children) if (
|
|
3750
|
+
if (A.animation.has(e.name) && e.attributes.attributeName === t) return !0;
|
|
3751
|
+
for (let n of e.children) if (qt(n, t)) return !0;
|
|
3746
3752
|
}
|
|
3747
3753
|
return !1;
|
|
3748
3754
|
};
|
|
3749
|
-
var
|
|
3755
|
+
var Jt = Object.freeze({
|
|
3750
3756
|
__proto__: null,
|
|
3751
3757
|
description: `collapses useless groups`,
|
|
3752
3758
|
fn: (e) => {
|
|
3753
|
-
let t =
|
|
3759
|
+
let t = P(e);
|
|
3754
3760
|
return { element: { exit: (e, n) => {
|
|
3755
|
-
if (
|
|
3761
|
+
if (n.type !== `root` && n.name !== `switch` && e.name === `g` && e.children.length !== 0) {
|
|
3756
3762
|
if (Object.keys(e.attributes).length !== 0 && e.children.length === 1) {
|
|
3757
|
-
let n = e.children[0], r = !!(e.attributes.filter ||
|
|
3763
|
+
let n = e.children[0], r = !!(e.attributes.filter || F(t, e).filter);
|
|
3758
3764
|
if (n.type === `element` && n.attributes.id == null && !r && (e.attributes.class == null || n.attributes.class == null) && (e.attributes[`clip-path`] == null && e.attributes.mask == null || n.name === `g` && e.attributes.transform == null && n.attributes.transform == null)) {
|
|
3759
3765
|
let t = { ...n.attributes };
|
|
3760
3766
|
for (let [r, i] of Object.entries(e.attributes)) {
|
|
3761
|
-
if (
|
|
3767
|
+
if (qt(n, r)) return;
|
|
3762
3768
|
if (t[r] == null) t[r] = i;
|
|
3763
3769
|
else if (r === `transform`) t[r] = i + ` ` + t[r];
|
|
3764
3770
|
else if (t[r] === `inherit`) t[r] = i;
|
|
3765
|
-
else if (!
|
|
3771
|
+
else if (!N.has(r) && t[r] !== i) return;
|
|
3766
3772
|
}
|
|
3767
3773
|
e.attributes = {}, n.attributes = t;
|
|
3768
3774
|
}
|
|
3769
3775
|
}
|
|
3770
3776
|
if (Object.keys(e.attributes).length === 0) {
|
|
3771
|
-
for (let t of e.children) if (t.type === `element` &&
|
|
3777
|
+
for (let t of e.children) if (t.type === `element` && A.animation.has(t.name)) return;
|
|
3772
3778
|
let t = n.children.indexOf(e);
|
|
3773
3779
|
n.children.splice(t, 1, ...e.children);
|
|
3774
3780
|
}
|
|
@@ -3777,22 +3783,22 @@ var l = e(((e) => {
|
|
|
3777
3783
|
},
|
|
3778
3784
|
name: `collapseGroups`
|
|
3779
3785
|
});
|
|
3780
|
-
let
|
|
3786
|
+
let B, Yt = (e) => {
|
|
3781
3787
|
if (e.pathJS) return e.pathJS;
|
|
3782
|
-
let t = [], n =
|
|
3788
|
+
let t = [], n = Ft(e.attributes.d);
|
|
3783
3789
|
for (let { command: e, args: r } of n) t.push({
|
|
3784
3790
|
command: e,
|
|
3785
3791
|
args: r
|
|
3786
3792
|
});
|
|
3787
3793
|
return t.length && t[0].command == `m` && (t[0].command = `M`), e.pathJS = t, t;
|
|
3788
|
-
},
|
|
3794
|
+
}, Xt = (e) => {
|
|
3789
3795
|
let t = [], n = [0, 0], r = [0, 0];
|
|
3790
3796
|
for (let { command: i, args: a } of e) a = a.slice(), i === `m` && (a[0] += r[0], a[1] += r[1], i = `M`), i === `M` && (r[0] = a[0], r[1] = a[1], n[0] = r[0], n[1] = r[1]), i === `h` && (a[0] += r[0], i = `H`), i === `H` && (r[0] = a[0]), i === `v` && (a[0] += r[1], i = `V`), i === `V` && (r[1] = a[0]), i === `l` && (a[0] += r[0], a[1] += r[1], i = `L`), i === `L` && (r[0] = a[0], r[1] = a[1]), i === `c` && (a[0] += r[0], a[1] += r[1], a[2] += r[0], a[3] += r[1], a[4] += r[0], a[5] += r[1], i = `C`), i === `C` && (r[0] = a[4], r[1] = a[5]), i === `s` && (a[0] += r[0], a[1] += r[1], a[2] += r[0], a[3] += r[1], i = `S`), i === `S` && (r[0] = a[2], r[1] = a[3]), i === `q` && (a[0] += r[0], a[1] += r[1], a[2] += r[0], a[3] += r[1], i = `Q`), i === `Q` && (r[0] = a[2], r[1] = a[3]), i === `t` && (a[0] += r[0], a[1] += r[1], i = `T`), i === `T` && (r[0] = a[0], r[1] = a[1]), i === `a` && (a[5] += r[0], a[6] += r[1], i = `A`), i === `A` && (r[0] = a[5], r[1] = a[6]), (i === `z` || i === `Z`) && (r[0] = n[0], r[1] = n[1], i = `z`), t.push({
|
|
3791
3797
|
command: i,
|
|
3792
3798
|
args: a
|
|
3793
3799
|
});
|
|
3794
3800
|
return t;
|
|
3795
|
-
},
|
|
3801
|
+
}, Zt = function(e, t, n) {
|
|
3796
3802
|
e.pathJS = t;
|
|
3797
3803
|
let r = [];
|
|
3798
3804
|
for (let e of t) {
|
|
@@ -3805,67 +3811,67 @@ var l = e(((e) => {
|
|
|
3805
3811
|
args: e.args
|
|
3806
3812
|
});
|
|
3807
3813
|
}
|
|
3808
|
-
e.attributes.d =
|
|
3814
|
+
e.attributes.d = z({
|
|
3809
3815
|
pathData: r,
|
|
3810
3816
|
precision: n.floatPrecision,
|
|
3811
3817
|
disableSpaceAfterFlags: n.noSpaceAfterFlags
|
|
3812
3818
|
});
|
|
3813
3819
|
};
|
|
3814
|
-
function
|
|
3820
|
+
function V(e, t) {
|
|
3815
3821
|
return e[0] = t[t.length - 2], e[1] = t[t.length - 1], e;
|
|
3816
3822
|
}
|
|
3817
|
-
let
|
|
3818
|
-
let n =
|
|
3823
|
+
let Qt = function(e, t) {
|
|
3824
|
+
let n = nn(Xt(e)), r = nn(Xt(t));
|
|
3819
3825
|
if (n.maxX <= r.minX || r.maxX <= n.minX || n.maxY <= r.minY || r.maxY <= n.minY || n.list.every(((e) => r.list.every(((t) => e.list[e.maxX][0] <= t.list[t.minX][0] || t.list[t.maxX][0] <= e.list[e.minX][0] || e.list[e.maxY][1] <= t.list[t.minY][1] || t.list[t.maxY][1] <= e.list[e.minY][1]))))) return !1;
|
|
3820
|
-
let i = n.list.map(
|
|
3826
|
+
let i = n.list.map(rn), a = r.list.map(rn);
|
|
3821
3827
|
return i.some((function(e) {
|
|
3822
3828
|
return e.list.length < 3 ? !1 : a.some((function(t) {
|
|
3823
3829
|
if (t.list.length < 3) return !1;
|
|
3824
|
-
let n = [o(e, t, [1, 0])], r =
|
|
3830
|
+
let n = [o(e, t, [1, 0])], r = H(n[0]), i = 1e4;
|
|
3825
3831
|
for (;;) {
|
|
3826
3832
|
if (i-- == 0) return console.error(`Error: infinite loop while processing mergePaths plugin.`), !0;
|
|
3827
|
-
if (n.push(o(e, t, r)),
|
|
3828
|
-
if (
|
|
3833
|
+
if (n.push(o(e, t, r)), U(r, n[n.length - 1]) <= 0) return !1;
|
|
3834
|
+
if ($t(n, r)) return !0;
|
|
3829
3835
|
}
|
|
3830
3836
|
}));
|
|
3831
3837
|
}));
|
|
3832
3838
|
function o(e, t, n) {
|
|
3833
|
-
return
|
|
3839
|
+
return en(s(e, n), s(t, H(n)));
|
|
3834
3840
|
}
|
|
3835
3841
|
function s(e, t) {
|
|
3836
3842
|
let n = t[1] >= 0 ? t[0] < 0 ? e.maxY : e.maxX : t[0] < 0 ? e.minX : e.minY, r = -Infinity, i;
|
|
3837
|
-
for (; (i =
|
|
3843
|
+
for (; (i = U(e.list[n], t)) > r;) r = i, n = ++n % e.list.length;
|
|
3838
3844
|
return e.list[(n || e.list.length) - 1];
|
|
3839
3845
|
}
|
|
3840
3846
|
};
|
|
3841
|
-
function
|
|
3847
|
+
function $t(e, t) {
|
|
3842
3848
|
if (e.length == 2) {
|
|
3843
|
-
let n = e[1], r = e[0], i =
|
|
3844
|
-
|
|
3849
|
+
let n = e[1], r = e[0], i = H(e[1]), a = en(r, n);
|
|
3850
|
+
U(i, a) > 0 ? V(t, tn(a, n)) : (V(t, i), e.shift());
|
|
3845
3851
|
} else {
|
|
3846
|
-
let n = e[2], r = e[1], i = e[0], a =
|
|
3847
|
-
if (
|
|
3852
|
+
let n = e[2], r = e[1], i = e[0], a = en(r, n), o = en(i, n), s = H(n), c = tn(a, o), l = tn(o, a);
|
|
3853
|
+
if (U(c, s) > 0) U(a, s) > 0 ? (V(t, c), e.shift()) : (V(t, s), e.splice(0, 2));
|
|
3848
3854
|
else {
|
|
3849
|
-
if (!(
|
|
3850
|
-
|
|
3855
|
+
if (!(U(l, s) > 0)) return !0;
|
|
3856
|
+
U(o, s) > 0 ? (V(t, l), e.splice(1, 1)) : (V(t, s), e.splice(0, 2));
|
|
3851
3857
|
}
|
|
3852
3858
|
}
|
|
3853
3859
|
return !1;
|
|
3854
3860
|
}
|
|
3855
|
-
function
|
|
3861
|
+
function H(e) {
|
|
3856
3862
|
return [-e[0], -e[1]];
|
|
3857
3863
|
}
|
|
3858
|
-
function
|
|
3864
|
+
function en(e, t) {
|
|
3859
3865
|
return [e[0] - t[0], e[1] - t[1]];
|
|
3860
3866
|
}
|
|
3861
|
-
function
|
|
3867
|
+
function U(e, t) {
|
|
3862
3868
|
return e[0] * t[0] + e[1] * t[1];
|
|
3863
3869
|
}
|
|
3864
|
-
function
|
|
3870
|
+
function tn(e, t) {
|
|
3865
3871
|
let n = [-e[1], e[0]];
|
|
3866
|
-
return
|
|
3872
|
+
return U(n, H(t)) < 0 ? H(n) : n;
|
|
3867
3873
|
}
|
|
3868
|
-
function
|
|
3874
|
+
function nn(e) {
|
|
3869
3875
|
let t = {
|
|
3870
3876
|
list: [],
|
|
3871
3877
|
minX: 0,
|
|
@@ -3900,40 +3906,38 @@ var l = e(((e) => {
|
|
|
3900
3906
|
c != null && n(o, [c[0], l[0]]);
|
|
3901
3907
|
break;
|
|
3902
3908
|
case `Q`:
|
|
3903
|
-
n(o, l.slice(0, 2)),
|
|
3909
|
+
n(o, l.slice(0, 2)), B = [l[2] - l[0], l[3] - l[1]];
|
|
3904
3910
|
break;
|
|
3905
3911
|
case `T`:
|
|
3906
|
-
c != null && s != null && (s.command == `Q` || s.command == `T`) && (u = [c[0] +
|
|
3912
|
+
c != null && s != null && (s.command == `Q` || s.command == `T`) && (u = [c[0] + B[0], c[1] + B[1]], n(o, u), B = [l[0] - u[0], l[1] - u[1]]);
|
|
3907
3913
|
break;
|
|
3908
3914
|
case `C`:
|
|
3909
|
-
c != null && n(o, [.5 * (c[0] + l[0]), .5 * (c[1] + l[1])]), n(o, [.5 * (l[0] + l[2]), .5 * (l[1] + l[3])]), n(o, [.5 * (l[2] + l[4]), .5 * (l[3] + l[5])]),
|
|
3915
|
+
c != null && n(o, [.5 * (c[0] + l[0]), .5 * (c[1] + l[1])]), n(o, [.5 * (l[0] + l[2]), .5 * (l[1] + l[3])]), n(o, [.5 * (l[2] + l[4]), .5 * (l[3] + l[5])]), B = [l[4] - l[2], l[5] - l[3]];
|
|
3910
3916
|
break;
|
|
3911
3917
|
case `S`:
|
|
3912
|
-
c != null && s != null && (s.command == `C` || s.command == `S`) && (n(o, [c[0] + .5 *
|
|
3913
|
-
break;
|
|
3914
|
-
case `A`:
|
|
3915
|
-
if (c != null) {
|
|
3916
|
-
let e = rn.apply(0, c.concat(l));
|
|
3917
|
-
for (var r; (r = e.splice(0, 6).map(d)).length;) c != null && n(o, [.5 * (c[0] + r[0]), .5 * (c[1] + r[1])]), n(o, [.5 * (r[0] + r[2]), .5 * (r[1] + r[3])]), n(o, [.5 * (r[2] + r[4]), .5 * (r[3] + r[5])]), e.length && n(o, c = r.slice(-2));
|
|
3918
|
-
}
|
|
3918
|
+
c != null && s != null && (s.command == `C` || s.command == `S`) && (n(o, [c[0] + .5 * B[0], c[1] + .5 * B[1]]), u = [c[0] + B[0], c[1] + B[1]]), u != null && n(o, [.5 * (u[0] + l[0]), .5 * (u[1] + l[1])]), n(o, [.5 * (l[0] + l[2]), .5 * (l[1] + l[3])]), B = [l[2] - l[0], l[3] - l[1]];
|
|
3919
3919
|
break;
|
|
3920
|
+
case `A`: if (c != null) {
|
|
3921
|
+
let e = on.apply(0, c.concat(l));
|
|
3922
|
+
for (var r; (r = e.splice(0, 6).map(d)).length;) c != null && n(o, [.5 * (c[0] + r[0]), .5 * (c[1] + r[1])]), n(o, [.5 * (r[0] + r[2]), .5 * (r[1] + r[3])]), n(o, [.5 * (r[2] + r[4]), .5 * (r[3] + r[5])]), e.length && n(o, c = r.slice(-2));
|
|
3923
|
+
}
|
|
3920
3924
|
}
|
|
3921
3925
|
l.length >= 2 && n(o, l.slice(-2));
|
|
3922
3926
|
}
|
|
3923
3927
|
return t;
|
|
3924
3928
|
}
|
|
3925
|
-
function
|
|
3929
|
+
function rn(e) {
|
|
3926
3930
|
e.list.sort((function(e, t) {
|
|
3927
3931
|
return e[0] == t[0] ? e[1] - t[1] : e[0] - t[0];
|
|
3928
3932
|
}));
|
|
3929
3933
|
let t = [], n = 0, r = 0;
|
|
3930
3934
|
for (let i = 0; i < e.list.length; i++) {
|
|
3931
|
-
for (; t.length >= 2 &&
|
|
3935
|
+
for (; t.length >= 2 && an(t[t.length - 2], t[t.length - 1], e.list[i]) <= 0;) t.pop();
|
|
3932
3936
|
e.list[i][1] < e.list[n][1] && (n = i, r = t.length), t.push(e.list[i]);
|
|
3933
3937
|
}
|
|
3934
3938
|
let i = [], a = e.list.length - 1, o = 0;
|
|
3935
3939
|
for (let t = e.list.length; t--;) {
|
|
3936
|
-
for (; i.length >= 2 &&
|
|
3940
|
+
for (; i.length >= 2 && an(i[i.length - 2], i[i.length - 1], e.list[t]) <= 0;) i.pop();
|
|
3937
3941
|
e.list[t][1] > e.list[a][1] && (a = t, o = i.length), i.push(e.list[t]);
|
|
3938
3942
|
}
|
|
3939
3943
|
i.pop(), t.pop();
|
|
@@ -3946,10 +3950,10 @@ var l = e(((e) => {
|
|
|
3946
3950
|
maxY: (t.length + o) % s.length
|
|
3947
3951
|
};
|
|
3948
3952
|
}
|
|
3949
|
-
function
|
|
3953
|
+
function an(e, t, n) {
|
|
3950
3954
|
return (t[0] - e[0]) * (n[1] - e[1]) - (t[1] - e[1]) * (n[0] - e[0]);
|
|
3951
3955
|
}
|
|
3952
|
-
let
|
|
3956
|
+
let on = (e, t, n, r, i, a, o, s, c, l) => {
|
|
3953
3957
|
let u = Math.PI * 120 / 180, d = Math.PI / 180 * (+i || 0), f = [], p = (e, t, n) => e * Math.cos(n) - t * Math.sin(n), m = (e, t, n) => e * Math.sin(n) + t * Math.cos(n);
|
|
3954
3958
|
if (l) _ = l[0], v = l[1], h = l[2], g = l[3];
|
|
3955
3959
|
else {
|
|
@@ -3963,7 +3967,7 @@ var l = e(((e) => {
|
|
|
3963
3967
|
let y = v - _;
|
|
3964
3968
|
if (Math.abs(y) > u) {
|
|
3965
3969
|
let e = v, t = s, a = c;
|
|
3966
|
-
v = _ + u * (o && v > _ ? 1 : -1), s = h + n * Math.cos(v), c = g + r * Math.sin(v), f =
|
|
3970
|
+
v = _ + u * (o && v > _ ? 1 : -1), s = h + n * Math.cos(v), c = g + r * Math.sin(v), f = on(s, c, n, r, i, 0, o, t, a, [
|
|
3967
3971
|
v,
|
|
3968
3972
|
e,
|
|
3969
3973
|
h,
|
|
@@ -3971,58 +3975,58 @@ var l = e(((e) => {
|
|
|
3971
3975
|
]);
|
|
3972
3976
|
}
|
|
3973
3977
|
y = v - _;
|
|
3974
|
-
let b = Math.cos(_), x = Math.sin(_), S = Math.cos(v), C = Math.sin(v), w = Math.tan(y / 4),
|
|
3975
|
-
-
|
|
3976
|
-
|
|
3977
|
-
s +
|
|
3978
|
-
c -
|
|
3978
|
+
let b = Math.cos(_), x = Math.sin(_), S = Math.cos(v), C = Math.sin(v), w = Math.tan(y / 4), ee = 4 / 3 * n * w, T = 4 / 3 * r * w, E = [
|
|
3979
|
+
-ee * x,
|
|
3980
|
+
T * b,
|
|
3981
|
+
s + ee * C - e,
|
|
3982
|
+
c - T * S - t,
|
|
3979
3983
|
s - e,
|
|
3980
3984
|
c - t
|
|
3981
3985
|
];
|
|
3982
|
-
if (l) return
|
|
3986
|
+
if (l) return E.concat(f);
|
|
3983
3987
|
{
|
|
3984
|
-
f =
|
|
3988
|
+
f = E.concat(f);
|
|
3985
3989
|
let e = [];
|
|
3986
3990
|
for (let t = 0, n = f.length; t < n; t++) e[t] = t % 2 ? m(f[t - 1], f[t], d) : p(f[t], f[t + 1], d);
|
|
3987
3991
|
return e;
|
|
3988
3992
|
}
|
|
3989
|
-
},
|
|
3993
|
+
}, sn = /* @__PURE__ */ new Set([
|
|
3990
3994
|
`matrix`,
|
|
3991
3995
|
`rotate`,
|
|
3992
3996
|
`scale`,
|
|
3993
3997
|
`skewX`,
|
|
3994
3998
|
`skewY`,
|
|
3995
3999
|
`translate`
|
|
3996
|
-
]),
|
|
4000
|
+
]), cn = /\s*(matrix|translate|scale|rotate|skewX|skewY)\s*\(\s*(.+?)\s*\)[\s,]*/, ln = /[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g, un = (e) => {
|
|
3997
4001
|
let t = [], n = null;
|
|
3998
|
-
for (let r of e.split(
|
|
4002
|
+
for (let r of e.split(cn)) if (r) if (sn.has(r)) n = {
|
|
3999
4003
|
name: r,
|
|
4000
4004
|
data: []
|
|
4001
4005
|
}, t.push(n);
|
|
4002
4006
|
else {
|
|
4003
4007
|
let e;
|
|
4004
|
-
for (; e =
|
|
4008
|
+
for (; e = ln.exec(r);) e = Number(e), n?.data.push(e);
|
|
4005
4009
|
}
|
|
4006
4010
|
return n == null || n.data.length == 0 ? [] : t;
|
|
4007
|
-
},
|
|
4008
|
-
let t = e.map(((e) => e.name === `matrix` ? e.data :
|
|
4011
|
+
}, dn = (e) => {
|
|
4012
|
+
let t = e.map(((e) => e.name === `matrix` ? e.data : bn(e)));
|
|
4009
4013
|
return {
|
|
4010
4014
|
name: `matrix`,
|
|
4011
|
-
data: t.length > 0 ? t.reduce(
|
|
4015
|
+
data: t.length > 0 ? t.reduce(Sn) : []
|
|
4012
4016
|
};
|
|
4013
|
-
},
|
|
4017
|
+
}, W = {
|
|
4014
4018
|
rad: (e) => e * Math.PI / 180,
|
|
4015
4019
|
deg: (e) => e * 180 / Math.PI,
|
|
4016
|
-
cos: (e) => Math.cos(
|
|
4017
|
-
acos: (e, t) =>
|
|
4018
|
-
sin: (e) => Math.sin(
|
|
4019
|
-
asin: (e, t) =>
|
|
4020
|
-
tan: (e) => Math.tan(
|
|
4021
|
-
atan: (e, t) =>
|
|
4022
|
-
},
|
|
4023
|
-
let t = [], n =
|
|
4020
|
+
cos: (e) => Math.cos(W.rad(e)),
|
|
4021
|
+
acos: (e, t) => R(W.deg(Math.acos(e)), t),
|
|
4022
|
+
sin: (e) => Math.sin(W.rad(e)),
|
|
4023
|
+
asin: (e, t) => R(W.deg(Math.asin(e)), t),
|
|
4024
|
+
tan: (e) => Math.tan(W.rad(e)),
|
|
4025
|
+
atan: (e, t) => R(W.deg(Math.atan(e)), t)
|
|
4026
|
+
}, fn = (e) => {
|
|
4027
|
+
let t = [], n = pn(e), r = mn(e);
|
|
4024
4028
|
return n && t.push(n), r && t.push(r), t;
|
|
4025
|
-
},
|
|
4029
|
+
}, pn = (e) => {
|
|
4026
4030
|
let [t, n, r, i, a, o] = e.data, s = t * i - n * r;
|
|
4027
4031
|
if (s === 0) return;
|
|
4028
4032
|
let c = Math.hypot(t, n);
|
|
@@ -4036,7 +4040,7 @@ var l = e(((e) => {
|
|
|
4036
4040
|
l.push({
|
|
4037
4041
|
name: `rotate`,
|
|
4038
4042
|
data: [
|
|
4039
|
-
|
|
4043
|
+
W.deg(n < 0 ? -e : e),
|
|
4040
4044
|
0,
|
|
4041
4045
|
0
|
|
4042
4046
|
]
|
|
@@ -4050,9 +4054,9 @@ var l = e(((e) => {
|
|
|
4050
4054
|
let p = t * r + n * i;
|
|
4051
4055
|
return p && l.push({
|
|
4052
4056
|
name: `skewX`,
|
|
4053
|
-
data: [
|
|
4057
|
+
data: [W.deg(Math.atan(p / (t * t + n * n)))]
|
|
4054
4058
|
}), l;
|
|
4055
|
-
},
|
|
4059
|
+
}, mn = (e) => {
|
|
4056
4060
|
let [t, n, r, i, a, o] = e.data, s = t * i - n * r;
|
|
4057
4061
|
if (s === 0) return;
|
|
4058
4062
|
let c = Math.hypot(r, i);
|
|
@@ -4066,7 +4070,7 @@ var l = e(((e) => {
|
|
|
4066
4070
|
l.push({
|
|
4067
4071
|
name: `rotate`,
|
|
4068
4072
|
data: [
|
|
4069
|
-
|
|
4073
|
+
W.deg(u),
|
|
4070
4074
|
0,
|
|
4071
4075
|
0
|
|
4072
4076
|
]
|
|
@@ -4079,10 +4083,10 @@ var l = e(((e) => {
|
|
|
4079
4083
|
let p = t * r + n * i;
|
|
4080
4084
|
return p && l.push({
|
|
4081
4085
|
name: `skewY`,
|
|
4082
|
-
data: [
|
|
4086
|
+
data: [W.deg(Math.atan(p / (r * r + i * i)))]
|
|
4083
4087
|
}), l;
|
|
4084
|
-
},
|
|
4085
|
-
let r =
|
|
4088
|
+
}, hn = (e, t, n) => {
|
|
4089
|
+
let r = W.rad(n), i = 1 - Math.cos(r), a = Math.sin(r), o = (i * t + a * e) / (i * i + a * a);
|
|
4086
4090
|
return {
|
|
4087
4091
|
name: `rotate`,
|
|
4088
4092
|
data: [
|
|
@@ -4091,7 +4095,7 @@ var l = e(((e) => {
|
|
|
4091
4095
|
o
|
|
4092
4096
|
]
|
|
4093
4097
|
};
|
|
4094
|
-
},
|
|
4098
|
+
}, gn = (e) => {
|
|
4095
4099
|
switch (e.name) {
|
|
4096
4100
|
case `rotate`:
|
|
4097
4101
|
case `skewX`:
|
|
@@ -4100,11 +4104,11 @@ var l = e(((e) => {
|
|
|
4100
4104
|
case `translate`: return e.data[0] === 0 && e.data[1] === 0;
|
|
4101
4105
|
}
|
|
4102
4106
|
return !1;
|
|
4103
|
-
},
|
|
4107
|
+
}, _n = (e, t) => {
|
|
4104
4108
|
let n = [];
|
|
4105
4109
|
for (let r = 0; r < e.length; r++) {
|
|
4106
4110
|
let i = e[r];
|
|
4107
|
-
if (
|
|
4111
|
+
if (gn(i)) continue;
|
|
4108
4112
|
let a = i.data;
|
|
4109
4113
|
switch (i.name) {
|
|
4110
4114
|
case `rotate`:
|
|
@@ -4113,7 +4117,7 @@ var l = e(((e) => {
|
|
|
4113
4117
|
case -180:
|
|
4114
4118
|
{
|
|
4115
4119
|
let t = e[r + 1];
|
|
4116
|
-
t && t.name === `scale` ? (n.push(
|
|
4120
|
+
t && t.name === `scale` ? (n.push(vn(t.data.map(((e) => -e)))), r++) : n.push({
|
|
4117
4121
|
name: `scale`,
|
|
4118
4122
|
data: [-1]
|
|
4119
4123
|
});
|
|
@@ -4126,7 +4130,7 @@ var l = e(((e) => {
|
|
|
4126
4130
|
});
|
|
4127
4131
|
break;
|
|
4128
4132
|
case `scale`:
|
|
4129
|
-
n.push(
|
|
4133
|
+
n.push(vn(a));
|
|
4130
4134
|
break;
|
|
4131
4135
|
case `skewX`:
|
|
4132
4136
|
case `skewY`:
|
|
@@ -4140,7 +4144,7 @@ var l = e(((e) => {
|
|
|
4140
4144
|
let i = e[r + 1];
|
|
4141
4145
|
if (i && i.name === `rotate` && i.data[0] !== 180 && i.data[0] !== -180 && i.data[0] !== 0 && i.data[1] === 0 && i.data[2] === 0) {
|
|
4142
4146
|
let e = t[r].data;
|
|
4143
|
-
n.push(
|
|
4147
|
+
n.push(hn(e[0], e[1], t[r + 1].data[0])), r++;
|
|
4144
4148
|
continue;
|
|
4145
4149
|
}
|
|
4146
4150
|
}
|
|
@@ -4148,27 +4152,29 @@ var l = e(((e) => {
|
|
|
4148
4152
|
name: `translate`,
|
|
4149
4153
|
data: a.slice(0, a[1] ? 2 : 1)
|
|
4150
4154
|
});
|
|
4151
|
-
break;
|
|
4152
4155
|
}
|
|
4153
4156
|
}
|
|
4154
4157
|
return n.length ? n : [{
|
|
4155
4158
|
name: `scale`,
|
|
4156
4159
|
data: [1]
|
|
4157
4160
|
}];
|
|
4158
|
-
},
|
|
4161
|
+
}, vn = (e) => ({
|
|
4159
4162
|
name: `scale`,
|
|
4160
4163
|
data: e.slice(0, e[0] === e[1] ? 1 : 2)
|
|
4161
|
-
}),
|
|
4162
|
-
let n =
|
|
4164
|
+
}), yn = (e, t) => {
|
|
4165
|
+
let n = fn(e), r, i = Number.MAX_VALUE;
|
|
4163
4166
|
for (let e of n) {
|
|
4164
|
-
let n =
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4167
|
+
let n = e.map(((e) => {
|
|
4168
|
+
let n = {
|
|
4169
|
+
name: e.name,
|
|
4170
|
+
data: [...e.data]
|
|
4171
|
+
};
|
|
4172
|
+
return Cn(n, t);
|
|
4173
|
+
})), a = _n(n, e), o = kn(a, t).length;
|
|
4174
|
+
o < i && (r = a, i = o);
|
|
4169
4175
|
}
|
|
4170
4176
|
return r ?? [e];
|
|
4171
|
-
},
|
|
4177
|
+
}, bn = (e) => {
|
|
4172
4178
|
if (e.name === `matrix`) return e.data;
|
|
4173
4179
|
switch (e.name) {
|
|
4174
4180
|
case `translate`: return [
|
|
@@ -4188,7 +4194,7 @@ var l = e(((e) => {
|
|
|
4188
4194
|
0
|
|
4189
4195
|
];
|
|
4190
4196
|
case `rotate`:
|
|
4191
|
-
var t =
|
|
4197
|
+
var t = W.cos(e.data[0]), n = W.sin(e.data[0]), r = e.data[1] || 0, i = e.data[2] || 0;
|
|
4192
4198
|
return [
|
|
4193
4199
|
t,
|
|
4194
4200
|
n,
|
|
@@ -4200,14 +4206,14 @@ var l = e(((e) => {
|
|
|
4200
4206
|
case `skewX`: return [
|
|
4201
4207
|
1,
|
|
4202
4208
|
0,
|
|
4203
|
-
|
|
4209
|
+
W.tan(e.data[0]),
|
|
4204
4210
|
1,
|
|
4205
4211
|
0,
|
|
4206
4212
|
0
|
|
4207
4213
|
];
|
|
4208
4214
|
case `skewY`: return [
|
|
4209
4215
|
1,
|
|
4210
|
-
|
|
4216
|
+
W.tan(e.data[0]),
|
|
4211
4217
|
0,
|
|
4212
4218
|
1,
|
|
4213
4219
|
0,
|
|
@@ -4215,156 +4221,155 @@ var l = e(((e) => {
|
|
|
4215
4221
|
];
|
|
4216
4222
|
default: throw Error(`Unknown transform ${e.name}`);
|
|
4217
4223
|
}
|
|
4218
|
-
},
|
|
4224
|
+
}, xn = (e, t, n) => {
|
|
4219
4225
|
let r = t[5] - e[0], i = t[6] - e[1], a = t[0], o = t[1], s = t[2] * Math.PI / 180, c = Math.cos(s), l = Math.sin(s);
|
|
4220
4226
|
if (a > 0 && o > 0) {
|
|
4221
4227
|
let e = (r * c + i * l) ** 2 / (4 * a * a) + (i * c - r * l) ** 2 / (4 * o * o);
|
|
4222
4228
|
e > 1 && (e = Math.sqrt(e), a *= e, o *= e);
|
|
4223
4229
|
}
|
|
4224
|
-
let u =
|
|
4230
|
+
let u = [
|
|
4225
4231
|
a * c,
|
|
4226
4232
|
a * l,
|
|
4227
4233
|
-o * l,
|
|
4228
4234
|
o * c,
|
|
4229
4235
|
0,
|
|
4230
4236
|
0
|
|
4231
|
-
]
|
|
4232
|
-
if (
|
|
4233
|
-
let e = (
|
|
4237
|
+
], d = Sn(n, u), f = d[2] * d[2] + d[3] * d[3], p = d[0] * d[0] + d[1] * d[1] + f, m = Math.hypot(d[0] - d[3], d[1] + d[2]) * Math.hypot(d[0] + d[3], d[1] - d[2]);
|
|
4238
|
+
if (m) {
|
|
4239
|
+
let e = (p + m) / 2, n = (p - m) / 2, r = Math.abs(e - f) > 1e-6, i = (r ? e : n) - f, a = d[0] * d[2] + d[1] * d[3], o = d[0] * i + d[2] * a, s = d[1] * i + d[3] * a;
|
|
4234
4240
|
t[0] = Math.sqrt(e), t[1] = Math.sqrt(n), t[2] = ((r ? s < 0 : o > 0) ? -1 : 1) * Math.acos((r ? o : s) / Math.hypot(o, s)) * 180 / Math.PI;
|
|
4235
|
-
} else t[0] = t[1] = Math.sqrt(
|
|
4241
|
+
} else t[0] = t[1] = Math.sqrt(p / 2), t[2] = 0;
|
|
4236
4242
|
return n[0] < 0 != n[3] < 0 && (t[4] = 1 - t[4]), t;
|
|
4237
|
-
},
|
|
4243
|
+
}, Sn = (e, t) => [
|
|
4238
4244
|
e[0] * t[0] + e[2] * t[1],
|
|
4239
4245
|
e[1] * t[0] + e[3] * t[1],
|
|
4240
4246
|
e[0] * t[2] + e[2] * t[3],
|
|
4241
4247
|
e[1] * t[2] + e[3] * t[3],
|
|
4242
4248
|
e[0] * t[4] + e[2] * t[5] + e[4],
|
|
4243
4249
|
e[1] * t[4] + e[3] * t[5] + e[5]
|
|
4244
|
-
],
|
|
4250
|
+
], Cn = (e, t) => {
|
|
4245
4251
|
switch (e.name) {
|
|
4246
4252
|
case `translate`:
|
|
4247
|
-
e.data =
|
|
4253
|
+
e.data = Tn(e.data, t);
|
|
4248
4254
|
break;
|
|
4249
4255
|
case `rotate`:
|
|
4250
|
-
e.data = [...
|
|
4256
|
+
e.data = [...wn(e.data.slice(0, 1), t), ...Tn(e.data.slice(1), t)];
|
|
4251
4257
|
break;
|
|
4252
4258
|
case `skewX`:
|
|
4253
4259
|
case `skewY`:
|
|
4254
|
-
e.data = Sn(e.data, t);
|
|
4255
|
-
break;
|
|
4256
|
-
case `scale`:
|
|
4257
4260
|
e.data = wn(e.data, t);
|
|
4258
4261
|
break;
|
|
4259
|
-
case `
|
|
4260
|
-
e.data =
|
|
4262
|
+
case `scale`:
|
|
4263
|
+
e.data = En(e.data, t);
|
|
4261
4264
|
break;
|
|
4265
|
+
case `matrix`: e.data = [...En(e.data.slice(0, 4), t), ...Tn(e.data.slice(4), t)];
|
|
4262
4266
|
}
|
|
4263
4267
|
return e;
|
|
4264
|
-
},
|
|
4265
|
-
for (let n = t.length, r = +(.1 ** e).toFixed(e); n--;) if (
|
|
4268
|
+
}, wn = (e, t) => t.degPrecision != null && t.degPrecision >= 1 && t.floatPrecision < 20 ? On(t.degPrecision, e) : Dn(e), Tn = (e, t) => t.floatPrecision >= 1 && t.floatPrecision < 20 ? On(t.floatPrecision, e) : Dn(e), En = (e, t) => t.transformPrecision >= 1 && t.floatPrecision < 20 ? On(t.transformPrecision, e) : Dn(e), Dn = (e) => e.map(Math.round), On = (e, t) => {
|
|
4269
|
+
for (let n = t.length, r = +(.1 ** e).toFixed(e); n--;) if (R(t[n], e) !== t[n]) {
|
|
4266
4270
|
let i = +t[n].toFixed(e - 1);
|
|
4267
4271
|
t[n] = +Math.abs(i - t[n]).toFixed(e + 1) >= r ? +t[n].toFixed(e) : i;
|
|
4268
4272
|
}
|
|
4269
4273
|
return t;
|
|
4270
|
-
},
|
|
4271
|
-
let n =
|
|
4274
|
+
}, kn = (e, t) => e.map(((e) => (Cn(e, t), `${e.name}(${I(e.data, t)})`))).join(``), An = /[-+]?(\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g, jn = (e, t) => {
|
|
4275
|
+
let n = P(e);
|
|
4272
4276
|
return { element: { enter: (e) => {
|
|
4273
|
-
if (e.attributes.d == null || e.attributes.id != null || e.attributes.transform == null || e.attributes.transform === `` || e.attributes.style != null || Object.entries(e.attributes).some((([e, t]) =>
|
|
4274
|
-
let r =
|
|
4277
|
+
if (e.attributes.d == null || e.attributes.id != null || e.attributes.transform == null || e.attributes.transform === `` || e.attributes.style != null || Object.entries(e.attributes).some((([e, t]) => M.has(e) && et(t)))) return;
|
|
4278
|
+
let r = F(n, e), i = r.transform;
|
|
4275
4279
|
if (i.type === `static` && i.value !== e.attributes.transform) return;
|
|
4276
|
-
let a =
|
|
4280
|
+
let a = dn(un(e.attributes.transform)), o = r.stroke?.type === `static` ? r.stroke.value : null, s = r[`stroke-width`]?.type === `static` ? r[`stroke-width`].value : null, c = t.transformPrecision;
|
|
4277
4281
|
if (r.stroke?.type === `dynamic` || r[`stroke-width`]?.type === `dynamic`) return;
|
|
4278
4282
|
let l = Number(Math.hypot(a.data[0], a.data[1]).toFixed(c));
|
|
4279
4283
|
if (o && o != `none`) {
|
|
4280
4284
|
if (!t.applyTransformsStroked || (a.data[0] !== a.data[3] || a.data[1] !== -a.data[2]) && (a.data[0] !== -a.data[3] || a.data[1] !== a.data[2])) return;
|
|
4281
|
-
l !== 1 && e.attributes[`vector-effect`] !== `non-scaling-stroke` && (e.attributes[`stroke-width`] = (s ||
|
|
4285
|
+
l !== 1 && e.attributes[`vector-effect`] !== `non-scaling-stroke` && (e.attributes[`stroke-width`] = (s || ve.presentation[`stroke-width`]).trim().replace(An, ((e) => L(Number(e) * l))), e.attributes[`stroke-dashoffset`] != null && (e.attributes[`stroke-dashoffset`] = e.attributes[`stroke-dashoffset`].trim().replace(An, ((e) => L(Number(e) * l)))), e.attributes[`stroke-dasharray`] != null && (e.attributes[`stroke-dasharray`] = e.attributes[`stroke-dasharray`].trim().replace(An, ((e) => L(Number(e) * l)))));
|
|
4282
4286
|
}
|
|
4283
|
-
|
|
4287
|
+
let u = Yt(e);
|
|
4288
|
+
Mn(u, a.data), delete e.attributes.transform;
|
|
4284
4289
|
} } };
|
|
4285
|
-
},
|
|
4290
|
+
}, G = (e, t, n) => [e[0] * t + e[2] * n + e[4], e[1] * t + e[3] * n + e[5]], K = (e, t, n) => [e[0] * t + e[2] * n, e[1] * t + e[3] * n], Mn = (e, t) => {
|
|
4286
4291
|
let n = [0, 0], r = [0, 0];
|
|
4287
4292
|
for (let i of e) {
|
|
4288
4293
|
let { command: e, args: a } = i;
|
|
4289
4294
|
if (e === `M`) {
|
|
4290
4295
|
r[0] = a[0], r[1] = a[1], n[0] = r[0], n[1] = r[1];
|
|
4291
|
-
let [e, i] =
|
|
4296
|
+
let [e, i] = G(t, a[0], a[1]);
|
|
4292
4297
|
a[0] = e, a[1] = i;
|
|
4293
4298
|
}
|
|
4294
4299
|
if (e === `m`) {
|
|
4295
4300
|
r[0] += a[0], r[1] += a[1], n[0] = r[0], n[1] = r[1];
|
|
4296
|
-
let [e, i] =
|
|
4301
|
+
let [e, i] = K(t, a[0], a[1]);
|
|
4297
4302
|
a[0] = e, a[1] = i;
|
|
4298
4303
|
}
|
|
4299
4304
|
if (e === `H` && (e = `L`, a = [a[0], r[1]]), e === `h` && (e = `l`, a = [a[0], 0]), e === `V` && (e = `L`, a = [r[0], a[0]]), e === `v` && (e = `l`, a = [0, a[0]]), e === `L`) {
|
|
4300
4305
|
r[0] = a[0], r[1] = a[1];
|
|
4301
|
-
let [e, n] =
|
|
4306
|
+
let [e, n] = G(t, a[0], a[1]);
|
|
4302
4307
|
a[0] = e, a[1] = n;
|
|
4303
4308
|
}
|
|
4304
4309
|
if (e === `l`) {
|
|
4305
4310
|
r[0] += a[0], r[1] += a[1];
|
|
4306
|
-
let [e, n] =
|
|
4311
|
+
let [e, n] = K(t, a[0], a[1]);
|
|
4307
4312
|
a[0] = e, a[1] = n;
|
|
4308
4313
|
}
|
|
4309
4314
|
if (e === `C`) {
|
|
4310
4315
|
r[0] = a[4], r[1] = a[5];
|
|
4311
|
-
let [e, n] =
|
|
4316
|
+
let [e, n] = G(t, a[0], a[1]), [i, o] = G(t, a[2], a[3]), [s, c] = G(t, a[4], a[5]);
|
|
4312
4317
|
a[0] = e, a[1] = n, a[2] = i, a[3] = o, a[4] = s, a[5] = c;
|
|
4313
4318
|
}
|
|
4314
4319
|
if (e === `c`) {
|
|
4315
4320
|
r[0] += a[4], r[1] += a[5];
|
|
4316
|
-
let [e, n] =
|
|
4321
|
+
let [e, n] = K(t, a[0], a[1]), [i, o] = K(t, a[2], a[3]), [s, c] = K(t, a[4], a[5]);
|
|
4317
4322
|
a[0] = e, a[1] = n, a[2] = i, a[3] = o, a[4] = s, a[5] = c;
|
|
4318
4323
|
}
|
|
4319
4324
|
if (e === `S`) {
|
|
4320
4325
|
r[0] = a[2], r[1] = a[3];
|
|
4321
|
-
let [e, n] =
|
|
4326
|
+
let [e, n] = G(t, a[0], a[1]), [i, o] = G(t, a[2], a[3]);
|
|
4322
4327
|
a[0] = e, a[1] = n, a[2] = i, a[3] = o;
|
|
4323
4328
|
}
|
|
4324
4329
|
if (e === `s`) {
|
|
4325
4330
|
r[0] += a[2], r[1] += a[3];
|
|
4326
|
-
let [e, n] =
|
|
4331
|
+
let [e, n] = K(t, a[0], a[1]), [i, o] = K(t, a[2], a[3]);
|
|
4327
4332
|
a[0] = e, a[1] = n, a[2] = i, a[3] = o;
|
|
4328
4333
|
}
|
|
4329
4334
|
if (e === `Q`) {
|
|
4330
4335
|
r[0] = a[2], r[1] = a[3];
|
|
4331
|
-
let [e, n] =
|
|
4336
|
+
let [e, n] = G(t, a[0], a[1]), [i, o] = G(t, a[2], a[3]);
|
|
4332
4337
|
a[0] = e, a[1] = n, a[2] = i, a[3] = o;
|
|
4333
4338
|
}
|
|
4334
4339
|
if (e === `q`) {
|
|
4335
4340
|
r[0] += a[2], r[1] += a[3];
|
|
4336
|
-
let [e, n] =
|
|
4341
|
+
let [e, n] = K(t, a[0], a[1]), [i, o] = K(t, a[2], a[3]);
|
|
4337
4342
|
a[0] = e, a[1] = n, a[2] = i, a[3] = o;
|
|
4338
4343
|
}
|
|
4339
4344
|
if (e === `T`) {
|
|
4340
4345
|
r[0] = a[0], r[1] = a[1];
|
|
4341
|
-
let [e, n] =
|
|
4346
|
+
let [e, n] = G(t, a[0], a[1]);
|
|
4342
4347
|
a[0] = e, a[1] = n;
|
|
4343
4348
|
}
|
|
4344
4349
|
if (e === `t`) {
|
|
4345
4350
|
r[0] += a[0], r[1] += a[1];
|
|
4346
|
-
let [e, n] =
|
|
4351
|
+
let [e, n] = K(t, a[0], a[1]);
|
|
4347
4352
|
a[0] = e, a[1] = n;
|
|
4348
4353
|
}
|
|
4349
4354
|
if (e === `A`) {
|
|
4350
|
-
if (
|
|
4355
|
+
if (xn(r, a, t), r[0] = a[5], r[1] = a[6], Math.abs(a[2]) > 80) {
|
|
4351
4356
|
let e = a[0], t = a[2];
|
|
4352
4357
|
a[0] = a[1], a[1] = e, a[2] = t + (t > 0 ? -90 : 90);
|
|
4353
4358
|
}
|
|
4354
|
-
let [e, n] =
|
|
4359
|
+
let [e, n] = G(t, a[5], a[6]);
|
|
4355
4360
|
a[5] = e, a[6] = n;
|
|
4356
4361
|
}
|
|
4357
4362
|
if (e === `a`) {
|
|
4358
|
-
if (
|
|
4363
|
+
if (xn([0, 0], a, t), r[0] += a[5], r[1] += a[6], Math.abs(a[2]) > 80) {
|
|
4359
4364
|
let e = a[0], t = a[2];
|
|
4360
4365
|
a[0] = a[1], a[1] = e, a[2] = t + (t > 0 ? -90 : 90);
|
|
4361
4366
|
}
|
|
4362
|
-
let [e, n] =
|
|
4367
|
+
let [e, n] = K(t, a[5], a[6]);
|
|
4363
4368
|
a[5] = e, a[6] = n;
|
|
4364
4369
|
}
|
|
4365
4370
|
(e === `z` || e === `Z`) && (r[0] = n[0], r[1] = n[1]), i.command = e, i.args = a;
|
|
4366
4371
|
}
|
|
4367
|
-
}, J, Y,
|
|
4372
|
+
}, q, J, Y, Nn, Pn, Fn = (e, t) => {
|
|
4368
4373
|
let { applyTransforms: n = !0, applyTransformsStroked: r = !0, makeArcs: i = {
|
|
4369
4374
|
threshold: 2.5,
|
|
4370
4375
|
tolerance: .5
|
|
@@ -4388,30 +4393,30 @@ var l = e(((e) => {
|
|
|
4388
4393
|
noSpaceAfterFlags: v,
|
|
4389
4394
|
forceAbsolutePath: y
|
|
4390
4395
|
};
|
|
4391
|
-
n && C(e,
|
|
4396
|
+
n && C(e, jn(e, {
|
|
4392
4397
|
transformPrecision: d,
|
|
4393
4398
|
applyTransformsStroked: r
|
|
4394
4399
|
}));
|
|
4395
|
-
let x =
|
|
4400
|
+
let x = P(e);
|
|
4396
4401
|
return { element: { enter: (e) => {
|
|
4397
|
-
if (
|
|
4398
|
-
let t =
|
|
4399
|
-
|
|
4400
|
-
let n = t[`marker-mid`] != null, r = t.stroke && (t.stroke.type === `dynamic` || t.stroke.value !== `none`), a = t[`stroke-linecap`] && (t[`stroke-linecap`].type === `dynamic` || t[`stroke-linecap`].value !== `butt`), o =
|
|
4402
|
+
if (_e.has(e.name) && e.attributes.d != null) {
|
|
4403
|
+
let t = F(x, e);
|
|
4404
|
+
J = u, Y = J === !1 ? .01 : +(.1 ** J).toFixed(J), q = J && J > 0 && J < 20 ? Vn : Hn, i && (Nn = i.threshold, Pn = i.tolerance);
|
|
4405
|
+
let n = t[`marker-mid`] != null, r = t.stroke && (t.stroke.type === `dynamic` || t.stroke.value !== `none`), a = t[`stroke-linecap`] && (t[`stroke-linecap`].type === `dynamic` || t[`stroke-linecap`].value !== `butt`), o = !r || t[`stroke-linecap`]?.type === `static` && t[`stroke-linecap`].value === `round` && t[`stroke-linejoin`]?.type === `static` && t[`stroke-linejoin`].value === `round`, s = (e, t) => r ? e ? !a : t : !0, c = Yt(e);
|
|
4401
4406
|
if (c.length) {
|
|
4402
4407
|
let t = c.some(((e) => e.command !== `m` && e.command !== `M`));
|
|
4403
|
-
|
|
4404
|
-
isSafeToUseZ:
|
|
4405
|
-
|
|
4408
|
+
In(c), c = Ln(c, b, {
|
|
4409
|
+
isSafeToUseZ: o,
|
|
4410
|
+
isSafeToRemove: s,
|
|
4406
4411
|
hasMarkerMid: n
|
|
4407
|
-
}), h && (c =
|
|
4412
|
+
}), h && (c = Rn(c, b)), (e.attributes[`marker-start`] != null || e.attributes[`marker-end`] != null) && t && c.every(((e) => e.command === `m` || e.command === `M`)) && c.push({
|
|
4408
4413
|
command: `z`,
|
|
4409
4414
|
args: []
|
|
4410
|
-
}),
|
|
4415
|
+
}), Zt(e, c, b);
|
|
4411
4416
|
}
|
|
4412
4417
|
}
|
|
4413
4418
|
} } };
|
|
4414
|
-
},
|
|
4419
|
+
}, In = (e) => {
|
|
4415
4420
|
let t = [0, 0], n = [0, 0], r = [0, 0];
|
|
4416
4421
|
for (let i = 0; i < e.length; i += 1) {
|
|
4417
4422
|
let a = e[i], { command: o, args: s } = a;
|
|
@@ -4419,8 +4424,8 @@ var l = e(((e) => {
|
|
|
4419
4424
|
}
|
|
4420
4425
|
return e;
|
|
4421
4426
|
};
|
|
4422
|
-
function
|
|
4423
|
-
let a =
|
|
4427
|
+
function Ln(e, t, { isSafeToUseZ: n, isSafeToRemove: r, hasMarkerMid: i }) {
|
|
4428
|
+
let a = Qn.bind(null, t), o = [0, 0], s = [0, 0], c = {}, l;
|
|
4424
4429
|
return e = e.filter((function(e, u, d) {
|
|
4425
4430
|
let f = l, p = e.command, m = e.args, h = d[u + 1];
|
|
4426
4431
|
if (p !== `Z` && p !== `z`) {
|
|
@@ -4430,8 +4435,8 @@ var l = e(((e) => {
|
|
|
4430
4435
|
let e = c.args, t = e.length;
|
|
4431
4436
|
l[0] = e[t - 2] - e[t - 4], l[1] = e[t - 1] - e[t - 3];
|
|
4432
4437
|
}
|
|
4433
|
-
if (t.makeArcs && (p == `c` || p == `s`) &&
|
|
4434
|
-
let t =
|
|
4438
|
+
if (t.makeArcs && (p == `c` || p == `s`) && zn(l) && (_ = Jn(l))) {
|
|
4439
|
+
let t = q([_.radius])[0], n = Zn(l, _), r = +(l[5] * l[0] - l[4] * l[1] > 0), i = {
|
|
4435
4440
|
command: `a`,
|
|
4436
4441
|
args: [
|
|
4437
4442
|
t,
|
|
@@ -4448,9 +4453,9 @@ var l = e(((e) => {
|
|
|
4448
4453
|
center: f,
|
|
4449
4454
|
radius: _.radius
|
|
4450
4455
|
}, y = [e], b = 0, x = ``, S;
|
|
4451
|
-
if (c.command == `c` &&
|
|
4456
|
+
if (c.command == `c` && zn(c.args) && Xn(c.args, _) || c.command == `a` && c.sdata && Xn(c.sdata, _)) {
|
|
4452
4457
|
y.unshift(c), i.base = c.base, i.args[5] = i.coords[0] - i.base[0], i.args[6] = i.coords[1] - i.base[1];
|
|
4453
|
-
let e = c.command == `a` ? c.sdata : c.args, t =
|
|
4458
|
+
let e = c.command == `a` ? c.sdata : c.args, t = Zn(e, {
|
|
4454
4459
|
center: [e[4] + _.center[0], e[5] + _.center[1]],
|
|
4455
4460
|
radius: _.radius
|
|
4456
4461
|
});
|
|
@@ -4458,10 +4463,10 @@ var l = e(((e) => {
|
|
|
4458
4463
|
}
|
|
4459
4464
|
for (var g = u; (h = d[++g]) && (h.command === `c` || h.command === `s`);) {
|
|
4460
4465
|
let e = h.args;
|
|
4461
|
-
if (h.command == `s` && (S =
|
|
4466
|
+
if (h.command == `s` && (S = X({
|
|
4462
4467
|
command: `s`,
|
|
4463
4468
|
args: h.args.slice()
|
|
4464
|
-
}, d[g - 1].args), e = S.args, S.args = e.slice(0, 2), x = a([S])), !
|
|
4469
|
+
}, d[g - 1].args), e = S.args, S.args = e.slice(0, 2), x = a([S])), !zn(e) || !Yn(e, v) || (n += Zn(e, v), n - 2 * Math.PI > .001)) break;
|
|
4465
4470
|
if (n > Math.PI && (i.args[3] = 1), y.push(h), !(2 * Math.PI - n > .001)) {
|
|
4466
4471
|
i.args[5] = 2 * (v.center[0] - e[4]), i.args[6] = 2 * (v.center[1] - e[5]), i.coords = [i.base[0] + i.args[5], i.base[1] + i.args[6]], i = {
|
|
4467
4472
|
command: `a`,
|
|
@@ -4482,61 +4487,61 @@ var l = e(((e) => {
|
|
|
4482
4487
|
i.coords = h.coords, i.args[5] = i.coords[0] - i.base[0], i.args[6] = i.coords[1] - i.base[1], f[0] -= e[4], f[1] -= e[5];
|
|
4483
4488
|
}
|
|
4484
4489
|
if ((a(s) + x).length < a(y).length) {
|
|
4485
|
-
if (d[g] && d[g].command == `s` &&
|
|
4490
|
+
if (d[g] && d[g].command == `s` && X(d[g], d[g - 1].args), b) {
|
|
4486
4491
|
let t = s.shift();
|
|
4487
|
-
|
|
4492
|
+
q(t.args), o[0] += t.args[5] - c.args[c.args.length - 2], o[1] += t.args[6] - c.args[c.args.length - 1], c.command = `a`, c.args = t.args, e.base = c.coords = t.coords;
|
|
4488
4493
|
}
|
|
4489
4494
|
if (i = s.shift(), y.length == 1 ? e.sdata = l.slice() : y.length - 1 - b > 0 && d.splice(u + 1, y.length - 1 - b, ...s), !i) return !1;
|
|
4490
4495
|
p = `a`, m = i.args, e.coords = i.coords;
|
|
4491
4496
|
}
|
|
4492
4497
|
}
|
|
4493
|
-
if (
|
|
4498
|
+
if (J !== !1) {
|
|
4494
4499
|
if (p === `m` || p === `l` || p === `t` || p === `q` || p === `s` || p === `c`) for (let t = m.length; t--;) m[t] += e.base[t % 2] - o[t % 2];
|
|
4495
4500
|
else p == `h` ? m[0] += e.base[0] - o[0] : p == `v` ? m[0] += e.base[1] - o[1] : p == `a` && (m[5] += e.base[0] - o[0], m[6] += e.base[1] - o[1]);
|
|
4496
|
-
|
|
4501
|
+
q(m), p == `h` ? o[0] += m[0] : p == `v` ? o[1] += m[0] : (o[0] += m[m.length - 2], o[1] += m[m.length - 1]), q(o), (p === `M` || p === `m`) && (s[0] = o[0], s[1] = o[1]);
|
|
4497
4502
|
}
|
|
4498
|
-
let v = p === `a` ?
|
|
4499
|
-
if (t.smartArcRounding && v !== void 0 &&
|
|
4500
|
-
let t =
|
|
4503
|
+
let v = p === `a` ? Wn(m) : void 0;
|
|
4504
|
+
if (t.smartArcRounding && v !== void 0 && J) for (let e = J; e >= 0; e--) {
|
|
4505
|
+
let t = R(m[0], e), n = Wn([
|
|
4501
4506
|
t,
|
|
4502
4507
|
t,
|
|
4503
4508
|
...m.slice(2)
|
|
4504
4509
|
]);
|
|
4505
|
-
if (!(Math.abs(v - n) <
|
|
4510
|
+
if (!(Math.abs(v - n) < Y)) break;
|
|
4506
4511
|
m[0] = t, m[1] = t;
|
|
4507
4512
|
}
|
|
4508
|
-
if (t.straightCurves && (p === `c` &&
|
|
4513
|
+
if (t.straightCurves && (p === `c` && Un(m) || p === `s` && Un(l) ? (h && h.command == `s` && X(h, m), p = `l`, m = m.slice(-2)) : p === `q` && Un(m) || p === `t` && c.command !== `q` && c.command !== `t` ? (p == `q` && h && h.command == `t` && X(h, m), p == `t` && h && h.command == `t` && (h.command = `q`, h.args.unshift(2 * e.coords[0] - e.base[0] - e.coords[0], 2 * e.coords[1] - e.base[1] - e.coords[1])), p = `l`, m = m.slice(-2)) : p === `a` && (m[0] === 0 || m[1] === 0 || v !== void 0 && v < Y) && (p = `l`, m = m.slice(-2))), t.convertToQ && p == `c`) {
|
|
4509
4514
|
let n = .75 * (e.base[0] + m[0]) - .25 * e.base[0], r = .75 * (e.base[0] + m[2]) - .25 * (e.base[0] + m[4]);
|
|
4510
|
-
if (Math.abs(n - r) <
|
|
4515
|
+
if (Math.abs(n - r) < Y * 2) {
|
|
4511
4516
|
let i = .75 * (e.base[1] + m[1]) - .25 * e.base[1], a = .75 * (e.base[1] + m[3]) - .25 * (e.base[1] + m[5]);
|
|
4512
|
-
if (Math.abs(i - a) <
|
|
4517
|
+
if (Math.abs(i - a) < Y * 2) {
|
|
4513
4518
|
let o = m.slice();
|
|
4514
|
-
o.splice(0, 4, n + r - e.base[0], i + a - e.base[1]),
|
|
4515
|
-
let s =
|
|
4516
|
-
|
|
4519
|
+
o.splice(0, 4, n + r - e.base[0], i + a - e.base[1]), q(o);
|
|
4520
|
+
let s = I(m, t).length;
|
|
4521
|
+
I(o, t).length < s && (p = `q`, m = o, h && h.command == `s` && X(h, m));
|
|
4517
4522
|
}
|
|
4518
4523
|
}
|
|
4519
4524
|
}
|
|
4520
4525
|
if (t.lineShorthands && p === `l` && (m[1] === 0 ? (p = `h`, m.pop()) : m[0] === 0 && (p = `v`, m.shift())), t.collapseRepeated && i === !1 && (p === `m` || p === `h` || p === `v`) && c.command && p == c.command.toLowerCase() && (p != `h` && p != `v` || c.args[0] >= 0 == m[0] >= 0)) return c.args[0] += m[0], p != `h` && p != `v` && (c.args[1] += m[1]), c.coords = e.coords, d[u] = c, !1;
|
|
4521
4526
|
if (t.curveSmoothShorthands && c.command) {
|
|
4522
|
-
if (p === `c`) (c.command === `c` && Math.abs(m[0] - -(c.args[2] - c.args[4])) <
|
|
4527
|
+
if (p === `c`) (c.command === `c` && Math.abs(m[0] - -(c.args[2] - c.args[4])) < Y && Math.abs(m[1] - -(c.args[3] - c.args[5])) < Y || c.command === `s` && Math.abs(m[0] - -(c.args[0] - c.args[2])) < Y && Math.abs(m[1] - -(c.args[1] - c.args[3])) < Y || c.command !== `c` && c.command !== `s` && Math.abs(m[0]) < Y && Math.abs(m[1]) < Y) && (p = `s`, m = m.slice(2));
|
|
4523
4528
|
else if (p === `q`) {
|
|
4524
|
-
if (c.command === `q` && Math.abs(m[0] - (c.args[2] - c.args[0])) <
|
|
4529
|
+
if (c.command === `q` && Math.abs(m[0] - (c.args[2] - c.args[0])) < Y && Math.abs(m[1] - (c.args[3] - c.args[1])) < Y) p = `t`, m = m.slice(2);
|
|
4525
4530
|
else if (c.command === `t`) {
|
|
4526
|
-
let t =
|
|
4527
|
-
Math.abs(t[0] - n[0]) <
|
|
4531
|
+
let t = Kn(f, e.base), n = [m[0] + e.base[0], m[1] + e.base[1]];
|
|
4532
|
+
Math.abs(t[0] - n[0]) < Y && Math.abs(t[1] - n[1]) < Y && (p = `t`, m = m.slice(2));
|
|
4528
4533
|
}
|
|
4529
4534
|
}
|
|
4530
4535
|
}
|
|
4531
|
-
if (t.removeUseless &&
|
|
4536
|
+
if (t.removeUseless && r(c.command == `m` || c.command == `M`, !0) && ((p === `l` || p === `h` || p === `v` || p === `q` || p === `t` || p === `c` || p === `s`) && m.every((function(e) {
|
|
4532
4537
|
return e === 0;
|
|
4533
4538
|
})) || p === `a` && m[5] === 0 && m[6] === 0)) return d[u] = c, !1;
|
|
4534
|
-
t.convertToZ && (n || h?.command === `Z` || h?.command === `z`) && (p === `l` || p === `h` || p === `v`) && Math.abs(s[0] - e.coords[0]) <
|
|
4539
|
+
t.convertToZ && (n || h?.command === `Z` || h?.command === `z`) && (p === `l` || p === `h` || p === `v`) && Math.abs(s[0] - e.coords[0]) < Y && Math.abs(s[1] - e.coords[1]) < Y && (p = `z`, m = []), e.command = p, e.args = m;
|
|
4535
4540
|
} else if (o[0] = s[0], o[1] = s[1], c.command === `Z` || c.command === `z`) return !1;
|
|
4536
|
-
return (p === `Z` || p === `z`) && t.removeUseless && n && Math.abs(e.base[0] - e.coords[0]) <
|
|
4541
|
+
return (p === `Z` || p === `z`) && t.removeUseless && r(c.command == `m` || c.command == `M`, n) && Math.abs(e.base[0] - e.coords[0]) < Y / 10 && Math.abs(e.base[1] - e.coords[1]) < Y / 10 ? !1 : (l = p === `q` ? [m[0] + e.base[0], m[1] + e.base[1]] : p === `t` ? f ? Kn(f, e.base) : e.coords : void 0, c = e, !0);
|
|
4537
4542
|
})), e;
|
|
4538
4543
|
}
|
|
4539
|
-
function
|
|
4544
|
+
function Rn(e, t) {
|
|
4540
4545
|
let n = e[0];
|
|
4541
4546
|
return e = e.filter((function(e, r) {
|
|
4542
4547
|
if (r == 0) return !0;
|
|
@@ -4544,13 +4549,13 @@ var l = e(((e) => {
|
|
|
4544
4549
|
let i = e.command, a = e.args, o = a.slice(), s = a.slice();
|
|
4545
4550
|
if (i === `m` || i === `l` || i === `t` || i === `q` || i === `s` || i === `c`) for (let t = o.length; t--;) o[t] += e.base[t % 2];
|
|
4546
4551
|
else i == `h` ? o[0] += e.base[0] : i == `v` ? o[0] += e.base[1] : i == `a` && (o[5] += e.base[0], o[6] += e.base[1]);
|
|
4547
|
-
|
|
4548
|
-
let c =
|
|
4552
|
+
q(o), q(s);
|
|
4553
|
+
let c = I(o, t), l = I(s, t);
|
|
4549
4554
|
return (t.forceAbsolutePath || c.length < l.length && !(t.negativeExtraSpace && i == n.command && n.command.charCodeAt(0) > 96 && c.length == l.length - 1 && (a[0] < 0 || Math.floor(a[0]) === 0 && !Number.isInteger(a[0]) && n.args[n.args.length - 1] % 1))) && (e.command = i.toUpperCase(), e.args = o), n = e, !0;
|
|
4550
4555
|
})), e;
|
|
4551
4556
|
}
|
|
4552
|
-
function
|
|
4553
|
-
let t =
|
|
4557
|
+
function zn(e) {
|
|
4558
|
+
let t = Bn([
|
|
4554
4559
|
0,
|
|
4555
4560
|
0,
|
|
4556
4561
|
e[2],
|
|
@@ -4562,63 +4567,61 @@ var l = e(((e) => {
|
|
|
4562
4567
|
]);
|
|
4563
4568
|
return t != null && e[2] < t[0] == t[0] < 0 && e[3] < t[1] == t[1] < 0 && e[4] < t[0] == t[0] < e[0] && e[5] < t[1] == t[1] < e[1];
|
|
4564
4569
|
}
|
|
4565
|
-
function
|
|
4570
|
+
function Bn(e) {
|
|
4566
4571
|
let t = e[1] - e[3], n = e[2] - e[0], r = e[0] * e[3] - e[2] * e[1], i = e[5] - e[7], a = e[6] - e[4], o = e[4] * e[7] - e[5] * e[6], s = t * a - i * n;
|
|
4567
4572
|
if (!s) return;
|
|
4568
4573
|
let c = [(n * o - a * r) / s, (t * o - i * r) / -s];
|
|
4569
4574
|
if (!isNaN(c[0]) && !isNaN(c[1]) && isFinite(c[0]) && isFinite(c[1])) return c;
|
|
4570
4575
|
}
|
|
4571
|
-
function
|
|
4572
|
-
let t =
|
|
4576
|
+
function Vn(e) {
|
|
4577
|
+
let t = J || 0;
|
|
4573
4578
|
for (let n = e.length; n-- > 0;) {
|
|
4574
|
-
let r =
|
|
4579
|
+
let r = R(e[n], t);
|
|
4575
4580
|
if (r !== e[n]) {
|
|
4576
|
-
let i =
|
|
4577
|
-
e[n] =
|
|
4581
|
+
let i = R(e[n], t - 1);
|
|
4582
|
+
e[n] = R(Math.abs(i - e[n]), t + 1) >= Y ? r : i;
|
|
4578
4583
|
}
|
|
4579
4584
|
}
|
|
4580
4585
|
return e;
|
|
4581
4586
|
}
|
|
4582
|
-
function
|
|
4587
|
+
function Hn(e) {
|
|
4583
4588
|
for (let t = e.length; t-- > 0;) e[t] = Math.round(e[t]);
|
|
4584
4589
|
return e;
|
|
4585
4590
|
}
|
|
4586
|
-
function
|
|
4591
|
+
function Un(e) {
|
|
4587
4592
|
let t = e.length - 2, n = -e[t + 1], r = e[t], i = 1 / (n * n + r * r);
|
|
4588
4593
|
if (t <= 1 || !isFinite(i)) return !1;
|
|
4589
|
-
for (; (t -= 2) >= 0;) if (Math.sqrt((n * e[t] + r * e[t + 1]) ** 2 * i) >
|
|
4594
|
+
for (; (t -= 2) >= 0;) if (Math.sqrt((n * e[t] + r * e[t + 1]) ** 2 * i) > Y) return !1;
|
|
4590
4595
|
return !0;
|
|
4591
4596
|
}
|
|
4592
|
-
function
|
|
4597
|
+
function Wn(e) {
|
|
4593
4598
|
if (e[3] === 1) return;
|
|
4594
4599
|
let [t, n] = e;
|
|
4595
|
-
if (Math.abs(t - n) >
|
|
4600
|
+
if (Math.abs(t - n) > Y) return;
|
|
4596
4601
|
let r = Math.hypot(e[5], e[6]);
|
|
4597
4602
|
if (!(r > t * 2)) return t - Math.sqrt(t ** 2 - .25 * r ** 2);
|
|
4598
4603
|
}
|
|
4599
|
-
function
|
|
4604
|
+
function X(e, t) {
|
|
4600
4605
|
switch (e.command) {
|
|
4601
4606
|
case `s`:
|
|
4602
4607
|
e.command = `c`;
|
|
4603
4608
|
break;
|
|
4604
|
-
case `t`:
|
|
4605
|
-
e.command = `q`;
|
|
4606
|
-
break;
|
|
4609
|
+
case `t`: e.command = `q`;
|
|
4607
4610
|
}
|
|
4608
4611
|
return e.args.unshift(t[t.length - 2] - t[t.length - 4], t[t.length - 1] - t[t.length - 3]), e;
|
|
4609
4612
|
}
|
|
4610
|
-
function
|
|
4613
|
+
function Gn(e, t) {
|
|
4611
4614
|
return Math.hypot(e[0] - t[0], e[1] - t[1]);
|
|
4612
4615
|
}
|
|
4613
|
-
function
|
|
4616
|
+
function Kn(e, t) {
|
|
4614
4617
|
return [2 * t[0] - e[0], 2 * t[1] - e[1]];
|
|
4615
4618
|
}
|
|
4616
|
-
function
|
|
4619
|
+
function qn(e, t) {
|
|
4617
4620
|
let n = t * t, r = n * t, i = 1 - t, a = i * i;
|
|
4618
4621
|
return [3 * a * t * e[0] + 3 * i * n * e[2] + r * e[4], 3 * a * t * e[1] + 3 * i * n * e[3] + r * e[5]];
|
|
4619
4622
|
}
|
|
4620
|
-
function
|
|
4621
|
-
let t =
|
|
4623
|
+
function Jn(e) {
|
|
4624
|
+
let t = qn(e, .5), n = [t[0] / 2, t[1] / 2], r = [(t[0] + e[4]) / 2, (t[1] + e[5]) / 2], i = Bn([
|
|
4622
4625
|
n[0],
|
|
4623
4626
|
n[1],
|
|
4624
4627
|
n[0] + n[1],
|
|
@@ -4627,16 +4630,16 @@ var l = e(((e) => {
|
|
|
4627
4630
|
r[1],
|
|
4628
4631
|
r[0] + (r[1] - t[1]),
|
|
4629
4632
|
r[1] - (r[0] - t[0])
|
|
4630
|
-
]), a = i &&
|
|
4633
|
+
]), a = i && Gn([0, 0], i), o = Math.min(Nn * Y, Pn * a / 100);
|
|
4631
4634
|
if (i && a < 0x38d7ea4c68000 && [1 / 4, 3 / 4].every((function(t) {
|
|
4632
|
-
return Math.abs(
|
|
4635
|
+
return Math.abs(Gn(qn(e, t), i) - a) <= o;
|
|
4633
4636
|
}))) return {
|
|
4634
4637
|
center: i,
|
|
4635
4638
|
radius: a
|
|
4636
4639
|
};
|
|
4637
4640
|
}
|
|
4638
|
-
function
|
|
4639
|
-
let n = Math.min(
|
|
4641
|
+
function Yn(e, t) {
|
|
4642
|
+
let n = Math.min(Nn * Y, Pn * t.radius / 100);
|
|
4640
4643
|
return [
|
|
4641
4644
|
0,
|
|
4642
4645
|
1 / 4,
|
|
@@ -4644,32 +4647,32 @@ var l = e(((e) => {
|
|
|
4644
4647
|
3 / 4,
|
|
4645
4648
|
1
|
|
4646
4649
|
].every((function(r) {
|
|
4647
|
-
return Math.abs(
|
|
4650
|
+
return Math.abs(Gn(qn(e, r), t.center) - t.radius) <= n;
|
|
4648
4651
|
}));
|
|
4649
4652
|
}
|
|
4650
|
-
function
|
|
4651
|
-
return
|
|
4653
|
+
function Xn(e, t) {
|
|
4654
|
+
return Yn(e, {
|
|
4652
4655
|
center: [t.center[0] + e[4], t.center[1] + e[5]],
|
|
4653
4656
|
radius: t.radius
|
|
4654
4657
|
});
|
|
4655
4658
|
}
|
|
4656
|
-
function
|
|
4659
|
+
function Zn(e, t) {
|
|
4657
4660
|
let n = -t.center[0], r = -t.center[1], i = e[4] - t.center[0], a = e[5] - t.center[1];
|
|
4658
4661
|
return Math.acos((n * i + r * a) / Math.sqrt((n * n + r * r) * (i * i + a * a)));
|
|
4659
4662
|
}
|
|
4660
|
-
function
|
|
4663
|
+
function Qn(e, t) {
|
|
4661
4664
|
return t.reduce((function(t, n) {
|
|
4662
4665
|
let r = ``;
|
|
4663
|
-
return n.args && (r =
|
|
4666
|
+
return n.args && (r = I(q(n.args.slice()), e)), t + n.command + r;
|
|
4664
4667
|
}), ``);
|
|
4665
4668
|
}
|
|
4666
|
-
var
|
|
4669
|
+
var $n = Object.freeze({
|
|
4667
4670
|
__proto__: null,
|
|
4668
4671
|
description: `optimizes path data: writes in shorter form, applies transformations`,
|
|
4669
|
-
fn:
|
|
4672
|
+
fn: Fn,
|
|
4670
4673
|
name: `convertPathData`
|
|
4671
4674
|
});
|
|
4672
|
-
let
|
|
4675
|
+
let er = (e, t) => {
|
|
4673
4676
|
let { convertToShorts: n = !0, degPrecision: r, floatPrecision: i = 3, transformPrecision: a = 5, matrixToTransform: o = !0, shortTranslate: s = !0, shortScale: c = !0, shortRotate: l = !0, removeUseless: u = !0, collapseIntoOne: d = !0, leadingZero: f = !0, negativeExtraSpace: p = !1 } = t, m = {
|
|
4674
4677
|
convertToShorts: n,
|
|
4675
4678
|
degPrecision: r,
|
|
@@ -4685,27 +4688,27 @@ var l = e(((e) => {
|
|
|
4685
4688
|
negativeExtraSpace: p
|
|
4686
4689
|
};
|
|
4687
4690
|
return { element: { enter: (e) => {
|
|
4688
|
-
e.attributes.transform != null &&
|
|
4691
|
+
e.attributes.transform != null && tr(e, `transform`, m), e.attributes.gradientTransform != null && tr(e, `gradientTransform`, m), e.attributes.patternTransform != null && tr(e, `patternTransform`, m);
|
|
4689
4692
|
} } };
|
|
4690
|
-
},
|
|
4691
|
-
let r =
|
|
4692
|
-
n =
|
|
4693
|
-
},
|
|
4693
|
+
}, tr = (e, t, n) => {
|
|
4694
|
+
let r = un(e.attributes[t]);
|
|
4695
|
+
n = nr(r, n), n.collapseIntoOne && r.length > 1 && (r = [dn(r)]), n.convertToShorts ? r = ir(r, n) : r.forEach(((e) => Cn(e, n))), n.removeUseless && (r = ar(r)), r.length ? e.attributes[t] = kn(r, n) : delete e.attributes[t];
|
|
4696
|
+
}, nr = (e, { ...t }) => {
|
|
4694
4697
|
let n = [];
|
|
4695
4698
|
for (let t of e) t.name == `matrix` && n.push(...t.data.slice(0, 4));
|
|
4696
4699
|
let r = t.transformPrecision;
|
|
4697
|
-
return n.length && (t.transformPrecision = Math.min(t.transformPrecision, Math.max.apply(Math, n.map(
|
|
4698
|
-
},
|
|
4700
|
+
return n.length && (t.transformPrecision = Math.min(t.transformPrecision, Math.max.apply(Math, n.map(rr)) || t.transformPrecision), r = Math.max.apply(Math, n.map(((e) => e.toString().replace(/\D+/g, ``).length)))), t.degPrecision ??= Math.max(0, Math.min(t.floatPrecision, r - 2)), t;
|
|
4701
|
+
}, rr = (e) => {
|
|
4699
4702
|
let t = e.toString();
|
|
4700
4703
|
return t.slice(t.indexOf(`.`)).length - 1;
|
|
4701
|
-
},
|
|
4704
|
+
}, ir = (e, t) => {
|
|
4702
4705
|
for (let n = 0; n < e.length; n++) {
|
|
4703
4706
|
let r = e[n];
|
|
4704
4707
|
if (t.matrixToTransform && r.name === `matrix`) {
|
|
4705
|
-
let i =
|
|
4706
|
-
|
|
4708
|
+
let i = yn(r, t);
|
|
4709
|
+
kn(i, t).length <= kn([r], t).length && e.splice(n, 1, ...i), r = e[n];
|
|
4707
4710
|
}
|
|
4708
|
-
|
|
4711
|
+
Cn(r, t), t.shortTranslate && r.name === `translate` && r.data.length === 2 && !r.data[1] && r.data.pop(), t.shortScale && r.name === `scale` && r.data.length === 2 && r.data[0] === r.data[1] && r.data.pop(), t.shortRotate && e[n - 2]?.name === `translate` && e[n - 1].name === `rotate` && e[n].name === `translate` && e[n - 2].data[0] === -e[n].data[0] && e[n - 2].data[1] === -e[n].data[1] && (e.splice(n - 2, 3, {
|
|
4709
4712
|
name: `rotate`,
|
|
4710
4713
|
data: [
|
|
4711
4714
|
e[n - 1].data[0],
|
|
@@ -4715,34 +4718,34 @@ var l = e(((e) => {
|
|
|
4715
4718
|
}), n -= 2);
|
|
4716
4719
|
}
|
|
4717
4720
|
return e;
|
|
4718
|
-
},
|
|
4721
|
+
}, ar = (e) => e.filter(((e) => !([
|
|
4719
4722
|
`translate`,
|
|
4720
4723
|
`rotate`,
|
|
4721
4724
|
`skewX`,
|
|
4722
4725
|
`skewY`
|
|
4723
4726
|
].indexOf(e.name) > -1 && (e.data.length == 1 || e.name == `rotate`) && !e.data[0] || e.name == `translate` && !e.data[0] && !e.data[1] || e.name == `scale` && e.data[0] == 1 && (e.data.length < 2 || e.data[1] == 1) || e.name == `matrix` && e.data[0] == 1 && e.data[3] == 1 && !(e.data[1] || e.data[2] || e.data[4] || e.data[5]))));
|
|
4724
|
-
var
|
|
4727
|
+
var or = Object.freeze({
|
|
4725
4728
|
__proto__: null,
|
|
4726
4729
|
description: `collapses multiple transformations and optimizes it`,
|
|
4727
|
-
fn:
|
|
4730
|
+
fn: er,
|
|
4728
4731
|
name: `convertTransform`
|
|
4729
|
-
}),
|
|
4732
|
+
}), sr = Object.freeze({
|
|
4730
4733
|
__proto__: null,
|
|
4731
4734
|
description: `removes empty attributes`,
|
|
4732
4735
|
fn: () => ({ element: { enter: (e) => {
|
|
4733
|
-
for (let [t, n] of Object.entries(e.attributes)) n !== `` ||
|
|
4736
|
+
for (let [t, n] of Object.entries(e.attributes)) n !== `` || j.conditionalProcessing.has(t) || delete e.attributes[t];
|
|
4734
4737
|
} } }),
|
|
4735
4738
|
name: `removeEmptyAttrs`
|
|
4736
|
-
}),
|
|
4739
|
+
}), cr = Object.freeze({
|
|
4737
4740
|
__proto__: null,
|
|
4738
4741
|
description: `removes empty container elements`,
|
|
4739
4742
|
fn: (e) => {
|
|
4740
|
-
let t =
|
|
4743
|
+
let t = P(e), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
4741
4744
|
return {
|
|
4742
4745
|
element: {
|
|
4743
4746
|
enter: (e, t) => {
|
|
4744
4747
|
if (e.name === `use`) for (let [n, i] of Object.entries(e.attributes)) {
|
|
4745
|
-
let a =
|
|
4748
|
+
let a = nt(n, i);
|
|
4746
4749
|
for (let n of a) {
|
|
4747
4750
|
let i = r.get(n);
|
|
4748
4751
|
i === void 0 && (i = [], r.set(n, i)), i.push({
|
|
@@ -4753,32 +4756,32 @@ var l = e(((e) => {
|
|
|
4753
4756
|
}
|
|
4754
4757
|
},
|
|
4755
4758
|
exit: (e, r) => {
|
|
4756
|
-
e.name === `svg` || !
|
|
4759
|
+
e.name === `svg` || !A.container.has(e.name) || e.children.length !== 0 || (e.name !== `pattern` || Object.keys(e.attributes).length === 0) && (e.name !== `mask` || e.attributes.id == null) && (r.type !== `element` || r.name !== `switch`) && (e.name === `g` && (e.attributes.filter != null || F(t, e).filter) || (k(e, r), e.attributes.id && n.add(e.attributes.id)));
|
|
4757
4760
|
}
|
|
4758
4761
|
},
|
|
4759
4762
|
root: { exit: () => {
|
|
4760
4763
|
for (let e of n) {
|
|
4761
4764
|
let t = r.get(e);
|
|
4762
|
-
if (t) for (let e of t)
|
|
4765
|
+
if (t) for (let e of t) k(e.node, e.parent);
|
|
4763
4766
|
}
|
|
4764
4767
|
} }
|
|
4765
4768
|
};
|
|
4766
4769
|
},
|
|
4767
4770
|
name: `removeEmptyContainers`
|
|
4768
4771
|
});
|
|
4769
|
-
function
|
|
4772
|
+
function lr(e, t) {
|
|
4770
4773
|
let n = e[t];
|
|
4771
|
-
return n?.type === `static`
|
|
4774
|
+
return n?.type === `static` && et(n.value);
|
|
4772
4775
|
}
|
|
4773
|
-
var
|
|
4776
|
+
var ur = Object.freeze({
|
|
4774
4777
|
__proto__: null,
|
|
4775
4778
|
description: `merges multiple paths in one if possible`,
|
|
4776
4779
|
fn: (e, t) => {
|
|
4777
|
-
let { force: n = !1, floatPrecision: r = 3, noSpaceAfterFlags: i = !1 } = t, a =
|
|
4780
|
+
let { force: n = !1, floatPrecision: r = 3, noSpaceAfterFlags: i = !1 } = t, a = P(e);
|
|
4778
4781
|
return { element: { enter: (e) => {
|
|
4779
4782
|
if (e.children.length <= 1) return;
|
|
4780
|
-
let t =
|
|
4781
|
-
|
|
4783
|
+
let t = /* @__PURE__ */ new Set(), o = e.children[0], s = null, c = (e, t) => {
|
|
4784
|
+
Zt(e, t, {
|
|
4782
4785
|
floatPrecision: r,
|
|
4783
4786
|
noSpaceAfterFlags: i
|
|
4784
4787
|
}), s = null;
|
|
@@ -4793,12 +4796,12 @@ var l = e(((e) => {
|
|
|
4793
4796
|
s && c(o, s), o = i;
|
|
4794
4797
|
continue;
|
|
4795
4798
|
}
|
|
4796
|
-
let l =
|
|
4799
|
+
let l = F(a, i);
|
|
4797
4800
|
if (l[`marker-start`] || l[`marker-mid`] || l[`marker-end`] || l[`clip-path`] || l.mask || l[`mask-image`] || [
|
|
4798
4801
|
`fill`,
|
|
4799
4802
|
`filter`,
|
|
4800
4803
|
`stroke`
|
|
4801
|
-
].some(((e) =>
|
|
4804
|
+
].some(((e) => lr(l, e)))) {
|
|
4802
4805
|
s && c(o, s), o = i;
|
|
4803
4806
|
continue;
|
|
4804
4807
|
}
|
|
@@ -4811,18 +4814,18 @@ var l = e(((e) => {
|
|
|
4811
4814
|
s && c(o, s), o = i;
|
|
4812
4815
|
continue;
|
|
4813
4816
|
}
|
|
4814
|
-
let d = s != null, f =
|
|
4815
|
-
if (s ??=
|
|
4816
|
-
s.push(...f), t.
|
|
4817
|
+
let d = s != null, f = Yt(i);
|
|
4818
|
+
if (s ??= Yt(o), n || !Qt(s, f)) {
|
|
4819
|
+
s.push(...f), t.add(i);
|
|
4817
4820
|
continue;
|
|
4818
4821
|
}
|
|
4819
4822
|
d && c(o, s), o = i, s = null;
|
|
4820
4823
|
}
|
|
4821
|
-
s && o.type === `element` && c(o, s), e.children = e.children.filter(((e) => !t.
|
|
4824
|
+
s && o.type === `element` && c(o, s), e.children = e.children.filter(((e) => !t.has(e)));
|
|
4822
4825
|
} } };
|
|
4823
4826
|
},
|
|
4824
4827
|
name: `mergePaths`
|
|
4825
|
-
}),
|
|
4828
|
+
}), dr = Object.freeze({
|
|
4826
4829
|
__proto__: null,
|
|
4827
4830
|
description: `removes unused namespaces declaration`,
|
|
4828
4831
|
fn: () => {
|
|
@@ -4852,7 +4855,7 @@ var l = e(((e) => {
|
|
|
4852
4855
|
} };
|
|
4853
4856
|
},
|
|
4854
4857
|
name: `removeUnusedNS`
|
|
4855
|
-
}),
|
|
4858
|
+
}), fr = Object.freeze({
|
|
4856
4859
|
__proto__: null,
|
|
4857
4860
|
description: `Sort element attributes for better compression`,
|
|
4858
4861
|
fn: (e, t) => {
|
|
@@ -4901,7 +4904,7 @@ var l = e(((e) => {
|
|
|
4901
4904
|
} } };
|
|
4902
4905
|
},
|
|
4903
4906
|
name: `sortAttrs`
|
|
4904
|
-
}),
|
|
4907
|
+
}), pr = Object.freeze({
|
|
4905
4908
|
__proto__: null,
|
|
4906
4909
|
description: `Sorts children of <defs> to improve compression`,
|
|
4907
4910
|
fn: () => ({ element: { enter: (e) => {
|
|
@@ -4925,58 +4928,58 @@ var l = e(((e) => {
|
|
|
4925
4928
|
} } }),
|
|
4926
4929
|
name: `sortDefsChildren`
|
|
4927
4930
|
});
|
|
4928
|
-
let
|
|
4929
|
-
var
|
|
4931
|
+
let mr = /^(Created with|Created using)/;
|
|
4932
|
+
var hr = Object.freeze({
|
|
4930
4933
|
__proto__: null,
|
|
4931
4934
|
description: `removes <desc>`,
|
|
4932
4935
|
fn: (e, t) => {
|
|
4933
4936
|
let { removeAny: n = !1 } = t;
|
|
4934
4937
|
return { element: { enter: (e, t) => {
|
|
4935
|
-
e.name === `desc` && (n || e.children.length === 0 || e.children[0].type === `text` &&
|
|
4938
|
+
e.name === `desc` && (n || e.children.length === 0 || e.children[0].type === `text` && mr.test(e.children[0].value)) && k(e, t);
|
|
4936
4939
|
} } };
|
|
4937
4940
|
},
|
|
4938
4941
|
name: `removeDesc`
|
|
4939
4942
|
});
|
|
4940
|
-
let
|
|
4943
|
+
let gr = ee({
|
|
4941
4944
|
name: `preset-default`,
|
|
4942
4945
|
plugins: [
|
|
4943
|
-
de,
|
|
4944
4946
|
fe,
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
+
pe,
|
|
4948
|
+
he,
|
|
4947
4949
|
Re,
|
|
4948
4950
|
ze,
|
|
4949
|
-
|
|
4951
|
+
Be,
|
|
4950
4952
|
We,
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
St,
|
|
4953
|
+
Ge,
|
|
4954
|
+
qe,
|
|
4955
|
+
rt,
|
|
4956
|
+
lt,
|
|
4957
|
+
ft,
|
|
4958
|
+
ht,
|
|
4959
|
+
yt,
|
|
4959
4960
|
Ct,
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4961
|
+
wt,
|
|
4962
|
+
Tt,
|
|
4963
|
+
kt,
|
|
4964
|
+
zt,
|
|
4963
4965
|
Bt,
|
|
4964
|
-
Vt,
|
|
4965
4966
|
Ht,
|
|
4967
|
+
Ut,
|
|
4966
4968
|
Wt,
|
|
4967
4969
|
Kt,
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
ar,
|
|
4970
|
+
Jt,
|
|
4971
|
+
$n,
|
|
4971
4972
|
or,
|
|
4973
|
+
sr,
|
|
4972
4974
|
cr,
|
|
4973
|
-
lr,
|
|
4974
4975
|
ur,
|
|
4975
4976
|
dr,
|
|
4976
|
-
|
|
4977
|
+
fr,
|
|
4978
|
+
pr,
|
|
4979
|
+
hr
|
|
4977
4980
|
]
|
|
4978
4981
|
});
|
|
4979
|
-
var
|
|
4982
|
+
var _r = Object.freeze({
|
|
4980
4983
|
__proto__: null,
|
|
4981
4984
|
description: `adds attributes to an outer <svg> element`,
|
|
4982
4985
|
fn: (e, t) => {
|
|
@@ -5026,7 +5029,7 @@ plugins: [
|
|
|
5026
5029
|
} } };
|
|
5027
5030
|
},
|
|
5028
5031
|
name: `addAttributesToSVGElement`
|
|
5029
|
-
}),
|
|
5032
|
+
}), vr = Object.freeze({
|
|
5030
5033
|
__proto__: null,
|
|
5031
5034
|
description: `adds classnames to an outer <svg> element`,
|
|
5032
5035
|
fn: (e, t, n) => {
|
|
@@ -5066,7 +5069,7 @@ plugins: [
|
|
|
5066
5069
|
},
|
|
5067
5070
|
name: `addClassesToSVGElement`
|
|
5068
5071
|
});
|
|
5069
|
-
let
|
|
5072
|
+
let yr = /^([-+]?\d*\.?\d+([eE][-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/, br = /\s+,?\s*|,\s*/, xr = {
|
|
5070
5073
|
cm: 96 / 2.54,
|
|
5071
5074
|
mm: 96 / 25.4,
|
|
5072
5075
|
in: 96,
|
|
@@ -5074,22 +5077,22 @@ plugins: [
|
|
|
5074
5077
|
pc: 16,
|
|
5075
5078
|
px: 1
|
|
5076
5079
|
};
|
|
5077
|
-
var
|
|
5080
|
+
var Sr = Object.freeze({
|
|
5078
5081
|
__proto__: null,
|
|
5079
5082
|
description: `rounds list of values to the fixed precision`,
|
|
5080
5083
|
fn: (e, t) => {
|
|
5081
5084
|
let { floatPrecision: n = 3, leadingZero: r = !0, defaultPx: i = !0, convertToPx: a = !0 } = t, o = (e) => {
|
|
5082
5085
|
let t = [];
|
|
5083
|
-
for (let o of e.split(
|
|
5084
|
-
let e = o.match(
|
|
5086
|
+
for (let o of e.split(br)) {
|
|
5087
|
+
let e = o.match(yr), s = o.match(/new/);
|
|
5085
5088
|
if (e) {
|
|
5086
5089
|
let o = Number(Number(e[1]).toFixed(n)), s = e[3] || ``;
|
|
5087
|
-
if (a && s && s in
|
|
5088
|
-
let t = Number((
|
|
5090
|
+
if (a && s && s in xr) {
|
|
5091
|
+
let t = Number((xr[s] * Number(e[1])).toFixed(n));
|
|
5089
5092
|
t.toString().length < e[0].length && (o = t, s = `px`);
|
|
5090
5093
|
}
|
|
5091
5094
|
let c;
|
|
5092
|
-
c = r ?
|
|
5095
|
+
c = r ? L(o) : o.toString(), i && s === `px` && (s = ``), t.push(c + s);
|
|
5093
5096
|
} else s ? t.push(`new`) : o && t.push(o);
|
|
5094
5097
|
}
|
|
5095
5098
|
return t.join(` `);
|
|
@@ -5099,11 +5102,11 @@ plugins: [
|
|
|
5099
5102
|
} } };
|
|
5100
5103
|
},
|
|
5101
5104
|
name: `cleanupListOfValues`
|
|
5102
|
-
}),
|
|
5105
|
+
}), Cr = Object.freeze({
|
|
5103
5106
|
__proto__: null,
|
|
5104
5107
|
description: `converts one-stop (single color) gradients to a plain color`,
|
|
5105
5108
|
fn: (e) => {
|
|
5106
|
-
let t =
|
|
5109
|
+
let t = P(e), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = 0;
|
|
5107
5110
|
return { element: {
|
|
5108
5111
|
enter: (o, s) => {
|
|
5109
5112
|
if (o.attributes[`xlink:href`] != null && a++, o.name === `defs`) {
|
|
@@ -5111,7 +5114,7 @@ plugins: [
|
|
|
5111
5114
|
return;
|
|
5112
5115
|
}
|
|
5113
5116
|
if (o.name !== `linearGradient` && o.name !== `radialGradient`) return;
|
|
5114
|
-
let c = o.children.filter(((e) => e.type === `element` && e.name === `stop`)), l = o.attributes[`xlink:href`] || o.attributes.href, u = c.length === 0 && l != null && l.startsWith(`#`) ?
|
|
5117
|
+
let c = o.children.filter(((e) => e.type === `element` && e.name === `stop`)), l = o.attributes[`xlink:href`] || o.attributes.href, u = c.length === 0 && l != null && l.startsWith(`#`) ? ue(e, l) : o;
|
|
5115
5118
|
if (u == null || u.type !== `element`) {
|
|
5116
5119
|
i.set(o, s);
|
|
5117
5120
|
return;
|
|
@@ -5119,39 +5122,39 @@ plugins: [
|
|
|
5119
5122
|
let d = u.children.filter(((e) => e.type === `element` && e.name === `stop`));
|
|
5120
5123
|
if (d.length !== 1 || d[0].type !== `element`) return;
|
|
5121
5124
|
s.type === `element` && s.name === `defs` && n.add(s), i.set(o, s);
|
|
5122
|
-
let f, p =
|
|
5125
|
+
let f, p = F(t, d[0])[`stop-color`];
|
|
5123
5126
|
p != null && p.type === `static` && (f = p.value);
|
|
5124
|
-
let m = `url(#${o.attributes.id})`, h =
|
|
5125
|
-
for (let e of
|
|
5126
|
-
let
|
|
5127
|
-
for (let e of
|
|
5127
|
+
let m = `url(#${o.attributes.id})`, h = [...Te].map(((e) => `[${e}="${m}"]`)).join(`,`), g = O(e, h);
|
|
5128
|
+
for (let e of g) if (e.type === `element`) for (let t of Te) e.attributes[t] === m && (f == null ? delete e.attributes[t] : e.attributes[t] = f);
|
|
5129
|
+
let _ = O(e, `[style*=${m}]`);
|
|
5130
|
+
for (let e of _) e.type === `element` && (e.attributes.style = e.attributes.style.replace(m, f || ve.presentation[`stop-color`]));
|
|
5128
5131
|
},
|
|
5129
5132
|
exit: (e) => {
|
|
5130
5133
|
if (e.name === `svg`) {
|
|
5131
|
-
for (let [e, t] of i.entries()) e.attributes[`xlink:href`] != null && a--,
|
|
5134
|
+
for (let [e, t] of i.entries()) e.attributes[`xlink:href`] != null && a--, k(e, t);
|
|
5132
5135
|
a === 0 && delete e.attributes[`xmlns:xlink`];
|
|
5133
|
-
for (let [e, t] of r.entries()) n.has(e) && e.children.length === 0 &&
|
|
5136
|
+
for (let [e, t] of r.entries()) n.has(e) && e.children.length === 0 && k(e, t);
|
|
5134
5137
|
}
|
|
5135
5138
|
}
|
|
5136
5139
|
} };
|
|
5137
5140
|
},
|
|
5138
5141
|
name: `convertOneStopGradients`
|
|
5139
5142
|
});
|
|
5140
|
-
let
|
|
5141
|
-
var
|
|
5143
|
+
let wr = (...e) => `(?:` + e.join(`|`) + `)`, Tr = j.presentation, Er = `\\\\(?:[0-9a-f]{1,6}\\s?|\\r\\n|.)`, Dr = `\\s*(` + wr(`[^:;\\\\]`, Er) + `*?)\\s*`, Or = `'(?:[^'\\n\\r\\\\]|\\\\(?:[0-9a-f]{1,6}\\s?|\\r\\n|.))*?(?:'|$)`, kr = `"(?:[^"\\n\\r\\\\]|\\\\(?:[0-9a-f]{1,6}\\s?|\\r\\n|.))*?(?:"|$)`, Ar = RegExp(`^` + wr(Or, kr) + `$`), jr = `\\s*(` + wr(`[^!'"();\\\\]+?`, Er, Or, kr, `\\(` + wr(`[^'"()\\\\]+`, Er, Or, kr) + `*?\\)`, `[^;]*?`) + `*?)`, Mr = RegExp(Dr + `:` + jr + `(\\s*!important(?![-(\\w]))?\\s*(?:;\\s*|$)`, `ig`), Nr = new RegExp(wr(Er, Or, kr, `/\\*[^]*?\\*/`), `ig`);
|
|
5144
|
+
var Pr = Object.freeze({
|
|
5142
5145
|
__proto__: null,
|
|
5143
5146
|
description: `converts style to attributes`,
|
|
5144
5147
|
fn: (e, t) => {
|
|
5145
5148
|
let { keepImportant: n = !1 } = t;
|
|
5146
5149
|
return { element: { enter: (e) => {
|
|
5147
5150
|
if (e.attributes.style != null) {
|
|
5148
|
-
let r = [], i = {}, a = e.attributes.style.replace(
|
|
5149
|
-
|
|
5150
|
-
for (var t; t =
|
|
5151
|
+
let r = [], i = {}, a = e.attributes.style.replace(Nr, ((e) => e[0] == `/` ? `` : e[0] == `\\` && /[-g-z]/i.test(e[1]) ? e[1] : e));
|
|
5152
|
+
Mr.lastIndex = 0;
|
|
5153
|
+
for (var t; t = Mr.exec(a);) n && t[3] || r.push([t[1], t[2]]);
|
|
5151
5154
|
r.length && (r = r.filter((function(e) {
|
|
5152
5155
|
if (e[0]) {
|
|
5153
5156
|
let t = e[0].toLowerCase(), n = e[1];
|
|
5154
|
-
if (
|
|
5157
|
+
if (Ar.test(n) && (n = n.slice(1, -1)), Tr.has(t)) return i[t] = n, !1;
|
|
5155
5158
|
}
|
|
5156
5159
|
return !0;
|
|
5157
5160
|
})), Object.assign(e.attributes, i), r.length ? e.attributes.style = r.map(((e) => e.join(`:`))).join(`;`) : delete e.attributes.style);
|
|
@@ -5160,26 +5163,26 @@ plugins: [
|
|
|
5160
5163
|
},
|
|
5161
5164
|
name: `convertStyleToAttrs`
|
|
5162
5165
|
});
|
|
5163
|
-
let
|
|
5166
|
+
let Fr = (e) => {
|
|
5164
5167
|
let t = /[/\\]?([^/\\]+)$/.exec(e);
|
|
5165
5168
|
return t ? t[1] : ``;
|
|
5166
|
-
},
|
|
5169
|
+
}, Ir = (e) => e.replace(/[. ]/g, `_`), Lr = (e) => e.startsWith(`"`) && e.endsWith(`"`) || e.startsWith(`'`) && e.endsWith(`'`) ? e.slice(1, -1) : e, Rr = (e, t) => {
|
|
5167
5170
|
let n = e(t);
|
|
5168
5171
|
return t.startsWith(n) ? t : n + t;
|
|
5169
|
-
},
|
|
5172
|
+
}, zr = (e, t) => t.startsWith(`#`) ? `#` + Rr(e, t.slice(1)) : null, Br = (e, t, n, r, i, a) => {
|
|
5170
5173
|
if (typeof r == `function`) {
|
|
5171
5174
|
let o = a.get(e);
|
|
5172
5175
|
return o ?? (o = r(t, n) + i, a.set(e, o), o);
|
|
5173
5176
|
}
|
|
5174
|
-
return typeof r == `string` ? r + i : r === !1 ? `` : n.path != null && n.path.length > 0 ?
|
|
5177
|
+
return typeof r == `string` ? r + i : r === !1 ? `` : n.path != null && n.path.length > 0 ? Ir(Fr(n.path)) + i : `prefix` + i;
|
|
5175
5178
|
};
|
|
5176
|
-
var
|
|
5179
|
+
var Vr = Object.freeze({
|
|
5177
5180
|
__proto__: null,
|
|
5178
5181
|
description: `prefix IDs`,
|
|
5179
5182
|
fn: (e, t, n) => {
|
|
5180
5183
|
let { delim: r = `__`, prefix: i, prefixIds: a = !0, prefixClassNames: o = !0 } = t, s = /* @__PURE__ */ new Map();
|
|
5181
5184
|
return { element: { enter: (e) => {
|
|
5182
|
-
let t = (t) =>
|
|
5185
|
+
let t = (t) => Br(t, e, n, i, r, s);
|
|
5183
5186
|
if (e.name === `style`) {
|
|
5184
5187
|
if (e.children.length === 0) return;
|
|
5185
5188
|
for (let n of e.children) {
|
|
@@ -5195,30 +5198,30 @@ plugins: [
|
|
|
5195
5198
|
}
|
|
5196
5199
|
b.walk(r, ((e) => {
|
|
5197
5200
|
if (a && e.type === `IdSelector` || o && e.type === `ClassSelector`) {
|
|
5198
|
-
e.name =
|
|
5201
|
+
e.name = Rr(t, e.name);
|
|
5199
5202
|
return;
|
|
5200
5203
|
}
|
|
5201
5204
|
if (e.type === `Url` && e.value.length > 0) {
|
|
5202
|
-
let n =
|
|
5205
|
+
let n = zr(t, Lr(e.value));
|
|
5203
5206
|
n != null && (e.value = n);
|
|
5204
5207
|
}
|
|
5205
5208
|
})), n.value = b.generate(r);
|
|
5206
5209
|
}
|
|
5207
5210
|
}
|
|
5208
|
-
a && e.attributes.id != null && e.attributes.id.length !== 0 && (e.attributes.id =
|
|
5211
|
+
a && e.attributes.id != null && e.attributes.id.length !== 0 && (e.attributes.id = Rr(t, e.attributes.id)), o && e.attributes.class != null && e.attributes.class.length !== 0 && (e.attributes.class = e.attributes.class.split(/\s+/).map(((e) => Rr(t, e))).join(` `));
|
|
5209
5212
|
for (let n of [`href`, `xlink:href`]) if (e.attributes[n] != null && e.attributes[n].length !== 0) {
|
|
5210
|
-
let r =
|
|
5213
|
+
let r = zr(t, e.attributes[n]);
|
|
5211
5214
|
r != null && (e.attributes[n] = r);
|
|
5212
5215
|
}
|
|
5213
|
-
for (let n of
|
|
5214
|
-
let i =
|
|
5216
|
+
for (let n of M) e.attributes[n] != null && e.attributes[n].length !== 0 && (e.attributes[n] = e.attributes[n].replace(/\burl\((["'])?(#.+?)\1\)/gi, ((e, n, r) => {
|
|
5217
|
+
let i = zr(t, r);
|
|
5215
5218
|
return i == null ? e : `url(${i})`;
|
|
5216
5219
|
})));
|
|
5217
5220
|
for (let n of [`begin`, `end`]) if (e.attributes[n] != null && e.attributes[n].length !== 0) {
|
|
5218
5221
|
let r = e.attributes[n].split(/\s*;\s+/).map(((e) => {
|
|
5219
5222
|
if (e.endsWith(`.end`) || e.endsWith(`.start`)) {
|
|
5220
5223
|
let [n, r] = e.split(`.`);
|
|
5221
|
-
return `${
|
|
5224
|
+
return `${Rr(t, n)}.${r}`;
|
|
5222
5225
|
}
|
|
5223
5226
|
return e;
|
|
5224
5227
|
}));
|
|
@@ -5227,20 +5230,23 @@ plugins: [
|
|
|
5227
5230
|
} } };
|
|
5228
5231
|
},
|
|
5229
5232
|
name: `prefixIds`
|
|
5230
|
-
}),
|
|
5233
|
+
}), Hr = Object.freeze({
|
|
5231
5234
|
__proto__: null,
|
|
5232
5235
|
description: `removes attributes of elements that match a css selector`,
|
|
5233
5236
|
fn: (e, t) => {
|
|
5237
|
+
if (!Array.isArray(t.selectors) && (!t.selector || !t.attributes)) return console.warn(`Warning: The plugin "removeAttributesBySelector" is missing parameters.
|
|
5238
|
+
It should have a list of "selectors", or one "selector" and one "attributes".
|
|
5239
|
+
Without either, the plugin is a noop.`), null;
|
|
5234
5240
|
let n = Array.isArray(t.selectors) ? t.selectors : [t];
|
|
5235
5241
|
for (let { selector: t, attributes: r } of n) {
|
|
5236
|
-
let n =
|
|
5242
|
+
let n = O(e, t);
|
|
5237
5243
|
for (let e of n) if (e.type === `element`) if (Array.isArray(r)) for (let t of r) delete e.attributes[t];
|
|
5238
5244
|
else delete e.attributes[r];
|
|
5239
5245
|
}
|
|
5240
5246
|
return {};
|
|
5241
5247
|
},
|
|
5242
5248
|
name: `removeAttributesBySelector`
|
|
5243
|
-
}),
|
|
5249
|
+
}), Ur = Object.freeze({
|
|
5244
5250
|
__proto__: null,
|
|
5245
5251
|
description: `removes specified attributes`,
|
|
5246
5252
|
fn: (e, t) => {
|
|
@@ -5278,7 +5284,7 @@ plugins: [
|
|
|
5278
5284
|
} } };
|
|
5279
5285
|
},
|
|
5280
5286
|
name: `removeAttrs`
|
|
5281
|
-
}),
|
|
5287
|
+
}), Wr = Object.freeze({
|
|
5282
5288
|
__proto__: null,
|
|
5283
5289
|
description: `removes width and height in presence of viewBox (opposite to removeViewBox)`,
|
|
5284
5290
|
fn: () => ({ element: { enter: (e) => {
|
|
@@ -5291,23 +5297,23 @@ plugins: [
|
|
|
5291
5297
|
}
|
|
5292
5298
|
} } }),
|
|
5293
5299
|
name: `removeDimensions`
|
|
5294
|
-
}),
|
|
5300
|
+
}), Gr = Object.freeze({
|
|
5295
5301
|
__proto__: null,
|
|
5296
5302
|
description: `removes arbitrary elements by ID or className`,
|
|
5297
5303
|
fn: (e, t) => {
|
|
5298
5304
|
let n = t.id == null ? [] : Array.isArray(t.id) ? t.id : [t.id], r = t.class == null ? [] : Array.isArray(t.class) ? t.class : [t.class];
|
|
5299
5305
|
return { element: { enter: (e, t) => {
|
|
5300
|
-
if (e.attributes.id != null && n.length !== 0 && n.includes(e.attributes.id) &&
|
|
5306
|
+
if (e.attributes.id != null && n.length !== 0 && n.includes(e.attributes.id) && k(e, t), e.attributes.class && r.length !== 0) {
|
|
5301
5307
|
let n = e.attributes.class.split(` `);
|
|
5302
5308
|
for (let i of r) if (n.includes(i)) {
|
|
5303
|
-
|
|
5309
|
+
k(e, t);
|
|
5304
5310
|
break;
|
|
5305
5311
|
}
|
|
5306
5312
|
}
|
|
5307
5313
|
} } };
|
|
5308
5314
|
},
|
|
5309
5315
|
name: `removeElementsByAttr`
|
|
5310
|
-
}),
|
|
5316
|
+
}), Kr = Object.freeze({
|
|
5311
5317
|
__proto__: null,
|
|
5312
5318
|
description: `removes elements that are drawn outside of the viewBox`,
|
|
5313
5319
|
fn: () => {
|
|
@@ -5330,7 +5336,7 @@ plugins: [
|
|
|
5330
5336
|
}
|
|
5331
5337
|
if (t.attributes.transform != null) return S;
|
|
5332
5338
|
if (t.name === `path` && t.attributes.d != null && e != null) {
|
|
5333
|
-
let r =
|
|
5339
|
+
let r = Ft(t.attributes.d), i = !1;
|
|
5334
5340
|
for (let t of r) if (t.command === `M`) {
|
|
5335
5341
|
let [n, r] = t.args;
|
|
5336
5342
|
n >= e.left && n <= e.right && r >= e.top && r <= e.bottom && (i = !0);
|
|
@@ -5341,7 +5347,7 @@ plugins: [
|
|
|
5341
5347
|
args: []
|
|
5342
5348
|
});
|
|
5343
5349
|
let { left: a, top: o, width: s, height: c } = e;
|
|
5344
|
-
|
|
5350
|
+
Qt([
|
|
5345
5351
|
{
|
|
5346
5352
|
command: `M`,
|
|
5347
5353
|
args: [a, o]
|
|
@@ -5362,73 +5368,97 @@ plugins: [
|
|
|
5362
5368
|
command: `z`,
|
|
5363
5369
|
args: []
|
|
5364
5370
|
}
|
|
5365
|
-
], r) === !1 &&
|
|
5371
|
+
], r) === !1 && k(t, n);
|
|
5366
5372
|
}
|
|
5367
5373
|
} } };
|
|
5368
5374
|
},
|
|
5369
5375
|
name: `removeOffCanvasPaths`
|
|
5370
|
-
}),
|
|
5376
|
+
}), qr = Object.freeze({
|
|
5371
5377
|
__proto__: null,
|
|
5372
5378
|
description: `removes raster images`,
|
|
5373
5379
|
fn: () => ({ element: { enter: (e, t) => {
|
|
5374
|
-
e.name === `image` && e.attributes[`xlink:href`] != null && /(\.|image\/)(jpe?g|png|gif)/.test(e.attributes[`xlink:href`]) &&
|
|
5380
|
+
e.name === `image` && e.attributes[`xlink:href`] != null && /(\.|image\/)(jpe?g|png|gif)/.test(e.attributes[`xlink:href`]) && k(e, t);
|
|
5375
5381
|
} } }),
|
|
5376
5382
|
name: `removeRasterImages`
|
|
5377
5383
|
});
|
|
5378
|
-
let
|
|
5379
|
-
...
|
|
5380
|
-
...
|
|
5381
|
-
...
|
|
5382
|
-
...
|
|
5383
|
-
...
|
|
5384
|
-
];
|
|
5385
|
-
|
|
5384
|
+
let Jr = [
|
|
5385
|
+
...j.animationEvent,
|
|
5386
|
+
...j.documentEvent,
|
|
5387
|
+
...j.documentElementEvent,
|
|
5388
|
+
...j.globalEvent,
|
|
5389
|
+
...j.graphicalEvent
|
|
5390
|
+
], Yr = [`http://www.w3.org/2000/svg`, `http://www.w3.org/1999/xhtml`];
|
|
5391
|
+
function Xr(e, t, n, r) {
|
|
5392
|
+
if (e === t) return !0;
|
|
5393
|
+
if (e.includes(`:`)) {
|
|
5394
|
+
let [i, a] = e.split(`:`, 2);
|
|
5395
|
+
if (t === a) {
|
|
5396
|
+
let e = n.get(i), t = e[e.length - 1];
|
|
5397
|
+
return r.includes(t);
|
|
5398
|
+
}
|
|
5399
|
+
}
|
|
5400
|
+
return !1;
|
|
5401
|
+
}
|
|
5402
|
+
var Zr = Object.freeze({
|
|
5386
5403
|
__proto__: null,
|
|
5387
5404
|
description: `removes scripts`,
|
|
5388
|
-
fn: () =>
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5405
|
+
fn: () => {
|
|
5406
|
+
let e = /* @__PURE__ */ new Map();
|
|
5407
|
+
return { element: {
|
|
5408
|
+
enter: (t, n) => {
|
|
5409
|
+
for (let [n, r] of Object.entries(t.attributes)) {
|
|
5410
|
+
if (!n.startsWith(`xmlns:`)) continue;
|
|
5411
|
+
let t = n.slice(6);
|
|
5412
|
+
e.has(t) ? e.get(t).push(r) : e.set(t, [r]);
|
|
5413
|
+
}
|
|
5414
|
+
if (Xr(t.name, `script`, e, Yr)) {
|
|
5415
|
+
k(t, n);
|
|
5416
|
+
return;
|
|
5417
|
+
}
|
|
5418
|
+
for (let e of Jr) t.attributes[e] != null && delete t.attributes[e];
|
|
5419
|
+
},
|
|
5420
|
+
exit: (t, n) => {
|
|
5421
|
+
for (let n of Object.keys(t.attributes)) {
|
|
5422
|
+
if (!n.startsWith(`xmlns:`)) continue;
|
|
5423
|
+
let t = n.slice(6);
|
|
5424
|
+
e.get(t).pop();
|
|
5425
|
+
}
|
|
5426
|
+
if (t.name === `a`) {
|
|
5427
|
+
for (let e of Object.keys(t.attributes)) if (e === `href` || e.endsWith(`:href`)) {
|
|
5428
|
+
if (t.attributes[e] == null || !t.attributes[e].trimStart().toLowerCase().startsWith(`javascript:`)) continue;
|
|
5429
|
+
let r = n.children.indexOf(t), i = t.children.filter(((e) => e.type !== `text`));
|
|
5430
|
+
n.children.splice(r, 1, ...i);
|
|
5431
|
+
}
|
|
5402
5432
|
}
|
|
5403
5433
|
}
|
|
5404
|
-
}
|
|
5405
|
-
}
|
|
5434
|
+
} };
|
|
5435
|
+
},
|
|
5406
5436
|
name: `removeScripts`
|
|
5407
|
-
}),
|
|
5437
|
+
}), Qr = Object.freeze({
|
|
5408
5438
|
__proto__: null,
|
|
5409
5439
|
description: `removes <style> element`,
|
|
5410
5440
|
fn: () => ({ element: { enter: (e, t) => {
|
|
5411
|
-
e.name === `style` &&
|
|
5441
|
+
e.name === `style` && k(e, t);
|
|
5412
5442
|
} } }),
|
|
5413
5443
|
name: `removeStyleElement`
|
|
5414
|
-
}),
|
|
5444
|
+
}), $r = Object.freeze({
|
|
5415
5445
|
__proto__: null,
|
|
5416
5446
|
description: `removes <title>`,
|
|
5417
5447
|
fn: () => ({ element: { enter: (e, t) => {
|
|
5418
|
-
e.name === `title` &&
|
|
5448
|
+
e.name === `title` && k(e, t);
|
|
5419
5449
|
} } }),
|
|
5420
5450
|
name: `removeTitle`
|
|
5421
5451
|
});
|
|
5422
|
-
let
|
|
5452
|
+
let ei = /* @__PURE__ */ new Set([
|
|
5423
5453
|
`pattern`,
|
|
5424
5454
|
`svg`,
|
|
5425
5455
|
`symbol`
|
|
5426
5456
|
]);
|
|
5427
|
-
var
|
|
5457
|
+
var ti = Object.freeze({
|
|
5428
5458
|
__proto__: null,
|
|
5429
5459
|
description: `removes viewBox attribute when possible`,
|
|
5430
5460
|
fn: () => ({ element: { enter: (e, t) => {
|
|
5431
|
-
if (
|
|
5461
|
+
if (ei.has(e.name) && e.attributes.viewBox != null && e.attributes.width != null && e.attributes.height != null) {
|
|
5432
5462
|
if (e.name === `svg` && t.type !== `root`) return;
|
|
5433
5463
|
let n = e.attributes.viewBox.split(/[ ,]+/g);
|
|
5434
5464
|
n[0] === `0` && n[1] === `0` && e.attributes.width.replace(/px$/, ``) === n[2] && e.attributes.height.replace(/px$/, ``) === n[3] && delete e.attributes.viewBox;
|
|
@@ -5436,17 +5466,17 @@ plugins: [
|
|
|
5436
5466
|
} } }),
|
|
5437
5467
|
name: `removeViewBox`
|
|
5438
5468
|
});
|
|
5439
|
-
let
|
|
5469
|
+
let ni = `http://www.w3.org/1999/xlink`, ri = {
|
|
5440
5470
|
new: `_blank`,
|
|
5441
5471
|
replace: `_self`
|
|
5442
|
-
},
|
|
5472
|
+
}, ii = /* @__PURE__ */ new Set([
|
|
5443
5473
|
`cursor`,
|
|
5444
5474
|
`filter`,
|
|
5445
5475
|
`font-face-uri`,
|
|
5446
5476
|
`glyphRef`,
|
|
5447
5477
|
`tref`
|
|
5448
|
-
]),
|
|
5449
|
-
var
|
|
5478
|
+
]), ai = (e, t, n) => t.map(((e) => `${e}:${n}`)).filter(((t) => e.attributes[t] != null));
|
|
5479
|
+
var oi = Object.freeze({
|
|
5450
5480
|
__proto__: null,
|
|
5451
5481
|
description: `remove xlink namespace and replaces attributes with the SVG 2 equivalent where applicable`,
|
|
5452
5482
|
fn: (e, t) => {
|
|
@@ -5455,23 +5485,23 @@ plugins: [
|
|
|
5455
5485
|
enter: (e) => {
|
|
5456
5486
|
for (let [t, n] of Object.entries(e.attributes)) if (t.startsWith(`xmlns:`)) {
|
|
5457
5487
|
let e = t.split(`:`, 2)[1];
|
|
5458
|
-
if (n ===
|
|
5488
|
+
if (n === ni) {
|
|
5459
5489
|
r.push(e);
|
|
5460
5490
|
continue;
|
|
5461
5491
|
}
|
|
5462
5492
|
r.includes(e) && i.push(e);
|
|
5463
5493
|
}
|
|
5464
5494
|
if (i.some(((e) => r.includes(e)))) return;
|
|
5465
|
-
let t =
|
|
5495
|
+
let t = ai(e, r, `show`), o = e.attributes.target != null;
|
|
5466
5496
|
for (let n = t.length - 1; n >= 0; n--) {
|
|
5467
|
-
let r = t[n], i =
|
|
5468
|
-
if (o ||
|
|
5497
|
+
let r = t[n], i = e.attributes[r], a = ri[i];
|
|
5498
|
+
if (o || a == null) {
|
|
5469
5499
|
delete e.attributes[r];
|
|
5470
5500
|
continue;
|
|
5471
5501
|
}
|
|
5472
|
-
|
|
5502
|
+
a !== be[e.name]?.defaults?.target && (e.attributes.target = a), delete e.attributes[r], o = !0;
|
|
5473
5503
|
}
|
|
5474
|
-
let s =
|
|
5504
|
+
let s = ai(e, r, `title`);
|
|
5475
5505
|
for (let t = s.length - 1; t >= 0; t--) {
|
|
5476
5506
|
let n = s[t], r = e.attributes[n];
|
|
5477
5507
|
if (e.children.filter(((e) => e.type === `element` && e.name === `title`)).length > 0) {
|
|
@@ -5492,8 +5522,8 @@ plugins: [
|
|
|
5492
5522
|
value: e
|
|
5493
5523
|
}), e.children.unshift(i), delete e.attributes[n];
|
|
5494
5524
|
}
|
|
5495
|
-
let c =
|
|
5496
|
-
if (c.length > 0 &&
|
|
5525
|
+
let c = ai(e, r, `href`);
|
|
5526
|
+
if (c.length > 0 && ii.has(e.name) && !n) {
|
|
5497
5527
|
c.map(((e) => e.split(`:`, 1)[0])).forEach(((e) => a.push(e)));
|
|
5498
5528
|
return;
|
|
5499
5529
|
}
|
|
@@ -5514,7 +5544,7 @@ plugins: [
|
|
|
5514
5544
|
continue;
|
|
5515
5545
|
}
|
|
5516
5546
|
if (t.startsWith(`xmlns:`) && !a.includes(c)) {
|
|
5517
|
-
if (o ===
|
|
5547
|
+
if (o === ni) {
|
|
5518
5548
|
let n = r.indexOf(c);
|
|
5519
5549
|
r.splice(n, 1), delete e.attributes[t];
|
|
5520
5550
|
continue;
|
|
@@ -5529,18 +5559,18 @@ plugins: [
|
|
|
5529
5559
|
} };
|
|
5530
5560
|
},
|
|
5531
5561
|
name: `removeXlink`
|
|
5532
|
-
}),
|
|
5562
|
+
}), si = Object.freeze({
|
|
5533
5563
|
__proto__: null,
|
|
5534
5564
|
description: `removes xmlns attribute (for inline svg)`,
|
|
5535
5565
|
fn: () => ({ element: { enter: (e) => {
|
|
5536
5566
|
e.name === `svg` && delete e.attributes.xmlns;
|
|
5537
5567
|
} } }),
|
|
5538
5568
|
name: `removeXMLNS`
|
|
5539
|
-
}),
|
|
5569
|
+
}), ci = Object.freeze({
|
|
5540
5570
|
__proto__: null,
|
|
5541
5571
|
description: `Finds <path> elements with the same d, fill, and stroke, and converts them to <use> elements referencing a single <path> def.`,
|
|
5542
5572
|
fn: (e) => {
|
|
5543
|
-
let t =
|
|
5573
|
+
let t = P(e), n = /* @__PURE__ */ new Map(), r, i = /* @__PURE__ */ new Set();
|
|
5544
5574
|
return { element: {
|
|
5545
5575
|
enter: (e, t) => {
|
|
5546
5576
|
if (e.name === `path` && e.attributes.d != null) {
|
|
@@ -5579,13 +5609,13 @@ plugins: [
|
|
|
5579
5609
|
for (let t of r) {
|
|
5580
5610
|
if (delete t.attributes.d, delete t.attributes.stroke, delete t.attributes.fill, a.children.includes(t) && t.children.length === 0) {
|
|
5581
5611
|
if (Object.keys(t.attributes).length === 0) {
|
|
5582
|
-
|
|
5612
|
+
k(t, a);
|
|
5583
5613
|
continue;
|
|
5584
5614
|
}
|
|
5585
5615
|
if (Object.keys(t.attributes).length === 1 && t.attributes.id != null) {
|
|
5586
|
-
|
|
5616
|
+
k(t, a);
|
|
5587
5617
|
let r = `[xlink\\:href=#${t.attributes.id}], [href=#${t.attributes.id}]`;
|
|
5588
|
-
for (let t of
|
|
5618
|
+
for (let t of O(e, r)) if (t.type === `element`) for (let e of [`href`, `xlink:href`]) t.attributes[e] != null && (t.attributes[e] = `#` + n.attributes.id);
|
|
5589
5619
|
continue;
|
|
5590
5620
|
}
|
|
5591
5621
|
}
|
|
@@ -5599,63 +5629,63 @@ plugins: [
|
|
|
5599
5629
|
},
|
|
5600
5630
|
name: `reusePaths`
|
|
5601
5631
|
});
|
|
5602
|
-
let
|
|
5603
|
-
mr,
|
|
5604
|
-
hr,
|
|
5632
|
+
let li = Object.freeze([
|
|
5605
5633
|
gr,
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
st,
|
|
5609
|
-
br,
|
|
5610
|
-
pt,
|
|
5611
|
-
Kt,
|
|
5612
|
-
_t,
|
|
5613
|
-
Vt,
|
|
5614
|
-
xr,
|
|
5615
|
-
Zn,
|
|
5616
|
-
Bt,
|
|
5617
|
-
Mr,
|
|
5618
|
-
ir,
|
|
5619
|
-
Ke,
|
|
5620
|
-
cr,
|
|
5634
|
+
_r,
|
|
5635
|
+
vr,
|
|
5621
5636
|
We,
|
|
5622
|
-
|
|
5637
|
+
kt,
|
|
5638
|
+
lt,
|
|
5639
|
+
Sr,
|
|
5640
|
+
ht,
|
|
5641
|
+
Jt,
|
|
5642
|
+
yt,
|
|
5643
|
+
Ut,
|
|
5644
|
+
Cr,
|
|
5645
|
+
$n,
|
|
5623
5646
|
Ht,
|
|
5647
|
+
Pr,
|
|
5648
|
+
or,
|
|
5649
|
+
qe,
|
|
5650
|
+
ur,
|
|
5651
|
+
Ge,
|
|
5652
|
+
rt,
|
|
5624
5653
|
Wt,
|
|
5625
|
-
|
|
5626
|
-
Br,
|
|
5654
|
+
Kt,
|
|
5627
5655
|
Vr,
|
|
5628
|
-
me,
|
|
5629
|
-
Le,
|
|
5630
|
-
pr,
|
|
5631
5656
|
Hr,
|
|
5632
|
-
de,
|
|
5633
|
-
ze,
|
|
5634
5657
|
Ur,
|
|
5635
|
-
|
|
5636
|
-
or,
|
|
5637
|
-
Rt,
|
|
5638
|
-
Lt,
|
|
5658
|
+
he,
|
|
5639
5659
|
Re,
|
|
5640
|
-
|
|
5660
|
+
hr,
|
|
5641
5661
|
Wr,
|
|
5662
|
+
fe,
|
|
5663
|
+
Be,
|
|
5642
5664
|
Gr,
|
|
5665
|
+
sr,
|
|
5666
|
+
cr,
|
|
5667
|
+
Bt,
|
|
5668
|
+
zt,
|
|
5669
|
+
ze,
|
|
5670
|
+
wt,
|
|
5671
|
+
Kr,
|
|
5643
5672
|
qr,
|
|
5644
|
-
Jr,
|
|
5645
|
-
Yr,
|
|
5646
|
-
xt,
|
|
5647
|
-
lr,
|
|
5648
|
-
ut,
|
|
5649
|
-
Ct,
|
|
5650
5673
|
Zr,
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5674
|
+
Qr,
|
|
5675
|
+
$r,
|
|
5676
|
+
Ct,
|
|
5677
|
+
dr,
|
|
5678
|
+
ft,
|
|
5679
|
+
Tt,
|
|
5680
|
+
ti,
|
|
5681
|
+
oi,
|
|
5682
|
+
si,
|
|
5683
|
+
pe,
|
|
5684
|
+
ci,
|
|
5685
|
+
fr,
|
|
5686
|
+
pr
|
|
5657
5687
|
]);
|
|
5658
|
-
var
|
|
5688
|
+
var ui = class e extends Error {
|
|
5659
5689
|
constructor(t, n, r, i, a) {
|
|
5660
5690
|
super(t), this.name = `SvgoParserError`, this.message = `${a || `<input>`}:${n}:${r}: ${t}`, this.reason = t, this.line = n, this.column = r, this.source = i, Error.captureStackTrace && Error.captureStackTrace(this, e);
|
|
5661
5691
|
}
|
|
@@ -5674,7 +5704,7 @@ plugins: [
|
|
|
5674
5704
|
return `${this.name}: ${this.message}\n\n${o}\n`;
|
|
5675
5705
|
}
|
|
5676
5706
|
};
|
|
5677
|
-
let
|
|
5707
|
+
let di = /<!ENTITY\s+(\S+)\s+(?:'([^']+)'|"([^"]+)")\s*>/g, fi = {
|
|
5678
5708
|
strict: !0,
|
|
5679
5709
|
trim: !1,
|
|
5680
5710
|
normalize: !1,
|
|
@@ -5682,8 +5712,8 @@ plugins: [
|
|
|
5682
5712
|
xmlns: !0,
|
|
5683
5713
|
position: !0,
|
|
5684
5714
|
unparsedEntities: !0
|
|
5685
|
-
},
|
|
5686
|
-
let n = g.parser(
|
|
5715
|
+
}, pi = (e, t) => {
|
|
5716
|
+
let n = g.parser(fi.strict, fi), r = {
|
|
5687
5717
|
type: `root`,
|
|
5688
5718
|
children: []
|
|
5689
5719
|
}, i = r, a = [r], o = (e) => {
|
|
@@ -5697,21 +5727,23 @@ plugins: [
|
|
|
5697
5727
|
});
|
|
5698
5728
|
let r = t.indexOf(`[`);
|
|
5699
5729
|
if (r >= 0) {
|
|
5700
|
-
|
|
5701
|
-
let t =
|
|
5702
|
-
for (; t != null;) n.ENTITIES[t[1]] = t[2] || t[3], t =
|
|
5730
|
+
di.lastIndex = r;
|
|
5731
|
+
let t = di.exec(e);
|
|
5732
|
+
for (; t != null;) n.ENTITIES[t[1]] = t[2] || t[3], t = di.exec(e);
|
|
5703
5733
|
}
|
|
5704
5734
|
}, n.onprocessinginstruction = (e) => {
|
|
5705
|
-
|
|
5735
|
+
let t = {
|
|
5706
5736
|
type: `instruction`,
|
|
5707
5737
|
name: e.name,
|
|
5708
5738
|
value: e.body
|
|
5709
|
-
}
|
|
5739
|
+
};
|
|
5740
|
+
o(t);
|
|
5710
5741
|
}, n.oncomment = (e) => {
|
|
5711
|
-
|
|
5742
|
+
let t = {
|
|
5712
5743
|
type: `comment`,
|
|
5713
5744
|
value: e.trim()
|
|
5714
|
-
}
|
|
5745
|
+
};
|
|
5746
|
+
o(t);
|
|
5715
5747
|
}, n.oncdata = (e) => {
|
|
5716
5748
|
o({
|
|
5717
5749
|
type: `cdata`,
|
|
@@ -5727,7 +5759,7 @@ plugins: [
|
|
|
5727
5759
|
for (let [n, r] of Object.entries(e.attributes)) t.attributes[n] = r.value;
|
|
5728
5760
|
o(t), i = t, a.push(t);
|
|
5729
5761
|
}, n.ontext = (e) => {
|
|
5730
|
-
if (i.type === `element`) if (
|
|
5762
|
+
if (i.type === `element`) if (ge.has(i.name)) o({
|
|
5731
5763
|
type: `text`,
|
|
5732
5764
|
value: e
|
|
5733
5765
|
});
|
|
@@ -5742,10 +5774,10 @@ plugins: [
|
|
|
5742
5774
|
a.pop(), i = a[a.length - 1];
|
|
5743
5775
|
}, n.onerror = (r) => {
|
|
5744
5776
|
let i = r.message.split(`
|
|
5745
|
-
`)[0], a = new
|
|
5777
|
+
`)[0], a = new ui(i, n.line + 1, n.column, e, t);
|
|
5746
5778
|
if (r.message.indexOf(`Unexpected end`) === -1) throw a;
|
|
5747
5779
|
}, n.write(e).close(), r;
|
|
5748
|
-
},
|
|
5780
|
+
}, Z = {
|
|
5749
5781
|
doctypeStart: `<!DOCTYPE`,
|
|
5750
5782
|
doctypeEnd: `>`,
|
|
5751
5783
|
procInstStart: `<?`,
|
|
@@ -5767,20 +5799,20 @@ plugins: [
|
|
|
5767
5799
|
indent: 4,
|
|
5768
5800
|
regEntities: /[&'"<>]/g,
|
|
5769
5801
|
regValEntities: /[&"<>]/g,
|
|
5770
|
-
encodeEntity: (e) =>
|
|
5802
|
+
encodeEntity: (e) => mi[e],
|
|
5771
5803
|
pretty: !1,
|
|
5772
5804
|
useShortTags: !0,
|
|
5773
5805
|
eol: `lf`,
|
|
5774
5806
|
finalNewline: !1
|
|
5775
|
-
},
|
|
5807
|
+
}, mi = {
|
|
5776
5808
|
"&": `&`,
|
|
5777
5809
|
"'": `'`,
|
|
5778
5810
|
"\"": `"`,
|
|
5779
5811
|
">": `>`,
|
|
5780
5812
|
"<": `<`
|
|
5781
|
-
},
|
|
5813
|
+
}, hi = (e, t = {}) => {
|
|
5782
5814
|
let n = {
|
|
5783
|
-
...
|
|
5815
|
+
...Z,
|
|
5784
5816
|
...t
|
|
5785
5817
|
}, r = n.indent, i = ` `;
|
|
5786
5818
|
typeof r == `number` && Number.isNaN(r) === !1 ? i = r < 0 ? ` ` : ` `.repeat(r) : typeof r == `string` && (i = r);
|
|
@@ -5792,55 +5824,55 @@ plugins: [
|
|
|
5792
5824
|
` : `
|
|
5793
5825
|
`;
|
|
5794
5826
|
n.pretty && (n.doctypeEnd += o, n.procInstEnd += o, n.commentEnd += o, n.cdataEnd += o, n.tagShortEnd += o, n.tagOpenEnd += o, n.tagCloseEnd += o, n.textEnd += o);
|
|
5795
|
-
let s =
|
|
5827
|
+
let s = gi(e, n, a);
|
|
5796
5828
|
return n.finalNewline && s.length > 0 && !s.endsWith(`
|
|
5797
5829
|
`) && (s += o), s;
|
|
5798
|
-
},
|
|
5830
|
+
}, gi = (e, t, n) => {
|
|
5799
5831
|
let r = ``;
|
|
5800
5832
|
n.indentLevel++;
|
|
5801
5833
|
for (let i of e.children) switch (i.type) {
|
|
5802
5834
|
case `element`:
|
|
5803
|
-
r +=
|
|
5835
|
+
r += xi(i, t, n);
|
|
5804
5836
|
break;
|
|
5805
5837
|
case `text`:
|
|
5806
|
-
r +=
|
|
5838
|
+
r += Ci(i, t, n);
|
|
5807
5839
|
break;
|
|
5808
5840
|
case `doctype`:
|
|
5809
|
-
r +=
|
|
5841
|
+
r += _i(i, t);
|
|
5810
5842
|
break;
|
|
5811
5843
|
case `instruction`:
|
|
5812
|
-
r +=
|
|
5844
|
+
r += vi(i, t);
|
|
5813
5845
|
break;
|
|
5814
5846
|
case `comment`:
|
|
5815
|
-
r +=
|
|
5847
|
+
r += yi(i, t);
|
|
5816
5848
|
break;
|
|
5817
|
-
case `cdata`: r +=
|
|
5849
|
+
case `cdata`: r += bi(i, t, n);
|
|
5818
5850
|
}
|
|
5819
5851
|
return n.indentLevel--, r;
|
|
5820
|
-
},
|
|
5852
|
+
}, Q = (e, t) => {
|
|
5821
5853
|
let n = ``;
|
|
5822
5854
|
return e.pretty && t.textContext == null && (n = t.indent.repeat(t.indentLevel - 1)), n;
|
|
5823
|
-
},
|
|
5824
|
-
if (e.children.length === 0) return t.useShortTags ?
|
|
5825
|
-
let r = t.tagOpenStart, i = t.tagOpenEnd, a = t.tagCloseStart, o = t.tagCloseEnd, s =
|
|
5826
|
-
n.textContext ? (r =
|
|
5827
|
-
let l =
|
|
5828
|
-
return n.textContext === e && (n.textContext = null), s + r + e.name +
|
|
5829
|
-
},
|
|
5855
|
+
}, _i = (e, t) => t.doctypeStart + e.data.doctype + t.doctypeEnd, vi = (e, t) => t.procInstStart + e.name + ` ` + e.value + t.procInstEnd, yi = (e, t) => t.commentStart + e.value + t.commentEnd, bi = (e, t, n) => Q(t, n) + t.cdataStart + e.value + t.cdataEnd, xi = (e, t, n) => {
|
|
5856
|
+
if (e.children.length === 0) return t.useShortTags ? Q(t, n) + t.tagShortStart + e.name + Si(e, t) + t.tagShortEnd : Q(t, n) + t.tagShortStart + e.name + Si(e, t) + t.tagOpenEnd + t.tagCloseStart + e.name + t.tagCloseEnd;
|
|
5857
|
+
let r = t.tagOpenStart, i = t.tagOpenEnd, a = t.tagCloseStart, o = t.tagCloseEnd, s = Q(t, n), c = Q(t, n);
|
|
5858
|
+
n.textContext ? (r = Z.tagOpenStart, i = Z.tagOpenEnd, a = Z.tagCloseStart, o = Z.tagCloseEnd, s = ``) : ge.has(e.name) && (i = Z.tagOpenEnd, a = Z.tagCloseStart, c = ``, n.textContext = e);
|
|
5859
|
+
let l = gi(e, t, n);
|
|
5860
|
+
return n.textContext === e && (n.textContext = null), s + r + e.name + Si(e, t) + i + l + c + a + e.name + o;
|
|
5861
|
+
}, Si = (e, t) => {
|
|
5830
5862
|
let n = ``;
|
|
5831
5863
|
for (let [r, i] of Object.entries(e.attributes)) if (n += ` ` + r, i !== void 0) {
|
|
5832
5864
|
let e = i.toString().replace(t.regValEntities, t.encodeEntity);
|
|
5833
5865
|
n += t.attrStart + e + t.attrEnd;
|
|
5834
5866
|
}
|
|
5835
5867
|
return n;
|
|
5836
|
-
},
|
|
5837
|
-
for (let e of
|
|
5838
|
-
function
|
|
5839
|
-
return e === `removeScriptElement` ? (console.warn(`Warning: removeScriptElement has been renamed to removeScripts, please update your SVGO config`),
|
|
5868
|
+
}, Ci = (e, t, n) => Q(t, n) + t.textStart + e.value.replace(t.regEntities, t.encodeEntity) + (n.textContext ? `` : t.textEnd), wi = /* @__PURE__ */ new Map();
|
|
5869
|
+
for (let e of li) wi.set(e.name, e);
|
|
5870
|
+
function Ti(e) {
|
|
5871
|
+
return e === `removeScriptElement` ? (console.warn(`Warning: removeScriptElement has been renamed to removeScripts, please update your SVGO config`), wi.get(`removeScripts`)) : wi.get(e);
|
|
5840
5872
|
}
|
|
5841
|
-
let
|
|
5873
|
+
let Ei = (e) => {
|
|
5842
5874
|
if (typeof e == `string`) {
|
|
5843
|
-
let t =
|
|
5875
|
+
let t = Ti(e);
|
|
5844
5876
|
if (t == null) throw Error(`Unknown builtin plugin "${e}" specified.`);
|
|
5845
5877
|
return {
|
|
5846
5878
|
name: e,
|
|
@@ -5852,7 +5884,7 @@ plugins: [
|
|
|
5852
5884
|
if (e.name == null) throw Error(`Plugin name must be specified`);
|
|
5853
5885
|
let t = e.fn;
|
|
5854
5886
|
if (t == null) {
|
|
5855
|
-
let n =
|
|
5887
|
+
let n = Ti(e.name);
|
|
5856
5888
|
if (n == null) throw Error(`Unknown builtin plugin "${e.name}" specified.`);
|
|
5857
5889
|
t = n.fn;
|
|
5858
5890
|
}
|
|
@@ -5863,49 +5895,49 @@ plugins: [
|
|
|
5863
5895
|
};
|
|
5864
5896
|
}
|
|
5865
5897
|
return null;
|
|
5866
|
-
},
|
|
5898
|
+
}, Di = (e, t) => {
|
|
5867
5899
|
if (t ??= {}, typeof t != `object`) throw Error(`Config should be an object`);
|
|
5868
5900
|
let n = t.multipass ? 10 : 1, r = Infinity, i = ``, a = {};
|
|
5869
5901
|
t.path != null && (a.path = t.path);
|
|
5870
5902
|
for (let o = 0; o < n; o += 1) {
|
|
5871
5903
|
a.multipassCount = o;
|
|
5872
|
-
let n =
|
|
5904
|
+
let n = pi(e, t.path), s = t.plugins || [`preset-default`];
|
|
5873
5905
|
if (!Array.isArray(s)) throw Error("malformed config, `plugins` property must be an array.\nSee more info here: https://github.com/svg/svgo#configuration");
|
|
5874
|
-
let c = s.filter(((e) => e != null)).map(
|
|
5906
|
+
let c = s.filter(((e) => e != null)).map(Ei);
|
|
5875
5907
|
c.length < s.length && console.warn(`Warning: plugins list includes null or undefined elements, these will be ignored.`);
|
|
5876
5908
|
let l = {};
|
|
5877
|
-
if (t.floatPrecision != null && (l.floatPrecision = t.floatPrecision), w(n, a, c, null, l), i =
|
|
5909
|
+
if (t.floatPrecision != null && (l.floatPrecision = t.floatPrecision), w(n, a, c, null, l), i = hi(n, t.js2svg), !(i.length < r)) break;
|
|
5878
5910
|
e = i, r = i.length;
|
|
5879
5911
|
}
|
|
5880
|
-
return t.datauri && (i =
|
|
5881
|
-
},
|
|
5912
|
+
return t.datauri && (i = Ze(i, t.datauri)), { data: i };
|
|
5913
|
+
}, $ = async (e) => {
|
|
5882
5914
|
let t = d.resolve(e), n = (await import(_.pathToFileURL(t).toString())).default;
|
|
5883
5915
|
if (typeof n != `object` || !n || Array.isArray(n)) throw Error(`Invalid config file "${e}"`);
|
|
5884
5916
|
return n;
|
|
5885
|
-
},
|
|
5917
|
+
}, Oi = async (e) => {
|
|
5886
5918
|
try {
|
|
5887
5919
|
return (await u.stat(e)).isFile();
|
|
5888
5920
|
} catch {
|
|
5889
5921
|
return !1;
|
|
5890
5922
|
}
|
|
5891
5923
|
};
|
|
5892
|
-
e.VERSION = `4.0.
|
|
5893
|
-
if (e != null) return d.isAbsolute(e) ?
|
|
5924
|
+
e.VERSION = `4.0.2`, e._collections = De, e.builtinPlugins = li, e.loadConfig = async (e, t = process.cwd()) => {
|
|
5925
|
+
if (e != null) return d.isAbsolute(e) ? $(e) : $(d.join(t, e));
|
|
5894
5926
|
let n = t;
|
|
5895
5927
|
for (;;) {
|
|
5896
5928
|
let e = d.join(n, `svgo.config.js`);
|
|
5897
|
-
if (await
|
|
5929
|
+
if (await Oi(e)) return $(e);
|
|
5898
5930
|
let t = d.join(n, `svgo.config.mjs`);
|
|
5899
|
-
if (await
|
|
5931
|
+
if (await Oi(t)) return $(t);
|
|
5900
5932
|
let r = d.join(n, `svgo.config.cjs`);
|
|
5901
|
-
if (await
|
|
5933
|
+
if (await Oi(r)) return $(r);
|
|
5902
5934
|
let i = d.dirname(n);
|
|
5903
5935
|
if (n === i) return null;
|
|
5904
5936
|
n = i;
|
|
5905
5937
|
}
|
|
5906
|
-
}, e.mapNodesToParents =
|
|
5938
|
+
}, e.mapNodesToParents = T, e.optimize = (e, t) => {
|
|
5907
5939
|
if (t ??= {}, typeof t != `object`) throw Error(`Config should be an object`);
|
|
5908
|
-
return
|
|
5940
|
+
return Di(e, {
|
|
5909
5941
|
...t,
|
|
5910
5942
|
js2svg: {
|
|
5911
5943
|
eol: l.EOL === `\r
|
|
@@ -5913,6 +5945,6 @@ plugins: [
|
|
|
5913
5945
|
...t.js2svg
|
|
5914
5946
|
}
|
|
5915
5947
|
});
|
|
5916
|
-
}, e.querySelector =
|
|
5948
|
+
}, e.querySelector = ue, e.querySelectorAll = O;
|
|
5917
5949
|
}));
|
|
5918
5950
|
export { l as require_svgo_node };
|