svg-path-commander 2.1.8 → 2.1.9
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 +7 -6
- package/dist/svg-path-commander.cjs +2 -2
- package/dist/svg-path-commander.cjs.map +1 -1
- package/dist/svg-path-commander.d.cts +1343 -0
- package/dist/svg-path-commander.d.ts +1332 -781
- package/dist/svg-path-commander.js +1 -1
- package/dist/svg-path-commander.js.map +1 -1
- package/dist/svg-path-commander.mjs +2 -2047
- package/dist/svg-path-commander.mjs.map +1 -1
- package/package.json +18 -14
|
@@ -1,2047 +1,2 @@
|
|
|
1
|
-
var Qe = Object.defineProperty;
|
|
2
|
-
|
|
3
|
-
var b = (e, t, s) => Ze(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
var De = Object.defineProperty, Oe = (e, t, s) => t in e ? De(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, S = (e, t, s) => Oe(e, typeof t != "symbol" ? t + "" : t, s);
|
|
5
|
-
const Be = {
|
|
6
|
-
a: 1,
|
|
7
|
-
b: 0,
|
|
8
|
-
c: 0,
|
|
9
|
-
d: 1,
|
|
10
|
-
e: 0,
|
|
11
|
-
f: 0,
|
|
12
|
-
m11: 1,
|
|
13
|
-
m12: 0,
|
|
14
|
-
m13: 0,
|
|
15
|
-
m14: 0,
|
|
16
|
-
m21: 0,
|
|
17
|
-
m22: 1,
|
|
18
|
-
m23: 0,
|
|
19
|
-
m24: 0,
|
|
20
|
-
m31: 0,
|
|
21
|
-
m32: 0,
|
|
22
|
-
m33: 1,
|
|
23
|
-
m34: 0,
|
|
24
|
-
m41: 0,
|
|
25
|
-
m42: 0,
|
|
26
|
-
m43: 0,
|
|
27
|
-
m44: 1,
|
|
28
|
-
is2D: !0,
|
|
29
|
-
isIdentity: !0
|
|
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 C || typeof e == "object" && Object.keys(Be).every((t) => e && t in e), lt = (e) => {
|
|
31
|
-
const t = new C(), s = Array.from(e);
|
|
32
|
-
if (!Gt(s))
|
|
33
|
-
throw TypeError(
|
|
34
|
-
`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`
|
|
35
|
-
);
|
|
36
|
-
if (s.length === 16) {
|
|
37
|
-
const [
|
|
38
|
-
r,
|
|
39
|
-
n,
|
|
40
|
-
i,
|
|
41
|
-
o,
|
|
42
|
-
l,
|
|
43
|
-
c,
|
|
44
|
-
a,
|
|
45
|
-
u,
|
|
46
|
-
f,
|
|
47
|
-
h,
|
|
48
|
-
y,
|
|
49
|
-
m,
|
|
50
|
-
g,
|
|
51
|
-
A,
|
|
52
|
-
M,
|
|
53
|
-
N
|
|
54
|
-
] = s;
|
|
55
|
-
t.m11 = r, t.a = r, t.m21 = l, t.c = l, t.m31 = f, t.m41 = g, t.e = g, t.m12 = n, t.b = n, t.m22 = c, t.d = c, t.m32 = h, t.m42 = A, t.f = A, t.m13 = i, t.m23 = a, t.m33 = y, t.m43 = M, t.m14 = o, t.m24 = u, t.m34 = m, t.m44 = N;
|
|
56
|
-
} else if (s.length === 6) {
|
|
57
|
-
const [r, n, i, o, l, c] = s;
|
|
58
|
-
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;
|
|
59
|
-
}
|
|
60
|
-
return t;
|
|
61
|
-
}, ee = (e) => {
|
|
62
|
-
if (te(e))
|
|
63
|
-
return lt([
|
|
64
|
-
e.m11,
|
|
65
|
-
e.m12,
|
|
66
|
-
e.m13,
|
|
67
|
-
e.m14,
|
|
68
|
-
e.m21,
|
|
69
|
-
e.m22,
|
|
70
|
-
e.m23,
|
|
71
|
-
e.m24,
|
|
72
|
-
e.m31,
|
|
73
|
-
e.m32,
|
|
74
|
-
e.m33,
|
|
75
|
-
e.m34,
|
|
76
|
-
e.m41,
|
|
77
|
-
e.m42,
|
|
78
|
-
e.m43,
|
|
79
|
-
e.m44
|
|
80
|
-
]);
|
|
81
|
-
throw TypeError(
|
|
82
|
-
`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`
|
|
83
|
-
);
|
|
84
|
-
}, ne = (e) => {
|
|
85
|
-
if (typeof e != "string")
|
|
86
|
-
throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);
|
|
87
|
-
const t = String(e).replace(/\s/g, "");
|
|
88
|
-
let s = new C();
|
|
89
|
-
const r = `CSSMatrix: invalid transform string "${e}"`;
|
|
90
|
-
return t.split(")").filter((n) => n).forEach((n) => {
|
|
91
|
-
const [i, o] = n.split("(");
|
|
92
|
-
if (!o) throw TypeError(r);
|
|
93
|
-
const l = o.split(",").map(
|
|
94
|
-
(m) => m.includes("rad") ? parseFloat(m) * (180 / Math.PI) : parseFloat(m)
|
|
95
|
-
), [c, a, u, f] = l, h = [c, a, u], y = [c, a, u, f];
|
|
96
|
-
if (i === "perspective" && c && [a, u].every((m) => m === void 0))
|
|
97
|
-
s.m34 = -1 / c;
|
|
98
|
-
else if (i.includes("matrix") && [6, 16].includes(l.length) && l.every((m) => !Number.isNaN(+m))) {
|
|
99
|
-
const m = l.map((g) => Math.abs(g) < 1e-6 ? 0 : g);
|
|
100
|
-
s = s.multiply(lt(m));
|
|
101
|
-
} else if (i === "translate3d" && h.every((m) => !Number.isNaN(+m)))
|
|
102
|
-
s = s.translate(c, a, u);
|
|
103
|
-
else if (i === "translate" && c && u === void 0)
|
|
104
|
-
s = s.translate(c, a || 0, 0);
|
|
105
|
-
else if (i === "rotate3d" && y.every((m) => !Number.isNaN(+m)) && f)
|
|
106
|
-
s = s.rotateAxisAngle(c, a, u, f);
|
|
107
|
-
else if (i === "rotate" && c && [a, u].every((m) => m === void 0))
|
|
108
|
-
s = s.rotate(0, 0, c);
|
|
109
|
-
else if (i === "scale3d" && h.every((m) => !Number.isNaN(+m)) && h.some((m) => m !== 1))
|
|
110
|
-
s = s.scale(c, a, u);
|
|
111
|
-
else if (
|
|
112
|
-
// prop === "scale" && !Number.isNaN(x) && x !== 1 && z === undefined
|
|
113
|
-
// prop === "scale" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&
|
|
114
|
-
i === "scale" && !Number.isNaN(c) && (c !== 1 || a !== 1) && u === void 0
|
|
115
|
-
) {
|
|
116
|
-
const m = Number.isNaN(+a) ? c : a;
|
|
117
|
-
s = s.scale(c, m, 1);
|
|
118
|
-
} else if (i === "skew" && (c || !Number.isNaN(c) && a) && u === void 0)
|
|
119
|
-
s = s.skew(c, a || 0);
|
|
120
|
-
else if (["translate", "rotate", "scale", "skew"].some(
|
|
121
|
-
(m) => i.includes(m)
|
|
122
|
-
) && /[XYZ]/.test(i) && c && [a, u].every((m) => m === void 0))
|
|
123
|
-
if (i === "skewX" || i === "skewY")
|
|
124
|
-
s = s[i](c);
|
|
125
|
-
else {
|
|
126
|
-
const m = i.replace(/[XYZ]/, ""), g = i.replace(m, ""), A = ["X", "Y", "Z"].indexOf(g), M = m === "scale" ? 1 : 0, N = [
|
|
127
|
-
A === 0 ? c : M,
|
|
128
|
-
A === 1 ? c : M,
|
|
129
|
-
A === 2 ? c : M
|
|
130
|
-
];
|
|
131
|
-
s = s[m](...N);
|
|
132
|
-
}
|
|
133
|
-
else
|
|
134
|
-
throw TypeError(r);
|
|
135
|
-
}), s;
|
|
136
|
-
}, zt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [
|
|
137
|
-
e.m11,
|
|
138
|
-
e.m12,
|
|
139
|
-
e.m13,
|
|
140
|
-
e.m14,
|
|
141
|
-
e.m21,
|
|
142
|
-
e.m22,
|
|
143
|
-
e.m23,
|
|
144
|
-
e.m24,
|
|
145
|
-
e.m31,
|
|
146
|
-
e.m32,
|
|
147
|
-
e.m33,
|
|
148
|
-
e.m34,
|
|
149
|
-
e.m41,
|
|
150
|
-
e.m42,
|
|
151
|
-
e.m43,
|
|
152
|
-
e.m44
|
|
153
|
-
], se = (e, t, s) => {
|
|
154
|
-
const r = new C();
|
|
155
|
-
return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = s, r;
|
|
156
|
-
}, re = (e, t, s) => {
|
|
157
|
-
const r = new C(), 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), f = -Math.sin(o), h = Math.cos(l), y = -Math.sin(l), m = u * h, g = -u * y;
|
|
158
|
-
r.m11 = m, r.a = m, r.m12 = g, r.b = g, r.m13 = f;
|
|
159
|
-
const A = a * f * h + c * y;
|
|
160
|
-
r.m21 = A, r.c = A;
|
|
161
|
-
const M = c * h - a * f * y;
|
|
162
|
-
return r.m22 = M, r.d = M, r.m23 = -a * u, r.m31 = a * y - c * f * h, r.m32 = a * h + c * f * y, r.m33 = c * u, r;
|
|
163
|
-
}, ie = (e, t, s, r) => {
|
|
164
|
-
const n = new C(), i = Math.sqrt(e * e + t * t + s * s);
|
|
165
|
-
if (i === 0)
|
|
166
|
-
return n;
|
|
167
|
-
const o = e / i, l = t / i, c = s / i, a = r * (Math.PI / 360), u = Math.sin(a), f = Math.cos(a), h = u * u, y = o * o, m = l * l, g = c * c, A = 1 - 2 * (m + g) * h;
|
|
168
|
-
n.m11 = A, n.a = A;
|
|
169
|
-
const M = 2 * (o * l * h + c * u * f);
|
|
170
|
-
n.m12 = M, n.b = M, n.m13 = 2 * (o * c * h - l * u * f);
|
|
171
|
-
const N = 2 * (l * o * h - c * u * f);
|
|
172
|
-
n.m21 = N, n.c = N;
|
|
173
|
-
const x = 1 - 2 * (g + y) * h;
|
|
174
|
-
return n.m22 = x, n.d = x, n.m23 = 2 * (l * c * h + o * u * f), n.m31 = 2 * (c * o * h + l * u * f), n.m32 = 2 * (c * l * h - o * u * f), n.m33 = 1 - 2 * (y + m) * h, n;
|
|
175
|
-
}, oe = (e, t, s) => {
|
|
176
|
-
const r = new C();
|
|
177
|
-
return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = s, r;
|
|
178
|
-
}, At = (e, t) => {
|
|
179
|
-
const s = new C();
|
|
180
|
-
if (e) {
|
|
181
|
-
const r = e * Math.PI / 180, n = Math.tan(r);
|
|
182
|
-
s.m21 = n, s.c = n;
|
|
183
|
-
}
|
|
184
|
-
if (t) {
|
|
185
|
-
const r = t * Math.PI / 180, n = Math.tan(r);
|
|
186
|
-
s.m12 = n, s.b = n;
|
|
187
|
-
}
|
|
188
|
-
return s;
|
|
189
|
-
}, ce = (e) => At(e, 0), le = (e) => At(0, e), U = (e, t) => {
|
|
190
|
-
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, f = 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, y = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, m = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, g = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, A = 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;
|
|
191
|
-
return lt([
|
|
192
|
-
s,
|
|
193
|
-
r,
|
|
194
|
-
n,
|
|
195
|
-
i,
|
|
196
|
-
o,
|
|
197
|
-
l,
|
|
198
|
-
c,
|
|
199
|
-
a,
|
|
200
|
-
u,
|
|
201
|
-
f,
|
|
202
|
-
h,
|
|
203
|
-
y,
|
|
204
|
-
m,
|
|
205
|
-
g,
|
|
206
|
-
A,
|
|
207
|
-
M
|
|
208
|
-
]);
|
|
209
|
-
};
|
|
210
|
-
class C {
|
|
211
|
-
/**
|
|
212
|
-
* @constructor
|
|
213
|
-
* @param init accepts all parameter configurations:
|
|
214
|
-
* * valid CSS transform string,
|
|
215
|
-
* * CSSMatrix/DOMMatrix instance,
|
|
216
|
-
* * a 6/16 elements *Array*.
|
|
217
|
-
*/
|
|
218
|
-
constructor(t) {
|
|
219
|
-
return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity
|
|
223
|
-
* matrix is one in which every value is 0 except those on the main diagonal from top-left
|
|
224
|
-
* to bottom-right corner (in other words, where the offsets in each direction are equal).
|
|
225
|
-
*
|
|
226
|
-
* @return the current property value
|
|
227
|
-
*/
|
|
228
|
-
get isIdentity() {
|
|
229
|
-
return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix
|
|
233
|
-
* and `false` if the matrix is 3D.
|
|
234
|
-
*
|
|
235
|
-
* @return the current property value
|
|
236
|
-
*/
|
|
237
|
-
get is2D() {
|
|
238
|
-
return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* The `setMatrixValue` method replaces the existing matrix with one computed
|
|
242
|
-
* in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`
|
|
243
|
-
*
|
|
244
|
-
* The method accepts any *Array* values, the result of
|
|
245
|
-
* `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls
|
|
246
|
-
* or `CSSMatrix` instance method `toArray()`.
|
|
247
|
-
*
|
|
248
|
-
* This method expects valid *matrix()* / *matrix3d()* string values, as well
|
|
249
|
-
* as other transform functions like *translateX(10px)*.
|
|
250
|
-
*
|
|
251
|
-
* @param source
|
|
252
|
-
* @return the matrix instance
|
|
253
|
-
*/
|
|
254
|
-
setMatrixValue(t) {
|
|
255
|
-
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;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Returns a *Float32Array* containing elements which comprise the matrix.
|
|
259
|
-
* The method can return either the 16 elements or the 6 elements
|
|
260
|
-
* depending on the value of the `is2D` parameter.
|
|
261
|
-
*
|
|
262
|
-
* @param is2D *Array* representation of the matrix
|
|
263
|
-
* @return an *Array* representation of the matrix
|
|
264
|
-
*/
|
|
265
|
-
toFloat32Array(t) {
|
|
266
|
-
return Float32Array.from(zt(this, t));
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Returns a *Float64Array* containing elements which comprise the matrix.
|
|
270
|
-
* The method can return either the 16 elements or the 6 elements
|
|
271
|
-
* depending on the value of the `is2D` parameter.
|
|
272
|
-
*
|
|
273
|
-
* @param is2D *Array* representation of the matrix
|
|
274
|
-
* @return an *Array* representation of the matrix
|
|
275
|
-
*/
|
|
276
|
-
toFloat64Array(t) {
|
|
277
|
-
return Float64Array.from(zt(this, t));
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Creates and returns a string representation of the matrix in `CSS` matrix syntax,
|
|
281
|
-
* using the appropriate `CSS` matrix notation.
|
|
282
|
-
*
|
|
283
|
-
* matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*
|
|
284
|
-
* matrix *matrix(a, b, c, d, e, f)*
|
|
285
|
-
*
|
|
286
|
-
* @return a string representation of the matrix
|
|
287
|
-
*/
|
|
288
|
-
toString() {
|
|
289
|
-
const { is2D: t } = this, s = this.toFloat64Array(t).join(", ");
|
|
290
|
-
return `${t ? "matrix" : "matrix3d"}(${s})`;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*
|
|
294
|
-
* that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well
|
|
295
|
-
* as the `is2D` & `isIdentity` properties.
|
|
296
|
-
*
|
|
297
|
-
* The result can also be used as a second parameter for the `fromMatrix` static method
|
|
298
|
-
* to load values into another matrix instance.
|
|
299
|
-
*
|
|
300
|
-
* @return an *Object* with all matrix values.
|
|
301
|
-
*/
|
|
302
|
-
toJSON() {
|
|
303
|
-
const { is2D: t, isIdentity: s } = this;
|
|
304
|
-
return { ...this, is2D: t, isIdentity: s };
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* The Multiply method returns a new CSSMatrix which is the result of this
|
|
308
|
-
* matrix multiplied by the passed matrix, with the passed matrix to the right.
|
|
309
|
-
* This matrix is not modified.
|
|
310
|
-
*
|
|
311
|
-
* @param m2 CSSMatrix
|
|
312
|
-
* @return The resulted matrix.
|
|
313
|
-
*/
|
|
314
|
-
multiply(t) {
|
|
315
|
-
return U(this, t);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* The translate method returns a new matrix which is this matrix post
|
|
319
|
-
* multiplied by a translation matrix containing the passed values. If the z
|
|
320
|
-
* component is undefined, a 0 value is used in its place. This matrix is not
|
|
321
|
-
* modified.
|
|
322
|
-
*
|
|
323
|
-
* @param x X component of the translation value.
|
|
324
|
-
* @param y Y component of the translation value.
|
|
325
|
-
* @param z Z component of the translation value.
|
|
326
|
-
* @return The resulted matrix
|
|
327
|
-
*/
|
|
328
|
-
translate(t, s, r) {
|
|
329
|
-
const n = t;
|
|
330
|
-
let i = s, o = r;
|
|
331
|
-
return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), U(this, se(n, i, o));
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* The scale method returns a new matrix which is this matrix post multiplied by
|
|
335
|
-
* a scale matrix containing the passed values. If the z component is undefined,
|
|
336
|
-
* a 1 value is used in its place. If the y component is undefined, the x
|
|
337
|
-
* component value is used in its place. This matrix is not modified.
|
|
338
|
-
*
|
|
339
|
-
* @param x The X component of the scale value.
|
|
340
|
-
* @param y The Y component of the scale value.
|
|
341
|
-
* @param z The Z component of the scale value.
|
|
342
|
-
* @return The resulted matrix
|
|
343
|
-
*/
|
|
344
|
-
scale(t, s, r) {
|
|
345
|
-
const n = t;
|
|
346
|
-
let i = s, o = r;
|
|
347
|
-
return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), U(this, oe(n, i, o));
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* The rotate method returns a new matrix which is this matrix post multiplied
|
|
351
|
-
* by each of 3 rotation matrices about the major axes, first X, then Y, then Z.
|
|
352
|
-
* If the y and z components are undefined, the x value is used to rotate the
|
|
353
|
-
* object about the z axis, as though the vector (0,0,x) were passed. All
|
|
354
|
-
* rotation values are in degrees. This matrix is not modified.
|
|
355
|
-
*
|
|
356
|
-
* @param rx The X component of the rotation, or Z if Y and Z are null.
|
|
357
|
-
* @param ry The (optional) Y component of the rotation value.
|
|
358
|
-
* @param rz The (optional) Z component of the rotation value.
|
|
359
|
-
* @return The resulted matrix
|
|
360
|
-
*/
|
|
361
|
-
rotate(t, s, r) {
|
|
362
|
-
let n = t, i = s || 0, o = r || 0;
|
|
363
|
-
return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0), U(this, re(n, i, o));
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* The rotateAxisAngle method returns a new matrix which is this matrix post
|
|
367
|
-
* multiplied by a rotation matrix with the given axis and `angle`. The right-hand
|
|
368
|
-
* rule is used to determine the direction of rotation. All rotation values are
|
|
369
|
-
* in degrees. This matrix is not modified.
|
|
370
|
-
*
|
|
371
|
-
* @param x The X component of the axis vector.
|
|
372
|
-
* @param y The Y component of the axis vector.
|
|
373
|
-
* @param z The Z component of the axis vector.
|
|
374
|
-
* @param angle The angle of rotation about the axis vector, in degrees.
|
|
375
|
-
* @return The resulted matrix
|
|
376
|
-
*/
|
|
377
|
-
rotateAxisAngle(t, s, r, n) {
|
|
378
|
-
if ([t, s, r, n].some((i) => Number.isNaN(+i)))
|
|
379
|
-
throw new TypeError("CSSMatrix: expecting 4 values");
|
|
380
|
-
return U(this, ie(t, s, r, n));
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Specifies a skew transformation along the `x-axis` by the given angle.
|
|
384
|
-
* This matrix is not modified.
|
|
385
|
-
*
|
|
386
|
-
* @param angle The angle amount in degrees to skew.
|
|
387
|
-
* @return The resulted matrix
|
|
388
|
-
*/
|
|
389
|
-
skewX(t) {
|
|
390
|
-
return U(this, ce(t));
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Specifies a skew transformation along the `y-axis` by the given angle.
|
|
394
|
-
* This matrix is not modified.
|
|
395
|
-
*
|
|
396
|
-
* @param angle The angle amount in degrees to skew.
|
|
397
|
-
* @return The resulted matrix
|
|
398
|
-
*/
|
|
399
|
-
skewY(t) {
|
|
400
|
-
return U(this, le(t));
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Specifies a skew transformation along both the `x-axis` and `y-axis`.
|
|
404
|
-
* This matrix is not modified.
|
|
405
|
-
*
|
|
406
|
-
* @param angleX The X-angle amount in degrees to skew.
|
|
407
|
-
* @param angleY The angle amount in degrees to skew.
|
|
408
|
-
* @return The resulted matrix
|
|
409
|
-
*/
|
|
410
|
-
skew(t, s) {
|
|
411
|
-
return U(this, At(t, s));
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Transforms a specified vector using the matrix, returning a new
|
|
415
|
-
* {x,y,z,w} Tuple *Object* comprising the transformed vector.
|
|
416
|
-
* Neither the matrix nor the original vector are altered.
|
|
417
|
-
*
|
|
418
|
-
* The method is equivalent with `transformPoint()` method
|
|
419
|
-
* of the `DOMMatrix` constructor.
|
|
420
|
-
*
|
|
421
|
-
* @param t Tuple with `{x,y,z,w}` components
|
|
422
|
-
* @return the resulting Tuple
|
|
423
|
-
*/
|
|
424
|
-
transformPoint(t) {
|
|
425
|
-
const s = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, r = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, n = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, i = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;
|
|
426
|
-
return t instanceof DOMPoint ? new DOMPoint(s, r, n, i) : {
|
|
427
|
-
x: s,
|
|
428
|
-
y: r,
|
|
429
|
-
z: n,
|
|
430
|
-
w: i
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
S(C, "Translate", se), S(C, "Rotate", re), S(C, "RotateAxisAngle", ie), S(C, "Scale", oe), S(C, "SkewX", ce), S(C, "SkewY", le), S(C, "Skew", At), S(C, "Multiply", U), S(C, "fromArray", lt), S(C, "fromMatrix", ee), S(C, "fromString", ne), S(C, "toArray", zt), S(C, "isCompatibleArray", Gt), S(C, "isCompatibleObject", te);
|
|
435
|
-
const V = {
|
|
436
|
-
origin: [0, 0, 0],
|
|
437
|
-
round: 4
|
|
438
|
-
}, tt = {
|
|
439
|
-
a: 7,
|
|
440
|
-
c: 6,
|
|
441
|
-
h: 1,
|
|
442
|
-
l: 2,
|
|
443
|
-
m: 2,
|
|
444
|
-
r: 4,
|
|
445
|
-
q: 4,
|
|
446
|
-
s: 4,
|
|
447
|
-
t: 2,
|
|
448
|
-
v: 1,
|
|
449
|
-
z: 0
|
|
450
|
-
}, qt = (e) => {
|
|
451
|
-
let t = e.pathValue[e.segmentStart], s = t.toLowerCase();
|
|
452
|
-
const { data: r } = e;
|
|
453
|
-
for (; r.length >= tt[s] && (s === "m" && r.length > 2 ? (e.segments.push(
|
|
454
|
-
[t].concat(
|
|
455
|
-
r.splice(0, 2)
|
|
456
|
-
)
|
|
457
|
-
), s = "l", t = t === "m" ? "l" : "L") : e.segments.push(
|
|
458
|
-
[t].concat(
|
|
459
|
-
r.splice(0, tt[s])
|
|
460
|
-
)
|
|
461
|
-
), !!tt[s]); )
|
|
462
|
-
;
|
|
463
|
-
}, Z = "SVGPathCommander Error", ae = (e) => {
|
|
464
|
-
const { index: t, pathValue: s } = e, r = s.charCodeAt(t);
|
|
465
|
-
if (r === 48) {
|
|
466
|
-
e.param = 0, e.index += 1;
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
if (r === 49) {
|
|
470
|
-
e.param = 1, e.index += 1;
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
e.err = `${Z}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`;
|
|
474
|
-
}, J = (e) => e >= 48 && e <= 57, K = "Invalid path value", ue = (e) => {
|
|
475
|
-
const { max: t, pathValue: s, index: r } = e;
|
|
476
|
-
let n = r, i = !1, o = !1, l = !1, c = !1, a;
|
|
477
|
-
if (n >= t) {
|
|
478
|
-
e.err = `${Z}: ${K} at index ${n}, "pathValue" is missing param`;
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
if (a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1, a = s.charCodeAt(n)), !J(a) && a !== 46) {
|
|
482
|
-
e.err = `${Z}: ${K} at index ${n}, "${s[n]}" is not a number`;
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
if (a !== 46) {
|
|
486
|
-
if (i = a === 48, n += 1, a = s.charCodeAt(n), i && n < t && a && J(a)) {
|
|
487
|
-
e.err = `${Z}: ${K} at index ${r}, "${s[r]}" illegal number`;
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
for (; n < t && J(s.charCodeAt(n)); )
|
|
491
|
-
n += 1, o = !0;
|
|
492
|
-
a = s.charCodeAt(n);
|
|
493
|
-
}
|
|
494
|
-
if (a === 46) {
|
|
495
|
-
for (c = !0, n += 1; J(s.charCodeAt(n)); )
|
|
496
|
-
n += 1, l = !0;
|
|
497
|
-
a = s.charCodeAt(n);
|
|
498
|
-
}
|
|
499
|
-
if (a === 101 || a === 69) {
|
|
500
|
-
if (c && !o && !l) {
|
|
501
|
-
e.err = `${Z}: ${K} at index ${n}, "${s[n]}" invalid float exponent`;
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
if (n += 1, a = s.charCodeAt(n), (a === 43 || a === 45) && (n += 1), n < t && J(s.charCodeAt(n)))
|
|
505
|
-
for (; n < t && J(s.charCodeAt(n)); )
|
|
506
|
-
n += 1;
|
|
507
|
-
else {
|
|
508
|
-
e.err = `${Z}: ${K} at index ${n}, "${s[n]}" invalid integer exponent`;
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
e.index = n, e.param = +e.pathValue.slice(r, n);
|
|
513
|
-
}, me = (e) => [
|
|
514
|
-
// Special spaces
|
|
515
|
-
5760,
|
|
516
|
-
6158,
|
|
517
|
-
8192,
|
|
518
|
-
8193,
|
|
519
|
-
8194,
|
|
520
|
-
8195,
|
|
521
|
-
8196,
|
|
522
|
-
8197,
|
|
523
|
-
8198,
|
|
524
|
-
8199,
|
|
525
|
-
8200,
|
|
526
|
-
8201,
|
|
527
|
-
8202,
|
|
528
|
-
8239,
|
|
529
|
-
8287,
|
|
530
|
-
12288,
|
|
531
|
-
65279,
|
|
532
|
-
// Line terminators
|
|
533
|
-
10,
|
|
534
|
-
13,
|
|
535
|
-
8232,
|
|
536
|
-
8233,
|
|
537
|
-
// White spaces
|
|
538
|
-
32,
|
|
539
|
-
9,
|
|
540
|
-
11,
|
|
541
|
-
12,
|
|
542
|
-
160
|
|
543
|
-
].includes(e), et = (e) => {
|
|
544
|
-
const { pathValue: t, max: s } = e;
|
|
545
|
-
for (; e.index < s && me(t.charCodeAt(e.index)); )
|
|
546
|
-
e.index += 1;
|
|
547
|
-
}, fe = (e) => {
|
|
548
|
-
switch (e | 32) {
|
|
549
|
-
case 109:
|
|
550
|
-
case 122:
|
|
551
|
-
case 108:
|
|
552
|
-
case 104:
|
|
553
|
-
case 118:
|
|
554
|
-
case 99:
|
|
555
|
-
case 115:
|
|
556
|
-
case 113:
|
|
557
|
-
case 116:
|
|
558
|
-
case 97:
|
|
559
|
-
return !0;
|
|
560
|
-
default:
|
|
561
|
-
return !1;
|
|
562
|
-
}
|
|
563
|
-
}, he = (e) => J(e) || e === 43 || e === 45 || e === 46, ye = (e) => (e | 32) === 97, ge = (e) => {
|
|
564
|
-
switch (e | 32) {
|
|
565
|
-
case 109:
|
|
566
|
-
case 77:
|
|
567
|
-
return !0;
|
|
568
|
-
default:
|
|
569
|
-
return !1;
|
|
570
|
-
}
|
|
571
|
-
}, Dt = (e) => {
|
|
572
|
-
var c;
|
|
573
|
-
const { max: t, pathValue: s, index: r, segments: n } = e, i = s.charCodeAt(r), o = tt[s[r].toLowerCase()];
|
|
574
|
-
if (e.segmentStart = r, !fe(i)) {
|
|
575
|
-
e.err = `${Z}: ${K} "${s[r]}" is not a path command at index ${r}`;
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
const l = n[n.length - 1];
|
|
579
|
-
if (!ge(i) && ((c = l == null ? void 0 : l[0]) == null ? void 0 : c.toLocaleLowerCase()) === "z") {
|
|
580
|
-
e.err = `${Z}: ${K} "${s[r]}" is not a MoveTo path command at index ${r}`;
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
if (e.index += 1, et(e), e.data = [], !o) {
|
|
584
|
-
qt(e);
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
for (; ; ) {
|
|
588
|
-
for (let a = o; a > 0; a -= 1) {
|
|
589
|
-
if (ye(i) && (a === 3 || a === 4) ? ae(e) : ue(e), e.err.length)
|
|
590
|
-
return;
|
|
591
|
-
e.data.push(e.param), et(e), e.index < t && s.charCodeAt(e.index) === 44 && (e.index += 1, et(e));
|
|
592
|
-
}
|
|
593
|
-
if (e.index >= e.max || !he(s.charCodeAt(e.index)))
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
qt(e);
|
|
597
|
-
};
|
|
598
|
-
class Ot {
|
|
599
|
-
constructor(t) {
|
|
600
|
-
this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
const D = (e) => {
|
|
604
|
-
if (typeof e != "string")
|
|
605
|
-
return e.slice(0);
|
|
606
|
-
const t = new Ot(e);
|
|
607
|
-
for (et(t); t.index < t.max && !t.err.length; )
|
|
608
|
-
Dt(t);
|
|
609
|
-
if (!t.err.length)
|
|
610
|
-
t.segments.length && (t.segments[0][0] = "M");
|
|
611
|
-
else
|
|
612
|
-
throw TypeError(t.err);
|
|
613
|
-
return t.segments;
|
|
614
|
-
}, at = (e, t, s, r) => {
|
|
615
|
-
const [n] = e, i = n.toUpperCase();
|
|
616
|
-
if (t === 0 || i === n) return e;
|
|
617
|
-
if (i === "A")
|
|
618
|
-
return [
|
|
619
|
-
i,
|
|
620
|
-
e[1],
|
|
621
|
-
e[2],
|
|
622
|
-
e[3],
|
|
623
|
-
e[4],
|
|
624
|
-
e[5],
|
|
625
|
-
e[6] + s,
|
|
626
|
-
e[7] + r
|
|
627
|
-
];
|
|
628
|
-
if (i === "V")
|
|
629
|
-
return [i, e[1] + r];
|
|
630
|
-
if (i === "H")
|
|
631
|
-
return [i, e[1] + s];
|
|
632
|
-
if (i === "L")
|
|
633
|
-
return [
|
|
634
|
-
i,
|
|
635
|
-
e[1] + s,
|
|
636
|
-
e[2] + r
|
|
637
|
-
];
|
|
638
|
-
{
|
|
639
|
-
const l = [], c = e.length;
|
|
640
|
-
for (let a = 1; a < c; a += 1)
|
|
641
|
-
l.push(e[a] + (a % 2 ? s : r));
|
|
642
|
-
return [i].concat(l);
|
|
643
|
-
}
|
|
644
|
-
}, O = (e, t) => {
|
|
645
|
-
let s = e.length, r, n = "M", i = "M", o = !1, l = 0, c = 0, a = 0, u = 0, f = 0;
|
|
646
|
-
for (let h = 0; h < s; h += 1) {
|
|
647
|
-
r = e[h], [n] = r, f = r.length, i = n.toUpperCase(), o = i !== n;
|
|
648
|
-
const y = t(r, h, l, c);
|
|
649
|
-
if (y === !1)
|
|
650
|
-
break;
|
|
651
|
-
i === "Z" ? (l = a, c = u) : i === "H" ? l = r[1] + (o ? l : 0) : i === "V" ? c = r[1] + (o ? c : 0) : (l = r[f - 2] + (o ? l : 0), c = r[f - 1] + (o ? c : 0), i === "M" && (a = l, u = c)), y && (e[h] = y, y[0] === "C" && (s = e.length));
|
|
652
|
-
}
|
|
653
|
-
return e;
|
|
654
|
-
}, ht = (e) => {
|
|
655
|
-
const t = D(e);
|
|
656
|
-
return O(t, at);
|
|
657
|
-
}, Bt = (e, t, s, r) => {
|
|
658
|
-
const [n] = e, i = n.toLowerCase();
|
|
659
|
-
if (t === 0 || n === i) return e;
|
|
660
|
-
if (i === "a")
|
|
661
|
-
return [
|
|
662
|
-
i,
|
|
663
|
-
e[1],
|
|
664
|
-
e[2],
|
|
665
|
-
e[3],
|
|
666
|
-
e[4],
|
|
667
|
-
e[5],
|
|
668
|
-
e[6] - s,
|
|
669
|
-
e[7] - r
|
|
670
|
-
];
|
|
671
|
-
if (i === "v")
|
|
672
|
-
return [i, e[1] - r];
|
|
673
|
-
if (i === "h")
|
|
674
|
-
return [i, e[1] - s];
|
|
675
|
-
if (i === "l")
|
|
676
|
-
return [
|
|
677
|
-
i,
|
|
678
|
-
e[1] - s,
|
|
679
|
-
e[2] - r
|
|
680
|
-
];
|
|
681
|
-
{
|
|
682
|
-
const l = [], c = e.length;
|
|
683
|
-
for (let a = 1; a < c; a += 1)
|
|
684
|
-
l.push(e[a] - (a % 2 ? s : r));
|
|
685
|
-
return [i].concat(l);
|
|
686
|
-
}
|
|
687
|
-
}, Kt = (e) => {
|
|
688
|
-
const t = D(e);
|
|
689
|
-
return O(t, Bt);
|
|
690
|
-
}, st = (e, t, s) => {
|
|
691
|
-
const { sin: r, cos: n } = Math, i = e * n(s) - t * r(s), o = e * r(s) + t * n(s);
|
|
692
|
-
return { x: i, y: o };
|
|
693
|
-
}, Mt = (e, t, s, r, n, i, o, l, c, a) => {
|
|
694
|
-
let u = e, f = t, h = s, y = r, m = l, g = c;
|
|
695
|
-
const A = Math.PI * 120 / 180, M = Math.PI / 180 * (+n || 0);
|
|
696
|
-
let N = [], x, p, w, T, k;
|
|
697
|
-
if (a)
|
|
698
|
-
[p, w, T, k] = a;
|
|
699
|
-
else {
|
|
700
|
-
x = st(u, f, -M), u = x.x, f = x.y, x = st(m, g, -M), m = x.x, g = x.y;
|
|
701
|
-
const $ = (u - m) / 2, j = (f - g) / 2;
|
|
702
|
-
let q = $ * $ / (h * h) + j * j / (y * y);
|
|
703
|
-
q > 1 && (q = Math.sqrt(q), h *= q, y *= q);
|
|
704
|
-
const vt = h * h, $t = y * y, Jt = (i === o ? -1 : 1) * Math.sqrt(
|
|
705
|
-
Math.abs(
|
|
706
|
-
(vt * $t - vt * j * j - $t * $ * $) / (vt * j * j + $t * $ * $)
|
|
707
|
-
)
|
|
708
|
-
);
|
|
709
|
-
T = Jt * h * j / y + (u + m) / 2, k = Jt * -y * $ / h + (f + g) / 2, p = Math.asin(((f - k) / y * 10 ** 9 >> 0) / 10 ** 9), w = Math.asin(((g - k) / y * 10 ** 9 >> 0) / 10 ** 9), p = u < T ? Math.PI - p : p, w = m < T ? Math.PI - w : w, p < 0 && (p = Math.PI * 2 + p), w < 0 && (w = Math.PI * 2 + w), o && p > w && (p -= Math.PI * 2), !o && w > p && (w -= Math.PI * 2);
|
|
710
|
-
}
|
|
711
|
-
let I = w - p;
|
|
712
|
-
if (Math.abs(I) > A) {
|
|
713
|
-
const $ = w, j = m, q = g;
|
|
714
|
-
w = p + A * (o && w > p ? 1 : -1), m = T + h * Math.cos(w), g = k + y * Math.sin(w), N = Mt(m, g, h, y, n, 0, o, j, q, [
|
|
715
|
-
w,
|
|
716
|
-
$,
|
|
717
|
-
T,
|
|
718
|
-
k
|
|
719
|
-
]);
|
|
720
|
-
}
|
|
721
|
-
I = w - p;
|
|
722
|
-
const z = Math.cos(p), v = Math.sin(p), B = Math.cos(w), W = Math.sin(w), E = Math.tan(I / 4), L = 4 / 3 * h * E, R = 4 / 3 * y * E, H = [u, f], Q = [u + L * v, f - R * z], _ = [m + L * W, g - R * B], G = [m, g];
|
|
723
|
-
if (Q[0] = 2 * H[0] - Q[0], Q[1] = 2 * H[1] - Q[1], a)
|
|
724
|
-
return [Q[0], Q[1], _[0], _[1], G[0], G[1]].concat(N);
|
|
725
|
-
N = [Q[0], Q[1], _[0], _[1], G[0], G[1]].concat(N);
|
|
726
|
-
const X = [];
|
|
727
|
-
for (let $ = 0, j = N.length; $ < j; $ += 1)
|
|
728
|
-
X[$] = $ % 2 ? st(N[$ - 1], N[$], M).y : st(N[$], N[$ + 1], M).x;
|
|
729
|
-
return X;
|
|
730
|
-
}, xe = (e, t, s, r, n, i) => {
|
|
731
|
-
const o = 0.3333333333333333, l = 2 / 3;
|
|
732
|
-
return [
|
|
733
|
-
o * e + l * s,
|
|
734
|
-
// cpx1
|
|
735
|
-
o * t + l * r,
|
|
736
|
-
// cpy1
|
|
737
|
-
o * n + l * s,
|
|
738
|
-
// cpx2
|
|
739
|
-
o * i + l * r,
|
|
740
|
-
// cpy2
|
|
741
|
-
n,
|
|
742
|
-
i
|
|
743
|
-
// x,y
|
|
744
|
-
];
|
|
745
|
-
}, F = (e, t, s) => {
|
|
746
|
-
const [r, n] = e, [i, o] = t;
|
|
747
|
-
return [r + (i - r) * s, n + (o - n) * s];
|
|
748
|
-
}, Pt = (e, t, s, r) => {
|
|
749
|
-
const n = F([e, t], [s, r], 0.3333333333333333), i = F([e, t], [s, r], 2 / 3);
|
|
750
|
-
return [n[0], n[1], i[0], i[1], s, r];
|
|
751
|
-
}, pe = (e, t) => {
|
|
752
|
-
const [s] = e, r = e.slice(1).map(Number), [n, i] = r, { x1: o, y1: l, x: c, y: a } = t;
|
|
753
|
-
return "TQ".includes(s) || (t.qx = null, t.qy = null), s === "M" ? (t.x = n, t.y = i, e) : s === "A" ? ["C"].concat(
|
|
754
|
-
Mt(
|
|
755
|
-
o,
|
|
756
|
-
l,
|
|
757
|
-
r[0],
|
|
758
|
-
r[1],
|
|
759
|
-
r[2],
|
|
760
|
-
r[3],
|
|
761
|
-
r[4],
|
|
762
|
-
r[5],
|
|
763
|
-
r[6]
|
|
764
|
-
)
|
|
765
|
-
) : s === "Q" ? (t.qx = n, t.qy = i, ["C"].concat(
|
|
766
|
-
xe(o, l, r[0], r[1], r[2], r[3])
|
|
767
|
-
)) : s === "L" ? ["C"].concat(
|
|
768
|
-
Pt(o, l, n, i)
|
|
769
|
-
) : s === "Z" ? ["C"].concat(
|
|
770
|
-
Pt(o, l, c, a)
|
|
771
|
-
) : e;
|
|
772
|
-
}, Nt = (e, t) => {
|
|
773
|
-
const [s] = e, r = s.toUpperCase(), n = s !== r, { x1: i, y1: o, x2: l, y2: c, x: a, y: u } = t, f = e.slice(1);
|
|
774
|
-
let h = f.map((y, m) => y + (n ? m % 2 ? u : a : 0));
|
|
775
|
-
if ("TQ".includes(r) || (t.qx = null, t.qy = null), r === "A")
|
|
776
|
-
return h = f.slice(0, -2).concat(
|
|
777
|
-
f[5] + (n ? a : 0),
|
|
778
|
-
f[6] + (n ? u : 0)
|
|
779
|
-
), ["A"].concat(h);
|
|
780
|
-
if (r === "H")
|
|
781
|
-
return [
|
|
782
|
-
"L",
|
|
783
|
-
e[1] + (n ? a : 0),
|
|
784
|
-
o
|
|
785
|
-
];
|
|
786
|
-
if (r === "V")
|
|
787
|
-
return [
|
|
788
|
-
"L",
|
|
789
|
-
i,
|
|
790
|
-
e[1] + (n ? u : 0)
|
|
791
|
-
];
|
|
792
|
-
if (r === "L")
|
|
793
|
-
return [
|
|
794
|
-
"L",
|
|
795
|
-
e[1] + (n ? a : 0),
|
|
796
|
-
e[2] + (n ? u : 0)
|
|
797
|
-
];
|
|
798
|
-
if (r === "M")
|
|
799
|
-
return [
|
|
800
|
-
"M",
|
|
801
|
-
e[1] + (n ? a : 0),
|
|
802
|
-
e[2] + (n ? u : 0)
|
|
803
|
-
];
|
|
804
|
-
if (r === "C")
|
|
805
|
-
return ["C"].concat(h);
|
|
806
|
-
if (r === "S") {
|
|
807
|
-
const y = i * 2 - l, m = o * 2 - c;
|
|
808
|
-
return t.x1 = y, t.y1 = m, ["C", y, m].concat(h);
|
|
809
|
-
} else if (r === "T") {
|
|
810
|
-
const y = i * 2 - (t.qx ? t.qx : (
|
|
811
|
-
/* istanbul ignore next */
|
|
812
|
-
0
|
|
813
|
-
)), m = o * 2 - (t.qy ? t.qy : (
|
|
814
|
-
/* istanbul ignore next */
|
|
815
|
-
0
|
|
816
|
-
));
|
|
817
|
-
return t.qx = y, t.qy = m, ["Q", y, m].concat(h);
|
|
818
|
-
} else if (r === "Q") {
|
|
819
|
-
const [y, m] = h;
|
|
820
|
-
return t.qx = y, t.qy = m, ["Q"].concat(h);
|
|
821
|
-
} else if (r === "Z")
|
|
822
|
-
return ["Z"];
|
|
823
|
-
return e;
|
|
824
|
-
}, ut = {
|
|
825
|
-
x1: 0,
|
|
826
|
-
y1: 0,
|
|
827
|
-
x2: 0,
|
|
828
|
-
y2: 0,
|
|
829
|
-
x: 0,
|
|
830
|
-
y: 0,
|
|
831
|
-
qx: null,
|
|
832
|
-
qy: null
|
|
833
|
-
}, yt = (e) => {
|
|
834
|
-
const t = { ...ut }, s = D(e);
|
|
835
|
-
return O(s, (r, n, i, o) => {
|
|
836
|
-
t.x = i, t.y = o;
|
|
837
|
-
const l = Nt(r, t);
|
|
838
|
-
let c = pe(l, t);
|
|
839
|
-
c[0] === "C" && c.length > 7 && (s.splice(
|
|
840
|
-
n + 1,
|
|
841
|
-
0,
|
|
842
|
-
["C"].concat(c.slice(7))
|
|
843
|
-
), c = c.slice(0, 7));
|
|
844
|
-
const u = c.length;
|
|
845
|
-
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;
|
|
846
|
-
});
|
|
847
|
-
}, P = (e, t) => {
|
|
848
|
-
const s = t >= 1 ? 10 ** t : 1;
|
|
849
|
-
return t > 0 ? Math.round(e * s) / s : Math.round(e);
|
|
850
|
-
}, kt = (e, t) => {
|
|
851
|
-
const s = e.length;
|
|
852
|
-
let { round: r } = V, n = e[0], i = "";
|
|
853
|
-
r = t === "off" || typeof t == "number" && t >= 0 ? t : typeof r == "number" && r >= 0 ? r : (
|
|
854
|
-
/* istanbul ignore next @preserve */
|
|
855
|
-
"off"
|
|
856
|
-
);
|
|
857
|
-
for (let o = 0; o < s; o += 1) {
|
|
858
|
-
n = e[o];
|
|
859
|
-
const [l] = n, c = n.slice(1);
|
|
860
|
-
if (i += l, r === "off")
|
|
861
|
-
i += c.join(" ");
|
|
862
|
-
else {
|
|
863
|
-
let a = 0;
|
|
864
|
-
const u = c.length;
|
|
865
|
-
for (; a < u; )
|
|
866
|
-
i += P(c[a], r), a !== u - 1 && (i += " "), a += 1;
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
return i;
|
|
870
|
-
}, wt = (e, t) => Math.sqrt(
|
|
871
|
-
(e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])
|
|
872
|
-
), it = (e, t, s, r) => wt([e, t], [s, r]), Ht = (e, t, s, r, n) => {
|
|
873
|
-
let i = { x: e, y: t };
|
|
874
|
-
if (typeof n == "number") {
|
|
875
|
-
const o = wt([e, t], [s, r]);
|
|
876
|
-
if (n <= 0)
|
|
877
|
-
i = { x: e, y: t };
|
|
878
|
-
else if (n >= o)
|
|
879
|
-
i = { x: s, y: r };
|
|
880
|
-
else {
|
|
881
|
-
const [l, c] = F([e, t], [s, r], n / o);
|
|
882
|
-
i = { x: l, y: c };
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
return i;
|
|
886
|
-
}, It = (e, t, s, r) => {
|
|
887
|
-
const { min: n, max: i } = Math;
|
|
888
|
-
return [n(e, s), n(t, r), i(e, s), i(t, r)];
|
|
889
|
-
}, Ft = (e, t, s) => {
|
|
890
|
-
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;
|
|
891
|
-
return Math.abs(c);
|
|
892
|
-
}, Y = (e, t, s, r, n, i) => {
|
|
893
|
-
const { sin: o, cos: l } = Math, c = l(n), a = o(n), u = s * l(i), f = r * o(i);
|
|
894
|
-
return [e + c * u - a * f, t + a * u + c * f];
|
|
895
|
-
}, Et = (e, t) => {
|
|
896
|
-
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));
|
|
897
|
-
return (s * i - r * n < 0 ? -1 : 1) * Math.acos(o / l);
|
|
898
|
-
}, Lt = (e, t, s, r, n, i, o, l, c) => {
|
|
899
|
-
const { abs: a, sin: u, cos: f, sqrt: h, PI: y } = Math;
|
|
900
|
-
let m = a(s), g = a(r);
|
|
901
|
-
const M = (n % 360 + 360) % 360 * (y / 180);
|
|
902
|
-
if (e === l && t === c)
|
|
903
|
-
return {
|
|
904
|
-
rx: m,
|
|
905
|
-
ry: g,
|
|
906
|
-
startAngle: 0,
|
|
907
|
-
endAngle: 0,
|
|
908
|
-
center: { x: l, y: c }
|
|
909
|
-
};
|
|
910
|
-
if (m === 0 || g === 0)
|
|
911
|
-
return {
|
|
912
|
-
rx: m,
|
|
913
|
-
ry: g,
|
|
914
|
-
startAngle: 0,
|
|
915
|
-
endAngle: 0,
|
|
916
|
-
center: { x: (l + e) / 2, y: (c + t) / 2 }
|
|
917
|
-
};
|
|
918
|
-
const N = (e - l) / 2, x = (t - c) / 2, p = {
|
|
919
|
-
x: f(M) * N + u(M) * x,
|
|
920
|
-
y: -u(M) * N + f(M) * x
|
|
921
|
-
}, w = p.x ** 2 / m ** 2 + p.y ** 2 / g ** 2;
|
|
922
|
-
w > 1 && (m *= h(w), g *= h(w));
|
|
923
|
-
const T = m ** 2 * g ** 2 - m ** 2 * p.y ** 2 - g ** 2 * p.x ** 2, k = m ** 2 * p.y ** 2 + g ** 2 * p.x ** 2;
|
|
924
|
-
let I = T / k;
|
|
925
|
-
I = I < 0 ? 0 : I;
|
|
926
|
-
const z = (i !== o ? 1 : -1) * h(I), v = {
|
|
927
|
-
x: z * (m * p.y / g),
|
|
928
|
-
y: z * (-(g * p.x) / m)
|
|
929
|
-
}, B = {
|
|
930
|
-
x: f(M) * v.x - u(M) * v.y + (e + l) / 2,
|
|
931
|
-
y: u(M) * v.x + f(M) * v.y + (t + c) / 2
|
|
932
|
-
}, W = {
|
|
933
|
-
x: (p.x - v.x) / m,
|
|
934
|
-
y: (p.y - v.y) / g
|
|
935
|
-
}, E = Et({ x: 1, y: 0 }, W), L = {
|
|
936
|
-
x: (-p.x - v.x) / m,
|
|
937
|
-
y: (-p.y - v.y) / g
|
|
938
|
-
};
|
|
939
|
-
let R = Et(W, L);
|
|
940
|
-
!o && R > 0 ? R -= 2 * y : o && R < 0 && (R += 2 * y), R %= 2 * y;
|
|
941
|
-
const H = E + R;
|
|
942
|
-
return {
|
|
943
|
-
center: B,
|
|
944
|
-
startAngle: E,
|
|
945
|
-
endAngle: H,
|
|
946
|
-
rx: m,
|
|
947
|
-
ry: g
|
|
948
|
-
};
|
|
949
|
-
}, _t = (e, t, s, r, n, i, o, l, c) => {
|
|
950
|
-
const { rx: a, ry: u, startAngle: f, endAngle: h } = Lt(
|
|
951
|
-
e,
|
|
952
|
-
t,
|
|
953
|
-
s,
|
|
954
|
-
r,
|
|
955
|
-
n,
|
|
956
|
-
i,
|
|
957
|
-
o,
|
|
958
|
-
l,
|
|
959
|
-
c
|
|
960
|
-
);
|
|
961
|
-
return Ft(a, u, h - f);
|
|
962
|
-
}, be = (e, t, s, r, n, i, o, l, c, a) => {
|
|
963
|
-
let u = { x: e, y: t };
|
|
964
|
-
const { center: f, rx: h, ry: y, startAngle: m, endAngle: g } = Lt(
|
|
965
|
-
e,
|
|
966
|
-
t,
|
|
967
|
-
s,
|
|
968
|
-
r,
|
|
969
|
-
n,
|
|
970
|
-
i,
|
|
971
|
-
o,
|
|
972
|
-
l,
|
|
973
|
-
c
|
|
974
|
-
);
|
|
975
|
-
if (typeof a == "number") {
|
|
976
|
-
const A = Ft(h, y, g - m);
|
|
977
|
-
if (a <= 0)
|
|
978
|
-
u = { x: e, y: t };
|
|
979
|
-
else if (a >= A)
|
|
980
|
-
u = { x: l, y: c };
|
|
981
|
-
else {
|
|
982
|
-
if (e === l && t === c)
|
|
983
|
-
return { x: l, y: c };
|
|
984
|
-
if (h === 0 || y === 0)
|
|
985
|
-
return Ht(e, t, l, c, a);
|
|
986
|
-
const { PI: M, cos: N, sin: x } = Math, p = g - m, T = (n % 360 + 360) % 360 * (M / 180), k = m + p * (a / A), I = h * N(k), z = y * x(k);
|
|
987
|
-
u = {
|
|
988
|
-
x: N(T) * I - x(T) * z + f.x,
|
|
989
|
-
y: x(T) * I + N(T) * z + f.y
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
return u;
|
|
994
|
-
}, de = (e, t, s, r, n, i, o, l, c) => {
|
|
995
|
-
const { center: a, rx: u, ry: f, startAngle: h, endAngle: y } = Lt(
|
|
996
|
-
e,
|
|
997
|
-
t,
|
|
998
|
-
s,
|
|
999
|
-
r,
|
|
1000
|
-
n,
|
|
1001
|
-
i,
|
|
1002
|
-
o,
|
|
1003
|
-
l,
|
|
1004
|
-
c
|
|
1005
|
-
), m = y - h, { min: g, max: A, tan: M, atan2: N, PI: x } = Math, { x: p, y: w } = a, T = n * x / 180, k = M(T), I = N(-f * k, u), z = I, v = I + x, B = N(f, u * k), W = B + x, E = [l], L = [c];
|
|
1006
|
-
let R = g(e, l), H = A(e, l), Q = g(t, c), _ = A(t, c);
|
|
1007
|
-
const G = y - m * 1e-5, X = Y(p, w, u, f, T, G), $ = y - m * 0.99999, j = Y(p, w, u, f, T, $);
|
|
1008
|
-
if (X[0] > H || j[0] > H) {
|
|
1009
|
-
const q = Y(p, w, u, f, T, z);
|
|
1010
|
-
E.push(q[0]), L.push(q[1]);
|
|
1011
|
-
}
|
|
1012
|
-
if (X[0] < R || j[0] < R) {
|
|
1013
|
-
const q = Y(p, w, u, f, T, v);
|
|
1014
|
-
E.push(q[0]), L.push(q[1]);
|
|
1015
|
-
}
|
|
1016
|
-
if (X[1] < Q || j[1] < Q) {
|
|
1017
|
-
const q = Y(p, w, u, f, T, W);
|
|
1018
|
-
E.push(q[0]), L.push(q[1]);
|
|
1019
|
-
}
|
|
1020
|
-
if (X[1] > _ || j[1] > _) {
|
|
1021
|
-
const q = Y(p, w, u, f, T, B);
|
|
1022
|
-
E.push(q[0]), L.push(q[1]);
|
|
1023
|
-
}
|
|
1024
|
-
return R = g.apply([], E), Q = g.apply([], L), H = A.apply([], E), _ = A.apply([], L), [R, Q, H, _];
|
|
1025
|
-
}, He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1026
|
-
__proto__: null,
|
|
1027
|
-
angleBetween: Et,
|
|
1028
|
-
arcLength: Ft,
|
|
1029
|
-
arcPoint: Y,
|
|
1030
|
-
getArcBBox: de,
|
|
1031
|
-
getArcLength: _t,
|
|
1032
|
-
getArcProps: Lt,
|
|
1033
|
-
getPointAtArcLength: be
|
|
1034
|
-
}, Symbol.toStringTag, { value: "Module" })), Rt = [
|
|
1035
|
-
-0.06405689286260563,
|
|
1036
|
-
0.06405689286260563,
|
|
1037
|
-
-0.1911188674736163,
|
|
1038
|
-
0.1911188674736163,
|
|
1039
|
-
-0.3150426796961634,
|
|
1040
|
-
0.3150426796961634,
|
|
1041
|
-
-0.4337935076260451,
|
|
1042
|
-
0.4337935076260451,
|
|
1043
|
-
-0.5454214713888396,
|
|
1044
|
-
0.5454214713888396,
|
|
1045
|
-
-0.6480936519369755,
|
|
1046
|
-
0.6480936519369755,
|
|
1047
|
-
-0.7401241915785544,
|
|
1048
|
-
0.7401241915785544,
|
|
1049
|
-
-0.820001985973903,
|
|
1050
|
-
0.820001985973903,
|
|
1051
|
-
-0.8864155270044011,
|
|
1052
|
-
0.8864155270044011,
|
|
1053
|
-
-0.9382745520027328,
|
|
1054
|
-
0.9382745520027328,
|
|
1055
|
-
-0.9747285559713095,
|
|
1056
|
-
0.9747285559713095,
|
|
1057
|
-
-0.9951872199970213,
|
|
1058
|
-
0.9951872199970213
|
|
1059
|
-
], Ae = [
|
|
1060
|
-
0.12793819534675216,
|
|
1061
|
-
0.12793819534675216,
|
|
1062
|
-
0.1258374563468283,
|
|
1063
|
-
0.1258374563468283,
|
|
1064
|
-
0.12167047292780339,
|
|
1065
|
-
0.12167047292780339,
|
|
1066
|
-
0.1155056680537256,
|
|
1067
|
-
0.1155056680537256,
|
|
1068
|
-
0.10744427011596563,
|
|
1069
|
-
0.10744427011596563,
|
|
1070
|
-
0.09761865210411388,
|
|
1071
|
-
0.09761865210411388,
|
|
1072
|
-
0.08619016153195327,
|
|
1073
|
-
0.08619016153195327,
|
|
1074
|
-
0.0733464814110803,
|
|
1075
|
-
0.0733464814110803,
|
|
1076
|
-
0.05929858491543678,
|
|
1077
|
-
0.05929858491543678,
|
|
1078
|
-
0.04427743881741981,
|
|
1079
|
-
0.04427743881741981,
|
|
1080
|
-
0.028531388628933663,
|
|
1081
|
-
0.028531388628933663,
|
|
1082
|
-
0.0123412297999872,
|
|
1083
|
-
0.0123412297999872
|
|
1084
|
-
], Me = (e) => {
|
|
1085
|
-
const t = [];
|
|
1086
|
-
for (let s = e, r = s.length, n = r - 1; r > 1; r -= 1, n -= 1) {
|
|
1087
|
-
const i = [];
|
|
1088
|
-
for (let o = 0; o < n; o += 1)
|
|
1089
|
-
i.push({
|
|
1090
|
-
x: n * (s[o + 1].x - s[o].x),
|
|
1091
|
-
y: n * (s[o + 1].y - s[o].y),
|
|
1092
|
-
t: 0
|
|
1093
|
-
});
|
|
1094
|
-
t.push(i), s = i;
|
|
1095
|
-
}
|
|
1096
|
-
return t;
|
|
1097
|
-
}, Ne = (e, t) => {
|
|
1098
|
-
if (t === 0)
|
|
1099
|
-
return e[0].t = 0, e[0];
|
|
1100
|
-
const s = e.length - 1;
|
|
1101
|
-
if (t === 1)
|
|
1102
|
-
return e[s].t = 1, e[s];
|
|
1103
|
-
const r = 1 - t;
|
|
1104
|
-
let n = e;
|
|
1105
|
-
if (s === 0)
|
|
1106
|
-
return e[0].t = t, e[0];
|
|
1107
|
-
if (s === 1)
|
|
1108
|
-
return {
|
|
1109
|
-
x: r * n[0].x + t * n[1].x,
|
|
1110
|
-
y: r * n[0].y + t * n[1].y,
|
|
1111
|
-
t
|
|
1112
|
-
};
|
|
1113
|
-
const i = r * r, o = t * t;
|
|
1114
|
-
let l = 0, c = 0, a = 0, u = 0;
|
|
1115
|
-
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), {
|
|
1116
|
-
x: l * n[0].x + c * n[1].x + a * n[2].x + u * n[3].x,
|
|
1117
|
-
y: l * n[0].y + c * n[1].y + a * n[2].y + u * n[3].y,
|
|
1118
|
-
t
|
|
1119
|
-
};
|
|
1120
|
-
}, we = (e, t) => {
|
|
1121
|
-
const s = e(t), r = s.x * s.x + s.y * s.y;
|
|
1122
|
-
return Math.sqrt(r);
|
|
1123
|
-
}, Le = (e) => {
|
|
1124
|
-
const s = Rt.length;
|
|
1125
|
-
let r = 0;
|
|
1126
|
-
for (let n = 0, i; n < s; n++)
|
|
1127
|
-
i = 0.5 * Rt[n] + 0.5, r += Ae[n] * we(e, i);
|
|
1128
|
-
return 0.5 * r;
|
|
1129
|
-
}, mt = (e) => {
|
|
1130
|
-
const t = [];
|
|
1131
|
-
for (let r = 0, n = e.length, i = 2; r < n; r += i)
|
|
1132
|
-
t.push({
|
|
1133
|
-
x: e[r],
|
|
1134
|
-
y: e[r + 1]
|
|
1135
|
-
});
|
|
1136
|
-
const s = Me(t);
|
|
1137
|
-
return Le((r) => Ne(s[0], r));
|
|
1138
|
-
}, Te = 1e-8, gt = ([e, t, s]) => {
|
|
1139
|
-
const r = Math.min(e, s), n = Math.max(e, s);
|
|
1140
|
-
if (t >= e ? s >= t : s <= t)
|
|
1141
|
-
return [r, n];
|
|
1142
|
-
const i = (e * s - t * t) / (e - 2 * t + s);
|
|
1143
|
-
return i < r ? [i, n] : [r, i];
|
|
1144
|
-
}, jt = ([e, t, s, r]) => {
|
|
1145
|
-
const n = e - 3 * t + 3 * s - r;
|
|
1146
|
-
if (Math.abs(n) < Te)
|
|
1147
|
-
return e === r && e === t ? [e, r] : gt([e, -0.5 * e + 1.5 * t, e - 3 * t + 3 * s]);
|
|
1148
|
-
const i = -e * s + e * r - t * s - t * r + t * t + s * s;
|
|
1149
|
-
if (i <= 0)
|
|
1150
|
-
return [Math.min(e, r), Math.max(e, r)];
|
|
1151
|
-
const o = Math.sqrt(i);
|
|
1152
|
-
let l = Math.min(e, r), c = Math.max(e, r);
|
|
1153
|
-
const a = e - 2 * t + s;
|
|
1154
|
-
for (let u = (a + o) / n, f = 1; f <= 2; u = (a - o) / n, f++)
|
|
1155
|
-
if (u > 0 && u < 1) {
|
|
1156
|
-
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;
|
|
1157
|
-
h < l && (l = h), h > c && (c = h);
|
|
1158
|
-
}
|
|
1159
|
-
return [l, c];
|
|
1160
|
-
}, Ce = ([e, t, s, r, n, i, o, l], c) => {
|
|
1161
|
-
const a = 1 - c;
|
|
1162
|
-
return {
|
|
1163
|
-
x: a ** 3 * e + 3 * a ** 2 * c * s + 3 * a * c ** 2 * n + c ** 3 * o,
|
|
1164
|
-
y: a ** 3 * t + 3 * a ** 2 * c * r + 3 * a * c ** 2 * i + c ** 3 * l
|
|
1165
|
-
};
|
|
1166
|
-
}, xt = (e, t, s, r, n, i, o, l) => mt([e, t, s, r, n, i, o, l]), ve = (e, t, s, r, n, i, o, l, c) => {
|
|
1167
|
-
const a = typeof c == "number";
|
|
1168
|
-
let u = { x: e, y: t };
|
|
1169
|
-
if (a) {
|
|
1170
|
-
const f = mt([e, t, s, r, n, i, o, l]);
|
|
1171
|
-
c <= 0 || (c >= f ? u = { x: o, y: l } : u = Ce(
|
|
1172
|
-
[e, t, s, r, n, i, o, l],
|
|
1173
|
-
c / f
|
|
1174
|
-
));
|
|
1175
|
-
}
|
|
1176
|
-
return u;
|
|
1177
|
-
}, St = (e, t, s, r, n, i, o, l) => {
|
|
1178
|
-
const c = jt([e, s, n, o]), a = jt([t, r, i, l]);
|
|
1179
|
-
return [c[0], a[0], c[1], a[1]];
|
|
1180
|
-
}, $e = ([e, t, s, r, n, i], o) => {
|
|
1181
|
-
const l = 1 - o;
|
|
1182
|
-
return {
|
|
1183
|
-
x: l ** 2 * e + 2 * l * o * s + o ** 2 * n,
|
|
1184
|
-
y: l ** 2 * t + 2 * l * o * r + o ** 2 * i
|
|
1185
|
-
};
|
|
1186
|
-
}, pt = (e, t, s, r, n, i) => mt([e, t, s, r, n, i]), ze = (e, t, s, r, n, i, o) => {
|
|
1187
|
-
const l = typeof o == "number";
|
|
1188
|
-
let c = { x: e, y: t };
|
|
1189
|
-
if (l) {
|
|
1190
|
-
const a = mt([e, t, s, r, n, i]);
|
|
1191
|
-
o <= 0 || (o >= a ? c = { x: n, y: i } : c = $e(
|
|
1192
|
-
[e, t, s, r, n, i],
|
|
1193
|
-
o / a
|
|
1194
|
-
));
|
|
1195
|
-
}
|
|
1196
|
-
return c;
|
|
1197
|
-
}, Qt = (e, t, s, r, n, i) => {
|
|
1198
|
-
const o = gt([e, s, n]), l = gt([t, r, i]);
|
|
1199
|
-
return [o[0], l[0], o[1], l[1]];
|
|
1200
|
-
}, Fe = (e) => {
|
|
1201
|
-
const t = e.length;
|
|
1202
|
-
let s = -1, r, n = e[t - 1], i = 0;
|
|
1203
|
-
for (; ++s < t; )
|
|
1204
|
-
r = n, n = e[s], i += r[1] * n[0] - r[0] * n[1];
|
|
1205
|
-
return i / 2;
|
|
1206
|
-
}, _e = (e) => e.reduce((t, s, r) => r ? t + wt(e[r - 1], s) : 0, 0), bt = 1e-5, ot = (e) => {
|
|
1207
|
-
const t = D(e), s = { ...ut };
|
|
1208
|
-
return O(t, (r, n, i, o) => {
|
|
1209
|
-
s.x = i, s.y = o;
|
|
1210
|
-
const l = Nt(r, s), c = l.length;
|
|
1211
|
-
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;
|
|
1212
|
-
});
|
|
1213
|
-
}, rt = (e, t) => {
|
|
1214
|
-
const s = ot(e);
|
|
1215
|
-
let r = !1, n = [], i = "M", o = 0, l = 0, [c, a] = s[0].slice(1);
|
|
1216
|
-
const u = typeof t == "number";
|
|
1217
|
-
let f = { x: c, y: a }, h = 0, y = f, m = 0;
|
|
1218
|
-
return !u || t < bt ? f : (O(s, (g, A, M, N) => {
|
|
1219
|
-
if ([i] = g, r = i === "M", n = r ? n : [M, N].concat(g.slice(1)), r ? ([, c, a] = g, f = { x: c, y: a }, h = 0) : i === "L" ? (f = Ht(
|
|
1220
|
-
n[0],
|
|
1221
|
-
n[1],
|
|
1222
|
-
n[2],
|
|
1223
|
-
n[3],
|
|
1224
|
-
t - m
|
|
1225
|
-
), h = it(n[0], n[1], n[2], n[3])) : i === "A" ? (f = be(
|
|
1226
|
-
n[0],
|
|
1227
|
-
n[1],
|
|
1228
|
-
n[2],
|
|
1229
|
-
n[3],
|
|
1230
|
-
n[4],
|
|
1231
|
-
n[5],
|
|
1232
|
-
n[6],
|
|
1233
|
-
n[7],
|
|
1234
|
-
n[8],
|
|
1235
|
-
t - m
|
|
1236
|
-
), h = _t(
|
|
1237
|
-
n[0],
|
|
1238
|
-
n[1],
|
|
1239
|
-
n[2],
|
|
1240
|
-
n[3],
|
|
1241
|
-
n[4],
|
|
1242
|
-
n[5],
|
|
1243
|
-
n[6],
|
|
1244
|
-
n[7],
|
|
1245
|
-
n[8]
|
|
1246
|
-
)) : i === "C" ? (f = ve(
|
|
1247
|
-
n[0],
|
|
1248
|
-
n[1],
|
|
1249
|
-
n[2],
|
|
1250
|
-
n[3],
|
|
1251
|
-
n[4],
|
|
1252
|
-
n[5],
|
|
1253
|
-
n[6],
|
|
1254
|
-
n[7],
|
|
1255
|
-
t - m
|
|
1256
|
-
), h = xt(
|
|
1257
|
-
n[0],
|
|
1258
|
-
n[1],
|
|
1259
|
-
n[2],
|
|
1260
|
-
n[3],
|
|
1261
|
-
n[4],
|
|
1262
|
-
n[5],
|
|
1263
|
-
n[6],
|
|
1264
|
-
n[7]
|
|
1265
|
-
)) : i === "Q" ? (f = ze(
|
|
1266
|
-
n[0],
|
|
1267
|
-
n[1],
|
|
1268
|
-
n[2],
|
|
1269
|
-
n[3],
|
|
1270
|
-
n[4],
|
|
1271
|
-
n[5],
|
|
1272
|
-
t - m
|
|
1273
|
-
), h = pt(
|
|
1274
|
-
n[0],
|
|
1275
|
-
n[1],
|
|
1276
|
-
n[2],
|
|
1277
|
-
n[3],
|
|
1278
|
-
n[4],
|
|
1279
|
-
n[5]
|
|
1280
|
-
)) : i === "Z" && (n = [M, N, c, a], f = { x: c, y: a }, h = it(n[0], n[1], n[2], n[3])), [o, l] = n.slice(-2), m < t)
|
|
1281
|
-
y = f;
|
|
1282
|
-
else
|
|
1283
|
-
return !1;
|
|
1284
|
-
m += h;
|
|
1285
|
-
}), t > m - bt ? { x: o, y: l } : y);
|
|
1286
|
-
}, nt = (e) => {
|
|
1287
|
-
const t = D(e);
|
|
1288
|
-
let s = 0, r = 0, n = 0, i = 0, o = 0, l = 0, c = "M", a = 0, u = 0, f = 0;
|
|
1289
|
-
return O(t, (h, y, m, g) => {
|
|
1290
|
-
[c] = h;
|
|
1291
|
-
const A = c.toUpperCase(), N = A !== c ? at(h, y, m, g) : h.slice(0), x = A === "V" ? ["L", m, N[1]] : A === "H" ? ["L", N[1], g] : N;
|
|
1292
|
-
if ([c] = x, "TQ".includes(A) || (o = 0, l = 0), c === "M")
|
|
1293
|
-
[, a, u] = x;
|
|
1294
|
-
else if (c === "L")
|
|
1295
|
-
f += it(
|
|
1296
|
-
m,
|
|
1297
|
-
g,
|
|
1298
|
-
x[1],
|
|
1299
|
-
x[2]
|
|
1300
|
-
);
|
|
1301
|
-
else if (c === "A")
|
|
1302
|
-
f += _t(
|
|
1303
|
-
m,
|
|
1304
|
-
g,
|
|
1305
|
-
x[1],
|
|
1306
|
-
x[2],
|
|
1307
|
-
x[3],
|
|
1308
|
-
x[4],
|
|
1309
|
-
x[5],
|
|
1310
|
-
x[6],
|
|
1311
|
-
x[7]
|
|
1312
|
-
);
|
|
1313
|
-
else if (c === "S") {
|
|
1314
|
-
const p = s * 2 - n, w = r * 2 - i;
|
|
1315
|
-
f += xt(
|
|
1316
|
-
m,
|
|
1317
|
-
g,
|
|
1318
|
-
p,
|
|
1319
|
-
w,
|
|
1320
|
-
x[1],
|
|
1321
|
-
x[2],
|
|
1322
|
-
x[3],
|
|
1323
|
-
x[4]
|
|
1324
|
-
);
|
|
1325
|
-
} else c === "C" ? f += xt(
|
|
1326
|
-
m,
|
|
1327
|
-
g,
|
|
1328
|
-
x[1],
|
|
1329
|
-
x[2],
|
|
1330
|
-
x[3],
|
|
1331
|
-
x[4],
|
|
1332
|
-
x[5],
|
|
1333
|
-
x[6]
|
|
1334
|
-
) : c === "T" ? (o = s * 2 - o, l = r * 2 - l, f += pt(
|
|
1335
|
-
m,
|
|
1336
|
-
g,
|
|
1337
|
-
o,
|
|
1338
|
-
l,
|
|
1339
|
-
x[1],
|
|
1340
|
-
x[2]
|
|
1341
|
-
)) : c === "Q" ? (o = x[1], l = x[2], f += pt(
|
|
1342
|
-
m,
|
|
1343
|
-
g,
|
|
1344
|
-
x[1],
|
|
1345
|
-
x[2],
|
|
1346
|
-
x[3],
|
|
1347
|
-
x[4]
|
|
1348
|
-
)) : c === "Z" && (f += it(m, g, a, u));
|
|
1349
|
-
[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];
|
|
1350
|
-
}), f;
|
|
1351
|
-
}, Ut = (e, t) => {
|
|
1352
|
-
const s = D(e);
|
|
1353
|
-
let r = s.slice(0), n = nt(r), i = r.length - 1, o = 0, l = 0, c = s[0];
|
|
1354
|
-
if (i <= 0 || !t || !Number.isFinite(t))
|
|
1355
|
-
return {
|
|
1356
|
-
segment: c,
|
|
1357
|
-
index: 0,
|
|
1358
|
-
length: l,
|
|
1359
|
-
lengthAtSegment: o
|
|
1360
|
-
};
|
|
1361
|
-
if (t >= n)
|
|
1362
|
-
return r = s.slice(0, -1), o = nt(r), l = n - o, c = s[i], {
|
|
1363
|
-
segment: c,
|
|
1364
|
-
index: i,
|
|
1365
|
-
length: l,
|
|
1366
|
-
lengthAtSegment: o
|
|
1367
|
-
};
|
|
1368
|
-
const a = [];
|
|
1369
|
-
for (; i > 0; )
|
|
1370
|
-
c = r[i], r = r.slice(0, -1), o = nt(r), l = n - o, n = o, a.push({
|
|
1371
|
-
segment: c,
|
|
1372
|
-
index: i,
|
|
1373
|
-
length: l,
|
|
1374
|
-
lengthAtSegment: o
|
|
1375
|
-
}), i -= 1;
|
|
1376
|
-
return a.find(
|
|
1377
|
-
({ lengthAtSegment: u }) => u <= t
|
|
1378
|
-
);
|
|
1379
|
-
}, Tt = (e, t) => {
|
|
1380
|
-
const s = D(e), r = ot(s), n = nt(r), i = (p) => {
|
|
1381
|
-
const w = p.x - t.x, T = p.y - t.y;
|
|
1382
|
-
return w * w + T * T;
|
|
1383
|
-
};
|
|
1384
|
-
let o = 8, l, c = { x: 0, y: 0 }, a = 0, u = 0, f = 1 / 0;
|
|
1385
|
-
for (let p = 0; p <= n; p += o)
|
|
1386
|
-
l = rt(r, p), a = i(l), a < f && (c = l, u = p, f = a);
|
|
1387
|
-
o /= 2;
|
|
1388
|
-
let h, y, m = 0, g = 0, A = 0, M = 0;
|
|
1389
|
-
for (; o > 1e-6 && (m = u - o, h = rt(r, m), A = i(h), g = u + o, y = rt(r, g), M = i(y), m >= 0 && A < f ? (c = h, u = m, f = A) : g <= n && M < f ? (c = y, u = g, f = M) : o /= 2, !(o < 1e-5)); )
|
|
1390
|
-
;
|
|
1391
|
-
const N = Ut(s, u), x = Math.sqrt(f);
|
|
1392
|
-
return { closest: c, distance: x, segment: N };
|
|
1393
|
-
}, Ue = (e, t) => Tt(e, t).closest, Je = (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) => {
|
|
1394
|
-
let t = 0, s = 0, r = 0;
|
|
1395
|
-
return yt(e).map((n) => {
|
|
1396
|
-
switch (n[0]) {
|
|
1397
|
-
case "M":
|
|
1398
|
-
return [, t, s] = n, 0;
|
|
1399
|
-
default:
|
|
1400
|
-
return r = Je(
|
|
1401
|
-
t,
|
|
1402
|
-
s,
|
|
1403
|
-
n[1],
|
|
1404
|
-
n[2],
|
|
1405
|
-
n[3],
|
|
1406
|
-
n[4],
|
|
1407
|
-
n[5],
|
|
1408
|
-
n[6]
|
|
1409
|
-
), [t, s] = n.slice(-2), r;
|
|
1410
|
-
}
|
|
1411
|
-
}).reduce((n, i) => n + i, 0);
|
|
1412
|
-
}, Ke = (e) => qe(yt(e)) >= 0, Wt = (e) => {
|
|
1413
|
-
if (!e)
|
|
1414
|
-
return {
|
|
1415
|
-
x: 0,
|
|
1416
|
-
y: 0,
|
|
1417
|
-
width: 0,
|
|
1418
|
-
height: 0,
|
|
1419
|
-
x2: 0,
|
|
1420
|
-
y2: 0,
|
|
1421
|
-
cx: 0,
|
|
1422
|
-
cy: 0,
|
|
1423
|
-
cz: 0
|
|
1424
|
-
};
|
|
1425
|
-
const t = D(e);
|
|
1426
|
-
let s = "M", r = 0, n = 0;
|
|
1427
|
-
const { max: i, min: o } = Math;
|
|
1428
|
-
let l = 1 / 0, c = 1 / 0, a = -1 / 0, u = -1 / 0, f = 0, h = 0, y = 0, m = 0, g = 0, A = 0, M = 0, N = 0, x = 0, p = 0;
|
|
1429
|
-
O(t, (k, I, z, v) => {
|
|
1430
|
-
[s] = k;
|
|
1431
|
-
const B = s.toUpperCase(), E = B !== s ? at(k, I, z, v) : k.slice(0), L = B === "V" ? ["L", z, E[1]] : B === "H" ? ["L", E[1], v] : E;
|
|
1432
|
-
if ([s] = L, "TQ".includes(B) || (x = 0, p = 0), s === "M")
|
|
1433
|
-
[, r, n] = L, f = r, h = n, y = r, m = n;
|
|
1434
|
-
else if (s === "L")
|
|
1435
|
-
[f, h, y, m] = It(
|
|
1436
|
-
z,
|
|
1437
|
-
v,
|
|
1438
|
-
L[1],
|
|
1439
|
-
L[2]
|
|
1440
|
-
);
|
|
1441
|
-
else if (s === "A")
|
|
1442
|
-
[f, h, y, m] = de(
|
|
1443
|
-
z,
|
|
1444
|
-
v,
|
|
1445
|
-
L[1],
|
|
1446
|
-
L[2],
|
|
1447
|
-
L[3],
|
|
1448
|
-
L[4],
|
|
1449
|
-
L[5],
|
|
1450
|
-
L[6],
|
|
1451
|
-
L[7]
|
|
1452
|
-
);
|
|
1453
|
-
else if (s === "S") {
|
|
1454
|
-
const R = g * 2 - M, H = A * 2 - N;
|
|
1455
|
-
[f, h, y, m] = St(
|
|
1456
|
-
z,
|
|
1457
|
-
v,
|
|
1458
|
-
R,
|
|
1459
|
-
H,
|
|
1460
|
-
L[1],
|
|
1461
|
-
L[2],
|
|
1462
|
-
L[3],
|
|
1463
|
-
L[4]
|
|
1464
|
-
);
|
|
1465
|
-
} else s === "C" ? [f, h, y, m] = St(
|
|
1466
|
-
z,
|
|
1467
|
-
v,
|
|
1468
|
-
L[1],
|
|
1469
|
-
L[2],
|
|
1470
|
-
L[3],
|
|
1471
|
-
L[4],
|
|
1472
|
-
L[5],
|
|
1473
|
-
L[6]
|
|
1474
|
-
) : s === "T" ? (x = g * 2 - x, p = A * 2 - p, [f, h, y, m] = Qt(
|
|
1475
|
-
z,
|
|
1476
|
-
v,
|
|
1477
|
-
x,
|
|
1478
|
-
p,
|
|
1479
|
-
L[1],
|
|
1480
|
-
L[2]
|
|
1481
|
-
)) : s === "Q" ? (x = L[1], p = L[2], [f, h, y, m] = Qt(
|
|
1482
|
-
z,
|
|
1483
|
-
v,
|
|
1484
|
-
L[1],
|
|
1485
|
-
L[2],
|
|
1486
|
-
L[3],
|
|
1487
|
-
L[4]
|
|
1488
|
-
)) : s === "Z" && ([f, h, y, m] = It(z, v, r, n));
|
|
1489
|
-
l = o(f, l), c = o(h, c), a = i(y, a), u = i(m, u), [g, A] = s === "Z" ? [r, n] : L.slice(-2), [M, N] = s === "C" ? [L[3], L[4]] : s === "S" ? [L[1], L[2]] : [g, A];
|
|
1490
|
-
});
|
|
1491
|
-
const w = a - l, T = u - c;
|
|
1492
|
-
return {
|
|
1493
|
-
width: w,
|
|
1494
|
-
height: T,
|
|
1495
|
-
x: l,
|
|
1496
|
-
y: c,
|
|
1497
|
-
x2: a,
|
|
1498
|
-
y2: u,
|
|
1499
|
-
cx: l + w / 2,
|
|
1500
|
-
cy: c + T / 2,
|
|
1501
|
-
// an estimated guess
|
|
1502
|
-
cz: Math.max(w, T) + Math.min(w, T) / 2
|
|
1503
|
-
};
|
|
1504
|
-
}, We = (e, t) => Ut(e, t).segment, Xe = (e, t) => Tt(e, t).segment, Ct = (e) => Array.isArray(e) && e.every((t) => {
|
|
1505
|
-
const s = t[0].toLowerCase();
|
|
1506
|
-
return tt[s] === t.length - 1 && "achlmqstvz".includes(s) && t.slice(1).every(Number.isFinite);
|
|
1507
|
-
}) && e.length > 0, Pe = (e) => Ct(e) && // `isPathArray` also checks if it's `Array`
|
|
1508
|
-
e.every(([t]) => t === t.toUpperCase()), ke = (e) => Pe(e) && e.every(([t]) => "ACLMQZ".includes(t)), Ye = (e) => ke(e) && e.every(([t]) => "MC".includes(t)), Ve = (e, t) => {
|
|
1509
|
-
const { distance: s } = Tt(e, t);
|
|
1510
|
-
return Math.abs(s) < bt;
|
|
1511
|
-
}, Ge = (e) => Ct(e) && // `isPathArray` checks if it's `Array`
|
|
1512
|
-
e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => {
|
|
1513
|
-
if (typeof e != "string" || !e.length)
|
|
1514
|
-
return !1;
|
|
1515
|
-
const t = new Ot(e);
|
|
1516
|
-
for (et(t); t.index < t.max && !t.err.length; )
|
|
1517
|
-
Dt(t);
|
|
1518
|
-
return !t.err.length && "mM".includes(t.segments[0][0]);
|
|
1519
|
-
}, ct = {
|
|
1520
|
-
line: ["x1", "y1", "x2", "y2"],
|
|
1521
|
-
circle: ["cx", "cy", "r"],
|
|
1522
|
-
ellipse: ["cx", "cy", "rx", "ry"],
|
|
1523
|
-
rect: ["width", "height", "x", "y", "rx", "ry"],
|
|
1524
|
-
polygon: ["points"],
|
|
1525
|
-
polyline: ["points"],
|
|
1526
|
-
glyph: ["d"]
|
|
1527
|
-
}, Ee = (e) => e != null && typeof e == "object" && e.nodeType === 1, tn = (e) => {
|
|
1528
|
-
let { x1: t, y1: s, x2: r, y2: n } = e;
|
|
1529
|
-
return [t, s, r, n] = [t, s, r, n].map((i) => +i), [
|
|
1530
|
-
["M", t, s],
|
|
1531
|
-
["L", r, n]
|
|
1532
|
-
];
|
|
1533
|
-
}, en = (e) => {
|
|
1534
|
-
const t = [], s = (e.points || "").trim().split(/[\s|,]/).map((n) => +n);
|
|
1535
|
-
let r = 0;
|
|
1536
|
-
for (; r < s.length; )
|
|
1537
|
-
t.push([r ? "L" : "M", s[r], s[r + 1]]), r += 2;
|
|
1538
|
-
return e.type === "polygon" ? [...t, ["z"]] : t;
|
|
1539
|
-
}, nn = (e) => {
|
|
1540
|
-
let { cx: t, cy: s, r } = e;
|
|
1541
|
-
return [t, s, r] = [t, s, r].map((n) => +n), [
|
|
1542
|
-
["M", t - r, s],
|
|
1543
|
-
["a", r, r, 0, 1, 0, 2 * r, 0],
|
|
1544
|
-
["a", r, r, 0, 1, 0, -2 * r, 0]
|
|
1545
|
-
];
|
|
1546
|
-
}, sn = (e) => {
|
|
1547
|
-
let { cx: t, cy: s } = e, r = e.rx || 0, n = e.ry || r;
|
|
1548
|
-
return [t, s, r, n] = [t, s, r, n].map((i) => +i), [
|
|
1549
|
-
["M", t - r, s],
|
|
1550
|
-
["a", r, n, 0, 1, 0, 2 * r, 0],
|
|
1551
|
-
["a", r, n, 0, 1, 0, -2 * r, 0]
|
|
1552
|
-
];
|
|
1553
|
-
}, rn = (e) => {
|
|
1554
|
-
const t = +e.x || 0, s = +e.y || 0, r = +e.width, n = +e.height;
|
|
1555
|
-
let i = +(e.rx || 0), o = +(e.ry || i);
|
|
1556
|
-
return i || o ? (i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > n && (o -= (o * 2 - n) / 2), [
|
|
1557
|
-
["M", t + i, s],
|
|
1558
|
-
["h", r - i * 2],
|
|
1559
|
-
["s", i, 0, i, o],
|
|
1560
|
-
["v", n - o * 2],
|
|
1561
|
-
["s", 0, o, -i, o],
|
|
1562
|
-
["h", -r + i * 2],
|
|
1563
|
-
["s", -i, 0, -i, -o],
|
|
1564
|
-
["v", -n + o * 2],
|
|
1565
|
-
["s", 0, -o, i, -o]
|
|
1566
|
-
]) : [["M", t, s], ["h", r], ["v", n], ["H", t], ["Z"]];
|
|
1567
|
-
}, Re = (e) => {
|
|
1568
|
-
const t = Object.keys(ct), s = Ee(e), r = s ? e.tagName : null;
|
|
1569
|
-
if (r && [...t, "path"].every((c) => r !== c))
|
|
1570
|
-
throw TypeError(`${Z}: "${r}" is not SVGElement`);
|
|
1571
|
-
const n = s ? r : e.type, i = ct[n], o = { type: n };
|
|
1572
|
-
s ? i.forEach((c) => {
|
|
1573
|
-
o[c] = e.getAttribute(c);
|
|
1574
|
-
}) : Object.assign(o, e);
|
|
1575
|
-
let l = [];
|
|
1576
|
-
return n === "circle" ? l = nn(o) : n === "ellipse" ? l = sn(o) : ["polyline", "polygon"].includes(n) ? l = en(o) : n === "rect" ? l = rn(o) : n === "line" ? l = tn(o) : ["glyph", "path"].includes(n) && (l = D(
|
|
1577
|
-
s ? e.getAttribute("d") || /* istanbul ignore next @preserve */
|
|
1578
|
-
"" : e.d || ""
|
|
1579
|
-
)), Ct(l) && l.length ? l : !1;
|
|
1580
|
-
}, on = (e, t, s) => {
|
|
1581
|
-
const r = s || document, n = Object.keys(ct), i = Ee(e), o = i ? e.tagName : null;
|
|
1582
|
-
if (o === "path")
|
|
1583
|
-
throw TypeError(`${Z}: "${o}" is already SVGPathElement`);
|
|
1584
|
-
if (o && n.every((m) => o !== m))
|
|
1585
|
-
throw TypeError(`${Z}: "${o}" is not SVGElement`);
|
|
1586
|
-
const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), c = i ? o : e.type, a = ct[c], u = { type: c }, f = V.round, h = Re(e), y = h && h.length ? kt(h, f) : "";
|
|
1587
|
-
return i ? (a.forEach((m) => {
|
|
1588
|
-
u[m] = e.getAttribute(m);
|
|
1589
|
-
}), Object.values(e.attributes).forEach(({ name: m, value: g }) => {
|
|
1590
|
-
a.includes(m) || l.setAttribute(m, g);
|
|
1591
|
-
})) : (Object.assign(u, e), Object.keys(u).forEach((m) => {
|
|
1592
|
-
!a.includes(m) && m !== "type" && l.setAttribute(
|
|
1593
|
-
m.replace(/[A-Z]/g, (g) => `-${g.toLowerCase()}`),
|
|
1594
|
-
u[m]
|
|
1595
|
-
);
|
|
1596
|
-
})), Ie(y) ? (l.setAttribute("d", y), t && i && (e.before(l, e), e.remove()), l) : !1;
|
|
1597
|
-
}, je = (e) => {
|
|
1598
|
-
let t = new C();
|
|
1599
|
-
const { origin: s } = e, [r, n] = s, { translate: i } = e, { rotate: o } = e, { skew: l } = e, { scale: c } = e;
|
|
1600
|
-
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(
|
|
1601
|
-
(a) => !Number.isNaN(+a)
|
|
1602
|
-
) && 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(
|
|
1603
|
-
(a) => !Number.isNaN(+a)
|
|
1604
|
-
) && 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;
|
|
1605
|
-
}, Se = (e, t, s, r) => {
|
|
1606
|
-
const [n] = e, { round: i } = V, o = typeof i == "number" ? i : (
|
|
1607
|
-
/* istanbul ignore next */
|
|
1608
|
-
4
|
|
1609
|
-
), l = t.slice(1), { x1: c, y1: a, x2: u, y2: f, x: h, y } = s, [m, g] = l.slice(-2), A = e;
|
|
1610
|
-
if ("TQ".includes(n) || (s.qx = null, s.qy = null), n === "L") {
|
|
1611
|
-
if (P(h, o) === P(m, o))
|
|
1612
|
-
return ["V", g];
|
|
1613
|
-
if (P(y, o) === P(g, o))
|
|
1614
|
-
return ["H", m];
|
|
1615
|
-
} else if (n === "C") {
|
|
1616
|
-
const [M, N] = l;
|
|
1617
|
-
if (s.x1 = M, s.y1 = N, "CS".includes(r) && (P(M, o) === P(c * 2 - u, o) && P(N, o) === P(a * 2 - f, o) || P(c, o) === P(u * 2 - h, o) && P(a, o) === P(f * 2 - y, o)))
|
|
1618
|
-
return [
|
|
1619
|
-
"S",
|
|
1620
|
-
l[2],
|
|
1621
|
-
l[3],
|
|
1622
|
-
l[4],
|
|
1623
|
-
l[5]
|
|
1624
|
-
];
|
|
1625
|
-
} else if (n === "Q") {
|
|
1626
|
-
const [M, N] = l;
|
|
1627
|
-
if (s.qx = M, s.qy = N, "QT".includes(r) && P(M, o) === P(c * 2 - u, o) && P(N, o) === P(a * 2 - f, o))
|
|
1628
|
-
return ["T", l[2], l[3]];
|
|
1629
|
-
}
|
|
1630
|
-
return A;
|
|
1631
|
-
}, dt = (e, t) => {
|
|
1632
|
-
const s = e.slice(1).map(
|
|
1633
|
-
(r) => P(r, t)
|
|
1634
|
-
);
|
|
1635
|
-
return [e[0]].concat(s);
|
|
1636
|
-
}, Xt = (e, t) => {
|
|
1637
|
-
const s = ht(e), r = typeof t == "number" && t >= 0 ? t : (
|
|
1638
|
-
/* istanbul ignore next @preserve */
|
|
1639
|
-
2
|
|
1640
|
-
), n = { ...ut }, i = [];
|
|
1641
|
-
let o = "M", l = "Z";
|
|
1642
|
-
return O(s, (c, a, u, f) => {
|
|
1643
|
-
n.x = u, n.y = f;
|
|
1644
|
-
const h = Nt(c, n);
|
|
1645
|
-
let y = c;
|
|
1646
|
-
if ([o] = c, i[a] = o, a) {
|
|
1647
|
-
l = i[a - 1];
|
|
1648
|
-
const g = Se(
|
|
1649
|
-
c,
|
|
1650
|
-
h,
|
|
1651
|
-
n,
|
|
1652
|
-
l
|
|
1653
|
-
), A = dt(g, r), M = A.join(""), N = Bt(g, a, u, f), x = dt(N, r), p = x.join("");
|
|
1654
|
-
y = M.length < p.length ? A : x;
|
|
1655
|
-
}
|
|
1656
|
-
const m = h.length;
|
|
1657
|
-
return n.x1 = +h[m - 2], n.y1 = +h[m - 1], n.x2 = +h[m - 4] || n.x1, n.y2 = +h[m - 3] || n.y1, y;
|
|
1658
|
-
});
|
|
1659
|
-
}, cn = (e, t) => {
|
|
1660
|
-
let s = C.Translate(t[0], t[1], t[2]);
|
|
1661
|
-
return [, , , s.m44] = t, s = e.multiply(s), [s.m41, s.m42, s.m43, s.m44];
|
|
1662
|
-
}, Zt = (e, t, s) => {
|
|
1663
|
-
const [r, n, i] = s, [o, l, c] = cn(e, [t[0], t[1], 0, 1]), a = o - r, u = l - n, f = c - i;
|
|
1664
|
-
return [
|
|
1665
|
-
// protect against division by ZERO
|
|
1666
|
-
a * (Math.abs(i) / Math.abs(f) || 1) + r,
|
|
1667
|
-
u * (Math.abs(i) / Math.abs(f) || 1) + n
|
|
1668
|
-
];
|
|
1669
|
-
}, ln = (e) => {
|
|
1670
|
-
const t = e.slice(1).map(
|
|
1671
|
-
(s, r, n) => r ? n[r - 1].slice(-2).concat(s.slice(1)) : e[0].slice(1).concat(s.slice(1))
|
|
1672
|
-
).map((s) => s.map((r, n) => s[s.length - n - 2 * (1 - n % 2)])).reverse();
|
|
1673
|
-
return [["M"].concat(t[0].slice(0, 2))].concat(
|
|
1674
|
-
t.map((s) => ["C"].concat(s.slice(2)))
|
|
1675
|
-
);
|
|
1676
|
-
}, ft = (e) => {
|
|
1677
|
-
const t = ht(e), s = ot(t), r = t.length, n = t[r - 1][0] === "Z", i = O(t, (o, l) => {
|
|
1678
|
-
const c = s[l], a = l && t[l - 1], u = a && a[0], f = t[l + 1], h = f && f[0], [y] = o, [m, g] = s[l ? l - 1 : r - 1].slice(-2);
|
|
1679
|
-
let A = o;
|
|
1680
|
-
switch (y) {
|
|
1681
|
-
case "M":
|
|
1682
|
-
A = n ? ["Z"] : [y, m, g];
|
|
1683
|
-
break;
|
|
1684
|
-
case "A":
|
|
1685
|
-
A = [
|
|
1686
|
-
y,
|
|
1687
|
-
o[1],
|
|
1688
|
-
o[2],
|
|
1689
|
-
o[3],
|
|
1690
|
-
o[4],
|
|
1691
|
-
o[5] === 1 ? 0 : 1,
|
|
1692
|
-
m,
|
|
1693
|
-
g
|
|
1694
|
-
];
|
|
1695
|
-
break;
|
|
1696
|
-
case "C":
|
|
1697
|
-
f && h === "S" ? A = ["S", o[1], o[2], m, g] : A = [
|
|
1698
|
-
y,
|
|
1699
|
-
o[3],
|
|
1700
|
-
o[4],
|
|
1701
|
-
o[1],
|
|
1702
|
-
o[2],
|
|
1703
|
-
m,
|
|
1704
|
-
g
|
|
1705
|
-
];
|
|
1706
|
-
break;
|
|
1707
|
-
case "S":
|
|
1708
|
-
u && "CS".includes(u) && (!f || h !== "S") ? A = [
|
|
1709
|
-
"C",
|
|
1710
|
-
c[3],
|
|
1711
|
-
c[4],
|
|
1712
|
-
c[1],
|
|
1713
|
-
c[2],
|
|
1714
|
-
m,
|
|
1715
|
-
g
|
|
1716
|
-
] : A = [
|
|
1717
|
-
y,
|
|
1718
|
-
c[1],
|
|
1719
|
-
c[2],
|
|
1720
|
-
m,
|
|
1721
|
-
g
|
|
1722
|
-
];
|
|
1723
|
-
break;
|
|
1724
|
-
case "Q":
|
|
1725
|
-
f && h === "T" ? A = ["T", m, g] : A = [y, o[1], o[2], m, g];
|
|
1726
|
-
break;
|
|
1727
|
-
case "T":
|
|
1728
|
-
u && "QT".includes(u) && (!f || h !== "T") ? A = [
|
|
1729
|
-
"Q",
|
|
1730
|
-
c[1],
|
|
1731
|
-
c[2],
|
|
1732
|
-
m,
|
|
1733
|
-
g
|
|
1734
|
-
] : A = [y, m, g];
|
|
1735
|
-
break;
|
|
1736
|
-
case "Z":
|
|
1737
|
-
A = ["M", m, g];
|
|
1738
|
-
break;
|
|
1739
|
-
case "H":
|
|
1740
|
-
A = [y, m];
|
|
1741
|
-
break;
|
|
1742
|
-
case "V":
|
|
1743
|
-
A = [y, g];
|
|
1744
|
-
break;
|
|
1745
|
-
default:
|
|
1746
|
-
A = [y].concat(
|
|
1747
|
-
o.slice(1, -2),
|
|
1748
|
-
m,
|
|
1749
|
-
g
|
|
1750
|
-
);
|
|
1751
|
-
}
|
|
1752
|
-
return A;
|
|
1753
|
-
});
|
|
1754
|
-
return n ? i.reverse() : [i[0]].concat(i.slice(1).reverse());
|
|
1755
|
-
}, an = (e, t) => {
|
|
1756
|
-
let { round: s } = V;
|
|
1757
|
-
return s = t === "off" || typeof t == "number" && t >= 0 ? t : typeof s == "number" && s >= 0 ? s : (
|
|
1758
|
-
/* istanbul ignore next @preserve */
|
|
1759
|
-
"off"
|
|
1760
|
-
), s === "off" ? e.slice(0) : O(e, (r) => dt(r, s));
|
|
1761
|
-
}, un = (e, t = 0.5) => {
|
|
1762
|
-
const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), l = F(r, n, s), c = F(n, i, s), a = F(i, o, s), u = F(l, c, s), f = F(c, a, s), h = F(u, f, s);
|
|
1763
|
-
return [
|
|
1764
|
-
["C", l[0], l[1], u[0], u[1], h[0], h[1]],
|
|
1765
|
-
["C", f[0], f[1], a[0], a[1], o[0], o[1]]
|
|
1766
|
-
];
|
|
1767
|
-
}, Yt = (e) => {
|
|
1768
|
-
const t = [];
|
|
1769
|
-
let s, r = -1, n = 0, i = 0, o = 0, l = 0;
|
|
1770
|
-
const c = { ...ut };
|
|
1771
|
-
return e.forEach((a) => {
|
|
1772
|
-
const [u] = a, f = u.toUpperCase(), h = u.toLowerCase(), y = u === h, m = a.slice(1);
|
|
1773
|
-
f === "M" ? (r += 1, [n, i] = m, n += y ? c.x : 0, i += y ? c.y : 0, o = n, l = i, s = [y ? [f, o, l] : a]) : (f === "Z" ? (n = o, i = l) : f === "H" ? ([, n] = a, n += y ? c.x : (
|
|
1774
|
-
/* istanbul ignore next @preserve */
|
|
1775
|
-
0
|
|
1776
|
-
)) : f === "V" ? ([, i] = a, i += y ? c.y : (
|
|
1777
|
-
/* istanbul ignore next @preserve */
|
|
1778
|
-
0
|
|
1779
|
-
)) : ([n, i] = a.slice(-2), n += y ? c.x : 0, i += y ? c.y : 0), s.push(a)), c.x = n, c.y = i, t[r] = s;
|
|
1780
|
-
}), t;
|
|
1781
|
-
}, Vt = (e, t) => {
|
|
1782
|
-
let s = 0, r = 0, n = 0, i = 0, o = 0, l = 0, c = "M";
|
|
1783
|
-
const a = D(e), u = t && Object.keys(t);
|
|
1784
|
-
if (!t || u && !u.length)
|
|
1785
|
-
return a.slice(0);
|
|
1786
|
-
t.origin || Object.assign(t, { origin: V.origin });
|
|
1787
|
-
const f = t.origin, h = je(t);
|
|
1788
|
-
return h.isIdentity ? a.slice(0) : O(a, (y, m, g, A) => {
|
|
1789
|
-
[c] = y;
|
|
1790
|
-
const M = c.toUpperCase(), x = M !== c ? at(y, m, g, A) : y.slice(0);
|
|
1791
|
-
let p = M === "A" ? ["C"].concat(
|
|
1792
|
-
Mt(
|
|
1793
|
-
g,
|
|
1794
|
-
A,
|
|
1795
|
-
x[1],
|
|
1796
|
-
x[2],
|
|
1797
|
-
x[3],
|
|
1798
|
-
x[4],
|
|
1799
|
-
x[5],
|
|
1800
|
-
x[6],
|
|
1801
|
-
x[7]
|
|
1802
|
-
)
|
|
1803
|
-
) : M === "V" ? ["L", g, x[1]] : M === "H" ? ["L", x[1], A] : x;
|
|
1804
|
-
c = p[0];
|
|
1805
|
-
const w = c === "C" && p.length > 7, T = w ? p.slice(0, 7) : p.slice(0);
|
|
1806
|
-
if (w && (a.splice(
|
|
1807
|
-
m + 1,
|
|
1808
|
-
0,
|
|
1809
|
-
["C"].concat(
|
|
1810
|
-
p.slice(7)
|
|
1811
|
-
)
|
|
1812
|
-
), p = T), c === "L")
|
|
1813
|
-
[n, i] = Zt(h, [
|
|
1814
|
-
p[1],
|
|
1815
|
-
p[2]
|
|
1816
|
-
], f), s !== n && r !== i ? p = ["L", n, i] : r === i ? p = ["H", n] : s === n && (p = ["V", i]);
|
|
1817
|
-
else
|
|
1818
|
-
for (o = 1, l = p.length; o < l; o += 2)
|
|
1819
|
-
[n, i] = Zt(
|
|
1820
|
-
h,
|
|
1821
|
-
[+p[o], +p[o + 1]],
|
|
1822
|
-
f
|
|
1823
|
-
), p[o] = n, p[o + 1] = i;
|
|
1824
|
-
return s = n, r = i, p;
|
|
1825
|
-
});
|
|
1826
|
-
};
|
|
1827
|
-
class d {
|
|
1828
|
-
/**
|
|
1829
|
-
* @constructor
|
|
1830
|
-
* @param pathValue the path string
|
|
1831
|
-
* @param config instance options
|
|
1832
|
-
*/
|
|
1833
|
-
constructor(t, s) {
|
|
1834
|
-
const r = s || {}, n = typeof t > "u";
|
|
1835
|
-
if (n || !t.length)
|
|
1836
|
-
throw TypeError(
|
|
1837
|
-
`${Z}: "pathValue" is ${n ? "undefined" : "empty"}`
|
|
1838
|
-
);
|
|
1839
|
-
this.segments = D(t);
|
|
1840
|
-
const { round: i, origin: o } = r;
|
|
1841
|
-
let l;
|
|
1842
|
-
Number.isInteger(i) || i === "off" ? l = i : l = V.round;
|
|
1843
|
-
let c = V.origin;
|
|
1844
|
-
if (Array.isArray(o) && o.length >= 2) {
|
|
1845
|
-
const [a, u, f] = o.map(Number);
|
|
1846
|
-
c = [
|
|
1847
|
-
Number.isNaN(a) ? 0 : a,
|
|
1848
|
-
Number.isNaN(u) ? 0 : u,
|
|
1849
|
-
Number.isNaN(f) ? 0 : f
|
|
1850
|
-
];
|
|
1851
|
-
}
|
|
1852
|
-
return this.round = l, this.origin = c, this;
|
|
1853
|
-
}
|
|
1854
|
-
get bbox() {
|
|
1855
|
-
return Wt(this.segments);
|
|
1856
|
-
}
|
|
1857
|
-
get length() {
|
|
1858
|
-
return nt(this.segments);
|
|
1859
|
-
}
|
|
1860
|
-
/**
|
|
1861
|
-
* Returns the path bounding box, equivalent to native `path.getBBox()`.
|
|
1862
|
-
*
|
|
1863
|
-
* @public
|
|
1864
|
-
* @returns the pathBBox
|
|
1865
|
-
*/
|
|
1866
|
-
getBBox() {
|
|
1867
|
-
return this.bbox;
|
|
1868
|
-
}
|
|
1869
|
-
/**
|
|
1870
|
-
* Returns the total path length, equivalent to native `path.getTotalLength()`.
|
|
1871
|
-
*
|
|
1872
|
-
* @public
|
|
1873
|
-
* @returns the path total length
|
|
1874
|
-
*/
|
|
1875
|
-
getTotalLength() {
|
|
1876
|
-
return this.length;
|
|
1877
|
-
}
|
|
1878
|
-
/**
|
|
1879
|
-
* Returns an `{x,y}` point in the path stroke at a given length,
|
|
1880
|
-
* equivalent to the native `path.getPointAtLength()`.
|
|
1881
|
-
*
|
|
1882
|
-
* @public
|
|
1883
|
-
* @param length the length
|
|
1884
|
-
* @returns the requested point
|
|
1885
|
-
*/
|
|
1886
|
-
getPointAtLength(t) {
|
|
1887
|
-
return rt(this.segments, t);
|
|
1888
|
-
}
|
|
1889
|
-
/**
|
|
1890
|
-
* Convert path to absolute values
|
|
1891
|
-
*
|
|
1892
|
-
* @public
|
|
1893
|
-
*/
|
|
1894
|
-
toAbsolute() {
|
|
1895
|
-
const { segments: t } = this;
|
|
1896
|
-
return this.segments = ht(t), this;
|
|
1897
|
-
}
|
|
1898
|
-
/**
|
|
1899
|
-
* Convert path to relative values
|
|
1900
|
-
*
|
|
1901
|
-
* @public
|
|
1902
|
-
*/
|
|
1903
|
-
toRelative() {
|
|
1904
|
-
const { segments: t } = this;
|
|
1905
|
-
return this.segments = Kt(t), this;
|
|
1906
|
-
}
|
|
1907
|
-
/**
|
|
1908
|
-
* Convert path to cubic-bezier values. In addition, un-necessary `Z`
|
|
1909
|
-
* segment is removed if previous segment extends to the `M` segment.
|
|
1910
|
-
*
|
|
1911
|
-
* @public
|
|
1912
|
-
*/
|
|
1913
|
-
toCurve() {
|
|
1914
|
-
const { segments: t } = this;
|
|
1915
|
-
return this.segments = yt(t), this;
|
|
1916
|
-
}
|
|
1917
|
-
/**
|
|
1918
|
-
* Reverse the order of the segments and their values.
|
|
1919
|
-
*
|
|
1920
|
-
* @param onlySubpath option to reverse all sub-paths except first
|
|
1921
|
-
* @public
|
|
1922
|
-
*/
|
|
1923
|
-
reverse(t) {
|
|
1924
|
-
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);
|
|
1925
|
-
let o = [];
|
|
1926
|
-
return n ? o = i.flat(1) : o = t ? s : ft(s), this.segments = o.slice(0), this;
|
|
1927
|
-
}
|
|
1928
|
-
/**
|
|
1929
|
-
* Normalize path in 2 steps:
|
|
1930
|
-
* * convert `pathArray`(s) to absolute values
|
|
1931
|
-
* * convert shorthand notation to standard notation
|
|
1932
|
-
*
|
|
1933
|
-
* @public
|
|
1934
|
-
*/
|
|
1935
|
-
normalize() {
|
|
1936
|
-
const { segments: t } = this;
|
|
1937
|
-
return this.segments = ot(t), this;
|
|
1938
|
-
}
|
|
1939
|
-
/**
|
|
1940
|
-
* Optimize `pathArray` values:
|
|
1941
|
-
* * convert segments to absolute and/or relative values
|
|
1942
|
-
* * select segments with shortest resulted string
|
|
1943
|
-
* * round values to the specified `decimals` option value
|
|
1944
|
-
*
|
|
1945
|
-
* @public
|
|
1946
|
-
*/
|
|
1947
|
-
optimize() {
|
|
1948
|
-
const { segments: t } = this, s = this.round === "off" ? 2 : this.round;
|
|
1949
|
-
return this.segments = Xt(t, s), this;
|
|
1950
|
-
}
|
|
1951
|
-
/**
|
|
1952
|
-
* Transform path using values from an `Object` defined as `transformObject`.
|
|
1953
|
-
*
|
|
1954
|
-
* @see TransformObject for a quick refference
|
|
1955
|
-
*
|
|
1956
|
-
* @param source a `transformObject`as described above
|
|
1957
|
-
* @public
|
|
1958
|
-
*/
|
|
1959
|
-
transform(t) {
|
|
1960
|
-
if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((c) => c in t))
|
|
1961
|
-
return this;
|
|
1962
|
-
const {
|
|
1963
|
-
segments: s,
|
|
1964
|
-
origin: [r, n, i]
|
|
1965
|
-
} = this, o = {};
|
|
1966
|
-
for (const [c, a] of Object.entries(t))
|
|
1967
|
-
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));
|
|
1968
|
-
const { origin: l } = o;
|
|
1969
|
-
if (Array.isArray(l) && l.length >= 2) {
|
|
1970
|
-
const [c, a, u] = l.map(Number);
|
|
1971
|
-
o.origin = [
|
|
1972
|
-
Number.isNaN(c) ? r : c,
|
|
1973
|
-
Number.isNaN(a) ? n : a,
|
|
1974
|
-
u || i
|
|
1975
|
-
];
|
|
1976
|
-
} else
|
|
1977
|
-
o.origin = [r, n, i];
|
|
1978
|
-
return this.segments = Vt(s, o), this;
|
|
1979
|
-
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Rotate path 180deg vertically
|
|
1982
|
-
*
|
|
1983
|
-
* @public
|
|
1984
|
-
*/
|
|
1985
|
-
flipX() {
|
|
1986
|
-
const { cx: t, cy: s } = this.bbox;
|
|
1987
|
-
return this.transform({ rotate: [0, 180, 0], origin: [t, s, 0] }), this;
|
|
1988
|
-
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Rotate path 180deg horizontally
|
|
1991
|
-
*
|
|
1992
|
-
* @public
|
|
1993
|
-
*/
|
|
1994
|
-
flipY() {
|
|
1995
|
-
const { cx: t, cy: s } = this.bbox;
|
|
1996
|
-
return this.transform({ rotate: [180, 0, 0], origin: [t, s, 0] }), this;
|
|
1997
|
-
}
|
|
1998
|
-
/**
|
|
1999
|
-
* Export the current path to be used
|
|
2000
|
-
* for the `d` (description) attribute.
|
|
2001
|
-
*
|
|
2002
|
-
* @public
|
|
2003
|
-
* @return the path string
|
|
2004
|
-
*/
|
|
2005
|
-
toString() {
|
|
2006
|
-
return kt(this.segments, this.round);
|
|
2007
|
-
}
|
|
2008
|
-
/**
|
|
2009
|
-
* Remove the instance.
|
|
2010
|
-
*
|
|
2011
|
-
* @public
|
|
2012
|
-
* @return void
|
|
2013
|
-
*/
|
|
2014
|
-
dispose() {
|
|
2015
|
-
Object.keys(this).forEach((t) => delete this[t]);
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
b(d, "CSSMatrix", C), b(d, "pathToAbsolute", ht), b(d, "pathToRelative", Kt), b(d, "pathToCurve", yt), b(d, "pathToString", kt), b(d, "arcTools", He), b(d, "bezierTools", {
|
|
2019
|
-
Cvalues: Ae,
|
|
2020
|
-
Tvalues: Rt,
|
|
2021
|
-
minmaxC: jt,
|
|
2022
|
-
minmaxQ: gt,
|
|
2023
|
-
getBezierLength: mt,
|
|
2024
|
-
bezierLength: Le,
|
|
2025
|
-
calculateBezier: we,
|
|
2026
|
-
computeBezier: Ne,
|
|
2027
|
-
deriveBezier: Me,
|
|
2028
|
-
CBEZIER_MINMAX_EPSILON: Te
|
|
2029
|
-
}), b(d, "cubicTools", {
|
|
2030
|
-
getCubicLength: xt,
|
|
2031
|
-
getCubicBBox: St,
|
|
2032
|
-
getPointAtCubicLength: ve,
|
|
2033
|
-
getPointAtCubicSegmentLength: Ce
|
|
2034
|
-
}), b(d, "lineTools", {
|
|
2035
|
-
getPointAtLineLength: Ht,
|
|
2036
|
-
getLineBBox: It,
|
|
2037
|
-
getLineLength: it
|
|
2038
|
-
}), b(d, "quadTools", {
|
|
2039
|
-
getPointAtQuadSegmentLength: $e,
|
|
2040
|
-
getQuadLength: pt,
|
|
2041
|
-
getQuadBBox: Qt,
|
|
2042
|
-
getPointAtQuadLength: ze
|
|
2043
|
-
}), b(d, "polygonTools", { polygonArea: Fe, polygonLength: _e }), b(d, "distanceSquareRoot", wt), b(d, "distanceEpsilon", bt), b(d, "midPoint", F), b(d, "rotateVector", st), b(d, "roundTo", P), b(d, "finalizeSegment", qt), b(d, "invalidPathValue", K), b(d, "isArcCommand", ye), b(d, "isDigit", J), b(d, "isDigitStart", he), b(d, "isMoveCommand", ge), b(d, "isPathCommand", fe), b(d, "isSpace", me), b(d, "paramsCount", tt), b(d, "paramsParser", ut), b(d, "pathParser", Ot), b(d, "scanFlag", ae), b(d, "scanParam", ue), b(d, "scanSegment", Dt), b(d, "skipSpaces", et), b(d, "getPathBBox", Wt), b(d, "getPathArea", qe), b(d, "getTotalLength", nt), b(d, "getDrawDirection", Ke), b(d, "getPointAtLength", rt), b(d, "getPropertiesAtLength", Ut), b(d, "getPropertiesAtPoint", Tt), b(d, "getClosestPoint", Ue), b(d, "getSegmentOfPoint", Xe), b(d, "getSegmentAtLength", We), b(d, "isPointInStroke", Ve), b(d, "isValidPath", Ie), b(d, "isPathArray", Ct), b(d, "isAbsoluteArray", Pe), b(d, "isRelativeArray", Ge), b(d, "isCurveArray", Ye), b(d, "isNormalizedArray", ke), b(d, "shapeToPath", on), b(d, "shapeToPathArray", Re), b(d, "shapeParams", ct), b(d, "parsePathString", D), b(d, "absolutizeSegment", at), b(d, "arcToCubic", Mt), b(d, "getSVGMatrix", je), b(d, "iterate", O), b(d, "lineToCubic", Pt), b(d, "normalizePath", ot), b(d, "normalizeSegment", Nt), b(d, "optimizePath", Xt), b(d, "projection2d", Zt), b(d, "quadToCubic", xe), b(d, "relativizeSegment", Bt), b(d, "reverseCurve", ln), b(d, "reversePath", ft), b(d, "roundPath", an), b(d, "roundSegment", dt), b(d, "segmentToCubic", pe), b(d, "shortenSegment", Se), b(d, "splitCubic", un), b(d, "splitPath", Yt), b(d, "transformPath", Vt);
|
|
2044
|
-
export {
|
|
2045
|
-
d as default
|
|
2046
|
-
};
|
|
2047
|
-
//# sourceMappingURL=svg-path-commander.mjs.map
|
|
1
|
+
import un from"@thednp/dommatrix";var Bt=(t,e,n)=>{let[o,r]=t,[s,a]=e;return[o+(s-o)*n,r+(a-r)*n]},E=Bt;var $t=(t,e)=>Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),re=$t;var ce=(t,e,n,o)=>re([t,e],[n,o]),Le=(t,e,n,o,r)=>{let s={x:t,y:e};if(typeof r=="number"){let a=re([t,e],[n,o]);if(r<=0)s={x:t,y:e};else if(r>=a)s={x:n,y:o};else{let[i,m]=E([t,e],[n,o],r/a);s={x:i,y:m}}}return s},Ge=(t,e,n,o)=>{let{min:r,max:s}=Math;return[r(t,n),r(e,o),s(t,n),s(e,o)]},ot={getLineBBox:Ge,getLineLength:ce,getPointAtLineLength:Le};var st=(t,e,n)=>{let o=n/2,r=Math.sin(o),s=Math.cos(o),a=t**2*r**2,i=e**2*s**2,m=Math.sqrt(a+i)*n;return Math.abs(m)},pe=(t,e,n,o,r,s)=>{let{sin:a,cos:i}=Math,m=i(r),u=a(r),l=n*i(s),c=o*a(s);return[t+m*l-u*c,e+u*l+m*c]},at=(t,e)=>{let{x:n,y:o}=t,{x:r,y:s}=e,a=n*r+o*s,i=Math.sqrt((n**2+o**2)*(r**2+s**2));return(n*s-o*r<0?-1:1)*Math.acos(a/i)},_e=(t,e,n,o,r,s,a,i,m)=>{let{abs:u,sin:l,cos:c,sqrt:f,PI:g}=Math,p=u(n),h=u(o),S=(r%360+360)%360*(g/180);if(t===i&&e===m)return{rx:p,ry:h,startAngle:0,endAngle:0,center:{x:i,y:m}};if(p===0||h===0)return{rx:p,ry:h,startAngle:0,endAngle:0,center:{x:(i+t)/2,y:(m+e)/2}};let A=(t-i)/2,d=(e-m)/2,b={x:c(S)*A+l(S)*d,y:-l(S)*A+c(S)*d},P=b.x**2/p**2+b.y**2/h**2;P>1&&(p*=f(P),h*=f(P));let C=p**2*h**2-p**2*b.y**2-h**2*b.x**2,V=p**2*b.y**2+h**2*b.x**2,k=C/V;k=k<0?0:k;let w=(s!==a?1:-1)*f(k),v={x:w*(p*b.y/h),y:w*(-(h*b.x)/p)},j={x:c(S)*v.x-l(S)*v.y+(t+i)/2,y:l(S)*v.x+c(S)*v.y+(e+m)/2},ue={x:(b.x-v.x)/p,y:(b.y-v.y)/h},q=at({x:1,y:0},ue),x={x:(-b.x-v.x)/p,y:(-b.y-v.y)/h},Q=at(ue,x);!a&&Q>0?Q-=2*g:a&&Q<0&&(Q+=2*g),Q%=2*g;let H=q+Q;return{center:j,startAngle:q,endAngle:H,rx:p,ry:h}},ve=(t,e,n,o,r,s,a,i,m)=>{let{rx:u,ry:l,startAngle:c,endAngle:f}=_e(t,e,n,o,r,s,a,i,m);return st(u,l,f-c)},mt=(t,e,n,o,r,s,a,i,m,u)=>{let l={x:t,y:e},{center:c,rx:f,ry:g,startAngle:p,endAngle:h}=_e(t,e,n,o,r,s,a,i,m);if(typeof u=="number"){let y=st(f,g,h-p);if(u<=0)l={x:t,y:e};else if(u>=y)l={x:i,y:m};else{if(t===i&&e===m)return{x:i,y:m};if(f===0||g===0)return Le(t,e,i,m,u);let{PI:S,cos:A,sin:d}=Math,b=h-p,C=(r%360+360)%360*(S/180),V=p+b*(u/y),k=f*A(V),w=g*d(V);l={x:A(C)*k-d(C)*w+c.x,y:d(C)*k+A(C)*w+c.y}}}return l},it=(t,e,n,o,r,s,a,i,m)=>{let{center:u,rx:l,ry:c,startAngle:f,endAngle:g}=_e(t,e,n,o,r,s,a,i,m),p=g-f,{min:h,max:y,tan:S,atan2:A,PI:d}=Math,{x:b,y:P}=u,C=r*d/180,V=S(C),k=A(-c*V,l),w=k,v=k+d,j=A(c,l*V),ue=j+d,q=[i],x=[m],Q=h(t,i),H=y(t,i),O=h(e,m),W=y(e,m),ye=g-p*1e-5,le=pe(b,P,l,c,C,ye),N=g-p*.99999,D=pe(b,P,l,c,C,N);if(le[0]>H||D[0]>H){let z=pe(b,P,l,c,C,w);q.push(z[0]),x.push(z[1])}if(le[0]<Q||D[0]<Q){let z=pe(b,P,l,c,C,v);q.push(z[0]),x.push(z[1])}if(le[1]<O||D[1]<O){let z=pe(b,P,l,c,C,ue);q.push(z[0]),x.push(z[1])}if(le[1]>W||D[1]>W){let z=pe(b,P,l,c,C,j);q.push(z[0]),x.push(z[1])}return Q=h.apply([],q),O=h.apply([],x),H=y.apply([],q),W=y.apply([],x),[Q,O,H,W]},ut={angleBetween:at,arcLength:st,arcPoint:pe,getArcBBox:it,getArcLength:ve,getArcProps:_e,getPointAtArcLength:mt};var lt=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],zt=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],Vt=t=>{let e=[];for(let n=t,o=n.length,r=o-1;o>1;o-=1,r-=1){let s=[];for(let a=0;a<r;a+=1)s.push({x:r*(n[a+1].x-n[a].x),y:r*(n[a+1].y-n[a].y),t:0});e.push(s),n=s}return e},Rt=(t,e)=>{if(e===0)return t[0].t=0,t[0];let n=t.length-1;if(e===1)return t[n].t=1,t[n];let o=1-e,r=t;if(n===0)return t[0].t=e,t[0];if(n===1)return{x:o*r[0].x+e*r[1].x,y:o*r[0].y+e*r[1].y,t:e};let s=o*o,a=e*e,i=0,m=0,u=0,l=0;return n===2?(r=[r[0],r[1],r[2],{x:0,y:0}],i=s,m=o*e*2,u=a):n===3&&(i=s*o,m=s*e*3,u=o*a*3,l=e*a),{x:i*r[0].x+m*r[1].x+u*r[2].x+l*r[3].x,y:i*r[0].y+m*r[1].y+u*r[2].y+l*r[3].y,t:e}},kt=(t,e)=>{let n=t(e),o=n.x*n.x+n.y*n.y;return Math.sqrt(o)},qt=t=>{let n=lt.length,o=0;for(let r=0,s;r<n;r++)s=.5*lt[r]+.5,o+=zt[r]*kt(t,s);return .5*o},fe=t=>{let e=[];for(let o=0,r=t.length,s=2;o<r;o+=s)e.push({x:t[o],y:t[o+1]});let n=Vt(e);return qt(o=>Rt(n[0],o))},Qt=1e-8,Ne=([t,e,n])=>{let o=Math.min(t,n),r=Math.max(t,n);if(e>=t?n>=e:n<=e)return[o,r];let s=(t*n-e*e)/(t-2*e+n);return s<o?[s,r]:[o,s]},Ue=([t,e,n,o])=>{let r=t-3*e+3*n-o;if(Math.abs(r)<Qt)return t===o&&t===e?[t,o]:Ne([t,-.5*t+1.5*e,t-3*e+3*n]);let s=-t*n+t*o-e*n-e*o+e*e+n*n;if(s<=0)return[Math.min(t,o),Math.max(t,o)];let a=Math.sqrt(s),i=Math.min(t,o),m=Math.max(t,o),u=t-2*e+n;for(let l=(u+a)/r,c=1;c<=2;l=(u-a)/r,c++){if(l>0&&l<1){let f=t*(1-l)*(1-l)*(1-l)+e*3*(1-l)*(1-l)*l+n*3*(1-l)*l*l+o*l*l*l;f<i&&(i=f),f>m&&(m=f)}}return[i,m]},ct={bezierLength:qt,calculateBezier:kt,CBEZIER_MINMAX_EPSILON:Qt,computeBezier:Rt,Cvalues:zt,deriveBezier:Vt,getBezierLength:fe,minmaxC:Ue,minmaxQ:Ne,Tvalues:lt};var Dt=([t,e,n,o,r,s,a,i],m)=>{let u=1-m;return{x:u**3*t+3*u**2*m*n+3*u*m**2*r+m**3*a,y:u**3*e+3*u**2*m*o+3*u*m**2*s+m**3*i}},Pe=(t,e,n,o,r,s,a,i)=>fe([t,e,n,o,r,s,a,i]),pt=(t,e,n,o,r,s,a,i,m)=>{let u=typeof m=="number",l={x:t,y:e};if(u){let c=fe([t,e,n,o,r,s,a,i]);m<=0||(m>=c?l={x:a,y:i}:l=Dt([t,e,n,o,r,s,a,i],m/c))}return l},Fe=(t,e,n,o,r,s,a,i)=>{let m=Ue([t,n,r,a]),u=Ue([e,o,s,i]);return[m[0],u[0],m[1],u[1]]},ft={getCubicBBox:Fe,getCubicLength:Pe,getPointAtCubicLength:pt,getPointAtCubicSegmentLength:Dt};var Et=([t,e,n,o,r,s],a)=>{let i=1-a;return{x:i**2*t+2*i*a*n+a**2*r,y:i**2*e+2*i*a*o+a**2*s}},xe=(t,e,n,o,r,s)=>fe([t,e,n,o,r,s]),gt=(t,e,n,o,r,s,a)=>{let i=typeof a=="number",m={x:t,y:e};if(i){let u=fe([t,e,n,o,r,s]);a<=0||(a>=u?m={x:r,y:s}:m=Et([t,e,n,o,r,s],a/u))}return m},Ke=(t,e,n,o,r,s)=>{let a=Ne([t,n,r]),i=Ne([e,o,s]);return[a[0],i[0],a[1],i[1]]},ht={getPointAtQuadLength:gt,getPointAtQuadSegmentLength:Et,getQuadBBox:Ke,getQuadLength:xe};var jt=t=>{let e=t.length,n=-1,o,r=t[e-1],s=0;for(;++n<e;)o=r,r=t[n],s+=o[1]*r[0]-o[0]*r[1];return s/2},Ht=t=>t.reduce((e,n,o)=>o?e+re(t[o-1],n):0,0),bt={polygonArea:jt,polygonLength:Ht};var Zt=(t,e,n)=>{let{sin:o,cos:r}=Math,s=t*r(n)-e*o(n),a=t*o(n)+e*r(n);return{x:s,y:a}},ne=Zt;var Gt=(t,e)=>{let n=e>=1?10**e:1;return e>0?Math.round(t*n)/n:Math.round(t)},M=Gt;var _t={origin:[0,0,0],round:4},I=_t;var Ut={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},Z=Ut;var Ft=t=>{let e=t.pathValue[t.segmentStart],n=e.toLowerCase(),{data:o}=t;for(;o.length>=Z[n]&&(n==="m"&&o.length>2?(t.segments.push([e].concat(o.splice(0,2))),n="l",e=e==="m"?"l":"L"):t.segments.push([e].concat(o.splice(0,Z[n]))),!!Z[n]););},Se=Ft;var Kt="SVGPathCommander Error",R=Kt;var Jt=t=>{let{index:e,pathValue:n}=t,o=n.charCodeAt(e);if(o===48){t.param=0,t.index+=1;return}if(o===49){t.param=1,t.index+=1;return}t.err=`${R}: invalid Arc flag "${n[e]}", expecting 0 or 1 at index ${e}`},we=Jt;var Wt=t=>t>=48&&t<=57,B=Wt;var Xt="Invalid path value",$=Xt;var Yt=t=>{let{max:e,pathValue:n,index:o}=t,r=o,s=!1,a=!1,i=!1,m=!1,u;if(r>=e){t.err=`${R}: ${$} at index ${r}, "pathValue" is missing param`;return}if(u=n.charCodeAt(r),(u===43||u===45)&&(r+=1,u=n.charCodeAt(r)),!B(u)&&u!==46){t.err=`${R}: ${$} at index ${r}, "${n[r]}" is not a number`;return}if(u!==46){if(s=u===48,r+=1,u=n.charCodeAt(r),s&&r<e&&u&&B(u)){t.err=`${R}: ${$} at index ${o}, "${n[o]}" illegal number`;return}for(;r<e&&B(n.charCodeAt(r));)r+=1,a=!0;u=n.charCodeAt(r)}if(u===46){for(m=!0,r+=1;B(n.charCodeAt(r));)r+=1,i=!0;u=n.charCodeAt(r)}if(u===101||u===69){if(m&&!a&&!i){t.err=`${R}: ${$} at index ${r}, "${n[r]}" invalid float exponent`;return}if(r+=1,u=n.charCodeAt(r),(u===43||u===45)&&(r+=1),r<e&&B(n.charCodeAt(r)))for(;r<e&&B(n.charCodeAt(r));)r+=1;else{t.err=`${R}: ${$} at index ${r}, "${n[r]}" invalid integer exponent`;return}}t.index=r,t.param=+t.pathValue.slice(o,r)},ze=Yt;var er=t=>[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(t),Ve=er;var tr=t=>{let{pathValue:e,max:n}=t;for(;t.index<n&&Ve(e.charCodeAt(t.index));)t.index+=1},G=tr;var rr=t=>{switch(t|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},Re=rr;var nr=t=>B(t)||t===43||t===45||t===46,ke=nr;var or=t=>(t|32)===97,qe=or;var ar=t=>{switch(t|32){case 109:case 77:return!0;default:return!1}},Qe=ar;var sr=t=>{let{max:e,pathValue:n,index:o,segments:r}=t,s=n.charCodeAt(o),a=Z[n[o].toLowerCase()];if(t.segmentStart=o,!Re(s)){t.err=`${R}: ${$} "${n[o]}" is not a path command at index ${o}`;return}let i=r[r.length-1];if(!Qe(s)&&i?.[0]?.toLocaleLowerCase()==="z"){t.err=`${R}: ${$} "${n[o]}" is not a MoveTo path command at index ${o}`;return}if(t.index+=1,G(t),t.data=[],!a){Se(t);return}for(;;){for(let m=a;m>0;m-=1){if(qe(s)&&(m===3||m===4)?we(t):ze(t),t.err.length)return;t.data.push(t.param),G(t),t.index<e&&n.charCodeAt(t.index)===44&&(t.index+=1,G(t))}if(t.index>=t.max||!ke(n.charCodeAt(t.index)))break}Se(t)},ge=sr;var F=class{constructor(e){this.segments=[],this.pathValue=e,this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}};var mr=t=>{if(typeof t!="string")return t.slice(0);let e=new F(t);for(G(e);e.index<e.max&&!e.err.length;)ge(e);if(!e.err.length)e.segments.length&&(e.segments[0][0]="M");else throw TypeError(e.err);return e.segments},L=mr;var ir=(t,e,n,o)=>{let[r]=t,s=r.toUpperCase(),a=s===r;if(e===0||a)return t;if(s==="A")return[s,t[1],t[2],t[3],t[4],t[5],t[6]+n,t[7]+o];if(s==="V")return[s,t[1]+o];if(s==="H")return[s,t[1]+n];if(s==="L")return[s,t[1]+n,t[2]+o];{let i=[],m=t.length;for(let u=1;u<m;u+=1)i.push(t[u]+(u%2?n:o));return[s].concat(i)}},_=ir;var ur=(t,e)=>{let n=t.length,o,r="M",s="M",a=!1,i=0,m=0,u=0,l=0,c=0;for(let f=0;f<n;f+=1){o=t[f],[r]=o,c=o.length,s=r.toUpperCase(),a=s!==r;let g=e(o,f,i,m);if(g===!1)break;s==="Z"?(i=u,m=l):s==="H"?i=o[1]+(a?i:0):s==="V"?m=o[1]+(a?m:0):(i=o[c-2]+(a?i:0),m=o[c-1]+(a?m:0),s==="M"&&(u=i,l=m)),g&&(t[f]=g,g[0]==="C"&&(n=t.length))}return t},T=ur;var lr=t=>{let e=L(t);return T(e,_)},oe=lr;var cr=(t,e,n,o)=>{let[r]=t,s=r.toLowerCase(),a=r===s;if(e===0||a)return t;if(s==="a")return[s,t[1],t[2],t[3],t[4],t[5],t[6]-n,t[7]-o];if(s==="v")return[s,t[1]-o];if(s==="h")return[s,t[1]-n];if(s==="l")return[s,t[1]-n,t[2]-o];{let i=[],m=t.length;for(let u=1;u<m;u+=1)i.push(t[u]-(u%2?n:o));return[s].concat(i)}},he=cr;var pr=t=>{let e=L(t);return T(e,he)},Je=pr;var Ot=(t,e,n,o,r,s,a,i,m,u)=>{let l=t,c=e,f=n,g=o,p=i,h=m,y=Math.PI*120/180,S=Math.PI/180*(+r||0),A=[],d,b,P,C,V;if(u)[b,P,C,V]=u;else{d=ne(l,c,-S),l=d.x,c=d.y,d=ne(p,h,-S),p=d.x,h=d.y;let N=(l-p)/2,D=(c-h)/2,z=N*N/(f*f)+D*D/(g*g);z>1&&(z=Math.sqrt(z),f*=z,g*=z);let rt=f*f,nt=g*g,wt=(s===a?-1:1)*Math.sqrt(Math.abs((rt*nt-rt*D*D-nt*N*N)/(rt*D*D+nt*N*N)));C=wt*f*D/g+(l+p)/2,V=wt*-g*N/f+(c+h)/2,b=Math.asin(((c-V)/g*10**9>>0)/10**9),P=Math.asin(((h-V)/g*10**9>>0)/10**9),b=l<C?Math.PI-b:b,P=p<C?Math.PI-P:P,b<0&&(b=Math.PI*2+b),P<0&&(P=Math.PI*2+P),a&&b>P&&(b-=Math.PI*2),!a&&P>b&&(P-=Math.PI*2)}let k=P-b;if(Math.abs(k)>y){let N=P,D=p,z=h;P=b+y*(a&&P>b?1:-1),p=C+f*Math.cos(P),h=V+g*Math.sin(P),A=Ot(p,h,f,g,r,0,a,D,z,[P,N,C,V])}k=P-b;let w=Math.cos(b),v=Math.sin(b),j=Math.cos(P),ue=Math.sin(P),q=Math.tan(k/4),x=4/3*f*q,Q=4/3*g*q,H=[l,c],O=[l+x*v,c-Q*w],W=[p+x*ue,h-Q*j],ye=[p,h];if(O[0]=2*H[0]-O[0],O[1]=2*H[1]-O[1],u)return[O[0],O[1],W[0],W[1],ye[0],ye[1]].concat(A);A=[O[0],O[1],W[0],W[1],ye[0],ye[1]].concat(A);let le=[];for(let N=0,D=A.length;N<D;N+=1)le[N]=N%2?ne(A[N-1],A[N],S).y:ne(A[N],A[N+1],S).x;return le},be=Ot;var fr=(t,e,n,o,r,s)=>{let a=.3333333333333333,i=2/3;return[a*t+i*n,a*e+i*o,a*r+i*n,a*s+i*o,r,s]},De=fr;var gr=(t,e,n,o)=>{let r=E([t,e],[n,o],.3333333333333333),s=E([t,e],[n,o],2/3);return[r[0],r[1],s[0],s[1],n,o]},Ae=gr;var hr=(t,e)=>{let[n]=t,o=t.slice(1).map(Number),[r,s]=o,{x1:a,y1:i,x:m,y:u}=e;return"TQ".includes(n)||(e.qx=null,e.qy=null),n==="M"?(e.x=r,e.y=s,t):n==="A"?["C"].concat(be(a,i,o[0],o[1],o[2],o[3],o[4],o[5],o[6])):n==="Q"?(e.qx=r,e.qy=s,["C"].concat(De(a,i,o[0],o[1],o[2],o[3]))):n==="L"?["C"].concat(Ae(a,i,r,s)):n==="Z"?["C"].concat(Ae(a,i,m,u)):t},Ee=hr;var br=(t,e)=>{let[n]=t,o=n.toUpperCase(),r=n!==o,{x1:s,y1:a,x2:i,y2:m,x:u,y:l}=e,c=t.slice(1),f=c.map((g,p)=>g+(r?p%2?l:u:0));"TQ".includes(o)||(e.qx=null,e.qy=null);if(o==="A")return f=c.slice(0,-2).concat(c[5]+(r?u:0),c[6]+(r?l:0)),["A"].concat(f);if(o==="H")return["L",t[1]+(r?u:0),a];if(o==="V")return["L",s,t[1]+(r?l:0)];if(o==="L")return["L",t[1]+(r?u:0),t[2]+(r?l:0)];if(o==="M")return["M",t[1]+(r?u:0),t[2]+(r?l:0)];if(o==="C")return["C"].concat(f);if(o==="S"){let g=s*2-i,p=a*2-m;return e.x1=g,e.y1=p,["C",g,p].concat(f)}else if(o==="T"){let g=s*2-(e.qx?e.qx:0),p=a*2-(e.qy?e.qy:0);return e.qx=g,e.qy=p,["Q",g,p].concat(f)}else if(o==="Q"){let[g,p]=f;return e.qx=g,e.qy=p,["Q"].concat(f)}else if(o==="Z")return["Z"];return t},X=br;var dr={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},U=dr;var yr=t=>{let e={...U},n=L(t);return T(n,(o,r,s,a)=>{e.x=s,e.y=a;let i=X(o,e),m=Ee(i,e);m[0]==="C"&&m.length>7&&(n.splice(r+1,0,["C"].concat(m.slice(7))),m=m.slice(0,7));let l=m.length;return e.x1=+m[l-2],e.y1=+m[l-1],e.x2=+m[l-4]||e.x1,e.y2=+m[l-3]||e.y1,m})},ae=yr;var Pr=(t,e)=>{let n=t.length,{round:o}=I,r=t[0],s="";o=e==="off"||typeof e=="number"&&e>=0?e:typeof o=="number"&&o>=0?o:"off";for(let a=0;a<n;a+=1){r=t[a];let[i]=r,m=r.slice(1);if(s+=i,o==="off")s+=m.join(" ");else{let u=0,l=m.length;for(;u<l;)s+=M(m[u],o),u!==l-1&&(s+=" "),u+=1}}return s},Ce=Pr;var xr=t=>{if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};let e=L(t),n="M",o=0,r=0,{max:s,min:a}=Math,i=1/0,m=1/0,u=-1/0,l=-1/0,c=0,f=0,g=0,p=0,h=0,y=0,S=0,A=0,d=0,b=0;T(e,(V,k,w,v)=>{[n]=V;let j=n.toUpperCase(),q=j!==n?_(V,k,w,v):V.slice(0),x=j==="V"?["L",w,q[1]]:j==="H"?["L",q[1],v]:q;[n]=x,"TQ".includes(j)||(d=0,b=0);if(n==="M")[,o,r]=x,c=o,f=r,g=o,p=r;else if(n==="L")[c,f,g,p]=Ge(w,v,x[1],x[2]);else if(n==="A")[c,f,g,p]=it(w,v,x[1],x[2],x[3],x[4],x[5],x[6],x[7]);else if(n==="S"){let Q=h*2-S,H=y*2-A;[c,f,g,p]=Fe(w,v,Q,H,x[1],x[2],x[3],x[4])}else n==="C"?[c,f,g,p]=Fe(w,v,x[1],x[2],x[3],x[4],x[5],x[6]):n==="T"?(d=h*2-d,b=y*2-b,[c,f,g,p]=Ke(w,v,d,b,x[1],x[2])):n==="Q"?(d=x[1],b=x[2],[c,f,g,p]=Ke(w,v,x[1],x[2],x[3],x[4])):n==="Z"&&([c,f,g,p]=Ge(w,v,o,r));i=a(c,i),m=a(f,m),u=s(g,u),l=s(p,l),[h,y]=n==="Z"?[o,r]:x.slice(-2),[S,A]=n==="C"?[x[3],x[4]]:n==="S"?[x[1],x[2]]:[h,y]});let P=u-i,C=l-m;return{width:P,height:C,x:i,y:m,x2:u,y2:l,cx:i+P/2,cy:m+C/2,cz:Math.max(P,C)+Math.min(P,C)/2}},We=xr;var Sr=t=>{let e=L(t),n=0,o=0,r=0,s=0,a=0,i=0,m="M",u=0,l=0,c=0;return T(e,(f,g,p,h)=>{[m]=f;let y=m.toUpperCase(),A=y!==m?_(f,g,p,h):f.slice(0),d=y==="V"?["L",p,A[1]]:y==="H"?["L",A[1],h]:A;[m]=d,"TQ".includes(y)||(a=0,i=0);if(m==="M")[,u,l]=d;else if(m==="L")c+=ce(p,h,d[1],d[2]);else if(m==="A")c+=ve(p,h,d[1],d[2],d[3],d[4],d[5],d[6],d[7]);else if(m==="S"){let b=n*2-r,P=o*2-s;c+=Pe(p,h,b,P,d[1],d[2],d[3],d[4])}else m==="C"?c+=Pe(p,h,d[1],d[2],d[3],d[4],d[5],d[6]):m==="T"?(a=n*2-a,i=o*2-i,c+=xe(p,h,a,i,d[1],d[2])):m==="Q"?(a=d[1],i=d[2],c+=xe(p,h,d[1],d[2],d[3],d[4])):m==="Z"&&(c+=ce(p,h,u,l));[n,o]=m==="Z"?[u,l]:d.slice(-2),[r,s]=m==="C"?[d[3],d[4]]:m==="S"?[d[1],d[2]]:[n,o]}),c},K=Sr;var se=1e-5;var Ar=t=>{let e=L(t),n={...U};return T(e,(o,r,s,a)=>{n.x=s,n.y=a;let i=X(o,n),m=i.length;return n.x1=+i[m-2],n.y1=+i[m-1],n.x2=+i[m-4]||n.x1,n.y2=+i[m-3]||n.y1,i})},J=Ar;var Cr=(t,e)=>{let n=J(t),o=!1,r=[],s="M",a=0,i=0,[m,u]=n[0].slice(1),l=typeof e=="number",c={x:m,y:u},f=0,g=c,p=0;return!l||e<se?c:(T(n,(h,y,S,A)=>{[s]=h,o=s==="M",r=o?r:[S,A].concat(h.slice(1));if(o?([,m,u]=h,c={x:m,y:u},f=0):s==="L"?(c=Le(r[0],r[1],r[2],r[3],e-p),f=ce(r[0],r[1],r[2],r[3])):s==="A"?(c=mt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],e-p),f=ve(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])):s==="C"?(c=pt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],e-p),f=Pe(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7])):s==="Q"?(c=gt(r[0],r[1],r[2],r[3],r[4],r[5],e-p),f=xe(r[0],r[1],r[2],r[3],r[4],r[5])):s==="Z"&&(r=[S,A,m,u],c={x:m,y:u},f=ce(r[0],r[1],r[2],r[3])),[a,i]=r.slice(-2),p<e)g=c;else return!1;p+=f}),e>p-se?{x:a,y:i}:g)},me=Cr;var Tr=(t,e)=>{let n=L(t),o=n.slice(0),r=K(o),s=o.length-1,a=0,i=0,m=n[0];if(s<=0||!e||!Number.isFinite(e))return{segment:m,index:0,length:i,lengthAtSegment:a};if(e>=r)return o=n.slice(0,-1),a=K(o),i=r-a,m=n[s],{segment:m,index:s,length:i,lengthAtSegment:a};let u=[];for(;s>0;)m=o[s],o=o.slice(0,-1),a=K(o),i=r-a,r=a,u.push({segment:m,index:s,length:i,lengthAtSegment:a}),s-=1;return u.find(({lengthAtSegment:l})=>l<=e)},de=Tr;var Mr=(t,e)=>{let n=L(t),o=J(n),r=K(o),s=b=>{let P=b.x-e.x,C=b.y-e.y;return P*P+C*C},a=8,i,m={x:0,y:0},u=0,l=0,c=1/0;for(let b=0;b<=r;b+=a)i=me(o,b),u=s(i),u<c&&(m=i,l=b,c=u);a/=2;let f,g,p=0,h=0,y=0,S=0;for(;a>1e-6&&(p=l-a,f=me(o,p),y=s(f),h=l+a,g=me(o,h),S=s(g),p>=0&&y<c?(m=f,l=p,c=y):h<=r&&S<c?(m=g,l=h,c=S):a/=2,!(a<1e-5)););let A=de(n,l),d=Math.sqrt(c);return{closest:m,distance:d,segment:A}},Y=Mr;var Lr=(t,e)=>Y(t,e).closest,dt=Lr;var vr=(t,e,n,o,r,s,a,i)=>3*((i-e)*(n+r)-(a-t)*(o+s)+o*(t-r)-n*(e-s)+i*(r+t/3)-a*(s+e/3))/20,Nr=t=>{let e=0,n=0,o=0;return ae(t).map(r=>{switch(r[0]){case"M":return[,e,n]=r,0;default:return o=vr(e,n,r[1],r[2],r[3],r[4],r[5],r[6]),[e,n]=r.slice(-2),o}}).reduce((r,s)=>r+s,0)},Oe=Nr;var wr=t=>Oe(ae(t))>=0,yt=wr;var zr=(t,e)=>de(t,e).segment,Pt=zr;var Vr=(t,e)=>Y(t,e).segment,xt=Vr;var Rr=t=>Array.isArray(t)&&t.every(e=>{let n=e[0].toLowerCase();return Z[n]===e.length-1&&"achlmqstvz".includes(n)&&e.slice(1).every(Number.isFinite)})&&t.length>0,ee=Rr;var kr=t=>ee(t)&&t.every(([e])=>e===e.toUpperCase()),Ie=kr;var qr=t=>Ie(t)&&t.every(([e])=>"ACLMQZ".includes(e)),Be=qr;var Qr=t=>Be(t)&&t.every(([e])=>"MC".includes(e)),St=Qr;var Dr=(t,e)=>{let{distance:n}=Y(t,e);return Math.abs(n)<se},At=Dr;var Er=t=>ee(t)&&t.slice(1).every(([e])=>e===e.toLowerCase()),Ct=Er;var Or=t=>{if(typeof t!="string"||!t.length)return!1;let e=new F(t);for(G(e);e.index<e.max&&!e.err.length;)ge(e);return!e.err.length&&"mM".includes(e.segments[0][0])},$e=Or;var Ir={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]},te=Ir;var Br=t=>t!=null&&typeof t=="object"&&t.nodeType===1,Xe=Br;var $r=t=>{let{x1:e,y1:n,x2:o,y2:r}=t;return[e,n,o,r]=[e,n,o,r].map(s=>+s),[["M",e,n],["L",o,r]]},jr=t=>{let e=[],n=(t.points||"").trim().split(/[\s|,]/).map(r=>+r),o=0;for(;o<n.length;)e.push([o?"L":"M",n[o],n[o+1]]),o+=2;return t.type==="polygon"?[...e,["z"]]:e},Hr=t=>{let{cx:e,cy:n,r:o}=t;return[e,n,o]=[e,n,o].map(r=>+r),[["M",e-o,n],["a",o,o,0,1,0,2*o,0],["a",o,o,0,1,0,-2*o,0]]},Zr=t=>{let{cx:e,cy:n}=t,o=t.rx||0,r=t.ry||o;return[e,n,o,r]=[e,n,o,r].map(s=>+s),[["M",e-o,n],["a",o,r,0,1,0,2*o,0],["a",o,r,0,1,0,-2*o,0]]},Gr=t=>{let e=+t.x||0,n=+t.y||0,o=+t.width,r=+t.height,s=+(t.rx||0),a=+(t.ry||s);if(s||a){s*2>o&&(s-=(s*2-o)/2);return a*2>r&&(a-=(a*2-r)/2),[["M",e+s,n],["h",o-s*2],["s",s,0,s,a],["v",r-a*2],["s",0,a,-s,a],["h",-o+s*2],["s",-s,0,-s,-a],["v",-r+a*2],["s",0,-a,s,-a]]}return[["M",e,n],["h",o],["v",r],["H",e],["Z"]]},_r=t=>{let e=Object.keys(te),n=Xe(t),o=n?t.tagName:null;if(o&&[...e,"path"].every(m=>o!==m))throw TypeError(`${R}: "${o}" is not SVGElement`);let r=n?o:t.type,s=te[r],a={type:r};n?s.forEach(m=>{a[m]=t.getAttribute(m)}):Object.assign(a,t);let i=[];return r==="circle"?i=Hr(a):r==="ellipse"?i=Zr(a):["polyline","polygon"].includes(r)?i=jr(a):r==="rect"?i=Gr(a):r==="line"?i=$r(a):["glyph","path"].includes(r)&&(i=L(n?t.getAttribute("d")||"":t.d||"")),ee(i)&&i.length?i:!1},je=_r;var Ur=(t,e,n)=>{let o=n||document,r=Object.keys(te),s=Xe(t),a=s?t.tagName:null;if(a==="path")throw TypeError(`${R}: "${a}" is already SVGPathElement`);if(a&&r.every(p=>a!==p))throw TypeError(`${R}: "${a}" is not SVGElement`);let i=o.createElementNS("http://www.w3.org/2000/svg","path"),m=s?a:t.type,u=te[m],l={type:m},c=I.round,f=je(t),g=f&&f.length?Ce(f,c):"";return s?(u.forEach(p=>{l[p]=t.getAttribute(p)}),Object.values(t.attributes).forEach(({name:p,value:h})=>{u.includes(p)||i.setAttribute(p,h)})):(Object.assign(l,t),Object.keys(l).forEach(p=>{!u.includes(p)&&p!=="type"&&i.setAttribute(p.replace(/[A-Z]/g,h=>`-${h.toLowerCase()}`),l[p])})),$e(g)?(i.setAttribute("d",g),e&&s&&(t.before(i,t),t.remove()),i):!1},Tt=Ur;var Fr=(t,e,n,o)=>{let[r]=t,{round:s}=I,a=typeof s=="number"?s:4,i=e.slice(1),{x1:m,y1:u,x2:l,y2:c,x:f,y:g}=n,[p,h]=i.slice(-2),y=t;if("TQ".includes(r)||(n.qx=null,n.qy=null),r==="L"){if(M(f,a)===M(p,a))return["V",h];if(M(g,a)===M(h,a))return["H",p]}else if(r==="C"){let[S,A]=i;if(n.x1=S,n.y1=A,"CS".includes(o)&&(M(S,a)===M(m*2-l,a)&&M(A,a)===M(u*2-c,a)||M(m,a)===M(l*2-f,a)&&M(u,a)===M(c*2-g,a)))return["S",i[2],i[3],i[4],i[5]]}else if(r==="Q"){let[S,A]=i;if(n.qx=S,n.qy=A,"QT".includes(o)&&M(S,a)===M(m*2-l,a)&&M(A,a)===M(u*2-c,a))return["T",i[2],i[3]]}return y},He=Fr;var Kr=(t,e)=>{let n=t.slice(1).map(o=>M(o,e));return[t[0]].concat(n)},ie=Kr;var Jr=(t,e)=>{let n=oe(t),o=typeof e=="number"&&e>=0?e:2,r={...U},s=[],a="M",i="Z";return T(n,(m,u,l,c)=>{r.x=l,r.y=c;let f=X(m,r),g=m;if([a]=m,s[u]=a,u){i=s[u-1];let h=He(m,f,r,i),y=ie(h,o),S=y.join(""),A=he(h,u,l,c),d=ie(A,o),b=d.join("");g=S.length<b.length?y:d}let p=f.length;return r.x1=+f[p-2],r.y1=+f[p-1],r.x2=+f[p-4]||r.x1,r.y2=+f[p-3]||r.y1,g})},Ye=Jr;var Wr=t=>{let e=oe(t),n=J(e),o=e.length,r=e[o-1][0]==="Z",s=T(e,(a,i)=>{let m=n[i],u=i&&e[i-1],l=u&&u[0],c=e[i+1],f=c&&c[0],[g]=a,[p,h]=n[i?i-1:o-1].slice(-2),y=a;switch(g){case"M":y=r?["Z"]:[g,p,h];break;case"A":y=[g,a[1],a[2],a[3],a[4],a[5]===1?0:1,p,h];break;case"C":c&&f==="S"?y=["S",a[1],a[2],p,h]:y=[g,a[3],a[4],a[1],a[2],p,h];break;case"S":l&&"CS".includes(l)&&(!c||f!=="S")?y=["C",m[3],m[4],m[1],m[2],p,h]:y=[g,m[1],m[2],p,h];break;case"Q":c&&f==="T"?y=["T",p,h]:y=[g,a[1],a[2],p,h];break;case"T":l&&"QT".includes(l)&&(!c||f!=="T")?y=["Q",m[1],m[2],p,h]:y=[g,p,h];break;case"Z":y=["M",p,h];break;case"H":y=[g,p];break;case"V":y=[g,h];break;default:y=[g].concat(a.slice(1,-2),p,h)}return y});return r?s.reverse():[s[0]].concat(s.slice(1).reverse())},Te=Wr;var Xr=t=>{let e=[],n,o=-1,r=0,s=0,a=0,i=0,m={...U};return t.forEach(u=>{let[l]=u,c=l.toUpperCase(),f=l.toLowerCase(),g=l===f,p=u.slice(1);c==="M"?(o+=1,[r,s]=p,r+=g?m.x:0,s+=g?m.y:0,a=r,i=s,n=[g?[c,a,i]:u]):(c==="Z"?(r=a,s=i):c==="H"?([,r]=u,r+=g?m.x:0):c==="V"?([,s]=u,s+=g?m.y:0):([r,s]=u.slice(-2),r+=g?m.x:0,s+=g?m.y:0),n.push(u)),m.x=r,m.y=s,e[o]=n}),e},et=Xr;import Yr from"@thednp/dommatrix";var en=t=>{let e=new Yr,{origin:n}=t,[o,r]=n,{translate:s}=t,{rotate:a}=t,{skew:i}=t,{scale:m}=t;return Array.isArray(s)&&s.length>=2&&s.every(u=>!Number.isNaN(+u))&&s.some(u=>u!==0)?e=e.translate(...s):typeof s=="number"&&!Number.isNaN(s)&&(e=e.translate(s)),(a||i||m)&&(e=e.translate(o,r),Array.isArray(a)&&a.length>=2&&a.every(u=>!Number.isNaN(+u))&&a.some(u=>u!==0)?e=e.rotate(...a):typeof a=="number"&&!Number.isNaN(a)&&(e=e.rotate(a)),Array.isArray(i)&&i.length===2&&i.every(u=>!Number.isNaN(+u))&&i.some(u=>u!==0)?(e=i[0]?e.skewX(i[0]):e,e=i[1]?e.skewY(i[1]):e):typeof i=="number"&&!Number.isNaN(i)&&(e=e.skewX(i)),Array.isArray(m)&&m.length>=2&&m.every(u=>!Number.isNaN(+u))&&m.some(u=>u!==1)?e=e.scale(...m):typeof m=="number"&&!Number.isNaN(m)&&(e=e.scale(m)),e=e.translate(-o,-r)),e},Ze=en;import tn from"@thednp/dommatrix";var rn=(t,e)=>{let n=tn.Translate(e[0],e[1],e[2]);return[,,,n.m44]=e,n=t.multiply(n),[n.m41,n.m42,n.m43,n.m44]},nn=(t,e,n)=>{let[o,r,s]=n,[a,i,m]=rn(t,[e[0],e[1],0,1]),u=a-o,l=i-r,c=m-s;return[u*(Math.abs(s)/Math.abs(c)||1)+o,l*(Math.abs(s)/Math.abs(c)||1)+r]},Me=nn;var on=(t,e)=>{let n=0,o=0,r=0,s=0,a=0,i=0,m="M",u=L(t),l=e&&Object.keys(e);if(!e||l&&!l.length)return u.slice(0);e.origin||Object.assign(e,{origin:I.origin});let c=e.origin,f=Ze(e);return f.isIdentity?u.slice(0):T(u,(g,p,h,y)=>{[m]=g;let S=m.toUpperCase(),d=S!==m?_(g,p,h,y):g.slice(0),b=S==="A"?["C"].concat(be(h,y,d[1],d[2],d[3],d[4],d[5],d[6],d[7])):S==="V"?["L",h,d[1]]:S==="H"?["L",d[1],y]:d;m=b[0];let P=m==="C"&&b.length>7,C=P?b.slice(0,7):b.slice(0);if(P&&(u.splice(p+1,0,["C"].concat(b.slice(7))),b=C),m==="L"){[r,s]=Me(f,[b[1],b[2]],c);n!==r&&o!==s?b=["L",r,s]:o===s?b=["H",r]:n===r&&(b=["V",s])}else for(a=1,i=b.length;a<i;a+=2)[r,s]=Me(f,[+b[a],+b[a+1]],c),b[a]=r,b[a+1]=s;return n=r,o=s,b})},tt=on;var an=t=>{let e=t.slice(1).map((n,o,r)=>o?r[o-1].slice(-2).concat(n.slice(1)):t[0].slice(1).concat(n.slice(1))).map(n=>n.map((o,r)=>n[n.length-r-2*(1-r%2)])).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map(n=>["C"].concat(n.slice(2))))},Mt=an;var sn=(t,e)=>{let{round:n}=I;n=e==="off"||typeof e=="number"&&e>=0?e:typeof n=="number"&&n>=0?n:"off";return n==="off"?t.slice(0):T(t,o=>ie(o,n))},Lt=sn;var mn=(t,e=.5)=>{let n=e,o=t.slice(0,2),r=t.slice(2,4),s=t.slice(4,6),a=t.slice(6,8),i=E(o,r,n),m=E(r,s,n),u=E(s,a,n),l=E(i,m,n),c=E(m,u,n),f=E(l,c,n);return[["C",i[0],i[1],l[0],l[1],f[0],f[1]],["C",c[0],c[1],u[0],u[1],a[0],a[1]]]},vt=mn;var Nt=class{constructor(e,n){let o=n||{},r=typeof e>"u";if(r||!e.length)throw TypeError(`${R}: "pathValue" is ${r?"undefined":"empty"}`);this.segments=L(e);let{round:s,origin:a}=o,i;Number.isInteger(s)||s==="off"?i=s:i=I.round;let m=I.origin;if(Array.isArray(a)&&a.length>=2){let[u,l,c]=a.map(Number);m=[Number.isNaN(u)?0:u,Number.isNaN(l)?0:l,Number.isNaN(c)?0:c]}return this.round=i,this.origin=m,this}get bbox(){return We(this.segments)}get length(){return K(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(e){return me(this.segments,e)}toAbsolute(){let{segments:e}=this;return this.segments=oe(e),this}toRelative(){let{segments:e}=this;return this.segments=Je(e),this}toCurve(){let{segments:e}=this;return this.segments=ae(e),this}reverse(e){let{segments:n}=this,o=et(n),r=o.length>1?o:!1,s=r?r.map((i,m)=>e?m?Te(i):i.slice(0):Te(i)):n.slice(0),a=[];return r?a=s.flat(1):a=e?n:Te(n),this.segments=a.slice(0),this}normalize(){let{segments:e}=this;return this.segments=J(e),this}optimize(){let{segments:e}=this,n=this.round==="off"?2:this.round;return this.segments=Ye(e,n),this}transform(e){if(!e||typeof e!="object"||typeof e=="object"&&!["translate","rotate","skew","scale"].some(m=>m in e))return this;let{segments:n,origin:[o,r,s]}=this,a={};for(let[m,u]of Object.entries(e)){m==="skew"&&Array.isArray(u)||(m==="rotate"||m==="translate"||m==="origin"||m==="scale")&&Array.isArray(u)?a[m]=u.map(Number):m!=="origin"&&typeof Number(u)=="number"&&(a[m]=Number(u))}let{origin:i}=a;if(Array.isArray(i)&&i.length>=2){let[m,u,l]=i.map(Number);a.origin=[Number.isNaN(m)?o:m,Number.isNaN(u)?r:u,l||s]}else a.origin=[o,r,s];return this.segments=tt(n,a),this}flipX(){let{cx:e,cy:n}=this.bbox;return this.transform({rotate:[0,180,0],origin:[e,n,0]}),this}flipY(){let{cx:e,cy:n}=this.bbox;return this.transform({rotate:[180,0,0],origin:[e,n,0]}),this}toString(){return Ce(this.segments,this.round)}dispose(){Object.keys(this).forEach(e=>delete this[e])}static get CSSMatrix(){return un}static get arcTools(){return ut}static get bezierTools(){return ct}static get cubicTools(){return ft}static get lineTools(){return ot}static get polygonTools(){return bt}static get quadTools(){return ht}static get pathToAbsolute(){return oe}static get pathToRelative(){return Je}static get pathToCurve(){return ae}static get pathToString(){return Ce}static get distanceSquareRoot(){return re}static get midPoint(){return E}static get rotateVector(){return ne}static get roundTo(){return M}static get parsePathString(){return L}static get finalizeSegment(){return Se}static get invalidPathValue(){return $}static get isArcCommand(){return qe}static get isDigit(){return B}static get isDigitStart(){return ke}static get isMoveCommand(){return Qe}static get isPathCommand(){return Re}static get isSpace(){return Ve}static get paramsCount(){return Z}static get paramsParser(){return U}static get pathParser(){return F}static get scanFlag(){return we}static get scanParam(){return ze}static get scanSegment(){return ge}static get skipSpaces(){return G}static get distanceEpsilon(){return se}static get getClosestPoint(){return dt}static get getDrawDirection(){return yt}static get getPathArea(){return Oe}static get getPathBBox(){return We}static get getPointAtLength(){return me}static get getPropertiesAtLength(){return de}static get getPropertiesAtPoint(){return Y}static get getSegmentAtLength(){return Pt}static get getSegmentOfPoint(){return xt}static get getTotalLength(){return K}static get isAbsoluteArray(){return Ie}static get isCurveArray(){return St}static get isNormalizedArray(){return Be}static get isPathArray(){return ee}static get isPointInStroke(){return At}static get isRelativeArray(){return Ct}static get isValidPath(){return $e}static get shapeParams(){return te}static get shapeToPath(){return Tt}static get shapeToPathArray(){return je}static get absolutizeSegment(){return _}static get arcToCubic(){return be}static get getSVGMatrix(){return Ze}static get iterate(){return T}static get lineToCubic(){return Ae}static get normalizePath(){return J}static get normalizeSegment(){return X}static get optimizePath(){return Ye}static get projection2d(){return Me}static get quadToCubic(){return De}static get relativizeSegment(){return he}static get reverseCurve(){return Mt}static get reversePath(){return Te}static get roundPath(){return Lt}static get roundSegment(){return ie}static get segmentToCubic(){return Ee}static get shortenSegment(){return He}static get splitCubic(){return vt}static get splitPath(){return et}static get transformPath(){return tt}},It=Nt;import{default as Li}from"@thednp/dommatrix";var Ci=It;export{Li as CSSMatrix,_ as absolutizeSegment,be as arcToCubic,ut as arcTools,ct as bezierTools,ft as cubicTools,Ci as default,se as distanceEpsilon,re as distanceSquareRoot,Se as finalizeSegment,dt as getClosestPoint,yt as getDrawDirection,Oe as getPathArea,We as getPathBBox,me as getPointAtLength,de as getPropertiesAtLength,Y as getPropertiesAtPoint,Ze as getSVGMatrix,Pt as getSegmentAtLength,xt as getSegmentOfPoint,K as getTotalLength,$ as invalidPathValue,Ie as isAbsoluteArray,qe as isArcCommand,St as isCurveArray,B as isDigit,ke as isDigitStart,Qe as isMoveCommand,Be as isNormalizedArray,ee as isPathArray,Re as isPathCommand,At as isPointInStroke,Ct as isRelativeArray,Ve as isSpace,$e as isValidPath,T as iterate,Ae as lineToCubic,ot as lineTools,E as midPoint,J as normalizePath,X as normalizeSegment,Ye as optimizePath,Z as paramsCount,U as paramsParser,L as parsePathString,F as pathParser,oe as pathToAbsolute,ae as pathToCurve,Je as pathToRelative,Ce as pathToString,bt as polygonTools,Me as projection2d,De as quadToCubic,ht as quadTools,he as relativizeSegment,Mt as reverseCurve,Te as reversePath,ne as rotateVector,Lt as roundPath,ie as roundSegment,M as roundTo,we as scanFlag,ze as scanParam,ge as scanSegment,Ee as segmentToCubic,te as shapeParams,Tt as shapeToPath,je as shapeToPathArray,He as shortenSegment,G as skipSpaces,vt as splitCubic,et as splitPath,tt as transformPath};
|
|
2
|
+
//# sourceMappingURL=svg-path-commander.mjs.map
|