@mlightcad/geometry-engine 3.2.15 → 3.2.17

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.
Files changed (34) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +174 -174
  3. package/dist/geometry-engine.js +801 -652
  4. package/dist/geometry-engine.umd.cjs +1 -1
  5. package/lib/geometry/AcGeArea2d.d.ts +1 -1
  6. package/lib/geometry/AcGeArea2d.d.ts.map +1 -1
  7. package/lib/geometry/AcGeArea2d.js +4 -2
  8. package/lib/geometry/AcGeArea2d.js.map +1 -1
  9. package/lib/geometry/AcGeCircArc2d.d.ts.map +1 -1
  10. package/lib/geometry/AcGeCircArc2d.js +27 -1
  11. package/lib/geometry/AcGeCircArc2d.js.map +1 -1
  12. package/lib/geometry/AcGeCircArc3d.d.ts.map +1 -1
  13. package/lib/geometry/AcGeCircArc3d.js +26 -15
  14. package/lib/geometry/AcGeCircArc3d.js.map +1 -1
  15. package/lib/geometry/AcGeEllipseArc2d.d.ts +1 -0
  16. package/lib/geometry/AcGeEllipseArc2d.d.ts.map +1 -1
  17. package/lib/geometry/AcGeEllipseArc2d.js +38 -0
  18. package/lib/geometry/AcGeEllipseArc2d.js.map +1 -1
  19. package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -1
  20. package/lib/geometry/AcGeEllipseArc3d.js +39 -0
  21. package/lib/geometry/AcGeEllipseArc3d.js.map +1 -1
  22. package/lib/geometry/AcGeLoop2d.d.ts +1 -1
  23. package/lib/geometry/AcGeLoop2d.d.ts.map +1 -1
  24. package/lib/geometry/AcGeLoop2d.js +11 -3
  25. package/lib/geometry/AcGeLoop2d.js.map +1 -1
  26. package/lib/geometry/AcGePolyline2d.d.ts +1 -1
  27. package/lib/geometry/AcGePolyline2d.d.ts.map +1 -1
  28. package/lib/geometry/AcGePolyline2d.js +10 -2
  29. package/lib/geometry/AcGePolyline2d.js.map +1 -1
  30. package/lib/geometry/AcGeSpline3d.d.ts +1 -1
  31. package/lib/geometry/AcGeSpline3d.d.ts.map +1 -1
  32. package/lib/geometry/AcGeSpline3d.js +21 -2
  33. package/lib/geometry/AcGeSpline3d.js.map +1 -1
  34. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- import { AcCmErrors as q } from "@mlightcad/common";
