svg-path-commander 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,10 @@
1
+ var Gt = Object.defineProperty;
2
+ var te = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var N = (e, t, n) => (te(e, typeof t != "symbol" ? t + "" : t, n), n);
1
4
  const at = {
2
5
  origin: [0, 0, 0],
3
6
  round: 4
4
- }, q = "SVGPathCommander Error", B = {
7
+ }, O = "SVGPathCommander Error", K = {
5
8
  a: 7,
6
9
  c: 6,
7
10
  h: 1,
@@ -13,12 +16,12 @@ const at = {
13
16
  t: 2,
14
17
  v: 1,
15
18
  z: 0
16
- }, vt = (e) => {
19
+ }, Tt = (e) => {
17
20
  let t = e.pathValue[e.segmentStart], n = t.toLowerCase();
18
21
  const { data: r } = e;
19
- for (; r.length >= B[n] && (n === "m" && r.length > 2 ? (e.segments.push([t, ...r.splice(0, 2)]), n = "l", t = t === "m" ? "l" : "L") : e.segments.push([t, ...r.splice(0, B[n])]), !!B[n]); )
22
+ for (; r.length >= K[n] && (n === "m" && r.length > 2 ? (e.segments.push([t, ...r.splice(0, 2)]), n = "l", t = t === "m" ? "l" : "L") : e.segments.push([t, ...r.splice(0, K[n])]), !!K[n]); )
20
23
  ;
21
- }, Kt = (e) => {
24
+ }, ee = (e) => {
22
25
  const { index: t, pathValue: n } = e, r = n.charCodeAt(t);
23
26
  if (r === 48) {
24
27
  e.param = 0, e.index += 1;
@@ -28,47 +31,47 @@ const at = {
28
31
  e.param = 1, e.index += 1;
29
32
  return;
30
33
  }
31
- e.err = `${q}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`;
32
- }, I = (e) => e >= 48 && e <= 57, D = "Invalid path value", _t = (e) => {
34
+ e.err = `${O}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`;
35
+ }, D = (e) => e >= 48 && e <= 57, X = "Invalid path value", ne = (e) => {
33
36
  const { max: t, pathValue: n, index: r } = e;
34
- let s = r, i = !1, o = !1, l = !1, c = !1, a;
37
+ let s = r, i = !1, o = !1, a = !1, l = !1, c;
35
38
  if (s >= t) {
36
- e.err = `${q}: ${D} at index ${s}, "pathValue" is missing param`;
39
+ e.err = `${O}: ${X} at index ${s}, "pathValue" is missing param`;
37
40
  return;
38
41
  }
39
- if (a = n.charCodeAt(s), (a === 43 || a === 45) && (s += 1, a = n.charCodeAt(s)), !I(a) && a !== 46) {
40
- e.err = `${q}: ${D} at index ${s}, "${n[s]}" is not a number`;
42
+ if (c = n.charCodeAt(s), (c === 43 || c === 45) && (s += 1, c = n.charCodeAt(s)), !D(c) && c !== 46) {
43
+ e.err = `${O}: ${X} at index ${s}, "${n[s]}" is not a number`;
41
44
  return;
42
45
  }
43
- if (a !== 46) {
44
- if (i = a === 48, s += 1, a = n.charCodeAt(s), i && s < t && a && I(a)) {
45
- e.err = `${q}: ${D} at index ${r}, "${n[r]}" illegal number`;
46
+ if (c !== 46) {
47
+ if (i = c === 48, s += 1, c = n.charCodeAt(s), i && s < t && c && D(c)) {
48
+ e.err = `${O}: ${X} at index ${r}, "${n[r]}" illegal number`;
46
49
  return;
47
50
  }
48
- for (; s < t && I(n.charCodeAt(s)); )
51
+ for (; s < t && D(n.charCodeAt(s)); )
49
52
  s += 1, o = !0;
50
- a = n.charCodeAt(s);
53
+ c = n.charCodeAt(s);
51
54
  }
52
- if (a === 46) {
53
- for (c = !0, s += 1; I(n.charCodeAt(s)); )
54
- s += 1, l = !0;
55
- a = n.charCodeAt(s);
55
+ if (c === 46) {
56
+ for (l = !0, s += 1; D(n.charCodeAt(s)); )
57
+ s += 1, a = !0;
58
+ c = n.charCodeAt(s);
56
59
  }
57
- if (a === 101 || a === 69) {
58
- if (c && !o && !l) {
59
- e.err = `${q}: ${D} at index ${s}, "${n[s]}" invalid float exponent`;
60
+ if (c === 101 || c === 69) {
61
+ if (l && !o && !a) {
62
+ e.err = `${O}: ${X} at index ${s}, "${n[s]}" invalid float exponent`;
60
63
  return;
61
64
  }
62
- if (s += 1, a = n.charCodeAt(s), (a === 43 || a === 45) && (s += 1), s < t && I(n.charCodeAt(s)))
63
- for (; s < t && I(n.charCodeAt(s)); )
65
+ if (s += 1, c = n.charCodeAt(s), (c === 43 || c === 45) && (s += 1), s < t && D(n.charCodeAt(s)))
66
+ for (; s < t && D(n.charCodeAt(s)); )
64
67
  s += 1;
65
68
  else {
66
- e.err = `${q}: ${D} at index ${s}, "${n[s]}" invalid integer exponent`;
69
+ e.err = `${O}: ${X} at index ${s}, "${n[s]}" invalid integer exponent`;
67
70
  return;
68
71
  }
69
72
  }
70
73
  e.index = s, e.param = +e.pathValue.slice(r, s);
71
- }, Wt = (e) => [
74
+ }, se = (e) => [
72
75
  // Special spaces
73
76
  5760,
74
77
  6158,
@@ -98,11 +101,11 @@ const at = {
98
101
  11,
99
102
  12,
100
103
  160
101
- ].includes(e), G = (e) => {
104
+ ].includes(e), _ = (e) => {
102
105
  const { pathValue: t, max: n } = e;
103
- for (; e.index < n && Wt(t.charCodeAt(e.index)); )
106
+ for (; e.index < n && se(t.charCodeAt(e.index)); )
104
107
  e.index += 1;
105
- }, te = (e) => {
108
+ }, re = (e) => {
106
109
  switch (e | 32) {
107
110
  case 109:
108
111
  case 122:
@@ -118,136 +121,136 @@ const at = {
118
121
  default:
119
122
  return !1;
120
123
  }
121
- }, ee = (e) => I(e) || e === 43 || e === 45 || e === 46, ne = (e) => (e | 32) === 97, Ot = (e) => {
122
- const { max: t, pathValue: n, index: r } = e, s = n.charCodeAt(r), i = B[n[r].toLowerCase()];
123
- if (e.segmentStart = r, !te(s)) {
124
- e.err = `${q}: ${D} "${n[r]}" is not a path command`;
124
+ }, ie = (e) => D(e) || e === 43 || e === 45 || e === 46, oe = (e) => (e | 32) === 97, jt = (e) => {
125
+ const { max: t, pathValue: n, index: r } = e, s = n.charCodeAt(r), i = K[n[r].toLowerCase()];
126
+ if (e.segmentStart = r, !re(s)) {
127
+ e.err = `${O}: ${X} "${n[r]}" is not a path command`;
125
128
  return;
126
129
  }
127
- if (e.index += 1, G(e), e.data = [], !i) {
128
- vt(e);
130
+ if (e.index += 1, _(e), e.data = [], !i) {
131
+ Tt(e);
129
132
  return;
130
133
  }
131
134
  for (; ; ) {
132
135
  for (let o = i; o > 0; o -= 1) {
133
- if (ne(s) && (o === 3 || o === 4) ? Kt(e) : _t(e), e.err.length)
136
+ if (oe(s) && (o === 3 || o === 4) ? ee(e) : ne(e), e.err.length)
134
137
  return;
135
- e.data.push(e.param), G(e), e.index < t && n.charCodeAt(e.index) === 44 && (e.index += 1, G(e));
138
+ e.data.push(e.param), _(e), e.index < t && n.charCodeAt(e.index) === 44 && (e.index += 1, _(e));
136
139
  }
137
- if (e.index >= e.max || !ee(n.charCodeAt(e.index)))
140
+ if (e.index >= e.max || !ie(n.charCodeAt(e.index)))
138
141
  break;
139
142
  }
140
- vt(e);
143
+ Tt(e);
141
144
  };
142
- class zt {
145
+ class Et {
143
146
  constructor(t) {
144
147
  this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = "";
145
148
  }
146
149
  }
147
- const ct = (e) => Array.isArray(e) && e.every((t) => {
150
+ const mt = (e) => Array.isArray(e) && e.every((t) => {
148
151
  const n = t[0].toLowerCase();
149
- return B[n] === t.length - 1 && "achlmqstvz".includes(n);
150
- }), R = (e) => {
151
- if (ct(e))
152
+ return K[n] === t.length - 1 && "achlmqstvz".includes(n);
153
+ }), Q = (e) => {
154
+ if (mt(e))
152
155
  return [...e];
153
- const t = new zt(e);
154
- for (G(t); t.index < t.max && !t.err.length; )
155
- Ot(t);
156
+ const t = new Et(e);
157
+ for (_(t); t.index < t.max && !t.err.length; )
158
+ jt(t);
156
159
  if (t.err && t.err.length)
157
160
  throw TypeError(t.err);
158
161
  return t.segments;
159
- }, se = (e) => {
162
+ }, ce = (e) => {
160
163
  const t = e.length;
161
164
  let n = -1, r, s = e[t - 1], i = 0;
162
165
  for (; ++n < t; )
163
166
  r = s, s = e[n], i += r[1] * s[0] - r[0] * s[1];
164
167
  return i / 2;
165
- }, U = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), re = (e) => e.reduce((t, n, r) => r ? t + U(e[r - 1], n) : 0, 0);
166
- var ie = Object.defineProperty, oe = (e, t, n) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (oe(e, typeof t != "symbol" ? t + "" : t, n), n);
167
- const ae = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, m11: 1, m12: 0, m13: 0, m14: 0, m21: 0, m22: 1, m23: 0, m24: 0, m31: 0, m32: 0, m33: 1, m34: 0, m41: 0, m42: 0, m43: 0, m44: 1, is2D: !0, isIdentity: !0 }, It = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), jt = (e) => e instanceof DOMMatrix || e instanceof N || typeof e == "object" && Object.keys(ae).every((t) => e && t in e), K = (e) => {
168
- const t = new N(), n = Array.from(e);
169
- if (!It(n))
168
+ }, V = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), le = (e) => e.reduce((t, n, r) => r ? t + V(e[r - 1], n) : 0, 0);
169
+ var ae = Object.defineProperty, me = (e, t, n) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (me(e, typeof t != "symbol" ? t + "" : t, n), n);
170
+ const he = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, m11: 1, m12: 0, m13: 0, m14: 0, m21: 0, m22: 1, m23: 0, m24: 0, m31: 0, m32: 0, m33: 1, m34: 0, m41: 0, m42: 0, m43: 0, m44: 1, is2D: !0, isIdentity: !0 }, Dt = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Zt = (e) => e instanceof DOMMatrix || e instanceof w || typeof e == "object" && Object.keys(he).every((t) => e && t in e), G = (e) => {
171
+ const t = new w(), n = Array.from(e);
172
+ if (!Dt(n))
170
173
  throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`);
171
174
  if (n.length === 16) {
172
- const [r, s, i, o, l, c, a, m, f, y, g, h, u, x, d, p] = n;
173
- t.m11 = r, t.a = r, t.m21 = l, t.c = l, t.m31 = f, t.m41 = u, t.e = u, t.m12 = s, t.b = s, t.m22 = c, t.d = c, t.m32 = y, t.m42 = x, t.f = x, t.m13 = i, t.m23 = a, t.m33 = g, t.m43 = d, t.m14 = o, t.m24 = m, t.m34 = h, t.m44 = p;
175
+ const [r, s, i, o, a, l, c, m, f, y, g, h, u, x, p, b] = n;
176
+ t.m11 = r, t.a = r, t.m21 = a, t.c = a, t.m31 = f, t.m41 = u, t.e = u, t.m12 = s, t.b = s, t.m22 = l, t.d = l, t.m32 = y, t.m42 = x, t.f = x, t.m13 = i, t.m23 = c, t.m33 = g, t.m43 = p, t.m14 = o, t.m24 = m, t.m34 = h, t.m44 = b;
174
177
  } else if (n.length === 6) {
175
- const [r, s, i, o, l, c] = n;
176
- t.m11 = r, t.a = r, t.m12 = s, t.b = s, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = l, t.e = l, t.m42 = c, t.f = c;
178
+ const [r, s, i, o, a, l] = n;
179
+ t.m11 = r, t.a = r, t.m12 = s, t.b = s, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = a, t.e = a, t.m42 = l, t.f = l;
177
180
  }
178
181
  return t;
179
- }, Et = (e) => {
180
- if (jt(e))
181
- return K([e.m11, e.m12, e.m13, e.m14, e.m21, e.m22, e.m23, e.m24, e.m31, e.m32, e.m33, e.m34, e.m41, e.m42, e.m43, e.m44]);
182
+ }, Rt = (e) => {
183
+ if (Zt(e))
184
+ return G([e.m11, e.m12, e.m13, e.m14, e.m21, e.m22, e.m23, e.m24, e.m31, e.m32, e.m33, e.m34, e.m41, e.m42, e.m43, e.m44]);
182
185
  throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);
183
- }, Dt = (e) => {
186
+ }, Xt = (e) => {
184
187
  if (typeof e != "string")
185
188
  throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);
186
189
  const t = String(e).replace(/\s/g, "");
187
- let n = new N();
190
+ let n = new w();
188
191
  const r = `CSSMatrix: invalid transform string "${e}"`;
189
192
  return t.split(")").filter((s) => s).forEach((s) => {
190
193
  const [i, o] = s.split("(");
191
194
  if (!o)
192
195
  throw TypeError(r);
193
- const l = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [c, a, m, f] = l, y = [c, a, m], g = [c, a, m, f];
194
- if (i === "perspective" && c && [a, m].every((h) => h === void 0))
195
- n.m34 = -1 / c;
196
- else if (i.includes("matrix") && [6, 16].includes(l.length) && l.every((h) => !Number.isNaN(+h))) {
197
- const h = l.map((u) => Math.abs(u) < 1e-6 ? 0 : u);
198
- n = n.multiply(K(h));
196
+ const a = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [l, c, m, f] = a, y = [l, c, m], g = [l, c, m, f];
197
+ if (i === "perspective" && l && [c, m].every((h) => h === void 0))
198
+ n.m34 = -1 / l;
199
+ else if (i.includes("matrix") && [6, 16].includes(a.length) && a.every((h) => !Number.isNaN(+h))) {
200
+ const h = a.map((u) => Math.abs(u) < 1e-6 ? 0 : u);
201
+ n = n.multiply(G(h));
199
202
  } else if (i === "translate3d" && y.every((h) => !Number.isNaN(+h)))
200
- n = n.translate(c, a, m);
201
- else if (i === "translate" && c && m === void 0)
202
- n = n.translate(c, a || 0, 0);
203
+ n = n.translate(l, c, m);
204
+ else if (i === "translate" && l && m === void 0)
205
+ n = n.translate(l, c || 0, 0);
203
206
  else if (i === "rotate3d" && g.every((h) => !Number.isNaN(+h)) && f)
204
- n = n.rotateAxisAngle(c, a, m, f);
205
- else if (i === "rotate" && c && [a, m].every((h) => h === void 0))
206
- n = n.rotate(0, 0, c);
207
+ n = n.rotateAxisAngle(l, c, m, f);
208
+ else if (i === "rotate" && l && [c, m].every((h) => h === void 0))
209
+ n = n.rotate(0, 0, l);
207
210
  else if (i === "scale3d" && y.every((h) => !Number.isNaN(+h)) && y.some((h) => h !== 1))
208
- n = n.scale(c, a, m);
209
- else if (i === "scale" && !Number.isNaN(c) && c !== 1 && m === void 0) {
210
- const h = Number.isNaN(+a) ? c : a;
211
- n = n.scale(c, h, 1);
212
- } else if (i === "skew" && (c || !Number.isNaN(c) && a) && m === void 0)
213
- n = n.skew(c, a || 0);
214
- else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && c && [a, m].every((h) => h === void 0))
211
+ n = n.scale(l, c, m);
212
+ else if (i === "scale" && !Number.isNaN(l) && l !== 1 && m === void 0) {
213
+ const h = Number.isNaN(+c) ? l : c;
214
+ n = n.scale(l, h, 1);
215
+ } else if (i === "skew" && (l || !Number.isNaN(l) && c) && m === void 0)
216
+ n = n.skew(l, c || 0);
217
+ else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && l && [c, m].every((h) => h === void 0))
215
218
  if (i === "skewX" || i === "skewY")
216
- n = n[i](c);
219
+ n = n[i](l);
217
220
  else {
218
- const h = i.replace(/[XYZ]/, ""), u = i.replace(h, ""), x = ["X", "Y", "Z"].indexOf(u), d = h === "scale" ? 1 : 0, p = [x === 0 ? c : d, x === 1 ? c : d, x === 2 ? c : d];
219
- n = n[h](...p);
221
+ const h = i.replace(/[XYZ]/, ""), u = i.replace(h, ""), x = ["X", "Y", "Z"].indexOf(u), p = h === "scale" ? 1 : 0, b = [x === 0 ? l : p, x === 1 ? l : p, x === 2 ? l : p];
222
+ n = n[h](...b);
220
223
  }
221
224
  else
222
225
  throw TypeError(r);
223
226
  }), n;
224
- }, xt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [e.m11, e.m12, e.m13, e.m14, e.m21, e.m22, e.m23, e.m24, e.m31, e.m32, e.m33, e.m34, e.m41, e.m42, e.m43, e.m44], Zt = (e, t, n) => {
225
- const r = new N();
227
+ }, bt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [e.m11, e.m12, e.m13, e.m14, e.m21, e.m22, e.m23, e.m24, e.m31, e.m32, e.m33, e.m34, e.m41, e.m42, e.m43, e.m44], Ft = (e, t, n) => {
228
+ const r = new w();
226
229
  return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = n, r;
227
- }, Rt = (e, t, n) => {
228
- const r = new N(), s = Math.PI / 180, i = e * s, o = t * s, l = n * s, c = Math.cos(i), a = -Math.sin(i), m = Math.cos(o), f = -Math.sin(o), y = Math.cos(l), g = -Math.sin(l), h = m * y, u = -m * g;
230
+ }, Qt = (e, t, n) => {
231
+ const r = new w(), s = Math.PI / 180, i = e * s, o = t * s, a = n * s, l = Math.cos(i), c = -Math.sin(i), m = Math.cos(o), f = -Math.sin(o), y = Math.cos(a), g = -Math.sin(a), h = m * y, u = -m * g;
229
232
  r.m11 = h, r.a = h, r.m12 = u, r.b = u, r.m13 = f;
230
- const x = a * f * y + c * g;
233
+ const x = c * f * y + l * g;
231
234
  r.m21 = x, r.c = x;
232
- const d = c * y - a * f * g;
233
- return r.m22 = d, r.d = d, r.m23 = -a * m, r.m31 = a * g - c * f * y, r.m32 = a * y + c * f * g, r.m33 = c * m, r;
234
- }, Xt = (e, t, n, r) => {
235
- const s = new N(), i = Math.sqrt(e * e + t * t + n * n);
235
+ const p = l * y - c * f * g;
236
+ return r.m22 = p, r.d = p, r.m23 = -c * m, r.m31 = c * g - l * f * y, r.m32 = c * y + l * f * g, r.m33 = l * m, r;
237
+ }, Ht = (e, t, n, r) => {
238
+ const s = new w(), i = Math.sqrt(e * e + t * t + n * n);
236
239
  if (i === 0)
237
240
  return s;
238
- const o = e / i, l = t / i, c = n / i, a = r * (Math.PI / 360), m = Math.sin(a), f = Math.cos(a), y = m * m, g = o * o, h = l * l, u = c * c, x = 1 - 2 * (h + u) * y;
241
+ const o = e / i, a = t / i, l = n / i, c = r * (Math.PI / 360), m = Math.sin(c), f = Math.cos(c), y = m * m, g = o * o, h = a * a, u = l * l, x = 1 - 2 * (h + u) * y;
239
242
  s.m11 = x, s.a = x;
240
- const d = 2 * (o * l * y + c * m * f);
241
- s.m12 = d, s.b = d, s.m13 = 2 * (o * c * y - l * m * f);
242
- const p = 2 * (l * o * y - c * m * f);
243
- s.m21 = p, s.c = p;
243
+ const p = 2 * (o * a * y + l * m * f);
244
+ s.m12 = p, s.b = p, s.m13 = 2 * (o * l * y - a * m * f);
245
+ const b = 2 * (a * o * y - l * m * f);
246
+ s.m21 = b, s.c = b;
244
247
  const A = 1 - 2 * (u + g) * y;
245
- return s.m22 = A, s.d = A, s.m23 = 2 * (l * c * y + o * m * f), s.m31 = 2 * (c * o * y + l * m * f), s.m32 = 2 * (c * l * y - o * m * f), s.m33 = 1 - 2 * (g + h) * y, s;
246
- }, Ft = (e, t, n) => {
247
- const r = new N();
248
+ return s.m22 = A, s.d = A, s.m23 = 2 * (a * l * y + o * m * f), s.m31 = 2 * (l * o * y + a * m * f), s.m32 = 2 * (l * a * y - o * m * f), s.m33 = 1 - 2 * (g + h) * y, s;
249
+ }, Yt = (e, t, n) => {
250
+ const r = new w();
248
251
  return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = n, r;
249
- }, lt = (e, t) => {
250
- const n = new N();
252
+ }, ht = (e, t) => {
253
+ const n = new w();
251
254
  if (e) {
252
255
  const r = e * Math.PI / 180, s = Math.tan(r);
253
256
  n.m21 = s, n.c = s;
@@ -257,11 +260,11 @@ const ae = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, m11: 1, m12: 0, m13: 0, m14: 0,
257
260
  n.m12 = s, n.b = s;
258
261
  }
259
262
  return n;
260
- }, Qt = (e) => lt(e, 0), Ht = (e) => lt(0, e), k = (e, t) => {
261
- const n = 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, s = 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, m = 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, y = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, g = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, h = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, u = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, x = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, d = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
262
- return K([n, r, s, i, o, l, c, a, m, f, y, g, h, u, x, d]);
263
+ }, Bt = (e) => ht(e, 0), Jt = (e) => ht(0, e), $ = (e, t) => {
264
+ const n = 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, s = 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, a = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, l = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, c = t.m21 * e.m14 + t.m22 * e.m24 + t.m23 * e.m34 + t.m24 * e.m44, m = 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, y = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, g = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, h = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, u = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, x = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, p = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44;
265
+ return G([n, r, s, i, o, a, l, c, m, f, y, g, h, u, x, p]);
263
266
  };
264
- class N {
267
+ class w {
265
268
  constructor(t) {
266
269
  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;
267
270
  }
@@ -272,13 +275,13 @@ class N {
272
275
  return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;
273
276
  }
274
277
  setMatrixValue(t) {
275
- return typeof t == "string" && t.length && t !== "none" ? Dt(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? K(t) : typeof t == "object" ? Et(t) : this;
278
+ return typeof t == "string" && t.length && t !== "none" ? Xt(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? G(t) : typeof t == "object" ? Rt(t) : this;
276
279
  }
277
280
  toFloat32Array(t) {
278
- return Float32Array.from(xt(this, t));
281
+ return Float32Array.from(bt(this, t));
279
282
  }
280
283
  toFloat64Array(t) {
281
- return Float64Array.from(xt(this, t));
284
+ return Float64Array.from(bt(this, t));
282
285
  }
283
286
  toString() {
284
287
  const { is2D: t } = this, n = this.toFloat64Array(t).join(", ");
@@ -289,103 +292,103 @@ class N {
289
292
  return { ...this, is2D: t, isIdentity: n };
290
293
  }
291
294
  multiply(t) {
292
- return k(this, t);
295
+ return $(this, t);
293
296
  }
294
297
  translate(t, n, r) {
295
298
  const s = t;
296
299
  let i = n, o = r;
297
- return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), k(this, Zt(s, i, o));
300
+ return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), $(this, Ft(s, i, o));
298
301
  }
299
302
  scale(t, n, r) {
300
303
  const s = t;
301
304
  let i = n, o = r;
302
- return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), k(this, Ft(s, i, o));
305
+ return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), $(this, Yt(s, i, o));
303
306
  }
304
307
  rotate(t, n, r) {
305
308
  let s = t, i = n || 0, o = r || 0;
306
- return typeof t == "number" && typeof n > "u" && typeof r > "u" && (o = s, s = 0, i = 0), k(this, Rt(s, i, o));
309
+ return typeof t == "number" && typeof n > "u" && typeof r > "u" && (o = s, s = 0, i = 0), $(this, Qt(s, i, o));
307
310
  }
308
311
  rotateAxisAngle(t, n, r, s) {
309
312
  if ([t, n, r, s].some((i) => Number.isNaN(+i)))
310
313
  throw new TypeError("CSSMatrix: expecting 4 values");
311
- return k(this, Xt(t, n, r, s));
314
+ return $(this, Ht(t, n, r, s));
312
315
  }
313
316
  skewX(t) {
314
- return k(this, Qt(t));
317
+ return $(this, Bt(t));
315
318
  }
316
319
  skewY(t) {
317
- return k(this, Ht(t));
320
+ return $(this, Jt(t));
318
321
  }
319
322
  skew(t, n) {
320
- return k(this, lt(t, n));
323
+ return $(this, ht(t, n));
321
324
  }
322
325
  transformPoint(t) {
323
326
  const n = 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, s = 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;
324
327
  return t instanceof DOMPoint ? new DOMPoint(n, r, s, i) : { x: n, y: r, z: s, w: i };
325
328
  }
326
329
  }
327
- C(N, "Translate", Zt), C(N, "Rotate", Rt), C(N, "RotateAxisAngle", Xt), C(N, "Scale", Ft), C(N, "SkewX", Qt), C(N, "SkewY", Ht), C(N, "Skew", lt), C(N, "Multiply", k), C(N, "fromArray", K), C(N, "fromMatrix", Et), C(N, "fromString", Dt), C(N, "toArray", xt), C(N, "isCompatibleArray", It), C(N, "isCompatibleObject", jt);
328
- var Mt = N;
329
- const At = (e) => ct(e) && // `isPathArray` also checks if it's `Array`
330
- e.every(([t]) => t === t.toUpperCase()), X = (e) => {
331
- if (At(e))
330
+ C(w, "Translate", Ft), C(w, "Rotate", Qt), C(w, "RotateAxisAngle", Ht), C(w, "Scale", Yt), C(w, "SkewX", Bt), C(w, "SkewY", Jt), C(w, "Skew", ht), C(w, "Multiply", $), C(w, "fromArray", G), C(w, "fromMatrix", Rt), C(w, "fromString", Xt), C(w, "toArray", bt), C(w, "isCompatibleArray", Dt), C(w, "isCompatibleObject", Zt);
331
+ var Nt = w;
332
+ const vt = (e) => mt(e) && // `isPathArray` also checks if it's `Array`
333
+ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
334
+ if (vt(e))
332
335
  return [...e];
333
- const t = R(e);
336
+ const t = Q(e);
334
337
  let n = 0, r = 0, s = 0, i = 0;
335
338
  return t.map((o) => {
336
- const l = o.slice(1).map(Number), [c] = o, a = c.toUpperCase();
337
- if (c === "M")
338
- return [n, r] = l, s = n, i = r, ["M", n, r];
339
+ const a = o.slice(1).map(Number), [l] = o, c = l.toUpperCase();
340
+ if (l === "M")
341
+ return [n, r] = a, s = n, i = r, ["M", n, r];
339
342
  let m = [];
340
- if (c !== a)
341
- if (a === "A")
343
+ if (l !== c)
344
+ if (c === "A")
342
345
  m = [
343
- a,
344
- l[0],
345
- l[1],
346
- l[2],
347
- l[3],
348
- l[4],
349
- l[5] + n,
350
- l[6] + r
346
+ c,
347
+ a[0],
348
+ a[1],
349
+ a[2],
350
+ a[3],
351
+ a[4],
352
+ a[5] + n,
353
+ a[6] + r
351
354
  ];
352
- else if (a === "V")
353
- m = [a, l[0] + r];
354
- else if (a === "H")
355
- m = [a, l[0] + n];
355
+ else if (c === "V")
356
+ m = [c, a[0] + r];
357
+ else if (c === "H")
358
+ m = [c, a[0] + n];
356
359
  else {
357
- const f = l.map((y, g) => y + (g % 2 ? r : n));
358
- m = [a, ...f];
360
+ const f = a.map((y, g) => y + (g % 2 ? r : n));
361
+ m = [c, ...f];
359
362
  }
360
363
  else
361
- m = [a, ...l];
362
- return a === "Z" ? (n = s, r = i) : a === "H" ? [, n] = m : a === "V" ? [, r] = m : ([n, r] = m.slice(-2), a === "M" && (s = n, i = r)), m;
364
+ m = [c, ...a];
365
+ return c === "Z" ? (n = s, r = i) : c === "H" ? [, n] = m : c === "V" ? [, r] = m : ([n, r] = m.slice(-2), c === "M" && (s = n, i = r)), m;
363
366
  });
364
- }, ce = (e, t) => {
365
- const [n] = e, { x1: r, y1: s, x2: i, y2: o } = t, l = e.slice(1).map(Number);
366
- let c = e;
367
+ }, ue = (e, t) => {
368
+ const [n] = e, { x1: r, y1: s, x2: i, y2: o } = t, a = e.slice(1).map(Number);
369
+ let l = e;
367
370
  if ("TQ".includes(n) || (t.qx = null, t.qy = null), n === "H")
368
- c = ["L", e[1], s];
371
+ l = ["L", e[1], s];
369
372
  else if (n === "V")
370
- c = ["L", r, e[1]];
373
+ l = ["L", r, e[1]];
371
374
  else if (n === "S") {
372
- const a = r * 2 - i, m = s * 2 - o;
373
- t.x1 = a, t.y1 = m, c = ["C", a, m, ...l];
375
+ const c = r * 2 - i, m = s * 2 - o;
376
+ t.x1 = c, t.y1 = m, l = ["C", c, m, ...a];
374
377
  } else if (n === "T") {
375
- const a = r * 2 - (t.qx ? t.qx : (
378
+ const c = r * 2 - (t.qx ? t.qx : (
376
379
  /* istanbul ignore next */
377
380
  0
378
381
  )), m = s * 2 - (t.qy ? t.qy : (
379
382
  /* istanbul ignore next */
380
383
  0
381
384
  ));
382
- t.qx = a, t.qy = m, c = ["Q", a, m, ...l];
385
+ t.qx = c, t.qy = m, l = ["Q", c, m, ...a];
383
386
  } else if (n === "Q") {
384
- const [a, m] = l;
385
- t.qx = a, t.qy = m;
387
+ const [c, m] = a;
388
+ t.qx = c, t.qy = m;
386
389
  }
387
- return c;
388
- }, Nt = (e) => At(e) && e.every(([t]) => "ACLMQZ".includes(t)), mt = {
390
+ return l;
391
+ }, wt = (e) => vt(e) && e.every(([t]) => "ACLMQZ".includes(t)), ut = {
389
392
  x1: 0,
390
393
  y1: 0,
391
394
  x2: 0,
@@ -394,21 +397,21 @@ e.every(([t]) => t === t.toUpperCase()), X = (e) => {
394
397
  y: 0,
395
398
  qx: null,
396
399
  qy: null
397
- }, O = (e) => {
398
- if (Nt(e))
400
+ }, j = (e) => {
401
+ if (wt(e))
399
402
  return [...e];
400
- const t = X(e), n = { ...mt }, r = t.length;
403
+ const t = H(e), n = { ...ut }, r = t.length;
401
404
  for (let s = 0; s < r; s += 1) {
402
- t[s], t[s] = ce(t[s], n);
405
+ t[s], t[s] = ue(t[s], n);
403
406
  const i = t[s], o = i.length;
404
407
  n.x1 = +i[o - 2], n.y1 = +i[o - 1], n.x2 = +i[o - 4] || n.x1, n.y2 = +i[o - 3] || n.y1;
405
408
  }
406
409
  return t;
407
- }, V = (e, t, n) => {
410
+ }, I = (e, t, n) => {
408
411
  const [r, s] = e, [i, o] = t;
409
412
  return [r + (i - r) * n, s + (o - s) * n];
410
413
  }, dt = (e, t, n, r, s) => {
411
- const i = U([e, t], [n, r]);
414
+ const i = V([e, t], [n, r]);
412
415
  let o = { x: 0, y: 0 };
413
416
  if (typeof s == "number")
414
417
  if (s <= 0)
@@ -416,8 +419,8 @@ e.every(([t]) => t === t.toUpperCase()), X = (e) => {
416
419
  else if (s >= i)
417
420
  o = { x: n, y: r };
418
421
  else {
419
- const [l, c] = V([e, t], [n, r], s / i);
420
- o = { x: l, y: c };
422
+ const [a, l] = I([e, t], [n, r], s / i);
423
+ o = { x: a, y: l };
421
424
  }
422
425
  return {
423
426
  length: i,
@@ -431,171 +434,171 @@ e.every(([t]) => t === t.toUpperCase()), X = (e) => {
431
434
  y: Math.max(t, r)
432
435
  }
433
436
  };
434
- }, wt = (e, t) => {
435
- const { x: n, y: r } = e, { x: s, y: i } = t, o = n * s + r * i, l = Math.sqrt((n ** 2 + r ** 2) * (s ** 2 + i ** 2));
436
- return (n * i - r * s < 0 ? -1 : 1) * Math.acos(o / l);
437
- }, le = (e, t, n, r, s, i, o, l, c, a) => {
437
+ }, Lt = (e, t) => {
438
+ const { x: n, y: r } = e, { x: s, y: i } = t, o = n * s + r * i, a = Math.sqrt((n ** 2 + r ** 2) * (s ** 2 + i ** 2));
439
+ return (n * i - r * s < 0 ? -1 : 1) * Math.acos(o / a);
440
+ }, fe = (e, t, n, r, s, i, o, a, l, c) => {
438
441
  const { abs: m, sin: f, cos: y, sqrt: g, PI: h } = Math;
439
442
  let u = m(n), x = m(r);
440
- const p = (s % 360 + 360) % 360 * (h / 180);
441
- if (e === l && t === c)
443
+ const b = (s % 360 + 360) % 360 * (h / 180);
444
+ if (e === a && t === l)
442
445
  return { x: e, y: t };
443
446
  if (u === 0 || x === 0)
444
- return dt(e, t, l, c, a).point;
445
- const A = (e - l) / 2, b = (t - c) / 2, M = {
446
- x: y(p) * A + f(p) * b,
447
- y: -f(p) * A + y(p) * b
448
- }, v = M.x ** 2 / u ** 2 + M.y ** 2 / x ** 2;
449
- v > 1 && (u *= g(v), x *= g(v));
450
- const $ = u ** 2 * x ** 2 - u ** 2 * M.y ** 2 - x ** 2 * M.x ** 2, F = u ** 2 * M.y ** 2 + x ** 2 * M.x ** 2;
451
- let E = $ / F;
452
- E = E < 0 ? 0 : E;
453
- const _ = (i !== o ? 1 : -1) * g(E), S = {
454
- x: _ * (u * M.y / x),
455
- y: _ * (-(x * M.x) / u)
456
- }, W = {
457
- x: y(p) * S.x - f(p) * S.y + (e + l) / 2,
458
- y: f(p) * S.x + y(p) * S.y + (t + c) / 2
459
- }, Q = {
460
- x: (M.x - S.x) / u,
461
- y: (M.y - S.y) / x
462
- }, tt = wt({ x: 1, y: 0 }, Q), et = {
463
- x: (-M.x - S.x) / u,
464
- y: (-M.y - S.y) / x
447
+ return dt(e, t, a, l, c).point;
448
+ const A = (e - a) / 2, d = (t - l) / 2, M = {
449
+ x: y(b) * A + f(b) * d,
450
+ y: -f(b) * A + y(b) * d
451
+ }, T = M.x ** 2 / u ** 2 + M.y ** 2 / x ** 2;
452
+ T > 1 && (u *= g(T), x *= g(T));
453
+ const z = u ** 2 * x ** 2 - u ** 2 * M.y ** 2 - x ** 2 * M.x ** 2, Y = u ** 2 * M.y ** 2 + x ** 2 * M.x ** 2;
454
+ let R = z / Y;
455
+ R = R < 0 ? 0 : R;
456
+ const tt = (i !== o ? 1 : -1) * g(R), k = {
457
+ x: tt * (u * M.y / x),
458
+ y: tt * (-(x * M.x) / u)
459
+ }, et = {
460
+ x: y(b) * k.x - f(b) * k.y + (e + a) / 2,
461
+ y: f(b) * k.x + y(b) * k.y + (t + l) / 2
462
+ }, B = {
463
+ x: (M.x - k.x) / u,
464
+ y: (M.y - k.y) / x
465
+ }, nt = Lt({ x: 1, y: 0 }, B), st = {
466
+ x: (-M.x - k.x) / u,
467
+ y: (-M.y - k.y) / x
465
468
  };
466
- let T = wt(Q, et);
467
- !o && T > 0 ? T -= 2 * h : o && T < 0 && (T += 2 * h), T %= 2 * h;
468
- const L = tt + T * a, H = u * y(L), Y = x * f(L);
469
+ let S = Lt(B, st);
470
+ !o && S > 0 ? S -= 2 * h : o && S < 0 && (S += 2 * h), S %= 2 * h;
471
+ const q = nt + S * c, J = u * y(q), U = x * f(q);
469
472
  return {
470
- x: y(p) * H - f(p) * Y + W.x,
471
- y: f(p) * H + y(p) * Y + W.y
473
+ x: y(b) * J - f(b) * U + et.x,
474
+ y: f(b) * J + y(b) * U + et.y
472
475
  };
473
- }, me = (e, t, n, r, s, i, o, l, c, a) => {
474
- const m = typeof a == "number";
475
- let f = e, y = t, g = 0, h = [f, y, g], u = [f, y], x = 0, d = { x: 0, y: 0 }, p = [{ x: f, y }];
476
- m && a <= 0 && (d = { x: f, y });
476
+ }, ye = (e, t, n, r, s, i, o, a, l, c) => {
477
+ const m = typeof c == "number";
478
+ let f = e, y = t, g = 0, h = [f, y, g], u = [f, y], x = 0, p = { x: 0, y: 0 }, b = [{ x: f, y }];
479
+ m && c <= 0 && (p = { x: f, y });
477
480
  const A = 300;
478
- for (let b = 0; b <= A; b += 1) {
479
- if (x = b / A, { x: f, y } = le(e, t, n, r, s, i, o, l, c, x), p = [...p, { x: f, y }], g += U(u, [f, y]), u = [f, y], m && g > a && a > h[2]) {
480
- const M = (g - a) / (g - h[2]);
481
- d = {
481
+ for (let d = 0; d <= A; d += 1) {
482
+ if (x = d / A, { x: f, y } = fe(e, t, n, r, s, i, o, a, l, x), b = [...b, { x: f, y }], g += V(u, [f, y]), u = [f, y], m && g > c && c > h[2]) {
483
+ const M = (g - c) / (g - h[2]);
484
+ p = {
482
485
  x: u[0] * (1 - M) + h[0] * M,
483
486
  y: u[1] * (1 - M) + h[1] * M
484
487
  };
485
488
  }
486
489
  h = [f, y, g];
487
490
  }
488
- return m && a >= g && (d = { x: l, y: c }), {
491
+ return m && c >= g && (p = { x: a, y: l }), {
489
492
  length: g,
490
- point: d,
493
+ point: p,
491
494
  min: {
492
- x: Math.min(...p.map((b) => b.x)),
493
- y: Math.min(...p.map((b) => b.y))
495
+ x: Math.min(...b.map((d) => d.x)),
496
+ y: Math.min(...b.map((d) => d.y))
494
497
  },
495
498
  max: {
496
- x: Math.max(...p.map((b) => b.x)),
497
- y: Math.max(...p.map((b) => b.y))
499
+ x: Math.max(...b.map((d) => d.x)),
500
+ y: Math.max(...b.map((d) => d.y))
498
501
  }
499
502
  };
500
- }, he = (e, t, n, r, s, i, o, l, c) => {
501
- const a = 1 - c;
503
+ }, ge = (e, t, n, r, s, i, o, a, l) => {
504
+ const c = 1 - l;
502
505
  return {
503
- x: a ** 3 * e + 3 * a ** 2 * c * n + 3 * a * c ** 2 * s + c ** 3 * o,
504
- y: a ** 3 * t + 3 * a ** 2 * c * r + 3 * a * c ** 2 * i + c ** 3 * l
506
+ x: c ** 3 * e + 3 * c ** 2 * l * n + 3 * c * l ** 2 * s + l ** 3 * o,
507
+ y: c ** 3 * t + 3 * c ** 2 * l * r + 3 * c * l ** 2 * i + l ** 3 * a
505
508
  };
506
- }, ue = (e, t, n, r, s, i, o, l, c) => {
507
- const a = typeof c == "number";
508
- let m = e, f = t, y = 0, g = [m, f, y], h = [m, f], u = 0, x = { x: 0, y: 0 }, d = [{ x: m, y: f }];
509
- a && c <= 0 && (x = { x: m, y: f });
510
- const p = 300;
511
- for (let A = 0; A <= p; A += 1) {
512
- if (u = A / p, { x: m, y: f } = he(e, t, n, r, s, i, o, l, u), d = [...d, { x: m, y: f }], y += U(h, [m, f]), h = [m, f], a && y > c && c > g[2]) {
513
- const b = (y - c) / (y - g[2]);
509
+ }, xe = (e, t, n, r, s, i, o, a, l) => {
510
+ const c = typeof l == "number";
511
+ let m = e, f = t, y = 0, g = [m, f, y], h = [m, f], u = 0, x = { x: 0, y: 0 }, p = [{ x: m, y: f }];
512
+ c && l <= 0 && (x = { x: m, y: f });
513
+ const b = 300;
514
+ for (let A = 0; A <= b; A += 1) {
515
+ if (u = A / b, { x: m, y: f } = ge(e, t, n, r, s, i, o, a, u), p = [...p, { x: m, y: f }], y += V(h, [m, f]), h = [m, f], c && y > l && l > g[2]) {
516
+ const d = (y - l) / (y - g[2]);
514
517
  x = {
515
- x: h[0] * (1 - b) + g[0] * b,
516
- y: h[1] * (1 - b) + g[1] * b
518
+ x: h[0] * (1 - d) + g[0] * d,
519
+ y: h[1] * (1 - d) + g[1] * d
517
520
  };
518
521
  }
519
522
  g = [m, f, y];
520
523
  }
521
- return a && c >= y && (x = { x: o, y: l }), {
524
+ return c && l >= y && (x = { x: o, y: a }), {
522
525
  length: y,
523
526
  point: x,
524
527
  min: {
525
- x: Math.min(...d.map((A) => A.x)),
526
- y: Math.min(...d.map((A) => A.y))
528
+ x: Math.min(...p.map((A) => A.x)),
529
+ y: Math.min(...p.map((A) => A.y))
527
530
  },
528
531
  max: {
529
- x: Math.max(...d.map((A) => A.x)),
530
- y: Math.max(...d.map((A) => A.y))
532
+ x: Math.max(...p.map((A) => A.x)),
533
+ y: Math.max(...p.map((A) => A.y))
531
534
  }
532
535
  };
533
- }, fe = (e, t, n, r, s, i, o) => {
534
- const l = 1 - o;
536
+ }, pe = (e, t, n, r, s, i, o) => {
537
+ const a = 1 - o;
535
538
  return {
536
- x: l ** 2 * e + 2 * l * o * n + o ** 2 * s,
537
- y: l ** 2 * t + 2 * l * o * r + o ** 2 * i
539
+ x: a ** 2 * e + 2 * a * o * n + o ** 2 * s,
540
+ y: a ** 2 * t + 2 * a * o * r + o ** 2 * i
538
541
  };
539
- }, ye = (e, t, n, r, s, i, o) => {
540
- const l = typeof o == "number";
541
- let c = e, a = t, m = 0, f = [c, a, m], y = [c, a], g = 0, h = { x: 0, y: 0 }, u = [{ x: c, y: a }];
542
- l && o <= 0 && (h = { x: c, y: a });
542
+ }, be = (e, t, n, r, s, i, o) => {
543
+ const a = typeof o == "number";
544
+ let l = e, c = t, m = 0, f = [l, c, m], y = [l, c], g = 0, h = { x: 0, y: 0 }, u = [{ x: l, y: c }];
545
+ a && o <= 0 && (h = { x: l, y: c });
543
546
  const x = 300;
544
- for (let d = 0; d <= x; d += 1) {
545
- if (g = d / x, { x: c, y: a } = fe(e, t, n, r, s, i, g), u = [...u, { x: c, y: a }], m += U(y, [c, a]), y = [c, a], l && m > o && o > f[2]) {
546
- const p = (m - o) / (m - f[2]);
547
+ for (let p = 0; p <= x; p += 1) {
548
+ if (g = p / x, { x: l, y: c } = pe(e, t, n, r, s, i, g), u = [...u, { x: l, y: c }], m += V(y, [l, c]), y = [l, c], a && m > o && o > f[2]) {
549
+ const b = (m - o) / (m - f[2]);
547
550
  h = {
548
- x: y[0] * (1 - p) + f[0] * p,
549
- y: y[1] * (1 - p) + f[1] * p
551
+ x: y[0] * (1 - b) + f[0] * b,
552
+ y: y[1] * (1 - b) + f[1] * b
550
553
  };
551
554
  }
552
- f = [c, a, m];
555
+ f = [l, c, m];
553
556
  }
554
- return l && o >= m && (h = { x: s, y: i }), {
557
+ return a && o >= m && (h = { x: s, y: i }), {
555
558
  length: m,
556
559
  point: h,
557
560
  min: {
558
- x: Math.min(...u.map((d) => d.x)),
559
- y: Math.min(...u.map((d) => d.y))
561
+ x: Math.min(...u.map((p) => p.x)),
562
+ y: Math.min(...u.map((p) => p.y))
560
563
  },
561
564
  max: {
562
- x: Math.max(...u.map((d) => d.x)),
563
- y: Math.max(...u.map((d) => d.y))
565
+ x: Math.max(...u.map((p) => p.x)),
566
+ y: Math.max(...u.map((p) => p.y))
564
567
  }
565
568
  };
566
- }, ht = (e, t) => {
567
- const n = O(e), r = typeof t == "number";
568
- let s, i = [], o, l = 0, c = 0, a = 0, m = 0, f, y = [], g = [], h = 0, u = { x: 0, y: 0 }, x = u, d = u, p = u, A = 0;
569
- for (let b = 0, M = n.length; b < M; b += 1)
570
- f = n[b], [o] = f, s = o === "M", i = s ? i : [l, c, ...f.slice(1)], s ? ([, a, m] = f, u = { x: a, y: m }, x = u, h = 0, r && t < 1e-3 && (p = u)) : o === "L" ? { length: h, min: u, max: x, point: d } = dt(
569
+ }, ft = (e, t) => {
570
+ const n = j(e), r = typeof t == "number";
571
+ let s, i = [], o, a = 0, l = 0, c = 0, m = 0, f, y = [], g = [], h = 0, u = { x: 0, y: 0 }, x = u, p = u, b = u, A = 0;
572
+ for (let d = 0, M = n.length; d < M; d += 1)
573
+ f = n[d], [o] = f, s = o === "M", i = s ? i : [a, l, ...f.slice(1)], s ? ([, c, m] = f, u = { x: c, y: m }, x = u, h = 0, r && t < 1e-3 && (b = u)) : o === "L" ? { length: h, min: u, max: x, point: p } = dt(
571
574
  ...i,
572
575
  (t || 0) - A
573
- ) : o === "A" ? { length: h, min: u, max: x, point: d } = me(
576
+ ) : o === "A" ? { length: h, min: u, max: x, point: p } = ye(
574
577
  ...i,
575
578
  (t || 0) - A
576
- ) : o === "C" ? { length: h, min: u, max: x, point: d } = ue(
579
+ ) : o === "C" ? { length: h, min: u, max: x, point: p } = xe(
577
580
  ...i,
578
581
  (t || 0) - A
579
- ) : o === "Q" ? { length: h, min: u, max: x, point: d } = ye(
582
+ ) : o === "Q" ? { length: h, min: u, max: x, point: p } = be(
580
583
  ...i,
581
584
  (t || 0) - A
582
- ) : o === "Z" && (i = [l, c, a, m], { length: h, min: u, max: x, point: d } = dt(
585
+ ) : o === "Z" && (i = [a, l, c, m], { length: h, min: u, max: x, point: p } = dt(
583
586
  ...i,
584
587
  (t || 0) - A
585
- )), r && A < t && A + h >= t && (p = d), g = [...g, x], y = [...y, u], A += h, [l, c] = o !== "Z" ? f.slice(-2) : [a, m];
586
- return r && t >= A && (p = { x: l, y: c }), {
588
+ )), r && A < t && A + h >= t && (b = p), g = [...g, x], y = [...y, u], A += h, [a, l] = o !== "Z" ? f.slice(-2) : [c, m];
589
+ return r && t >= A && (b = { x: a, y: l }), {
587
590
  length: A,
588
- point: p,
591
+ point: b,
589
592
  min: {
590
- x: Math.min(...y.map((b) => b.x)),
591
- y: Math.min(...y.map((b) => b.y))
593
+ x: Math.min(...y.map((d) => d.x)),
594
+ y: Math.min(...y.map((d) => d.y))
592
595
  },
593
596
  max: {
594
- x: Math.max(...g.map((b) => b.x)),
595
- y: Math.max(...g.map((b) => b.y))
597
+ x: Math.max(...g.map((d) => d.x)),
598
+ y: Math.max(...g.map((d) => d.y))
596
599
  }
597
600
  };
598
- }, St = (e) => {
601
+ }, kt = (e) => {
599
602
  if (!e)
600
603
  return {
601
604
  x: 0,
@@ -611,7 +614,7 @@ e.every(([t]) => t === t.toUpperCase()), X = (e) => {
611
614
  const {
612
615
  min: { x: t, y: n },
613
616
  max: { x: r, y: s }
614
- } = ht(e), i = r - t, o = s - n;
617
+ } = ft(e), i = r - t, o = s - n;
615
618
  return {
616
619
  width: i,
617
620
  height: o,
@@ -624,7 +627,7 @@ e.every(([t]) => t === t.toUpperCase()), X = (e) => {
624
627
  // an estimted guess
625
628
  cz: Math.max(i, o) + Math.min(i, o) / 2
626
629
  };
627
- }, pt = (e, t, n) => {
630
+ }, Mt = (e, t, n) => {
628
631
  if (e[n].length > 7) {
629
632
  e[n].shift();
630
633
  const r = e[n];
@@ -633,132 +636,132 @@ e.every(([t]) => t === t.toUpperCase()), X = (e) => {
633
636
  t[n] = "A", e.splice(s += 1, 0, ["C", ...r.splice(0, 6)]);
634
637
  e.splice(n, 1);
635
638
  }
636
- }, Yt = (e) => Nt(e) && e.every(([t]) => "MC".includes(t)), nt = (e, t, n) => {
639
+ }, Ut = (e) => wt(e) && e.every(([t]) => "MC".includes(t)), rt = (e, t, n) => {
637
640
  const r = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
638
641
  return { x: r, y: s };
639
- }, Bt = (e, t, n, r, s, i, o, l, c, a) => {
640
- let m = e, f = t, y = n, g = r, h = l, u = c;
641
- const x = Math.PI * 120 / 180, d = Math.PI / 180 * (+s || 0);
642
- let p = [], A, b, M, v, $;
643
- if (a)
644
- [b, M, v, $] = a;
642
+ }, Kt = (e, t, n, r, s, i, o, a, l, c) => {
643
+ let m = e, f = t, y = n, g = r, h = a, u = l;
644
+ const x = Math.PI * 120 / 180, p = Math.PI / 180 * (+s || 0);
645
+ let b = [], A, d, M, T, z;
646
+ if (c)
647
+ [d, M, T, z] = c;
645
648
  else {
646
- A = nt(m, f, -d), m = A.x, f = A.y, A = nt(h, u, -d), h = A.x, u = A.y;
647
- const P = (m - h) / 2, w = (f - u) / 2;
648
- let z = P * P / (y * y) + w * w / (g * g);
649
- z > 1 && (z = Math.sqrt(z), y *= z, g *= z);
650
- const yt = y * y, gt = g * g, Ct = (i === o ? -1 : 1) * Math.sqrt(Math.abs((yt * gt - yt * w * w - gt * P * P) / (yt * w * w + gt * P * P)));
651
- v = Ct * y * w / g + (m + h) / 2, $ = Ct * -g * P / y + (f + u) / 2, b = Math.asin(((f - $) / g * 10 ** 9 >> 0) / 10 ** 9), M = Math.asin(((u - $) / g * 10 ** 9 >> 0) / 10 ** 9), b = m < v ? Math.PI - b : b, M = h < v ? Math.PI - M : M, b < 0 && (b = Math.PI * 2 + b), M < 0 && (M = Math.PI * 2 + M), o && b > M && (b -= Math.PI * 2), !o && M > b && (M -= Math.PI * 2);
649
+ A = rt(m, f, -p), m = A.x, f = A.y, A = rt(h, u, -p), h = A.x, u = A.y;
650
+ const P = (m - h) / 2, L = (f - u) / 2;
651
+ let E = P * P / (y * y) + L * L / (g * g);
652
+ E > 1 && (E = Math.sqrt(E), y *= E, g *= E);
653
+ const xt = y * y, pt = g * g, Ct = (i === o ? -1 : 1) * Math.sqrt(Math.abs((xt * pt - xt * L * L - pt * P * P) / (xt * L * L + pt * P * P)));
654
+ T = Ct * y * L / g + (m + h) / 2, z = Ct * -g * P / y + (f + u) / 2, d = Math.asin(((f - z) / g * 10 ** 9 >> 0) / 10 ** 9), M = Math.asin(((u - z) / g * 10 ** 9 >> 0) / 10 ** 9), d = m < T ? Math.PI - d : d, M = h < T ? Math.PI - M : M, d < 0 && (d = Math.PI * 2 + d), M < 0 && (M = Math.PI * 2 + M), o && d > M && (d -= Math.PI * 2), !o && M > d && (M -= Math.PI * 2);
652
655
  }
653
- let F = M - b;
654
- if (Math.abs(F) > x) {
655
- const P = M, w = h, z = u;
656
- M = b + x * (o && M > b ? 1 : -1), h = v + y * Math.cos(M), u = $ + g * Math.sin(M), p = Bt(h, u, y, g, s, 0, o, w, z, [M, P, v, $]);
656
+ let Y = M - d;
657
+ if (Math.abs(Y) > x) {
658
+ const P = M, L = h, E = u;
659
+ M = d + x * (o && M > d ? 1 : -1), h = T + y * Math.cos(M), u = z + g * Math.sin(M), b = Kt(h, u, y, g, s, 0, o, L, E, [M, P, T, z]);
657
660
  }
658
- F = M - b;
659
- const E = Math.cos(b), _ = Math.sin(b), S = Math.cos(M), W = Math.sin(M), Q = Math.tan(F / 4), tt = 4 / 3 * y * Q, et = 4 / 3 * g * Q, T = [m, f], L = [m + tt * _, f - et * E], H = [h + tt * W, u - et * S], Y = [h, u];
660
- if (L[0] = 2 * T[0] - L[0], L[1] = 2 * T[1] - L[1], a)
661
- return [...L, ...H, ...Y, ...p];
662
- p = [...L, ...H, ...Y, ...p];
663
- const ft = [];
664
- for (let P = 0, w = p.length; P < w; P += 1)
665
- ft[P] = P % 2 ? nt(p[P - 1], p[P], d).y : nt(p[P], p[P + 1], d).x;
666
- return ft;
667
- }, ge = (e, t, n, r, s, i) => {
668
- const o = 0.3333333333333333, l = 2 / 3;
661
+ Y = M - d;
662
+ const R = Math.cos(d), tt = Math.sin(d), k = Math.cos(M), et = Math.sin(M), B = Math.tan(Y / 4), nt = 4 / 3 * y * B, st = 4 / 3 * g * B, S = [m, f], q = [m + nt * tt, f - st * R], J = [h + nt * et, u - st * k], U = [h, u];
663
+ if (q[0] = 2 * S[0] - q[0], q[1] = 2 * S[1] - q[1], c)
664
+ return [...q, ...J, ...U, ...b];
665
+ b = [...q, ...J, ...U, ...b];
666
+ const gt = [];
667
+ for (let P = 0, L = b.length; P < L; P += 1)
668
+ gt[P] = P % 2 ? rt(b[P - 1], b[P], p).y : rt(b[P], b[P + 1], p).x;
669
+ return gt;
670
+ }, de = (e, t, n, r, s, i) => {
671
+ const o = 0.3333333333333333, a = 2 / 3;
669
672
  return [
670
- o * e + l * n,
673
+ o * e + a * n,
671
674
  // cpx1
672
- o * t + l * r,
675
+ o * t + a * r,
673
676
  // cpy1
674
- o * s + l * n,
677
+ o * s + a * n,
675
678
  // cpx2
676
- o * i + l * r,
679
+ o * i + a * r,
677
680
  // cpy2
678
681
  s,
679
682
  i
680
683
  // x,y
681
684
  ];
682
- }, Tt = (e, t, n, r) => [...V([e, t], [n, r], 0.5), n, r, n, r], rt = (e, t) => {
685
+ }, St = (e, t, n, r) => [...I([e, t], [n, r], 0.5), n, r, n, r], ot = (e, t) => {
683
686
  const [n] = e, r = e.slice(1).map(Number), [s, i] = r;
684
687
  let o;
685
- const { x1: l, y1: c, x: a, y: m } = t;
686
- return "TQ".includes(n) || (t.qx = null, t.qy = null), n === "M" ? (t.x = s, t.y = i, e) : n === "A" ? (o = [l, c, ...r], ["C", ...Bt(...o)]) : n === "Q" ? (t.qx = s, t.qy = i, o = [l, c, ...r], ["C", ...ge(...o)]) : n === "L" ? ["C", ...Tt(l, c, s, i)] : n === "Z" ? ["C", ...Tt(l, c, a, m)] : e;
687
- }, it = (e) => {
688
- if (Yt(e))
688
+ const { x1: a, y1: l, x: c, y: m } = t;
689
+ return "TQ".includes(n) || (t.qx = null, t.qy = null), n === "M" ? (t.x = s, t.y = i, e) : n === "A" ? (o = [a, l, ...r], ["C", ...Kt(...o)]) : n === "Q" ? (t.qx = s, t.qy = i, o = [a, l, ...r], ["C", ...de(...o)]) : n === "L" ? ["C", ...St(a, l, s, i)] : n === "Z" ? ["C", ...St(a, l, c, m)] : e;
690
+ }, ct = (e) => {
691
+ if (Ut(e))
689
692
  return [...e];
690
- const t = O(e), n = { ...mt }, r = [];
693
+ const t = j(e), n = { ...ut }, r = [];
691
694
  let s = "", i = t.length;
692
695
  for (let o = 0; o < i; o += 1) {
693
- [s] = t[o], r[o] = s, t[o] = rt(t[o], n), pt(t, r, o), i = t.length;
694
- const l = t[o], c = l.length;
695
- n.x1 = +l[c - 2], n.y1 = +l[c - 1], n.x2 = +l[c - 4] || n.x1, n.y2 = +l[c - 3] || n.y1;
696
+ [s] = t[o], r[o] = s, t[o] = ot(t[o], n), Mt(t, r, o), i = t.length;
697
+ const a = t[o], l = a.length;
698
+ n.x1 = +a[l - 2], n.y1 = +a[l - 1], n.x2 = +a[l - 4] || n.x1, n.y2 = +a[l - 3] || n.y1;
696
699
  }
697
700
  return t;
698
- }, xe = (e, t, n, r, s, i, o, l) => 3 * ((l - t) * (n + s) - (o - e) * (r + i) + r * (e - s) - n * (t - i) + l * (s + e / 3) - o * (i + t / 3)) / 20, Gt = (e) => {
701
+ }, Me = (e, t, n, r, s, i, o, a) => 3 * ((a - t) * (n + s) - (o - e) * (r + i) + r * (e - s) - n * (t - i) + a * (s + e / 3) - o * (i + t / 3)) / 20, _t = (e) => {
699
702
  let t = 0, n = 0, r = 0;
700
- return it(e).map((s) => {
703
+ return ct(e).map((s) => {
701
704
  switch (s[0]) {
702
705
  case "M":
703
706
  return [, t, n] = s, 0;
704
707
  default:
705
- return r = xe(t, n, ...s.slice(1)), [t, n] = s.slice(-2), r;
708
+ return r = Me(t, n, ...s.slice(1)), [t, n] = s.slice(-2), r;
706
709
  }
707
710
  }).reduce((s, i) => s + i, 0);
708
- }, Z = (e) => ht(e).length, de = (e) => Gt(it(e)) >= 0, J = (e, t) => ht(e, t).point, Pt = (e, t) => {
709
- const n = R(e);
710
- let r = [...n], s = Z(r), i = r.length - 1, o = 0, l = 0, c = n[0];
711
- const [a, m] = c.slice(-2), f = { x: a, y: m };
711
+ }, F = (e) => ft(e).length, Ae = (e) => _t(ct(e)) >= 0, W = (e, t) => ft(e, t).point, Pt = (e, t) => {
712
+ const n = Q(e);
713
+ let r = [...n], s = F(r), i = r.length - 1, o = 0, a = 0, l = n[0];
714
+ const [c, m] = l.slice(-2), f = { x: c, y: m };
712
715
  if (i <= 0 || !t || !Number.isFinite(t))
713
716
  return {
714
- segment: c,
717
+ segment: l,
715
718
  index: 0,
716
- length: l,
719
+ length: a,
717
720
  point: f,
718
721
  lengthAtSegment: o
719
722
  };
720
723
  if (t >= s)
721
- return r = n.slice(0, -1), o = Z(r), l = s - o, {
724
+ return r = n.slice(0, -1), o = F(r), a = s - o, {
722
725
  segment: n[i],
723
726
  index: i,
724
- length: l,
727
+ length: a,
725
728
  lengthAtSegment: o
726
729
  };
727
730
  const y = [];
728
731
  for (; i > 0; )
729
- c = r[i], r = r.slice(0, -1), o = Z(r), l = s - o, s = o, y.push({
730
- segment: c,
732
+ l = r[i], r = r.slice(0, -1), o = F(r), a = s - o, s = o, y.push({
733
+ segment: l,
731
734
  index: i,
732
- length: l,
735
+ length: a,
733
736
  lengthAtSegment: o
734
737
  }), i -= 1;
735
738
  return y.find(({ lengthAtSegment: g }) => g <= t);
736
- }, ut = (e, t) => {
737
- const n = R(e), r = O(n), s = Z(n), i = (b) => {
738
- const M = b.x - t.x, v = b.y - t.y;
739
- return M * M + v * v;
739
+ }, yt = (e, t) => {
740
+ const n = Q(e), r = j(n), s = F(n), i = (d) => {
741
+ const M = d.x - t.x, T = d.y - t.y;
742
+ return M * M + T * T;
740
743
  };
741
- let o = 8, l, c = { x: 0, y: 0 }, a = 0, m = 0, f = 1 / 0;
742
- for (let b = 0; b <= s; b += o)
743
- l = J(r, b), a = i(l), a < f && (c = l, m = b, f = a);
744
+ let o = 8, a, l = { x: 0, y: 0 }, c = 0, m = 0, f = 1 / 0;
745
+ for (let d = 0; d <= s; d += o)
746
+ a = W(r, d), c = i(a), c < f && (l = a, m = d, f = c);
744
747
  o /= 2;
745
- let y, g, h = 0, u = 0, x = 0, d = 0;
748
+ let y, g, h = 0, u = 0, x = 0, p = 0;
746
749
  for (; o > 0.5; )
747
- h = m - o, y = J(r, h), x = i(y), u = m + o, g = J(r, u), d = i(g), h >= 0 && x < f ? (c = y, m = h, f = x) : u <= s && d < f ? (c = g, m = u, f = d) : o /= 2;
748
- const p = Pt(n, m), A = Math.sqrt(f);
749
- return { closest: c, distance: A, segment: p };
750
- }, pe = (e, t) => ut(e, t).closest, be = (e, t) => ut(e, t).segment, Me = (e, t) => Pt(e, t).segment, Ae = (e, t) => {
751
- const { distance: n } = ut(e, t);
750
+ h = m - o, y = W(r, h), x = i(y), u = m + o, g = W(r, u), p = i(g), h >= 0 && x < f ? (l = y, m = h, f = x) : u <= s && p < f ? (l = g, m = u, f = p) : o /= 2;
751
+ const b = Pt(n, m), A = Math.sqrt(f);
752
+ return { closest: l, distance: A, segment: b };
753
+ }, Ne = (e, t) => yt(e, t).closest, ve = (e, t) => yt(e, t).segment, we = (e, t) => Pt(e, t).segment, Pe = (e, t) => {
754
+ const { distance: n } = yt(e, t);
752
755
  return Math.abs(n) < 1e-3;
753
- }, Jt = (e) => {
756
+ }, Wt = (e) => {
754
757
  if (typeof e != "string")
755
758
  return !1;
756
- const t = new zt(e);
757
- for (G(t); t.index < t.max && !t.err.length; )
758
- Ot(t);
759
+ const t = new Et(e);
760
+ for (_(t); t.index < t.max && !t.err.length; )
761
+ jt(t);
759
762
  return !t.err.length && "mM".includes(t.segments[0][0]);
760
- }, Ut = (e) => ct(e) && // `isPathArray` checks if it's `Array`
761
- e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
763
+ }, Vt = (e) => mt(e) && // `isPathArray` checks if it's `Array`
764
+ e.slice(1).every(([t]) => t === t.toLowerCase()), lt = (e, t) => {
762
765
  let { round: n } = at;
763
766
  if (t === "off" || n === "off")
764
767
  return [...e];
@@ -768,7 +771,7 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
768
771
  const i = s.slice(1).map(Number).map((o) => n ? Math.round(o * r) / r : Math.round(o));
769
772
  return [s[0], ...i];
770
773
  });
771
- }, j = (e, t) => ot(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), Lt = {
774
+ }, Z = (e, t) => lt(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), qt = {
772
775
  line: ["x1", "y1", "x2", "y2"],
773
776
  circle: ["cx", "cy", "r"],
774
777
  ellipse: ["cx", "cy", "rx", "ry"],
@@ -776,33 +779,33 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
776
779
  polygon: ["points"],
777
780
  polyline: ["points"],
778
781
  glyph: ["d"]
779
- }, Ne = (e) => {
782
+ }, Ce = (e) => {
780
783
  const { x1: t, y1: n, x2: r, y2: s } = e;
781
784
  return [
782
785
  ["M", t, n],
783
786
  ["L", r, s]
784
787
  ];
785
- }, Pe = (e) => {
788
+ }, Te = (e) => {
786
789
  const t = [], n = (e.points || "").trim().split(/[\s|,]/).map(Number);
787
790
  let r = 0;
788
791
  for (; r < n.length; )
789
792
  t.push([r ? "L" : "M", n[r], n[r + 1]]), r += 2;
790
793
  return e.type === "polygon" ? [...t, ["z"]] : t;
791
- }, Ce = (e) => {
794
+ }, Le = (e) => {
792
795
  const { cx: t, cy: n, r } = e;
793
796
  return [
794
797
  ["M", t - r, n],
795
798
  ["a", r, r, 0, 1, 0, 2 * r, 0],
796
799
  ["a", r, r, 0, 1, 0, -2 * r, 0]
797
800
  ];
798
- }, ve = (e) => {
801
+ }, ke = (e) => {
799
802
  const { cx: t, cy: n, rx: r, ry: s } = e;
800
803
  return [
801
804
  ["M", t - r, n],
802
805
  ["a", r, s, 0, 1, 0, 2 * r, 0],
803
806
  ["a", r, s, 0, 1, 0, -2 * r, 0]
804
807
  ];
805
- }, we = (e) => {
808
+ }, Se = (e) => {
806
809
  const t = +e.x || 0, n = +e.y || 0, r = +e.width, s = +e.height;
807
810
  let i = +e.rx, o = +e.ry;
808
811
  return i || o ? (i = i || o, o = o || i, i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > s && (o -= (o * 2 - s) / 2), [
@@ -816,113 +819,113 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
816
819
  ["v", -s + o * 2],
817
820
  ["s", 0, -o, i, -o]
818
821
  ]) : [["M", t, n], ["h", r], ["v", s], ["H", t], ["Z"]];
819
- }, Se = (e, t, n) => {
822
+ }, qe = (e, t, n) => {
820
823
  const r = n || document, s = r.defaultView || /* istanbul ignore next */
821
- window, i = Object.keys(Lt), o = e instanceof s.SVGElement, l = o ? e.tagName : null;
822
- if (l && i.every((h) => l !== h))
823
- throw TypeError(`${q}: "${l}" is not SVGElement`);
824
- const c = r.createElementNS("http://www.w3.org/2000/svg", "path"), a = o ? l : e.type, m = Lt[a], f = { type: a };
824
+ window, i = Object.keys(qt), o = e instanceof s.SVGElement, a = o ? e.tagName : null;
825
+ if (a && i.every((h) => a !== h))
826
+ throw TypeError(`${O}: "${a}" is not SVGElement`);
827
+ const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), c = o ? a : e.type, m = qt[c], f = { type: c };
825
828
  o ? (m.forEach((h) => {
826
829
  m.includes(h) && (f[h] = e.getAttribute(h));
827
830
  }), Object.values(e.attributes).forEach(({ name: h, value: u }) => {
828
- m.includes(h) || c.setAttribute(h, u);
831
+ m.includes(h) || l.setAttribute(h, u);
829
832
  })) : (Object.assign(f, e), Object.keys(f).forEach((h) => {
830
- !m.includes(h) && h !== "type" && c.setAttribute(
833
+ !m.includes(h) && h !== "type" && l.setAttribute(
831
834
  h.replace(/[A-Z]/g, (u) => `-${u.toLowerCase()}`),
832
835
  f[h]
833
836
  );
834
837
  }));
835
838
  let y = "";
836
839
  const g = at.round;
837
- return a === "circle" ? y = j(Ce(f), g) : a === "ellipse" ? y = j(ve(f), g) : ["polyline", "polygon"].includes(a) ? y = j(Pe(f), g) : a === "rect" ? y = j(we(f), g) : a === "line" ? y = j(Ne(f), g) : a === "glyph" && (y = o ? e.getAttribute("d") : e.d), Jt(y) ? (c.setAttribute("d", y), t && o && (e.before(c, e), e.remove()), c) : !1;
838
- }, kt = (e) => {
840
+ return c === "circle" ? y = Z(Le(f), g) : c === "ellipse" ? y = Z(ke(f), g) : ["polyline", "polygon"].includes(c) ? y = Z(Te(f), g) : c === "rect" ? y = Z(Se(f), g) : c === "line" ? y = Z(Ce(f), g) : c === "glyph" && (y = o ? e.getAttribute("d") : e.d), Wt(y) ? (l.setAttribute("d", y), t && o && (e.before(l, e), e.remove()), l) : !1;
841
+ }, $t = (e) => {
839
842
  const t = [];
840
843
  let n, r = -1;
841
844
  return e.forEach((s) => {
842
845
  s[0] === "M" ? (n = [s], r += 1) : n = [...n, s], t[r] = n;
843
846
  }), t;
844
- }, bt = (e) => {
845
- if (Ut(e))
847
+ }, At = (e) => {
848
+ if (Vt(e))
846
849
  return [...e];
847
- const t = R(e);
850
+ const t = Q(e);
848
851
  let n = 0, r = 0, s = 0, i = 0;
849
852
  return t.map((o) => {
850
- const l = o.slice(1).map(Number), [c] = o, a = c.toLowerCase();
851
- if (c === "M")
852
- return [n, r] = l, s = n, i = r, ["M", n, r];
853
+ const a = o.slice(1).map(Number), [l] = o, c = l.toLowerCase();
854
+ if (l === "M")
855
+ return [n, r] = a, s = n, i = r, ["M", n, r];
853
856
  let m = [];
854
- if (c !== a)
855
- if (a === "a")
857
+ if (l !== c)
858
+ if (c === "a")
856
859
  m = [
857
- a,
858
- l[0],
859
- l[1],
860
- l[2],
861
- l[3],
862
- l[4],
863
- l[5] - n,
864
- l[6] - r
860
+ c,
861
+ a[0],
862
+ a[1],
863
+ a[2],
864
+ a[3],
865
+ a[4],
866
+ a[5] - n,
867
+ a[6] - r
865
868
  ];
866
- else if (a === "v")
867
- m = [a, l[0] - r];
868
- else if (a === "h")
869
- m = [a, l[0] - n];
869
+ else if (c === "v")
870
+ m = [c, a[0] - r];
871
+ else if (c === "h")
872
+ m = [c, a[0] - n];
870
873
  else {
871
- const y = l.map((g, h) => g - (h % 2 ? r : n));
872
- m = [a, ...y];
874
+ const y = a.map((g, h) => g - (h % 2 ? r : n));
875
+ m = [c, ...y];
873
876
  }
874
877
  else
875
- c === "m" && (s = l[0] + n, i = l[1] + r), m = [a, ...l];
878
+ l === "m" && (s = a[0] + n, i = a[1] + r), m = [c, ...a];
876
879
  const f = m.length;
877
- return a === "z" ? (n = s, r = i) : a === "h" ? n += m[1] : a === "v" ? r += m[1] : (n += m[f - 2], r += m[f - 1]), m;
880
+ return c === "z" ? (n = s, r = i) : c === "h" ? n += m[1] : c === "v" ? r += m[1] : (n += m[f - 2], r += m[f - 1]), m;
878
881
  });
879
- }, Te = (e, t, n, r) => {
880
- const [s] = e, i = (d) => Math.round(d * 10 ** 4) / 10 ** 4, o = e.slice(1).map((d) => +d), l = t.slice(1).map((d) => +d), { x1: c, y1: a, x2: m, y2: f, x: y, y: g } = n;
882
+ }, $e = (e, t, n, r) => {
883
+ const [s] = e, i = (p) => Math.round(p * 10 ** 4) / 10 ** 4, o = e.slice(1).map((p) => +p), a = t.slice(1).map((p) => +p), { x1: l, y1: c, x2: m, y2: f, x: y, y: g } = n;
881
884
  let h = e;
882
- const [u, x] = l.slice(-2);
885
+ const [u, x] = a.slice(-2);
883
886
  if ("TQ".includes(s) || (n.qx = null, n.qy = null), ["V", "H", "S", "T", "Z"].includes(s))
884
887
  h = [s, ...o];
885
888
  else if (s === "L")
886
889
  i(y) === i(u) ? h = ["V", x] : i(g) === i(x) && (h = ["H", u]);
887
890
  else if (s === "C") {
888
- const [d, p] = l;
889
- "CS".includes(r) && (i(d) === i(c * 2 - m) && i(p) === i(a * 2 - f) || i(c) === i(m * 2 - y) && i(a) === i(f * 2 - g)) && (h = ["S", ...l.slice(-4)]), n.x1 = d, n.y1 = p;
891
+ const [p, b] = a;
892
+ "CS".includes(r) && (i(p) === i(l * 2 - m) && i(b) === i(c * 2 - f) || i(l) === i(m * 2 - y) && i(c) === i(f * 2 - g)) && (h = ["S", ...a.slice(-4)]), n.x1 = p, n.y1 = b;
890
893
  } else if (s === "Q") {
891
- const [d, p] = l;
892
- n.qx = d, n.qy = p, "QT".includes(r) && (i(d) === i(c * 2 - m) && i(p) === i(a * 2 - f) || i(c) === i(m * 2 - y) && i(a) === i(f * 2 - g)) && (h = ["T", ...l.slice(-2)]);
894
+ const [p, b] = a;
895
+ n.qx = p, n.qy = b, "QT".includes(r) && (i(p) === i(l * 2 - m) && i(b) === i(c * 2 - f) || i(l) === i(m * 2 - y) && i(c) === i(f * 2 - g)) && (h = ["T", ...a.slice(-2)]);
893
896
  }
894
897
  return h;
895
- }, qt = (e, t) => {
896
- const n = X(e), r = O(n), s = { ...mt }, i = [], o = n.length;
897
- let l = "", c = "", a = 0, m = 0, f = 0, y = 0;
898
+ }, Ot = (e, t) => {
899
+ const n = H(e), r = j(n), s = { ...ut }, i = [], o = n.length;
900
+ let a = "", l = "", c = 0, m = 0, f = 0, y = 0;
898
901
  for (let u = 0; u < o; u += 1) {
899
- [l] = n[u], i[u] = l, u && (c = i[u - 1]), n[u] = Te(n[u], r[u], s, c);
900
- const x = n[u], d = x.length;
901
- switch (s.x1 = +x[d - 2], s.y1 = +x[d - 1], s.x2 = +x[d - 4] || s.x1, s.y2 = +x[d - 3] || s.y1, l) {
902
+ [a] = n[u], i[u] = a, u && (l = i[u - 1]), n[u] = $e(n[u], r[u], s, l);
903
+ const x = n[u], p = x.length;
904
+ switch (s.x1 = +x[p - 2], s.y1 = +x[p - 1], s.x2 = +x[p - 4] || s.x1, s.y2 = +x[p - 3] || s.y1, a) {
902
905
  case "Z":
903
- a = f, m = y;
906
+ c = f, m = y;
904
907
  break;
905
908
  case "H":
906
- [, a] = x;
909
+ [, c] = x;
907
910
  break;
908
911
  case "V":
909
912
  [, m] = x;
910
913
  break;
911
914
  default:
912
- [a, m] = x.slice(-2).map(Number), l === "M" && (f = a, y = m);
915
+ [c, m] = x.slice(-2).map(Number), a === "M" && (f = c, y = m);
913
916
  }
914
- s.x = a, s.y = m;
917
+ s.x = c, s.y = m;
915
918
  }
916
- const g = ot(n, t), h = ot(bt(n), t);
919
+ const g = lt(n, t), h = lt(At(n), t);
917
920
  return g.map((u, x) => x ? u.join("").length < h[x].join("").length ? u : h[x] : u);
918
- }, Le = (e) => {
921
+ }, Oe = (e) => {
919
922
  const t = e.slice(1).map(
920
923
  (n, r, s) => r ? [...s[r - 1].slice(-2), ...n.slice(1)] : [...e[0].slice(1), ...n.slice(1)]
921
924
  ).map((n) => n.map((r, s) => n[n.length - s - 2 * (1 - s % 2)])).reverse();
922
925
  return [["M", ...t[0].slice(0, 2)], ...t.map((n) => ["C", ...n.slice(2)])];
923
- }, st = (e) => {
924
- const t = X(e), n = t.slice(-1)[0][0] === "Z", r = O(t).map((s, i) => {
925
- const [o, l] = s.slice(-2).map(Number);
926
+ }, it = (e) => {
927
+ const t = H(e), n = t.slice(-1)[0][0] === "Z", r = j(t).map((s, i) => {
928
+ const [o, a] = s.slice(-2).map(Number);
926
929
  return {
927
930
  seg: t[i],
928
931
  // absolute
@@ -932,30 +935,30 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
932
935
  // pathCommand
933
936
  x: o,
934
937
  // x
935
- y: l
938
+ y: a
936
939
  // y
937
940
  };
938
941
  }).map((s, i, o) => {
939
- const l = s.seg, c = s.n, a = i && o[i - 1], m = o[i + 1], f = s.c, y = o.length, g = i ? o[i - 1].x : o[y - 1].x, h = i ? o[i - 1].y : o[y - 1].y;
942
+ const a = s.seg, l = s.n, c = i && o[i - 1], m = o[i + 1], f = s.c, y = o.length, g = i ? o[i - 1].x : o[y - 1].x, h = i ? o[i - 1].y : o[y - 1].y;
940
943
  let u = [];
941
944
  switch (f) {
942
945
  case "M":
943
946
  u = n ? ["Z"] : [f, g, h];
944
947
  break;
945
948
  case "A":
946
- u = [f, ...l.slice(1, -3), l[5] === 1 ? 0 : 1, g, h];
949
+ u = [f, ...a.slice(1, -3), a[5] === 1 ? 0 : 1, g, h];
947
950
  break;
948
951
  case "C":
949
- m && m.c === "S" ? u = ["S", l[1], l[2], g, h] : u = [f, l[3], l[4], l[1], l[2], g, h];
952
+ m && m.c === "S" ? u = ["S", a[1], a[2], g, h] : u = [f, a[3], a[4], a[1], a[2], g, h];
950
953
  break;
951
954
  case "S":
952
- a && "CS".includes(a.c) && (!m || m.c !== "S") ? u = ["C", c[3], c[4], c[1], c[2], g, h] : u = [f, c[1], c[2], g, h];
955
+ c && "CS".includes(c.c) && (!m || m.c !== "S") ? u = ["C", l[3], l[4], l[1], l[2], g, h] : u = [f, l[1], l[2], g, h];
953
956
  break;
954
957
  case "Q":
955
- m && m.c === "T" ? u = ["T", g, h] : u = [f, ...l.slice(1, -2), g, h];
958
+ m && m.c === "T" ? u = ["T", g, h] : u = [f, ...a.slice(1, -2), g, h];
956
959
  break;
957
960
  case "T":
958
- a && "QT".includes(a.c) && (!m || m.c !== "T") ? u = ["Q", c[1], c[2], g, h] : u = [f, g, h];
961
+ c && "QT".includes(c.c) && (!m || m.c !== "T") ? u = ["Q", l[1], l[2], g, h] : u = [f, g, h];
959
962
  break;
960
963
  case "Z":
961
964
  u = ["M", g, h];
@@ -967,41 +970,41 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
967
970
  u = [f, h];
968
971
  break;
969
972
  default:
970
- u = [f, ...l.slice(1, -2), g, h];
973
+ u = [f, ...a.slice(1, -2), g, h];
971
974
  }
972
975
  return u;
973
976
  });
974
977
  return n ? r.reverse() : [r[0], ...r.slice(1).reverse()];
975
- }, ke = (e) => {
976
- let t = new Mt();
977
- const { origin: n } = e, [r, s] = n, { translate: i } = e, { rotate: o } = e, { skew: l } = e, { scale: c } = e;
978
- 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, s), 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((a) => !Number.isNaN(+a)) && 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((a) => !Number.isNaN(+a)) && c.some((a) => a !== 1) ? t = t.scale(...c) : typeof c == "number" && !Number.isNaN(c) && (t = t.scale(c)), t = t.translate(-r, -s)), t;
979
- }, qe = (e, t) => {
980
- let n = Mt.Translate(...t.slice(0, -1));
978
+ }, ze = (e) => {
979
+ let t = new Nt();
980
+ const { origin: n } = e, [r, s] = n, { translate: i } = e, { rotate: o } = e, { skew: a } = e, { scale: l } = e;
981
+ return Array.isArray(i) && i.length >= 2 && i.every((c) => !Number.isNaN(+c)) && i.some((c) => c !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || a || l) && (t = t.translate(r, s), Array.isArray(o) && o.length >= 2 && o.every((c) => !Number.isNaN(+c)) && o.some((c) => c !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(a) && a.length === 2 && a.every((c) => !Number.isNaN(+c)) && a.some((c) => c !== 0) ? (t = a[0] ? t.skewX(a[0]) : t, t = a[1] ? t.skewY(a[1]) : t) : typeof a == "number" && !Number.isNaN(a) && (t = t.skewX(a)), Array.isArray(l) && l.length >= 2 && l.every((c) => !Number.isNaN(+c)) && l.some((c) => c !== 1) ? t = t.scale(...l) : typeof l == "number" && !Number.isNaN(l) && (t = t.scale(l)), t = t.translate(-r, -s)), t;
982
+ }, Ie = (e, t) => {
983
+ let n = Nt.Translate(...t.slice(0, -1));
981
984
  return [, , , n.m44] = t, n = e.multiply(n), [n.m41, n.m42, n.m43, n.m44];
982
- }, $t = (e, t, n) => {
983
- const [r, s, i] = n, [o, l, c] = qe(e, [...t, 0, 1]), a = o - r, m = l - s, f = c - i;
985
+ }, zt = (e, t, n) => {
986
+ const [r, s, i] = n, [o, a, l] = Ie(e, [...t, 0, 1]), c = o - r, m = a - s, f = l - i;
984
987
  return [
985
988
  // protect against division by ZERO
986
- a * (Math.abs(i) / Math.abs(f) || 1) + r,
989
+ c * (Math.abs(i) / Math.abs(f) || 1) + r,
987
990
  m * (Math.abs(i) / Math.abs(f) || 1) + s
988
991
  ];
989
- }, Vt = (e, t) => {
990
- let n = 0, r = 0, s, i, o, l, c, a;
991
- const m = X(e), f = t && Object.keys(t);
992
+ }, It = (e, t) => {
993
+ let n = 0, r = 0, s, i, o, a, l, c;
994
+ const m = H(e), f = t && Object.keys(t);
992
995
  if (!t || f && !f.length)
993
996
  return [...m];
994
- const y = O(m);
997
+ const y = j(m);
995
998
  if (!t.origin) {
996
999
  const { origin: M } = at;
997
1000
  Object.assign(t, { origin: M });
998
1001
  }
999
- const g = ke(t), { origin: h } = t, u = { ...mt };
1000
- let x = [], d = 0, p = "", A = [];
1001
- const b = [];
1002
+ const g = ze(t), { origin: h } = t, u = { ...ut };
1003
+ let x = [], p = 0, b = "", A = [];
1004
+ const d = [];
1002
1005
  if (!g.isIdentity) {
1003
1006
  for (s = 0, o = m.length; s < o; s += 1) {
1004
- x = m[s], m[s] && ([p] = x), b[s] = p, p === "A" && (x = rt(y[s], u), m[s] = rt(y[s], u), pt(m, b, s), y[s] = rt(y[s], u), pt(y, b, s), o = Math.max(m.length, y.length)), x = y[s], d = x.length, u.x1 = +x[d - 2], u.y1 = +x[d - 1], u.x2 = +x[d - 4] || u.x1, u.y2 = +x[d - 3] || u.y1;
1007
+ x = m[s], m[s] && ([b] = x), d[s] = b, b === "A" && (x = ot(y[s], u), m[s] = ot(y[s], u), Mt(m, d, s), y[s] = ot(y[s], u), Mt(y, d, s), o = Math.max(m.length, y.length)), x = y[s], p = x.length, u.x1 = +x[p - 2], u.y1 = +x[p - 1], u.x2 = +x[p - 4] || u.x1, u.y2 = +x[p - 3] || u.y1;
1005
1008
  const M = {
1006
1009
  s: m[s],
1007
1010
  c: m[s][0],
@@ -1011,58 +1014,22 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ot = (e, t) => {
1011
1014
  A = [...A, M];
1012
1015
  }
1013
1016
  return A.map((M) => {
1014
- if (p = M.c, x = M.s, p === "L" || p === "H" || p === "V")
1015
- return [c, a] = $t(g, [M.x, M.y], h), n !== c && r !== a ? x = ["L", c, a] : r === a ? x = ["H", c] : n === c && (x = ["V", a]), n = c, r = a, x;
1016
- for (i = 1, l = x.length; i < l; i += 2)
1017
- [n, r] = $t(g, [+x[i], +x[i + 1]], h), x[i] = n, x[i + 1] = r;
1017
+ if (b = M.c, x = M.s, b === "L" || b === "H" || b === "V")
1018
+ return [l, c] = zt(g, [M.x, M.y], h), n !== l && r !== c ? x = ["L", l, c] : r === c ? x = ["H", l] : n === l && (x = ["V", c]), n = l, r = c, x;
1019
+ for (i = 1, a = x.length; i < a; i += 2)
1020
+ [n, r] = zt(g, [+x[i], +x[i + 1]], h), x[i] = n, x[i + 1] = r;
1018
1021
  return x;
1019
1022
  });
1020
1023
  }
1021
1024
  return [...m];
1022
- }, $e = (e) => {
1023
- const n = e.slice(0, 2), r = e.slice(2, 4), s = e.slice(4, 6), i = e.slice(6, 8), o = V(n, r, 0.5), l = V(r, s, 0.5), c = V(s, i, 0.5), a = V(o, l, 0.5), m = V(l, c, 0.5), f = V(a, m, 0.5);
1025
+ }, je = (e) => {
1026
+ const n = e.slice(0, 2), r = e.slice(2, 4), s = e.slice(4, 6), i = e.slice(6, 8), o = I(n, r, 0.5), a = I(r, s, 0.5), l = I(s, i, 0.5), c = I(o, a, 0.5), m = I(a, l, 0.5), f = I(c, m, 0.5);
1024
1027
  return [
1025
- ["C", ...o, ...a, ...f],
1026
- ["C", ...m, ...c, ...i]
1028
+ ["C", ...o, ...c, ...f],
1029
+ ["C", ...m, ...l, ...i]
1027
1030
  ];
1028
1031
  };
1029
- class Ve {
1030
- // bring main utilities to front
1031
- static CSSMatrix = Mt;
1032
- static getPathBBox = St;
1033
- static getPathArea = Gt;
1034
- static getTotalLength = Z;
1035
- static getDrawDirection = de;
1036
- static getPointAtLength = J;
1037
- static pathLengthFactory = ht;
1038
- static getPropertiesAtLength = Pt;
1039
- static getPropertiesAtPoint = ut;
1040
- static polygonLength = re;
1041
- static polygonArea = se;
1042
- static getClosestPoint = pe;
1043
- static getSegmentOfPoint = be;
1044
- static getSegmentAtLength = Me;
1045
- static isPointInStroke = Ae;
1046
- static isValidPath = Jt;
1047
- static isPathArray = ct;
1048
- static isAbsoluteArray = At;
1049
- static isRelativeArray = Ut;
1050
- static isCurveArray = Yt;
1051
- static isNormalizedArray = Nt;
1052
- static shapeToPath = Se;
1053
- static parsePathString = R;
1054
- static roundPath = ot;
1055
- static splitPath = kt;
1056
- static splitCubic = $e;
1057
- static optimizePath = qt;
1058
- static reverseCurve = Le;
1059
- static reversePath = st;
1060
- static normalizePath = O;
1061
- static transformPath = Vt;
1062
- static pathToAbsolute = X;
1063
- static pathToRelative = bt;
1064
- static pathToCurve = it;
1065
- static pathToString = j;
1032
+ class v {
1066
1033
  /**
1067
1034
  * @constructor
1068
1035
  * @param {string} pathValue the path string
@@ -1071,26 +1038,26 @@ class Ve {
1071
1038
  constructor(t, n) {
1072
1039
  const r = n || {}, s = typeof t > "u";
1073
1040
  if (s || !t.length)
1074
- throw TypeError(`${q}: "pathValue" is ${s ? "undefined" : "empty"}`);
1075
- const i = R(t);
1041
+ throw TypeError(`${O}: "pathValue" is ${s ? "undefined" : "empty"}`);
1042
+ const i = Q(t);
1076
1043
  this.segments = i;
1077
- const { width: o, height: l, cx: c, cy: a, cz: m } = this.getBBox(), { round: f, origin: y } = r;
1044
+ const { width: o, height: a, cx: l, cy: c, cz: m } = this.getBBox(), { round: f, origin: y } = r;
1078
1045
  let g;
1079
1046
  if (f === "auto") {
1080
- const u = `${Math.floor(Math.max(o, l))}`.length;
1047
+ const u = `${Math.floor(Math.max(o, a))}`.length;
1081
1048
  g = u >= 4 ? 0 : 4 - u;
1082
1049
  } else
1083
1050
  Number.isInteger(f) || f === "off" ? g = f : g = at.round;
1084
1051
  let h;
1085
1052
  if (Array.isArray(y) && y.length >= 2) {
1086
- const [u, x, d] = y.map(Number);
1053
+ const [u, x, p] = y.map(Number);
1087
1054
  h = [
1088
- Number.isNaN(u) ? c : u,
1089
- Number.isNaN(x) ? a : x,
1090
- Number.isNaN(d) ? m : d
1055
+ Number.isNaN(u) ? l : u,
1056
+ Number.isNaN(x) ? c : x,
1057
+ Number.isNaN(p) ? m : p
1091
1058
  ];
1092
1059
  } else
1093
- h = [c, a, m];
1060
+ h = [l, c, m];
1094
1061
  return this.round = g, this.origin = h, this;
1095
1062
  }
1096
1063
  /**
@@ -1100,7 +1067,7 @@ class Ve {
1100
1067
  * @returns the pathBBox
1101
1068
  */
1102
1069
  getBBox() {
1103
- return St(this.segments);
1070
+ return kt(this.segments);
1104
1071
  }
1105
1072
  /**
1106
1073
  * Returns the total path length, equivalent to native `path.getTotalLength()`.
@@ -1109,7 +1076,7 @@ class Ve {
1109
1076
  * @returns the path total length
1110
1077
  */
1111
1078
  getTotalLength() {
1112
- return Z(this.segments);
1079
+ return F(this.segments);
1113
1080
  }
1114
1081
  /**
1115
1082
  * Returns an `{x,y}` point in the path stroke at a given length,
@@ -1120,7 +1087,7 @@ class Ve {
1120
1087
  * @returns the requested point
1121
1088
  */
1122
1089
  getPointAtLength(t) {
1123
- return J(this.segments, t);
1090
+ return W(this.segments, t);
1124
1091
  }
1125
1092
  /**
1126
1093
  * Convert path to absolute values
@@ -1129,7 +1096,7 @@ class Ve {
1129
1096
  */
1130
1097
  toAbsolute() {
1131
1098
  const { segments: t } = this;
1132
- return this.segments = X(t), this;
1099
+ return this.segments = H(t), this;
1133
1100
  }
1134
1101
  /**
1135
1102
  * Convert path to relative values
@@ -1138,7 +1105,7 @@ class Ve {
1138
1105
  */
1139
1106
  toRelative() {
1140
1107
  const { segments: t } = this;
1141
- return this.segments = bt(t), this;
1108
+ return this.segments = At(t), this;
1142
1109
  }
1143
1110
  /**
1144
1111
  * Convert path to cubic-bezier values. In addition, un-necessary `Z`
@@ -1148,7 +1115,7 @@ class Ve {
1148
1115
  */
1149
1116
  toCurve() {
1150
1117
  const { segments: t } = this;
1151
- return this.segments = it(t), this;
1118
+ return this.segments = ct(t), this;
1152
1119
  }
1153
1120
  /**
1154
1121
  * Reverse the order of the segments and their values.
@@ -1158,9 +1125,9 @@ class Ve {
1158
1125
  */
1159
1126
  reverse(t) {
1160
1127
  this.toAbsolute();
1161
- const { segments: n } = this, r = kt(n), s = r.length > 1 ? r : !1, i = s ? [...s].map((l, c) => t ? c ? st(l) : [...l] : st(l)) : [...n];
1128
+ const { segments: n } = this, r = $t(n), s = r.length > 1 ? r : !1, i = s ? [...s].map((a, l) => t ? l ? it(a) : [...a] : it(a)) : [...n];
1162
1129
  let o = [];
1163
- return s ? o = i.flat(1) : o = t ? n : st(n), this.segments = [...o], this;
1130
+ return s ? o = i.flat(1) : o = t ? n : it(n), this.segments = [...o], this;
1164
1131
  }
1165
1132
  /**
1166
1133
  * Normalize path in 2 steps:
@@ -1171,7 +1138,7 @@ class Ve {
1171
1138
  */
1172
1139
  normalize() {
1173
1140
  const { segments: t } = this;
1174
- return this.segments = O(t), this;
1141
+ return this.segments = j(t), this;
1175
1142
  }
1176
1143
  /**
1177
1144
  * Optimize `pathArray` values:
@@ -1183,7 +1150,7 @@ class Ve {
1183
1150
  */
1184
1151
  optimize() {
1185
1152
  const { segments: t } = this;
1186
- return this.segments = qt(t, this.round), this;
1153
+ return this.segments = Ot(t, this.round), this;
1187
1154
  }
1188
1155
  /**
1189
1156
  * Transform path using values from an `Object` defined as `transformObject`.
@@ -1194,21 +1161,21 @@ class Ve {
1194
1161
  * @public
1195
1162
  */
1196
1163
  transform(t) {
1197
- if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((c) => c in t))
1164
+ if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((l) => l in t))
1198
1165
  return this;
1199
1166
  const {
1200
1167
  segments: n,
1201
1168
  origin: [r, s, i]
1202
1169
  } = this, o = {};
1203
- for (const [c, a] of Object.entries(t))
1204
- 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));
1205
- const { origin: l } = o;
1206
- if (Array.isArray(l) && l.length >= 2) {
1207
- const [c, a, m] = l.map(Number);
1208
- o.origin = [Number.isNaN(c) ? r : c, Number.isNaN(a) ? s : a, m || i];
1170
+ for (const [l, c] of Object.entries(t))
1171
+ l === "skew" && Array.isArray(c) || (l === "rotate" || l === "translate" || l === "origin" || l === "scale") && Array.isArray(c) ? o[l] = c.map(Number) : l !== "origin" && typeof Number(c) == "number" && (o[l] = Number(c));
1172
+ const { origin: a } = o;
1173
+ if (Array.isArray(a) && a.length >= 2) {
1174
+ const [l, c, m] = a.map(Number);
1175
+ o.origin = [Number.isNaN(l) ? r : l, Number.isNaN(c) ? s : c, m || i];
1209
1176
  } else
1210
1177
  o.origin = [r, s, i];
1211
- return this.segments = Vt(n, o), this;
1178
+ return this.segments = It(n, o), this;
1212
1179
  }
1213
1180
  /**
1214
1181
  * Rotate path 180deg vertically
@@ -1234,10 +1201,12 @@ class Ve {
1234
1201
  * @return the path string
1235
1202
  */
1236
1203
  toString() {
1237
- return j(this.segments, this.round);
1204
+ return Z(this.segments, this.round);
1238
1205
  }
1239
1206
  }
1207
+ // bring main utilities to front
1208
+ N(v, "CSSMatrix", Nt), N(v, "getPathBBox", kt), N(v, "getPathArea", _t), N(v, "getTotalLength", F), N(v, "getDrawDirection", Ae), N(v, "getPointAtLength", W), N(v, "pathLengthFactory", ft), N(v, "getPropertiesAtLength", Pt), N(v, "getPropertiesAtPoint", yt), N(v, "polygonLength", le), N(v, "polygonArea", ce), N(v, "getClosestPoint", Ne), N(v, "getSegmentOfPoint", ve), N(v, "getSegmentAtLength", we), N(v, "isPointInStroke", Pe), N(v, "isValidPath", Wt), N(v, "isPathArray", mt), N(v, "isAbsoluteArray", vt), N(v, "isRelativeArray", Vt), N(v, "isCurveArray", Ut), N(v, "isNormalizedArray", wt), N(v, "shapeToPath", qe), N(v, "parsePathString", Q), N(v, "roundPath", lt), N(v, "splitPath", $t), N(v, "splitCubic", je), N(v, "optimizePath", Ot), N(v, "reverseCurve", Oe), N(v, "reversePath", it), N(v, "normalizePath", j), N(v, "transformPath", It), N(v, "pathToAbsolute", H), N(v, "pathToRelative", At), N(v, "pathToCurve", ct), N(v, "pathToString", Z);
1240
1209
  export {
1241
- Ve as default
1210
+ v as default
1242
1211
  };
1243
1212
  //# sourceMappingURL=svg-path-commander.mjs.map