svg-path-commander 2.1.2 → 2.1.5
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 +4 -4
- package/dist/svg-path-commander.cjs +1 -1
- package/dist/svg-path-commander.cjs.map +1 -1
- package/dist/svg-path-commander.d.ts +755 -849
- package/dist/svg-path-commander.js +1 -1
- package/dist/svg-path-commander.js.map +1 -1
- package/dist/svg-path-commander.mjs +947 -611
- package/dist/svg-path-commander.mjs.map +1 -1
- package/package.json +14 -22
- package/.eslintrc.cjs +0 -225
- package/.prettierrc.json +0 -15
- package/dts.config.ts +0 -15
- package/src/convert/pathToAbsolute.ts +0 -18
- package/src/convert/pathToCurve.ts +0 -43
- package/src/convert/pathToRelative.ts +0 -18
- package/src/convert/pathToString.ts +0 -50
- package/src/index.ts +0 -454
- package/src/interface.ts +0 -130
- package/src/math/arcTools.ts +0 -396
- package/src/math/bezier.ts +0 -261
- package/src/math/cubicTools.ts +0 -124
- package/src/math/distanceSquareRoot.ts +0 -15
- package/src/math/lineTools.ts +0 -69
- package/src/math/midPoint.ts +0 -18
- package/src/math/polygonTools.ts +0 -48
- package/src/math/quadTools.ts +0 -100
- package/src/math/rotateVector.ts +0 -17
- package/src/math/roundTo.ts +0 -7
- package/src/options/options.ts +0 -9
- package/src/parser/error.ts +0 -2
- package/src/parser/finalizeSegment.ts +0 -35
- package/src/parser/invalidPathValue.ts +0 -2
- package/src/parser/isArcCommand.ts +0 -11
- package/src/parser/isDigit.ts +0 -12
- package/src/parser/isDigitStart.ts +0 -14
- package/src/parser/isMoveCommand.ts +0 -17
- package/src/parser/isPathCommand.ts +0 -28
- package/src/parser/isSpace.ts +0 -23
- package/src/parser/paramsCount.ts +0 -16
- package/src/parser/paramsParser.ts +0 -14
- package/src/parser/parsePathString.ts +0 -33
- package/src/parser/pathParser.ts +0 -29
- package/src/parser/scanFlag.ts +0 -29
- package/src/parser/scanParam.ts +0 -102
- package/src/parser/scanSegment.ts +0 -84
- package/src/parser/skipSpaces.ts +0 -17
- package/src/process/absolutizeSegment.ts +0 -63
- package/src/process/arcToCubic.ts +0 -128
- package/src/process/getSVGMatrix.ts +0 -70
- package/src/process/iterate.ts +0 -58
- package/src/process/lineToCubic.ts +0 -17
- package/src/process/normalizePath.ts +0 -33
- package/src/process/normalizeSegment.ts +0 -84
- package/src/process/optimizePath.ts +0 -63
- package/src/process/projection2d.ts +0 -52
- package/src/process/quadToCubic.ts +0 -31
- package/src/process/relativizeSegment.ts +0 -59
- package/src/process/reverseCurve.ts +0 -24
- package/src/process/reversePath.ts +0 -114
- package/src/process/roundPath.ts +0 -33
- package/src/process/roundSegment.ts +0 -9
- package/src/process/segmentToCubic.ts +0 -48
- package/src/process/shortenSegment.ts +0 -71
- package/src/process/splitCubic.ts +0 -29
- package/src/process/splitPath.ts +0 -63
- package/src/process/transformPath.ts +0 -110
- package/src/types.ts +0 -228
- package/src/util/distanceEpsilon.ts +0 -3
- package/src/util/getClosestPoint.ts +0 -15
- package/src/util/getDrawDirection.ts +0 -16
- package/src/util/getPathArea.ts +0 -70
- package/src/util/getPathBBox.ts +0 -98
- package/src/util/getPointAtLength.ts +0 -110
- package/src/util/getPropertiesAtLength.ts +0 -67
- package/src/util/getPropertiesAtPoint.ts +0 -84
- package/src/util/getSegmentAtLength.ts +0 -15
- package/src/util/getSegmentOfPoint.ts +0 -18
- package/src/util/getTotalLength.ts +0 -68
- package/src/util/isAbsoluteArray.ts +0 -18
- package/src/util/isCurveArray.ts +0 -15
- package/src/util/isNormalizedArray.ts +0 -16
- package/src/util/isPathArray.ts +0 -24
- package/src/util/isPointInStroke.ts +0 -16
- package/src/util/isRelativeArray.ts +0 -18
- package/src/util/isValidPath.ts +0 -27
- package/src/util/shapeParams.ts +0 -16
- package/src/util/shapeToPath.ts +0 -86
- package/src/util/shapeToPathArray.ts +0 -183
- package/test/class.test.ts +0 -504
- package/test/fixtures/getMarkup.ts +0 -17
- package/test/fixtures/shapeObjects.ts +0 -11
- package/test/fixtures/shapes.js +0 -104
- package/test/fixtures/simpleShapes.js +0 -75
- package/test/static.test.ts +0 -330
- package/vite.config.mts +0 -41
- package/vitest.config-ui.mts +0 -26
- package/vitest.config.mts +0 -26
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var Ze = Object.defineProperty,
|
|
5
|
-
const
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Qe = (e, t, s) => t in e ? je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var d = (e, t, s) => Qe(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
var Ze = Object.defineProperty, De = (e, t, s) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, S = (e, t, s) => De(e, typeof t != "symbol" ? t + "" : t, s);
|
|
5
|
+
const Oe = {
|
|
6
6
|
a: 1,
|
|
7
7
|
b: 0,
|
|
8
8
|
c: 0,
|
|
@@ -27,21 +27,21 @@ const Qe = {
|
|
|
27
27
|
m44: 1,
|
|
28
28
|
is2D: !0,
|
|
29
29
|
isIdentity: !0
|
|
30
|
-
},
|
|
31
|
-
const t = new
|
|
32
|
-
if (!
|
|
30
|
+
}, Gt = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), te = (e) => e instanceof DOMMatrix || e instanceof T || typeof e == "object" && Object.keys(Oe).every((t) => e && t in e), lt = (e) => {
|
|
31
|
+
const t = new T(), s = Array.from(e);
|
|
32
|
+
if (!Gt(s))
|
|
33
33
|
throw TypeError(`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`);
|
|
34
34
|
if (s.length === 16) {
|
|
35
|
-
const [r, n, i, o,
|
|
36
|
-
t.m11 = r, t.a = r, t.m21 =
|
|
35
|
+
const [r, n, i, o, l, c, a, u, m, h, g, f, y, p, M, N] = s;
|
|
36
|
+
t.m11 = r, t.a = r, t.m21 = l, t.c = l, t.m31 = m, t.m41 = y, t.e = y, t.m12 = n, t.b = n, t.m22 = c, t.d = c, t.m32 = h, t.m42 = p, t.f = p, t.m13 = i, t.m23 = a, t.m33 = g, t.m43 = M, t.m14 = o, t.m24 = u, t.m34 = f, t.m44 = N;
|
|
37
37
|
} else if (s.length === 6) {
|
|
38
|
-
const [r, n, i, o,
|
|
39
|
-
t.m11 = r, t.a = r, t.m12 = n, t.b = n, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 =
|
|
38
|
+
const [r, n, i, o, l, c] = s;
|
|
39
|
+
t.m11 = r, t.a = r, t.m12 = n, t.b = n, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = l, t.e = l, t.m42 = c, t.f = c;
|
|
40
40
|
}
|
|
41
41
|
return t;
|
|
42
|
-
},
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
42
|
+
}, ee = (e) => {
|
|
43
|
+
if (te(e))
|
|
44
|
+
return lt([
|
|
45
45
|
e.m11,
|
|
46
46
|
e.m12,
|
|
47
47
|
e.m13,
|
|
@@ -60,47 +60,47 @@ const Qe = {
|
|
|
60
60
|
e.m44
|
|
61
61
|
]);
|
|
62
62
|
throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);
|
|
63
|
-
},
|
|
63
|
+
}, ne = (e) => {
|
|
64
64
|
if (typeof e != "string")
|
|
65
65
|
throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);
|
|
66
66
|
const t = String(e).replace(/\s/g, "");
|
|
67
|
-
let s = new
|
|
67
|
+
let s = new T();
|
|
68
68
|
const r = `CSSMatrix: invalid transform string "${e}"`;
|
|
69
69
|
return t.split(")").filter((n) => n).forEach((n) => {
|
|
70
70
|
const [i, o] = n.split("(");
|
|
71
71
|
if (!o) throw TypeError(r);
|
|
72
|
-
const
|
|
73
|
-
if (i === "perspective" && c && [
|
|
72
|
+
const l = o.split(",").map((f) => f.includes("rad") ? parseFloat(f) * (180 / Math.PI) : parseFloat(f)), [c, a, u, m] = l, h = [c, a, u], g = [c, a, u, m];
|
|
73
|
+
if (i === "perspective" && c && [a, u].every((f) => f === void 0))
|
|
74
74
|
s.m34 = -1 / c;
|
|
75
|
-
else if (i.includes("matrix") && [6, 16].includes(
|
|
76
|
-
const
|
|
77
|
-
s = s.multiply(
|
|
78
|
-
} else if (i === "translate3d" &&
|
|
79
|
-
s = s.translate(c,
|
|
75
|
+
else if (i.includes("matrix") && [6, 16].includes(l.length) && l.every((f) => !Number.isNaN(+f))) {
|
|
76
|
+
const f = l.map((y) => Math.abs(y) < 1e-6 ? 0 : y);
|
|
77
|
+
s = s.multiply(lt(f));
|
|
78
|
+
} else if (i === "translate3d" && h.every((f) => !Number.isNaN(+f)))
|
|
79
|
+
s = s.translate(c, a, u);
|
|
80
80
|
else if (i === "translate" && c && u === void 0)
|
|
81
|
-
s = s.translate(c,
|
|
82
|
-
else if (i === "rotate3d" &&
|
|
83
|
-
s = s.rotateAxisAngle(c,
|
|
84
|
-
else if (i === "rotate" && c && [
|
|
81
|
+
s = s.translate(c, a || 0, 0);
|
|
82
|
+
else if (i === "rotate3d" && g.every((f) => !Number.isNaN(+f)) && m)
|
|
83
|
+
s = s.rotateAxisAngle(c, a, u, m);
|
|
84
|
+
else if (i === "rotate" && c && [a, u].every((f) => f === void 0))
|
|
85
85
|
s = s.rotate(0, 0, c);
|
|
86
|
-
else if (i === "scale3d" &&
|
|
87
|
-
s = s.scale(c,
|
|
86
|
+
else if (i === "scale3d" && h.every((f) => !Number.isNaN(+f)) && h.some((f) => f !== 1))
|
|
87
|
+
s = s.scale(c, a, u);
|
|
88
88
|
else if (i === "scale" && !Number.isNaN(c) && c !== 1 && u === void 0) {
|
|
89
|
-
const
|
|
90
|
-
s = s.scale(c,
|
|
91
|
-
} else if (i === "skew" && (c || !Number.isNaN(c) &&
|
|
92
|
-
s = s.skew(c,
|
|
93
|
-
else if (["translate", "rotate", "scale", "skew"].some((
|
|
89
|
+
const f = Number.isNaN(+a) ? c : a;
|
|
90
|
+
s = s.scale(c, f, 1);
|
|
91
|
+
} else if (i === "skew" && (c || !Number.isNaN(c) && a) && u === void 0)
|
|
92
|
+
s = s.skew(c, a || 0);
|
|
93
|
+
else if (["translate", "rotate", "scale", "skew"].some((f) => i.includes(f)) && /[XYZ]/.test(i) && c && [a, u].every((f) => f === void 0))
|
|
94
94
|
if (i === "skewX" || i === "skewY")
|
|
95
95
|
s = s[i](c);
|
|
96
96
|
else {
|
|
97
|
-
const
|
|
98
|
-
s = s[
|
|
97
|
+
const f = i.replace(/[XYZ]/, ""), y = i.replace(f, ""), p = ["X", "Y", "Z"].indexOf(y), M = f === "scale" ? 1 : 0, N = [p === 0 ? c : M, p === 1 ? c : M, p === 2 ? c : M];
|
|
98
|
+
s = s[f](...N);
|
|
99
99
|
}
|
|
100
100
|
else
|
|
101
101
|
throw TypeError(r);
|
|
102
102
|
}), s;
|
|
103
|
-
},
|
|
103
|
+
}, zt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [
|
|
104
104
|
e.m11,
|
|
105
105
|
e.m12,
|
|
106
106
|
e.m13,
|
|
@@ -117,33 +117,33 @@ const Qe = {
|
|
|
117
117
|
e.m42,
|
|
118
118
|
e.m43,
|
|
119
119
|
e.m44
|
|
120
|
-
],
|
|
121
|
-
const r = new
|
|
120
|
+
], se = (e, t, s) => {
|
|
121
|
+
const r = new T();
|
|
122
122
|
return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = s, r;
|
|
123
|
-
},
|
|
124
|
-
const r = new
|
|
125
|
-
r.m11 =
|
|
126
|
-
const
|
|
127
|
-
r.m21 =
|
|
128
|
-
const
|
|
129
|
-
return r.m22 =
|
|
130
|
-
},
|
|
131
|
-
const n = new
|
|
123
|
+
}, re = (e, t, s) => {
|
|
124
|
+
const r = new T(), n = Math.PI / 180, i = e * n, o = t * n, l = s * n, c = Math.cos(i), a = -Math.sin(i), u = Math.cos(o), m = -Math.sin(o), h = Math.cos(l), g = -Math.sin(l), f = u * h, y = -u * g;
|
|
125
|
+
r.m11 = f, r.a = f, r.m12 = y, r.b = y, r.m13 = m;
|
|
126
|
+
const p = a * m * h + c * g;
|
|
127
|
+
r.m21 = p, r.c = p;
|
|
128
|
+
const M = c * h - a * m * g;
|
|
129
|
+
return r.m22 = M, r.d = M, r.m23 = -a * u, r.m31 = a * g - c * m * h, r.m32 = a * h + c * m * g, r.m33 = c * u, r;
|
|
130
|
+
}, ie = (e, t, s, r) => {
|
|
131
|
+
const n = new T(), i = Math.sqrt(e * e + t * t + s * s);
|
|
132
132
|
if (i === 0)
|
|
133
133
|
return n;
|
|
134
|
-
const o = e / i,
|
|
135
|
-
n.m11 =
|
|
136
|
-
const
|
|
137
|
-
n.m12 =
|
|
138
|
-
const
|
|
139
|
-
n.m21 =
|
|
140
|
-
const
|
|
141
|
-
return n.m22 =
|
|
142
|
-
},
|
|
143
|
-
const r = new
|
|
134
|
+
const o = e / i, l = t / i, c = s / i, a = r * (Math.PI / 360), u = Math.sin(a), m = Math.cos(a), h = u * u, g = o * o, f = l * l, y = c * c, p = 1 - 2 * (f + y) * h;
|
|
135
|
+
n.m11 = p, n.a = p;
|
|
136
|
+
const M = 2 * (o * l * h + c * u * m);
|
|
137
|
+
n.m12 = M, n.b = M, n.m13 = 2 * (o * c * h - l * u * m);
|
|
138
|
+
const N = 2 * (l * o * h - c * u * m);
|
|
139
|
+
n.m21 = N, n.c = N;
|
|
140
|
+
const x = 1 - 2 * (y + g) * h;
|
|
141
|
+
return n.m22 = x, n.d = x, n.m23 = 2 * (l * c * h + o * u * m), n.m31 = 2 * (c * o * h + l * u * m), n.m32 = 2 * (c * l * h - o * u * m), n.m33 = 1 - 2 * (g + f) * h, n;
|
|
142
|
+
}, oe = (e, t, s) => {
|
|
143
|
+
const r = new T();
|
|
144
144
|
return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = s, r;
|
|
145
145
|
}, At = (e, t) => {
|
|
146
|
-
const s = new
|
|
146
|
+
const s = new T();
|
|
147
147
|
if (e) {
|
|
148
148
|
const r = e * Math.PI / 180, n = Math.tan(r);
|
|
149
149
|
s.m21 = n, s.c = n;
|
|
@@ -153,11 +153,11 @@ const Qe = {
|
|
|
153
153
|
s.m12 = n, s.b = n;
|
|
154
154
|
}
|
|
155
155
|
return s;
|
|
156
|
-
},
|
|
157
|
-
const s = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, n = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41,
|
|
158
|
-
return
|
|
156
|
+
}, ce = (e) => At(e, 0), le = (e) => At(0, e), _ = (e, t) => {
|
|
157
|
+
const s = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, n = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, l = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, c = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, a = t.m21 * e.m14 + t.m22 * e.m24 + t.m23 * e.m34 + t.m24 * e.m44, u = t.m31 * e.m11 + t.m32 * e.m21 + t.m33 * e.m31 + t.m34 * e.m41, m = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, h = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, g = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, f = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, y = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, p = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, M = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
|
|
158
|
+
return lt([s, r, n, i, o, l, c, a, u, m, h, g, f, y, p, M]);
|
|
159
159
|
};
|
|
160
|
-
class
|
|
160
|
+
class T {
|
|
161
161
|
/**
|
|
162
162
|
* @constructor
|
|
163
163
|
* @param init accepts all parameter configurations:
|
|
@@ -202,7 +202,7 @@ class C {
|
|
|
202
202
|
* @return the matrix instance
|
|
203
203
|
*/
|
|
204
204
|
setMatrixValue(t) {
|
|
205
|
-
return typeof t == "string" && t.length && t !== "none" ?
|
|
205
|
+
return typeof t == "string" && t.length && t !== "none" ? ne(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? lt(t) : typeof t == "object" ? ee(t) : this;
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Returns a *Float32Array* containing elements which comprise the matrix.
|
|
@@ -213,7 +213,7 @@ class C {
|
|
|
213
213
|
* @return an *Array* representation of the matrix
|
|
214
214
|
*/
|
|
215
215
|
toFloat32Array(t) {
|
|
216
|
-
return Float32Array.from(
|
|
216
|
+
return Float32Array.from(zt(this, t));
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Returns a *Float64Array* containing elements which comprise the matrix.
|
|
@@ -224,7 +224,7 @@ class C {
|
|
|
224
224
|
* @return an *Array* representation of the matrix
|
|
225
225
|
*/
|
|
226
226
|
toFloat64Array(t) {
|
|
227
|
-
return Float64Array.from(
|
|
227
|
+
return Float64Array.from(zt(this, t));
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* Creates and returns a string representation of the matrix in `CSS` matrix syntax,
|
|
@@ -262,7 +262,7 @@ class C {
|
|
|
262
262
|
* @return The resulted matrix.
|
|
263
263
|
*/
|
|
264
264
|
multiply(t) {
|
|
265
|
-
return
|
|
265
|
+
return _(this, t);
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* The translate method returns a new matrix which is this matrix post
|
|
@@ -278,7 +278,7 @@ class C {
|
|
|
278
278
|
translate(t, s, r) {
|
|
279
279
|
const n = t;
|
|
280
280
|
let i = s, o = r;
|
|
281
|
-
return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0),
|
|
281
|
+
return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), _(this, se(n, i, o));
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* The scale method returns a new matrix which is this matrix post multiplied by
|
|
@@ -294,7 +294,7 @@ class C {
|
|
|
294
294
|
scale(t, s, r) {
|
|
295
295
|
const n = t;
|
|
296
296
|
let i = s, o = r;
|
|
297
|
-
return typeof i > "u" && (i = t), typeof o > "u" && (o = 1),
|
|
297
|
+
return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), _(this, oe(n, i, o));
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
300
|
* The rotate method returns a new matrix which is this matrix post multiplied
|
|
@@ -310,7 +310,7 @@ class C {
|
|
|
310
310
|
*/
|
|
311
311
|
rotate(t, s, r) {
|
|
312
312
|
let n = t, i = s || 0, o = r || 0;
|
|
313
|
-
return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0),
|
|
313
|
+
return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0), _(this, re(n, i, o));
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
316
316
|
* The rotateAxisAngle method returns a new matrix which is this matrix post
|
|
@@ -327,7 +327,7 @@ class C {
|
|
|
327
327
|
rotateAxisAngle(t, s, r, n) {
|
|
328
328
|
if ([t, s, r, n].some((i) => Number.isNaN(+i)))
|
|
329
329
|
throw new TypeError("CSSMatrix: expecting 4 values");
|
|
330
|
-
return
|
|
330
|
+
return _(this, ie(t, s, r, n));
|
|
331
331
|
}
|
|
332
332
|
/**
|
|
333
333
|
* Specifies a skew transformation along the `x-axis` by the given angle.
|
|
@@ -337,7 +337,7 @@ class C {
|
|
|
337
337
|
* @return The resulted matrix
|
|
338
338
|
*/
|
|
339
339
|
skewX(t) {
|
|
340
|
-
return
|
|
340
|
+
return _(this, ce(t));
|
|
341
341
|
}
|
|
342
342
|
/**
|
|
343
343
|
* Specifies a skew transformation along the `y-axis` by the given angle.
|
|
@@ -347,7 +347,7 @@ class C {
|
|
|
347
347
|
* @return The resulted matrix
|
|
348
348
|
*/
|
|
349
349
|
skewY(t) {
|
|
350
|
-
return
|
|
350
|
+
return _(this, le(t));
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
353
|
* Specifies a skew transformation along both the `x-axis` and `y-axis`.
|
|
@@ -358,7 +358,7 @@ class C {
|
|
|
358
358
|
* @return The resulted matrix
|
|
359
359
|
*/
|
|
360
360
|
skew(t, s) {
|
|
361
|
-
return
|
|
361
|
+
return _(this, At(t, s));
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
364
364
|
* Transforms a specified vector using the matrix, returning a new
|
|
@@ -381,11 +381,11 @@ class C {
|
|
|
381
381
|
};
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
|
|
384
|
+
S(T, "Translate", se), S(T, "Rotate", re), S(T, "RotateAxisAngle", ie), S(T, "Scale", oe), S(T, "SkewX", ce), S(T, "SkewY", le), S(T, "Skew", At), S(T, "Multiply", _), S(T, "fromArray", lt), S(T, "fromMatrix", ee), S(T, "fromString", ne), S(T, "toArray", zt), S(T, "isCompatibleArray", Gt), S(T, "isCompatibleObject", te);
|
|
385
385
|
const V = {
|
|
386
386
|
origin: [0, 0, 0],
|
|
387
387
|
round: 4
|
|
388
|
-
},
|
|
388
|
+
}, tt = {
|
|
389
389
|
a: 7,
|
|
390
390
|
c: 6,
|
|
391
391
|
h: 1,
|
|
@@ -397,16 +397,20 @@ const V = {
|
|
|
397
397
|
t: 2,
|
|
398
398
|
v: 1,
|
|
399
399
|
z: 0
|
|
400
|
-
},
|
|
400
|
+
}, qt = (e) => {
|
|
401
401
|
let t = e.pathValue[e.segmentStart], s = t.toLowerCase();
|
|
402
402
|
const { data: r } = e;
|
|
403
|
-
for (; r.length >=
|
|
403
|
+
for (; r.length >= tt[s] && (s === "m" && r.length > 2 ? (e.segments.push(
|
|
404
|
+
[t].concat(
|
|
405
|
+
r.splice(0, 2)
|
|
406
|
+
)
|
|
407
|
+
), s = "l", t = t === "m" ? "l" : "L") : e.segments.push(
|
|
404
408
|
[t].concat(
|
|
405
|
-
r.splice(0,
|
|
409
|
+
r.splice(0, tt[s])
|
|
406
410
|
)
|
|
407
|
-
), !!
|
|
411
|
+
), !!tt[s]); )
|
|
408
412
|
;
|
|
409
|
-
},
|
|
413
|
+
}, j = "SVGPathCommander Error", ae = (e) => {
|
|
410
414
|
const { index: t, pathValue: s } = e, r = s.charCodeAt(t);
|
|
411
415
|
if (r === 48) {
|
|
412
416
|
e.param = 0, e.index += 1;
|
|
@@ -416,47 +420,47 @@ const V = {
|
|
|
416
420
|
e.param = 1, e.index += 1;
|
|
417
421
|
return;
|
|
418
422
|
}
|
|
419
|
-
e.err = `${
|
|
420
|
-
},
|
|
423
|
+
e.err = `${j}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`;
|
|
424
|
+
}, U = (e) => e >= 48 && e <= 57, J = "Invalid path value", ue = (e) => {
|
|
421
425
|
const { max: t, pathValue: s, index: r } = e;
|
|
422
|
-
let n = r, i = !1, o = !1,
|
|
426
|
+
let n = r, i = !1, o = !1, l = !1, c = !1, a;
|
|
423
427
|
if (n >= t) {
|
|
424
|
-
e.err = `${
|
|
428
|
+
e.err = `${j}: ${J} at index ${n}, "pathValue" is missing param`;
|
|
425
429
|
return;
|
|
426
430
|
}
|
|
427
|
-
if (
|
|
428
|
-
e.err = `${
|
|
431
|
+
if (a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1, a = s.charCodeAt(n)), !U(a) && a !== 46) {
|
|
432
|
+
e.err = `${j}: ${J} at index ${n}, "${s[n]}" is not a number`;
|
|
429
433
|
return;
|
|
430
434
|
}
|
|
431
|
-
if (
|
|
432
|
-
if (i =
|
|
433
|
-
e.err = `${
|
|
435
|
+
if (a !== 46) {
|
|
436
|
+
if (i = a === 48, n += 1, a = s.charCodeAt(n), i && n < t && a && U(a)) {
|
|
437
|
+
e.err = `${j}: ${J} at index ${r}, "${s[r]}" illegal number`;
|
|
434
438
|
return;
|
|
435
439
|
}
|
|
436
|
-
for (; n < t &&
|
|
440
|
+
for (; n < t && U(s.charCodeAt(n)); )
|
|
437
441
|
n += 1, o = !0;
|
|
438
|
-
|
|
442
|
+
a = s.charCodeAt(n);
|
|
439
443
|
}
|
|
440
|
-
if (
|
|
441
|
-
for (c = !0, n += 1;
|
|
442
|
-
n += 1,
|
|
443
|
-
|
|
444
|
+
if (a === 46) {
|
|
445
|
+
for (c = !0, n += 1; U(s.charCodeAt(n)); )
|
|
446
|
+
n += 1, l = !0;
|
|
447
|
+
a = s.charCodeAt(n);
|
|
444
448
|
}
|
|
445
|
-
if (
|
|
446
|
-
if (c && !o && !
|
|
447
|
-
e.err = `${
|
|
449
|
+
if (a === 101 || a === 69) {
|
|
450
|
+
if (c && !o && !l) {
|
|
451
|
+
e.err = `${j}: ${J} at index ${n}, "${s[n]}" invalid float exponent`;
|
|
448
452
|
return;
|
|
449
453
|
}
|
|
450
|
-
if (n += 1,
|
|
451
|
-
for (; n < t &&
|
|
454
|
+
if (n += 1, a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1), n < t && U(s.charCodeAt(n)))
|
|
455
|
+
for (; n < t && U(s.charCodeAt(n)); )
|
|
452
456
|
n += 1;
|
|
453
457
|
else {
|
|
454
|
-
e.err = `${
|
|
458
|
+
e.err = `${j}: ${J} at index ${n}, "${s[n]}" invalid integer exponent`;
|
|
455
459
|
return;
|
|
456
460
|
}
|
|
457
461
|
}
|
|
458
462
|
e.index = n, e.param = +e.pathValue.slice(r, n);
|
|
459
|
-
},
|
|
463
|
+
}, me = (e) => [
|
|
460
464
|
// Special spaces
|
|
461
465
|
5760,
|
|
462
466
|
6158,
|
|
@@ -486,11 +490,11 @@ const V = {
|
|
|
486
490
|
11,
|
|
487
491
|
12,
|
|
488
492
|
160
|
|
489
|
-
].includes(e),
|
|
493
|
+
].includes(e), et = (e) => {
|
|
490
494
|
const { pathValue: t, max: s } = e;
|
|
491
|
-
for (; e.index < s &&
|
|
495
|
+
for (; e.index < s && me(t.charCodeAt(e.index)); )
|
|
492
496
|
e.index += 1;
|
|
493
|
-
},
|
|
497
|
+
}, fe = (e) => {
|
|
494
498
|
switch (e | 32) {
|
|
495
499
|
case 109:
|
|
496
500
|
case 122:
|
|
@@ -506,7 +510,7 @@ const V = {
|
|
|
506
510
|
default:
|
|
507
511
|
return !1;
|
|
508
512
|
}
|
|
509
|
-
}, he = (e) =>
|
|
513
|
+
}, he = (e) => U(e) || e === 43 || e === 45 || e === 46, ye = (e) => (e | 32) === 97, ge = (e) => {
|
|
510
514
|
switch (e | 32) {
|
|
511
515
|
case 109:
|
|
512
516
|
case 77:
|
|
@@ -514,48 +518,48 @@ const V = {
|
|
|
514
518
|
default:
|
|
515
519
|
return !1;
|
|
516
520
|
}
|
|
517
|
-
},
|
|
521
|
+
}, Dt = (e) => {
|
|
518
522
|
var c;
|
|
519
|
-
const { max: t, pathValue: s, index: r, segments: n } = e, i = s.charCodeAt(r), o =
|
|
520
|
-
if (e.segmentStart = r, !
|
|
521
|
-
e.err = `${
|
|
523
|
+
const { max: t, pathValue: s, index: r, segments: n } = e, i = s.charCodeAt(r), o = tt[s[r].toLowerCase()];
|
|
524
|
+
if (e.segmentStart = r, !fe(i)) {
|
|
525
|
+
e.err = `${j}: ${J} "${s[r]}" is not a path command at index ${r}`;
|
|
522
526
|
return;
|
|
523
527
|
}
|
|
524
|
-
const
|
|
525
|
-
if (!
|
|
526
|
-
e.err = `${
|
|
528
|
+
const l = n[n.length - 1];
|
|
529
|
+
if (!ge(i) && ((c = l == null ? void 0 : l[0]) == null ? void 0 : c.toLocaleLowerCase()) === "z") {
|
|
530
|
+
e.err = `${j}: ${J} "${s[r]}" is not a MoveTo path command at index ${r}`;
|
|
527
531
|
return;
|
|
528
532
|
}
|
|
529
|
-
if (e.index += 1,
|
|
530
|
-
|
|
533
|
+
if (e.index += 1, et(e), e.data = [], !o) {
|
|
534
|
+
qt(e);
|
|
531
535
|
return;
|
|
532
536
|
}
|
|
533
537
|
for (; ; ) {
|
|
534
|
-
for (let
|
|
535
|
-
if (
|
|
538
|
+
for (let a = o; a > 0; a -= 1) {
|
|
539
|
+
if (ye(i) && (a === 3 || a === 4) ? ae(e) : ue(e), e.err.length)
|
|
536
540
|
return;
|
|
537
|
-
e.data.push(e.param),
|
|
541
|
+
e.data.push(e.param), et(e), e.index < t && s.charCodeAt(e.index) === 44 && (e.index += 1, et(e));
|
|
538
542
|
}
|
|
539
543
|
if (e.index >= e.max || !he(s.charCodeAt(e.index)))
|
|
540
544
|
break;
|
|
541
545
|
}
|
|
542
|
-
|
|
546
|
+
qt(e);
|
|
543
547
|
};
|
|
544
|
-
class
|
|
548
|
+
class Ot {
|
|
545
549
|
constructor(t) {
|
|
546
550
|
this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
|
|
547
551
|
}
|
|
548
552
|
}
|
|
549
|
-
const
|
|
553
|
+
const Q = (e) => {
|
|
550
554
|
if (typeof e != "string")
|
|
551
555
|
return e.slice(0);
|
|
552
|
-
const t = new
|
|
553
|
-
for (
|
|
554
|
-
|
|
556
|
+
const t = new Ot(e);
|
|
557
|
+
for (et(t); t.index < t.max && !t.err.length; )
|
|
558
|
+
Dt(t);
|
|
555
559
|
if (t != null && t.err.length)
|
|
556
560
|
throw TypeError(t.err);
|
|
557
561
|
return t.segments;
|
|
558
|
-
},
|
|
562
|
+
}, at = (e, t, s, r) => {
|
|
559
563
|
const [n] = e, i = n.toUpperCase();
|
|
560
564
|
if (t === 0 || i === n) return e;
|
|
561
565
|
if (i === "A")
|
|
@@ -574,25 +578,31 @@ const R = (e) => {
|
|
|
574
578
|
if (i === "H")
|
|
575
579
|
return [i, e[1] + s];
|
|
576
580
|
if (i === "L")
|
|
577
|
-
return [
|
|
581
|
+
return [
|
|
582
|
+
i,
|
|
583
|
+
e[1] + s,
|
|
584
|
+
e[2] + r
|
|
585
|
+
];
|
|
578
586
|
{
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
587
|
+
const l = [], c = e.length;
|
|
588
|
+
for (let a = 1; a < c; a += 1)
|
|
589
|
+
l.push(e[a] + (a % 2 ? s : r));
|
|
590
|
+
return [i].concat(l);
|
|
591
|
+
}
|
|
592
|
+
}, Z = (e, t) => {
|
|
593
|
+
let s = e.length, r, n = "M", i = "M", o = !1, l = 0, c = 0, a = 0, u = 0, m = 0;
|
|
594
|
+
for (let h = 0; h < s; h += 1) {
|
|
595
|
+
r = e[h], [n] = r, m = r.length, i = n.toUpperCase(), o = i !== n;
|
|
596
|
+
const g = t(r, h, l, c);
|
|
597
|
+
if (g === !1)
|
|
588
598
|
break;
|
|
589
|
-
i === "Z" ? (
|
|
599
|
+
i === "Z" ? (l = a, c = u) : i === "H" ? l = r[1] + (o ? l : 0) : i === "V" ? c = r[1] + (o ? c : 0) : (l = r[m - 2] + (o ? l : 0), c = r[m - 1] + (o ? c : 0), i === "M" && (a = l, u = c)), g && (e[h] = g, g[0] === "C" && (s = e.length));
|
|
590
600
|
}
|
|
591
601
|
return e;
|
|
592
|
-
},
|
|
593
|
-
const t =
|
|
594
|
-
return
|
|
595
|
-
},
|
|
602
|
+
}, ht = (e) => {
|
|
603
|
+
const t = Q(e);
|
|
604
|
+
return Z(t, at);
|
|
605
|
+
}, Bt = (e, t, s, r) => {
|
|
596
606
|
const [n] = e, i = n.toLowerCase();
|
|
597
607
|
if (t === 0 || n === i) return e;
|
|
598
608
|
if (i === "a")
|
|
@@ -611,115 +621,155 @@ const R = (e) => {
|
|
|
611
621
|
if (i === "h")
|
|
612
622
|
return [i, e[1] - s];
|
|
613
623
|
if (i === "l")
|
|
614
|
-
return [
|
|
624
|
+
return [
|
|
625
|
+
i,
|
|
626
|
+
e[1] - s,
|
|
627
|
+
e[2] - r
|
|
628
|
+
];
|
|
615
629
|
{
|
|
616
|
-
const
|
|
617
|
-
|
|
630
|
+
const l = [], c = e.length;
|
|
631
|
+
for (let a = 1; a < c; a += 1)
|
|
632
|
+
l.push(e[a] - (a % 2 ? s : r));
|
|
633
|
+
return [i].concat(l);
|
|
618
634
|
}
|
|
619
|
-
},
|
|
620
|
-
const t =
|
|
621
|
-
return
|
|
622
|
-
},
|
|
635
|
+
}, Kt = (e) => {
|
|
636
|
+
const t = Q(e);
|
|
637
|
+
return Z(t, Bt);
|
|
638
|
+
}, st = (e, t, s) => {
|
|
623
639
|
const { sin: r, cos: n } = Math, i = e * n(s) - t * r(s), o = e * r(s) + t * n(s);
|
|
624
640
|
return { x: i, y: o };
|
|
625
|
-
},
|
|
626
|
-
let u = e, m = t,
|
|
627
|
-
const
|
|
628
|
-
let
|
|
629
|
-
if (
|
|
630
|
-
[
|
|
641
|
+
}, Mt = (e, t, s, r, n, i, o, l, c, a) => {
|
|
642
|
+
let u = e, m = t, h = s, g = r, f = l, y = c;
|
|
643
|
+
const p = Math.PI * 120 / 180, M = Math.PI / 180 * (+n || 0);
|
|
644
|
+
let N = [], x, b, L, C, I;
|
|
645
|
+
if (a)
|
|
646
|
+
[b, L, C, I] = a;
|
|
631
647
|
else {
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
let
|
|
635
|
-
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
648
|
+
x = st(u, m, -M), u = x.x, m = x.y, x = st(f, y, -M), f = x.x, y = x.y;
|
|
649
|
+
const v = (u - f) / 2, O = (m - y) / 2;
|
|
650
|
+
let X = v * v / (h * h) + O * O / (g * g);
|
|
651
|
+
X > 1 && (X = Math.sqrt(X), h *= X, g *= X);
|
|
652
|
+
const Tt = h * h, $t = g * g, Jt = (i === o ? -1 : 1) * Math.sqrt(
|
|
653
|
+
Math.abs(
|
|
654
|
+
(Tt * $t - Tt * O * O - $t * v * v) / (Tt * O * O + $t * v * v)
|
|
655
|
+
)
|
|
656
|
+
);
|
|
657
|
+
C = Jt * h * O / g + (u + f) / 2, I = Jt * -g * v / h + (m + y) / 2, b = Math.asin(((m - I) / g * 10 ** 9 >> 0) / 10 ** 9), L = Math.asin(((y - I) / g * 10 ** 9 >> 0) / 10 ** 9), b = u < C ? Math.PI - b : b, L = f < C ? Math.PI - L : L, b < 0 && (b = Math.PI * 2 + b), L < 0 && (L = Math.PI * 2 + L), o && b > L && (b -= Math.PI * 2), !o && L > b && (L -= Math.PI * 2);
|
|
658
|
+
}
|
|
659
|
+
let R = L - b;
|
|
660
|
+
if (Math.abs(R) > p) {
|
|
661
|
+
const v = L, O = f, X = y;
|
|
662
|
+
L = b + p * (o && L > b ? 1 : -1), f = C + h * Math.cos(L), y = I + g * Math.sin(L), N = Mt(f, y, h, g, n, 0, o, O, X, [
|
|
663
|
+
L,
|
|
664
|
+
v,
|
|
665
|
+
C,
|
|
666
|
+
I
|
|
667
|
+
]);
|
|
668
|
+
}
|
|
669
|
+
R = L - b;
|
|
670
|
+
const P = Math.cos(b), z = Math.sin(b), D = Math.cos(L), K = Math.sin(L), q = Math.tan(R / 4), w = 4 / 3 * h * q, $ = 4 / 3 * g * q, E = [u, m], B = [u + w * z, m - $ * P], F = [f + w * K, y - $ * D], G = [f, y];
|
|
671
|
+
if (B[0] = 2 * E[0] - B[0], B[1] = 2 * E[1] - B[1], a)
|
|
672
|
+
return [B[0], B[1], F[0], F[1], G[0], G[1]].concat(N);
|
|
673
|
+
N = [B[0], B[1], F[0], F[1], G[0], G[1]].concat(N);
|
|
674
|
+
const W = [];
|
|
675
|
+
for (let v = 0, O = N.length; v < O; v += 1)
|
|
676
|
+
W[v] = v % 2 ? st(N[v - 1], N[v], M).y : st(N[v], N[v + 1], M).x;
|
|
677
|
+
return W;
|
|
653
678
|
}, xe = (e, t, s, r, n, i) => {
|
|
654
|
-
const o = 0.3333333333333333,
|
|
679
|
+
const o = 0.3333333333333333, l = 2 / 3;
|
|
655
680
|
return [
|
|
656
|
-
o * e +
|
|
681
|
+
o * e + l * s,
|
|
657
682
|
// cpx1
|
|
658
|
-
o * t +
|
|
683
|
+
o * t + l * r,
|
|
659
684
|
// cpy1
|
|
660
|
-
o * n +
|
|
685
|
+
o * n + l * s,
|
|
661
686
|
// cpx2
|
|
662
|
-
o * i +
|
|
687
|
+
o * i + l * r,
|
|
663
688
|
// cpy2
|
|
664
689
|
n,
|
|
665
690
|
i
|
|
666
691
|
// x,y
|
|
667
692
|
];
|
|
668
|
-
},
|
|
693
|
+
}, H = (e, t, s) => {
|
|
669
694
|
const [r, n] = e, [i, o] = t;
|
|
670
695
|
return [r + (i - r) * s, n + (o - n) * s];
|
|
671
|
-
},
|
|
672
|
-
const n =
|
|
696
|
+
}, Pt = (e, t, s, r) => {
|
|
697
|
+
const n = H([e, t], [s, r], 0.3333333333333333), i = H([e, t], [s, r], 2 / 3);
|
|
673
698
|
return [n[0], n[1], i[0], i[1], s, r];
|
|
674
|
-
},
|
|
675
|
-
const [s] = e, r = e.slice(1).map(Number), [n, i] = r, { x1: o, y1:
|
|
699
|
+
}, pe = (e, t) => {
|
|
700
|
+
const [s] = e, r = e.slice(1).map(Number), [n, i] = r, { x1: o, y1: l, x: c, y: a } = t;
|
|
676
701
|
return "TQ".includes(s) || (t.qx = null, t.qy = null), s === "M" ? (t.x = n, t.y = i, e) : s === "A" ? ["C"].concat(
|
|
677
|
-
|
|
702
|
+
Mt(
|
|
703
|
+
o,
|
|
704
|
+
l,
|
|
705
|
+
r[0],
|
|
706
|
+
r[1],
|
|
707
|
+
r[2],
|
|
708
|
+
r[3],
|
|
709
|
+
r[4],
|
|
710
|
+
r[5],
|
|
711
|
+
r[6]
|
|
712
|
+
)
|
|
678
713
|
) : s === "Q" ? (t.qx = n, t.qy = i, ["C"].concat(
|
|
679
|
-
xe(o,
|
|
680
|
-
)) : s === "L" ? ["C"].concat(
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
714
|
+
xe(o, l, r[0], r[1], r[2], r[3])
|
|
715
|
+
)) : s === "L" ? ["C"].concat(
|
|
716
|
+
Pt(o, l, n, i)
|
|
717
|
+
) : s === "Z" ? ["C"].concat(
|
|
718
|
+
Pt(o, l, c, a)
|
|
719
|
+
) : e;
|
|
720
|
+
}, wt = (e, t) => {
|
|
721
|
+
const [s] = e, r = s.toUpperCase(), n = s !== r, { x1: i, y1: o, x2: l, y2: c, x: a, y: u } = t, m = e.slice(1);
|
|
722
|
+
let h = m.map((g, f) => g + (n ? f % 2 ? u : a : 0));
|
|
684
723
|
if ("TQ".includes(r) || (t.qx = null, t.qy = null), r === "A")
|
|
685
|
-
return
|
|
724
|
+
return h = m.slice(0, -2).concat(
|
|
725
|
+
m[5] + (n ? a : 0),
|
|
726
|
+
m[6] + (n ? u : 0)
|
|
727
|
+
), ["A"].concat(h);
|
|
686
728
|
if (r === "H")
|
|
687
|
-
return [
|
|
729
|
+
return [
|
|
730
|
+
"L",
|
|
731
|
+
e[1] + (n ? a : 0),
|
|
732
|
+
o
|
|
733
|
+
];
|
|
688
734
|
if (r === "V")
|
|
689
|
-
return [
|
|
735
|
+
return [
|
|
736
|
+
"L",
|
|
737
|
+
i,
|
|
738
|
+
e[1] + (n ? u : 0)
|
|
739
|
+
];
|
|
690
740
|
if (r === "L")
|
|
691
741
|
return [
|
|
692
742
|
"L",
|
|
693
|
-
e[1] + (n ?
|
|
743
|
+
e[1] + (n ? a : 0),
|
|
694
744
|
e[2] + (n ? u : 0)
|
|
695
745
|
];
|
|
696
746
|
if (r === "M")
|
|
697
747
|
return [
|
|
698
748
|
"M",
|
|
699
|
-
e[1] + (n ?
|
|
749
|
+
e[1] + (n ? a : 0),
|
|
700
750
|
e[2] + (n ? u : 0)
|
|
701
751
|
];
|
|
702
752
|
if (r === "C")
|
|
703
|
-
return ["C"].concat(
|
|
753
|
+
return ["C"].concat(h);
|
|
704
754
|
if (r === "S") {
|
|
705
|
-
const
|
|
706
|
-
return t.x1 =
|
|
755
|
+
const g = i * 2 - l, f = o * 2 - c;
|
|
756
|
+
return t.x1 = g, t.y1 = f, ["C", g, f].concat(h);
|
|
707
757
|
} else if (r === "T") {
|
|
708
|
-
const
|
|
758
|
+
const g = i * 2 - (t.qx ? t.qx : (
|
|
709
759
|
/* istanbul ignore next */
|
|
710
760
|
0
|
|
711
|
-
)),
|
|
761
|
+
)), f = o * 2 - (t.qy ? t.qy : (
|
|
712
762
|
/* istanbul ignore next */
|
|
713
763
|
0
|
|
714
764
|
));
|
|
715
|
-
return t.qx =
|
|
765
|
+
return t.qx = g, t.qy = f, ["Q", g, f].concat(h);
|
|
716
766
|
} else if (r === "Q") {
|
|
717
|
-
const [
|
|
718
|
-
return t.qx =
|
|
767
|
+
const [g, f] = h;
|
|
768
|
+
return t.qx = g, t.qy = f, ["Q"].concat(h);
|
|
719
769
|
} else if (r === "Z")
|
|
720
770
|
return ["Z"];
|
|
721
771
|
return e;
|
|
722
|
-
},
|
|
772
|
+
}, ut = {
|
|
723
773
|
x1: 0,
|
|
724
774
|
y1: 0,
|
|
725
775
|
x2: 0,
|
|
@@ -728,20 +778,24 @@ const R = (e) => {
|
|
|
728
778
|
y: 0,
|
|
729
779
|
qx: null,
|
|
730
780
|
qy: null
|
|
731
|
-
},
|
|
732
|
-
const t = { ...
|
|
733
|
-
return
|
|
781
|
+
}, yt = (e) => {
|
|
782
|
+
const t = { ...ut }, s = Q(e);
|
|
783
|
+
return Z(s, (r, n, i, o) => {
|
|
734
784
|
t.x = i, t.y = o;
|
|
735
|
-
const
|
|
736
|
-
let c =
|
|
737
|
-
c[0] === "C" && c.length > 7 && (s.splice(
|
|
785
|
+
const l = wt(r, t);
|
|
786
|
+
let c = pe(l, t);
|
|
787
|
+
c[0] === "C" && c.length > 7 && (s.splice(
|
|
788
|
+
n + 1,
|
|
789
|
+
0,
|
|
790
|
+
["C"].concat(c.slice(7))
|
|
791
|
+
), c = c.slice(0, 7));
|
|
738
792
|
const u = c.length;
|
|
739
793
|
return t.x1 = +c[u - 2], t.y1 = +c[u - 1], t.x2 = +c[u - 4] || t.x1, t.y2 = +c[u - 3] || t.y1, c;
|
|
740
794
|
});
|
|
741
|
-
},
|
|
795
|
+
}, k = (e, t) => {
|
|
742
796
|
const s = t >= 1 ? 10 ** t : 1;
|
|
743
797
|
return t > 0 ? Math.round(e * s) / s : Math.round(e);
|
|
744
|
-
},
|
|
798
|
+
}, kt = (e, t) => {
|
|
745
799
|
const s = e.length;
|
|
746
800
|
let { round: r } = V, n = e[0], i = "";
|
|
747
801
|
r = t === "off" || typeof t == "number" && t >= 0 ? t : typeof r == "number" && r >= 0 ? r : (
|
|
@@ -750,153 +804,182 @@ const R = (e) => {
|
|
|
750
804
|
);
|
|
751
805
|
for (let o = 0; o < s; o += 1) {
|
|
752
806
|
n = e[o];
|
|
753
|
-
const [
|
|
754
|
-
if (i +=
|
|
807
|
+
const [l] = n, c = n.slice(1);
|
|
808
|
+
if (i += l, r === "off")
|
|
755
809
|
i += c.join(" ");
|
|
756
810
|
else {
|
|
757
|
-
let
|
|
811
|
+
let a = 0;
|
|
758
812
|
const u = c.length;
|
|
759
|
-
for (;
|
|
760
|
-
i +=
|
|
813
|
+
for (; a < u; )
|
|
814
|
+
i += k(c[a], r), a !== u - 1 && (i += " "), a += 1;
|
|
761
815
|
}
|
|
762
816
|
}
|
|
763
817
|
return i;
|
|
764
|
-
},
|
|
818
|
+
}, Nt = (e, t) => Math.sqrt(
|
|
819
|
+
(e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])
|
|
820
|
+
), it = (e, t, s, r) => Nt([e, t], [s, r]), Ht = (e, t, s, r, n) => {
|
|
765
821
|
let i = { x: e, y: t };
|
|
766
822
|
if (typeof n == "number") {
|
|
767
|
-
const o =
|
|
823
|
+
const o = Nt([e, t], [s, r]);
|
|
768
824
|
if (n <= 0)
|
|
769
825
|
i = { x: e, y: t };
|
|
770
826
|
else if (n >= o)
|
|
771
827
|
i = { x: s, y: r };
|
|
772
828
|
else {
|
|
773
|
-
const [
|
|
774
|
-
i = { x:
|
|
829
|
+
const [l, c] = H([e, t], [s, r], n / o);
|
|
830
|
+
i = { x: l, y: c };
|
|
775
831
|
}
|
|
776
832
|
}
|
|
777
833
|
return i;
|
|
778
|
-
},
|
|
834
|
+
}, It = (e, t, s, r) => {
|
|
779
835
|
const { min: n, max: i } = Math;
|
|
780
|
-
return
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
y: n(t, r)
|
|
784
|
-
},
|
|
785
|
-
max: {
|
|
786
|
-
x: i(e, s),
|
|
787
|
-
y: i(t, r)
|
|
788
|
-
}
|
|
789
|
-
};
|
|
790
|
-
}, Qt = (e, t, s) => {
|
|
791
|
-
const r = s / 2, n = Math.sin(r), i = Math.cos(r), o = e ** 2 * n ** 2, a = t ** 2 * i ** 2, c = Math.sqrt(o + a) * s;
|
|
836
|
+
return [n(e, s), n(t, r), i(e, s), i(t, r)];
|
|
837
|
+
}, Ft = (e, t, s) => {
|
|
838
|
+
const r = s / 2, n = Math.sin(r), i = Math.cos(r), o = e ** 2 * n ** 2, l = t ** 2 * i ** 2, c = Math.sqrt(o + l) * s;
|
|
792
839
|
return Math.abs(c);
|
|
793
|
-
},
|
|
794
|
-
const { sin: o, cos:
|
|
795
|
-
return
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
},
|
|
800
|
-
const {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
let h = l(s), x = l(r);
|
|
805
|
-
const A = (n % 360 + 360) % 360 * (y / 180);
|
|
806
|
-
if (e === a && t === c)
|
|
840
|
+
}, Y = (e, t, s, r, n, i) => {
|
|
841
|
+
const { sin: o, cos: l } = Math, c = l(n), a = o(n), u = s * l(i), m = r * o(i);
|
|
842
|
+
return [e + c * u - a * m, t + a * u + c * m];
|
|
843
|
+
}, Et = (e, t) => {
|
|
844
|
+
const { x: s, y: r } = e, { x: n, y: i } = t, o = s * n + r * i, l = Math.sqrt((s ** 2 + r ** 2) * (n ** 2 + i ** 2));
|
|
845
|
+
return (s * i - r * n < 0 ? -1 : 1) * Math.acos(o / l);
|
|
846
|
+
}, Lt = (e, t, s, r, n, i, o, l, c) => {
|
|
847
|
+
const { abs: a, sin: u, cos: m, sqrt: h, PI: g } = Math;
|
|
848
|
+
let f = a(s), y = a(r);
|
|
849
|
+
const M = (n % 360 + 360) % 360 * (g / 180);
|
|
850
|
+
if (e === l && t === c)
|
|
807
851
|
return {
|
|
808
|
-
rx:
|
|
809
|
-
ry:
|
|
852
|
+
rx: f,
|
|
853
|
+
ry: y,
|
|
810
854
|
startAngle: 0,
|
|
811
855
|
endAngle: 0,
|
|
812
|
-
center: { x:
|
|
856
|
+
center: { x: l, y: c }
|
|
813
857
|
};
|
|
814
|
-
if (
|
|
858
|
+
if (f === 0 || y === 0)
|
|
815
859
|
return {
|
|
816
|
-
rx:
|
|
817
|
-
ry:
|
|
860
|
+
rx: f,
|
|
861
|
+
ry: y,
|
|
818
862
|
startAngle: 0,
|
|
819
863
|
endAngle: 0,
|
|
820
|
-
center: { x: (
|
|
864
|
+
center: { x: (l + e) / 2, y: (c + t) / 2 }
|
|
821
865
|
};
|
|
822
|
-
const
|
|
823
|
-
x: m(
|
|
824
|
-
y: -u(
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
const
|
|
828
|
-
let
|
|
829
|
-
|
|
830
|
-
const
|
|
831
|
-
x:
|
|
832
|
-
y:
|
|
833
|
-
},
|
|
834
|
-
x: m(
|
|
835
|
-
y: u(
|
|
836
|
-
},
|
|
837
|
-
x: (
|
|
838
|
-
y: (
|
|
839
|
-
},
|
|
840
|
-
x: (-
|
|
841
|
-
y: (-
|
|
866
|
+
const N = (e - l) / 2, x = (t - c) / 2, b = {
|
|
867
|
+
x: m(M) * N + u(M) * x,
|
|
868
|
+
y: -u(M) * N + m(M) * x
|
|
869
|
+
}, L = b.x ** 2 / f ** 2 + b.y ** 2 / y ** 2;
|
|
870
|
+
L > 1 && (f *= h(L), y *= h(L));
|
|
871
|
+
const C = f ** 2 * y ** 2 - f ** 2 * b.y ** 2 - y ** 2 * b.x ** 2, I = f ** 2 * b.y ** 2 + y ** 2 * b.x ** 2;
|
|
872
|
+
let R = C / I;
|
|
873
|
+
R = R < 0 ? 0 : R;
|
|
874
|
+
const P = (i !== o ? 1 : -1) * h(R), z = {
|
|
875
|
+
x: P * (f * b.y / y),
|
|
876
|
+
y: P * (-(y * b.x) / f)
|
|
877
|
+
}, D = {
|
|
878
|
+
x: m(M) * z.x - u(M) * z.y + (e + l) / 2,
|
|
879
|
+
y: u(M) * z.x + m(M) * z.y + (t + c) / 2
|
|
880
|
+
}, K = {
|
|
881
|
+
x: (b.x - z.x) / f,
|
|
882
|
+
y: (b.y - z.y) / y
|
|
883
|
+
}, q = Et({ x: 1, y: 0 }, K), w = {
|
|
884
|
+
x: (-b.x - z.x) / f,
|
|
885
|
+
y: (-b.y - z.y) / y
|
|
842
886
|
};
|
|
843
|
-
let
|
|
844
|
-
!o &&
|
|
845
|
-
const
|
|
887
|
+
let $ = Et(K, w);
|
|
888
|
+
!o && $ > 0 ? $ -= 2 * g : o && $ < 0 && ($ += 2 * g), $ %= 2 * g;
|
|
889
|
+
const E = q + $;
|
|
846
890
|
return {
|
|
847
|
-
center:
|
|
848
|
-
startAngle:
|
|
849
|
-
endAngle:
|
|
850
|
-
rx:
|
|
851
|
-
ry:
|
|
891
|
+
center: D,
|
|
892
|
+
startAngle: q,
|
|
893
|
+
endAngle: E,
|
|
894
|
+
rx: f,
|
|
895
|
+
ry: y
|
|
852
896
|
};
|
|
853
|
-
},
|
|
854
|
-
const { rx:
|
|
855
|
-
|
|
856
|
-
|
|
897
|
+
}, _t = (e, t, s, r, n, i, o, l, c) => {
|
|
898
|
+
const { rx: a, ry: u, startAngle: m, endAngle: h } = Lt(
|
|
899
|
+
e,
|
|
900
|
+
t,
|
|
901
|
+
s,
|
|
902
|
+
r,
|
|
903
|
+
n,
|
|
904
|
+
i,
|
|
905
|
+
o,
|
|
906
|
+
l,
|
|
907
|
+
c
|
|
908
|
+
);
|
|
909
|
+
return Ft(a, u, h - m);
|
|
910
|
+
}, be = (e, t, s, r, n, i, o, l, c, a) => {
|
|
857
911
|
let u = { x: e, y: t };
|
|
858
|
-
const { center: m, rx:
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
912
|
+
const { center: m, rx: h, ry: g, startAngle: f, endAngle: y } = Lt(
|
|
913
|
+
e,
|
|
914
|
+
t,
|
|
915
|
+
s,
|
|
916
|
+
r,
|
|
917
|
+
n,
|
|
918
|
+
i,
|
|
919
|
+
o,
|
|
920
|
+
l,
|
|
921
|
+
c
|
|
922
|
+
);
|
|
923
|
+
if (typeof a == "number") {
|
|
924
|
+
const p = Ft(h, g, y - f);
|
|
925
|
+
if (a <= 0)
|
|
862
926
|
u = { x: e, y: t };
|
|
863
|
-
else if (
|
|
864
|
-
u = { x:
|
|
927
|
+
else if (a >= p)
|
|
928
|
+
u = { x: l, y: c };
|
|
865
929
|
else {
|
|
866
|
-
if (e ===
|
|
867
|
-
return { x:
|
|
868
|
-
if (
|
|
869
|
-
return
|
|
870
|
-
const { PI:
|
|
930
|
+
if (e === l && t === c)
|
|
931
|
+
return { x: l, y: c };
|
|
932
|
+
if (h === 0 || g === 0)
|
|
933
|
+
return Ht(e, t, l, c, a);
|
|
934
|
+
const { PI: M, cos: N, sin: x } = Math, b = y - f, C = (n % 360 + 360) % 360 * (M / 180), I = f + b * (a / p), R = h * N(I), P = g * x(I);
|
|
871
935
|
u = {
|
|
872
|
-
x:
|
|
873
|
-
y:
|
|
936
|
+
x: N(C) * R - x(C) * P + m.x,
|
|
937
|
+
y: x(C) * R + N(C) * P + m.y
|
|
874
938
|
};
|
|
875
939
|
}
|
|
876
940
|
}
|
|
877
941
|
return u;
|
|
878
|
-
},
|
|
879
|
-
const { center:
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
};
|
|
942
|
+
}, de = (e, t, s, r, n, i, o, l, c) => {
|
|
943
|
+
const { center: a, rx: u, ry: m, startAngle: h, endAngle: g } = Lt(
|
|
944
|
+
e,
|
|
945
|
+
t,
|
|
946
|
+
s,
|
|
947
|
+
r,
|
|
948
|
+
n,
|
|
949
|
+
i,
|
|
950
|
+
o,
|
|
951
|
+
l,
|
|
952
|
+
c
|
|
953
|
+
), f = g - h, { min: y, max: p, tan: M, atan2: N, PI: x } = Math, { x: b, y: L } = a, C = n * x / 180, I = M(C), R = N(-m * I, u), P = R, z = R + x, D = N(m, u * I), K = D + x;
|
|
954
|
+
let q = y(e, l), w = p(e, l), $ = y(t, c), E = p(t, c);
|
|
955
|
+
const B = g - f * 1e-3, F = Y(b, L, u, m, C, B), G = g - f * 0.999, W = Y(b, L, u, m, C, G);
|
|
956
|
+
if (F[0] > w || W[0] > w) {
|
|
957
|
+
const v = Y(b, L, u, m, C, P);
|
|
958
|
+
q = y(q, v[0]), $ = y($, v[1]), w = p(w, v[0]), E = p(E, v[1]);
|
|
959
|
+
}
|
|
960
|
+
if (F[0] < q || W[0] < q) {
|
|
961
|
+
const v = Y(b, L, u, m, C, z);
|
|
962
|
+
q = y(q, v[0]), $ = y($, v[1]), w = p(w, v[0]), E = p(E, v[1]);
|
|
963
|
+
}
|
|
964
|
+
if (F[1] < $ || W[1] < $) {
|
|
965
|
+
const v = Y(b, L, u, m, C, K);
|
|
966
|
+
q = y(q, v[0]), $ = y($, v[1]), w = p(w, v[0]), E = p(E, v[1]);
|
|
967
|
+
}
|
|
968
|
+
if (F[1] > E || W[1] > E) {
|
|
969
|
+
const v = Y(b, L, u, m, C, D);
|
|
970
|
+
q = y(q, v[0]), $ = y($, v[1]), w = p(w, v[0]), E = p(E, v[1]);
|
|
971
|
+
}
|
|
972
|
+
return [q, $, w, E];
|
|
890
973
|
}, Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
891
974
|
__proto__: null,
|
|
892
|
-
angleBetween:
|
|
893
|
-
arcLength:
|
|
894
|
-
arcPoint:
|
|
895
|
-
getArcBBox:
|
|
896
|
-
getArcLength:
|
|
897
|
-
getArcProps:
|
|
898
|
-
getPointAtArcLength:
|
|
899
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
975
|
+
angleBetween: Et,
|
|
976
|
+
arcLength: Ft,
|
|
977
|
+
arcPoint: Y,
|
|
978
|
+
getArcBBox: de,
|
|
979
|
+
getArcLength: _t,
|
|
980
|
+
getArcProps: Lt,
|
|
981
|
+
getPointAtArcLength: be
|
|
982
|
+
}, Symbol.toStringTag, { value: "Module" })), Rt = [
|
|
900
983
|
-0.06405689286260563,
|
|
901
984
|
0.06405689286260563,
|
|
902
985
|
-0.1911188674736163,
|
|
@@ -921,7 +1004,7 @@ const R = (e) => {
|
|
|
921
1004
|
0.9747285559713095,
|
|
922
1005
|
-0.9951872199970213,
|
|
923
1006
|
0.9951872199970213
|
|
924
|
-
],
|
|
1007
|
+
], Ae = [
|
|
925
1008
|
0.12793819534675216,
|
|
926
1009
|
0.12793819534675216,
|
|
927
1010
|
0.1258374563468283,
|
|
@@ -946,7 +1029,7 @@ const R = (e) => {
|
|
|
946
1029
|
0.028531388628933663,
|
|
947
1030
|
0.0123412297999872,
|
|
948
1031
|
0.0123412297999872
|
|
949
|
-
],
|
|
1032
|
+
], Me = (e) => {
|
|
950
1033
|
const t = [];
|
|
951
1034
|
for (let s = e, r = s.length, n = r - 1; r > 1; r -= 1, n -= 1) {
|
|
952
1035
|
const i = [];
|
|
@@ -959,7 +1042,7 @@ const R = (e) => {
|
|
|
959
1042
|
t.push(i), s = i;
|
|
960
1043
|
}
|
|
961
1044
|
return t;
|
|
962
|
-
},
|
|
1045
|
+
}, we = (e, t) => {
|
|
963
1046
|
if (t === 0)
|
|
964
1047
|
return e[0].t = 0, e[0];
|
|
965
1048
|
const s = e.length - 1;
|
|
@@ -976,112 +1059,118 @@ const R = (e) => {
|
|
|
976
1059
|
t
|
|
977
1060
|
};
|
|
978
1061
|
const i = r * r, o = t * t;
|
|
979
|
-
let
|
|
980
|
-
return s === 2 ? (n = [n[0], n[1], n[2], { x: 0, y: 0 }],
|
|
981
|
-
x:
|
|
982
|
-
y:
|
|
1062
|
+
let l = 0, c = 0, a = 0, u = 0;
|
|
1063
|
+
return s === 2 ? (n = [n[0], n[1], n[2], { x: 0, y: 0 }], l = i, c = r * t * 2, a = o) : s === 3 && (l = i * r, c = i * t * 3, a = r * o * 3, u = t * o), {
|
|
1064
|
+
x: l * n[0].x + c * n[1].x + a * n[2].x + u * n[3].x,
|
|
1065
|
+
y: l * n[0].y + c * n[1].y + a * n[2].y + u * n[3].y,
|
|
983
1066
|
t
|
|
984
1067
|
};
|
|
985
|
-
},
|
|
1068
|
+
}, Ne = (e, t) => {
|
|
986
1069
|
const s = e(t), r = s.x * s.x + s.y * s.y;
|
|
987
1070
|
return Math.sqrt(r);
|
|
988
|
-
},
|
|
989
|
-
const s =
|
|
1071
|
+
}, Le = (e) => {
|
|
1072
|
+
const s = Rt.length;
|
|
990
1073
|
let r = 0;
|
|
991
1074
|
for (let n = 0, i; n < s; n++)
|
|
992
|
-
i = 0.5 *
|
|
1075
|
+
i = 0.5 * Rt[n] + 0.5, r += Ae[n] * Ne(e, i);
|
|
993
1076
|
return 0.5 * r;
|
|
994
|
-
},
|
|
1077
|
+
}, mt = (e) => {
|
|
995
1078
|
const t = [];
|
|
996
1079
|
for (let r = 0, n = e.length, i = 2; r < n; r += i)
|
|
997
1080
|
t.push({
|
|
998
1081
|
x: e[r],
|
|
999
1082
|
y: e[r + 1]
|
|
1000
1083
|
});
|
|
1001
|
-
const s =
|
|
1002
|
-
return
|
|
1003
|
-
},
|
|
1084
|
+
const s = Me(t);
|
|
1085
|
+
return Le((r) => we(s[0], r));
|
|
1086
|
+
}, ve = 1e-8, gt = ([e, t, s]) => {
|
|
1004
1087
|
const r = Math.min(e, s), n = Math.max(e, s);
|
|
1005
1088
|
if (t >= e ? s >= t : s <= t)
|
|
1006
1089
|
return [r, n];
|
|
1007
1090
|
const i = (e * s - t * t) / (e - 2 * t + s);
|
|
1008
1091
|
return i < r ? [i, n] : [r, i];
|
|
1009
|
-
},
|
|
1092
|
+
}, St = ([e, t, s, r]) => {
|
|
1010
1093
|
const n = e - 3 * t + 3 * s - r;
|
|
1011
|
-
if (Math.abs(n) <
|
|
1012
|
-
return e === r && e === t ? [e, r] :
|
|
1094
|
+
if (Math.abs(n) < ve)
|
|
1095
|
+
return e === r && e === t ? [e, r] : gt([e, -0.5 * e + 1.5 * t, e - 3 * t + 3 * s]);
|
|
1013
1096
|
const i = -e * s + e * r - t * s - t * r + t * t + s * s;
|
|
1014
1097
|
if (i <= 0)
|
|
1015
1098
|
return [Math.min(e, r), Math.max(e, r)];
|
|
1016
1099
|
const o = Math.sqrt(i);
|
|
1017
|
-
let
|
|
1018
|
-
const
|
|
1019
|
-
for (let u = (
|
|
1100
|
+
let l = Math.min(e, r), c = Math.max(e, r);
|
|
1101
|
+
const a = e - 2 * t + s;
|
|
1102
|
+
for (let u = (a + o) / n, m = 1; m <= 2; u = (a - o) / n, m++)
|
|
1020
1103
|
if (u > 0 && u < 1) {
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1104
|
+
const h = e * (1 - u) * (1 - u) * (1 - u) + t * 3 * (1 - u) * (1 - u) * u + s * 3 * (1 - u) * u * u + r * u * u * u;
|
|
1105
|
+
h < l && (l = h), h > c && (c = h);
|
|
1023
1106
|
}
|
|
1024
|
-
return [
|
|
1025
|
-
},
|
|
1026
|
-
const
|
|
1107
|
+
return [l, c];
|
|
1108
|
+
}, Ce = ([e, t, s, r, n, i, o, l], c) => {
|
|
1109
|
+
const a = 1 - c;
|
|
1027
1110
|
return {
|
|
1028
|
-
x:
|
|
1029
|
-
y:
|
|
1111
|
+
x: a ** 3 * e + 3 * a ** 2 * c * s + 3 * a * c ** 2 * n + c ** 3 * o,
|
|
1112
|
+
y: a ** 3 * t + 3 * a ** 2 * c * r + 3 * a * c ** 2 * i + c ** 3 * l
|
|
1030
1113
|
};
|
|
1031
|
-
},
|
|
1032
|
-
const
|
|
1114
|
+
}, xt = (e, t, s, r, n, i, o, l) => mt([e, t, s, r, n, i, o, l]), Te = (e, t, s, r, n, i, o, l, c) => {
|
|
1115
|
+
const a = typeof c == "number";
|
|
1033
1116
|
let u = { x: e, y: t };
|
|
1034
|
-
if (
|
|
1035
|
-
const m =
|
|
1036
|
-
c <= 0 || (c >= m ? u = { x: o, y:
|
|
1117
|
+
if (a) {
|
|
1118
|
+
const m = mt([e, t, s, r, n, i, o, l]);
|
|
1119
|
+
c <= 0 || (c >= m ? u = { x: o, y: l } : u = Ce(
|
|
1120
|
+
[e, t, s, r, n, i, o, l],
|
|
1121
|
+
c / m
|
|
1122
|
+
));
|
|
1037
1123
|
}
|
|
1038
1124
|
return u;
|
|
1039
|
-
},
|
|
1040
|
-
const c =
|
|
1125
|
+
}, jt = (e, t, s, r, n, i, o, l) => {
|
|
1126
|
+
const c = St([e, s, n, o]), a = St([t, r, i, l]);
|
|
1127
|
+
return [c[0], a[0], c[1], a[1]];
|
|
1128
|
+
}, $e = ([e, t, s, r, n, i], o) => {
|
|
1129
|
+
const l = 1 - o;
|
|
1041
1130
|
return {
|
|
1042
|
-
|
|
1043
|
-
|
|
1131
|
+
x: l ** 2 * e + 2 * l * o * s + o ** 2 * n,
|
|
1132
|
+
y: l ** 2 * t + 2 * l * o * r + o ** 2 * i
|
|
1044
1133
|
};
|
|
1045
|
-
},
|
|
1046
|
-
const
|
|
1047
|
-
return {
|
|
1048
|
-
x: a ** 2 * e + 2 * a * o * s + o ** 2 * n,
|
|
1049
|
-
y: a ** 2 * t + 2 * a * o * r + o ** 2 * i
|
|
1050
|
-
};
|
|
1051
|
-
}, Ft = (e, t, s, r, n, i) => ft([e, t, s, r, n, i]), $e = (e, t, s, r, n, i, o) => {
|
|
1052
|
-
const a = typeof o == "number";
|
|
1134
|
+
}, pt = (e, t, s, r, n, i) => mt([e, t, s, r, n, i]), ze = (e, t, s, r, n, i, o) => {
|
|
1135
|
+
const l = typeof o == "number";
|
|
1053
1136
|
let c = { x: e, y: t };
|
|
1054
|
-
if (
|
|
1055
|
-
const
|
|
1056
|
-
o <= 0 || (o >=
|
|
1137
|
+
if (l) {
|
|
1138
|
+
const a = mt([e, t, s, r, n, i]);
|
|
1139
|
+
o <= 0 || (o >= a ? c = { x: n, y: i } : c = $e(
|
|
1140
|
+
[e, t, s, r, n, i],
|
|
1141
|
+
o / a
|
|
1142
|
+
));
|
|
1057
1143
|
}
|
|
1058
1144
|
return c;
|
|
1059
|
-
},
|
|
1060
|
-
const o =
|
|
1061
|
-
return
|
|
1062
|
-
|
|
1063
|
-
max: { x: o[1], y: a[1] }
|
|
1064
|
-
};
|
|
1065
|
-
}, _e = (e) => {
|
|
1145
|
+
}, Qt = (e, t, s, r, n, i) => {
|
|
1146
|
+
const o = gt([e, s, n]), l = gt([t, r, i]);
|
|
1147
|
+
return [o[0], l[0], o[1], l[1]];
|
|
1148
|
+
}, He = (e) => {
|
|
1066
1149
|
const t = e.length;
|
|
1067
1150
|
let s = -1, r, n = e[t - 1], i = 0;
|
|
1068
1151
|
for (; ++s < t; )
|
|
1069
1152
|
r = n, n = e[s], i += r[1] * n[0] - r[0] * n[1];
|
|
1070
1153
|
return i / 2;
|
|
1071
|
-
}, Fe = (e) => e.reduce((t, s, r) => r ? t +
|
|
1072
|
-
const t =
|
|
1073
|
-
return
|
|
1154
|
+
}, Fe = (e) => e.reduce((t, s, r) => r ? t + Nt(e[r - 1], s) : 0, 0), bt = 1e-5, ot = (e) => {
|
|
1155
|
+
const t = Q(e), s = { ...ut };
|
|
1156
|
+
return Z(t, (r, n, i, o) => {
|
|
1074
1157
|
s.x = i, s.y = o;
|
|
1075
|
-
const
|
|
1076
|
-
return s.x1 = +
|
|
1158
|
+
const l = wt(r, s), c = l.length;
|
|
1159
|
+
return s.x1 = +l[c - 2], s.y1 = +l[c - 1], s.x2 = +l[c - 4] || s.x1, s.y2 = +l[c - 3] || s.y1, l;
|
|
1077
1160
|
});
|
|
1078
|
-
},
|
|
1079
|
-
const s =
|
|
1080
|
-
let r = !1, n = [], i = "M", o = 0,
|
|
1161
|
+
}, rt = (e, t) => {
|
|
1162
|
+
const s = ot(e);
|
|
1163
|
+
let r = !1, n = [], i = "M", o = 0, l = 0, [c, a] = s[0].slice(1);
|
|
1081
1164
|
const u = typeof t == "number";
|
|
1082
|
-
let m = { x: c, y:
|
|
1083
|
-
return !u || t < bt ? m : (
|
|
1084
|
-
if ([i] =
|
|
1165
|
+
let m = { x: c, y: a }, h = 0, g = m, f = 0;
|
|
1166
|
+
return !u || t < bt ? m : (Z(s, (y, p, M, N) => {
|
|
1167
|
+
if ([i] = y, r = i === "M", n = r ? n : [M, N].concat(y.slice(1)), r ? ([, c, a] = y, m = { x: c, y: a }, h = 0) : i === "L" ? (m = Ht(
|
|
1168
|
+
n[0],
|
|
1169
|
+
n[1],
|
|
1170
|
+
n[2],
|
|
1171
|
+
n[3],
|
|
1172
|
+
t - f
|
|
1173
|
+
), h = it(n[0], n[1], n[2], n[3])) : i === "A" ? (m = be(
|
|
1085
1174
|
n[0],
|
|
1086
1175
|
n[1],
|
|
1087
1176
|
n[2],
|
|
@@ -1091,8 +1180,18 @@ const R = (e) => {
|
|
|
1091
1180
|
n[6],
|
|
1092
1181
|
n[7],
|
|
1093
1182
|
n[8],
|
|
1094
|
-
t -
|
|
1095
|
-
),
|
|
1183
|
+
t - f
|
|
1184
|
+
), h = _t(
|
|
1185
|
+
n[0],
|
|
1186
|
+
n[1],
|
|
1187
|
+
n[2],
|
|
1188
|
+
n[3],
|
|
1189
|
+
n[4],
|
|
1190
|
+
n[5],
|
|
1191
|
+
n[6],
|
|
1192
|
+
n[7],
|
|
1193
|
+
n[8]
|
|
1194
|
+
)) : i === "C" ? (m = Te(
|
|
1096
1195
|
n[0],
|
|
1097
1196
|
n[1],
|
|
1098
1197
|
n[2],
|
|
@@ -1101,74 +1200,164 @@ const R = (e) => {
|
|
|
1101
1200
|
n[5],
|
|
1102
1201
|
n[6],
|
|
1103
1202
|
n[7],
|
|
1104
|
-
t -
|
|
1105
|
-
),
|
|
1106
|
-
|
|
1203
|
+
t - f
|
|
1204
|
+
), h = xt(
|
|
1205
|
+
n[0],
|
|
1206
|
+
n[1],
|
|
1207
|
+
n[2],
|
|
1208
|
+
n[3],
|
|
1209
|
+
n[4],
|
|
1210
|
+
n[5],
|
|
1211
|
+
n[6],
|
|
1212
|
+
n[7]
|
|
1213
|
+
)) : i === "Q" ? (m = ze(
|
|
1214
|
+
n[0],
|
|
1215
|
+
n[1],
|
|
1216
|
+
n[2],
|
|
1217
|
+
n[3],
|
|
1218
|
+
n[4],
|
|
1219
|
+
n[5],
|
|
1220
|
+
t - f
|
|
1221
|
+
), h = pt(
|
|
1222
|
+
n[0],
|
|
1223
|
+
n[1],
|
|
1224
|
+
n[2],
|
|
1225
|
+
n[3],
|
|
1226
|
+
n[4],
|
|
1227
|
+
n[5]
|
|
1228
|
+
)) : i === "Z" && (n = [M, N, c, a], m = { x: c, y: a }, h = it(n[0], n[1], n[2], n[3])), [o, l] = n.slice(-2), f < t)
|
|
1229
|
+
g = m;
|
|
1107
1230
|
else
|
|
1108
1231
|
return !1;
|
|
1109
|
-
|
|
1110
|
-
}), t >
|
|
1111
|
-
},
|
|
1112
|
-
const t =
|
|
1113
|
-
let r =
|
|
1114
|
-
return
|
|
1115
|
-
|
|
1116
|
-
const
|
|
1117
|
-
[
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1232
|
+
f += h;
|
|
1233
|
+
}), t > f - bt ? { x: o, y: l } : g);
|
|
1234
|
+
}, nt = (e) => {
|
|
1235
|
+
const t = Q(e);
|
|
1236
|
+
let s = 0, r = 0, n = 0, i = 0, o = 0, l = 0, c = "M", a = 0, u = 0, m = 0;
|
|
1237
|
+
return Z(t, (h, g, f, y) => {
|
|
1238
|
+
[c] = h;
|
|
1239
|
+
const p = c.toUpperCase(), N = p !== c ? at(h, g, f, y) : h.slice(0), x = p === "V" ? ["L", f, N[1]] : p === "H" ? ["L", N[1], y] : N;
|
|
1240
|
+
if ([c] = x, "TQ".includes(p) || (o = 0, l = 0), c === "M")
|
|
1241
|
+
[, a, u] = x;
|
|
1242
|
+
else if (c === "L")
|
|
1243
|
+
m += it(
|
|
1244
|
+
f,
|
|
1245
|
+
y,
|
|
1246
|
+
x[1],
|
|
1247
|
+
x[2]
|
|
1248
|
+
);
|
|
1249
|
+
else if (c === "A")
|
|
1250
|
+
m += _t(
|
|
1251
|
+
f,
|
|
1252
|
+
y,
|
|
1253
|
+
x[1],
|
|
1254
|
+
x[2],
|
|
1255
|
+
x[3],
|
|
1256
|
+
x[4],
|
|
1257
|
+
x[5],
|
|
1258
|
+
x[6],
|
|
1259
|
+
x[7]
|
|
1260
|
+
);
|
|
1261
|
+
else if (c === "S") {
|
|
1262
|
+
const b = s * 2 - n, L = r * 2 - i;
|
|
1263
|
+
m += xt(
|
|
1264
|
+
f,
|
|
1265
|
+
y,
|
|
1266
|
+
b,
|
|
1267
|
+
L,
|
|
1268
|
+
x[1],
|
|
1269
|
+
x[2],
|
|
1270
|
+
x[3],
|
|
1271
|
+
x[4]
|
|
1272
|
+
);
|
|
1273
|
+
} else c === "C" ? m += xt(
|
|
1274
|
+
f,
|
|
1275
|
+
y,
|
|
1276
|
+
x[1],
|
|
1277
|
+
x[2],
|
|
1278
|
+
x[3],
|
|
1279
|
+
x[4],
|
|
1280
|
+
x[5],
|
|
1281
|
+
x[6]
|
|
1282
|
+
) : c === "T" ? (o = s * 2 - o, l = r * 2 - l, m += pt(
|
|
1283
|
+
f,
|
|
1284
|
+
y,
|
|
1285
|
+
o,
|
|
1286
|
+
l,
|
|
1287
|
+
x[1],
|
|
1288
|
+
x[2]
|
|
1289
|
+
)) : c === "Q" ? (o = x[1], l = x[2], m += pt(
|
|
1290
|
+
f,
|
|
1291
|
+
y,
|
|
1292
|
+
x[1],
|
|
1293
|
+
x[2],
|
|
1294
|
+
x[3],
|
|
1295
|
+
x[4]
|
|
1296
|
+
)) : c === "Z" && (m += it(f, y, a, u));
|
|
1297
|
+
[s, r] = c === "Z" ? [a, u] : x.slice(-2), [n, i] = c === "C" ? [x[3], x[4]] : c === "S" ? [x[1], x[2]] : [s, r];
|
|
1298
|
+
}), m;
|
|
1299
|
+
}, Ut = (e, t) => {
|
|
1300
|
+
const s = Q(e);
|
|
1301
|
+
let r = s.slice(0), n = nt(r), i = r.length - 1, o = 0, l = 0, c = s[0];
|
|
1124
1302
|
if (i <= 0 || !t || !Number.isFinite(t))
|
|
1125
1303
|
return {
|
|
1126
1304
|
segment: c,
|
|
1127
1305
|
index: 0,
|
|
1128
|
-
length:
|
|
1306
|
+
length: l,
|
|
1129
1307
|
lengthAtSegment: o
|
|
1130
1308
|
};
|
|
1131
1309
|
if (t >= n)
|
|
1132
|
-
return r = s.slice(0, -1), o =
|
|
1310
|
+
return r = s.slice(0, -1), o = nt(r), l = n - o, c = s[i], {
|
|
1133
1311
|
segment: c,
|
|
1134
1312
|
index: i,
|
|
1135
|
-
length:
|
|
1313
|
+
length: l,
|
|
1136
1314
|
lengthAtSegment: o
|
|
1137
1315
|
};
|
|
1138
|
-
const
|
|
1316
|
+
const a = [];
|
|
1139
1317
|
for (; i > 0; )
|
|
1140
|
-
c = r[i], r = r.slice(0, -1), o =
|
|
1318
|
+
c = r[i], r = r.slice(0, -1), o = nt(r), l = n - o, n = o, a.push({
|
|
1141
1319
|
segment: c,
|
|
1142
1320
|
index: i,
|
|
1143
|
-
length:
|
|
1321
|
+
length: l,
|
|
1144
1322
|
lengthAtSegment: o
|
|
1145
1323
|
}), i -= 1;
|
|
1146
|
-
return
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1324
|
+
return a.find(
|
|
1325
|
+
({ lengthAtSegment: u }) => u <= t
|
|
1326
|
+
);
|
|
1327
|
+
}, vt = (e, t) => {
|
|
1328
|
+
const s = Q(e), r = ot(s), n = nt(r), i = (b) => {
|
|
1329
|
+
const L = b.x - t.x, C = b.y - t.y;
|
|
1330
|
+
return L * L + C * C;
|
|
1151
1331
|
};
|
|
1152
|
-
let o = 8,
|
|
1153
|
-
for (let
|
|
1154
|
-
|
|
1332
|
+
let o = 8, l, c = { x: 0, y: 0 }, a = 0, u = 0, m = 1 / 0;
|
|
1333
|
+
for (let b = 0; b <= n; b += o)
|
|
1334
|
+
l = rt(r, b), a = i(l), a < m && (c = l, u = b, m = a);
|
|
1155
1335
|
o /= 2;
|
|
1156
|
-
let
|
|
1157
|
-
for (; o > 1e-6 && (
|
|
1336
|
+
let h, g, f = 0, y = 0, p = 0, M = 0;
|
|
1337
|
+
for (; o > 1e-6 && (f = u - o, h = rt(r, f), p = i(h), y = u + o, g = rt(r, y), M = i(g), f >= 0 && p < m ? (c = h, u = f, m = p) : y <= n && M < m ? (c = g, u = y, m = M) : o /= 2, !(o < 1e-5)); )
|
|
1158
1338
|
;
|
|
1159
|
-
const
|
|
1160
|
-
return { closest: c, distance:
|
|
1161
|
-
},
|
|
1339
|
+
const N = Ut(s, u), x = Math.sqrt(m);
|
|
1340
|
+
return { closest: c, distance: x, segment: N };
|
|
1341
|
+
}, _e = (e, t) => vt(e, t).closest, Ue = (e, t, s, r, n, i, o, l) => 3 * ((l - t) * (s + n) - (o - e) * (r + i) + r * (e - n) - s * (t - i) + l * (n + e / 3) - o * (i + t / 3)) / 20, qe = (e) => {
|
|
1162
1342
|
let t = 0, s = 0, r = 0;
|
|
1163
|
-
return
|
|
1343
|
+
return yt(e).map((n) => {
|
|
1164
1344
|
switch (n[0]) {
|
|
1165
1345
|
case "M":
|
|
1166
1346
|
return [, t, s] = n, 0;
|
|
1167
1347
|
default:
|
|
1168
|
-
return r = Ue(
|
|
1348
|
+
return r = Ue(
|
|
1349
|
+
t,
|
|
1350
|
+
s,
|
|
1351
|
+
n[1],
|
|
1352
|
+
n[2],
|
|
1353
|
+
n[3],
|
|
1354
|
+
n[4],
|
|
1355
|
+
n[5],
|
|
1356
|
+
n[6]
|
|
1357
|
+
), [t, s] = n.slice(-2), r;
|
|
1169
1358
|
}
|
|
1170
1359
|
}).reduce((n, i) => n + i, 0);
|
|
1171
|
-
},
|
|
1360
|
+
}, Je = (e) => qe(yt(e)) >= 0, Wt = (e) => {
|
|
1172
1361
|
if (!e)
|
|
1173
1362
|
return {
|
|
1174
1363
|
x: 0,
|
|
@@ -1181,49 +1370,101 @@ const R = (e) => {
|
|
|
1181
1370
|
cy: 0,
|
|
1182
1371
|
cz: 0
|
|
1183
1372
|
};
|
|
1184
|
-
const t =
|
|
1185
|
-
let s =
|
|
1186
|
-
const
|
|
1187
|
-
let
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1373
|
+
const t = Q(e);
|
|
1374
|
+
let s = "M", r = 0, n = 0;
|
|
1375
|
+
const { max: i, min: o } = Math;
|
|
1376
|
+
let l = 1 / 0, c = 1 / 0, a = -1 / 0, u = -1 / 0, m = 0, h = 0, g = 0, f = 0, y = 0, p = 0, M = 0, N = 0, x = 0, b = 0;
|
|
1377
|
+
Z(t, (I, R, P, z) => {
|
|
1378
|
+
[s] = I;
|
|
1379
|
+
const D = s.toUpperCase(), q = D !== s ? at(I, R, P, z) : I.slice(0), w = D === "V" ? ["L", P, q[1]] : D === "H" ? ["L", q[1], z] : q;
|
|
1380
|
+
if ([s] = w, "TQ".includes(D) || (x = 0, b = 0), s === "M")
|
|
1381
|
+
[, r, n] = w, m = r, h = n, g = r, f = n;
|
|
1382
|
+
else if (s === "L")
|
|
1383
|
+
[m, h, g, f] = It(
|
|
1384
|
+
P,
|
|
1385
|
+
z,
|
|
1386
|
+
w[1],
|
|
1387
|
+
w[2]
|
|
1388
|
+
);
|
|
1389
|
+
else if (s === "A")
|
|
1390
|
+
[m, h, g, f] = de(
|
|
1391
|
+
P,
|
|
1392
|
+
z,
|
|
1393
|
+
w[1],
|
|
1394
|
+
w[2],
|
|
1395
|
+
w[3],
|
|
1396
|
+
w[4],
|
|
1397
|
+
w[5],
|
|
1398
|
+
w[6],
|
|
1399
|
+
w[7]
|
|
1400
|
+
);
|
|
1401
|
+
else if (s === "S") {
|
|
1402
|
+
const $ = y * 2 - M, E = p * 2 - N;
|
|
1403
|
+
[m, h, g, f] = jt(
|
|
1404
|
+
P,
|
|
1405
|
+
z,
|
|
1406
|
+
$,
|
|
1407
|
+
E,
|
|
1408
|
+
w[1],
|
|
1409
|
+
w[2],
|
|
1410
|
+
w[3],
|
|
1411
|
+
w[4]
|
|
1412
|
+
);
|
|
1413
|
+
} else s === "C" ? [m, h, g, f] = jt(
|
|
1414
|
+
P,
|
|
1415
|
+
z,
|
|
1416
|
+
w[1],
|
|
1417
|
+
w[2],
|
|
1418
|
+
w[3],
|
|
1419
|
+
w[4],
|
|
1420
|
+
w[5],
|
|
1421
|
+
w[6]
|
|
1422
|
+
) : s === "T" ? (x = y * 2 - x, b = p * 2 - b, [m, h, g, f] = Qt(
|
|
1423
|
+
P,
|
|
1424
|
+
z,
|
|
1425
|
+
x,
|
|
1426
|
+
b,
|
|
1427
|
+
w[1],
|
|
1428
|
+
w[2]
|
|
1429
|
+
)) : s === "Q" ? (x = w[1], b = w[2], [m, h, g, f] = Qt(
|
|
1430
|
+
P,
|
|
1431
|
+
z,
|
|
1432
|
+
w[1],
|
|
1433
|
+
w[2],
|
|
1434
|
+
w[3],
|
|
1435
|
+
w[4]
|
|
1436
|
+
)) : s === "Z" && ([m, h, g, f] = It(P, z, r, n));
|
|
1437
|
+
l = o(m, l), c = o(h, c), a = i(g, a), u = i(f, u), [y, p] = s === "Z" ? [r, n] : w.slice(-2), [M, N] = s === "C" ? [w[3], w[4]] : s === "S" ? [w[1], w[2]] : [y, p];
|
|
1197
1438
|
});
|
|
1198
|
-
const
|
|
1439
|
+
const L = a - l, C = u - c;
|
|
1199
1440
|
return {
|
|
1200
|
-
width:
|
|
1201
|
-
height:
|
|
1202
|
-
x:
|
|
1203
|
-
y:
|
|
1204
|
-
x2:
|
|
1205
|
-
y2:
|
|
1206
|
-
cx:
|
|
1207
|
-
cy:
|
|
1441
|
+
width: L,
|
|
1442
|
+
height: C,
|
|
1443
|
+
x: l,
|
|
1444
|
+
y: c,
|
|
1445
|
+
x2: a,
|
|
1446
|
+
y2: u,
|
|
1447
|
+
cx: l + L / 2,
|
|
1448
|
+
cy: c + C / 2,
|
|
1208
1449
|
// an estimated guess
|
|
1209
|
-
cz: Math.max(
|
|
1450
|
+
cz: Math.max(L, C) + Math.min(L, C) / 2
|
|
1210
1451
|
};
|
|
1211
|
-
},
|
|
1452
|
+
}, Ke = (e, t) => Ut(e, t).segment, We = (e, t) => vt(e, t).segment, Ct = (e) => Array.isArray(e) && e.every((t) => {
|
|
1212
1453
|
const s = t[0].toLowerCase();
|
|
1213
|
-
return
|
|
1214
|
-
}) && e.length > 0,
|
|
1215
|
-
e.every(([t]) => t === t.toUpperCase()), ke = (e) =>
|
|
1216
|
-
const { distance: s } =
|
|
1454
|
+
return tt[s] === t.length - 1 && "achlmqstvz".includes(s) && t.slice(1).every(Number.isFinite);
|
|
1455
|
+
}) && e.length > 0, Pe = (e) => Ct(e) && // `isPathArray` also checks if it's `Array`
|
|
1456
|
+
e.every(([t]) => t === t.toUpperCase()), ke = (e) => Pe(e) && e.every(([t]) => "ACLMQZ".includes(t)), Xe = (e) => ke(e) && e.every(([t]) => "MC".includes(t)), Ye = (e, t) => {
|
|
1457
|
+
const { distance: s } = vt(e, t);
|
|
1217
1458
|
return Math.abs(s) < bt;
|
|
1218
|
-
}, Ve = (e) =>
|
|
1459
|
+
}, Ve = (e) => Ct(e) && // `isPathArray` checks if it's `Array`
|
|
1219
1460
|
e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
1220
1461
|
if (typeof e != "string" || !e.length)
|
|
1221
1462
|
return !1;
|
|
1222
|
-
const t = new
|
|
1223
|
-
for (
|
|
1224
|
-
|
|
1463
|
+
const t = new Ot(e);
|
|
1464
|
+
for (et(t); t.index < t.max && !t.err.length; )
|
|
1465
|
+
Dt(t);
|
|
1225
1466
|
return !t.err.length && "mM".includes(t.segments[0][0]);
|
|
1226
|
-
},
|
|
1467
|
+
}, ct = {
|
|
1227
1468
|
line: ["x1", "y1", "x2", "y2"],
|
|
1228
1469
|
circle: ["cx", "cy", "r"],
|
|
1229
1470
|
ellipse: ["cx", "cy", "rx", "ry"],
|
|
@@ -1273,87 +1514,106 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1273
1514
|
]) : [["M", t, s], ["h", r], ["v", n], ["H", t], ["Z"]];
|
|
1274
1515
|
}, Ee = (e, t) => {
|
|
1275
1516
|
const r = (t || document).defaultView || /* istanbul ignore next */
|
|
1276
|
-
window, n = Object.keys(
|
|
1517
|
+
window, n = Object.keys(ct), i = e instanceof r.SVGElement, o = i ? e.tagName : null;
|
|
1277
1518
|
if (o && [...n, "path"].every((m) => o !== m))
|
|
1278
|
-
throw TypeError(`${
|
|
1279
|
-
const
|
|
1519
|
+
throw TypeError(`${j}: "${o}" is not SVGElement`);
|
|
1520
|
+
const l = i ? o : e.type, c = ct[l], a = { type: l };
|
|
1280
1521
|
i ? c.forEach((m) => {
|
|
1281
|
-
|
|
1282
|
-
}) : Object.assign(
|
|
1522
|
+
a[m] = e.getAttribute(m);
|
|
1523
|
+
}) : Object.assign(a, e);
|
|
1283
1524
|
let u = [];
|
|
1284
|
-
return
|
|
1525
|
+
return l === "circle" ? u = en(a) : l === "ellipse" ? u = nn(a) : ["polyline", "polygon"].includes(l) ? u = tn(a) : l === "rect" ? u = sn(a) : l === "line" ? u = Ge(a) : ["glyph", "path"].includes(l) && (u = Q(
|
|
1285
1526
|
i ? e.getAttribute("d") || /* istanbul ignore next @preserve */
|
|
1286
1527
|
"" : e.d || ""
|
|
1287
|
-
)),
|
|
1528
|
+
)), Ct(u) && u.length ? u : !1;
|
|
1288
1529
|
}, rn = (e, t, s) => {
|
|
1289
1530
|
const r = s || document, n = r.defaultView || /* istanbul ignore next */
|
|
1290
|
-
window, i = Object.keys(
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
})
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1531
|
+
window, i = Object.keys(ct), o = e instanceof n.SVGElement, l = o ? e.tagName : null;
|
|
1532
|
+
if (l === "path")
|
|
1533
|
+
throw TypeError(`${j}: "${l}" is already SVGPathElement`);
|
|
1534
|
+
if (l && i.every((y) => l !== y))
|
|
1535
|
+
throw TypeError(`${j}: "${l}" is not SVGElement`);
|
|
1536
|
+
const c = r.createElementNS("http://www.w3.org/2000/svg", "path"), a = o ? l : e.type, u = ct[a], m = { type: a }, h = V.round, g = Ee(e, r), f = g && g.length ? kt(g, h) : "";
|
|
1537
|
+
return o ? (u.forEach((y) => {
|
|
1538
|
+
m[y] = e.getAttribute(y);
|
|
1539
|
+
}), Object.values(e.attributes).forEach(({ name: y, value: p }) => {
|
|
1540
|
+
u.includes(y) || c.setAttribute(y, p);
|
|
1541
|
+
})) : (Object.assign(m, e), Object.keys(m).forEach((y) => {
|
|
1542
|
+
!u.includes(y) && y !== "type" && c.setAttribute(
|
|
1543
|
+
y.replace(/[A-Z]/g, (p) => `-${p.toLowerCase()}`),
|
|
1544
|
+
m[y]
|
|
1302
1545
|
);
|
|
1303
|
-
})), Ie(
|
|
1546
|
+
})), Ie(f) ? (c.setAttribute("d", f), t && o && (e.before(c, e), e.remove()), c) : !1;
|
|
1304
1547
|
}, Re = (e) => {
|
|
1305
|
-
let t = new
|
|
1306
|
-
const { origin: s } = e, [r, n] = s, { translate: i } = e, { rotate: o } = e, { skew:
|
|
1307
|
-
return Array.isArray(i) && i.length >= 2 && i.every((
|
|
1308
|
-
|
|
1548
|
+
let t = new T();
|
|
1549
|
+
const { origin: s } = e, [r, n] = s, { translate: i } = e, { rotate: o } = e, { skew: l } = e, { scale: c } = e;
|
|
1550
|
+
return Array.isArray(i) && i.length >= 2 && i.every((a) => !Number.isNaN(+a)) && i.some((a) => a !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || l || c) && (t = t.translate(r, n), Array.isArray(o) && o.length >= 2 && o.every((a) => !Number.isNaN(+a)) && o.some((a) => a !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(l) && l.length === 2 && l.every(
|
|
1551
|
+
(a) => !Number.isNaN(+a)
|
|
1552
|
+
) && l.some((a) => a !== 0) ? (t = l[0] ? t.skewX(l[0]) : t, t = l[1] ? t.skewY(l[1]) : t) : typeof l == "number" && !Number.isNaN(l) && (t = t.skewX(l)), Array.isArray(c) && c.length >= 2 && c.every(
|
|
1553
|
+
(a) => !Number.isNaN(+a)
|
|
1554
|
+
) && c.some((a) => a !== 1) ? t = t.scale(...c) : typeof c == "number" && !Number.isNaN(c) && (t = t.scale(c)), t = t.translate(-r, -n)), t;
|
|
1555
|
+
}, Se = (e, t, s, r) => {
|
|
1309
1556
|
const [n] = e, { round: i } = V, o = typeof i == "number" ? i : (
|
|
1310
1557
|
/* istanbul ignore next */
|
|
1311
1558
|
4
|
|
1312
|
-
),
|
|
1559
|
+
), l = t.slice(1), { x1: c, y1: a, x2: u, y2: m, x: h, y: g } = s, [f, y] = l.slice(-2), p = e;
|
|
1313
1560
|
if ("TQ".includes(n) || (s.qx = null, s.qy = null), n === "L") {
|
|
1314
|
-
if (
|
|
1315
|
-
return ["V",
|
|
1316
|
-
if (
|
|
1317
|
-
return ["H",
|
|
1561
|
+
if (k(h, o) === k(f, o))
|
|
1562
|
+
return ["V", y];
|
|
1563
|
+
if (k(g, o) === k(y, o))
|
|
1564
|
+
return ["H", f];
|
|
1318
1565
|
} else if (n === "C") {
|
|
1319
|
-
const [
|
|
1320
|
-
if (s.x1 =
|
|
1321
|
-
return [
|
|
1566
|
+
const [M, N] = l;
|
|
1567
|
+
if (s.x1 = M, s.y1 = N, "CS".includes(r) && (k(M, o) === k(c * 2 - u, o) && k(N, o) === k(a * 2 - m, o) || k(c, o) === k(u * 2 - h, o) && k(a, o) === k(m * 2 - g, o)))
|
|
1568
|
+
return [
|
|
1569
|
+
"S",
|
|
1570
|
+
l[2],
|
|
1571
|
+
l[3],
|
|
1572
|
+
l[4],
|
|
1573
|
+
l[5]
|
|
1574
|
+
];
|
|
1322
1575
|
} else if (n === "Q") {
|
|
1323
|
-
const [
|
|
1324
|
-
if (s.qx =
|
|
1325
|
-
return ["T",
|
|
1576
|
+
const [M, N] = l;
|
|
1577
|
+
if (s.qx = M, s.qy = N, "QT".includes(r) && k(M, o) === k(c * 2 - u, o) && k(N, o) === k(a * 2 - m, o))
|
|
1578
|
+
return ["T", l[2], l[3]];
|
|
1326
1579
|
}
|
|
1327
|
-
return
|
|
1580
|
+
return p;
|
|
1328
1581
|
}, dt = (e, t) => {
|
|
1329
|
-
const s = e.slice(1).map(
|
|
1582
|
+
const s = e.slice(1).map(
|
|
1583
|
+
(r) => k(r, t)
|
|
1584
|
+
);
|
|
1330
1585
|
return [e[0]].concat(s);
|
|
1331
|
-
},
|
|
1332
|
-
const s =
|
|
1586
|
+
}, Xt = (e, t) => {
|
|
1587
|
+
const s = ht(e), r = typeof t == "number" && t >= 0 ? t : (
|
|
1333
1588
|
/* istanbul ignore next @preserve */
|
|
1334
1589
|
2
|
|
1335
|
-
), n = { ...
|
|
1336
|
-
let o = "M",
|
|
1337
|
-
return
|
|
1590
|
+
), n = { ...ut }, i = [];
|
|
1591
|
+
let o = "M", l = "Z";
|
|
1592
|
+
return Z(s, (c, a, u, m) => {
|
|
1338
1593
|
n.x = u, n.y = m;
|
|
1339
|
-
const
|
|
1340
|
-
let
|
|
1341
|
-
if ([o] = c, i[
|
|
1342
|
-
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1594
|
+
const h = wt(c, n);
|
|
1595
|
+
let g = c;
|
|
1596
|
+
if ([o] = c, i[a] = o, a) {
|
|
1597
|
+
l = i[a - 1];
|
|
1598
|
+
const y = Se(
|
|
1599
|
+
c,
|
|
1600
|
+
h,
|
|
1601
|
+
n,
|
|
1602
|
+
l
|
|
1603
|
+
), p = dt(y, r), M = p.join(""), N = Bt(y, a, u, m), x = dt(N, r), b = x.join("");
|
|
1604
|
+
g = M.length < b.length ? p : x;
|
|
1345
1605
|
}
|
|
1346
|
-
const
|
|
1347
|
-
return n.x1 = +f
|
|
1606
|
+
const f = h.length;
|
|
1607
|
+
return n.x1 = +h[f - 2], n.y1 = +h[f - 1], n.x2 = +h[f - 4] || n.x1, n.y2 = +h[f - 3] || n.y1, g;
|
|
1348
1608
|
});
|
|
1349
1609
|
}, on = (e, t) => {
|
|
1350
|
-
let s =
|
|
1610
|
+
let s = T.Translate(t[0], t[1], t[2]);
|
|
1351
1611
|
return [, , , s.m44] = t, s = e.multiply(s), [s.m41, s.m42, s.m43, s.m44];
|
|
1352
|
-
},
|
|
1353
|
-
const [r, n, i] = s, [o,
|
|
1612
|
+
}, Zt = (e, t, s) => {
|
|
1613
|
+
const [r, n, i] = s, [o, l, c] = on(e, [t[0], t[1], 0, 1]), a = o - r, u = l - n, m = c - i;
|
|
1354
1614
|
return [
|
|
1355
1615
|
// protect against division by ZERO
|
|
1356
|
-
|
|
1616
|
+
a * (Math.abs(i) / Math.abs(m) || 1) + r,
|
|
1357
1617
|
u * (Math.abs(i) / Math.abs(m) || 1) + n
|
|
1358
1618
|
];
|
|
1359
1619
|
}, cn = (e) => {
|
|
@@ -1363,110 +1623,158 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
|
1363
1623
|
return [["M"].concat(t[0].slice(0, 2))].concat(
|
|
1364
1624
|
t.map((s) => ["C"].concat(s.slice(2)))
|
|
1365
1625
|
);
|
|
1366
|
-
},
|
|
1367
|
-
const t =
|
|
1368
|
-
const c = s[
|
|
1369
|
-
let
|
|
1370
|
-
switch (
|
|
1626
|
+
}, ft = (e) => {
|
|
1627
|
+
const t = ht(e), s = ot(t), r = t.length, n = t[r - 1][0] === "Z", i = Z(t, (o, l) => {
|
|
1628
|
+
const c = s[l], a = l && t[l - 1], u = a && a[0], m = t[l + 1], h = m && m[0], [g] = o, [f, y] = s[l ? l - 1 : r - 1].slice(-2);
|
|
1629
|
+
let p = o;
|
|
1630
|
+
switch (g) {
|
|
1371
1631
|
case "M":
|
|
1372
|
-
|
|
1632
|
+
p = n ? ["Z"] : [g, f, y];
|
|
1373
1633
|
break;
|
|
1374
1634
|
case "A":
|
|
1375
|
-
|
|
1376
|
-
|
|
1635
|
+
p = [
|
|
1636
|
+
g,
|
|
1377
1637
|
o[1],
|
|
1378
1638
|
o[2],
|
|
1379
1639
|
o[3],
|
|
1380
1640
|
o[4],
|
|
1381
1641
|
o[5] === 1 ? 0 : 1,
|
|
1382
|
-
|
|
1383
|
-
|
|
1642
|
+
f,
|
|
1643
|
+
y
|
|
1384
1644
|
];
|
|
1385
1645
|
break;
|
|
1386
1646
|
case "C":
|
|
1387
|
-
m &&
|
|
1647
|
+
m && h === "S" ? p = ["S", o[1], o[2], f, y] : p = [
|
|
1648
|
+
g,
|
|
1649
|
+
o[3],
|
|
1650
|
+
o[4],
|
|
1651
|
+
o[1],
|
|
1652
|
+
o[2],
|
|
1653
|
+
f,
|
|
1654
|
+
y
|
|
1655
|
+
];
|
|
1388
1656
|
break;
|
|
1389
1657
|
case "S":
|
|
1390
|
-
u && "CS".includes(u) && (!m ||
|
|
1658
|
+
u && "CS".includes(u) && (!m || h !== "S") ? p = [
|
|
1391
1659
|
"C",
|
|
1392
1660
|
c[3],
|
|
1393
1661
|
c[4],
|
|
1394
1662
|
c[1],
|
|
1395
1663
|
c[2],
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
] :
|
|
1664
|
+
f,
|
|
1665
|
+
y
|
|
1666
|
+
] : p = [
|
|
1667
|
+
g,
|
|
1668
|
+
c[1],
|
|
1669
|
+
c[2],
|
|
1670
|
+
f,
|
|
1671
|
+
y
|
|
1672
|
+
];
|
|
1399
1673
|
break;
|
|
1400
1674
|
case "Q":
|
|
1401
|
-
m &&
|
|
1675
|
+
m && h === "T" ? p = ["T", f, y] : p = [g, o[1], o[2], f, y];
|
|
1402
1676
|
break;
|
|
1403
1677
|
case "T":
|
|
1404
|
-
u && "QT".includes(u) && (!m ||
|
|
1678
|
+
u && "QT".includes(u) && (!m || h !== "T") ? p = [
|
|
1679
|
+
"Q",
|
|
1680
|
+
c[1],
|
|
1681
|
+
c[2],
|
|
1682
|
+
f,
|
|
1683
|
+
y
|
|
1684
|
+
] : p = [g, f, y];
|
|
1405
1685
|
break;
|
|
1406
1686
|
case "Z":
|
|
1407
|
-
|
|
1687
|
+
p = ["M", f, y];
|
|
1408
1688
|
break;
|
|
1409
1689
|
case "H":
|
|
1410
|
-
|
|
1690
|
+
p = [g, f];
|
|
1411
1691
|
break;
|
|
1412
1692
|
case "V":
|
|
1413
|
-
|
|
1693
|
+
p = [g, y];
|
|
1414
1694
|
break;
|
|
1415
1695
|
default:
|
|
1416
|
-
|
|
1696
|
+
p = [g].concat(
|
|
1697
|
+
o.slice(1, -2),
|
|
1698
|
+
f,
|
|
1699
|
+
y
|
|
1700
|
+
);
|
|
1417
1701
|
}
|
|
1418
|
-
return
|
|
1702
|
+
return p;
|
|
1419
1703
|
});
|
|
1420
1704
|
return n ? i.reverse() : [i[0]].concat(i.slice(1).reverse());
|
|
1421
|
-
},
|
|
1705
|
+
}, ln = (e, t) => {
|
|
1422
1706
|
let { round: s } = V;
|
|
1423
1707
|
return s = t === "off" || typeof t == "number" && t >= 0 ? t : typeof s == "number" && s >= 0 ? s : (
|
|
1424
1708
|
/* istanbul ignore next @preserve */
|
|
1425
1709
|
"off"
|
|
1426
|
-
), s === "off" ? e.slice(0) :
|
|
1427
|
-
},
|
|
1428
|
-
const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8),
|
|
1710
|
+
), s === "off" ? e.slice(0) : Z(e, (r) => dt(r, s));
|
|
1711
|
+
}, an = (e, t = 0.5) => {
|
|
1712
|
+
const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), l = H(r, n, s), c = H(n, i, s), a = H(i, o, s), u = H(l, c, s), m = H(c, a, s), h = H(u, m, s);
|
|
1429
1713
|
return [
|
|
1430
|
-
["C",
|
|
1431
|
-
["C", m[0], m[1],
|
|
1714
|
+
["C", l[0], l[1], u[0], u[1], h[0], h[1]],
|
|
1715
|
+
["C", m[0], m[1], a[0], a[1], o[0], o[1]]
|
|
1432
1716
|
];
|
|
1433
|
-
},
|
|
1717
|
+
}, Yt = (e) => {
|
|
1434
1718
|
const t = [];
|
|
1435
|
-
let s, r = -1, n = 0, i = 0, o = 0,
|
|
1436
|
-
const c = { ...
|
|
1437
|
-
return e.forEach((
|
|
1438
|
-
const [u] =
|
|
1439
|
-
m === "M" ? (r += 1, [n, i] =
|
|
1719
|
+
let s, r = -1, n = 0, i = 0, o = 0, l = 0;
|
|
1720
|
+
const c = { ...ut };
|
|
1721
|
+
return e.forEach((a) => {
|
|
1722
|
+
const [u] = a, m = u.toUpperCase(), h = u.toLowerCase(), g = u === h, f = a.slice(1);
|
|
1723
|
+
m === "M" ? (r += 1, [n, i] = f, n += g ? c.x : 0, i += g ? c.y : 0, o = n, l = i, s = [g ? [m, o, l] : a]) : (m === "Z" ? (n = o, i = l) : m === "H" ? ([, n] = a, n += g ? c.x : (
|
|
1440
1724
|
/* istanbul ignore next @preserve */
|
|
1441
1725
|
0
|
|
1442
|
-
)) : m === "V" ? ([, i] =
|
|
1726
|
+
)) : m === "V" ? ([, i] = a, i += g ? c.y : (
|
|
1443
1727
|
/* istanbul ignore next @preserve */
|
|
1444
1728
|
0
|
|
1445
|
-
)) : ([n, i] =
|
|
1729
|
+
)) : ([n, i] = a.slice(-2), n += g ? c.x : 0, i += g ? c.y : 0), s.push(a)), c.x = n, c.y = i, t[r] = s;
|
|
1446
1730
|
}), t;
|
|
1447
|
-
},
|
|
1448
|
-
let s = 0, r = 0, n = 0, i = 0, o = 0,
|
|
1449
|
-
const
|
|
1450
|
-
if (!t ||
|
|
1731
|
+
}, Vt = (e, t) => {
|
|
1732
|
+
let s = 0, r = 0, n = 0, i = 0, o = 0, l = 0, c = "M";
|
|
1733
|
+
const a = Q(e), u = t && Object.keys(t);
|
|
1734
|
+
if (!t || u && !u.length)
|
|
1735
|
+
return a.slice(0);
|
|
1451
1736
|
t.origin || Object.assign(t, { origin: V.origin });
|
|
1452
|
-
const
|
|
1453
|
-
return
|
|
1454
|
-
|
|
1455
|
-
const
|
|
1456
|
-
let
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1737
|
+
const m = t.origin, h = Re(t);
|
|
1738
|
+
return h.isIdentity ? a.slice(0) : Z(a, (g, f, y, p) => {
|
|
1739
|
+
[c] = g;
|
|
1740
|
+
const M = c.toUpperCase(), x = M !== c ? at(g, f, y, p) : g.slice(0);
|
|
1741
|
+
let b = M === "A" ? ["C"].concat(
|
|
1742
|
+
Mt(
|
|
1743
|
+
y,
|
|
1744
|
+
p,
|
|
1745
|
+
x[1],
|
|
1746
|
+
x[2],
|
|
1747
|
+
x[3],
|
|
1748
|
+
x[4],
|
|
1749
|
+
x[5],
|
|
1750
|
+
x[6],
|
|
1751
|
+
x[7]
|
|
1752
|
+
)
|
|
1753
|
+
) : M === "V" ? ["L", y, x[1]] : M === "H" ? ["L", x[1], p] : x;
|
|
1754
|
+
c = b[0];
|
|
1755
|
+
const L = c === "C" && b.length > 7, C = L ? b.slice(0, 7) : b.slice(0);
|
|
1756
|
+
if (L && (a.splice(
|
|
1757
|
+
f + 1,
|
|
1758
|
+
0,
|
|
1759
|
+
["C"].concat(
|
|
1760
|
+
b.slice(7)
|
|
1761
|
+
)
|
|
1762
|
+
), b = C), c === "L")
|
|
1763
|
+
[n, i] = Zt(h, [
|
|
1764
|
+
b[1],
|
|
1765
|
+
b[2]
|
|
1766
|
+
], m), s !== n && r !== i ? b = ["L", n, i] : r === i ? b = ["H", n] : s === n && (b = ["V", i]);
|
|
1461
1767
|
else
|
|
1462
|
-
for (o = 1,
|
|
1463
|
-
[n, i] =
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1768
|
+
for (o = 1, l = b.length; o < l; o += 2)
|
|
1769
|
+
[n, i] = Zt(
|
|
1770
|
+
h,
|
|
1771
|
+
[+b[o], +b[o + 1]],
|
|
1772
|
+
m
|
|
1773
|
+
), b[o] = n, b[o + 1] = i;
|
|
1774
|
+
return s = n, r = i, b;
|
|
1467
1775
|
});
|
|
1468
1776
|
};
|
|
1469
|
-
class
|
|
1777
|
+
class A {
|
|
1470
1778
|
/**
|
|
1471
1779
|
* @constructor
|
|
1472
1780
|
* @param pathValue the path string
|
|
@@ -1475,27 +1783,29 @@ class p {
|
|
|
1475
1783
|
constructor(t, s) {
|
|
1476
1784
|
const r = s || {}, n = typeof t > "u";
|
|
1477
1785
|
if (n || !t.length)
|
|
1478
|
-
throw TypeError(
|
|
1479
|
-
|
|
1786
|
+
throw TypeError(
|
|
1787
|
+
`${j}: "pathValue" is ${n ? "undefined" : "empty"}`
|
|
1788
|
+
);
|
|
1789
|
+
this.segments = Q(t);
|
|
1480
1790
|
const { round: i, origin: o } = r;
|
|
1481
|
-
let
|
|
1482
|
-
Number.isInteger(i) || i === "off" ?
|
|
1791
|
+
let l;
|
|
1792
|
+
Number.isInteger(i) || i === "off" ? l = i : l = V.round;
|
|
1483
1793
|
let c = V.origin;
|
|
1484
1794
|
if (Array.isArray(o) && o.length >= 2) {
|
|
1485
|
-
const [
|
|
1795
|
+
const [a, u, m] = o.map(Number);
|
|
1486
1796
|
c = [
|
|
1487
|
-
Number.isNaN(
|
|
1797
|
+
Number.isNaN(a) ? 0 : a,
|
|
1488
1798
|
Number.isNaN(u) ? 0 : u,
|
|
1489
1799
|
Number.isNaN(m) ? 0 : m
|
|
1490
1800
|
];
|
|
1491
1801
|
}
|
|
1492
|
-
return this.round =
|
|
1802
|
+
return this.round = l, this.origin = c, this;
|
|
1493
1803
|
}
|
|
1494
1804
|
get bbox() {
|
|
1495
|
-
return
|
|
1805
|
+
return Wt(this.segments);
|
|
1496
1806
|
}
|
|
1497
1807
|
get length() {
|
|
1498
|
-
return
|
|
1808
|
+
return nt(this.segments);
|
|
1499
1809
|
}
|
|
1500
1810
|
/**
|
|
1501
1811
|
* Returns the path bounding box, equivalent to native `path.getBBox()`.
|
|
@@ -1524,7 +1834,7 @@ class p {
|
|
|
1524
1834
|
* @returns the requested point
|
|
1525
1835
|
*/
|
|
1526
1836
|
getPointAtLength(t) {
|
|
1527
|
-
return
|
|
1837
|
+
return rt(this.segments, t);
|
|
1528
1838
|
}
|
|
1529
1839
|
/**
|
|
1530
1840
|
* Convert path to absolute values
|
|
@@ -1533,7 +1843,7 @@ class p {
|
|
|
1533
1843
|
*/
|
|
1534
1844
|
toAbsolute() {
|
|
1535
1845
|
const { segments: t } = this;
|
|
1536
|
-
return this.segments =
|
|
1846
|
+
return this.segments = ht(t), this;
|
|
1537
1847
|
}
|
|
1538
1848
|
/**
|
|
1539
1849
|
* Convert path to relative values
|
|
@@ -1542,7 +1852,7 @@ class p {
|
|
|
1542
1852
|
*/
|
|
1543
1853
|
toRelative() {
|
|
1544
1854
|
const { segments: t } = this;
|
|
1545
|
-
return this.segments =
|
|
1855
|
+
return this.segments = Kt(t), this;
|
|
1546
1856
|
}
|
|
1547
1857
|
/**
|
|
1548
1858
|
* Convert path to cubic-bezier values. In addition, un-necessary `Z`
|
|
@@ -1552,7 +1862,7 @@ class p {
|
|
|
1552
1862
|
*/
|
|
1553
1863
|
toCurve() {
|
|
1554
1864
|
const { segments: t } = this;
|
|
1555
|
-
return this.segments =
|
|
1865
|
+
return this.segments = yt(t), this;
|
|
1556
1866
|
}
|
|
1557
1867
|
/**
|
|
1558
1868
|
* Reverse the order of the segments and their values.
|
|
@@ -1561,10 +1871,9 @@ class p {
|
|
|
1561
1871
|
* @public
|
|
1562
1872
|
*/
|
|
1563
1873
|
reverse(t) {
|
|
1564
|
-
this.
|
|
1565
|
-
const { segments: s } = this, r = Kt(s), n = r.length > 1 ? r : !1, i = n ? n.map((a, c) => t ? c ? yt(a) : a.slice(0) : yt(a)) : s.slice(0);
|
|
1874
|
+
const { segments: s } = this, r = Yt(s), n = r.length > 1 ? r : !1, i = n ? n.map((l, c) => t ? c ? ft(l) : l.slice(0) : ft(l)) : s.slice(0);
|
|
1566
1875
|
let o = [];
|
|
1567
|
-
return n ? o = i.flat(1) : o = t ? s :
|
|
1876
|
+
return n ? o = i.flat(1) : o = t ? s : ft(s), this.segments = o.slice(0), this;
|
|
1568
1877
|
}
|
|
1569
1878
|
/**
|
|
1570
1879
|
* Normalize path in 2 steps:
|
|
@@ -1575,7 +1884,7 @@ class p {
|
|
|
1575
1884
|
*/
|
|
1576
1885
|
normalize() {
|
|
1577
1886
|
const { segments: t } = this;
|
|
1578
|
-
return this.segments =
|
|
1887
|
+
return this.segments = ot(t), this;
|
|
1579
1888
|
}
|
|
1580
1889
|
/**
|
|
1581
1890
|
* Optimize `pathArray` values:
|
|
@@ -1587,7 +1896,7 @@ class p {
|
|
|
1587
1896
|
*/
|
|
1588
1897
|
optimize() {
|
|
1589
1898
|
const { segments: t } = this, s = this.round === "off" ? 2 : this.round;
|
|
1590
|
-
return this.segments =
|
|
1899
|
+
return this.segments = Xt(t, s), this;
|
|
1591
1900
|
}
|
|
1592
1901
|
/**
|
|
1593
1902
|
* Transform path using values from an `Object` defined as `transformObject`.
|
|
@@ -1604,15 +1913,19 @@ class p {
|
|
|
1604
1913
|
segments: s,
|
|
1605
1914
|
origin: [r, n, i]
|
|
1606
1915
|
} = this, o = {};
|
|
1607
|
-
for (const [c,
|
|
1608
|
-
c === "skew" && Array.isArray(
|
|
1609
|
-
const { origin:
|
|
1610
|
-
if (Array.isArray(
|
|
1611
|
-
const [c,
|
|
1612
|
-
o.origin = [
|
|
1916
|
+
for (const [c, a] of Object.entries(t))
|
|
1917
|
+
c === "skew" && Array.isArray(a) || (c === "rotate" || c === "translate" || c === "origin" || c === "scale") && Array.isArray(a) ? o[c] = a.map(Number) : c !== "origin" && typeof Number(a) == "number" && (o[c] = Number(a));
|
|
1918
|
+
const { origin: l } = o;
|
|
1919
|
+
if (Array.isArray(l) && l.length >= 2) {
|
|
1920
|
+
const [c, a, u] = l.map(Number);
|
|
1921
|
+
o.origin = [
|
|
1922
|
+
Number.isNaN(c) ? r : c,
|
|
1923
|
+
Number.isNaN(a) ? n : a,
|
|
1924
|
+
u || i
|
|
1925
|
+
];
|
|
1613
1926
|
} else
|
|
1614
1927
|
o.origin = [r, n, i];
|
|
1615
|
-
return this.segments =
|
|
1928
|
+
return this.segments = Vt(s, o), this;
|
|
1616
1929
|
}
|
|
1617
1930
|
/**
|
|
1618
1931
|
* Rotate path 180deg vertically
|
|
@@ -1640,22 +1953,45 @@ class p {
|
|
|
1640
1953
|
* @return the path string
|
|
1641
1954
|
*/
|
|
1642
1955
|
toString() {
|
|
1643
|
-
return
|
|
1956
|
+
return kt(this.segments, this.round);
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Remove the instance.
|
|
1960
|
+
*
|
|
1961
|
+
* @public
|
|
1962
|
+
* @return void
|
|
1963
|
+
*/
|
|
1964
|
+
dispose() {
|
|
1965
|
+
Object.keys(this).forEach((t) => delete this[t]);
|
|
1644
1966
|
}
|
|
1645
1967
|
}
|
|
1646
|
-
|
|
1647
|
-
Cvalues:
|
|
1648
|
-
Tvalues:
|
|
1649
|
-
minmaxC:
|
|
1650
|
-
minmaxQ:
|
|
1651
|
-
getBezierLength:
|
|
1652
|
-
bezierLength:
|
|
1653
|
-
calculateBezier:
|
|
1654
|
-
computeBezier:
|
|
1655
|
-
deriveBezier:
|
|
1656
|
-
CBEZIER_MINMAX_EPSILON:
|
|
1657
|
-
}),
|
|
1968
|
+
d(A, "CSSMatrix", T), d(A, "pathToAbsolute", ht), d(A, "pathToRelative", Kt), d(A, "pathToCurve", yt), d(A, "pathToString", kt), d(A, "arcTools", Be), d(A, "bezierTools", {
|
|
1969
|
+
Cvalues: Ae,
|
|
1970
|
+
Tvalues: Rt,
|
|
1971
|
+
minmaxC: St,
|
|
1972
|
+
minmaxQ: gt,
|
|
1973
|
+
getBezierLength: mt,
|
|
1974
|
+
bezierLength: Le,
|
|
1975
|
+
calculateBezier: Ne,
|
|
1976
|
+
computeBezier: we,
|
|
1977
|
+
deriveBezier: Me,
|
|
1978
|
+
CBEZIER_MINMAX_EPSILON: ve
|
|
1979
|
+
}), d(A, "cubicTools", {
|
|
1980
|
+
getCubicLength: xt,
|
|
1981
|
+
getCubicBBox: jt,
|
|
1982
|
+
getPointAtCubicLength: Te,
|
|
1983
|
+
getPointAtCubicSegmentLength: Ce
|
|
1984
|
+
}), d(A, "lineTools", {
|
|
1985
|
+
getPointAtLineLength: Ht,
|
|
1986
|
+
getLineBBox: It,
|
|
1987
|
+
getLineLength: it
|
|
1988
|
+
}), d(A, "quadTools", {
|
|
1989
|
+
getPointAtQuadSegmentLength: $e,
|
|
1990
|
+
getQuadLength: pt,
|
|
1991
|
+
getQuadBBox: Qt,
|
|
1992
|
+
getPointAtQuadLength: ze
|
|
1993
|
+
}), d(A, "polygonTools", { polygonArea: He, polygonLength: Fe }), d(A, "distanceSquareRoot", Nt), d(A, "distanceEpsilon", bt), d(A, "midPoint", H), d(A, "rotateVector", st), d(A, "roundTo", k), d(A, "finalizeSegment", qt), d(A, "invalidPathValue", J), d(A, "isArcCommand", ye), d(A, "isDigit", U), d(A, "isDigitStart", he), d(A, "isMoveCommand", ge), d(A, "isPathCommand", fe), d(A, "isSpace", me), d(A, "paramsCount", tt), d(A, "paramsParser", ut), d(A, "pathParser", Ot), d(A, "scanFlag", ae), d(A, "scanParam", ue), d(A, "scanSegment", Dt), d(A, "skipSpaces", et), d(A, "getPathBBox", Wt), d(A, "getPathArea", qe), d(A, "getTotalLength", nt), d(A, "getDrawDirection", Je), d(A, "getPointAtLength", rt), d(A, "getPropertiesAtLength", Ut), d(A, "getPropertiesAtPoint", vt), d(A, "getClosestPoint", _e), d(A, "getSegmentOfPoint", We), d(A, "getSegmentAtLength", Ke), d(A, "isPointInStroke", Ye), d(A, "isValidPath", Ie), d(A, "isPathArray", Ct), d(A, "isAbsoluteArray", Pe), d(A, "isRelativeArray", Ve), d(A, "isCurveArray", Xe), d(A, "isNormalizedArray", ke), d(A, "shapeToPath", rn), d(A, "shapeToPathArray", Ee), d(A, "shapeParams", ct), d(A, "parsePathString", Q), d(A, "absolutizeSegment", at), d(A, "arcToCubic", Mt), d(A, "getSVGMatrix", Re), d(A, "iterate", Z), d(A, "lineToCubic", Pt), d(A, "normalizePath", ot), d(A, "normalizeSegment", wt), d(A, "optimizePath", Xt), d(A, "projection2d", Zt), d(A, "quadToCubic", xe), d(A, "relativizeSegment", Bt), d(A, "reverseCurve", cn), d(A, "reversePath", ft), d(A, "roundPath", ln), d(A, "roundSegment", dt), d(A, "segmentToCubic", pe), d(A, "shortenSegment", Se), d(A, "splitCubic", an), d(A, "splitPath", Yt), d(A, "transformPath", Vt);
|
|
1658
1994
|
export {
|
|
1659
|
-
|
|
1995
|
+
A as default
|
|
1660
1996
|
};
|
|
1661
1997
|
//# sourceMappingURL=svg-path-commander.mjs.map
|