2
- const R = [
1
+ import { AcCmErrors as L } from "@mlightcad/common";
2
+ const N = [
3
3
  "00",
4
4
  "01",
5
5
  "02",
@@ -257,100 +257,100 @@ const R = [
257
257
  "fe",
258
258
  "ff"
259
259
  ];
260
- let Nt = 1234567;
261
- const Ft = Math.PI / 180, Xt = 180 / Math.PI;
260
+ let Rt = 1234567;
261
+ const Xt = Math.PI / 180, Dt = 180 / Math.PI;
262
262
  function Jt() {
263
- const u = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
264
- return (R[u & 255] + R[u >> 8 & 255] + R[u >> 16 & 255] + R[u >> 24 & 255] + "-" + R[t & 255] + R[t >> 8 & 255] + "-" + R[t >> 16 & 15 | 64] + R[t >> 24 & 255] + "-" + R[s & 63 | 128] + R[s >> 8 & 255] + "-" + R[s >> 16 & 255] + R[s >> 24 & 255] + R[e & 255] + R[e >> 8 & 255] + R[e >> 16 & 255] + R[e >> 24 & 255]).toLowerCase();
263
+ const d = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
264
+ return (N[d & 255] + N[d >> 8 & 255] + N[d >> 16 & 255] + N[d >> 24 & 255] + "-" + N[t & 255] + N[t >> 8 & 255] + "-" + N[t >> 16 & 15 | 64] + N[t >> 24 & 255] + "-" + N[s & 63 | 128] + N[s >> 8 & 255] + "-" + N[s >> 16 & 255] + N[s >> 24 & 255] + N[e & 255] + N[e >> 8 & 255] + N[e >> 16 & 255] + N[e >> 24 & 255]).toLowerCase();
265
265
  }
266
- function v(u, t, s) {
267
- return Math.max(t, Math.min(s, u));
266
+ function Z(d, t, s) {
267
+ return Math.max(t, Math.min(s, d));
268
268
  }
269
- function Yt(u, t) {
270
- return (u % t + t) % t;
269
+ function Yt(d, t) {
270
+ return (d % t + t) % t;
271
271
  }
272
- function ts(u, t, s, e, n) {
273
- return e + (u - t) * (n - e) / (s - t);
272
+ function ts(d, t, s, e, n) {
273
+ return e + (d - t) * (n - e) / (s - t);
274
274
  }
275
- function ss(u, t, s) {
276
- return u !== t ? (s - u) / (t - u) : 0;
275
+ function ss(d, t, s) {
276
+ return d !== t ? (s - d) / (t - d) : 0;
277
277
  }
278
- function Dt(u, t, s) {
279
- return (1 - s) * u + s * t;
278
+ function vt(d, t, s) {
279
+ return (1 - s) * d + s * t;
280
280
  }
281
- function es(u, t, s, e) {
282
- return Dt(u, t, 1 - Math.exp(-s * e));
281
+ function es(d, t, s, e) {
282
+ return vt(d, t, 1 - Math.exp(-s * e));
283
283
  }
284
- function ns(u, t = 1) {
285
- return t - Math.abs(Yt(u, t * 2) - t);
284
+ function ns(d, t = 1) {
285
+ return t - Math.abs(Yt(d, t * 2) - t);
286
286
  }
287
- function is(u, t, s) {
288
- return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * (3 - 2 * u));
287
+ function is(d, t, s) {
288
+ return d <= t ? 0 : d >= s ? 1 : (d = (d - t) / (s - t), d * d * (3 - 2 * d));
289
289
  }
290
- function rs(u, t, s) {
291
- return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * u * (u * (u * 6 - 15) + 10));
290
+ function rs(d, t, s) {
291
+ return d <= t ? 0 : d >= s ? 1 : (d = (d - t) / (s - t), d * d * d * (d * (d * 6 - 15) + 10));
292
292
  }
293
- function hs(u, t) {
294
- return u + Math.floor(Math.random() * (t - u + 1));
293
+ function os(d, t) {
294
+ return d + Math.floor(Math.random() * (t - d + 1));
295
295
  }
296
- function os(u, t) {
297
- return u + Math.random() * (t - u);
296
+ function hs(d, t) {
297
+ return d + Math.random() * (t - d);
298
298
  }
299
- function as(u) {
300
- return u * (0.5 - Math.random());
299
+ function as(d) {
300
+ return d * (0.5 - Math.random());
301
301
  }
302
- function cs(u) {
303
- u !== void 0 && (Nt = u);
304
- let t = Nt += 1831565813;
302
+ function cs(d) {
303
+ d !== void 0 && (Rt = d);
304
+ let t = Rt += 1831565813;
305
305
  return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
306
306
  }
307
- function ls(u) {
308
- return u * Ft;
307
+ function ls(d) {
308
+ return d * Xt;
309
309
  }
310
- function us(u) {
311
- return u * Xt;
310
+ function us(d) {
311
+ return d * Dt;
312
312
  }
313
- function ds(u) {
314
- return (u & u - 1) === 0 && u !== 0;
313
+ function ds(d) {
314
+ return (d & d - 1) === 0 && d !== 0;
315
315
  }
316
- function ms(u) {
317
- return Math.pow(2, Math.ceil(Math.log(u) / Math.LN2));
316
+ function ms(d) {
317
+ return Math.pow(2, Math.ceil(Math.log(d) / Math.LN2));
318
318
  }
319
- function xs(u) {
320
- return Math.pow(2, Math.floor(Math.log(u) / Math.LN2));
319
+ function xs(d) {
320
+ return Math.pow(2, Math.floor(Math.log(d) / Math.LN2));
321
321
  }
322
- function yt(u) {
322
+ function pt(d) {
323
323
  const t = Math.PI * 2;
324
- return (u % t + t) % t;
324
+ return (d % t + t) % t;
325
325
  }
326
- function gs(u, t, s) {
327
- return u > t && u < s || u > s && u < t;
326
+ function gs(d, t, s) {
327
+ return d > t && d < s || d > s && d < t;
328
328
  }
329
- function ys(u, t, s, e = !1) {
330
- return u = yt(u), t = yt(t), s = yt(s), e ? t > s ? u <= t && u >= s : u <= t || u >= s : t < s ? u >= t && u <= s : u >= t || u <= s;
329
+ function ys(d, t, s, e = !1) {
330
+ return d = pt(d), t = pt(t), s = pt(s), e ? t > s ? d <= t && d >= s : d <= t || d >= s : t < s ? d >= t && d <= s : d >= t || d <= s;
331
331
  }
332
- function Zt(u) {
333
- return u = Math.abs(u), u < 1 ? 0 : Math.ceil(Math.log10(Math.abs(u) + 1));
332
+ function Zt(d) {
333
+ return d = Math.abs(d), d < 1 ? 0 : Math.ceil(Math.log10(Math.abs(d) + 1));
334
334
  }
335
- function _s(u, t = 1e-7) {
336
- const s = Zt(u);
335
+ function _s(d, t = 1e-7) {
336
+ const s = Zt(d);
337
337
  return Math.max(Math.pow(10, s) * t, t);
338
338
  }
339
- const b = {
340
- DEG2RAD: Ft,
341
- RAD2DEG: Xt,
339
+ const M = {
340
+ DEG2RAD: Xt,
341
+ RAD2DEG: Dt,
342
342
  generateUUID: Jt,
343
- clamp: v,
343
+ clamp: Z,
344
344
  euclideanModulo: Yt,
345
345
  mapLinear: ts,
346
346
  inverseLerp: ss,
347
- lerp: Dt,
347
+ lerp: vt,
348
348
  damp: es,
349
349
  pingpong: ns,
350
350
  smoothstep: is,
351
351
  smootherstep: rs,
352
- randInt: hs,
353
- randFloat: os,
352
+ randInt: os,
353
+ randFloat: hs,
354
354
  randFloatSpread: as,
355
355
  seededRandom: cs,
356
356
  degToRad: ls,
@@ -358,12 +358,12 @@ const b = {
358
358
  isPowerOfTwo: ds,
359
359
  ceilPowerOfTwo: ms,
360
360
  floorPowerOfTwo: xs,
361
- normalizeAngle: yt,
361
+ normalizeAngle: pt,
362
362
  isBetween: gs,
363
363
  isBetweenAngle: ys,
364
364
  intPartLength: Zt,
365
365
  relativeEps: _s
366
- }, H = class H {
366
+ }, tt = class tt {
367
367
  constructor(t, s) {
368
368
  this.x = 0, this.y = 0;
369
369
  const e = +(t !== void 0) + +(s !== void 0);
@@ -381,7 +381,7 @@ const b = {
381
381
  this.x = t, this.y = s;
382
382
  return;
383
383
  }
384
- throw q.ILLEGAL_PARAMETERS;
384
+ throw L.ILLEGAL_PARAMETERS;
385
385
  }
386
386
  }
387
387
  get width() {
@@ -432,7 +432,7 @@ const b = {
432
432
  }
433
433
  }
434
434
  clone() {
435
- return new H(this.x, this.y);
435
+ return new tt(this.x, this.y);
436
436
  }
437
437
  copy(t) {
438
438
  return this.x = t.x, this.y = t.y, this;
@@ -571,23 +571,23 @@ const b = {
571
571
  }
572
572
  relativeEps(t = 1e-7) {
573
573
  return Math.min(
574
- b.relativeEps(this.x, t),
575
- b.relativeEps(this.y, t)
574
+ M.relativeEps(this.x, t),
575
+ M.relativeEps(this.y, t)
576
576
  );
577
577
  }
578
578
  *[Symbol.iterator]() {
579
579
  yield this.x, yield this.y;
580
580
  }
581
581
  };
582
- H.EMPTY = Object.freeze(new H(0, 0));
583
- let B = H;
584
- const W = class W {
585
- constructor(t, s, e, n, i, r, h, a, o) {
586
- this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && h != null && a != null && o != null && this.set(t, s, e, n, i, r, h, a, o);
582
+ tt.EMPTY = Object.freeze(new tt(0, 0));
583
+ let B = tt;
584
+ const st = class st {
585
+ constructor(t, s, e, n, i, r, o, a, h) {
586
+ this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && o != null && a != null && h != null && this.set(t, s, e, n, i, r, o, a, h);
587
587
  }
588
- set(t, s, e, n, i, r, h, a, o) {
588
+ set(t, s, e, n, i, r, o, a, h) {
589
589
  const c = this.elements;
590
- return c[0] = t, c[1] = n, c[2] = h, c[3] = s, c[4] = i, c[5] = a, c[6] = e, c[7] = r, c[8] = o, this;
590
+ return c[0] = t, c[1] = n, c[2] = o, c[3] = s, c[4] = i, c[5] = a, c[6] = e, c[7] = r, c[8] = h, this;
591
591
  }
592
592
  identity() {
593
593
  return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
@@ -610,22 +610,22 @@ const W = class W {
610
610
  return this.multiplyMatrices(t, this);
611
611
  }
612
612
  multiplyMatrices(t, s) {
613
- const e = t.elements, n = s.elements, i = this.elements, r = e[0], h = e[3], a = e[6], o = e[1], c = e[4], l = e[7], m = e[2], d = e[5], x = e[8], g = n[0], y = n[3], _ = n[6], M = n[1], A = n[4], P = n[7], z = n[2], E = n[5], f = n[8];
614
- return i[0] = r * g + h * M + a * z, i[3] = r * y + h * A + a * E, i[6] = r * _ + h * P + a * f, i[1] = o * g + c * M + l * z, i[4] = o * y + c * A + l * E, i[7] = o * _ + c * P + l * f, i[2] = m * g + d * M + x * z, i[5] = m * y + d * A + x * E, i[8] = m * _ + d * P + x * f, this;
613
+ const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[3], a = e[6], h = e[1], c = e[4], l = e[7], m = e[2], u = e[5], x = e[8], g = n[0], y = n[3], _ = n[6], z = n[1], f = n[4], b = n[7], P = n[2], I = n[5], A = n[8];
614
+ return i[0] = r * g + o * z + a * P, i[3] = r * y + o * f + a * I, i[6] = r * _ + o * b + a * A, i[1] = h * g + c * z + l * P, i[4] = h * y + c * f + l * I, i[7] = h * _ + c * b + l * A, i[2] = m * g + u * z + x * P, i[5] = m * y + u * f + x * I, i[8] = m * _ + u * b + x * A, this;
615
615
  }
616
616
  multiplyScalar(t) {
617
617
  const s = this.elements;
618
618
  return s[0] *= t, s[3] *= t, s[6] *= t, s[1] *= t, s[4] *= t, s[7] *= t, s[2] *= t, s[5] *= t, s[8] *= t, this;
619
619
  }
620
620
  determinant() {
621
- const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], h = t[5], a = t[6], o = t[7], c = t[8];
622
- return s * r * c - s * h * o - e * i * c + e * h * a + n * i * o - n * r * a;
621
+ const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8];
622
+ return s * r * c - s * o * h - e * i * c + e * o * a + n * i * h - n * r * a;
623
623
  }
624
624
  invert() {
625
- const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], h = t[5], a = t[6], o = t[7], c = t[8], l = c * r - h * o, m = h * a - c * i, d = o * i - r * a, x = s * l + e * m + n * d;
625
+ const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = c * r - o * h, m = o * a - c * i, u = h * i - r * a, x = s * l + e * m + n * u;
626
626
  if (x === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
627
627
  const g = 1 / x;
628
- return t[0] = l * g, t[1] = (n * o - c * e) * g, t[2] = (h * e - n * r) * g, t[3] = m * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - h * s) * g, t[6] = d * g, t[7] = (e * a - o * s) * g, t[8] = (r * s - e * i) * g, this;
628
+ return t[0] = l * g, t[1] = (n * h - c * e) * g, t[2] = (o * e - n * r) * g, t[3] = m * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - o * s) * g, t[6] = u * g, t[7] = (e * a - h * s) * g, t[8] = (r * s - e * i) * g, this;
629
629
  }
630
630
  transpose() {
631
631
  let t;
@@ -639,28 +639,28 @@ const W = class W {
639
639
  const s = this.elements;
640
640
  return t.elements[0] = s[0], t.elements[1] = s[3], t.elements[2] = s[6], t.elements[3] = s[1], t.elements[4] = s[4], t.elements[5] = s[7], t.elements[6] = s[2], t.elements[7] = s[5], t.elements[8] = s[8], this;
641
641
  }
642
- setUvTransform(t, s, e, n, i, r, h) {
643
- const a = Math.cos(i), o = Math.sin(i);
642
+ setUvTransform(t, s, e, n, i, r, o) {
643
+ const a = Math.cos(i), h = Math.sin(i);
644
644
  return this.set(
645
645
  e * a,
646
- e * o,
647
- -e * (a * r + o * h) + r + t,
648
- -n * o,
646
+ e * h,
647
+ -e * (a * r + h * o) + r + t,
648
+ -n * h,
649
649
  n * a,
650
- -n * (-o * r + a * h) + h + s,
650
+ -n * (-h * r + a * o) + o + s,
651
651
  0,
652
652
  0,
653
653
  1
654
654
  ), this;
655
655
  }
656
656
  scale(t, s) {
657
- return this.premultiply(St.makeScale(t, s)), this;
657
+ return this.premultiply(Ct.makeScale(t, s)), this;
658
658
  }
659
659
  rotate(t) {
660
- return this.premultiply(St.makeRotation(-t)), this;
660
+ return this.premultiply(Ct.makeRotation(-t)), this;
661
661
  }
662
662
  translate(t, s) {
663
- return this.premultiply(St.makeTranslation(t, s)), this;
663
+ return this.premultiply(Ct.makeTranslation(t, s)), this;
664
664
  }
665
665
  makeTranslation(t, s) {
666
666
  return t instanceof B ? this.set(1, 0, t.x, 0, 1, t.y, 0, 0, 1) : this.set(1, 0, t, 0, 1, s, 0, 0, 1), this;
@@ -688,22 +688,22 @@ const W = class W {
688
688
  return t[s] = e[0], t[s + 1] = e[1], t[s + 2] = e[2], t[s + 3] = e[3], t[s + 4] = e[4], t[s + 5] = e[5], t[s + 6] = e[6], t[s + 7] = e[7], t[s + 8] = e[8], t;
689
689
  }
690
690
  clone() {
691
- return new W().fromArray(this.elements);
691
+ return new st().fromArray(this.elements);
692
692
  }
693
693
  };
694
- W.IDENTITY = Object.freeze(new W());
695
- let st = W;
696
- const St = new st(), Q = 1e-6, I = 2 * Math.PI, Bs = {
694
+ st.IDENTITY = Object.freeze(new st());
695
+ let it = st;
696
+ const Ct = new it(), G = 1e-6, E = 2 * Math.PI, Bs = {
697
697
  x: 0,
698
698
  y: 0
699
- }, vt = {
699
+ }, Ot = {
700
700
  x: 0,
701
701
  y: 0,
702
702
  z: 0
703
703
  };
704
- class Gt {
704
+ class Qt {
705
705
  constructor() {
706
- this.equalPointTol = Q, this.equalVectorTol = Q;
706
+ this.equalPointTol = G, this.equalVectorTol = G;
707
707
  }
708
708
  equalPoint2d(t, s) {
709
709
  return new B(t).sub(s).length() < this.equalPointTol;
@@ -711,50 +711,50 @@ class Gt {
711
711
  equalPoint3d(t, s) {
712
712
  return new p(t).sub(s).length() < this.equalPointTol;
713
713
  }
714
- static equalToZero(t, s = Q) {
714
+ static equalToZero(t, s = G) {
715
715
  return t < s && t > -s;
716
716
  }
717
- static equal(t, s, e = Q) {
717
+ static equal(t, s, e = G) {
718
718
  return Math.abs(t - s) < e;
719
719
  }
720
- static great(t, s, e = Q) {
720
+ static great(t, s, e = G) {
721
721
  return t - s > e;
722
722
  }
723
- static less(t, s, e = Q) {
723
+ static less(t, s, e = G) {
724
724
  return t - s < e;
725
725
  }
726
726
  }
727
- const Ot = new Gt();
728
- function Qt(u, t, s = !1) {
729
- const e = u.x, n = u.y;
727
+ const Kt = new Qt();
728
+ function Gt(d, t, s = !1) {
729
+ const e = d.x, n = d.y;
730
730
  let i = !1;
731
731
  const r = t.length;
732
- for (let h = 0, a = r - 1; h < r; a = h++) {
733
- const o = t[h].x, c = t[h].y, l = t[a].x, m = t[a].y;
734
- let d = c > n != m > n;
735
- s && (d = c >= n != m >= n), d && e < (l - o) * (n - c) / (m - c) + o && (i = !i);
732
+ for (let o = 0, a = r - 1; o < r; a = o++) {
733
+ const h = t[o].x, c = t[o].y, l = t[a].x, m = t[a].y;
734
+ let u = c > n != m > n;
735
+ s && (u = c >= n != m >= n), u && e < (l - h) * (n - c) / (m - c) + h && (i = !i);
736
736
  }
737
737
  return i;
738
738
  }
739
- function ps(u, t) {
740
- if (u.length === 0 || t.length === 0)
739
+ function ps(d, t) {
740
+ if (d.length === 0 || t.length === 0)
741
741
  return !1;
742
- const s = new F().setFromPoints(u), e = new F().setFromPoints(t);
742
+ const s = new F().setFromPoints(d), e = new F().setFromPoints(t);
743
743
  if (!s.intersectsBox(e))
744
744
  return !1;
745
- for (let n = 0; n < u.length; ) {
746
- if (Qt(u[n], t, !0))
745
+ for (let n = 0; n < d.length; ) {
746
+ if (Gt(d[n], t, !0))
747
747
  return !0;
748
- n < u.length - 1 && Ot.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
748
+ n < d.length - 1 && Kt.equalPoint2d(d[n + 1], d[n]) && ++n, ++n;
749
749
  }
750
750
  return !1;
751
751
  }
752
- const As = {
753
- isPointInPolygon: Qt,
752
+ const fs = {
753
+ isPointInPolygon: Gt,
754
754
  isPolygonIntersect: ps
755
755
  };
756
- function ks(u, t) {
757
- const s = [], e = t - 1, n = u;
756
+ function ks(d, t) {
757
+ const s = [], e = t - 1, n = d;
758
758
  for (let i = 0; i <= n; i++)
759
759
  s.push(0);
760
760
  for (let i = 1; i <= e - n; i++)
@@ -763,230 +763,230 @@ function ks(u, t) {
763
763
  s.push(e - n + 1);
764
764
  return s;
765
765
  }
766
- function Ns(u, t) {
767
- const s = t.length - 1, e = u, n = [0];
766
+ function Rs(d, t) {
767
+ const s = t.length - 1, e = d, n = [0];
768
768
  let i = 0;
769
- for (let h = 1; h <= s; h++) {
770
- const a = t[h][0] - t[h - 1][0], o = t[h][1] - t[h - 1][1], c = t[h][2] - t[h - 1][2], l = Math.sqrt(a * a + o * o + c * c);
769
+ for (let o = 1; o <= s; o++) {
770
+ const a = t[o][0] - t[o - 1][0], h = t[o][1] - t[o - 1][1], c = t[o][2] - t[o - 1][2], l = Math.sqrt(a * a + h * h + c * c);
771
771
  i += l, n.push(i);
772
772
  }
773
773
  const r = [];
774
- for (let h = 0; h <= e; h++)
774
+ for (let o = 0; o <= e; o++)
775
775
  r.push(0);
776
- for (let h = 1; h <= s - e; h++) {
777
- const a = n[h] / i;
776
+ for (let o = 1; o <= s - e; o++) {
777
+ const a = n[o] / i;
778
778
  r.push(a * (s - e + 1));
779
779
  }
780
- for (let h = 0; h <= e; h++)
780
+ for (let o = 0; o <= e; o++)
781
781
  r.push(s - e + 1);
782
782
  return r;
783
783
  }
784
- function fs(u, t = "Uniform") {
785
- const s = u.length;
784
+ function As(d, t = "Uniform") {
785
+ const s = d.length;
786
786
  if (s === 0)
787
787
  return [];
788
788
  if (s === 1)
789
789
  return [0];
790
790
  const e = s - 1;
791
791
  if (t === "Uniform")
792
- return new Array(s).fill(0).map((r, h) => h / e);
792
+ return new Array(s).fill(0).map((r, o) => o / e);
793
793
  const n = [0];
794
794
  let i = 0;
795
795
  for (let r = 1; r <= e; r++) {
796
- const h = u[r][0] - u[r - 1][0], a = u[r][1] - u[r - 1][1], o = u[r][2] - u[r - 1][2], c = Math.sqrt(h * h + a * a + o * o), l = t === "SqrtChord" ? Math.sqrt(c) : c;
796
+ const o = d[r][0] - d[r - 1][0], a = d[r][1] - d[r - 1][1], h = d[r][2] - d[r - 1][2], c = Math.sqrt(o * o + a * a + h * h), l = t === "SqrtChord" ? Math.sqrt(c) : c;
797
797
  i += l, n.push(i);
798
798
  }
799
- return i < 1e-12 ? new Array(s).fill(0).map((r, h) => h / e) : n.map((r) => r / i);
799
+ return i < 1e-12 ? new Array(s).fill(0).map((r, o) => o / e) : n.map((r) => r / i);
800
800
  }
801
- function zs(u, t) {
802
- const s = t.length - 1, e = u, n = s + e + 1, i = new Array(n + 1).fill(0), r = t[t.length - 1];
803
- for (let h = n - e; h <= n; h++)
804
- i[h] = r;
805
- for (let h = 1; h <= s - e; h++) {
801
+ function zs(d, t) {
802
+ const s = t.length - 1, e = d, n = s + e + 1, i = new Array(n + 1).fill(0), r = t[t.length - 1];
803
+ for (let o = n - e; o <= n; o++)
804
+ i[o] = r;
805
+ for (let o = 1; o <= s - e; o++) {
806
806
  let a = 0;
807
- for (let o = h; o < h + e; o++)
808
- a += t[o];
809
- i[h + e] = a / e;
807
+ for (let h = o; h < o + e; h++)
808
+ a += t[h];
809
+ i[o + e] = a / e;
810
810
  }
811
811
  return i;
812
812
  }
813
- function Rs(u, t) {
814
- const s = t.length - 1, e = u, n = [0];
813
+ function Ns(d, t) {
814
+ const s = t.length - 1, e = d, n = [0];
815
815
  let i = 0;
816
- for (let h = 1; h <= s; h++) {
817
- const a = t[h][0] - t[h - 1][0], o = t[h][1] - t[h - 1][1], c = t[h][2] - t[h - 1][2], l = Math.sqrt(a * a + o * o + c * c), m = Math.sqrt(l);
816
+ for (let o = 1; o <= s; o++) {
817
+ const a = t[o][0] - t[o - 1][0], h = t[o][1] - t[o - 1][1], c = t[o][2] - t[o - 1][2], l = Math.sqrt(a * a + h * h + c * c), m = Math.sqrt(l);
818
818
  i += m, n.push(i);
819
819
  }
820
820
  const r = [];
821
- for (let h = 0; h <= e; h++)
821
+ for (let o = 0; o <= e; o++)
822
822
  r.push(0);
823
- for (let h = 1; h <= s - e; h++) {
824
- const a = n[h] / i;
823
+ for (let o = 1; o <= s - e; o++) {
824
+ const a = n[o] / i;
825
825
  r.push(a * (s - e + 1));
826
826
  }
827
- for (let h = 0; h <= e; h++)
827
+ for (let o = 0; o <= e; o++)
828
828
  r.push(s - e + 1);
829
829
  return r;
830
830
  }
831
- function Ct(u, t) {
832
- const s = u.length, e = u.map((r) => r.slice()), n = t.slice();
831
+ function Et(d, t) {
832
+ const s = d.length, e = d.map((r) => r.slice()), n = t.slice();
833
833
  for (let r = 0; r < s; r++) {
834
- let h = r, a = Math.abs(e[r][r]);
835
- for (let o = r + 1; o < s; o++) {
836
- const c = Math.abs(e[o][r]);
837
- c > a && (a = c, h = o);
834
+ let o = r, a = Math.abs(e[r][r]);
835
+ for (let h = r + 1; h < s; h++) {
836
+ const c = Math.abs(e[h][r]);
837
+ c > a && (a = c, o = h);
838
838
  }
839
839
  if (a < 1e-12)
840
840
  throw new Error("Interpolation matrix is singular.");
841
- if (h !== r) {
842
- const o = e[r];
843
- e[r] = e[h], e[h] = o;
841
+ if (o !== r) {
842
+ const h = e[r];
843
+ e[r] = e[o], e[o] = h;
844
844
  const c = n[r];
845
- n[r] = n[h], n[h] = c;
845
+ n[r] = n[o], n[o] = c;
846
846
  }
847
- for (let o = r + 1; o < s; o++) {
848
- const c = e[o][r] / e[r][r];
847
+ for (let h = r + 1; h < s; h++) {
848
+ const c = e[h][r] / e[r][r];
849
849
  if (!(Math.abs(c) < 1e-14)) {
850
850
  for (let l = r; l < s; l++)
851
- e[o][l] -= c * e[r][l];
852
- n[o] -= c * n[r];
851
+ e[h][l] -= c * e[r][l];
852
+ n[h] -= c * n[r];
853
853
  }
854
854
  }
855
855
  }
856
856
  const i = new Array(s).fill(0);
857
857
  for (let r = s - 1; r >= 0; r--) {
858
- let h = n[r];
858
+ let o = n[r];
859
859
  for (let a = r + 1; a < s; a++)
860
- h -= e[r][a] * i[a];
861
- i[r] = h / e[r][r];
860
+ o -= e[r][a] * i[a];
861
+ i[r] = o / e[r][r];
862
862
  }
863
863
  return i;
864
864
  }
865
- function Kt(u, t, s = "Uniform", e, n) {
866
- if (u.length === 0)
865
+ function $t(d, t, s = "Uniform", e, n) {
866
+ if (d.length === 0)
867
867
  return { controlPoints: [], knots: [], weights: [] };
868
- const i = u.map((w) => [w[0], w[1], w[2] ?? 0]), r = !!e, h = !!n, a = (r ? 1 : 0) + (h ? 1 : 0), o = i.length - 1, c = o + a;
868
+ const i = d.map((S) => [S[0], S[1], S[2] ?? 0]), r = !!e, o = !!n, a = (r ? 1 : 0) + (o ? 1 : 0), h = i.length - 1, c = h + a;
869
869
  if (c < t)
870
870
  throw new Error("Not enough points to interpolate a curve of this degree.");
871
- const l = fs(i, s), m = l.slice();
872
- r && m.unshift(l[0]), h && m.push(l[l.length - 1]);
873
- const d = zs(t, m), x = c + 1, g = new Array(x), y = new Array(x), _ = new Array(x), M = new Array(x);
874
- let A = 0;
875
- g[A] = new Array(x).fill(0), g[A][0] = 1, y[A] = i[0][0], _[A] = i[0][1], M[A] = i[0][2], A++;
876
- for (let w = 1; w <= o - 1; w++) {
877
- const T = l[w];
878
- g[A] = new Array(x).fill(0);
879
- for (let V = 0; V <= c; V++)
880
- g[A][V] = At(V, t, T, d);
881
- y[A] = i[w][0], _[A] = i[w][1], M[A] = i[w][2], A++;
882
- }
883
- if (g[A] = new Array(x).fill(0), g[A][c] = 1, y[A] = i[o][0], _[A] = i[o][1], M[A] = i[o][2], A++, r) {
884
- const w = d[t + 1] - d[0], T = w !== 0 ? t / w : 0;
885
- g[A] = new Array(x).fill(0), g[A][0] = -T, g[A][1] = T, y[A] = (e == null ? void 0 : e[0]) ?? 0, _[A] = (e == null ? void 0 : e[1]) ?? 0, M[A] = (e == null ? void 0 : e[2]) ?? 0, A++;
886
- }
887
- if (h) {
888
- const w = d[c + t + 1] - d[c], T = w !== 0 ? t / w : 0;
889
- g[A] = new Array(x).fill(0), g[A][c - 1] = -T, g[A][c] = T, y[A] = (n == null ? void 0 : n[0]) ?? 0, _[A] = (n == null ? void 0 : n[1]) ?? 0, M[A] = (n == null ? void 0 : n[2]) ?? 0, A++;
890
- }
891
- const P = Ct(g, y), z = Ct(g, _), E = Ct(g, M), f = new Array(x);
892
- for (let w = 0; w < x; w++)
893
- f[w] = [P[w], z[w], E[w]];
871
+ const l = As(i, s), m = l.slice();
872
+ r && m.unshift(l[0]), o && m.push(l[l.length - 1]);
873
+ const u = zs(t, m), x = c + 1, g = new Array(x), y = new Array(x), _ = new Array(x), z = new Array(x);
874
+ let f = 0;
875
+ g[f] = new Array(x).fill(0), g[f][0] = 1, y[f] = i[0][0], _[f] = i[0][1], z[f] = i[0][2], f++;
876
+ for (let S = 1; S <= h - 1; S++) {
877
+ const T = l[S];
878
+ g[f] = new Array(x).fill(0);
879
+ for (let U = 0; U <= c; U++)
880
+ g[f][U] = wt(U, t, T, u);
881
+ y[f] = i[S][0], _[f] = i[S][1], z[f] = i[S][2], f++;
882
+ }
883
+ if (g[f] = new Array(x).fill(0), g[f][c] = 1, y[f] = i[h][0], _[f] = i[h][1], z[f] = i[h][2], f++, r) {
884
+ const S = u[t + 1] - u[0], T = S !== 0 ? t / S : 0;
885
+ g[f] = new Array(x).fill(0), g[f][0] = -T, g[f][1] = T, y[f] = (e == null ? void 0 : e[0]) ?? 0, _[f] = (e == null ? void 0 : e[1]) ?? 0, z[f] = (e == null ? void 0 : e[2]) ?? 0, f++;
886
+ }
887
+ if (o) {
888
+ const S = u[c + t + 1] - u[c], T = S !== 0 ? t / S : 0;
889
+ g[f] = new Array(x).fill(0), g[f][c - 1] = -T, g[f][c] = T, y[f] = (n == null ? void 0 : n[0]) ?? 0, _[f] = (n == null ? void 0 : n[1]) ?? 0, z[f] = (n == null ? void 0 : n[2]) ?? 0, f++;
890
+ }
891
+ const b = Et(g, y), P = Et(g, _), I = Et(g, z), A = new Array(x);
892
+ for (let S = 0; S < x; S++)
893
+ A[S] = [b[S], P[S], I[S]];
894
894
  const k = new Array(x).fill(1);
895
- return { controlPoints: f, knots: d, weights: k };
895
+ return { controlPoints: A, knots: u, weights: k };
896
896
  }
897
- function At(u, t, s, e) {
897
+ function wt(d, t, s, e) {
898
898
  if (t === 0)
899
- return s >= e[u] && s < e[u + 1] ? 1 : 0;
900
- const n = e[u + t] - e[u], i = e[u + t + 1] - e[u + 1], r = n > 1e-10 ? (s - e[u]) / n : 0, h = i > 1e-10 ? (e[u + t + 1] - s) / i : 0;
901
- return r * At(u, t - 1, s, e) + h * At(u + 1, t - 1, s, e);
899
+ return s >= e[d] && s < e[d + 1] ? 1 : 0;
900
+ const n = e[d + t] - e[d], i = e[d + t + 1] - e[d + 1], r = n > 1e-10 ? (s - e[d]) / n : 0, o = i > 1e-10 ? (e[d + t + 1] - s) / i : 0;
901
+ return r * wt(d, t - 1, s, e) + o * wt(d + 1, t - 1, s, e);
902
902
  }
903
- function _t(u, t, s, e, n) {
903
+ function ft(d, t, s, e, n) {
904
904
  const i = e.length - 1, r = t;
905
- if (u = Math.max(s[r], Math.min(s[i + 1], u)), Math.abs(u - s[i + 1]) < 1e-8)
905
+ if (d = Math.max(s[r], Math.min(s[i + 1], d)), Math.abs(d - s[i + 1]) < 1e-8)
906
906
  return [...e[i]];
907
- if (Math.abs(u - s[r]) < 1e-8)
907
+ if (Math.abs(d - s[r]) < 1e-8)
908
908
  return [...e[0]];
909
- const h = [0, 0, 0];
909
+ const o = [0, 0, 0];
910
910
  let a = 0;
911
- for (let o = 0; o <= i; o++) {
912
- const c = At(o, r, u, s), l = n[o] * c;
913
- h[0] += e[o][0] * l, h[1] += e[o][1] * l, h[2] += e[o][2] * l, a += l;
911
+ for (let h = 0; h <= i; h++) {
912
+ const c = wt(h, r, d, s), l = n[h] * c;
913
+ o[0] += e[h][0] * l, o[1] += e[h][1] * l, o[2] += e[h][2] * l, a += l;
914
914
  }
915
915
  if (Math.abs(a) < 1e-10) {
916
- const o = s[s.length - r - 1];
917
- if (Math.abs(u - o) < 1e-8)
916
+ const h = s[s.length - r - 1];
917
+ if (Math.abs(d - h) < 1e-8)
918
918
  return [...e[i]];
919
- if (Math.abs(u - s[r]) < 1e-8)
919
+ if (Math.abs(d - s[r]) < 1e-8)
920
920
  return [...e[0]];
921
921
  }
922
- return Math.abs(a) >= 1e-10 && (h[0] /= a, h[1] /= a, h[2] /= a), h;
922
+ return Math.abs(a) >= 1e-10 && (o[0] /= a, o[1] /= a, o[2] /= a), o;
923
923
  }
924
- function Ms(u, t, s, e) {
925
- const n = u, i = t[n], r = t[t.length - n - 1];
926
- let h = 0;
927
- const a = 1e3, o = (r - i) / a;
928
- let c = _t(
924
+ function ws(d, t, s, e) {
925
+ const n = d, i = t[n], r = t[t.length - n - 1];
926
+ let o = 0;
927
+ const a = 1e3, h = (r - i) / a;
928
+ let c = ft(
929
929
  i,
930
- u,
930
+ d,
931
931
  t,
932
932
  s,
933
933
  e
934
934
  );
935
935
  for (let g = 1; g <= a; g++) {
936
- const y = i + g * o, _ = _t(y, u, t, s, e), M = _[0] - c[0], A = _[1] - c[1], P = _[2] - c[2];
937
- h += Math.sqrt(M * M + A * A + P * P), c = _;
936
+ const y = i + g * h, _ = ft(y, d, t, s, e), z = _[0] - c[0], f = _[1] - c[1], b = _[2] - c[2];
937
+ o += Math.sqrt(z * z + f * f + b * b), c = _;
938
938
  }
939
- const l = _t(
939
+ const l = ft(
940
940
  r,
941
- u,
941
+ d,
942
942
  t,
943
943
  s,
944
944
  e
945
- ), m = l[0] - c[0], d = l[1] - c[1], x = l[2] - c[2];
946
- return h += Math.sqrt(m * m + d * d + x * x), h;
945
+ ), m = l[0] - c[0], u = l[1] - c[1], x = l[2] - c[2];
946
+ return o += Math.sqrt(m * m + u * u + x * x), o;
947
947
  }
948
- function Ts(u, t = 3, s = "Uniform", e, n) {
949
- return u.length === 0 ? [] : Kt(
950
- u,
948
+ function Ts(d, t = 3, s = "Uniform", e, n) {
949
+ return d.length === 0 ? [] : $t(
950
+ d,
951
951
  t,
952
952
  s,
953
953
  e,
954
954
  n
955
955
  ).controlPoints;
956
956
  }
957
- class Pt {
957
+ class bt {
958
958
  constructor(t = 0, s = 0, e = 0, n = 1) {
959
959
  this._x = t, this._y = s, this._z = e, this._w = n;
960
960
  }
961
- static slerpFlat(t, s, e, n, i, r, h) {
962
- let a = e[n + 0], o = e[n + 1], c = e[n + 2], l = e[n + 3];
963
- const m = i[r + 0], d = i[r + 1], x = i[r + 2], g = i[r + 3];
964
- if (h === 0) {
965
- t[s + 0] = a, t[s + 1] = o, t[s + 2] = c, t[s + 3] = l;
961
+ static slerpFlat(t, s, e, n, i, r, o) {
962
+ let a = e[n + 0], h = e[n + 1], c = e[n + 2], l = e[n + 3];
963
+ const m = i[r + 0], u = i[r + 1], x = i[r + 2], g = i[r + 3];
964
+ if (o === 0) {
965
+ t[s + 0] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
966
966
  return;
967
967
  }
968
- if (h === 1) {
969
- t[s + 0] = m, t[s + 1] = d, t[s + 2] = x, t[s + 3] = g;
968
+ if (o === 1) {
969
+ t[s + 0] = m, t[s + 1] = u, t[s + 2] = x, t[s + 3] = g;
970
970
  return;
971
971
  }
972
- if (l !== g || a !== m || o !== d || c !== x) {
973
- let y = 1 - h;
974
- const _ = a * m + o * d + c * x + l * g, M = _ >= 0 ? 1 : -1, A = 1 - _ * _;
975
- if (A > Number.EPSILON) {
976
- const z = Math.sqrt(A), E = Math.atan2(z, _ * M);
977
- y = Math.sin(y * E) / z, h = Math.sin(h * E) / z;
972
+ if (l !== g || a !== m || h !== u || c !== x) {
973
+ let y = 1 - o;
974
+ const _ = a * m + h * u + c * x + l * g, z = _ >= 0 ? 1 : -1, f = 1 - _ * _;
975
+ if (f > Number.EPSILON) {
976
+ const P = Math.sqrt(f), I = Math.atan2(P, _ * z);
977
+ y = Math.sin(y * I) / P, o = Math.sin(o * I) / P;
978
978
  }
979
- const P = h * M;
980
- if (a = a * y + m * P, o = o * y + d * P, c = c * y + x * P, l = l * y + g * P, y === 1 - h) {
981
- const z = 1 / Math.sqrt(a * a + o * o + c * c + l * l);
982
- a *= z, o *= z, c *= z, l *= z;
979
+ const b = o * z;
980
+ if (a = a * y + m * b, h = h * y + u * b, c = c * y + x * b, l = l * y + g * b, y === 1 - o) {
981
+ const P = 1 / Math.sqrt(a * a + h * h + c * c + l * l);
982
+ a *= P, h *= P, c *= P, l *= P;
983
983
  }
984
984
  }
985
- t[s] = a, t[s + 1] = o, t[s + 2] = c, t[s + 3] = l;
985
+ t[s] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
986
986
  }
987
987
  static multiplyQuaternionsFlat(t, s, e, n, i, r) {
988
- const h = e[n], a = e[n + 1], o = e[n + 2], c = e[n + 3], l = i[r], m = i[r + 1], d = i[r + 2], x = i[r + 3];
989
- return t[s] = h * x + c * l + a * d - o * m, t[s + 1] = a * x + c * m + o * l - h * d, t[s + 2] = o * x + c * d + h * m - a * l, t[s + 3] = c * x - h * l - a * m - o * d, t;
988
+ const o = e[n], a = e[n + 1], h = e[n + 2], c = e[n + 3], l = i[r], m = i[r + 1], u = i[r + 2], x = i[r + 3];
989
+ return t[s] = o * x + c * l + a * u - h * m, t[s + 1] = a * x + c * m + h * l - o * u, t[s + 2] = h * x + c * u + o * m - a * l, t[s + 3] = c * x - o * l - a * m - h * u, t;
990
990
  }
991
991
  get x() {
992
992
  return this._x;
@@ -1016,31 +1016,31 @@ class Pt {
1016
1016
  return this._x = t, this._y = s, this._z = e, this._w = n, this._onChangeCallback(), this;
1017
1017
  }
1018
1018
  clone() {
1019
- return new Pt(this._x, this._y, this._z, this._w);
1019
+ return new bt(this._x, this._y, this._z, this._w);
1020
1020
  }
1021
1021
  copy(t) {
1022
1022
  return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
1023
1023
  }
1024
1024
  setFromEuler(t, s = !0) {
1025
- const e = t.x, n = t.y, i = t.z, r = t.order, h = Math.cos, a = Math.sin, o = h(e / 2), c = h(n / 2), l = h(i / 2), m = a(e / 2), d = a(n / 2), x = a(i / 2);
1025
+ const e = t.x, n = t.y, i = t.z, r = t.order, o = Math.cos, a = Math.sin, h = o(e / 2), c = o(n / 2), l = o(i / 2), m = a(e / 2), u = a(n / 2), x = a(i / 2);
1026
1026
  switch (r) {
1027
1027
  case "XYZ":
1028
- this._x = m * c * l + o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l - m * d * x;
1028
+ this._x = m * c * l + h * u * x, this._y = h * u * l - m * c * x, this._z = h * c * x + m * u * l, this._w = h * c * l - m * u * x;
1029
1029
  break;
1030
1030
  case "YXZ":
1031
- this._x = m * c * l + o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x - m * d * l, this._w = o * c * l + m * d * x;
1031
+ this._x = m * c * l + h * u * x, this._y = h * u * l - m * c * x, this._z = h * c * x - m * u * l, this._w = h * c * l + m * u * x;
1032
1032
  break;
1033
1033
  case "ZXY":
1034
- this._x = m * c * l - o * d * x, this._y = o * d * l + m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l - m * d * x;
1034
+ this._x = m * c * l - h * u * x, this._y = h * u * l + m * c * x, this._z = h * c * x + m * u * l, this._w = h * c * l - m * u * x;
1035
1035
  break;
1036
1036
  case "ZYX":
1037
- this._x = m * c * l - o * d * x, this._y = o * d * l + m * c * x, this._z = o * c * x - m * d * l, this._w = o * c * l + m * d * x;
1037
+ this._x = m * c * l - h * u * x, this._y = h * u * l + m * c * x, this._z = h * c * x - m * u * l, this._w = h * c * l + m * u * x;
1038
1038
  break;
1039
1039
  case "YZX":
1040
- this._x = m * c * l + o * d * x, this._y = o * d * l + m * c * x, this._z = o * c * x - m * d * l, this._w = o * c * l - m * d * x;
1040
+ this._x = m * c * l + h * u * x, this._y = h * u * l + m * c * x, this._z = h * c * x - m * u * l, this._w = h * c * l - m * u * x;
1041
1041
  break;
1042
1042
  case "XZY":
1043
- this._x = m * c * l - o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l + m * d * x;
1043
+ this._x = m * c * l - h * u * x, this._y = h * u * l - m * c * x, this._z = h * c * x + m * u * l, this._w = h * c * l + m * u * x;
1044
1044
  break;
1045
1045
  }
1046
1046
  return s === !0 && this._onChangeCallback(), this;
@@ -1050,19 +1050,19 @@ class Pt {
1050
1050
  return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(e), this._onChangeCallback(), this;
1051
1051
  }
1052
1052
  setFromRotationMatrix(t) {
1053
- const s = t.elements, e = s[0], n = s[4], i = s[8], r = s[1], h = s[5], a = s[9], o = s[2], c = s[6], l = s[10], m = e + h + l;
1053
+ const s = t.elements, e = s[0], n = s[4], i = s[8], r = s[1], o = s[5], a = s[9], h = s[2], c = s[6], l = s[10], m = e + o + l;
1054
1054
  if (m > 0) {
1055
- const d = 0.5 / Math.sqrt(m + 1);
1056
- this._w = 0.25 / d, this._x = (c - a) * d, this._y = (i - o) * d, this._z = (r - n) * d;
1057
- } else if (e > h && e > l) {
1058
- const d = 2 * Math.sqrt(1 + e - h - l);
1059
- this._w = (c - a) / d, this._x = 0.25 * d, this._y = (n + r) / d, this._z = (i + o) / d;
1060
- } else if (h > l) {
1061
- const d = 2 * Math.sqrt(1 + h - e - l);
1062
- this._w = (i - o) / d, this._x = (n + r) / d, this._y = 0.25 * d, this._z = (a + c) / d;
1055
+ const u = 0.5 / Math.sqrt(m + 1);
1056
+ this._w = 0.25 / u, this._x = (c - a) * u, this._y = (i - h) * u, this._z = (r - n) * u;
1057
+ } else if (e > o && e > l) {
1058
+ const u = 2 * Math.sqrt(1 + e - o - l);
1059
+ this._w = (c - a) / u, this._x = 0.25 * u, this._y = (n + r) / u, this._z = (i + h) / u;
1060
+ } else if (o > l) {
1061
+ const u = 2 * Math.sqrt(1 + o - e - l);
1062
+ this._w = (i - h) / u, this._x = (n + r) / u, this._y = 0.25 * u, this._z = (a + c) / u;
1063
1063
  } else {
1064
- const d = 2 * Math.sqrt(1 + l - e - h);
1065
- this._w = (r - n) / d, this._x = (i + o) / d, this._y = (a + c) / d, this._z = 0.25 * d;
1064
+ const u = 2 * Math.sqrt(1 + l - e - o);
1065
+ this._w = (r - n) / u, this._x = (i + h) / u, this._y = (a + c) / u, this._z = 0.25 * u;
1066
1066
  }
1067
1067
  return this._onChangeCallback(), this;
1068
1068
  }
@@ -1071,7 +1071,7 @@ class Pt {
1071
1071
  return e < Number.EPSILON ? (e = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = e) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = e)) : (this._x = t.y * s.z - t.z * s.y, this._y = t.z * s.x - t.x * s.z, this._z = t.x * s.y - t.y * s.x, this._w = e), this.normalize();
1072
1072
  }
1073
1073
  angleTo(t) {
1074
- return 2 * Math.acos(Math.abs(v(this.dot(t), -1, 1)));
1074
+ return 2 * Math.acos(Math.abs(Z(this.dot(t), -1, 1)));
1075
1075
  }
1076
1076
  rotateTowards(t, s) {
1077
1077
  const e = this.angleTo(t);
@@ -1110,22 +1110,22 @@ class Pt {
1110
1110
  return this.multiplyQuaternions(t, this);
1111
1111
  }
1112
1112
  multiplyQuaternions(t, s) {
1113
- const e = t._x, n = t._y, i = t._z, r = t._w, h = s._x, a = s._y, o = s._z, c = s._w;
1114
- return this._x = e * c + r * h + n * o - i * a, this._y = n * c + r * a + i * h - e * o, this._z = i * c + r * o + e * a - n * h, this._w = r * c - e * h - n * a - i * o, this._onChangeCallback(), this;
1113
+ const e = t._x, n = t._y, i = t._z, r = t._w, o = s._x, a = s._y, h = s._z, c = s._w;
1114
+ return this._x = e * c + r * o + n * h - i * a, this._y = n * c + r * a + i * o - e * h, this._z = i * c + r * h + e * a - n * o, this._w = r * c - e * o - n * a - i * h, this._onChangeCallback(), this;
1115
1115
  }
1116
1116
  slerp(t, s) {
1117
1117
  if (s === 0) return this;
1118
1118
  if (s === 1) return this.copy(t);
1119
1119
  const e = this._x, n = this._y, i = this._z, r = this._w;
1120
- let h = r * t._w + e * t._x + n * t._y + i * t._z;
1121
- if (h < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, h = -h) : this.copy(t), h >= 1)
1120
+ let o = r * t._w + e * t._x + n * t._y + i * t._z;
1121
+ if (o < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, o = -o) : this.copy(t), o >= 1)
1122
1122
  return this._w = r, this._x = e, this._y = n, this._z = i, this;
1123
- const a = 1 - h * h;
1123
+ const a = 1 - o * o;
1124
1124
  if (a <= Number.EPSILON) {
1125
- const d = 1 - s;
1126
- return this._w = d * r + s * this._w, this._x = d * e + s * this._x, this._y = d * n + s * this._y, this._z = d * i + s * this._z, this.normalize(), this;
1125
+ const u = 1 - s;
1126
+ return this._w = u * r + s * this._w, this._x = u * e + s * this._x, this._y = u * n + s * this._y, this._z = u * i + s * this._z, this.normalize(), this;
1127
1127
  }
1128
- const o = Math.sqrt(a), c = Math.atan2(o, h), l = Math.sin((1 - s) * c) / o, m = Math.sin(s * c) / o;
1128
+ const h = Math.sqrt(a), c = Math.atan2(h, o), l = Math.sin((1 - s) * c) / h, m = Math.sin(s * c) / h;
1129
1129
  return this._w = r * l + this._w * m, this._x = e * l + this._x * m, this._y = n * l + this._y * m, this._z = i * l + this._z * m, this._onChangeCallback(), this;
1130
1130
  }
1131
1131
  slerpQuaternions(t, s, e) {
@@ -1161,7 +1161,7 @@ class Pt {
1161
1161
  yield this._x, yield this._y, yield this._z, yield this._w;
1162
1162
  }
1163
1163
  }
1164
- const N = class N {
1164
+ const R = class R {
1165
1165
  constructor(t, s, e) {
1166
1166
  this.x = 0, this.y = 0, this.z = 0;
1167
1167
  const n = +(t !== void 0) + +(s !== void 0) + +(e !== void 0);
@@ -1171,15 +1171,15 @@ const N = class N {
1171
1171
  return;
1172
1172
  }
1173
1173
  if (n === 1) {
1174
- const { x: i, y: r, z: h } = t;
1175
- this.x = i, this.y = r, this.z = h || 0;
1174
+ const { x: i, y: r, z: o } = t;
1175
+ this.x = i, this.y = r, this.z = o || 0;
1176
1176
  return;
1177
1177
  }
1178
1178
  if (n === 3) {
1179
1179
  this.x = t, this.y = s, this.z = e;
1180
1180
  return;
1181
1181
  }
1182
- throw q.ILLEGAL_PARAMETERS;
1182
+ throw L.ILLEGAL_PARAMETERS;
1183
1183
  }
1184
1184
  }
1185
1185
  set(t, s, e) {
@@ -1226,7 +1226,7 @@ const N = class N {
1226
1226
  }
1227
1227
  }
1228
1228
  clone() {
1229
- return new N(this.x, this.y, this.z);
1229
+ return new R(this.x, this.y, this.z);
1230
1230
  }
1231
1231
  copy(t) {
1232
1232
  return this.x = t.x, this.y = t.y, this.z = t.z || 0, this;
@@ -1262,10 +1262,10 @@ const N = class N {
1262
1262
  return this.x = t.x * s.x, this.y = t.y * s.y, this.z = t.z * s.z, this;
1263
1263
  }
1264
1264
  applyEuler(t) {
1265
- return this.applyQuaternion(Rt.setFromEuler(t));
1265
+ return this.applyQuaternion(Nt.setFromEuler(t));
1266
1266
  }
1267
1267
  applyAxisAngle(t, s) {
1268
- return this.applyQuaternion(Rt.setFromAxisAngle(t, s));
1268
+ return this.applyQuaternion(Nt.setFromAxisAngle(t, s));
1269
1269
  }
1270
1270
  applyMatrix3(t) {
1271
1271
  const s = this.x, e = this.y, n = this.z, i = t.elements;
@@ -1279,8 +1279,8 @@ const N = class N {
1279
1279
  return this.x = (i[0] * s + i[4] * e + i[8] * n + i[12]) * r, this.y = (i[1] * s + i[5] * e + i[9] * n + i[13]) * r, this.z = (i[2] * s + i[6] * e + i[10] * n + i[14]) * r, this;
1280
1280
  }
1281
1281
  applyQuaternion(t) {
1282
- const s = this.x, e = this.y, n = this.z, i = t.x, r = t.y, h = t.z, a = t.w, o = 2 * (r * n - h * e), c = 2 * (h * s - i * n), l = 2 * (i * e - r * s);
1283
- return this.x = s + a * o + r * l - h * c, this.y = e + a * c + h * o - i * l, this.z = n + a * l + i * c - r * o, this;
1282
+ const s = this.x, e = this.y, n = this.z, i = t.x, r = t.y, o = t.z, a = t.w, h = 2 * (r * n - o * e), c = 2 * (o * s - i * n), l = 2 * (i * e - r * s);
1283
+ return this.x = s + a * h + r * l - o * c, this.y = e + a * c + o * h - i * l, this.z = n + a * l + i * c - r * h, this;
1284
1284
  }
1285
1285
  transformDirection(t) {
1286
1286
  const s = this.x, e = this.y, n = this.z, i = t.elements;
@@ -1357,8 +1357,8 @@ const N = class N {
1357
1357
  return this.crossVectors(this, t);
1358
1358
  }
1359
1359
  crossVectors(t, s) {
1360
- const e = t.x, n = t.y, i = t.z, r = s.x, h = s.y, a = s.z;
1361
- return this.x = n * a - i * h, this.y = i * r - e * a, this.z = e * h - n * r, this;
1360
+ const e = t.x, n = t.y, i = t.z, r = s.x, o = s.y, a = s.z;
1361
+ return this.x = n * a - i * o, this.y = i * r - e * a, this.z = e * o - n * r, this;
1362
1362
  }
1363
1363
  projectOnVector(t) {
1364
1364
  const s = t.lengthSq();
@@ -1367,10 +1367,10 @@ const N = class N {
1367
1367
  return this.copy(t).multiplyScalar(e);
1368
1368
  }
1369
1369
  projectOnPlane(t) {
1370
- return Et.copy(this).projectOnVector(t), this.sub(Et);
1370
+ return It.copy(this).projectOnVector(t), this.sub(It);
1371
1371
  }
1372
1372
  reflect(t) {
1373
- return this.sub(Et.copy(t).multiplyScalar(2 * this.dot(t)));
1373
+ return this.sub(It.copy(t).multiplyScalar(2 * this.dot(t)));
1374
1374
  }
1375
1375
  angleTo(t) {
1376
1376
  const s = Math.sqrt(this.lengthSq() * t.lengthSq());
@@ -1422,38 +1422,38 @@ const N = class N {
1422
1422
  yield this.x, yield this.y, yield this.z;
1423
1423
  }
1424
1424
  };
1425
- N.ORIGIN = Object.freeze(new N(0, 0, 0)), N.X_AXIS = Object.freeze(new N(1, 0, 0)), N.NEGATIVE_X_AXIS = Object.freeze(new N(-1, 0, 0)), N.Y_AXIS = Object.freeze(new N(0, 1, 0)), N.NEGATIVE_Y_AXIS = Object.freeze(new N(0, -1, 0)), N.Z_AXIS = Object.freeze(new N(0, 0, 1)), N.NEGATIVE_Z_AXIS = Object.freeze(new N(0, 0, -1));
1426
- let p = N;
1427
- const Et = new p(), Rt = new Pt(), J = class J {
1428
- constructor(t, s, e, n, i, r, h, a, o, c, l, m, d, x, g, y) {
1429
- this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && h != null && a != null && o != null && c != null && l != null && m != null && d != null && x != null && g != null && y != null && this.set(
1425
+ R.ORIGIN = Object.freeze(new R(0, 0, 0)), R.X_AXIS = Object.freeze(new R(1, 0, 0)), R.NEGATIVE_X_AXIS = Object.freeze(new R(-1, 0, 0)), R.Y_AXIS = Object.freeze(new R(0, 1, 0)), R.NEGATIVE_Y_AXIS = Object.freeze(new R(0, -1, 0)), R.Z_AXIS = Object.freeze(new R(0, 0, 1)), R.NEGATIVE_Z_AXIS = Object.freeze(new R(0, 0, -1));
1426
+ let p = R;
1427
+ const It = new p(), Nt = new bt(), et = class et {
1428
+ constructor(t, s, e, n, i, r, o, a, h, c, l, m, u, x, g, y) {
1429
+ this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && o != null && a != null && h != null && c != null && l != null && m != null && u != null && x != null && g != null && y != null && this.set(
1430
1430
  t,
1431
1431
  s,
1432
1432
  e,
1433
1433
  n,
1434
1434
  i,
1435
1435
  r,
1436
- h,
1437
- a,
1438
1436
  o,
1437
+ a,
1438
+ h,
1439
1439
  c,
1440
1440
  l,
1441
1441
  m,
1442
- d,
1442
+ u,
1443
1443
  x,
1444
1444
  g,
1445
1445
  y
1446
1446
  );
1447
1447
  }
1448
- set(t, s, e, n, i, r, h, a, o, c, l, m, d, x, g, y) {
1448
+ set(t, s, e, n, i, r, o, a, h, c, l, m, u, x, g, y) {
1449
1449
  const _ = this.elements;
1450
- return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = r, _[9] = h, _[13] = a, _[2] = o, _[6] = c, _[10] = l, _[14] = m, _[3] = d, _[7] = x, _[11] = g, _[15] = y, this;
1450
+ return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = r, _[9] = o, _[13] = a, _[2] = h, _[6] = c, _[10] = l, _[14] = m, _[3] = u, _[7] = x, _[11] = g, _[15] = y, this;
1451
1451
  }
1452
1452
  identity() {
1453
1453
  return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
1454
1454
  }
1455
1455
  clone() {
1456
- return new J().fromArray(this.elements);
1456
+ return new et().fromArray(this.elements);
1457
1457
  }
1458
1458
  copy(t) {
1459
1459
  const s = this.elements, e = t.elements;
@@ -1485,7 +1485,7 @@ const Et = new p(), Rt = new Pt(), J = class J {
1485
1485
  ), this;
1486
1486
  }
1487
1487
  setFromExtrusionDirection(t) {
1488
- if (Ot.equalPoint3d(t, p.Z_AXIS))
1488
+ if (Kt.equalPoint3d(t, p.Z_AXIS))
1489
1489
  this.identity();
1490
1490
  else {
1491
1491
  const s = new p(1, 0, 0);
@@ -1536,15 +1536,15 @@ const Et = new p(), Rt = new Pt(), J = class J {
1536
1536
  ), this;
1537
1537
  }
1538
1538
  extractRotation(t) {
1539
- const s = this.elements, e = t.elements, n = 1 / K.setFromMatrixColumn(t, 0).length(), i = 1 / K.setFromMatrixColumn(t, 1).length(), r = 1 / K.setFromMatrixColumn(t, 2).length();
1539
+ const s = this.elements, e = t.elements, n = 1 / $.setFromMatrixColumn(t, 0).length(), i = 1 / $.setFromMatrixColumn(t, 1).length(), r = 1 / $.setFromMatrixColumn(t, 2).length();
1540
1540
  return s[0] = e[0] * n, s[1] = e[1] * n, s[2] = e[2] * n, s[3] = 0, s[4] = e[4] * i, s[5] = e[5] * i, s[6] = e[6] * i, s[7] = 0, s[8] = e[8] * r, s[9] = e[9] * r, s[10] = e[10] * r, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[15] = 1, this;
1541
1541
  }
1542
1542
  makeRotationFromQuaternion(t) {
1543
- return this.compose(ws, t, Ps);
1543
+ return this.compose(Ms, t, Ps);
1544
1544
  }
1545
1545
  lookAt(t, s, e) {
1546
1546
  const n = this.elements;
1547
- return L.subVectors(t, s), L.lengthSq() === 0 && (L.z = 1), L.normalize(), Z.crossVectors(e, L), Z.lengthSq() === 0 && (Math.abs(e.z) === 1 ? L.x += 1e-4 : L.z += 1e-4, L.normalize(), Z.crossVectors(e, L)), Z.normalize(), xt.crossVectors(L, Z), n[0] = Z.x, n[4] = xt.x, n[8] = L.x, n[1] = Z.y, n[5] = xt.y, n[9] = L.y, n[2] = Z.z, n[6] = xt.z, n[10] = L.z, this;
1547
+ return V.subVectors(t, s), V.lengthSq() === 0 && (V.z = 1), V.normalize(), v.crossVectors(e, V), v.lengthSq() === 0 && (Math.abs(e.z) === 1 ? V.x += 1e-4 : V.z += 1e-4, V.normalize(), v.crossVectors(e, V)), v.normalize(), yt.crossVectors(V, v), n[0] = v.x, n[4] = yt.x, n[8] = V.x, n[1] = v.y, n[5] = yt.y, n[9] = V.y, n[2] = v.z, n[6] = yt.z, n[10] = V.z, this;
1548
1548
  }
1549
1549
  multiply(t) {
1550
1550
  return this.multiplyMatrices(this, t);
@@ -1553,16 +1553,16 @@ const Et = new p(), Rt = new Pt(), J = class J {
1553
1553
  return this.multiplyMatrices(t, this);
1554
1554
  }
1555
1555
  multiplyMatrices(t, s) {
1556
- const e = t.elements, n = s.elements, i = this.elements, r = e[0], h = e[4], a = e[8], o = e[12], c = e[1], l = e[5], m = e[9], d = e[13], x = e[2], g = e[6], y = e[10], _ = e[14], M = e[3], A = e[7], P = e[11], z = e[15], E = n[0], f = n[4], k = n[8], w = n[12], T = n[1], V = n[5], O = n[9], rt = n[13], ht = n[2], ot = n[6], at = n[10], ct = n[14], lt = n[3], ut = n[7], dt = n[11], mt = n[15];
1557
- return i[0] = r * E + h * T + a * ht + o * lt, i[4] = r * f + h * V + a * ot + o * ut, i[8] = r * k + h * O + a * at + o * dt, i[12] = r * w + h * rt + a * ct + o * mt, i[1] = c * E + l * T + m * ht + d * lt, i[5] = c * f + l * V + m * ot + d * ut, i[9] = c * k + l * O + m * at + d * dt, i[13] = c * w + l * rt + m * ct + d * mt, i[2] = x * E + g * T + y * ht + _ * lt, i[6] = x * f + g * V + y * ot + _ * ut, i[10] = x * k + g * O + y * at + _ * dt, i[14] = x * w + g * rt + y * ct + _ * mt, i[3] = M * E + A * T + P * ht + z * lt, i[7] = M * f + A * V + P * ot + z * ut, i[11] = M * k + A * O + P * at + z * dt, i[15] = M * w + A * rt + P * ct + z * mt, this;
1556
+ const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[4], a = e[8], h = e[12], c = e[1], l = e[5], m = e[9], u = e[13], x = e[2], g = e[6], y = e[10], _ = e[14], z = e[3], f = e[7], b = e[11], P = e[15], I = n[0], A = n[4], k = n[8], S = n[12], T = n[1], U = n[5], K = n[9], ht = n[13], at = n[2], ct = n[6], lt = n[10], ut = n[14], dt = n[3], mt = n[7], xt = n[11], gt = n[15];
1557
+ return i[0] = r * I + o * T + a * at + h * dt, i[4] = r * A + o * U + a * ct + h * mt, i[8] = r * k + o * K + a * lt + h * xt, i[12] = r * S + o * ht + a * ut + h * gt, i[1] = c * I + l * T + m * at + u * dt, i[5] = c * A + l * U + m * ct + u * mt, i[9] = c * k + l * K + m * lt + u * xt, i[13] = c * S + l * ht + m * ut + u * gt, i[2] = x * I + g * T + y * at + _ * dt, i[6] = x * A + g * U + y * ct + _ * mt, i[10] = x * k + g * K + y * lt + _ * xt, i[14] = x * S + g * ht + y * ut + _ * gt, i[3] = z * I + f * T + b * at + P * dt, i[7] = z * A + f * U + b * ct + P * mt, i[11] = z * k + f * K + b * lt + P * xt, i[15] = z * S + f * ht + b * ut + P * gt, this;
1558
1558
  }
1559
1559
  multiplyScalar(t) {
1560
1560
  const s = this.elements;
1561
1561
  return s[0] *= t, s[4] *= t, s[8] *= t, s[12] *= t, s[1] *= t, s[5] *= t, s[9] *= t, s[13] *= t, s[2] *= t, s[6] *= t, s[10] *= t, s[14] *= t, s[3] *= t, s[7] *= t, s[11] *= t, s[15] *= t, this;
1562
1562
  }
1563
1563
  determinant() {
1564
- const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], r = t[1], h = t[5], a = t[9], o = t[13], c = t[2], l = t[6], m = t[10], d = t[14], x = t[3], g = t[7], y = t[11], _ = t[15];
1565
- return x * (+i * a * l - n * o * l - i * h * m + e * o * m + n * h * d - e * a * d) + g * (+s * a * d - s * o * m + i * r * m - n * r * d + n * o * c - i * a * c) + y * (+s * o * l - s * h * d - i * r * l + e * r * d + i * h * c - e * o * c) + _ * (-n * h * c - s * a * l + s * h * m + n * r * l - e * r * m + e * a * c);
1564
+ const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], r = t[1], o = t[5], a = t[9], h = t[13], c = t[2], l = t[6], m = t[10], u = t[14], x = t[3], g = t[7], y = t[11], _ = t[15];
1565
+ return x * (+i * a * l - n * h * l - i * o * m + e * h * m + n * o * u - e * a * u) + g * (+s * a * u - s * h * m + i * r * m - n * r * u + n * h * c - i * a * c) + y * (+s * h * l - s * o * u - i * r * l + e * r * u + i * o * c - e * h * c) + _ * (-n * o * c - s * a * l + s * o * m + n * r * l - e * r * m + e * a * c);
1566
1566
  }
1567
1567
  transpose() {
1568
1568
  const t = this.elements;
@@ -1574,11 +1574,11 @@ const Et = new p(), Rt = new Pt(), J = class J {
1574
1574
  return t instanceof p ? (n[12] = t.x, n[13] = t.y, n[14] = t.z) : (n[12] = t, n[13] = s, n[14] = e), this;
1575
1575
  }
1576
1576
  invert() {
1577
- const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], h = t[5], a = t[6], o = t[7], c = t[8], l = t[9], m = t[10], d = t[11], x = t[12], g = t[13], y = t[14], _ = t[15], M = l * y * o - g * m * o + g * a * d - h * y * d - l * a * _ + h * m * _, A = x * m * o - c * y * o - x * a * d + r * y * d + c * a * _ - r * m * _, P = c * g * o - x * l * o + x * h * d - r * g * d - c * h * _ + r * l * _, z = x * l * a - c * g * a - x * h * m + r * g * m + c * h * y - r * l * y, E = s * M + e * A + n * P + i * z;
1578
- if (E === 0)
1577
+ const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = t[9], m = t[10], u = t[11], x = t[12], g = t[13], y = t[14], _ = t[15], z = l * y * h - g * m * h + g * a * u - o * y * u - l * a * _ + o * m * _, f = x * m * h - c * y * h - x * a * u + r * y * u + c * a * _ - r * m * _, b = c * g * h - x * l * h + x * o * u - r * g * u - c * o * _ + r * l * _, P = x * l * a - c * g * a - x * o * m + r * g * m + c * o * y - r * l * y, I = s * z + e * f + n * b + i * P;
1578
+ if (I === 0)
1579
1579
  return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1580
- const f = 1 / E;
1581
- return t[0] = M * f, t[1] = (g * m * i - l * y * i - g * n * d + e * y * d + l * n * _ - e * m * _) * f, t[2] = (h * y * i - g * a * i + g * n * o - e * y * o - h * n * _ + e * a * _) * f, t[3] = (l * a * i - h * m * i - l * n * o + e * m * o + h * n * d - e * a * d) * f, t[4] = A * f, t[5] = (c * y * i - x * m * i + x * n * d - s * y * d - c * n * _ + s * m * _) * f, t[6] = (x * a * i - r * y * i - x * n * o + s * y * o + r * n * _ - s * a * _) * f, t[7] = (r * m * i - c * a * i + c * n * o - s * m * o - r * n * d + s * a * d) * f, t[8] = P * f, t[9] = (x * l * i - c * g * i - x * e * d + s * g * d + c * e * _ - s * l * _) * f, t[10] = (r * g * i - x * h * i + x * e * o - s * g * o - r * e * _ + s * h * _) * f, t[11] = (c * h * i - r * l * i - c * e * o + s * l * o + r * e * d - s * h * d) * f, t[12] = z * f, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - c * e * y + s * l * y) * f, t[14] = (x * h * n - r * g * n - x * e * a + s * g * a + r * e * y - s * h * y) * f, t[15] = (r * l * n - c * h * n + c * e * a - s * l * a - r * e * m + s * h * m) * f, this;
1580
+ const A = 1 / I;
1581
+ return t[0] = z * A, t[1] = (g * m * i - l * y * i - g * n * u + e * y * u + l * n * _ - e * m * _) * A, t[2] = (o * y * i - g * a * i + g * n * h - e * y * h - o * n * _ + e * a * _) * A, t[3] = (l * a * i - o * m * i - l * n * h + e * m * h + o * n * u - e * a * u) * A, t[4] = f * A, t[5] = (c * y * i - x * m * i + x * n * u - s * y * u - c * n * _ + s * m * _) * A, t[6] = (x * a * i - r * y * i - x * n * h + s * y * h + r * n * _ - s * a * _) * A, t[7] = (r * m * i - c * a * i + c * n * h - s * m * h - r * n * u + s * a * u) * A, t[8] = b * A, t[9] = (x * l * i - c * g * i - x * e * u + s * g * u + c * e * _ - s * l * _) * A, t[10] = (r * g * i - x * o * i + x * e * h - s * g * h - r * e * _ + s * o * _) * A, t[11] = (c * o * i - r * l * i - c * e * h + s * l * h + r * e * u - s * o * u) * A, t[12] = P * A, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - c * e * y + s * l * y) * A, t[14] = (x * o * n - r * g * n - x * e * a + s * g * a + r * e * y - s * o * y) * A, t[15] = (r * l * n - c * o * n + c * e * a - s * l * a - r * e * m + s * o * m) * A, this;
1582
1582
  }
1583
1583
  scale(t) {
1584
1584
  const s = this.elements, e = t.x, n = t.y, i = t.z;
@@ -1604,17 +1604,17 @@ const Et = new p(), Rt = new Pt(), J = class J {
1604
1604
  return this.set(s, -e, 0, 0, e, s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
1605
1605
  }
1606
1606
  makeRotationAxis(t, s) {
1607
- const e = Math.cos(s), n = Math.sin(s), i = 1 - e, r = t.x, h = t.y, a = t.z, o = i * r, c = i * h;
1607
+ const e = Math.cos(s), n = Math.sin(s), i = 1 - e, r = t.x, o = t.y, a = t.z, h = i * r, c = i * o;
1608
1608
  return this.set(
1609
- o * r + e,
1610
- o * h - n * a,
1611
- o * a + n * h,
1609
+ h * r + e,
1610
+ h * o - n * a,
1611
+ h * a + n * o,
1612
1612
  0,
1613
- o * h + n * a,
1614
- c * h + e,
1613
+ h * o + n * a,
1614
+ c * o + e,
1615
1615
  c * a - n * r,
1616
1616
  0,
1617
- o * a - n * h,
1617
+ h * a - n * o,
1618
1618
  c * a + n * r,
1619
1619
  i * a * a + e,
1620
1620
  0,
@@ -1631,16 +1631,16 @@ const Et = new p(), Rt = new Pt(), J = class J {
1631
1631
  return this.set(1, e, i, 0, t, 1, r, 0, s, n, 1, 0, 0, 0, 0, 1), this;
1632
1632
  }
1633
1633
  compose(t, s, e) {
1634
- const n = this.elements, i = s.x, r = s.y, h = s.z, a = s.w, o = i + i, c = r + r, l = h + h, m = i * o, d = i * c, x = i * l, g = r * c, y = r * l, _ = h * l, M = a * o, A = a * c, P = a * l, z = e.x, E = e.y, f = e.z;
1635
- return n[0] = (1 - (g + _)) * z, n[1] = (d + P) * z, n[2] = (x - A) * z, n[3] = 0, n[4] = (d - P) * E, n[5] = (1 - (m + _)) * E, n[6] = (y + M) * E, n[7] = 0, n[8] = (x + A) * f, n[9] = (y - M) * f, n[10] = (1 - (m + g)) * f, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
1634
+ const n = this.elements, i = s.x, r = s.y, o = s.z, a = s.w, h = i + i, c = r + r, l = o + o, m = i * h, u = i * c, x = i * l, g = r * c, y = r * l, _ = o * l, z = a * h, f = a * c, b = a * l, P = e.x, I = e.y, A = e.z;
1635
+ return n[0] = (1 - (g + _)) * P, n[1] = (u + b) * P, n[2] = (x - f) * P, n[3] = 0, n[4] = (u - b) * I, n[5] = (1 - (m + _)) * I, n[6] = (y + z) * I, n[7] = 0, n[8] = (x + f) * A, n[9] = (y - z) * A, n[10] = (1 - (m + g)) * A, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
1636
1636
  }
1637
1637
  decompose(t, s, e) {
1638
1638
  const n = this.elements;
1639
- let i = K.set(n[0], n[1], n[2]).length();
1640
- const r = K.set(n[4], n[5], n[6]).length(), h = K.set(n[8], n[9], n[10]).length();
1641
- this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], j.copy(this);
1642
- const o = 1 / i, c = 1 / r, l = 1 / h;
1643
- return j.elements[0] *= o, j.elements[1] *= o, j.elements[2] *= o, j.elements[4] *= c, j.elements[5] *= c, j.elements[6] *= c, j.elements[8] *= l, j.elements[9] *= l, j.elements[10] *= l, s.setFromRotationMatrix(j), e.x = i, e.y = r, e.z = h, this;
1639
+ let i = $.set(n[0], n[1], n[2]).length();
1640
+ const r = $.set(n[4], n[5], n[6]).length(), o = $.set(n[8], n[9], n[10]).length();
1641
+ this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], q.copy(this);
1642
+ const h = 1 / i, c = 1 / r, l = 1 / o;
1643
+ return q.elements[0] *= h, q.elements[1] *= h, q.elements[2] *= h, q.elements[4] *= c, q.elements[5] *= c, q.elements[6] *= c, q.elements[8] *= l, q.elements[9] *= l, q.elements[10] *= l, s.setFromRotationMatrix(q), e.x = i, e.y = r, e.z = o, this;
1644
1644
  }
1645
1645
  equals(t) {
1646
1646
  const s = this.elements, e = t.elements;
@@ -1658,10 +1658,10 @@ const Et = new p(), Rt = new Pt(), J = class J {
1658
1658
  return t[s] = e[0], t[s + 1] = e[1], t[s + 2] = e[2], t[s + 3] = e[3], t[s + 4] = e[4], t[s + 5] = e[5], t[s + 6] = e[6], t[s + 7] = e[7], t[s + 8] = e[8], t[s + 9] = e[9], t[s + 10] = e[10], t[s + 11] = e[11], t[s + 12] = e[12], t[s + 13] = e[13], t[s + 14] = e[14], t[s + 15] = e[15], t;
1659
1659
  }
1660
1660
  };
1661
- J.IDENTITY = Object.freeze(new J());
1662
- let et = J;
1663
- const K = new p(), j = new et(), ws = new p(0, 0, 0), Ps = new p(1, 1, 1), Z = new p(), xt = new p(), L = new p();
1664
- class D {
1661
+ et.IDENTITY = Object.freeze(new et());
1662
+ let H = et;
1663
+ const $ = new p(), q = new H(), Ms = new p(0, 0, 0), Ps = new p(1, 1, 1), v = new p(), yt = new p(), V = new p();
1664
+ class Y {
1665
1665
  constructor(t = void 0, s = void 0) {
1666
1666
  this.min = t == null ? new p(1 / 0, 1 / 0, 1 / 0) : new p(t.x, t.y, t.z), this.max = s == null ? new p(-1 / 0, -1 / 0, -1 / 0) : new p(s.x, s.y, s.z);
1667
1667
  }
@@ -1671,7 +1671,7 @@ class D {
1671
1671
  setFromArray(t) {
1672
1672
  this.makeEmpty();
1673
1673
  for (let s = 0, e = t.length; s < e; s += 3)
1674
- this.expandByPoint(It.fromArray(t, s));
1674
+ this.expandByPoint(Bt.fromArray(t, s));
1675
1675
  return this;
1676
1676
  }
1677
1677
  setFromPoints(t) {
@@ -1681,11 +1681,11 @@ class D {
1681
1681
  return this;
1682
1682
  }
1683
1683
  setFromCenterAndSize(t, s) {
1684
- const e = It.copy(s).multiplyScalar(0.5);
1684
+ const e = Bt.copy(s).multiplyScalar(0.5);
1685
1685
  return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
1686
1686
  }
1687
1687
  clone() {
1688
- return new D().copy(this);
1688
+ return new Y().copy(this);
1689
1689
  }
1690
1690
  copy(t) {
1691
1691
  return this.min.copy(t.min), this.max.copy(t.max), this;
@@ -1741,7 +1741,7 @@ class D {
1741
1741
  return s.copy(t).clamp(this.min, this.max);
1742
1742
  }
1743
1743
  distanceToPoint(t) {
1744
- return this.clampPoint(t, It).distanceTo(t);
1744
+ return this.clampPoint(t, Bt).distanceTo(t);
1745
1745
  }
1746
1746
  intersect(t) {
1747
1747
  return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this;
@@ -1750,7 +1750,7 @@ class D {
1750
1750
  return this.min.min(t.min), this.max.max(t.max), this;
1751
1751
  }
1752
1752
  applyMatrix4(t) {
1753
- return this.isEmpty() ? this : (Y[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t), Y[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t), Y[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t), Y[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t), Y[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t), Y[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t), Y[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t), Y[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t), this.setFromPoints(Y), this);
1753
+ return this.isEmpty() ? this : (D[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t), D[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t), D[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t), D[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t), D[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t), D[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t), D[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t), D[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t), this.setFromPoints(D), this);
1754
1754
  }
1755
1755
  translate(t) {
1756
1756
  return this.min.add(t), this.max.add(t), this;
@@ -1759,7 +1759,7 @@ class D {
1759
1759
  return t.min.equals(this.min) && t.max.equals(this.max);
1760
1760
  }
1761
1761
  }
1762
- const Y = [
1762
+ const D = [
1763
1763
  new p(),
1764
1764
  new p(),
1765
1765
  new p(),
@@ -1768,7 +1768,7 @@ const Y = [
1768
1768
  new p(),
1769
1769
  new p(),
1770
1770
  new p()
1771
- ], It = new p(), Tt = new B();
1771
+ ], Bt = new p(), Tt = new B();
1772
1772
  class F {
1773
1773
  constructor(t = void 0, s = void 0) {
1774
1774
  this.min = t == null ? new B(1 / 0, 1 / 0) : new B(t.x, t.y), this.max = s == null ? new B(-1 / 0, -1 / 0) : new B(s.x, s.y);
@@ -1853,8 +1853,8 @@ class F {
1853
1853
  return t.min.equals(this.min) && t.max.equals(this.max);
1854
1854
  }
1855
1855
  }
1856
- const Lt = new p(), bs = new p(), Ss = new st();
1857
- class bt {
1856
+ const jt = new p(), bs = new p(), Ss = new it();
1857
+ class St {
1858
1858
  constructor(t = new p(1, 0, 0), s = 0) {
1859
1859
  this.normal = t, this.constant = s;
1860
1860
  }
@@ -1868,7 +1868,7 @@ class bt {
1868
1868
  return this.normal.copy(t), this.constant = -s.dot(this.normal), this;
1869
1869
  }
1870
1870
  setFromCoplanarPoints(t, s, e) {
1871
- const n = Lt.subVectors(e, s).cross(bs.subVectors(t, s)).normalize();
1871
+ const n = jt.subVectors(e, s).cross(bs.subVectors(t, s)).normalize();
1872
1872
  return this.setFromNormalAndCoplanarPoint(n, t), this;
1873
1873
  }
1874
1874
  copy(t) {
@@ -1894,7 +1894,7 @@ class bt {
1894
1894
  return t.copy(this.normal).multiplyScalar(-this.constant);
1895
1895
  }
1896
1896
  applyMatrix4(t, s) {
1897
- const e = s || Ss.getNormalMatrix(t), n = this.coplanarPoint(Lt).applyMatrix4(t), i = this.normal.applyMatrix3(e).normalize();
1897
+ const e = s || Ss.getNormalMatrix(t), n = this.coplanarPoint(jt).applyMatrix4(t), i = this.normal.applyMatrix3(e).normalize();
1898
1898
  return this.constant = -n.dot(i), this;
1899
1899
  }
1900
1900
  translate(t) {
@@ -1904,7 +1904,7 @@ class bt {
1904
1904
  return t.normal.equals(this.normal) && t.constant === this.constant;
1905
1905
  }
1906
1906
  clone() {
1907
- return new bt().copy(this);
1907
+ return new St().copy(this);
1908
1908
  }
1909
1909
  }
1910
1910
  class C extends B {
@@ -1915,7 +1915,7 @@ class C extends B {
1915
1915
  }), s;
1916
1916
  }
1917
1917
  }
1918
- class S extends p {
1918
+ class w extends p {
1919
1919
  static pointArrayToNumberArray(t, s = !0) {
1920
1920
  const e = s ? 3 : 2, n = new Array(t.length * e);
1921
1921
  return t.forEach((i, r) => {
@@ -1923,8 +1923,8 @@ class S extends p {
1923
1923
  }), n;
1924
1924
  }
1925
1925
  }
1926
- const Ut = new et(), Vt = new Pt(), tt = class tt {
1927
- constructor(t = 0, s = 0, e = 0, n = tt.DEFAULT_ORDER) {
1926
+ const Vt = new H(), Ut = new bt(), nt = class nt {
1927
+ constructor(t = 0, s = 0, e = 0, n = nt.DEFAULT_ORDER) {
1928
1928
  this._x = t, this._y = s, this._z = e, this._order = n;
1929
1929
  }
1930
1930
  get x() {
@@ -1955,43 +1955,43 @@ const Ut = new et(), Vt = new Pt(), tt = class tt {
1955
1955
  return this._x = t, this._y = s, this._z = e, this._order = n, this._onChangeCallback(), this;
1956
1956
  }
1957
1957
  clone() {
1958
- return new tt(this._x, this._y, this._z, this._order);
1958
+ return new nt(this._x, this._y, this._z, this._order);
1959
1959
  }
1960
1960
  copy(t) {
1961
1961
  return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this._onChangeCallback(), this;
1962
1962
  }
1963
1963
  setFromRotationMatrix(t, s = this._order, e = !0) {
1964
- const n = t.elements, i = n[0], r = n[4], h = n[8], a = n[1], o = n[5], c = n[9], l = n[2], m = n[6], d = n[10];
1964
+ const n = t.elements, i = n[0], r = n[4], o = n[8], a = n[1], h = n[5], c = n[9], l = n[2], m = n[6], u = n[10];
1965
1965
  switch (s) {
1966
1966
  case "XYZ":
1967
- this._y = Math.asin(v(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(-c, d), this._z = Math.atan2(-r, i)) : (this._x = Math.atan2(m, o), this._z = 0);
1967
+ this._y = Math.asin(Z(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-c, u), this._z = Math.atan2(-r, i)) : (this._x = Math.atan2(m, h), this._z = 0);
1968
1968
  break;
1969
1969
  case "YXZ":
1970
- this._x = Math.asin(-v(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(h, d), this._z = Math.atan2(a, o)) : (this._y = Math.atan2(-l, i), this._z = 0);
1970
+ this._x = Math.asin(-Z(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(o, u), this._z = Math.atan2(a, h)) : (this._y = Math.atan2(-l, i), this._z = 0);
1971
1971
  break;
1972
1972
  case "ZXY":
1973
- this._x = Math.asin(v(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, d), this._z = Math.atan2(-r, o)) : (this._y = 0, this._z = Math.atan2(a, i));
1973
+ this._x = Math.asin(Z(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, u), this._z = Math.atan2(-r, h)) : (this._y = 0, this._z = Math.atan2(a, i));
1974
1974
  break;
1975
1975
  case "ZYX":
1976
- this._y = Math.asin(-v(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(m, d), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-r, o));
1976
+ this._y = Math.asin(-Z(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(m, u), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-r, h));
1977
1977
  break;
1978
1978
  case "YZX":
1979
- this._z = Math.asin(v(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, o), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(h, d));
1979
+ this._z = Math.asin(Z(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, h), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(o, u));
1980
1980
  break;
1981
1981
  case "XZY":
1982
- this._z = Math.asin(-v(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(m, o), this._y = Math.atan2(h, i)) : (this._x = Math.atan2(-c, d), this._y = 0);
1982
+ this._z = Math.asin(-Z(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(m, h), this._y = Math.atan2(o, i)) : (this._x = Math.atan2(-c, u), this._y = 0);
1983
1983
  break;
1984
1984
  }
1985
1985
  return this._order = s, e === !0 && this._onChangeCallback(), this;
1986
1986
  }
1987
1987
  setFromQuaternion(t, s, e = !0) {
1988
- return Ut.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Ut, s, e);
1988
+ return Vt.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Vt, s, e);
1989
1989
  }
1990
1990
  setFromVector3(t, s = this._order) {
1991
1991
  return this.set(t.x, t.y, t.z, s);
1992
1992
  }
1993
1993
  reorder(t) {
1994
- return Vt.setFromEuler(this), this.setFromQuaternion(Vt, t);
1994
+ return Ut.setFromEuler(this), this.setFromQuaternion(Ut, t);
1995
1995
  }
1996
1996
  equals(t) {
1997
1997
  return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order;
@@ -2011,9 +2011,9 @@ const Ut = new et(), Vt = new Pt(), tt = class tt {
2011
2011
  yield this._x, yield this._y, yield this._z, yield this._order;
2012
2012
  }
2013
2013
  };
2014
- tt.DEFAULT_ORDER = "XYZ";
2015
- let qt = tt;
2016
- class $t {
2014
+ nt.DEFAULT_ORDER = "XYZ";
2015
+ let Lt = nt;
2016
+ class Wt {
2017
2017
  constructor() {
2018
2018
  this._boundingBoxNeedsUpdate = !1;
2019
2019
  }
@@ -2021,15 +2021,15 @@ class $t {
2021
2021
  return this._boundingBoxNeedsUpdate;
2022
2022
  }
2023
2023
  }
2024
- class Ht extends $t {
2024
+ class Ht extends Wt {
2025
2025
  translate(t) {
2026
- return this.transform(new st().makeTranslation(t.x, t.y));
2026
+ return this.transform(new it().makeTranslation(t.x, t.y));
2027
2027
  }
2028
2028
  get box() {
2029
2029
  return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
2030
2030
  }
2031
2031
  }
2032
- class Ls extends Ht {
2032
+ class js extends Ht {
2033
2033
  constructor() {
2034
2034
  super(), this._loops = [];
2035
2035
  }
@@ -2048,7 +2048,9 @@ class Ls extends Ht {
2048
2048
  return t ? t.box : new F();
2049
2049
  }
2050
2050
  transform(t) {
2051
- return this._boundingBoxNeedsUpdate = !0, this;
2051
+ return this._loops.forEach((s) => {
2052
+ s.transform(t);
2053
+ }), this._boundingBoxNeedsUpdate = !0, this;
2052
2054
  }
2053
2055
  getPoints(t) {
2054
2056
  const s = [];
@@ -2059,7 +2061,7 @@ class Ls extends Ht {
2059
2061
  return s;
2060
2062
  }
2061
2063
  buildHierarchy() {
2062
- var h;
2064
+ var o;
2063
2065
  const t = this.getPoints(100), s = this.calculateBoundaryBoxes(t), e = this.sortBoundaryBoxesByAreas(s), n = /* @__PURE__ */ new Map(), i = e.length;
2064
2066
  for (let a = 0; a < i; a++)
2065
2067
  n.set(e[a], {
@@ -2068,19 +2070,19 @@ class Ls extends Ht {
2068
2070
  });
2069
2071
  const r = { index: -1, children: [] };
2070
2072
  for (let a = 0; a < i; a++) {
2071
- const o = e[a], c = t[o], l = s[o];
2073
+ const h = e[a], c = t[h], l = s[h];
2072
2074
  let m = a + 1;
2073
2075
  for (; m < i; m++) {
2074
- const d = e[m], x = t[d];
2075
- if (s[d].containsBox(l) && As.isPointInPolygon(
2076
- c[b.randInt(0, c.length - 1)],
2076
+ const u = e[m], x = t[u];
2077
+ if (s[u].containsBox(l) && fs.isPointInPolygon(
2078
+ c[M.randInt(0, c.length - 1)],
2077
2079
  x
2078
2080
  )) {
2079
- (h = n.get(d)) == null || h.children.push(n.get(o));
2081
+ (o = n.get(u)) == null || o.children.push(n.get(h));
2080
2082
  break;
2081
2083
  }
2082
2084
  }
2083
- m === i && r.children.push(n.get(o));
2085
+ m === i && r.children.push(n.get(h));
2084
2086
  }
2085
2087
  return r;
2086
2088
  }
@@ -2098,8 +2100,8 @@ class Ls extends Ht {
2098
2100
  if (s < 3) return 0;
2099
2101
  let e = 0;
2100
2102
  for (let n = 0, i = s - 1; n < s; i = n++) {
2101
- const r = t[i], h = t[n];
2102
- e += r.x * h.y - h.x * r.y;
2103
+ const r = t[i], o = t[n];
2104
+ e += r.x * o.y - o.x * r.y;
2103
2105
  }
2104
2106
  return e * 0.5;
2105
2107
  }
@@ -2112,9 +2114,9 @@ class Ls extends Ht {
2112
2114
  sortBoundaryBoxesByAreas(t) {
2113
2115
  const s = [];
2114
2116
  t.forEach((n, i) => {
2115
- const r = n.size, h = r.width * r.height;
2117
+ const r = n.size, o = r.width * r.height;
2116
2118
  s.push({
2117
- area: h,
2119
+ area: o,
2118
2120
  index: i
2119
2121
  });
2120
2122
  }), s.sort((n, i) => n.area - i.area);
@@ -2124,7 +2126,7 @@ class Ls extends Ht {
2124
2126
  }), e;
2125
2127
  }
2126
2128
  }
2127
- class nt extends Ht {
2129
+ class rt extends Ht {
2128
2130
  constructor() {
2129
2131
  super(), this.arcLengthDivisions = 100;
2130
2132
  }
@@ -2174,11 +2176,11 @@ class nt extends Ht {
2174
2176
  const i = e.length;
2175
2177
  let r;
2176
2178
  s ? r = s : r = t * e[i - 1];
2177
- let h = 0, a = i - 1, o;
2178
- for (; h <= a; )
2179
- if (n = Math.floor(h + (a - h) / 2), o = e[n] - r, o < 0)
2180
- h = n + 1;
2181
- else if (o > 0)
2179
+ let o = 0, a = i - 1, h;
2180
+ for (; o <= a; )
2181
+ if (n = Math.floor(o + (a - o) / 2), h = e[n] - r, h < 0)
2182
+ o = n + 1;
2183
+ else if (h > 0)
2182
2184
  a = n - 1;
2183
2185
  else {
2184
2186
  a = n;
@@ -2186,21 +2188,21 @@ class nt extends Ht {
2186
2188
  }
2187
2189
  if (n = a, e[n] === r)
2188
2190
  return n / (i - 1);
2189
- const c = e[n], m = e[n + 1] - c, d = (r - c) / m;
2190
- return (n + d) / (i - 1);
2191
+ const c = e[n], m = e[n + 1] - c, u = (r - c) / m;
2192
+ return (n + u) / (i - 1);
2191
2193
  }
2192
2194
  getTangent(t) {
2193
2195
  let e = t - 1e-4, n = t + 1e-4;
2194
2196
  e < 0 && (e = 0), n > 1 && (n = 1);
2195
- const i = this.getPoint(e), r = this.getPoint(n), h = new C();
2196
- return h.copy(r).sub(i).normalize(), h;
2197
+ const i = this.getPoint(e), r = this.getPoint(n), o = new C();
2198
+ return o.copy(r).sub(i).normalize(), o;
2197
2199
  }
2198
2200
  getTangentAt(t) {
2199
2201
  const s = this.getUtoTmapping(t);
2200
2202
  return this.getTangent(s);
2201
2203
  }
2202
2204
  }
2203
- class $ extends nt {
2205
+ class Q extends rt {
2204
2206
  constructor(t, s, e, n, i) {
2205
2207
  super();
2206
2208
  const r = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
@@ -2215,32 +2217,32 @@ class $ extends nt {
2215
2217
  e
2216
2218
  );
2217
2219
  else if (r == 5) {
2218
- const h = t;
2219
- this.center = new C(h.x, h.y), this.radius = s, this._clockwise = i, this._startAngle = this._clockwise ? this._mirrorAngle(b.normalizeAngle(e)) : b.normalizeAngle(e), this._endAngle = this._clockwise ? this._mirrorAngle(b.normalizeAngle(n)) : b.normalizeAngle(n);
2220
+ const o = t;
2221
+ this.center = new C(o.x, o.y), this.radius = s, this._clockwise = i, this._startAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(e)) : M.normalizeAngle(e), this._endAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(n)) : M.normalizeAngle(n);
2220
2222
  } else
2221
- throw q.ILLEGAL_PARAMETERS;
2223
+ throw L.ILLEGAL_PARAMETERS;
2222
2224
  }
2223
2225
  createByThreePoints(t, s, e) {
2224
- const n = (f, k) => ({
2225
- x: (f.x + k.x) / 2,
2226
- y: (f.y + k.y) / 2
2227
- }), i = (f, k) => (k.y - f.y) / (k.x - f.x), r = (f) => -1 / f, h = n(t, s), a = n(s, e), o = i(t, s), c = i(s, e), l = r(o), m = r(c), d = (f, k, w, T) => {
2228
- const V = (T - k) / (f - w), O = f * V + k;
2229
- return { x: V, y: O };
2230
- }, x = h.y - l * h.x, g = a.y - m * a.x, y = d(l, x, m, g), _ = Math.sqrt(
2226
+ const n = (A, k) => ({
2227
+ x: (A.x + k.x) / 2,
2228
+ y: (A.y + k.y) / 2
2229
+ }), i = (A, k) => (k.y - A.y) / (k.x - A.x), r = (A) => -1 / A, o = n(t, s), a = n(s, e), h = i(t, s), c = i(s, e), l = r(h), m = r(c), u = (A, k, S, T) => {
2230
+ const U = (T - k) / (A - S), K = A * U + k;
2231
+ return { x: U, y: K };
2232
+ }, x = o.y - l * o.x, g = a.y - m * a.x, y = u(l, x, m, g), _ = Math.sqrt(
2231
2233
  Math.pow(t.x - y.x, 2) + Math.pow(t.y - y.y, 2)
2232
- ), M = (f, k) => Math.atan2(f.y - k.y, f.x - k.x), A = M(t, y), P = M(s, y), z = M(e, y), E = z > A && z < P || A > z && A < P || P > z && P < A;
2233
- this.center = y, this.radius = _, this._clockwise = !E, this._startAngle = A, this._endAngle = z;
2234
+ ), z = (A, k) => Math.atan2(A.y - k.y, A.x - k.x), f = z(t, y), b = z(s, y), P = z(e, y), I = P > f && P < b || f > P && f < b || b > P && b < f;
2235
+ this.center = y, this.radius = _, this._clockwise = !I, this._startAngle = f, this._endAngle = P;
2234
2236
  }
2235
2237
  createByStartEndPointsAndBulge(t, s, e) {
2236
2238
  let n, i, r;
2237
2239
  e < 0 ? (n = Math.atan(-e) * 4, i = new B(t), r = new B(s)) : (n = Math.atan(e) * 4, i = new B(s), r = new B(t));
2238
- const h = new B().subVectors(r, i), a = h.length(), o = new B().addVectors(i, h.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = h.normalize(), m = e < 0 ? -Math.PI / 2 : Math.PI / 2, d = new B(
2240
+ const o = new B().subVectors(r, i), a = o.length(), h = new B().addVectors(i, o.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = o.normalize(), m = e < 0 ? -Math.PI / 2 : Math.PI / 2, u = new B(
2239
2241
  l.x * Math.cos(m) - l.y * Math.sin(m),
2240
2242
  l.y * Math.cos(m) + l.x * Math.sin(m)
2241
2243
  );
2242
2244
  let x;
2243
- n < Math.PI ? e < 0 ? x = o.add(d.multiplyScalar(c)) : x = o.add(d.multiplyScalar(-c)) : e < 0 ? x = o.add(d.multiplyScalar(-c)) : x = o.add(d.multiplyScalar(c)), e < 0 ? (this._startAngle = Math.atan2(i.y - x.y, i.x - x.x), this._endAngle = Math.atan2(r.y - x.y, r.x - x.x)) : (this._startAngle = Math.atan2(r.y - x.y, r.x - x.x), this._endAngle = Math.atan2(i.y - x.y, i.x - x.x)), this._clockwise = e < 0, this.center = x, this.radius = r.sub(x).length();
2245
+ n < Math.PI ? e < 0 ? x = h.add(u.multiplyScalar(c)) : x = h.add(u.multiplyScalar(-c)) : e < 0 ? x = h.add(u.multiplyScalar(-c)) : x = h.add(u.multiplyScalar(c)), e < 0 ? (this._startAngle = Math.atan2(i.y - x.y, i.x - x.x), this._endAngle = Math.atan2(r.y - x.y, r.x - x.x)) : (this._startAngle = Math.atan2(r.y - x.y, r.x - x.x), this._endAngle = Math.atan2(i.y - x.y, i.x - x.x)), this._clockwise = e < 0, this.center = x, this.radius = r.sub(x).length();
2244
2246
  }
2245
2247
  get center() {
2246
2248
  return this._center;
@@ -2258,13 +2260,13 @@ class $ extends nt {
2258
2260
  return this._clockwise ? this._mirrorAngle(this._startAngle) : this._startAngle;
2259
2261
  }
2260
2262
  set startAngle(t) {
2261
- this._startAngle = this._clockwise ? this._mirrorAngle(b.normalizeAngle(t)) : b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2263
+ this._startAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(t)) : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2262
2264
  }
2263
2265
  get endAngle() {
2264
2266
  return this._clockwise ? this._mirrorAngle(this._endAngle) : this._endAngle;
2265
2267
  }
2266
2268
  set endAngle(t) {
2267
- const s = this.startAngle == 0 && t == I ? t : b.normalizeAngle(t);
2269
+ const s = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t);
2268
2270
  this._endAngle = this._clockwise ? this._mirrorAngle(s) : s, this._boundingBoxNeedsUpdate = !0;
2269
2271
  }
2270
2272
  _mirrorAngle(t) {
@@ -2275,7 +2277,7 @@ class $ extends nt {
2275
2277
  }
2276
2278
  get deltaAngle() {
2277
2279
  const t = this._getInternalAngle(this.startAngle), s = this._getInternalAngle(this.endAngle);
2278
- return this.clockwise ? b.normalizeAngle(t - s) : b.normalizeAngle(s - t);
2280
+ return this.clockwise ? M.normalizeAngle(t - s) : M.normalizeAngle(s - t);
2279
2281
  }
2280
2282
  get clockwise() {
2281
2283
  return this._clockwise;
@@ -2290,7 +2292,7 @@ class $ extends nt {
2290
2292
  return this.getPointAtAngle(this.endAngle);
2291
2293
  }
2292
2294
  get midPoint() {
2293
- const t = this._getInternalAngle(this.startAngle), s = this._clockwise ? b.normalizeAngle(t - this.deltaAngle / 2) : b.normalizeAngle(t + this.deltaAngle / 2), e = this._clockwise ? this._mirrorAngle(s) : s;
2295
+ const t = this._getInternalAngle(this.startAngle), s = this._clockwise ? M.normalizeAngle(t - this.deltaAngle / 2) : M.normalizeAngle(t + this.deltaAngle / 2), e = this._clockwise ? this._mirrorAngle(s) : s;
2294
2296
  return this.getPointAtAngle(e);
2295
2297
  }
2296
2298
  get closed() {
@@ -2301,7 +2303,7 @@ class $ extends nt {
2301
2303
  const t = [this.startPoint, this.endPoint], s = [0, Math.PI / 2, Math.PI, 3 * Math.PI / 2];
2302
2304
  for (const i of s) {
2303
2305
  const r = this._getInternalAngle(i);
2304
- b.isBetweenAngle(
2306
+ M.isBetweenAngle(
2305
2307
  r,
2306
2308
  this._getInternalAngle(this.startAngle),
2307
2309
  this._getInternalAngle(this.endAngle),
@@ -2318,10 +2320,34 @@ class $ extends nt {
2318
2320
  return Math.abs(this.deltaAngle * this.radius);
2319
2321
  }
2320
2322
  transform(t) {
2321
- return this._boundingBoxNeedsUpdate = !0, this;
2323
+ const s = t, e = this.center.clone().applyMatrix2d(s), n = this.startPoint.clone().applyMatrix2d(s);
2324
+ if (this.closed)
2325
+ return this.center = e, this.radius = e.distanceTo(n), this._startAngle = Math.atan2(
2326
+ n.y - e.y,
2327
+ n.x - e.x
2328
+ ), this._endAngle = this._startAngle, this._clockwise = s.determinant() < 0 ? !this._clockwise : this._clockwise, this._boundingBoxNeedsUpdate = !0, this;
2329
+ const i = this.midPoint.clone().applyMatrix2d(s), r = this.endPoint.clone().applyMatrix2d(s), o = new Q(
2330
+ n,
2331
+ i,
2332
+ r
2333
+ ), a = s.determinant() < 0 ? !this.clockwise : this.clockwise, h = (c) => {
2334
+ const l = M.normalizeAngle(c);
2335
+ return a ? this._mirrorAngle(l) : l;
2336
+ };
2337
+ return this.center = o.center, this.radius = o.radius, this.clockwise = a, this.startAngle = h(
2338
+ Math.atan2(
2339
+ n.y - o.center.y,
2340
+ n.x - o.center.x
2341
+ )
2342
+ ), this.endAngle = h(
2343
+ Math.atan2(
2344
+ r.y - o.center.y,
2345
+ r.x - o.center.x
2346
+ )
2347
+ ), this._boundingBoxNeedsUpdate = !0, this;
2322
2348
  }
2323
2349
  clone() {
2324
- return new $(
2350
+ return new Q(
2325
2351
  this.center.clone(),
2326
2352
  this.radius,
2327
2353
  this._startAngle,
@@ -2336,32 +2362,32 @@ class $ extends nt {
2336
2362
  getPoints(t = 100) {
2337
2363
  const s = [];
2338
2364
  let e = this.deltaAngle, n = this._getInternalAngle(this.startAngle);
2339
- if (this.closed && (e = I, n = 0), this.clockwise)
2365
+ if (this.closed && (e = E, n = 0), this.clockwise)
2340
2366
  for (let i = 0; i <= t; i++) {
2341
- const r = n - e * (i / t), h = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(h);
2367
+ const r = n - e * (i / t), o = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(o);
2342
2368
  s.push(new C(a.x, a.y));
2343
2369
  }
2344
2370
  else
2345
2371
  for (let i = 0; i <= t; i++) {
2346
- const r = n + e * (i / t), h = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(h);
2372
+ const r = n + e * (i / t), o = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(o);
2347
2373
  s.push(new C(a.x, a.y));
2348
2374
  }
2349
2375
  return s;
2350
2376
  }
2351
2377
  }
2352
- class Cs extends $t {
2378
+ class Cs extends Wt {
2353
2379
  translate(t) {
2354
- return this.transform(new et().makeTranslation(t.x, t.y, t.z));
2380
+ return this.transform(new H().makeTranslation(t.x, t.y, t.z));
2355
2381
  }
2356
2382
  get box() {
2357
2383
  return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
2358
2384
  }
2359
2385
  }
2360
- class it extends Cs {
2386
+ class ot extends Cs {
2361
2387
  }
2362
- class ft extends it {
2388
+ class Mt extends ot {
2363
2389
  constructor(t, s) {
2364
- super(), this._start = new S(t), this._end = new S(s);
2390
+ super(), this._start = new w(t), this._end = new w(s);
2365
2391
  }
2366
2392
  get startPoint() {
2367
2393
  return this._start;
@@ -2379,7 +2405,7 @@ class ft extends it {
2379
2405
  return new p().subVectors(this.endPoint, this.startPoint).normalize();
2380
2406
  }
2381
2407
  get midPoint() {
2382
- return new S(
2408
+ return new w(
2383
2409
  (this._start.x + this._end.x) / 2,
2384
2410
  (this._start.y + this._end.y) / 2,
2385
2411
  (this._start.z + this._end.z) / 2
@@ -2399,31 +2425,31 @@ class ft extends it {
2399
2425
  }
2400
2426
  atLength(t, s = !1) {
2401
2427
  if (s) {
2402
- const e = this.delta(G).normalize();
2403
- return new S(this._start).addScaledVector(e, t);
2428
+ const e = this.delta(O).normalize();
2429
+ return new w(this._start).addScaledVector(e, t);
2404
2430
  } else {
2405
- const e = this.delta(G).normalize();
2406
- return new S(this._end).addScaledVector(e, t);
2431
+ const e = this.delta(O).normalize();
2432
+ return new w(this._end).addScaledVector(e, t);
2407
2433
  }
2408
2434
  }
2409
2435
  extend(t, s = !1) {
2410
2436
  if (s) {
2411
- const e = G.subVectors(this._start, this._end).normalize();
2412
- this._start = new S(this._start).addScaledVector(
2437
+ const e = O.subVectors(this._start, this._end).normalize();
2438
+ this._start = new w(this._start).addScaledVector(
2413
2439
  e,
2414
2440
  t
2415
2441
  );
2416
2442
  } else {
2417
- const e = this.delta(G).normalize();
2418
- this._end = new S(this._end).addScaledVector(e, t);
2443
+ const e = this.delta(O).normalize();
2444
+ this._end = new w(this._end).addScaledVector(e, t);
2419
2445
  }
2420
2446
  return this._boundingBoxNeedsUpdate = !0, this;
2421
2447
  }
2422
2448
  closestPointToPointParameter(t, s) {
2423
- jt.subVectors(t, this._start), gt.subVectors(this.endPoint, this.startPoint);
2424
- const e = gt.dot(gt);
2425
- let i = gt.dot(jt) / e;
2426
- return s && (i = b.clamp(i, 0, 1)), i;
2449
+ qt.subVectors(t, this._start), _t.subVectors(this.endPoint, this.startPoint);
2450
+ const e = _t.dot(_t);
2451
+ let i = _t.dot(qt) / e;
2452
+ return s && (i = M.clamp(i, 0, 1)), i;
2427
2453
  }
2428
2454
  closestPointToPoint(t, s, e) {
2429
2455
  const n = this.closestPointToPointParameter(t, s);
@@ -2439,24 +2465,24 @@ class ft extends it {
2439
2465
  return this._start.distanceTo(this._end);
2440
2466
  }
2441
2467
  project(t) {
2442
- const s = this.direction, n = G.subVectors(t, this.startPoint).dot(s);
2443
- return new S().copy(s).multiplyScalar(n).add(this.startPoint);
2468
+ const s = this.direction, n = O.subVectors(t, this.startPoint).dot(s);
2469
+ return new w().copy(s).multiplyScalar(n).add(this.startPoint);
2444
2470
  }
2445
2471
  perpPoint(t) {
2446
- const s = this.direction, e = this.startPoint, i = G.subVectors(t, e).dot(s), r = G.copy(s).multiplyScalar(i);
2447
- return new S().addVectors(e, r);
2472
+ const s = this.direction, e = this.startPoint, i = O.subVectors(t, e).dot(s), r = O.copy(s).multiplyScalar(i);
2473
+ return new w().addVectors(e, r);
2448
2474
  }
2449
2475
  calculateBoundingBox() {
2450
- const t = new S(
2476
+ const t = new w(
2451
2477
  Math.min(this._start.x, this._end.x),
2452
2478
  Math.min(this._start.y, this._end.y),
2453
2479
  Math.min(this._start.z, this._end.z)
2454
- ), s = new S(
2480
+ ), s = new w(
2455
2481
  Math.max(this._start.x, this._end.x),
2456
2482
  Math.max(this._start.y, this._end.y),
2457
2483
  Math.max(this._start.z, this._end.z)
2458
2484
  );
2459
- return new D(t, s);
2485
+ return new Y(t, s);
2460
2486
  }
2461
2487
  transform(t) {
2462
2488
  return this._start.applyMatrix4(t), this._end.applyMatrix4(t), this._boundingBoxNeedsUpdate = !0, this;
@@ -2468,65 +2494,65 @@ class ft extends it {
2468
2494
  return this.startPoint = t.startPoint, this.endPoint = t.endPoint, this._boundingBoxNeedsUpdate = !0, this;
2469
2495
  }
2470
2496
  clone() {
2471
- return new ft(this._start.clone(), this._end.clone());
2497
+ return new Mt(this._start.clone(), this._end.clone());
2472
2498
  }
2473
2499
  }
2474
- const G = new p(), jt = new p(), gt = new p();
2475
- class pt extends it {
2500
+ const O = new p(), qt = new p(), _t = new p();
2501
+ class At extends ot {
2476
2502
  static computeCenterPoint(t, s, e) {
2477
- const n = new p().addVectors(t, s).multiplyScalar(0.5), i = new p().addVectors(t, e).multiplyScalar(0.5), r = new p().subVectors(s, t), h = new p().subVectors(e, t), a = new p().crossVectors(r, h).normalize();
2503
+ const n = new p().addVectors(t, s).multiplyScalar(0.5), i = new p().addVectors(t, e).multiplyScalar(0.5), r = new p().subVectors(s, t), o = new p().subVectors(e, t), a = new p().crossVectors(r, o).normalize();
2478
2504
  if (a.lengthSq() === 0)
2479
2505
  return null;
2480
- const o = new p().crossVectors(r, a).normalize(), c = new p().crossVectors(h, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = new ft(n, n.clone().add(l)), x = new ft(i, i.clone().add(m)), g = new p();
2481
- return d.closestPointToPoint(x.startPoint, !0, g) ? g : null;
2506
+ const h = new p().crossVectors(r, a).normalize(), c = new p().crossVectors(o, a).normalize(), l = h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), u = new Mt(n, n.clone().add(l)), x = new Mt(i, i.clone().add(m)), g = new p();
2507
+ return u.closestPointToPoint(x.startPoint, !0, g) ? g : null;
2482
2508
  }
2483
2509
  static createByThreePoints(t, s, e) {
2484
- const n = pt.computeCenterPoint(
2510
+ const n = At.computeCenterPoint(
2485
2511
  t,
2486
2512
  s,
2487
2513
  e
2488
2514
  );
2489
2515
  if (n) {
2490
- const i = n.distanceTo(t), r = new p().subVectors(t, n), h = new p().subVectors(s, n), a = Math.atan2(r.y, r.x), o = Math.atan2(h.y, h.x);
2491
- return new pt(
2516
+ const i = n.distanceTo(t), r = new p().subVectors(t, n), o = new p().subVectors(s, n), a = Math.atan2(r.y, r.x), h = Math.atan2(o.y, o.x);
2517
+ return new At(
2492
2518
  n,
2493
2519
  i,
2494
2520
  a,
2495
- o,
2521
+ h,
2496
2522
  p.Z_AXIS
2497
2523
  );
2498
2524
  }
2499
2525
  }
2500
2526
  constructor(t, s, e, n, i, r = p.X_AXIS) {
2501
- super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec = r, (n - e) % I == 0 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = e, this.endAngle = n);
2527
+ super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec = r, (n - e) % E == 0 ? (this.startAngle = 0, this.endAngle = E) : (this.startAngle = e, this.endAngle = n);
2502
2528
  }
2503
2529
  get center() {
2504
2530
  return this._center;
2505
2531
  }
2506
2532
  set center(t) {
2507
- this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
2533
+ this._center = new w(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
2508
2534
  }
2509
2535
  get radius() {
2510
2536
  return this._radius;
2511
2537
  }
2512
2538
  set radius(t) {
2513
- if (t < 0) throw q.ILLEGAL_PARAMETERS;
2539
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
2514
2540
  this._radius = t, this._boundingBoxNeedsUpdate = !0;
2515
2541
  }
2516
2542
  get startAngle() {
2517
2543
  return this._startAngle;
2518
2544
  }
2519
2545
  set startAngle(t) {
2520
- this._startAngle = b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2546
+ this._startAngle = M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2521
2547
  }
2522
2548
  get endAngle() {
2523
2549
  return this._endAngle;
2524
2550
  }
2525
2551
  set endAngle(t) {
2526
- this._endAngle = this.startAngle == 0 && t == I ? t : b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2552
+ this._endAngle = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2527
2553
  }
2528
2554
  get deltaAngle() {
2529
- return b.normalizeAngle(this.endAngle - this.startAngle);
2555
+ return M.normalizeAngle(this.endAngle - this.startAngle);
2530
2556
  }
2531
2557
  get isLargeArc() {
2532
2558
  return Math.abs(this.deltaAngle) > Math.PI ? 1 : 0;
@@ -2554,7 +2580,7 @@ class pt extends it {
2554
2580
  }
2555
2581
  get midPoint() {
2556
2582
  let t = this.startAngle, s = this.deltaAngle;
2557
- this.closed && (t = 0, s = I);
2583
+ this.closed && (t = 0, s = E);
2558
2584
  const e = t + s * 0.5;
2559
2585
  return this.getPointAtAngle(e);
2560
2586
  }
@@ -2569,18 +2595,18 @@ class pt extends it {
2569
2595
  if (a.lengthSq() === 0)
2570
2596
  return this.startPoint.clone();
2571
2597
  a.normalize().multiplyScalar(this.radius);
2572
- const o = e.clone().add(a), c = this.getAngle(o.clone()), l = this.startAngle, m = this.deltaAngle;
2573
- let d = b.normalizeAngle(c - l);
2574
- d < 0 && (d = 0), d > m && (d = m);
2575
- const x = this.getPointAtAngle(l + d), g = x.distanceTo(s), y = this.startPoint.distanceTo(s), _ = this.endPoint.distanceTo(s);
2598
+ const h = e.clone().add(a), c = this.getAngle(h.clone()), l = this.startAngle, m = this.deltaAngle;
2599
+ let u = M.normalizeAngle(c - l);
2600
+ u < 0 && (u = 0), u > m && (u = m);
2601
+ const x = this.getPointAtAngle(l + u), g = x.distanceTo(s), y = this.startPoint.distanceTo(s), _ = this.endPoint.distanceTo(s);
2576
2602
  return y < g && y <= _ ? this.startPoint.clone() : _ < g && _ < y ? this.endPoint.clone() : x;
2577
2603
  }
2578
2604
  tangentPoints(t) {
2579
- const s = [], e = new p(t.x, t.y, t.z || 0), n = this.center, i = this.normal, r = this.radius, a = e.clone().sub(n).dot(i), o = e.clone().sub(i.clone().multiplyScalar(a)), c = n.clone(), m = o.clone().sub(c).length();
2605
+ const s = [], e = new p(t.x, t.y, t.z || 0), n = this.center, i = this.normal, r = this.radius, a = e.clone().sub(n).dot(i), h = e.clone().sub(i.clone().multiplyScalar(a)), c = n.clone(), m = h.clone().sub(c).length();
2580
2606
  if (m < r) return s;
2581
- const d = Math.acos(r / m), x = this.getAngle(o.clone()), g = [x + d, x - d];
2607
+ const u = Math.acos(r / m), x = this.getAngle(h.clone()), g = [x + u, x - u];
2582
2608
  for (const y of g) {
2583
- const _ = b.normalizeAngle(y - this.startAngle);
2609
+ const _ = M.normalizeAngle(y - this.startAngle);
2584
2610
  _ >= 0 && _ <= this.deltaAngle && s.push(this.getPointAtAngle(this.startAngle + _));
2585
2611
  }
2586
2612
  return s;
@@ -2588,21 +2614,21 @@ class pt extends it {
2588
2614
  nearestTangentPoint(t) {
2589
2615
  const s = this.tangentPoints(t);
2590
2616
  if (s.length === 0) return null;
2591
- const e = new S(t.x, t.y, t.z || 0);
2617
+ const e = new w(t.x, t.y, t.z || 0);
2592
2618
  return s.length === 1 || s[0].distanceTo(e) < s[1].distanceTo(e) ? s[0] : s[1];
2593
2619
  }
2594
2620
  calculateBoundingBox() {
2595
2621
  const t = [this.startAngle, this.endAngle];
2596
2622
  for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
2597
- b.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
2598
- let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, h = -1 / 0;
2623
+ M.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
2624
+ let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, o = -1 / 0;
2599
2625
  for (const a of t) {
2600
- const o = this.getPointAtAngle(a);
2601
- o.x < s && (s = o.x), o.y < e && (e = o.y), o.z < n && (n = o.z), o.x > i && (i = o.x), o.y > r && (r = o.y), o.z > h && (h = o.z);
2626
+ const h = this.getPointAtAngle(a);
2627
+ h.x < s && (s = h.x), h.y < e && (e = h.y), h.z < n && (n = h.z), h.x > i && (i = h.x), h.y > r && (r = h.y), h.z > o && (o = h.z);
2602
2628
  }
2603
- return new D(
2629
+ return new Y(
2604
2630
  { x: s, y: e, z: n },
2605
- { x: i, y: r, z: h }
2631
+ { x: i, y: r, z: o }
2606
2632
  );
2607
2633
  }
2608
2634
  get closed() {
@@ -2611,22 +2637,36 @@ class pt extends it {
2611
2637
  getPoints(t) {
2612
2638
  const s = [];
2613
2639
  let e = this.deltaAngle, n = this.startAngle;
2614
- this.closed && (e = I, n = 0);
2640
+ this.closed && (e = E, n = 0);
2615
2641
  for (let i = 0; i <= t; i++) {
2616
- const r = n + e * (i / t), h = this.getPointAtAngle(r);
2617
- s.push(h);
2642
+ const r = n + e * (i / t), o = this.getPointAtAngle(r);
2643
+ s.push(o);
2618
2644
  }
2619
2645
  return s;
2620
2646
  }
2621
2647
  transform(t) {
2622
- const s = Bt.copy(this.refVec).applyAxisAngle(this.normal, this.startAngle).multiplyScalar(this.radius), e = Bt.copy(this.refVec).applyAxisAngle(this.normal, this.endAngle).multiplyScalar(this.radius);
2623
- return this.center.applyMatrix4(t), s.applyMatrix4(t), e.applyMatrix4(t), this.normal.applyMatrix4(t).normalize(), this.refVec.applyMatrix4(t).normalize(), this.startAngle = this.getAngle(s), this.endAngle = this.getAngle(e), this._boundingBoxNeedsUpdate = !0, this;
2648
+ const s = this.center.clone().applyMatrix4(t), e = this.startPoint.clone().applyMatrix4(t), n = this.endPoint.clone().applyMatrix4(t), i = this.getPointAtAngle(
2649
+ this.closed ? Math.PI / 2 : this.startAngle + this.deltaAngle / 2
2650
+ ).clone().applyMatrix4(t), r = new p(e).sub(s).normalize(), o = s.distanceTo(e);
2651
+ let a = new p().crossVectors(
2652
+ new p(e).sub(s),
2653
+ new p(i).sub(s)
2654
+ ).normalize();
2655
+ a.lengthSq() === 0 && (a = this.normal.clone().transformDirection(t));
2656
+ const h = (c) => {
2657
+ const l = new p(c).sub(s);
2658
+ return Math.atan2(
2659
+ l.dot(Ft.crossVectors(a, r)),
2660
+ l.dot(r)
2661
+ );
2662
+ };
2663
+ return this.center = s, this.radius = o, this.normal = a, this.refVec = r, this.startAngle = 0, this.endAngle = this.closed ? E : h(n), this._boundingBoxNeedsUpdate = !0, this;
2624
2664
  }
2625
2665
  copy(t) {
2626
2666
  return this.center = t.center, this.radius = t.radius, this.startAngle = t.startAngle, this.endAngle = t.endAngle, this.normal = t.normal, this.refVec = t.refVec, this._boundingBoxNeedsUpdate = !0, this;
2627
2667
  }
2628
2668
  clone() {
2629
- return new pt(
2669
+ return new At(
2630
2670
  this.center.clone(),
2631
2671
  this.radius,
2632
2672
  this.startAngle,
@@ -2637,7 +2677,7 @@ class pt extends it {
2637
2677
  }
2638
2678
  getAngle(t) {
2639
2679
  return t.sub(this.center), Math.atan2(
2640
- t.dot(Bt.crossVectors(this.refVec, this.normal)),
2680
+ t.dot(Ft.crossVectors(this.refVec, this.normal)),
2641
2681
  t.dot(this.refVec)
2642
2682
  );
2643
2683
  }
@@ -2647,53 +2687,53 @@ class pt extends it {
2647
2687
  y: s.z * e.x - s.x * e.z,
2648
2688
  z: s.x * e.y - s.y * e.x
2649
2689
  }, i = this.center, r = this.radius;
2650
- return new S(
2690
+ return new w(
2651
2691
  i.x + r * (e.x * Math.cos(t) + n.x * Math.sin(t)),
2652
2692
  i.y + r * (e.y * Math.cos(t) + n.y * Math.sin(t)),
2653
2693
  i.z + r * (e.z * Math.cos(t) + n.z * Math.sin(t))
2654
2694
  );
2655
2695
  }
2656
2696
  get plane() {
2657
- const t = new p(this.center).distanceTo(vt);
2658
- return new bt(this.normal, t);
2697
+ const t = new p(this.center).distanceTo(Ot);
2698
+ return new St(this.normal, t);
2659
2699
  }
2660
2700
  }
2661
- const Bt = new p();
2662
- class zt extends nt {
2663
- constructor(t, s, e, n = 0, i = I, r = !1, h = 0) {
2664
- super(), this.center = t, this.majorAxisRadius = s, this.minorAxisRadius = e, (i - n) % I == 0 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = n, this.endAngle = i), this.clockwise = r, this.rotation = h;
2701
+ const Ft = new p();
2702
+ class W extends rt {
2703
+ constructor(t, s, e, n = 0, i = E, r = !1, o = 0) {
2704
+ super(), this.center = t, this.majorAxisRadius = s, this.minorAxisRadius = e, (i - n) % E == 0 ? (this.startAngle = 0, this.endAngle = E) : (this.startAngle = n, this.endAngle = i), this.clockwise = r, this.rotation = o;
2665
2705
  }
2666
2706
  get center() {
2667
2707
  return this._center;
2668
2708
  }
2669
2709
  set center(t) {
2670
- this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
2710
+ this._center = new w(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
2671
2711
  }
2672
2712
  get majorAxisRadius() {
2673
2713
  return this._majorAxisRadius;
2674
2714
  }
2675
2715
  set majorAxisRadius(t) {
2676
- if (t < 0) throw q.ILLEGAL_PARAMETERS;
2716
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
2677
2717
  this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
2678
2718
  }
2679
2719
  get minorAxisRadius() {
2680
2720
  return this._minorAxisRadius;
2681
2721
  }
2682
2722
  set minorAxisRadius(t) {
2683
- if (t < 0) throw q.ILLEGAL_PARAMETERS;
2723
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
2684
2724
  this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
2685
2725
  }
2686
2726
  get startAngle() {
2687
2727
  return this._startAngle;
2688
2728
  }
2689
2729
  set startAngle(t) {
2690
- this._startAngle = b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2730
+ this._startAngle = M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2691
2731
  }
2692
2732
  get endAngle() {
2693
2733
  return this._endAngle;
2694
2734
  }
2695
2735
  set endAngle(t) {
2696
- this._endAngle = this.startAngle == 0 && t == I ? t : b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2736
+ this._endAngle = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2697
2737
  }
2698
2738
  get clockwise() {
2699
2739
  return this._clockwise;
@@ -2708,7 +2748,7 @@ class zt extends nt {
2708
2748
  this._rotation = t, this._boundingBoxNeedsUpdate = !0;
2709
2749
  }
2710
2750
  get deltaAngle() {
2711
- return b.normalizeAngle(this.endAngle - this.startAngle);
2751
+ return M.normalizeAngle(this.endAngle - this.startAngle);
2712
2752
  }
2713
2753
  get isLargeArc() {
2714
2754
  return Math.abs(this.deltaAngle) > Math.PI ? 1 : 0;
@@ -2716,8 +2756,8 @@ class zt extends nt {
2716
2756
  calculateBoundingBox() {
2717
2757
  let s = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
2718
2758
  for (let r = 0; r <= 100; r++) {
2719
- const h = this.getPoint(r / 100);
2720
- s = Math.min(s, h.x), e = Math.min(e, h.y), n = Math.max(n, h.x), i = Math.max(i, h.y);
2759
+ const o = this.getPoint(r / 100);
2760
+ s = Math.min(s, o.x), e = Math.min(e, o.y), n = Math.max(n, o.x), i = Math.max(i, o.y);
2721
2761
  }
2722
2762
  return new F({ x: s, y: e }, { x: n, y: i });
2723
2763
  }
@@ -2732,21 +2772,58 @@ class zt extends nt {
2732
2772
  for (; e > s; ) e -= s;
2733
2773
  e < Number.EPSILON && (n ? e = 0 : e = s), this.clockwise === !0 && !n && (e === s ? e = -s : e = e - s);
2734
2774
  const i = this.startAngle + t * e;
2735
- let r = this.center.x + this.majorAxisRadius * Math.cos(i), h = this.center.y + this.minorAxisRadius * Math.sin(i);
2775
+ let r = this.center.x + this.majorAxisRadius * Math.cos(i), o = this.center.y + this.minorAxisRadius * Math.sin(i);
2736
2776
  if (this.rotation !== 0) {
2737
- const a = Math.cos(this.rotation), o = Math.sin(this.rotation), c = r - this.center.x, l = h - this.center.y;
2738
- r = c * a - l * o + this.center.x, h = c * o + l * a + this.center.y;
2777
+ const a = Math.cos(this.rotation), h = Math.sin(this.rotation), c = r - this.center.x, l = o - this.center.y;
2778
+ r = c * a - l * h + this.center.x, o = c * h + l * a + this.center.y;
2739
2779
  }
2740
- return new C(r, h);
2780
+ return new C(r, o);
2741
2781
  }
2742
2782
  transform(t) {
2743
- return this._boundingBoxNeedsUpdate = !0, this;
2783
+ const s = t, e = new C(this.center).applyMatrix2d(
2784
+ s
2785
+ ), n = new w(
2786
+ e.x,
2787
+ e.y,
2788
+ this.center.z
2789
+ ), i = this.getPointAtAngle(0).clone().applyMatrix2d(s), r = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix2d(s), o = new C(i).sub(
2790
+ e
2791
+ ), a = new C(r).sub(
2792
+ e
2793
+ ), h = o.length(), c = a.length(), l = Math.atan2(o.y, o.x), m = o.clone().normalize(), u = a.clone().normalize(), x = (_) => {
2794
+ const z = new C(_).sub(e), f = z.dot(m), b = z.dot(u);
2795
+ return M.normalizeAngle(
2796
+ Math.atan2(b / c, f / h)
2797
+ );
2798
+ }, g = s.determinant() < 0 ? !this.clockwise : this.clockwise, y = this.closed ? new W(
2799
+ n,
2800
+ h,
2801
+ c,
2802
+ 0,
2803
+ E,
2804
+ g,
2805
+ l
2806
+ ) : new W(
2807
+ n,
2808
+ h,
2809
+ c,
2810
+ x(this.startPoint.clone().applyMatrix2d(s)),
2811
+ x(this.endPoint.clone().applyMatrix2d(s)),
2812
+ g,
2813
+ l
2814
+ );
2815
+ return this.center = y.center, this.majorAxisRadius = y.majorAxisRadius, this.minorAxisRadius = y.minorAxisRadius, this._startAngle = y._startAngle, this._endAngle = y._endAngle, this._clockwise = y._clockwise, this.rotation = y.rotation, this._boundingBoxNeedsUpdate = !0, this;
2816
+ }
2817
+ getPointAtAngle(t) {
2818
+ return this.getPoint(
2819
+ this.closed ? t / E : M.normalizeAngle(t - this.startAngle) / this.deltaAngle
2820
+ );
2744
2821
  }
2745
2822
  copy(t) {
2746
2823
  return this.center = t.center, this.majorAxisRadius = t.majorAxisRadius, this.minorAxisRadius = t.minorAxisRadius, this.startAngle = t.startAngle, this.endAngle = t.endAngle, this.clockwise = t.clockwise, this.rotation = t.rotation, this;
2747
2824
  }
2748
2825
  clone() {
2749
- return new zt(
2826
+ return new W(
2750
2827
  this.center,
2751
2828
  this.majorAxisRadius,
2752
2829
  this.minorAxisRadius,
@@ -2757,47 +2834,47 @@ class zt extends nt {
2757
2834
  );
2758
2835
  }
2759
2836
  }
2760
- class Wt extends it {
2761
- constructor(t, s, e, n, i, r = 0, h = I) {
2837
+ class zt extends ot {
2838
+ constructor(t, s, e, n, i, r = 0, o = E) {
2762
2839
  super(), this.center = t, this.normal = s, this.majorAxis = e, this.majorAxisRadius = n, this.minorAxisRadius = i;
2763
- const a = Math.abs(h - r);
2764
- Math.abs(a - I) < 1e-10 || Math.abs(a - 2 * I) < 1e-10 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = r, this.endAngle = h);
2840
+ const a = Math.abs(o - r);
2841
+ Math.abs(a - E) < 1e-10 || Math.abs(a - 2 * E) < 1e-10 ? (this.startAngle = 0, this.endAngle = E) : (this.startAngle = r, this.endAngle = o);
2765
2842
  }
2766
2843
  get center() {
2767
2844
  return this._center;
2768
2845
  }
2769
2846
  set center(t) {
2770
- this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
2847
+ this._center = new w(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
2771
2848
  }
2772
2849
  get majorAxisRadius() {
2773
2850
  return this._majorAxisRadius;
2774
2851
  }
2775
2852
  set majorAxisRadius(t) {
2776
- if (t < 0) throw q.ILLEGAL_PARAMETERS;
2853
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
2777
2854
  this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
2778
2855
  }
2779
2856
  get minorAxisRadius() {
2780
2857
  return this._minorAxisRadius;
2781
2858
  }
2782
2859
  set minorAxisRadius(t) {
2783
- if (t < 0) throw q.ILLEGAL_PARAMETERS;
2860
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
2784
2861
  this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
2785
2862
  }
2786
2863
  get startAngle() {
2787
2864
  return this._startAngle;
2788
2865
  }
2789
2866
  set startAngle(t) {
2790
- this._startAngle = b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2867
+ this._startAngle = M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2791
2868
  }
2792
2869
  get endAngle() {
2793
2870
  return this._endAngle;
2794
2871
  }
2795
2872
  set endAngle(t) {
2796
- this._endAngle = this.startAngle == 0 && t == I ? t : b.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2873
+ this._endAngle = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
2797
2874
  }
2798
2875
  get deltaAngle() {
2799
2876
  const t = this.endAngle - this.startAngle;
2800
- return Math.abs(t - I) < 1e-10 ? I : b.normalizeAngle(t);
2877
+ return Math.abs(t - E) < 1e-10 ? E : M.normalizeAngle(t);
2801
2878
  }
2802
2879
  get isLargeArc() {
2803
2880
  return Math.abs(this.deltaAngle) > Math.PI ? 1 : 0;
@@ -2828,12 +2905,12 @@ class Wt extends it {
2828
2905
  }
2829
2906
  get midPoint() {
2830
2907
  let t = this.startAngle, s = this.deltaAngle;
2831
- (this.closed || Math.abs(s - I) < 1e-10) && (t = 0, s = I);
2908
+ (this.closed || Math.abs(s - E) < 1e-10) && (t = 0, s = E);
2832
2909
  const e = t + s / 2;
2833
2910
  return this.getPointAtAngle(e);
2834
2911
  }
2835
2912
  get isCircular() {
2836
- return Gt.equal(this.majorAxisRadius, this.minorAxisRadius);
2913
+ return Qt.equal(this.majorAxisRadius, this.minorAxisRadius);
2837
2914
  }
2838
2915
  get length() {
2839
2916
  if (this.isCircular)
@@ -2841,14 +2918,14 @@ class Wt extends it {
2841
2918
  const t = 1e3, s = this.deltaAngle / t;
2842
2919
  let e = 0, n = this.getPointAtAngle(this.startAngle);
2843
2920
  for (let i = 1; i <= t; i++) {
2844
- const r = this.startAngle + i * s, h = this.getPointAtAngle(r), a = h.x - n.x, o = h.y - n.y, c = h.z - n.z;
2845
- e += Math.sqrt(a * a + o * o + c * c), n = h;
2921
+ const r = this.startAngle + i * s, o = this.getPointAtAngle(r), a = o.x - n.x, h = o.y - n.y, c = o.z - n.z;
2922
+ e += Math.sqrt(a * a + h * h + c * c), n = o;
2846
2923
  }
2847
2924
  return e;
2848
2925
  }
2849
2926
  get area() {
2850
2927
  const t = this.majorAxisRadius, s = this.minorAxisRadius, e = this.startAngle, n = e + this.deltaAngle;
2851
- if (Math.abs(this.deltaAngle - I) < 1e-10)
2928
+ if (Math.abs(this.deltaAngle - E) < 1e-10)
2852
2929
  return Math.PI * t * s;
2853
2930
  const i = t * s / 2 * (n - e - (Math.sin(n) * Math.cos(n) - Math.sin(e) * Math.cos(e)));
2854
2931
  return Math.abs(i);
@@ -2857,25 +2934,25 @@ class Wt extends it {
2857
2934
  if (this.majorAxis.equals(p.X_AXIS) || this.majorAxis.equals(p.Y_AXIS) || this.majorAxis.isParallelTo(p.X_AXIS) || this.majorAxis.isParallelTo(p.Y_AXIS)) {
2858
2935
  const t = [this.startAngle, this.endAngle];
2859
2936
  for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
2860
- b.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
2861
- let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, h = -1 / 0;
2937
+ M.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
2938
+ let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, o = -1 / 0;
2862
2939
  for (const a of t) {
2863
- const o = this.getPointAtAngle(a);
2864
- o.x < s && (s = o.x), o.y < e && (e = o.y), o.z < n && (n = o.z), o.x > i && (i = o.x), o.y > r && (r = o.y), o.z > h && (h = o.z);
2940
+ const h = this.getPointAtAngle(a);
2941
+ h.x < s && (s = h.x), h.y < e && (e = h.y), h.z < n && (n = h.z), h.x > i && (i = h.x), h.y > r && (r = h.y), h.z > o && (o = h.z);
2865
2942
  }
2866
- return new D(
2943
+ return new Y(
2867
2944
  { x: s, y: e, z: n },
2868
- { x: i, y: r, z: h }
2945
+ { x: i, y: r, z: o }
2869
2946
  );
2870
2947
  } else {
2871
- let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, h = -1 / 0;
2948
+ let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, o = -1 / 0;
2872
2949
  for (let a = 0; a <= 100; a++) {
2873
- const o = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(o);
2874
- s = Math.min(s, c.x), e = Math.min(e, c.y), n = Math.min(n, c.z), i = Math.max(i, c.x), r = Math.max(r, c.y), h = Math.max(h, c.z);
2950
+ const h = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(h);
2951
+ s = Math.min(s, c.x), e = Math.min(e, c.y), n = Math.min(n, c.z), i = Math.max(i, c.x), r = Math.max(r, c.y), o = Math.max(o, c.z);
2875
2952
  }
2876
- return new D(
2953
+ return new Y(
2877
2954
  { x: s, y: e, z: n },
2878
- { x: i, y: r, z: h }
2955
+ { x: i, y: r, z: o }
2879
2956
  );
2880
2957
  }
2881
2958
  }
@@ -2885,16 +2962,16 @@ class Wt extends it {
2885
2962
  getPoints(t = 100) {
2886
2963
  const s = [];
2887
2964
  let e = this.deltaAngle, n = this.startAngle;
2888
- this.closed && (e = I, n = 0);
2965
+ this.closed && (e = E, n = 0);
2889
2966
  for (let i = 0; i <= t; i++) {
2890
- const r = n + e * (i / t), h = this.getPointAtAngle(r);
2891
- s.push(h);
2967
+ const r = n + e * (i / t), o = this.getPointAtAngle(r);
2968
+ s.push(o);
2892
2969
  }
2893
2970
  return s;
2894
2971
  }
2895
2972
  getPointAtAngle(t) {
2896
2973
  const s = Math.cos(t), e = Math.sin(t), n = this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e), i = this.majorAxis.clone().multiplyScalar(s * this.majorAxisRadius).add(n);
2897
- return new S(
2974
+ return new w(
2898
2975
  this.center.x + i.x,
2899
2976
  this.center.y + i.y,
2900
2977
  this.center.z + i.z
@@ -2905,13 +2982,42 @@ class Wt extends it {
2905
2982
  return i * i + r * r <= 1;
2906
2983
  }
2907
2984
  transform(t) {
2908
- return this._boundingBoxNeedsUpdate = !0, this;
2985
+ const s = t, e = this.center.clone().applyMatrix4(s), n = this.getPointAtAngle(0).clone().applyMatrix4(s), i = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix4(s), r = new p(n).sub(
2986
+ e
2987
+ ), o = new p(i).sub(
2988
+ e
2989
+ ), a = r.length(), h = o.length(), c = r.clone().normalize(), l = new p().crossVectors(r, o).normalize();
2990
+ let m = new p().crossVectors(l, c).normalize();
2991
+ m.dot(o) < 0 && (l.negate(), m = new p().crossVectors(l, c).normalize());
2992
+ const u = (g) => {
2993
+ const y = new p(g).sub(e), _ = y.dot(c), z = y.dot(m);
2994
+ return M.normalizeAngle(
2995
+ Math.atan2(z / h, _ / a)
2996
+ );
2997
+ }, x = this.closed ? new zt(
2998
+ e,
2999
+ l,
3000
+ c,
3001
+ a,
3002
+ h,
3003
+ 0,
3004
+ E
3005
+ ) : new zt(
3006
+ e,
3007
+ l,
3008
+ c,
3009
+ a,
3010
+ h,
3011
+ u(this.startPoint.clone().applyMatrix4(s)),
3012
+ u(this.endPoint.clone().applyMatrix4(s))
3013
+ );
3014
+ return this.center = x.center, this.normal = x.normal, this.majorAxis = x.majorAxis, this.majorAxisRadius = x.majorAxisRadius, this.minorAxisRadius = x.minorAxisRadius, this._startAngle = x._startAngle, this._endAngle = x._endAngle, this._boundingBoxNeedsUpdate = !0, this;
2909
3015
  }
2910
3016
  copy(t) {
2911
3017
  return this.center = t.center, this.normal = t.normal, this.majorAxis = t.majorAxis, this.majorAxisRadius = t.majorAxisRadius, this.minorAxisRadius = t.minorAxisRadius, this.startAngle = t.startAngle, this.endAngle = t.endAngle, this._boundingBoxNeedsUpdate = !0, this;
2912
3018
  }
2913
3019
  clone() {
2914
- return new Wt(
3020
+ return new zt(
2915
3021
  this.center,
2916
3022
  this.normal,
2917
3023
  this.majorAxis,
@@ -2922,11 +3028,11 @@ class Wt extends it {
2922
3028
  );
2923
3029
  }
2924
3030
  get plane() {
2925
- const t = new p(this.center).distanceTo(vt);
2926
- return new bt(this.normal, t);
3031
+ const t = new p(this.center).distanceTo(Ot);
3032
+ return new St(this.normal, t);
2927
3033
  }
2928
3034
  }
2929
- class Us extends nt {
3035
+ class Vs extends rt {
2930
3036
  constructor(t = null, s = !1) {
2931
3037
  super(), this._vertices = t || new Array(), this._closed = s;
2932
3038
  }
@@ -2966,7 +3072,7 @@ class Us extends nt {
2966
3072
  let i = null;
2967
3073
  if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
2968
3074
  if (n.bulge) {
2969
- const r = new $(n, i, n.bulge);
3075
+ const r = new Q(n, i, n.bulge);
2970
3076
  t += r.length;
2971
3077
  } else
2972
3078
  t += new C(n.x, n.y).distanceTo(i);
@@ -2998,12 +3104,16 @@ class Us extends nt {
2998
3104
  return new F().setFromPoints(t);
2999
3105
  }
3000
3106
  transform(t) {
3001
- return this._boundingBoxNeedsUpdate = !0, this;
3107
+ const s = t.determinant() < 0;
3108
+ return this._vertices.forEach((e) => {
3109
+ const n = new C(e).applyMatrix2d(t);
3110
+ e.x = n.x, e.y = n.y, s && e.bulge != null && (e.bulge = -e.bulge);
3111
+ }), this._boundingBoxNeedsUpdate = !0, this;
3002
3112
  }
3003
3113
  getPoints3d(t, s) {
3004
3114
  const e = [];
3005
3115
  return this.getPoints(t).forEach(
3006
- (i) => e.push(new S().set(i.x, i.y, s))
3116
+ (i) => e.push(new w().set(i.x, i.y, s))
3007
3117
  ), e;
3008
3118
  }
3009
3119
  getPoints(t) {
@@ -3013,8 +3123,8 @@ class Us extends nt {
3013
3123
  if (i.bulge) {
3014
3124
  let r = null;
3015
3125
  if (n < e - 1 ? r = this._vertices[n + 1] : n == e - 1 && this.closed && (r = this._vertices[0]), r) {
3016
- const a = new $(i, r, i.bulge).getPoints(t), o = a.length;
3017
- for (let c = 0; c < o; ++c) {
3126
+ const a = new Q(i, r, i.bulge).getPoints(t), h = a.length;
3127
+ for (let c = 0; c < h; ++c) {
3018
3128
  const l = a[c];
3019
3129
  s.push(new C(l.x, l.y));
3020
3130
  }
@@ -3025,7 +3135,7 @@ class Us extends nt {
3025
3135
  return s;
3026
3136
  }
3027
3137
  }
3028
- class Mt extends nt {
3138
+ class Pt extends rt {
3029
3139
  constructor(t, s) {
3030
3140
  super(), this._start = new C(t), this._end = new C(s);
3031
3141
  }
@@ -3067,10 +3177,10 @@ class Mt extends nt {
3067
3177
  return this.startPoint = t.startPoint, this.endPoint = t.endPoint, this._boundingBoxNeedsUpdate = !0, this;
3068
3178
  }
3069
3179
  clone() {
3070
- return new Mt(this._start.clone(), this._end.clone());
3180
+ return new Pt(this._start.clone(), this._end.clone());
3071
3181
  }
3072
3182
  }
3073
- class X extends nt {
3183
+ class X extends rt {
3074
3184
  constructor(t = []) {
3075
3185
  super(), this._curves = t;
3076
3186
  }
@@ -3079,16 +3189,16 @@ class X extends nt {
3079
3189
  }
3080
3190
  static buildFromEdges(t, s = 1e-3) {
3081
3191
  if (t.length === 0) return [];
3082
- const e = [...t], n = [], i = s * s, r = (h, a) => {
3083
- const o = h.x - a.x, c = h.y - a.y;
3084
- return o * o + c * c <= i;
3192
+ const e = [...t], n = [], i = s * s, r = (o, a) => {
3193
+ const h = o.x - a.x, c = o.y - a.y;
3194
+ return h * h + c * c <= i;
3085
3195
  };
3086
3196
  for (; e.length > 0; ) {
3087
- const h = [], a = e.shift();
3088
- h.push(a);
3089
- const o = X.getEdgeStartPoint(a);
3197
+ const o = [], a = e.shift();
3198
+ o.push(a);
3199
+ const h = X.getEdgeStartPoint(a);
3090
3200
  let c = X.getEdgeEndPoint(a);
3091
- if (!r(o, c))
3201
+ if (!r(h, c))
3092
3202
  for (; e.length > 0; ) {
3093
3203
  const l = X.findConnectingEdge(
3094
3204
  e,
@@ -3097,9 +3207,9 @@ class X extends nt {
3097
3207
  );
3098
3208
  if (l.index < 0) break;
3099
3209
  let m = e.splice(l.index, 1)[0];
3100
- if (l.reverse && (m = X.reverseEdge(m)), h.push(m), c = X.getEdgeEndPoint(m), r(c, o)) break;
3210
+ if (l.reverse && (m = X.reverseEdge(m)), o.push(m), c = X.getEdgeEndPoint(m), r(c, h)) break;
3101
3211
  }
3102
- n.push(new X(h));
3212
+ n.push(new X(o));
3103
3213
  }
3104
3214
  return n;
3105
3215
  }
@@ -3130,7 +3240,27 @@ class X extends nt {
3130
3240
  return s.setFromPoints(t), s;
3131
3241
  }
3132
3242
  transform(t) {
3133
- return this._boundingBoxNeedsUpdate = !0, this;
3243
+ const s = new H().set(
3244
+ t.elements[0],
3245
+ t.elements[3],
3246
+ 0,
3247
+ t.elements[6],
3248
+ t.elements[1],
3249
+ t.elements[4],
3250
+ 0,
3251
+ t.elements[7],
3252
+ 0,
3253
+ 0,
3254
+ 1,
3255
+ 0,
3256
+ 0,
3257
+ 0,
3258
+ 0,
3259
+ 1
3260
+ );
3261
+ return this._curves.forEach((e) => {
3262
+ e instanceof J ? e.transform(s) : e.transform(t);
3263
+ }), this._boundingBoxNeedsUpdate = !0, this;
3134
3264
  }
3135
3265
  get closed() {
3136
3266
  return !0;
@@ -3145,11 +3275,11 @@ class X extends nt {
3145
3275
  }
3146
3276
  static findConnectingEdge(t, s, e) {
3147
3277
  let n = -1, i = !1, r = Number.POSITIVE_INFINITY;
3148
- for (let h = 0; h < t.length; h++) {
3149
- const a = t[h], o = X.getEdgeStartPoint(a), c = X.getEdgeEndPoint(a), l = s.x - o.x, m = s.y - o.y, d = l * l + m * m;
3150
- d < r && (r = d, n = h, i = !1);
3278
+ for (let o = 0; o < t.length; o++) {
3279
+ const a = t[o], h = X.getEdgeStartPoint(a), c = X.getEdgeEndPoint(a), l = s.x - h.x, m = s.y - h.y, u = l * l + m * m;
3280
+ u < r && (r = u, n = o, i = !1);
3151
3281
  const x = s.x - c.x, g = s.y - c.y, y = x * x + g * g;
3152
- y < r && (r = y, n = h, i = !0);
3282
+ y < r && (r = y, n = o, i = !0);
3153
3283
  }
3154
3284
  return r > e ? { index: -1, reverse: !1 } : { index: n, reverse: i };
3155
3285
  }
@@ -3162,13 +3292,13 @@ class X extends nt {
3162
3292
  return new C(s.x, s.y);
3163
3293
  }
3164
3294
  static reverseEdge(t) {
3165
- return t instanceof Mt ? new Mt(t.endPoint, t.startPoint) : t instanceof $ ? new $(
3295
+ return t instanceof Pt ? new Pt(t.endPoint, t.startPoint) : t instanceof Q ? new Q(
3166
3296
  t.center,
3167
3297
  t.radius,
3168
3298
  t.endAngle,
3169
3299
  t.startAngle,
3170
3300
  !t.clockwise
3171
- ) : t instanceof zt ? new zt(
3301
+ ) : t instanceof W ? new W(
3172
3302
  t.center,
3173
3303
  t.majorAxisRadius,
3174
3304
  t.minorAxisRadius,
@@ -3176,11 +3306,11 @@ class X extends nt {
3176
3306
  t.startAngle,
3177
3307
  !t.clockwise,
3178
3308
  t.rotation
3179
- ) : t instanceof wt ? X.reverseSplineEdge(t) : t;
3309
+ ) : t instanceof J ? X.reverseSplineEdge(t) : t;
3180
3310
  }
3181
3311
  static reverseSplineEdge(t) {
3182
- const s = [...t.controlPoints].reverse(), e = t.knots, n = e[0], i = e[e.length - 1], r = e.map((o) => n + i - o).reverse(), h = t.weights, a = h.length > 0 ? [...h].reverse() : void 0;
3183
- return new wt(
3312
+ const s = [...t.controlPoints].reverse(), e = t.knots, n = e[0], i = e[e.length - 1], r = e.map((h) => n + i - h).reverse(), o = t.weights, a = o.length > 0 ? [...o].reverse() : void 0;
3313
+ return new J(
3184
3314
  s,
3185
3315
  r,
3186
3316
  a,
@@ -3199,18 +3329,18 @@ class kt {
3199
3329
  initCatmullRom(t, s, e, n, i) {
3200
3330
  this.init(s, e, i * (e - t), i * (n - s));
3201
3331
  }
3202
- initNonuniformCatmullRom(t, s, e, n, i, r, h) {
3203
- let a = (s - t) / i - (e - t) / (i + r) + (e - s) / r, o = (e - s) / r - (n - s) / (r + h) + (n - e) / h;
3204
- a *= r, o *= r, this.init(s, e, a, o);
3332
+ initNonuniformCatmullRom(t, s, e, n, i, r, o) {
3333
+ let a = (s - t) / i - (e - t) / (i + r) + (e - s) / r, h = (e - s) / r - (n - s) / (r + o) + (n - e) / o;
3334
+ a *= r, h *= r, this.init(s, e, a, h);
3205
3335
  }
3206
3336
  calc(t) {
3207
3337
  const s = t * t, e = s * t;
3208
3338
  return this.c0 + this.c1 * t + this.c2 * s + this.c3 * e;
3209
3339
  }
3210
3340
  }
3211
- class Es extends it {
3341
+ class Es extends ot {
3212
3342
  constructor(t = [], s = !1, e = "centripetal", n = 0.5) {
3213
- super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new p(), this._px = new kt(), this._py = new kt(), this._pz = new kt(), this._points = t.map((i) => new S(i)), this._closed = s, this._curveType = e, this._tension = n;
3343
+ super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new p(), this._px = new kt(), this._py = new kt(), this._pz = new kt(), this._points = t.map((i) => new w(i)), this._closed = s, this._curveType = e, this._tension = n;
3214
3344
  }
3215
3345
  get points() {
3216
3346
  return this._points;
@@ -3225,10 +3355,10 @@ class Es extends it {
3225
3355
  return this._tension;
3226
3356
  }
3227
3357
  get startPoint() {
3228
- return this._points.length > 0 ? this._points[0] : new S();
3358
+ return this._points.length > 0 ? this._points[0] : new w();
3229
3359
  }
3230
3360
  get endPoint() {
3231
- return this._points.length > 0 ? this._points[this._points.length - 1] : new S();
3361
+ return this._points.length > 0 ? this._points[this._points.length - 1] : new w();
3232
3362
  }
3233
3363
  get length() {
3234
3364
  if (this._points.length < 2) return 0;
@@ -3239,23 +3369,23 @@ class Es extends it {
3239
3369
  this._points[0]
3240
3370
  )), t;
3241
3371
  }
3242
- getPoint(t, s = new S()) {
3372
+ getPoint(t, s = new w()) {
3243
3373
  const e = s, n = this._points, i = n.length;
3244
3374
  if (i === 0)
3245
3375
  return e.set(0, 0, 0);
3246
3376
  if (i === 1)
3247
3377
  return e.copy(n[0]);
3248
3378
  const r = (i - (this._closed ? 0 : 1)) * t;
3249
- let h = Math.floor(r), a = r - h;
3250
- this._closed ? h += h > 0 ? 0 : (Math.floor(Math.abs(h) / i) + 1) * i : a === 0 && h === i - 1 && (h = i - 2, a = 1);
3251
- let o, c;
3252
- this._closed || h > 0 ? o = n[(h - 1) % i] : (this._tmp.subVectors(n[0], n[1]).add(n[0]), o = new S(this._tmp.x, this._tmp.y, this._tmp.z));
3253
- const l = n[h % i], m = n[(h + 1) % i];
3254
- if (this._closed || h + 2 < i ? c = n[(h + 2) % i] : (this._tmp.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), c = new S(this._tmp.x, this._tmp.y, this._tmp.z)), this._curveType === "centripetal" || this._curveType === "chordal") {
3255
- const d = this._curveType === "chordal" ? 0.5 : 0.25;
3256
- let x = Math.pow(o.distanceToSquared(l), d), g = Math.pow(l.distanceToSquared(m), d), y = Math.pow(m.distanceToSquared(c), d);
3257
- g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(o.x, l.x, m.x, c.x, x, g, y), this._py.initNonuniformCatmullRom(o.y, l.y, m.y, c.y, x, g, y), this._pz.initNonuniformCatmullRom(o.z, l.z, m.z, c.z, x, g, y);
3258
- } else this._curveType === "catmullrom" && (this._px.initCatmullRom(o.x, l.x, m.x, c.x, this._tension), this._py.initCatmullRom(o.y, l.y, m.y, c.y, this._tension), this._pz.initCatmullRom(o.z, l.z, m.z, c.z, this._tension));
3379
+ let o = Math.floor(r), a = r - o;
3380
+ this._closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / i) + 1) * i : a === 0 && o === i - 1 && (o = i - 2, a = 1);
3381
+ let h, c;
3382
+ this._closed || o > 0 ? h = n[(o - 1) % i] : (this._tmp.subVectors(n[0], n[1]).add(n[0]), h = new w(this._tmp.x, this._tmp.y, this._tmp.z));
3383
+ const l = n[o % i], m = n[(o + 1) % i];
3384
+ if (this._closed || o + 2 < i ? c = n[(o + 2) % i] : (this._tmp.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), c = new w(this._tmp.x, this._tmp.y, this._tmp.z)), this._curveType === "centripetal" || this._curveType === "chordal") {
3385
+ const u = this._curveType === "chordal" ? 0.5 : 0.25;
3386
+ let x = Math.pow(h.distanceToSquared(l), u), g = Math.pow(l.distanceToSquared(m), u), y = Math.pow(m.distanceToSquared(c), u);
3387
+ g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(h.x, l.x, m.x, c.x, x, g, y), this._py.initNonuniformCatmullRom(h.y, l.y, m.y, c.y, x, g, y), this._pz.initNonuniformCatmullRom(h.z, l.z, m.z, c.z, x, g, y);
3388
+ } else this._curveType === "catmullrom" && (this._px.initCatmullRom(h.x, l.x, m.x, c.x, this._tension), this._py.initCatmullRom(h.y, l.y, m.y, c.y, this._tension), this._pz.initCatmullRom(h.z, l.z, m.z, c.z, this._tension));
3259
3389
  return e.set(
3260
3390
  this._px.calc(a),
3261
3391
  this._py.calc(a),
@@ -3269,7 +3399,7 @@ class Es extends it {
3269
3399
  return s;
3270
3400
  }
3271
3401
  setPoints(t) {
3272
- this._points = t.map((s) => new S(s)), this._boundingBoxNeedsUpdate = !0;
3402
+ this._points = t.map((s) => new w(s)), this._boundingBoxNeedsUpdate = !0;
3273
3403
  }
3274
3404
  setClosed(t) {
3275
3405
  this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0);
@@ -3282,20 +3412,20 @@ class Es extends it {
3282
3412
  }
3283
3413
  transform(t) {
3284
3414
  return this._points = this._points.map((s) => {
3285
- const e = new S();
3415
+ const e = new w();
3286
3416
  return e.copy(s), e.applyMatrix4(t), e;
3287
3417
  }), this._boundingBoxNeedsUpdate = !0, this;
3288
3418
  }
3289
3419
  calculateBoundingBox() {
3290
3420
  if (this._points.length === 0)
3291
- return new D();
3292
- const t = new D();
3421
+ return new Y();
3422
+ const t = new Y();
3293
3423
  return this._points.forEach((s) => {
3294
3424
  t.expandByPoint(s);
3295
3425
  }), t;
3296
3426
  }
3297
3427
  }
3298
- class U {
3428
+ class j {
3299
3429
  constructor(t, s, e, n) {
3300
3430
  this._degree = t, this._knots = [...s], this._controlPoints = e.map((i) => ({ x: i.x, y: i.y, z: i.z })), this._weights = n ? [...n] : new Array(e.length).fill(1);
3301
3431
  }
@@ -3313,7 +3443,7 @@ class U {
3313
3443
  }
3314
3444
  point(t) {
3315
3445
  const s = this._controlPoints.map((e) => [e.x, e.y, e.z]);
3316
- return _t(
3446
+ return ft(
3317
3447
  t,
3318
3448
  this._degree,
3319
3449
  this._knots,
@@ -3323,7 +3453,7 @@ class U {
3323
3453
  }
3324
3454
  length() {
3325
3455
  const t = this._controlPoints.map((s) => [s.x, s.y, s.z]);
3326
- return Ms(
3456
+ return ws(
3327
3457
  this._degree,
3328
3458
  this._knots,
3329
3459
  t,
@@ -3331,24 +3461,24 @@ class U {
3331
3461
  );
3332
3462
  }
3333
3463
  static byKnotsControlPointsWeights(t, s, e, n) {
3334
- return new U(t, s, e, n);
3464
+ return new j(t, s, e, n);
3335
3465
  }
3336
3466
  static byPoints(t, s, e = "Uniform", n, i) {
3337
- const r = Kt(
3467
+ const r = $t(
3338
3468
  t,
3339
3469
  s,
3340
3470
  e,
3341
3471
  n,
3342
3472
  i
3343
- ), h = r.controlPoints.map((a) => ({
3473
+ ), o = r.controlPoints.map((a) => ({
3344
3474
  x: a[0],
3345
3475
  y: a[1],
3346
3476
  z: a[2]
3347
3477
  }));
3348
- return new U(
3478
+ return new j(
3349
3479
  s,
3350
3480
  r.knots,
3351
- h,
3481
+ o,
3352
3482
  r.weights
3353
3483
  );
3354
3484
  }
@@ -3365,8 +3495,8 @@ class U {
3365
3495
  return s;
3366
3496
  }
3367
3497
  isClosed(t = 1e-6) {
3368
- const { start: s, end: e } = this.getParameterRange(), n = this.point(s), i = this.point(e), r = n[0] - i[0], h = n[1] - i[1], a = n[2] - i[2];
3369
- return Math.sqrt(r * r + h * h + a * a) < t;
3498
+ const { start: s, end: e } = this.getParameterRange(), n = this.point(s), i = this.point(e), r = n[0] - i[0], o = n[1] - i[1], a = n[2] - i[2];
3499
+ return Math.sqrt(r * r + o * o + a * a) < t;
3370
3500
  }
3371
3501
  static createFitPointsForClosedCurve(t) {
3372
3502
  if (t.length < 4)
@@ -3380,44 +3510,44 @@ class U {
3380
3510
  }
3381
3511
  static createClosedCurve(t, s, e = "Chord") {
3382
3512
  const i = this.createFitPointsForClosedCurve(t).map((r) => [r.x, r.y, r.z]);
3383
- return U.byPoints(i, s, e);
3513
+ return j.byPoints(i, s, e);
3384
3514
  }
3385
3515
  }
3386
- class wt extends it {
3516
+ class J extends ot {
3387
3517
  constructor(t, s, e, n, i, r) {
3388
3518
  super();
3389
- const h = arguments.length;
3519
+ const o = arguments.length;
3390
3520
  if (this._degree = 3, this._closed = !1, Array.isArray(s)) {
3391
- if (h < 2 || h > 5)
3392
- throw q.ILLEGAL_PARAMETERS;
3521
+ if (o < 2 || o > 5)
3522
+ throw L.ILLEGAL_PARAMETERS;
3393
3523
  this._controlPoints = t;
3394
- let a, o = 3, c = !1;
3395
- if (h >= 3 && (Array.isArray(e) ? (a = e, h >= 4 && (o = n || 3), h >= 5 && (c = i)) : e !== void 0 && (o = e || 3, h >= 4 && (c = n))), e === void 0 && h >= 4 && (o = n || 3, h >= 5 && (c = i)), this._degree = o, this._closed = c, this._controlPoints.length < this._degree + 1)
3396
- throw q.ILLEGAL_PARAMETERS;
3397
- this._nurbsCurve = U.byKnotsControlPointsWeights(
3524
+ let a, h = 3, c = !1;
3525
+ if (o >= 3 && (Array.isArray(e) ? (a = e, o >= 4 && (h = n || 3), o >= 5 && (c = i)) : e !== void 0 && (h = e || 3, o >= 4 && (c = n))), e === void 0 && o >= 4 && (h = n || 3, o >= 5 && (c = i)), this._degree = h, this._closed = c, this._controlPoints.length < this._degree + 1)
3526
+ throw L.ILLEGAL_PARAMETERS;
3527
+ this._nurbsCurve = j.byKnotsControlPointsWeights(
3398
3528
  this._degree,
3399
3529
  s,
3400
3530
  this._controlPoints,
3401
3531
  a
3402
3532
  );
3403
3533
  } else {
3404
- if (h < 2 || h > 6)
3405
- throw q.ILLEGAL_PARAMETERS;
3406
- this._fitPoints = t, this._knotParameterization = s, h >= 3 && (this._degree = e || 3);
3534
+ if (o < 2 || o > 6)
3535
+ throw L.ILLEGAL_PARAMETERS;
3536
+ this._fitPoints = t, this._knotParameterization = s, o >= 3 && (this._degree = e || 3);
3407
3537
  const a = typeof n == "boolean";
3408
- h >= 4 && a && (this._closed = n), a ? (h >= 5 && (this._startTangent = i), h >= 6 && (this._endTangent = r)) : (h >= 4 && (this._startTangent = n), h >= 5 && (this._endTangent = i)), this._closed && (this._startTangent = void 0, this._endTangent = void 0);
3409
- const o = (this._startTangent ? 1 : 0) + (this._endTangent ? 1 : 0);
3410
- if (this._fitPoints.length + o < this._degree + 1)
3411
- throw q.ILLEGAL_PARAMETERS;
3538
+ o >= 4 && a && (this._closed = n), a ? (o >= 5 && (this._startTangent = i), o >= 6 && (this._endTangent = r)) : (o >= 4 && (this._startTangent = n), o >= 5 && (this._endTangent = i)), this._closed && (this._startTangent = void 0, this._endTangent = void 0);
3539
+ const h = (this._startTangent ? 1 : 0) + (this._endTangent ? 1 : 0);
3540
+ if (this._fitPoints.length + h < this._degree + 1)
3541
+ throw L.ILLEGAL_PARAMETERS;
3412
3542
  if (this._closed)
3413
- this._nurbsCurve = U.createClosedCurve(
3543
+ this._nurbsCurve = j.createClosedCurve(
3414
3544
  this._fitPoints,
3415
3545
  this._degree,
3416
3546
  this._knotParameterization
3417
3547
  );
3418
3548
  else {
3419
3549
  const c = this.toNurbsPoints(this._fitPoints);
3420
- this._nurbsCurve = U.byPoints(
3550
+ this._nurbsCurve = j.byPoints(
3421
3551
  c,
3422
3552
  this._degree,
3423
3553
  this._knotParameterization,
@@ -3433,17 +3563,17 @@ class wt extends it {
3433
3563
  buildCurve() {
3434
3564
  if (this._fitPoints && this._knotParameterization) {
3435
3565
  if (this._closed) {
3436
- const t = U.createFitPointsForClosedCurve(
3566
+ const t = j.createFitPointsForClosedCurve(
3437
3567
  this._fitPoints
3438
3568
  ), s = this.toNurbsPoints(t);
3439
- this._nurbsCurve = U.byPoints(
3569
+ this._nurbsCurve = j.byPoints(
3440
3570
  s,
3441
3571
  this._degree,
3442
3572
  this._knotParameterization
3443
3573
  );
3444
3574
  } else {
3445
3575
  const t = this.toNurbsPoints(this._fitPoints);
3446
- this._nurbsCurve = U.byPoints(
3576
+ this._nurbsCurve = j.byPoints(
3447
3577
  t,
3448
3578
  this._degree,
3449
3579
  this._knotParameterization,
@@ -3456,10 +3586,10 @@ class wt extends it {
3456
3586
  );
3457
3587
  } else if (this._controlPoints)
3458
3588
  if (this._closed) {
3459
- const t = U.createFitPointsForClosedCurve(
3589
+ const t = j.createFitPointsForClosedCurve(
3460
3590
  this._controlPoints
3461
3591
  ), s = this.toNurbsPoints(t);
3462
- this._nurbsCurve = U.byPoints(
3592
+ this._nurbsCurve = j.byPoints(
3463
3593
  s,
3464
3594
  this._degree,
3465
3595
  this._knotParameterization
@@ -3468,7 +3598,7 @@ class wt extends it {
3468
3598
  );
3469
3599
  } else {
3470
3600
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.weights();
3471
- this._nurbsCurve = U.byKnotsControlPointsWeights(
3601
+ this._nurbsCurve = j.byKnotsControlPointsWeights(
3472
3602
  this._degree,
3473
3603
  t,
3474
3604
  this._controlPoints,
@@ -3508,11 +3638,11 @@ class wt extends it {
3508
3638
  }
3509
3639
  get startPoint() {
3510
3640
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
3511
- return new S(n[0], n[1], n[2]);
3641
+ return new w(n[0], n[1], n[2]);
3512
3642
  }
3513
3643
  get endPoint() {
3514
3644
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
3515
- return new S(n[0], n[1], n[2]);
3645
+ return new w(n[0], n[1], n[2]);
3516
3646
  }
3517
3647
  get length() {
3518
3648
  return this._nurbsCurve.length();
@@ -3528,24 +3658,24 @@ class wt extends it {
3528
3658
  return this._controlPoints[e];
3529
3659
  }
3530
3660
  getPoints(t = 100) {
3531
- const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), r = n[i], h = n[n.length - i - 1], a = (h - r) / (t - 1);
3532
- for (let o = 0; o < t; o++) {
3533
- const c = o === t - 1 ? h : r + o * a, l = s.point(c);
3534
- e.push(new S(l[0], l[1], l[2]));
3661
+ const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), r = n[i], o = n[n.length - i - 1], a = (o - r) / (t - 1);
3662
+ for (let h = 0; h < t; h++) {
3663
+ const c = h === t - 1 ? o : r + h * a, l = s.point(c);
3664
+ e.push(new w(l[0], l[1], l[2]));
3535
3665
  }
3536
3666
  return e;
3537
3667
  }
3538
3668
  getCurvePoints(t, s) {
3539
3669
  const e = [], n = t.knots(), i = t.degree(), r = n[i], a = (n[n.length - i - 1] - r) / (s - 1);
3540
- for (let o = 0; o < s; o++) {
3541
- const c = r + o * a;
3670
+ for (let h = 0; h < s; h++) {
3671
+ const c = r + h * a;
3542
3672
  e.push(t.point(c));
3543
3673
  }
3544
3674
  return e;
3545
3675
  }
3546
3676
  calculateBoundingBox() {
3547
3677
  const t = this.getPoints(100);
3548
- return new D().setFromPoints(t);
3678
+ return new Y().setFromPoints(t);
3549
3679
  }
3550
3680
  get closed() {
3551
3681
  return this._closed;
@@ -3554,6 +3684,25 @@ class wt extends it {
3554
3684
  this.setClosed(t);
3555
3685
  }
3556
3686
  transform(t) {
3687
+ if (this._fitPoints && this._knotParameterization)
3688
+ this._fitPoints = this._fitPoints.map(
3689
+ (s) => new w(s).applyMatrix4(t)
3690
+ ), this._startTangent && (this._startTangent = new w(
3691
+ this._startTangent
3692
+ ).transformDirection(t)), this._endTangent && (this._endTangent = new w(this._endTangent).transformDirection(
3693
+ t
3694
+ )), this.buildCurve();
3695
+ else {
3696
+ const s = this._nurbsCurve.knots(), e = this._nurbsCurve.weights();
3697
+ this._controlPoints = this._controlPoints.map(
3698
+ (n) => new w(n).applyMatrix4(t)
3699
+ ), this._nurbsCurve = j.byKnotsControlPointsWeights(
3700
+ this._degree,
3701
+ s,
3702
+ this._controlPoints,
3703
+ e.length > 0 ? e : void 0
3704
+ );
3705
+ }
3557
3706
  return this._boundingBoxNeedsUpdate = !0, this;
3558
3707
  }
3559
3708
  toNurbsPoints(t) {
@@ -3576,77 +3725,77 @@ class wt extends it {
3576
3725
  throw new Error(
3577
3726
  `At least ${e + 1} points are required for a degree ${e} closed spline`
3578
3727
  );
3579
- return new wt(t, s, e, !0);
3728
+ return new J(t, s, e, !0);
3580
3729
  }
3581
3730
  }
3582
3731
  export {
3583
- Ls as AcGeArea2d,
3732
+ js as AcGeArea2d,
3584
3733
  F as AcGeBox2d,
3585
- D as AcGeBox3d,
3734
+ Y as AcGeBox3d,
3586
3735
  Es as AcGeCatmullRomCurve3d,
3587
- $ as AcGeCircArc2d,
3588
- pt as AcGeCircArc3d,
3589
- nt as AcGeCurve2d,
3590
- zt as AcGeEllipseArc2d,
3591
- Wt as AcGeEllipseArc3d,
3592
- qt as AcGeEuler,
3593
- As as AcGeGeometryUtil,
3594
- Mt as AcGeLine2d,
3595
- ft as AcGeLine3d,
3736
+ Q as AcGeCircArc2d,
3737
+ At as AcGeCircArc3d,
3738
+ rt as AcGeCurve2d,
3739
+ W as AcGeEllipseArc2d,
3740
+ zt as AcGeEllipseArc3d,
3741
+ Lt as AcGeEuler,
3742
+ fs as AcGeGeometryUtil,
3743
+ Pt as AcGeLine2d,
3744
+ Mt as AcGeLine3d,
3596
3745
  X as AcGeLoop2d,
3597
- b as AcGeMathUtil,
3598
- st as AcGeMatrix2d,
3599
- et as AcGeMatrix3d,
3600
- U as AcGeNurbsCurve,
3601
- bt as AcGePlane,
3746
+ M as AcGeMathUtil,
3747
+ it as AcGeMatrix2d,
3748
+ H as AcGeMatrix3d,
3749
+ j as AcGeNurbsCurve,
3750
+ St as AcGePlane,
3602
3751
  C as AcGePoint2d,
3603
- S as AcGePoint3d,
3604
- Us as AcGePolyline2d,
3605
- Pt as AcGeQuaternion,
3752
+ w as AcGePoint3d,
3753
+ Vs as AcGePolyline2d,
3754
+ bt as AcGeQuaternion,
3606
3755
  Ht as AcGeShape2d,
3607
- wt as AcGeSpline3d,
3608
- Gt as AcGeTol,
3756
+ J as AcGeSpline3d,
3757
+ Qt as AcGeTol,
3609
3758
  B as AcGeVector2d,
3610
3759
  p as AcGeVector3d,
3611
- Ot as DEFAULT_TOL,
3612
- Ft as DEG2RAD,
3613
- Q as FLOAT_TOL,
3760
+ Kt as DEFAULT_TOL,
3761
+ Xt as DEG2RAD,
3762
+ G as FLOAT_TOL,
3614
3763
  Bs as ORIGIN_POINT_2D,
3615
- vt as ORIGIN_POINT_3D,
3616
- Xt as RAD2DEG,
3617
- I as TAU,
3618
- At as basisFunction,
3619
- Ms as calculateCurveLength,
3764
+ Ot as ORIGIN_POINT_3D,
3765
+ Dt as RAD2DEG,
3766
+ E as TAU,
3767
+ wt as basisFunction,
3768
+ ws as calculateCurveLength,
3620
3769
  ms as ceilPowerOfTwo,
3621
- v as clamp,
3622
- fs as computeParameterValues,
3770
+ Z as clamp,
3771
+ As as computeParameterValues,
3623
3772
  es as damp,
3624
3773
  ls as degToRad,
3625
3774
  Yt as euclideanModulo,
3626
- _t as evaluateNurbsPoint,
3775
+ ft as evaluateNurbsPoint,
3627
3776
  xs as floorPowerOfTwo,
3628
3777
  zs as generateAveragedKnots,
3629
- Ns as generateChordKnots,
3630
- Rs as generateSqrtChordKnots,
3778
+ Rs as generateChordKnots,
3779
+ Ns as generateSqrtChordKnots,
3631
3780
  Jt as generateUUID,
3632
3781
  ks as generateUniformKnots,
3633
3782
  Zt as intPartLength,
3634
3783
  Ts as interpolateControlPoints,
3635
- Kt as interpolateNurbsCurve,
3784
+ $t as interpolateNurbsCurve,
3636
3785
  ss as inverseLerp,
3637
3786
  gs as isBetween,
3638
3787
  ys as isBetweenAngle,
3639
- Qt as isPointInPolygon,
3788
+ Gt as isPointInPolygon,
3640
3789
  ps as isPolygonIntersect,
3641
3790
  ds as isPowerOfTwo,
3642
- Dt as lerp,
3791
+ vt as lerp,
3643
3792
  ts as mapLinear,
3644
- yt as normalizeAngle,
3793
+ pt as normalizeAngle,
3645
3794
  ns as pingpong,
3646
3795
  us as radToDeg,
3647
- os as randFloat,
3796
+ hs as randFloat,
3648
3797
  as as randFloatSpread,
3649
- hs as randInt,
3798
+ os as randInt,
3650
3799
  _s as relativeEps,
3651
3800
  cs as seededRandom,
3652
3801
  rs as smootherstep,