@s25studio/sinth 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,903 @@
1
+ import { t as e } from "./BufferGeometryUtils-DBNyVaoE.js";
2
+ import * as t from "three";
3
+ import { Box2 as n, BufferGeometry as r, FileLoader as i, Float32BufferAttribute as a, Loader as o, Matrix3 as s, Path as c, SRGBColorSpace as l, Shape as u, ShapePath as d, ShapeUtils as f, Vector2 as p, Vector3 as m } from "three";
4
+ //#region node_modules/three/examples/jsm/loaders/SVGLoader.js
5
+ var h = l, g = class e extends o {
6
+ constructor(e) {
7
+ super(e), this.defaultDPI = 90, this.defaultUnit = "px";
8
+ }
9
+ load(e, t, n, r) {
10
+ let a = this, o = new i(a.manager);
11
+ o.setPath(a.path), o.setRequestHeader(a.requestHeader), o.setWithCredentials(a.withCredentials), o.load(e, function(n) {
12
+ try {
13
+ t(a.parse(n));
14
+ } catch (t) {
15
+ r ? r(t) : console.error(t), a.manager.itemError(e);
16
+ }
17
+ }, n, r);
18
+ }
19
+ parse(e) {
20
+ let t = this;
21
+ function n(e, t) {
22
+ if (e.nodeType !== 1) return;
23
+ let a = T(e), o = !1, s = null;
24
+ switch (e.nodeName) {
25
+ case "svg":
26
+ t = y(e, t);
27
+ break;
28
+ case "style":
29
+ i(e);
30
+ break;
31
+ case "g":
32
+ t = y(e, t);
33
+ break;
34
+ case "path":
35
+ t = y(e, t), e.hasAttribute("d") && (s = r(e));
36
+ break;
37
+ case "rect":
38
+ t = y(e, t), s = l(e);
39
+ break;
40
+ case "polygon":
41
+ t = y(e, t), s = u(e);
42
+ break;
43
+ case "polyline":
44
+ t = y(e, t), s = f(e);
45
+ break;
46
+ case "circle":
47
+ t = y(e, t), s = g(e);
48
+ break;
49
+ case "ellipse":
50
+ t = y(e, t), s = _(e);
51
+ break;
52
+ case "line":
53
+ t = y(e, t), s = v(e);
54
+ break;
55
+ case "defs":
56
+ o = !0;
57
+ break;
58
+ case "use":
59
+ t = y(e, t);
60
+ let a = (e.getAttributeNS("http://www.w3.org/1999/xlink", "href") || "").substring(1), c = e.viewportElement.getElementById(a);
61
+ c ? n(c, t) : console.warn("SVGLoader: 'use node' references non-existent node id: " + a);
62
+ break;
63
+ default:
64
+ }
65
+ s && (t.fill !== void 0 && t.fill !== "none" && s.color.setStyle(t.fill, h), D(s, H), N.push(s), s.userData = {
66
+ node: e,
67
+ style: t
68
+ });
69
+ let c = e.childNodes;
70
+ for (let e = 0; e < c.length; e++) {
71
+ let r = c[e];
72
+ o && r.nodeName !== "style" && r.nodeName !== "defs" || n(r, t);
73
+ }
74
+ a && (F.pop(), F.length > 0 ? H.copy(F[F.length - 1]) : H.identity());
75
+ }
76
+ function r(e) {
77
+ let t = new d(), n = new p(), r = new p(), i = new p(), o = !0, s = !1, c = e.getAttribute("d");
78
+ if (c === "" || c === "none") return null;
79
+ let l = c.match(/[a-df-z][^a-df-z]*/gi);
80
+ for (let e = 0, c = l.length; e < c; e++) {
81
+ let c = l[e], u = c.charAt(0), d = c.slice(1).trim();
82
+ o === !0 && (s = !0, o = !1);
83
+ let f;
84
+ switch (u) {
85
+ case "M":
86
+ f = x(d);
87
+ for (let e = 0, a = f.length; e < a; e += 2) n.x = f[e + 0], n.y = f[e + 1], r.x = n.x, r.y = n.y, e === 0 ? t.moveTo(n.x, n.y) : t.lineTo(n.x, n.y), e === 0 && i.copy(n);
88
+ break;
89
+ case "H":
90
+ f = x(d);
91
+ for (let e = 0, a = f.length; e < a; e++) n.x = f[e], r.x = n.x, r.y = n.y, t.lineTo(n.x, n.y), e === 0 && s === !0 && i.copy(n);
92
+ break;
93
+ case "V":
94
+ f = x(d);
95
+ for (let e = 0, a = f.length; e < a; e++) n.y = f[e], r.x = n.x, r.y = n.y, t.lineTo(n.x, n.y), e === 0 && s === !0 && i.copy(n);
96
+ break;
97
+ case "L":
98
+ f = x(d);
99
+ for (let e = 0, a = f.length; e < a; e += 2) n.x = f[e + 0], n.y = f[e + 1], r.x = n.x, r.y = n.y, t.lineTo(n.x, n.y), e === 0 && s === !0 && i.copy(n);
100
+ break;
101
+ case "C":
102
+ f = x(d);
103
+ for (let e = 0, a = f.length; e < a; e += 6) t.bezierCurveTo(f[e + 0], f[e + 1], f[e + 2], f[e + 3], f[e + 4], f[e + 5]), r.x = f[e + 2], r.y = f[e + 3], n.x = f[e + 4], n.y = f[e + 5], e === 0 && s === !0 && i.copy(n);
104
+ break;
105
+ case "S":
106
+ f = x(d);
107
+ for (let e = 0, a = f.length; e < a; e += 4) t.bezierCurveTo(b(n.x, r.x), b(n.y, r.y), f[e + 0], f[e + 1], f[e + 2], f[e + 3]), r.x = f[e + 0], r.y = f[e + 1], n.x = f[e + 2], n.y = f[e + 3], e === 0 && s === !0 && i.copy(n);
108
+ break;
109
+ case "Q":
110
+ f = x(d);
111
+ for (let e = 0, a = f.length; e < a; e += 4) t.quadraticCurveTo(f[e + 0], f[e + 1], f[e + 2], f[e + 3]), r.x = f[e + 0], r.y = f[e + 1], n.x = f[e + 2], n.y = f[e + 3], e === 0 && s === !0 && i.copy(n);
112
+ break;
113
+ case "T":
114
+ f = x(d);
115
+ for (let e = 0, a = f.length; e < a; e += 2) {
116
+ let a = b(n.x, r.x), o = b(n.y, r.y);
117
+ t.quadraticCurveTo(a, o, f[e + 0], f[e + 1]), r.x = a, r.y = o, n.x = f[e + 0], n.y = f[e + 1], e === 0 && s === !0 && i.copy(n);
118
+ }
119
+ break;
120
+ case "A":
121
+ f = x(d, [3, 4], 7);
122
+ for (let e = 0, o = f.length; e < o; e += 7) {
123
+ if (f[e + 5] == n.x && f[e + 6] == n.y) continue;
124
+ let o = n.clone();
125
+ n.x = f[e + 5], n.y = f[e + 6], r.x = n.x, r.y = n.y, a(t, f[e], f[e + 1], f[e + 2], f[e + 3], f[e + 4], o, n), e === 0 && s === !0 && i.copy(n);
126
+ }
127
+ break;
128
+ case "m":
129
+ f = x(d);
130
+ for (let e = 0, a = f.length; e < a; e += 2) n.x += f[e + 0], n.y += f[e + 1], r.x = n.x, r.y = n.y, e === 0 ? t.moveTo(n.x, n.y) : t.lineTo(n.x, n.y), e === 0 && i.copy(n);
131
+ break;
132
+ case "h":
133
+ f = x(d);
134
+ for (let e = 0, a = f.length; e < a; e++) n.x += f[e], r.x = n.x, r.y = n.y, t.lineTo(n.x, n.y), e === 0 && s === !0 && i.copy(n);
135
+ break;
136
+ case "v":
137
+ f = x(d);
138
+ for (let e = 0, a = f.length; e < a; e++) n.y += f[e], r.x = n.x, r.y = n.y, t.lineTo(n.x, n.y), e === 0 && s === !0 && i.copy(n);
139
+ break;
140
+ case "l":
141
+ f = x(d);
142
+ for (let e = 0, a = f.length; e < a; e += 2) n.x += f[e + 0], n.y += f[e + 1], r.x = n.x, r.y = n.y, t.lineTo(n.x, n.y), e === 0 && s === !0 && i.copy(n);
143
+ break;
144
+ case "c":
145
+ f = x(d);
146
+ for (let e = 0, a = f.length; e < a; e += 6) t.bezierCurveTo(n.x + f[e + 0], n.y + f[e + 1], n.x + f[e + 2], n.y + f[e + 3], n.x + f[e + 4], n.y + f[e + 5]), r.x = n.x + f[e + 2], r.y = n.y + f[e + 3], n.x += f[e + 4], n.y += f[e + 5], e === 0 && s === !0 && i.copy(n);
147
+ break;
148
+ case "s":
149
+ f = x(d);
150
+ for (let e = 0, a = f.length; e < a; e += 4) t.bezierCurveTo(b(n.x, r.x), b(n.y, r.y), n.x + f[e + 0], n.y + f[e + 1], n.x + f[e + 2], n.y + f[e + 3]), r.x = n.x + f[e + 0], r.y = n.y + f[e + 1], n.x += f[e + 2], n.y += f[e + 3], e === 0 && s === !0 && i.copy(n);
151
+ break;
152
+ case "q":
153
+ f = x(d);
154
+ for (let e = 0, a = f.length; e < a; e += 4) t.quadraticCurveTo(n.x + f[e + 0], n.y + f[e + 1], n.x + f[e + 2], n.y + f[e + 3]), r.x = n.x + f[e + 0], r.y = n.y + f[e + 1], n.x += f[e + 2], n.y += f[e + 3], e === 0 && s === !0 && i.copy(n);
155
+ break;
156
+ case "t":
157
+ f = x(d);
158
+ for (let e = 0, a = f.length; e < a; e += 2) {
159
+ let a = b(n.x, r.x), o = b(n.y, r.y);
160
+ t.quadraticCurveTo(a, o, n.x + f[e + 0], n.y + f[e + 1]), r.x = a, r.y = o, n.x += f[e + 0], n.y += f[e + 1], e === 0 && s === !0 && i.copy(n);
161
+ }
162
+ break;
163
+ case "a":
164
+ f = x(d, [3, 4], 7);
165
+ for (let e = 0, o = f.length; e < o; e += 7) {
166
+ if (f[e + 5] == 0 && f[e + 6] == 0) continue;
167
+ let o = n.clone();
168
+ n.x += f[e + 5], n.y += f[e + 6], r.x = n.x, r.y = n.y, a(t, f[e], f[e + 1], f[e + 2], f[e + 3], f[e + 4], o, n), e === 0 && s === !0 && i.copy(n);
169
+ }
170
+ break;
171
+ case "Z":
172
+ case "z":
173
+ t.currentPath.autoClose = !0, t.currentPath.curves.length > 0 && (n.copy(i), t.currentPath.currentPoint.copy(n), o = !0);
174
+ break;
175
+ default: console.warn(c);
176
+ }
177
+ s = !1;
178
+ }
179
+ return t;
180
+ }
181
+ function i(e) {
182
+ if (!(!e.sheet || !e.sheet.cssRules || !e.sheet.cssRules.length)) for (let t = 0; t < e.sheet.cssRules.length; t++) {
183
+ let n = e.sheet.cssRules[t];
184
+ if (n.type !== 1) continue;
185
+ let r = n.selectorText.split(/,/gm).filter(Boolean).map((e) => e.trim());
186
+ for (let e = 0; e < r.length; e++) {
187
+ let t = Object.fromEntries(Object.entries(n.style).filter(([, e]) => e !== ""));
188
+ P[r[e]] = Object.assign(P[r[e]] || {}, t);
189
+ }
190
+ }
191
+ }
192
+ function a(e, t, n, r, i, a, s, c) {
193
+ if (t == 0 || n == 0) {
194
+ e.lineTo(c.x, c.y);
195
+ return;
196
+ }
197
+ r = r * Math.PI / 180, t = Math.abs(t), n = Math.abs(n);
198
+ let l = (s.x - c.x) / 2, u = (s.y - c.y) / 2, d = Math.cos(r) * l + Math.sin(r) * u, f = -Math.sin(r) * l + Math.cos(r) * u, p = t * t, m = n * n, h = d * d, g = f * f, _ = h / p + g / m;
199
+ if (_ > 1) {
200
+ let e = Math.sqrt(_);
201
+ t = e * t, n = e * n, p = t * t, m = n * n;
202
+ }
203
+ let v = p * g + m * h, y = (p * m - v) / v, b = Math.sqrt(Math.max(0, y));
204
+ i === a && (b = -b);
205
+ let x = b * t * f / n, S = -b * n * d / t, C = Math.cos(r) * x - Math.sin(r) * S + (s.x + c.x) / 2, w = Math.sin(r) * x + Math.cos(r) * S + (s.y + c.y) / 2, T = o(1, 0, (d - x) / t, (f - S) / n), E = o((d - x) / t, (f - S) / n, (-d - x) / t, (-f - S) / n) % (Math.PI * 2);
206
+ e.currentPath.absellipse(C, w, t, n, T, T + E, a === 0, r);
207
+ }
208
+ function o(e, t, n, r) {
209
+ let i = e * n + t * r, a = Math.sqrt(e * e + t * t) * Math.sqrt(n * n + r * r), o = Math.acos(Math.max(-1, Math.min(1, i / a)));
210
+ return e * r - t * n < 0 && (o = -o), o;
211
+ }
212
+ function l(e) {
213
+ let t = w(e.getAttribute("x") || 0), n = w(e.getAttribute("y") || 0), r = w(e.getAttribute("rx") || e.getAttribute("ry") || 0), i = w(e.getAttribute("ry") || e.getAttribute("rx") || 0), a = w(e.getAttribute("width")), o = w(e.getAttribute("height")), s = .448084975506, c = new d();
214
+ return c.moveTo(t + r, n), c.lineTo(t + a - r, n), (r !== 0 || i !== 0) && c.bezierCurveTo(t + a - r * s, n, t + a, n + i * s, t + a, n + i), c.lineTo(t + a, n + o - i), (r !== 0 || i !== 0) && c.bezierCurveTo(t + a, n + o - i * s, t + a - r * s, n + o, t + a - r, n + o), c.lineTo(t + r, n + o), (r !== 0 || i !== 0) && c.bezierCurveTo(t + r * s, n + o, t, n + o - i * s, t, n + o - i), c.lineTo(t, n + i), (r !== 0 || i !== 0) && c.bezierCurveTo(t, n + i * s, t + r * s, n, t + r, n), c;
215
+ }
216
+ function u(e) {
217
+ function t(e, t, n) {
218
+ let a = w(t), o = w(n);
219
+ i === 0 ? r.moveTo(a, o) : r.lineTo(a, o), i++;
220
+ }
221
+ let n = /([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g, r = new d(), i = 0;
222
+ return e.getAttribute("points").replace(n, t), r.currentPath.autoClose = !0, r;
223
+ }
224
+ function f(e) {
225
+ function t(e, t, n) {
226
+ let a = w(t), o = w(n);
227
+ i === 0 ? r.moveTo(a, o) : r.lineTo(a, o), i++;
228
+ }
229
+ let n = /([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g, r = new d(), i = 0;
230
+ return e.getAttribute("points").replace(n, t), r.currentPath.autoClose = !1, r;
231
+ }
232
+ function g(e) {
233
+ let t = w(e.getAttribute("cx") || 0), n = w(e.getAttribute("cy") || 0), r = w(e.getAttribute("r") || 0), i = new c();
234
+ i.absarc(t, n, r, 0, Math.PI * 2);
235
+ let a = new d();
236
+ return a.subPaths.push(i), a;
237
+ }
238
+ function _(e) {
239
+ let t = w(e.getAttribute("cx") || 0), n = w(e.getAttribute("cy") || 0), r = w(e.getAttribute("rx") || 0), i = w(e.getAttribute("ry") || 0), a = new c();
240
+ a.absellipse(t, n, r, i, 0, Math.PI * 2);
241
+ let o = new d();
242
+ return o.subPaths.push(a), o;
243
+ }
244
+ function v(e) {
245
+ let t = w(e.getAttribute("x1") || 0), n = w(e.getAttribute("y1") || 0), r = w(e.getAttribute("x2") || 0), i = w(e.getAttribute("y2") || 0), a = new d();
246
+ return a.moveTo(t, n), a.lineTo(r, i), a.currentPath.autoClose = !1, a;
247
+ }
248
+ function y(e, t) {
249
+ t = Object.assign({}, t);
250
+ let n = {};
251
+ if (e.hasAttribute("class")) {
252
+ let t = e.getAttribute("class").split(/\s/).filter(Boolean).map((e) => e.trim());
253
+ for (let e = 0; e < t.length; e++) n = Object.assign(n, P["." + t[e]]);
254
+ }
255
+ e.hasAttribute("id") && (n = Object.assign(n, P["#" + e.getAttribute("id")]));
256
+ function r(r, i, a) {
257
+ a === void 0 && (a = function(e) {
258
+ return e.startsWith("url") && console.warn("SVGLoader: url access in attributes is not implemented."), e;
259
+ }), e.hasAttribute(r) && (t[i] = a(e.getAttribute(r))), n[i] && (t[i] = a(n[i])), e.style && e.style[r] !== "" && (t[i] = a(e.style[r]));
260
+ }
261
+ function i(e) {
262
+ return Math.max(0, Math.min(1, w(e)));
263
+ }
264
+ function a(e) {
265
+ return Math.max(0, w(e));
266
+ }
267
+ return r("fill", "fill"), r("fill-opacity", "fillOpacity", i), r("fill-rule", "fillRule"), r("opacity", "opacity", i), r("stroke", "stroke"), r("stroke-opacity", "strokeOpacity", i), r("stroke-width", "strokeWidth", a), r("stroke-linejoin", "strokeLineJoin"), r("stroke-linecap", "strokeLineCap"), r("stroke-miterlimit", "strokeMiterLimit", a), r("visibility", "visibility"), t;
268
+ }
269
+ function b(e, t) {
270
+ return e - (t - e);
271
+ }
272
+ function x(e, t, n) {
273
+ if (typeof e != "string") throw TypeError("Invalid input: " + typeof e);
274
+ let r = {
275
+ SEPARATOR: /[ \t\r\n\,.\-+]/,
276
+ WHITESPACE: /[ \t\r\n]/,
277
+ DIGIT: /[\d]/,
278
+ SIGN: /[-+]/,
279
+ POINT: /\./,
280
+ COMMA: /,/,
281
+ EXP: /e/i,
282
+ FLAGS: /[01]/
283
+ }, i = 0, a = !0, o = "", s = "", c = [];
284
+ function l(e, t, n) {
285
+ let r = /* @__PURE__ */ SyntaxError("Unexpected character \"" + e + "\" at index " + t + ".");
286
+ throw r.partial = n, r;
287
+ }
288
+ function u() {
289
+ o !== "" && (s === "" ? c.push(Number(o)) : c.push(Number(o) * 10 ** Number(s))), o = "", s = "";
290
+ }
291
+ let d, f = e.length;
292
+ for (let p = 0; p < f; p++) {
293
+ if (d = e[p], Array.isArray(t) && t.includes(c.length % n) && r.FLAGS.test(d)) {
294
+ i = 1, o = d, u();
295
+ continue;
296
+ }
297
+ if (i === 0) {
298
+ if (r.WHITESPACE.test(d)) continue;
299
+ if (r.DIGIT.test(d) || r.SIGN.test(d)) {
300
+ i = 1, o = d;
301
+ continue;
302
+ }
303
+ if (r.POINT.test(d)) {
304
+ i = 2, o = d;
305
+ continue;
306
+ }
307
+ r.COMMA.test(d) && (a && l(d, p, c), a = !0);
308
+ }
309
+ if (i === 1) {
310
+ if (r.DIGIT.test(d)) {
311
+ o += d;
312
+ continue;
313
+ }
314
+ if (r.POINT.test(d)) {
315
+ o += d, i = 2;
316
+ continue;
317
+ }
318
+ if (r.EXP.test(d)) {
319
+ i = 3;
320
+ continue;
321
+ }
322
+ r.SIGN.test(d) && o.length === 1 && r.SIGN.test(o[0]) && l(d, p, c);
323
+ }
324
+ if (i === 2) {
325
+ if (r.DIGIT.test(d)) {
326
+ o += d;
327
+ continue;
328
+ }
329
+ if (r.EXP.test(d)) {
330
+ i = 3;
331
+ continue;
332
+ }
333
+ r.POINT.test(d) && o[o.length - 1] === "." && l(d, p, c);
334
+ }
335
+ if (i === 3) {
336
+ if (r.DIGIT.test(d)) {
337
+ s += d;
338
+ continue;
339
+ }
340
+ if (r.SIGN.test(d)) {
341
+ if (s === "") {
342
+ s += d;
343
+ continue;
344
+ }
345
+ s.length === 1 && r.SIGN.test(s) && l(d, p, c);
346
+ }
347
+ }
348
+ r.WHITESPACE.test(d) ? (u(), i = 0, a = !1) : r.COMMA.test(d) ? (u(), i = 0, a = !0) : r.SIGN.test(d) ? (u(), i = 1, o = d) : r.POINT.test(d) ? (u(), i = 2, o = d) : l(d, p, c);
349
+ }
350
+ return u(), c;
351
+ }
352
+ let S = [
353
+ "mm",
354
+ "cm",
355
+ "in",
356
+ "pt",
357
+ "pc",
358
+ "px"
359
+ ], C = {
360
+ mm: {
361
+ mm: 1,
362
+ cm: .1,
363
+ in: 1 / 25.4,
364
+ pt: 72 / 25.4,
365
+ pc: 6 / 25.4,
366
+ px: -1
367
+ },
368
+ cm: {
369
+ mm: 10,
370
+ cm: 1,
371
+ in: 1 / 2.54,
372
+ pt: 72 / 2.54,
373
+ pc: 6 / 2.54,
374
+ px: -1
375
+ },
376
+ in: {
377
+ mm: 25.4,
378
+ cm: 2.54,
379
+ in: 1,
380
+ pt: 72,
381
+ pc: 6,
382
+ px: -1
383
+ },
384
+ pt: {
385
+ mm: 25.4 / 72,
386
+ cm: 2.54 / 72,
387
+ in: 1 / 72,
388
+ pt: 1,
389
+ pc: 6 / 72,
390
+ px: -1
391
+ },
392
+ pc: {
393
+ mm: 25.4 / 6,
394
+ cm: 2.54 / 6,
395
+ in: 1 / 6,
396
+ pt: 72 / 6,
397
+ pc: 1,
398
+ px: -1
399
+ },
400
+ px: { px: 1 }
401
+ };
402
+ function w(e) {
403
+ let n = "px";
404
+ if (typeof e == "string" || e instanceof String) for (let t = 0, r = S.length; t < r; t++) {
405
+ let r = S[t];
406
+ if (e.endsWith(r)) {
407
+ n = r, e = e.substring(0, e.length - r.length);
408
+ break;
409
+ }
410
+ }
411
+ let r;
412
+ return n === "px" && t.defaultUnit !== "px" ? r = C.in[t.defaultUnit] / t.defaultDPI : (r = C[n][t.defaultUnit], r < 0 && (r = C[n].in * t.defaultDPI)), r * parseFloat(e);
413
+ }
414
+ function T(e) {
415
+ if (!(e.hasAttribute("transform") || e.nodeName === "use" && (e.hasAttribute("x") || e.hasAttribute("y")))) return null;
416
+ let t = E(e);
417
+ return F.length > 0 && t.premultiply(F[F.length - 1]), H.copy(t), F.push(t), t;
418
+ }
419
+ function E(e) {
420
+ let t = new s(), n = I;
421
+ if (e.nodeName === "use" && (e.hasAttribute("x") || e.hasAttribute("y"))) {
422
+ let n = w(e.getAttribute("x") || 0), r = w(e.getAttribute("y") || 0);
423
+ t.translate(n, r);
424
+ }
425
+ if (e.hasAttribute("transform")) {
426
+ let r = e.getAttribute("transform").split(")");
427
+ for (let e = r.length - 1; e >= 0; e--) {
428
+ let i = r[e].trim();
429
+ if (i === "") continue;
430
+ let a = i.indexOf("("), o = i.length;
431
+ if (a > 0 && a < o) {
432
+ let e = i.slice(0, a), t = x(i.slice(a + 1));
433
+ switch (n.identity(), e) {
434
+ case "translate":
435
+ if (t.length >= 1) {
436
+ let e = t[0], r = 0;
437
+ t.length >= 2 && (r = t[1]), n.translate(e, r);
438
+ }
439
+ break;
440
+ case "rotate":
441
+ if (t.length >= 1) {
442
+ let e = 0, r = 0, i = 0;
443
+ e = t[0] * Math.PI / 180, t.length >= 3 && (r = t[1], i = t[2]), L.makeTranslation(-r, -i), R.makeRotation(e), z.multiplyMatrices(R, L), L.makeTranslation(r, i), n.multiplyMatrices(L, z);
444
+ }
445
+ break;
446
+ case "scale":
447
+ if (t.length >= 1) {
448
+ let e = t[0], r = e;
449
+ t.length >= 2 && (r = t[1]), n.scale(e, r);
450
+ }
451
+ break;
452
+ case "skewX":
453
+ t.length === 1 && n.set(1, Math.tan(t[0] * Math.PI / 180), 0, 0, 1, 0, 0, 0, 1);
454
+ break;
455
+ case "skewY":
456
+ t.length === 1 && n.set(1, 0, 0, Math.tan(t[0] * Math.PI / 180), 1, 0, 0, 0, 1);
457
+ break;
458
+ case "matrix":
459
+ t.length === 6 && n.set(t[0], t[2], t[4], t[1], t[3], t[5], 0, 0, 1);
460
+ break;
461
+ }
462
+ }
463
+ t.premultiply(n);
464
+ }
465
+ }
466
+ return t;
467
+ }
468
+ function D(e, t) {
469
+ function n(e) {
470
+ V.set(e.x, e.y, 1).applyMatrix3(t), e.set(V.x, V.y);
471
+ }
472
+ function r(e) {
473
+ let n = e.xRadius, r = e.yRadius, i = Math.cos(e.aRotation), a = Math.sin(e.aRotation), o = new m(n * i, n * a, 0), s = new m(-r * a, r * i, 0), c = o.applyMatrix3(t), l = s.applyMatrix3(t), u = I.set(c.x, l.x, 0, c.y, l.y, 0, 0, 0, 1), d = L.copy(u).invert(), f = R.copy(d).transpose().multiply(d).elements, p = M(f[0], f[1], f[4]), h = Math.sqrt(p.rt1), g = Math.sqrt(p.rt2);
474
+ if (e.xRadius = 1 / h, e.yRadius = 1 / g, e.aRotation = Math.atan2(p.sn, p.cs), !((e.aEndAngle - e.aStartAngle) % (2 * Math.PI) < 2 ** -52)) {
475
+ let n = L.set(h, 0, 0, 0, g, 0, 0, 0, 1), r = R.set(p.cs, p.sn, 0, -p.sn, p.cs, 0, 0, 0, 1), i = n.multiply(r).multiply(u), a = (e) => {
476
+ let { x: t, y: n } = new m(Math.cos(e), Math.sin(e), 0).applyMatrix3(i);
477
+ return Math.atan2(n, t);
478
+ };
479
+ e.aStartAngle = a(e.aStartAngle), e.aEndAngle = a(e.aEndAngle), O(t) && (e.aClockwise = !e.aClockwise);
480
+ }
481
+ }
482
+ function i(e) {
483
+ let n = A(t), r = j(t);
484
+ e.xRadius *= n, e.yRadius *= r;
485
+ let i = n > 2 ** -52 ? Math.atan2(t.elements[1], t.elements[0]) : Math.atan2(-t.elements[3], t.elements[4]);
486
+ e.aRotation += i, O(t) && (e.aStartAngle *= -1, e.aEndAngle *= -1, e.aClockwise = !e.aClockwise);
487
+ }
488
+ let a = e.subPaths;
489
+ for (let e = 0, o = a.length; e < o; e++) {
490
+ let o = a[e].curves;
491
+ for (let e = 0; e < o.length; e++) {
492
+ let a = o[e];
493
+ a.isLineCurve ? (n(a.v1), n(a.v2)) : a.isCubicBezierCurve ? (n(a.v0), n(a.v1), n(a.v2), n(a.v3)) : a.isQuadraticBezierCurve ? (n(a.v0), n(a.v1), n(a.v2)) : a.isEllipseCurve && (B.set(a.aX, a.aY), n(B), a.aX = B.x, a.aY = B.y, k(t) ? r(a) : i(a));
494
+ }
495
+ }
496
+ }
497
+ function O(e) {
498
+ let t = e.elements;
499
+ return t[0] * t[4] - t[1] * t[3] < 0;
500
+ }
501
+ function k(e) {
502
+ let t = e.elements, n = t[0] * t[3] + t[1] * t[4];
503
+ if (n === 0) return !1;
504
+ let r = A(e), i = j(e);
505
+ return Math.abs(n / (r * i)) > 2 ** -52;
506
+ }
507
+ function A(e) {
508
+ let t = e.elements;
509
+ return Math.sqrt(t[0] * t[0] + t[1] * t[1]);
510
+ }
511
+ function j(e) {
512
+ let t = e.elements;
513
+ return Math.sqrt(t[3] * t[3] + t[4] * t[4]);
514
+ }
515
+ function M(e, t, n) {
516
+ let r, i, a, o, s, c = e + n, l = e - n, u = Math.sqrt(l * l + 4 * t * t);
517
+ return c > 0 ? (r = .5 * (c + u), s = 1 / r, i = e * s * n - t * s * t) : c < 0 ? i = .5 * (c - u) : (r = .5 * u, i = -.5 * u), a = l > 0 ? l + u : l - u, Math.abs(a) > 2 * Math.abs(t) ? (s = -2 * t / a, o = 1 / Math.sqrt(1 + s * s), a = s * o) : Math.abs(t) === 0 ? (a = 1, o = 0) : (s = -.5 * a / t, a = 1 / Math.sqrt(1 + s * s), o = s * a), l > 0 && (s = a, a = -o, o = s), {
518
+ rt1: r,
519
+ rt2: i,
520
+ cs: a,
521
+ sn: o
522
+ };
523
+ }
524
+ let N = [], P = {}, F = [], I = new s(), L = new s(), R = new s(), z = new s(), B = new p(), V = new m(), H = new s(), U = new DOMParser().parseFromString(e, "image/svg+xml");
525
+ return n(U.documentElement, {
526
+ fill: "#000",
527
+ fillOpacity: 1,
528
+ strokeOpacity: 1,
529
+ strokeWidth: 1,
530
+ strokeLineJoin: "miter",
531
+ strokeLineCap: "butt",
532
+ strokeMiterLimit: 4
533
+ }), {
534
+ paths: N,
535
+ xml: U.documentElement
536
+ };
537
+ }
538
+ static createShapes(e) {
539
+ let t = 999999999, r = {
540
+ ORIGIN: 0,
541
+ DESTINATION: 1,
542
+ BETWEEN: 2,
543
+ LEFT: 3,
544
+ RIGHT: 4,
545
+ BEHIND: 5,
546
+ BEYOND: 6
547
+ }, i = {
548
+ loc: r.ORIGIN,
549
+ t: 0
550
+ };
551
+ function a(e, t, n, a) {
552
+ let s = e.x, c = t.x, l = n.x, u = a.x, d = e.y, f = t.y, p = n.y, m = a.y, h = (u - l) * (d - p) - (m - p) * (s - l), g = (c - s) * (d - p) - (f - d) * (s - l), _ = (m - p) * (c - s) - (u - l) * (f - d), v = h / _, y = g / _;
553
+ if (_ === 0 && h !== 0 || v <= 0 || v >= 1 || y < 0 || y > 1) return null;
554
+ if (h === 0 && _ === 0) {
555
+ for (let l = 0; l < 2; l++) if (o(l === 0 ? n : a, e, t), i.loc == r.ORIGIN) {
556
+ let e = l === 0 ? n : a;
557
+ return {
558
+ x: e.x,
559
+ y: e.y,
560
+ t: i.t
561
+ };
562
+ } else if (i.loc == r.BETWEEN) return {
563
+ x: +(s + i.t * (c - s)).toPrecision(10),
564
+ y: +(d + i.t * (f - d)).toPrecision(10),
565
+ t: i.t
566
+ };
567
+ return null;
568
+ } else {
569
+ for (let s = 0; s < 2; s++) if (o(s === 0 ? n : a, e, t), i.loc == r.ORIGIN) {
570
+ let e = s === 0 ? n : a;
571
+ return {
572
+ x: e.x,
573
+ y: e.y,
574
+ t: i.t
575
+ };
576
+ }
577
+ return {
578
+ x: +(s + v * (c - s)).toPrecision(10),
579
+ y: +(d + v * (f - d)).toPrecision(10),
580
+ t: v
581
+ };
582
+ }
583
+ }
584
+ function o(e, t, n) {
585
+ let a = n.x - t.x, o = n.y - t.y, s = e.x - t.x, c = e.y - t.y, l = a * c - s * o;
586
+ if (e.x === t.x && e.y === t.y) {
587
+ i.loc = r.ORIGIN, i.t = 0;
588
+ return;
589
+ }
590
+ if (e.x === n.x && e.y === n.y) {
591
+ i.loc = r.DESTINATION, i.t = 1;
592
+ return;
593
+ }
594
+ if (l < -(2 ** -52)) {
595
+ i.loc = r.LEFT;
596
+ return;
597
+ }
598
+ if (l > 2 ** -52) {
599
+ i.loc = r.RIGHT;
600
+ return;
601
+ }
602
+ if (a * s < 0 || o * c < 0) {
603
+ i.loc = r.BEHIND;
604
+ return;
605
+ }
606
+ if (Math.sqrt(a * a + o * o) < Math.sqrt(s * s + c * c)) {
607
+ i.loc = r.BEYOND;
608
+ return;
609
+ }
610
+ let u;
611
+ u = a === 0 ? c / o : s / a, i.loc = r.BETWEEN, i.t = u;
612
+ }
613
+ function s(e, t) {
614
+ let n = [], r = [];
615
+ for (let i = 1; i < e.length; i++) {
616
+ let o = e[i - 1], s = e[i];
617
+ for (let e = 1; e < t.length; e++) {
618
+ let i = t[e - 1], c = t[e], l = a(o, s, i, c);
619
+ l !== null && n.find((e) => e.t <= l.t + 2 ** -52 && e.t >= l.t - 2 ** -52) === void 0 && (n.push(l), r.push(new p(l.x, l.y)));
620
+ }
621
+ }
622
+ return r;
623
+ }
624
+ function l(e, t, n) {
625
+ let r = new p();
626
+ t.getCenter(r);
627
+ let i = [];
628
+ return n.forEach((t) => {
629
+ t.boundingBox.containsPoint(r) && s(e, t.points).forEach((e) => {
630
+ i.push({
631
+ identifier: t.identifier,
632
+ isCW: t.isCW,
633
+ point: e
634
+ });
635
+ });
636
+ }), i.sort((e, t) => e.point.x - t.point.x), i;
637
+ }
638
+ function d(e, t, n, r, i) {
639
+ (i == null || i === "") && (i = "nonzero");
640
+ let a = new p();
641
+ e.boundingBox.getCenter(a);
642
+ let o = l([new p(n, a.y), new p(r, a.y)], e.boundingBox, t);
643
+ o.sort((e, t) => e.point.x - t.point.x);
644
+ let s = [], c = [];
645
+ o.forEach((t) => {
646
+ t.identifier === e.identifier ? s.push(t) : c.push(t);
647
+ });
648
+ let u = s[0].point.x, d = [], f = 0;
649
+ for (; f < c.length && c[f].point.x < u;) d.length > 0 && d[d.length - 1] === c[f].identifier ? d.pop() : d.push(c[f].identifier), f++;
650
+ if (d.push(e.identifier), i === "evenodd") {
651
+ let t = d.length % 2 == 0, n = d[d.length - 2];
652
+ return {
653
+ identifier: e.identifier,
654
+ isHole: t,
655
+ for: n
656
+ };
657
+ } else if (i === "nonzero") {
658
+ let n = !0, r = null, i = null;
659
+ for (let e = 0; e < d.length; e++) {
660
+ let a = d[e];
661
+ n ? (i = t[a].isCW, n = !1, r = a) : i !== t[a].isCW && (i = t[a].isCW, n = !0);
662
+ }
663
+ return {
664
+ identifier: e.identifier,
665
+ isHole: n,
666
+ for: r
667
+ };
668
+ } else console.warn("fill-rule: \"" + i + "\" is currently not implemented.");
669
+ }
670
+ let m = t, h = -999999999, g = e.subPaths.map((e) => {
671
+ let r = e.getPoints(), i = -999999999, a = t, o = -999999999, s = t;
672
+ for (let e = 0; e < r.length; e++) {
673
+ let t = r[e];
674
+ t.y > i && (i = t.y), t.y < a && (a = t.y), t.x > o && (o = t.x), t.x < s && (s = t.x);
675
+ }
676
+ return h <= o && (h = o + 1), m >= s && (m = s - 1), {
677
+ curves: e.curves,
678
+ points: r,
679
+ isCW: f.isClockWise(r),
680
+ identifier: -1,
681
+ boundingBox: new n(new p(s, a), new p(o, i))
682
+ };
683
+ });
684
+ g = g.filter((e) => e.points.length > 1);
685
+ for (let e = 0; e < g.length; e++) g[e].identifier = e;
686
+ let _ = g.map((t) => d(t, g, m, h, e.userData ? e.userData.style.fillRule : void 0)), v = [];
687
+ return g.forEach((e) => {
688
+ if (!_[e.identifier].isHole) {
689
+ let t = new u();
690
+ t.curves = e.curves, _.filter((t) => t.isHole && t.for === e.identifier).forEach((e) => {
691
+ let n = g[e.identifier], r = new c();
692
+ r.curves = n.curves, t.holes.push(r);
693
+ }), v.push(t);
694
+ }
695
+ }), v;
696
+ }
697
+ static getStrokeStyle(e, t, n, r, i) {
698
+ return e = e === void 0 ? 1 : e, t = t === void 0 ? "#000" : t, n = n === void 0 ? "miter" : n, r = r === void 0 ? "butt" : r, i = i === void 0 ? 4 : i, {
699
+ strokeColor: t,
700
+ strokeWidth: e,
701
+ strokeLineJoin: n,
702
+ strokeLineCap: r,
703
+ strokeMiterLimit: i
704
+ };
705
+ }
706
+ static pointsToStroke(t, n, i, o) {
707
+ let s = [], c = [], l = [];
708
+ if (e.pointsToStrokeWithBuffers(t, n, i, o, s, c, l) === 0) return null;
709
+ let u = new r();
710
+ return u.setAttribute("position", new a(s, 3)), u.setAttribute("normal", new a(c, 3)), u.setAttribute("uv", new a(l, 2)), u;
711
+ }
712
+ static pointsToStrokeWithBuffers(e, t, n, r, i, a, o, s) {
713
+ let c = new p(), l = new p(), u = new p(), d = new p(), f = new p(), m = new p(), h = new p(), g = new p(), _ = new p(), v = new p(), y = new p(), b = new p(), x = new p(), S = new p(), C = new p(), w = new p(), T = new p();
714
+ n = n === void 0 ? 12 : n, r = r === void 0 ? .001 : r, s = s === void 0 ? 0 : s, e = Y(e);
715
+ let E = e.length;
716
+ if (E < 2) return 0;
717
+ let D = e[0].equals(e[E - 1]), O, k = e[0], A, j = t.strokeWidth / 2, M = 1 / (E - 1), N = 0, P, F, I, L, R = !1, z = 0, B = s * 3, V = s * 2;
718
+ H(e[0], e[1], c).multiplyScalar(j), g.copy(e[0]).sub(c), _.copy(e[0]).add(c), v.copy(g), y.copy(_);
719
+ for (let n = 1; n < E; n++) {
720
+ O = e[n], A = n === E - 1 ? D ? e[1] : void 0 : e[n + 1];
721
+ let r = c;
722
+ if (H(k, O, r), u.copy(r).multiplyScalar(j), b.copy(O).sub(u), x.copy(O).add(u), P = N + M, F = !1, A !== void 0) {
723
+ H(O, A, l), u.copy(l).multiplyScalar(j), S.copy(O).sub(u), C.copy(O).add(u), I = !0, u.subVectors(A, k), r.dot(u) < 0 && (I = !1), n === 1 && (R = I), u.subVectors(A, O), u.normalize();
724
+ let e = Math.abs(r.dot(u));
725
+ if (e > 2 ** -52) {
726
+ let n = j / e;
727
+ u.multiplyScalar(-n), d.subVectors(O, k), f.copy(d).setLength(n).add(u), w.copy(f).negate();
728
+ let r = f.length(), i = d.length();
729
+ d.divideScalar(i), m.subVectors(A, O);
730
+ let a = m.length();
731
+ switch (m.divideScalar(a), d.dot(w) < i && m.dot(w) < a && (F = !0), T.copy(f).add(O), w.add(O), L = !1, F ? I ? (C.copy(w), x.copy(w)) : (S.copy(w), b.copy(w)) : G(), t.strokeLineJoin) {
732
+ case "bevel":
733
+ K(I, F, P);
734
+ break;
735
+ case "round":
736
+ q(I, F), I ? W(O, b, S, P, 0) : W(O, C, x, P, 1);
737
+ break;
738
+ default:
739
+ let e = j * t.strokeMiterLimit / r;
740
+ if (e < 1) if (t.strokeLineJoin !== "miter-clip") {
741
+ K(I, F, P);
742
+ break;
743
+ } else q(I, F), I ? (m.subVectors(T, b).multiplyScalar(e).add(b), h.subVectors(T, S).multiplyScalar(e).add(S), U(b, P, 0), U(m, P, 0), U(O, P, .5), U(O, P, .5), U(m, P, 0), U(h, P, 0), U(O, P, .5), U(h, P, 0), U(S, P, 0)) : (m.subVectors(T, x).multiplyScalar(e).add(x), h.subVectors(T, C).multiplyScalar(e).add(C), U(x, P, 1), U(m, P, 1), U(O, P, .5), U(O, P, .5), U(m, P, 1), U(h, P, 1), U(O, P, .5), U(h, P, 1), U(C, P, 1));
744
+ else F ? (I ? (U(_, N, 1), U(g, N, 0), U(T, P, 0), U(_, N, 1), U(T, P, 0), U(w, P, 1)) : (U(_, N, 1), U(g, N, 0), U(T, P, 1), U(g, N, 0), U(w, P, 0), U(T, P, 1)), I ? S.copy(T) : C.copy(T)) : I ? (U(b, P, 0), U(T, P, 0), U(O, P, .5), U(O, P, .5), U(T, P, 0), U(S, P, 0)) : (U(x, P, 1), U(T, P, 1), U(O, P, .5), U(O, P, .5), U(T, P, 1), U(C, P, 1)), L = !0;
745
+ break;
746
+ }
747
+ } else G();
748
+ } else G();
749
+ !D && n === E - 1 && J(e[0], v, y, I, !0, N), N = P, k = O, g.copy(S), _.copy(C);
750
+ }
751
+ if (!D) J(O, b, x, I, !1, P);
752
+ else if (F && i) {
753
+ let e = T, t = w;
754
+ R !== I && (e = w, t = T), I ? (L || R) && (t.toArray(i, 0), t.toArray(i, 9), L && e.toArray(i, 3)) : (L || !R) && (t.toArray(i, 3), t.toArray(i, 9), L && e.toArray(i, 0));
755
+ }
756
+ return z;
757
+ function H(e, t, n) {
758
+ return n.subVectors(t, e), n.set(-n.y, n.x).normalize();
759
+ }
760
+ function U(e, t, n) {
761
+ i && (i[B] = e.x, i[B + 1] = e.y, i[B + 2] = 0, a && (a[B] = 0, a[B + 1] = 0, a[B + 2] = 1), B += 3, o && (o[V] = t, o[V + 1] = n, V += 2)), z += 3;
762
+ }
763
+ function W(e, t, r, i, a) {
764
+ c.copy(t).sub(e).normalize(), l.copy(r).sub(e).normalize();
765
+ let o = Math.PI, s = c.dot(l);
766
+ Math.abs(s) < 1 && (o = Math.abs(Math.acos(s))), o /= n, u.copy(t);
767
+ for (let t = 0, r = n - 1; t < r; t++) d.copy(u).rotateAround(e, o), U(u, i, a), U(d, i, a), U(e, i, .5), u.copy(d);
768
+ U(u, i, a), U(r, i, a), U(e, i, .5);
769
+ }
770
+ function G() {
771
+ U(_, N, 1), U(g, N, 0), U(b, P, 0), U(_, N, 1), U(b, P, 0), U(x, P, 1);
772
+ }
773
+ function K(e, t, n) {
774
+ t ? e ? (U(_, N, 1), U(g, N, 0), U(b, P, 0), U(_, N, 1), U(b, P, 0), U(w, P, 1), U(b, n, 0), U(S, n, 0), U(w, n, .5)) : (U(_, N, 1), U(g, N, 0), U(x, P, 1), U(g, N, 0), U(w, P, 0), U(x, P, 1), U(x, n, 1), U(w, n, 0), U(C, n, 1)) : e ? (U(b, n, 0), U(S, n, 0), U(O, n, .5)) : (U(x, n, 1), U(C, n, 0), U(O, n, .5));
775
+ }
776
+ function q(e, t) {
777
+ t && (e ? (U(_, N, 1), U(g, N, 0), U(b, P, 0), U(_, N, 1), U(b, P, 0), U(w, P, 1), U(b, N, 0), U(O, P, .5), U(w, P, 1), U(O, P, .5), U(S, N, 0), U(w, P, 1)) : (U(_, N, 1), U(g, N, 0), U(x, P, 1), U(g, N, 0), U(w, P, 0), U(x, P, 1), U(x, N, 1), U(w, P, 0), U(O, P, .5), U(O, P, .5), U(w, P, 0), U(C, N, 1)));
778
+ }
779
+ function J(e, n, r, a, s, f) {
780
+ switch (t.strokeLineCap) {
781
+ case "round":
782
+ s ? W(e, r, n, f, .5) : W(e, n, r, f, .5);
783
+ break;
784
+ case "square":
785
+ if (s) c.subVectors(n, e), l.set(c.y, -c.x), u.addVectors(c, l).add(e), d.subVectors(l, c).add(e), a ? (u.toArray(i, 3), d.toArray(i, 0), d.toArray(i, 9)) : (u.toArray(i, 3), o[7] === 1 ? d.toArray(i, 9) : u.toArray(i, 9), d.toArray(i, 0));
786
+ else {
787
+ c.subVectors(r, e), l.set(c.y, -c.x), u.addVectors(c, l).add(e), d.subVectors(l, c).add(e);
788
+ let t = i.length;
789
+ a ? (u.toArray(i, t - 3), d.toArray(i, t - 6), d.toArray(i, t - 12)) : (d.toArray(i, t - 6), u.toArray(i, t - 3), d.toArray(i, t - 12));
790
+ }
791
+ break;
792
+ default: break;
793
+ }
794
+ }
795
+ function Y(e) {
796
+ let t = !1;
797
+ for (let n = 1, i = e.length - 1; n < i; n++) if (e[n].distanceTo(e[n + 1]) < r) {
798
+ t = !0;
799
+ break;
800
+ }
801
+ if (!t) return e;
802
+ let n = [];
803
+ n.push(e[0]);
804
+ for (let t = 1, i = e.length - 1; t < i; t++) e[t].distanceTo(e[t + 1]) >= r && n.push(e[t]);
805
+ return n.push(e[e.length - 1]), n;
806
+ }
807
+ }
808
+ }, _ = new g(), v = .05;
809
+ async function y(e, t) {
810
+ let n = await fetch(e);
811
+ if (!n.ok) throw Error(`Unable to load SVG asset: ${n.status} ${n.statusText}\n${e}`);
812
+ return x(await n.text(), t, e);
813
+ }
814
+ async function b(e, t) {
815
+ return x(await e.text(), t, e.name);
816
+ }
817
+ function x(n, r, i) {
818
+ let a = _.parse(n), o = [];
819
+ if (a.paths.forEach((e) => {
820
+ let n = e.userData?.style;
821
+ S(n) && g.createShapes(e).forEach((e) => {
822
+ o.push(r ? new t.ExtrudeGeometry(e, {
823
+ depth: 1,
824
+ bevelEnabled: !1,
825
+ curveSegments: 12
826
+ }) : new t.ShapeGeometry(e, 12));
827
+ }), C(n) && e.subPaths.forEach((e) => {
828
+ let t = g.pointsToStroke(e.getPoints(24), w(n), 12);
829
+ t && o.push(r ? T(t) : t);
830
+ });
831
+ }), o.length === 0) throw Error(`The SVG asset did not contain drawable paths:\n${i}`);
832
+ let s = e(o, !1);
833
+ if (o.forEach((e) => {
834
+ e !== s && e.dispose();
835
+ }), !s) throw Error(`Unable to merge SVG geometry:\n${i}`);
836
+ return E(s), s;
837
+ }
838
+ function S(e) {
839
+ let t = typeof e?.fill == "string" ? e.fill : "#000", n = typeof e?.fillOpacity == "number" ? e.fillOpacity : 1;
840
+ return t !== "none" && n > 0;
841
+ }
842
+ function C(e) {
843
+ let t = typeof e?.stroke == "string" ? e.stroke : "none", n = typeof e?.strokeOpacity == "number" ? e.strokeOpacity : 1, r = typeof e?.strokeWidth == "number" ? e.strokeWidth : 1;
844
+ return t !== "none" && n > 0 && r > 0;
845
+ }
846
+ function w(e) {
847
+ return g.getStrokeStyle(typeof e?.strokeWidth == "number" ? e.strokeWidth : 1, typeof e?.stroke == "string" ? e.stroke : "#000", typeof e?.strokeLineJoin == "string" ? e.strokeLineJoin : "miter", typeof e?.strokeLineCap == "string" ? e.strokeLineCap : "butt", typeof e?.strokeMiterLimit == "number" ? e.strokeMiterLimit : 4);
848
+ }
849
+ function T(e) {
850
+ let n = e.getAttribute("position"), r = [], i = /* @__PURE__ */ new Map(), a = [], o = (e) => {
851
+ let a = n.getX(e), o = n.getY(e), s = `${a.toFixed(6)},${o.toFixed(6)}`, c = i.get(s);
852
+ if (c !== void 0) return c;
853
+ let l = r.length;
854
+ return r.push(new t.Vector3(a, o, 0)), i.set(s, l), l;
855
+ };
856
+ for (let e = 0; e + 2 < n.count; e += 3) a.push([
857
+ o(e),
858
+ o(e + 1),
859
+ o(e + 2)
860
+ ]);
861
+ let s = [], c = [];
862
+ r.forEach((e) => {
863
+ s.push(e.x, e.y, .5);
864
+ }), r.forEach((e) => {
865
+ s.push(e.x, e.y, -.5);
866
+ });
867
+ let l = /* @__PURE__ */ new Map(), u = (e, t) => {
868
+ let n = e < t ? `${e}:${t}` : `${t}:${e}`, r = l.get(n);
869
+ if (r) {
870
+ r.count += 1;
871
+ return;
872
+ }
873
+ l.set(n, {
874
+ a: e,
875
+ b: t,
876
+ count: 1
877
+ });
878
+ };
879
+ a.forEach(([e, t, n]) => {
880
+ c.push(e, t, n), c.push(n + r.length, t + r.length, e + r.length), u(e, t), u(t, n), u(n, e);
881
+ }), l.forEach(({ a: e, b: t, count: n }) => {
882
+ if (n !== 1) return;
883
+ let i = e + r.length, a = t + r.length;
884
+ c.push(e, t, a), c.push(e, a, i);
885
+ });
886
+ let d = new t.BufferGeometry();
887
+ return d.setAttribute("position", new t.Float32BufferAttribute(s, 3)), d.setIndex(c), d.computeVertexNormals(), e.dispose(), d;
888
+ }
889
+ function E(e) {
890
+ e.computeBoundingBox();
891
+ let n = e.boundingBox;
892
+ if (!n) return;
893
+ let r = new t.Vector3(), i = new t.Vector3();
894
+ n.getSize(r), n.getCenter(i);
895
+ let a = Math.max(r.x, r.y);
896
+ if (e.translate(-i.x, -i.y, -i.z), a > 0) {
897
+ let t = 1 / a, n = r.z > 0 ? v / r.z : t * v;
898
+ e.scale(t, -t, n);
899
+ } else e.scale(1, -1, 1);
900
+ e.computeVertexNormals(), e.computeBoundingBox(), e.computeBoundingSphere();
901
+ }
902
+ //#endregion
903
+ export { y as loadSvgAssetGeometry, b as loadSvgAssetGeometryFromFile };