@thatopen/components 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  var kn = Object.defineProperty;
2
2
  var Wn = (l, s, t) => s in l ? kn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
3
3
  var I = (l, s, t) => (Wn(l, typeof s != "symbol" ? s + "" : s, t), t);
4
- import * as g from "three";
5
- import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as Lt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as Ot, BackSide as Zn, DoubleSide as Ln, FrontSide as wi, Mesh as v, Ray as Qn, Raycaster as jn, Quaternion as Pt, Object3D as ri, Euler as qn, MeshBasicMaterial as yn, LineBasicMaterial as Kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as me, PlaneGeometry as Jn } from "three";
4
+ import * as O from "three";
5
+ import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as Lt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as gt, BackSide as Zn, DoubleSide as Ln, FrontSide as wi, Mesh as v, Ray as Qn, Raycaster as jn, Quaternion as Pt, Object3D as ri, Euler as qn, MeshBasicMaterial as yn, LineBasicMaterial as Kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as me, PlaneGeometry as Jn } from "three";
6
6
  import * as Vt from "@thatopen/fragments";
7
7
  import { Serializer as to } from "@thatopen/fragments";
8
8
  import * as b from "web-ifc";
@@ -95,8 +95,8 @@ function Gs(l, s, t, e, i = null) {
95
95
  let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, h = -1 / 0, d = 1 / 0, E = 1 / 0, u = 1 / 0, f = -1 / 0, R = -1 / 0, m = -1 / 0;
96
96
  const C = i !== null;
97
97
  for (let A = s * 6, F = (s + t) * 6; A < F; A += 6) {
98
- const p = l[A + 0], T = l[A + 1], O = p - T, _ = p + T;
99
- O < o && (o = O), _ > a && (a = _), C && p < d && (d = p), C && p > f && (f = p);
98
+ const p = l[A + 0], T = l[A + 1], g = p - T, _ = p + T;
99
+ g < o && (o = g), _ > a && (a = _), C && p < d && (d = p), C && p > f && (f = p);
100
100
  const S = l[A + 2], N = l[A + 3], L = S - N, w = S + N;
101
101
  L < n && (n = L), w > c && (c = w), C && S < E && (E = S), C && S > R && (R = S);
102
102
  const y = l[A + 4], U = l[A + 5], x = y - U, B = y + U;
@@ -131,10 +131,10 @@ function ho(l, s) {
131
131
  n ? (A = t[h[C]](f), F = t[h[C]](R), p = t[h[C]](m)) : (A = r[f + C], F = r[R + C], p = r[m + C]);
132
132
  let T = A;
133
133
  F < T && (T = F), p < T && (T = p);
134
- let O = A;
135
- F > O && (O = F), p > O && (O = p);
136
- const _ = (O - T) / 2, S = C * 2;
137
- o[u + S + 0] = T + _, o[u + S + 1] = _ + (Math.abs(T) + _) * io, T < s[C] && (s[C] = T), O > s[C + 3] && (s[C + 3] = O);
134
+ let g = A;
135
+ F > g && (g = F), p > g && (g = p);
136
+ const _ = (g - T) / 2, S = C * 2;
137
+ o[u + S + 0] = T + _, o[u + S + 1] = _ + (Math.abs(T) + _) * io, T < s[C] && (s[C] = T), g > s[C + 3] && (s[C + 3] = g);
138
138
  }
139
139
  }
140
140
  return o;
@@ -166,13 +166,13 @@ function uo(l, s, t, e, i, o) {
166
166
  const T = C[A];
167
167
  T.candidate = t[p + 2 * E], T.count = 0;
168
168
  const {
169
- bounds: O,
169
+ bounds: g,
170
170
  leftCacheBounds: _,
171
171
  rightCacheBounds: S
172
172
  } = T;
173
173
  for (let N = 0; N < 3; N++)
174
- S[N] = 1 / 0, S[N + 3] = -1 / 0, _[N] = 1 / 0, _[N + 3] = -1 / 0, O[N] = 1 / 0, O[N + 3] = -1 / 0;
175
- Qe(p, t, O);
174
+ S[N] = 1 / 0, S[N + 3] = -1 / 0, _[N] = 1 / 0, _[N + 3] = -1 / 0, g[N] = 1 / 0, g[N + 3] = -1 / 0;
175
+ Qe(p, t, g);
176
176
  }
177
177
  C.sort(Eo);
178
178
  let F = i;
@@ -183,18 +183,18 @@ function uo(l, s, t, e, i, o) {
183
183
  }
184
184
  for (let p = h; p < d; p += 6) {
185
185
  const T = t[p + 2 * E];
186
- for (let O = 0; O < F; O++) {
187
- const _ = C[O];
186
+ for (let g = 0; g < F; g++) {
187
+ const _ = C[g];
188
188
  T >= _.candidate ? Qe(p, t, _.rightCacheBounds) : (Qe(p, t, _.leftCacheBounds), _.count++);
189
189
  }
190
190
  }
191
191
  for (let p = 0; p < F; p++) {
192
- const T = C[p], O = T.count, _ = i - T.count, S = T.leftCacheBounds, N = T.rightCacheBounds;
192
+ const T = C[p], g = T.count, _ = i - T.count, S = T.leftCacheBounds, N = T.rightCacheBounds;
193
193
  let L = 0;
194
- O !== 0 && (L = Re(S) / a);
194
+ g !== 0 && (L = Re(S) / a);
195
195
  let w = 0;
196
196
  _ !== 0 && (w = Re(N) / a);
197
- const y = bi + Ys * (L * O + w * _);
197
+ const y = bi + Ys * (L * g + w * _);
198
198
  y < c && (n = E, c = y, r = T.candidate);
199
199
  }
200
200
  } else {
@@ -202,13 +202,13 @@ function uo(l, s, t, e, i, o) {
202
202
  const p = Ut[F];
203
203
  p.count = 0, p.candidate = u + m + F * m;
204
204
  const T = p.bounds;
205
- for (let O = 0; O < 3; O++)
206
- T[O] = 1 / 0, T[O + 3] = -1 / 0;
205
+ for (let g = 0; g < 3; g++)
206
+ T[g] = 1 / 0, T[g + 3] = -1 / 0;
207
207
  }
208
208
  for (let F = h; F < d; F += 6) {
209
- let O = ~~((t[F + 2 * E] - u) / m);
210
- O >= Mt && (O = Mt - 1);
211
- const _ = Ut[O];
209
+ let g = ~~((t[F + 2 * E] - u) / m);
210
+ g >= Mt && (g = Mt - 1);
211
+ const _ = Ut[g];
212
212
  _.count++, Qe(F, t, _.bounds);
213
213
  }
214
214
  const C = Ut[Mt - 1];
@@ -219,8 +219,8 @@ function uo(l, s, t, e, i, o) {
219
219
  }
220
220
  let A = 0;
221
221
  for (let F = 0; F < Mt - 1; F++) {
222
- const p = Ut[F], T = p.count, O = p.bounds, S = Ut[F + 1].rightCacheBounds;
223
- T !== 0 && (A === 0 ? Bi(O, je) : Yi(O, je, je)), A += T;
222
+ const p = Ut[F], T = p.count, g = p.bounds, S = Ut[F + 1].rightCacheBounds;
223
+ T !== 0 && (A === 0 ? Bi(g, je) : Yi(g, je, je)), A += T;
224
224
  let N = 0, L = 0;
225
225
  A !== 0 && (N = Re(je) / a);
226
226
  const w = i - A;
@@ -308,20 +308,20 @@ function To(l, s) {
308
308
  function A(p) {
309
309
  a && a(p / c);
310
310
  }
311
- function F(p, T, O, _ = null, S = 0) {
312
- if (!d && S >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))), O <= n || S >= i)
313
- return A(T + O), p.offset = T, p.count = O, p;
314
- const N = uo(p.boundingData, _, f, T, O, r);
311
+ function F(p, T, g, _ = null, S = 0) {
312
+ if (!d && S >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))), g <= n || S >= i)
313
+ return A(T + g), p.offset = T, p.count = g, p;
314
+ const N = uo(p.boundingData, _, f, T, g, r);
315
315
  if (N.axis === -1)
316
- return A(T + O), p.offset = T, p.count = O, p;
317
- const L = R(h, e, f, T, O, N);
318
- if (L === T || L === T + O)
319
- A(T + O), p.offset = T, p.count = O;
316
+ return A(T + g), p.offset = T, p.count = g, p;
317
+ const L = R(h, e, f, T, g, N);
318
+ if (L === T || L === T + g)
319
+ A(T + g), p.offset = T, p.count = g;
320
320
  else {
321
321
  p.splitAxis = N.axis;
322
322
  const w = new qe(), y = T, U = L - T;
323
323
  p.left = w, w.boundingData = new Float32Array(6), Gs(f, y, U, w.boundingData, u), F(w, y, U, u, S + 1);
324
- const x = new qe(), B = L, H = O - U;
324
+ const x = new qe(), B = L, H = g - U;
325
325
  p.right = x, x.boundingData = new Float32Array(6), Gs(f, B, H, x.boundingData, u), F(x, B, H, u, S + 1);
326
326
  }
327
327
  return p;
@@ -410,7 +410,7 @@ const Ro = function() {
410
410
  let C, A;
411
411
  m !== 0 ? C = (d * E - f * u) / m : C = 0, A = (d + C * E) / u, n.x = C, n.y = A;
412
412
  };
413
- }(), Oi = function() {
413
+ }(), gi = function() {
414
414
  const l = new fe(), s = new M(), t = new M();
415
415
  return function(i, o, n, r) {
416
416
  Ro(i, o, l);
@@ -482,7 +482,7 @@ Ft.prototype.closestPointToSegment = function() {
482
482
  let h, d = 1 / 0;
483
483
  for (let E = 0; E < 3; E++) {
484
484
  const u = (E + 1) % 3;
485
- t.start.copy(c[E]), t.end.copy(c[u]), Oi(t, i, l, s), h = l.distanceToSquared(s), h < d && (d = h, o && o.copy(l), n && n.copy(s));
485
+ t.start.copy(c[E]), t.end.copy(c[u]), gi(t, i, l, s), h = l.distanceToSquared(s), h < d && (d = h, o && o.copy(l), n && n.copy(s));
486
486
  }
487
487
  return this.closestPointToPoint(r, l), h = r.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), h = a.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
488
488
  };
@@ -493,15 +493,15 @@ Ft.prototype.intersectsTriangle = function() {
493
493
  const A = R.points;
494
494
  let F = 0, p = -1;
495
495
  for (let T = 0; T < 3; T++) {
496
- const { start: O, end: _ } = h;
497
- O.copy(A[T]), _.copy(A[(T + 1) % 3]), h.delta(n);
498
- const S = zs(m.distanceToPoint(O));
496
+ const { start: g, end: _ } = h;
497
+ g.copy(A[T]), _.copy(A[(T + 1) % 3]), h.delta(n);
498
+ const S = zs(m.distanceToPoint(g));
499
499
  if (zs(m.normal.dot(n)) && S) {
500
500
  C.copy(h), F = 2;
501
501
  break;
502
502
  }
503
503
  const N = m.intersectLine(h, u);
504
- if (!N && S && u.copy(O), (N || S) && !zs(u.distanceTo(_))) {
504
+ if (!N && S && u.copy(g), (N || S) && !zs(u.distanceTo(_))) {
505
505
  if (F <= 1)
506
506
  (F === 1 ? C.start : C.end).copy(u), S && (p = F);
507
507
  else if (F >= 2) {
@@ -518,10 +518,10 @@ Ft.prototype.intersectsTriangle = function() {
518
518
  this.needsUpdate && this.update(), m.isExtendedTriangle ? m.needsUpdate && m.update() : (l.copy(m), l.update(), m = l);
519
519
  const F = this.plane, p = m.plane;
520
520
  if (Math.abs(F.normal.dot(p.normal)) > 1 - 1e-10) {
521
- const T = this.satBounds, O = this.satAxes;
521
+ const T = this.satBounds, g = this.satAxes;
522
522
  t[0] = m.a, t[1] = m.b, t[2] = m.c;
523
523
  for (let N = 0; N < 4; N++) {
524
- const L = T[N], w = O[N];
524
+ const L = T[N], w = g[N];
525
525
  if (e.setFromPoints(w, t), L.isSeparated(e))
526
526
  return !1;
527
527
  }
@@ -533,7 +533,7 @@ Ft.prototype.intersectsTriangle = function() {
533
533
  return !1;
534
534
  }
535
535
  for (let N = 0; N < 4; N++) {
536
- const L = O[N];
536
+ const L = g[N];
537
537
  for (let w = 0; w < 4; w++) {
538
538
  const y = S[w];
539
539
  if (o.crossVectors(L, y), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
@@ -547,10 +547,10 @@ Ft.prototype.intersectsTriangle = function() {
547
547
  return C && (C.start.copy(d.end), C.end.copy(d.end)), !0;
548
548
  if (T !== 2)
549
549
  return !1;
550
- const O = f(m, F, E);
551
- if (O === 1 && this.containsPoint(E.end))
550
+ const g = f(m, F, E);
551
+ if (g === 1 && this.containsPoint(E.end))
552
552
  return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
553
- if (O !== 2)
553
+ if (g !== 2)
554
554
  return !1;
555
555
  if (d.delta(r), E.delta(a), r.dot(a) < 0) {
556
556
  let U = E.start;
@@ -586,7 +586,7 @@ Ft.prototype.distanceToTriangle = function() {
586
586
  e.set(this[E], this[u]);
587
587
  for (let f = 0; f < 3; f++) {
588
588
  const R = t[f], m = t[(f + 1) % 3];
589
- i.set(n[R], n[m]), Oi(e, i, l, s);
589
+ i.set(n[R], n[m]), gi(e, i, l, s);
590
590
  const C = l.distanceToSquared(s);
591
591
  C < h && (h = C, r && r.copy(l), a && a.copy(s));
592
592
  }
@@ -695,7 +695,7 @@ at.prototype.distanceToBox = function() {
695
695
  for (let m = 0; m < 3; m++)
696
696
  for (let C = 0; C <= 1; C++)
697
697
  for (let A = 0; A <= 1; A++) {
698
- const F = (m + 1) % 3, p = (m + 2) % 3, T = C << F | A << p, O = 1 << m | C << F | A << p, _ = u[T], S = u[O];
698
+ const F = (m + 1) % 3, p = (m + 2) % 3, T = C << F | A << p, g = 1 << m | C << F | A << p, _ = u[T], S = u[g];
699
699
  s[R].set(_, S);
700
700
  const L = l[m], w = l[F], y = l[p], U = t[R], x = U.start, B = U.end;
701
701
  x[L] = d[L], x[w] = C ? d[w] : E[w], x[y] = A ? d[y] : E[w], B[L] = E[L], B[w] = C ? d[w] : E[w], B[y] = A ? d[y] : E[w], R++;
@@ -712,7 +712,7 @@ at.prototype.distanceToBox = function() {
712
712
  const C = s[m];
713
713
  for (let A = 0; A < 12; A++) {
714
714
  const F = t[A];
715
- Oi(C, F, e, i);
715
+ gi(C, F, e, i);
716
716
  const p = e.distanceToSquared(i);
717
717
  if (p < f && (f = p, a && a.copy(e), c && c.copy(i), p < h))
718
718
  return Math.sqrt(p);
@@ -721,7 +721,7 @@ at.prototype.distanceToBox = function() {
721
721
  return Math.sqrt(f);
722
722
  };
723
723
  }();
724
- class gi {
724
+ class Oi {
725
725
  constructor(s) {
726
726
  this._getNewPrimitive = s, this._primitives = [];
727
727
  }
@@ -733,12 +733,12 @@ class gi {
733
733
  this._primitives.push(s);
734
734
  }
735
735
  }
736
- class Oo extends gi {
736
+ class go extends Oi {
737
737
  constructor() {
738
738
  super(() => new Ft());
739
739
  }
740
740
  }
741
- const It = /* @__PURE__ */ new Oo();
741
+ const It = /* @__PURE__ */ new go();
742
742
  function Et(l, s) {
743
743
  return s[l + 15] === 65535;
744
744
  }
@@ -757,7 +757,7 @@ function Ct(l, s) {
757
757
  function Un(l, s) {
758
758
  return s[l + 7];
759
759
  }
760
- class go {
760
+ class Oo {
761
761
  constructor() {
762
762
  this.float32Array = null, this.uint16Array = null, this.uint32Array = null;
763
763
  const s = [];
@@ -769,9 +769,9 @@ class go {
769
769
  };
770
770
  }
771
771
  }
772
- const Z = new go();
772
+ const Z = new Oo();
773
773
  let Yt, Ie;
774
- const Jt = [], Ke = /* @__PURE__ */ new gi(() => new Ot());
774
+ const Jt = [], Ke = /* @__PURE__ */ new Oi(() => new gt());
775
775
  function _o(l, s, t, e, i, o) {
776
776
  Yt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Yt, Ie), Z.setBuffer(l._roots[s]);
777
777
  const n = ai(0, l.geometry, t, e, i, o);
@@ -808,12 +808,12 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
808
808
  }
809
809
  A || (A = Yt, K(f, r, A));
810
810
  const p = Et(f * 2, a), T = t(A, p, m, n + 1, o + f);
811
- let O;
811
+ let g;
812
812
  if (T === xi) {
813
813
  const y = L(f), x = w(f) - y;
814
- O = e(y, x, !0, n + 1, o + f, A);
814
+ g = e(y, x, !0, n + 1, o + f, A);
815
815
  } else
816
- O = T && ai(
816
+ g = T && ai(
817
817
  f,
818
818
  s,
819
819
  t,
@@ -822,7 +822,7 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
822
822
  o,
823
823
  n + 1
824
824
  );
825
- if (O)
825
+ if (g)
826
826
  return !0;
827
827
  F = Ie, K(R, r, F);
828
828
  const _ = Et(R * 2, a), S = t(F, _, C, n + 1, o + R);
@@ -933,18 +933,18 @@ function wo(l, s = null) {
933
933
  const R = E * 2;
934
934
  if (r[R + 15] === Us) {
935
935
  const C = n[E + 6], A = r[R + 14];
936
- let F = 1 / 0, p = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
936
+ let F = 1 / 0, p = 1 / 0, T = 1 / 0, g = -1 / 0, _ = -1 / 0, S = -1 / 0;
937
937
  for (let N = 3 * C, L = 3 * (C + A); N < L; N++) {
938
938
  let w = e[N];
939
939
  const y = i.getX(w), U = i.getY(w), x = i.getZ(w);
940
- y < F && (F = y), y > O && (O = y), U < p && (p = U), U > _ && (_ = U), x < T && (T = x), x > S && (S = x);
940
+ y < F && (F = y), y > g && (g = y), U < p && (p = U), U > _ && (_ = U), x < T && (T = x), x > S && (S = x);
941
941
  }
942
- return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
942
+ return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== g || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = g, a[E + 4] = _, a[E + 5] = S, !0) : !1;
943
943
  } else {
944
944
  const C = E + 8, A = n[E + 6], F = C + u, p = A + u;
945
- let T = f, O = !1, _ = !1;
946
- s ? T || (O = s.has(F), _ = s.has(p), T = !O && !_) : (O = !0, _ = !0);
947
- const S = T || O, N = T || _;
945
+ let T = f, g = !1, _ = !1;
946
+ s ? T || (g = s.has(F), _ = s.has(p), T = !g && !_) : (g = !0, _ = !0);
947
+ const S = T || g, N = T || _;
948
948
  let L = !1;
949
949
  S && (L = d(C, u, T));
950
950
  let w = !1;
@@ -959,7 +959,7 @@ function wo(l, s = null) {
959
959
  }
960
960
  }
961
961
  }
962
- const Hi = /* @__PURE__ */ new Ot();
962
+ const Hi = /* @__PURE__ */ new gt();
963
963
  function Gt(l, s, t, e) {
964
964
  return K(l, s, Hi), t.intersectBox(Hi, e);
965
965
  }
@@ -1033,7 +1033,7 @@ function li(l, s, t, e) {
1033
1033
  return m && A ? m.distance <= A.distance ? m : A : m || A || null;
1034
1034
  }
1035
1035
  }
1036
- const ss = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new Ft(), ne = /* @__PURE__ */ new Ft(), Fe = /* @__PURE__ */ new yt(), Xi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
1036
+ const ss = /* @__PURE__ */ new gt(), ie = /* @__PURE__ */ new Ft(), ne = /* @__PURE__ */ new Ft(), Fe = /* @__PURE__ */ new yt(), Xi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
1037
1037
  function Yo(l, s, t, e) {
1038
1038
  Z.setBuffer(l._roots[s]);
1039
1039
  const i = hi(0, l, t, e);
@@ -1066,26 +1066,26 @@ function hi(l, s, t, e, i = null) {
1066
1066
  return K(h, o, ss), !!(i.intersectsBox(ss) && hi(h, s, t, e, i) || (K(d, o, ss), i.intersectsBox(ss) && hi(d, s, t, e, i)));
1067
1067
  }
1068
1068
  }
1069
- const ns = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), Oe = /* @__PURE__ */ new at(), Vo = /* @__PURE__ */ new M(), Go = /* @__PURE__ */ new M(), zo = /* @__PURE__ */ new M(), Ho = /* @__PURE__ */ new M();
1069
+ const ns = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Vo = /* @__PURE__ */ new M(), Go = /* @__PURE__ */ new M(), zo = /* @__PURE__ */ new M(), Ho = /* @__PURE__ */ new M();
1070
1070
  function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1071
1071
  s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
1072
1072
  const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
1073
1073
  let f = Vo, R = Go, m = null, C = null;
1074
1074
  i && (m = zo, C = Ho);
1075
1075
  let A = 1 / 0, F = null, p = null;
1076
- return ns.copy(t).invert(), Oe.matrix.copy(ns), l.shapecast(
1076
+ return ns.copy(t).invert(), ge.matrix.copy(ns), l.shapecast(
1077
1077
  {
1078
1078
  boundsTraverseOrder: (T) => ks.distanceToBox(T),
1079
- intersectsBounds: (T, O, _) => _ < A && _ < n ? (O && (Oe.min.copy(T.min), Oe.max.copy(T.max), Oe.needsUpdate = !0), !0) : !1,
1080
- intersectsRange: (T, O) => {
1079
+ intersectsBounds: (T, g, _) => _ < A && _ < n ? (g && (ge.min.copy(T.min), ge.max.copy(T.max), ge.needsUpdate = !0), !0) : !1,
1080
+ intersectsRange: (T, g) => {
1081
1081
  if (s.boundsTree)
1082
1082
  return s.boundsTree.shapecast({
1083
- boundsTraverseOrder: (S) => Oe.distanceToBox(S),
1083
+ boundsTraverseOrder: (S) => ge.distanceToBox(S),
1084
1084
  intersectsBounds: (S, N, L) => L < A && L < n,
1085
1085
  intersectsRange: (S, N) => {
1086
1086
  for (let L = S, w = S + N; L < w; L++) {
1087
1087
  tt(u, 3 * L, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
- for (let y = T, U = T + O; y < U; y++) {
1088
+ for (let y = T, U = T + g; y < U; y++) {
1089
1089
  tt(E, 3 * y, c, a), E.needsUpdate = !0;
1090
1090
  const x = E.distanceToTriangle(u, f, m);
1091
1091
  if (x < A && (R.copy(f), C && C.copy(m), A = x, F = y, p = L), x < o)
@@ -1098,7 +1098,7 @@ function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1098
1098
  const _ = pe(s);
1099
1099
  for (let S = 0, N = _; S < N; S++) {
1100
1100
  tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
- for (let L = T, w = T + O; L < w; L++) {
1101
+ for (let L = T, w = T + g; L < w; L++) {
1102
1102
  tt(E, 3 * L, c, a), E.needsUpdate = !0;
1103
1103
  const y = E.distanceToTriangle(u, f, m);
1104
1104
  if (y < A && (R.copy(f), C && C.copy(m), A = y, F = L, p = S), y < o)
@@ -1121,22 +1121,22 @@ function Wo(l, s = null) {
1121
1121
  const R = E * 2;
1122
1122
  if (r[R + 15] === Us) {
1123
1123
  const C = n[E + 6], A = r[R + 14];
1124
- let F = 1 / 0, p = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
1124
+ let F = 1 / 0, p = 1 / 0, T = 1 / 0, g = -1 / 0, _ = -1 / 0, S = -1 / 0;
1125
1125
  for (let N = C, L = C + A; N < L; N++) {
1126
1126
  const w = 3 * l.resolveTriangleIndex(N);
1127
1127
  for (let y = 0; y < 3; y++) {
1128
1128
  let U = w + y;
1129
1129
  U = e ? e[U] : U;
1130
1130
  const x = i.getX(U), B = i.getY(U), H = i.getZ(U);
1131
- x < F && (F = x), x > O && (O = x), B < p && (p = B), B > _ && (_ = B), H < T && (T = H), H > S && (S = H);
1131
+ x < F && (F = x), x > g && (g = x), B < p && (p = B), B > _ && (_ = B), H < T && (T = H), H > S && (S = H);
1132
1132
  }
1133
1133
  }
1134
- return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
1134
+ return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== g || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = g, a[E + 4] = _, a[E + 5] = S, !0) : !1;
1135
1135
  } else {
1136
1136
  const C = E + 8, A = n[E + 6], F = C + u, p = A + u;
1137
- let T = f, O = !1, _ = !1;
1138
- s ? T || (O = s.has(F), _ = s.has(p), T = !O && !_) : (O = !0, _ = !0);
1139
- const S = T || O, N = T || _;
1137
+ let T = f, g = !1, _ = !1;
1138
+ s ? T || (g = s.has(F), _ = s.has(p), T = !g && !_) : (g = !0, _ = !0);
1139
+ const S = T || g, N = T || _;
1140
1140
  let L = !1;
1141
1141
  S && (L = d(C, u, T));
1142
1142
  let w = !1;
@@ -1196,7 +1196,7 @@ function di(l, s, t, e) {
1196
1196
  return m && A ? m.distance <= A.distance ? m : A : m || A || null;
1197
1197
  }
1198
1198
  }
1199
- const os = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new Ft(), re = /* @__PURE__ */ new Ft(), ge = /* @__PURE__ */ new yt(), ji = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
1199
+ const os = /* @__PURE__ */ new gt(), oe = /* @__PURE__ */ new Ft(), re = /* @__PURE__ */ new Ft(), Oe = /* @__PURE__ */ new yt(), ji = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
1200
1200
  function jo(l, s, t, e) {
1201
1201
  Z.setBuffer(l._roots[s]);
1202
1202
  const i = ui(0, l, t, e);
@@ -1207,8 +1207,8 @@ function ui(l, s, t, e, i = null) {
1207
1207
  let a = l * 2;
1208
1208
  if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, e), i = ji), Et(a, n)) {
1209
1209
  const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, R = dt(l, r), m = ft(a, n);
1210
- if (ge.copy(e).invert(), t.boundsTree)
1211
- return K(l, o, rs), rs.matrix.copy(ge), rs.needsUpdate = !0, t.boundsTree.shapecast({
1210
+ if (Oe.copy(e).invert(), t.boundsTree)
1211
+ return K(l, o, rs), rs.matrix.copy(Oe), rs.needsUpdate = !0, t.boundsTree.shapecast({
1212
1212
  intersectsBounds: (A) => rs.intersectsBox(A),
1213
1213
  intersectsTriangle: (A) => {
1214
1214
  A.a.applyMatrix4(e), A.b.applyMatrix4(e), A.c.applyMatrix4(e), A.needsUpdate = !0;
@@ -1220,7 +1220,7 @@ function ui(l, s, t, e, i = null) {
1220
1220
  });
1221
1221
  for (let C = R, A = m + R; C < A; C++) {
1222
1222
  const F = s.resolveTriangleIndex(C);
1223
- tt(oe, 3 * F, d, E), oe.a.applyMatrix4(ge), oe.b.applyMatrix4(ge), oe.c.applyMatrix4(ge), oe.needsUpdate = !0;
1223
+ tt(oe, 3 * F, d, E), oe.a.applyMatrix4(Oe), oe.b.applyMatrix4(Oe), oe.c.applyMatrix4(Oe), oe.needsUpdate = !0;
1224
1224
  for (let p = 0, T = u.count; p < T; p += 3)
1225
1225
  if (tt(re, p, u, f), re.needsUpdate = !0, oe.intersectsTriangle(re))
1226
1226
  return !0;
@@ -1240,8 +1240,8 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1240
1240
  return as.copy(t).invert(), _e.matrix.copy(as), l.shapecast(
1241
1241
  {
1242
1242
  boundsTraverseOrder: (T) => Ws.distanceToBox(T),
1243
- intersectsBounds: (T, O, _) => _ < A && _ < n ? (O && (_e.min.copy(T.min), _e.max.copy(T.max), _e.needsUpdate = !0), !0) : !1,
1244
- intersectsRange: (T, O) => {
1243
+ intersectsBounds: (T, g, _) => _ < A && _ < n ? (g && (_e.min.copy(T.min), _e.max.copy(T.max), _e.needsUpdate = !0), !0) : !1,
1244
+ intersectsRange: (T, g) => {
1245
1245
  if (s.boundsTree) {
1246
1246
  const _ = s.boundsTree;
1247
1247
  return _.shapecast({
@@ -1251,7 +1251,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1251
1251
  for (let L = S, w = S + N; L < w; L++) {
1252
1252
  const y = _.resolveTriangleIndex(L);
1253
1253
  tt(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
- for (let U = T, x = T + O; U < x; U++) {
1254
+ for (let U = T, x = T + g; U < x; U++) {
1255
1255
  const B = l.resolveTriangleIndex(U);
1256
1256
  tt(E, 3 * B, c, a), E.needsUpdate = !0;
1257
1257
  const H = E.distanceToTriangle(u, f, m);
@@ -1265,7 +1265,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1265
1265
  const _ = pe(s);
1266
1266
  for (let S = 0, N = _; S < N; S++) {
1267
1267
  tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
- for (let L = T, w = T + O; L < w; L++) {
1268
+ for (let L = T, w = T + g; L < w; L++) {
1269
1269
  const y = l.resolveTriangleIndex(L);
1270
1270
  tt(E, 3 * y, c, a), E.needsUpdate = !0;
1271
1271
  const U = E.distanceToTriangle(u, f, m);
@@ -1281,7 +1281,7 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1281
1281
  function er() {
1282
1282
  return typeof SharedArrayBuffer < "u";
1283
1283
  }
1284
- const xe = new Z.constructor(), As = new Z.constructor(), vt = new gi(() => new Ot()), ae = new Ot(), ce = new Ot(), Xs = new Ot(), Zs = new Ot();
1284
+ const xe = new Z.constructor(), As = new Z.constructor(), vt = new Oi(() => new gt()), ae = new gt(), ce = new gt(), Xs = new gt(), Zs = new gt();
1285
1285
  let Qs = !1;
1286
1286
  function sr(l, s, t, e) {
1287
1287
  if (Qs)
@@ -1315,9 +1315,9 @@ function sr(l, s, t, e) {
1315
1315
  function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1316
1316
  let d, E;
1317
1317
  h ? (d = As, E = xe) : (d = xe, E = As);
1318
- const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T = Et(F, R), O = Et(p, A);
1318
+ const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T = Et(F, R), g = Et(p, A);
1319
1319
  let _ = !1;
1320
- if (O && T)
1320
+ if (g && T)
1321
1321
  h ? _ = i(
1322
1322
  dt(s, C),
1323
1323
  ft(s * 2, A),
@@ -1337,7 +1337,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1337
1337
  a,
1338
1338
  n + s
1339
1339
  );
1340
- else if (O) {
1340
+ else if (g) {
1341
1341
  const S = vt.getPrimitive();
1342
1342
  K(s, m, S), S.applyMatrix4(t);
1343
1343
  const N = pt(l), L = Ct(l, f);
@@ -1495,7 +1495,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1495
1495
  }
1496
1496
  return _;
1497
1497
  }
1498
- const cs = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new Ot();
1498
+ const cs = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new gt();
1499
1499
  class _i {
1500
1500
  static serialize(s, t = {}) {
1501
1501
  t = {
@@ -1554,7 +1554,7 @@ class _i {
1554
1554
  [Vs]: !1
1555
1555
  }, t), t.useSharedArrayBuffer && !er())
1556
1556
  throw new Error("MeshBVH: SharedArrayBuffer is not available.");
1557
- this.geometry = s, this._roots = null, this._indirectBuffer = null, t[Vs] || (mo(this, t), !s.boundingBox && t.setBoundingBox && (s.boundingBox = this.getBoundingBox(new Ot())));
1557
+ this.geometry = s, this._roots = null, this._indirectBuffer = null, t[Vs] || (mo(this, t), !s.boundingBox && t.setBoundingBox && (s.boundingBox = this.getBoundingBox(new gt())));
1558
1558
  const { _indirectBuffer: e } = this;
1559
1559
  this.resolveTriangleIndex = t.indirect ? (i) => e[i] : (i) => i;
1560
1560
  }
@@ -1645,19 +1645,19 @@ class _i {
1645
1645
  tt(h, f * 3, d, E);
1646
1646
  };
1647
1647
  if (o) {
1648
- const f = (R, m, C, A, F, p, T, O) => {
1648
+ const f = (R, m, C, A, F, p, T, g) => {
1649
1649
  for (let _ = C, S = C + A; _ < S; _++) {
1650
1650
  u(_), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
1651
1651
  for (let N = R, L = R + m; N < L; N++)
1652
- if (c(N), n.needsUpdate = !0, o(n, h, N, _, F, p, T, O))
1652
+ if (c(N), n.needsUpdate = !0, o(n, h, N, _, F, p, T, g))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
1656
1656
  };
1657
1657
  if (i) {
1658
1658
  const R = i;
1659
- i = function(m, C, A, F, p, T, O, _) {
1660
- return R(m, C, A, F, p, T, O, _) ? !0 : f(m, C, A, F, p, T, O, _);
1659
+ i = function(m, C, A, F, p, T, g, _) {
1660
+ return R(m, C, A, F, p, T, g, _) ? !0 : f(m, C, A, F, p, T, g, _);
1661
1661
  };
1662
1662
  } else
1663
1663
  i = f;
@@ -2364,7 +2364,7 @@ function Cr(l, s) {
2364
2364
  let t = 0, e = 0;
2365
2365
  const i = 10;
2366
2366
  s.unitary.identity(), s.diagonal.copy(l);
2367
- const o = s.unitary, n = s.diagonal, r = new g.Matrix3(), a = new g.Matrix3(), c = Number.EPSILON * Ir(n);
2367
+ const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), c = Number.EPSILON * Ir(n);
2368
2368
  for (; e < i && fr(n) > c; )
2369
2369
  pr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
2370
2370
  return s;
@@ -2373,13 +2373,13 @@ function Tr(l) {
2373
2373
  const s = [];
2374
2374
  for (let it = 0; it < l.length - 2; it += 3) {
2375
2375
  const Xt = l[it], J = l[it + 1], $t = l[it + 2];
2376
- s.push(new g.Vector3(Xt, J, $t));
2376
+ s.push(new O.Vector3(Xt, J, $t));
2377
2377
  }
2378
2378
  const t = new dr();
2379
2379
  t.setFromPoints(s);
2380
2380
  const e = {
2381
- unitary: new g.Matrix3(),
2382
- diagonal: new g.Matrix3()
2381
+ unitary: new O.Matrix3(),
2382
+ diagonal: new O.Matrix3()
2383
2383
  }, i = t.faces, o = [], n = [];
2384
2384
  for (let it = 0, Xt = i.length; it < Xt; it++) {
2385
2385
  const J = i[it];
@@ -2394,7 +2394,7 @@ function Tr(l) {
2394
2394
  n.push(bs.point.x, bs.point.y, bs.point.z), n.push(vs.point.x, vs.point.y, vs.point.z), n.push(Bs.point.x, Bs.point.y, Bs.point.z);
2395
2395
  }
2396
2396
  }
2397
- const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(), h = new g.Vector3(), d = new g.Vector3(), E = new g.Vector3(), u = new g.Vector3(), f = new g.Vector3();
2397
+ const r = new O.Vector3(), a = new O.Vector3(), c = new O.Vector3(), h = new O.Vector3(), d = new O.Vector3(), E = new O.Vector3(), u = new O.Vector3(), f = new O.Vector3();
2398
2398
  let R = 0, m = 0, C = 0, A = 0, F = 0, p = 0, T = 0;
2399
2399
  for (let it = 0, Xt = n.length; it < Xt; it += 9) {
2400
2400
  r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), h.subVectors(a, r), d.subVectors(c, r);
@@ -2402,9 +2402,9 @@ function Tr(l) {
2402
2402
  f.add(E.copy(u).multiplyScalar(J)), R += J, m += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (J / 12), A += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (J / 12), p += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), T += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
2403
2403
  }
2404
2404
  f.divideScalar(R), m /= R, C /= R, A /= R, F /= R, p /= R, T /= R, m -= f.x * f.x, C -= f.x * f.y, A -= f.x * f.z, F -= f.y * f.y, p -= f.y * f.z, T -= f.z * f.z;
2405
- const O = new g.Matrix3();
2406
- O.elements[0] = m, O.elements[1] = C, O.elements[2] = A, O.elements[3] = C, O.elements[4] = F, O.elements[5] = p, O.elements[6] = A, O.elements[7] = p, O.elements[8] = T, Cr(O, e);
2407
- const _ = e.unitary, S = new g.Vector3(), N = new g.Vector3(), L = new g.Vector3();
2405
+ const g = new O.Matrix3();
2406
+ g.elements[0] = m, g.elements[1] = C, g.elements[2] = A, g.elements[3] = C, g.elements[4] = F, g.elements[5] = p, g.elements[6] = A, g.elements[7] = p, g.elements[8] = T, Cr(g, e);
2407
+ const _ = e.unitary, S = new O.Vector3(), N = new O.Vector3(), L = new O.Vector3();
2408
2408
  _.extractBasis(S, N, L);
2409
2409
  let w = -1 / 0, y = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
2410
2410
  for (let it = 0, Xt = s.length; it < Xt; it++) {
@@ -2412,17 +2412,17 @@ function Tr(l) {
2412
2412
  w = Math.max(S.dot(J), w), y = Math.max(N.dot(J), y), U = Math.max(L.dot(J), U), x = Math.min(S.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(L.dot(J), H);
2413
2413
  }
2414
2414
  S.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + y)), L.multiplyScalar(0.5 * (H + U));
2415
- const q = new g.Vector3(), st = new g.Vector3(), Q = new g.Matrix3();
2415
+ const q = new O.Vector3(), st = new O.Vector3(), Q = new O.Matrix3();
2416
2416
  q.add(S).add(N).add(L), st.x = w - x, st.y = y - B, st.z = U - H, st.multiplyScalar(0.5), Q.copy(_);
2417
- const { x: Ht, y: kt, z: Wt } = st, We = new g.Matrix4();
2417
+ const { x: Ht, y: kt, z: Wt } = st, We = new O.Matrix4();
2418
2418
  We.makeScale(Ht * 2, kt * 2, Wt * 2);
2419
- const Ce = new g.Matrix4();
2419
+ const Ce = new O.Matrix4();
2420
2420
  Ce.makeTranslation(-Ht, -kt, -Wt);
2421
- const yi = new g.Matrix4();
2421
+ const yi = new O.Matrix4();
2422
2422
  yi.makeTranslation(q.x, q.y, q.z);
2423
- const Mi = new g.Matrix4();
2423
+ const Mi = new O.Matrix4();
2424
2424
  Mi.setFromMatrix3(Q);
2425
- const Te = new g.Matrix4();
2425
+ const Te = new O.Matrix4();
2426
2426
  return Te.multiply(yi), Te.multiply(Mi), Te.multiply(Ce), Te.multiply(We), { center: q, halfSizes: st, rotation: Q, transformation: Te };
2427
2427
  }
2428
2428
  function mr(l, s, t) {
@@ -2832,7 +2832,7 @@ class ea extends et {
2832
2832
  return n ? (this.workingPlane ? Math.abs(this.workingPlane.distanceToPoint(n)) < 1e-3 : !0) ? ((this._pickedPoint === null || !this._pickedPoint.equals(n)) && (this._pickedPoint = n.clone(), this.onVertexFound.trigger(this._pickedPoint)), this._pickedPoint) : (this._pickedPoint = null, this._pickedPoint) : (this._pickedPoint !== null && (this.onVertexLost.trigger(), this._pickedPoint = null), this._pickedPoint);
2833
2833
  }
2834
2834
  getClosestVertex(t) {
2835
- let e = new g.Vector3(), i = !1, o = Number.MAX_SAFE_INTEGER;
2835
+ let e = new O.Vector3(), i = !1, o = Number.MAX_SAFE_INTEGER;
2836
2836
  const n = this.getVertices(t);
2837
2837
  if (n === null)
2838
2838
  return null;
@@ -2848,7 +2848,7 @@ class ea extends et {
2848
2848
  const e = t.object;
2849
2849
  if (!t.face || !e)
2850
2850
  return null;
2851
- const i = e.geometry, o = new g.Matrix4(), { instanceId: n } = t, r = n !== void 0, a = e instanceof g.InstancedMesh;
2851
+ const i = e.geometry, o = new O.Matrix4(), { instanceId: n } = t, r = n !== void 0, a = e instanceof O.InstancedMesh;
2852
2852
  return a && r && e.getMatrixAt(n, o), [
2853
2853
  this.getVertex(t.face.a, i),
2854
2854
  this.getVertex(t.face.b, i),
@@ -2859,7 +2859,7 @@ class ea extends et {
2859
2859
  if (t === void 0)
2860
2860
  return null;
2861
2861
  const i = e.attributes.position;
2862
- return new g.Vector3(
2862
+ return new O.Vector3(
2863
2863
  i.getX(t),
2864
2864
  i.getY(t),
2865
2865
  i.getZ(t)
@@ -2889,7 +2889,7 @@ const Fs = class Fs {
2889
2889
  e.enabled && e.isUpdateable() && e.update(s);
2890
2890
  requestAnimationFrame(this.update);
2891
2891
  });
2892
- this._clock = new g.Clock(), Fs.setupBVH();
2892
+ this._clock = new O.Clock(), Fs.setupBVH();
2893
2893
  }
2894
2894
  /**
2895
2895
  * Adds a component to the list of components.
@@ -2962,18 +2962,18 @@ const Fs = class Fs {
2962
2962
  this._clock.stop(), this.onDisposed.trigger(), this.onDisposed.reset();
2963
2963
  }
2964
2964
  static setupBVH() {
2965
- g.BufferGeometry.prototype.computeBoundsTree = or, g.BufferGeometry.prototype.disposeBoundsTree = rr, g.Mesh.prototype.raycast = nr;
2965
+ O.BufferGeometry.prototype.computeBoundsTree = or, O.BufferGeometry.prototype.disposeBoundsTree = rr, O.Mesh.prototype.raycast = nr;
2966
2966
  }
2967
2967
  };
2968
2968
  /**
2969
2969
  * The version of the @thatopen/components library.
2970
2970
  */
2971
- I(Fs, "release", "2.1.1");
2971
+ I(Fs, "release", "2.1.3");
2972
2972
  let pi = Fs;
2973
2973
  class Rr {
2974
2974
  constructor(s) {
2975
2975
  I(this, "_event");
2976
- I(this, "_position", new g.Vector2());
2976
+ I(this, "_position", new O.Vector2());
2977
2977
  /** {@link Disposable.onDisposed} */
2978
2978
  I(this, "onDisposed", new D());
2979
2979
  I(this, "updateMouseInfo", (s) => {
@@ -3019,7 +3019,7 @@ class Ar {
3019
3019
  * A reference to the Three.js Raycaster instance.
3020
3020
  * This is used for raycasting operations.
3021
3021
  */
3022
- I(this, "three", new g.Raycaster());
3022
+ I(this, "three", new O.Raycaster());
3023
3023
  /**
3024
3024
  * A reference to the world instance to which this Raycaster belongs.
3025
3025
  * This is used to access the camera and meshes.
@@ -3077,7 +3077,7 @@ class Ar {
3077
3077
  );
3078
3078
  }
3079
3079
  }
3080
- const Os = class Os extends et {
3080
+ const gs = class gs extends et {
3081
3081
  constructor(t) {
3082
3082
  super(t);
3083
3083
  /** {@link Component.enabled} */
@@ -3089,7 +3089,7 @@ const Os = class Os extends et {
3089
3089
  I(this, "list", /* @__PURE__ */ new Map());
3090
3090
  /** {@link Disposable.onDisposed} */
3091
3091
  I(this, "onDisposed", new D());
3092
- t.add(Os.uuid, this);
3092
+ t.add(gs.uuid, this);
3093
3093
  }
3094
3094
  /**
3095
3095
  * Retrieves a SimpleRaycaster instance for the given world.
@@ -3129,8 +3129,8 @@ const Os = class Os extends et {
3129
3129
  * A unique identifier for the component.
3130
3130
  * This UUID is used to register the component within the Components system.
3131
3131
  */
3132
- I(Os, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
3133
- let ze = Os;
3132
+ I(gs, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
3133
+ let ze = gs;
3134
3134
  class Fr extends Si {
3135
3135
  constructor() {
3136
3136
  super(...arguments);
@@ -3249,26 +3249,26 @@ class sa extends lr {
3249
3249
  */
3250
3250
  I(this, "config", {
3251
3251
  directionalLight: {
3252
- color: new g.Color("white"),
3252
+ color: new O.Color("white"),
3253
3253
  intensity: 1.5,
3254
- position: new g.Vector3(5, 10, 3)
3254
+ position: new O.Vector3(5, 10, 3)
3255
3255
  },
3256
3256
  ambientLight: {
3257
- color: new g.Color("white"),
3257
+ color: new O.Color("white"),
3258
3258
  intensity: 1
3259
3259
  }
3260
3260
  });
3261
- this.three = new g.Scene(), this.three.background = new g.Color(2107698);
3261
+ this.three = new O.Scene(), this.three.background = new O.Color(2107698);
3262
3262
  }
3263
3263
  /** {@link Configurable.setup} */
3264
3264
  setup(t) {
3265
3265
  this.config = { ...this.config, ...t };
3266
- const e = new g.DirectionalLight(
3266
+ const e = new O.DirectionalLight(
3267
3267
  this.config.directionalLight.color,
3268
3268
  this.config.directionalLight.intensity
3269
3269
  );
3270
3270
  e.position.copy(this.config.directionalLight.position);
3271
- const i = new g.AmbientLight(
3271
+ const i = new O.AmbientLight(
3272
3272
  this.config.ambientLight.color,
3273
3273
  this.config.ambientLight.intensity
3274
3274
  );
@@ -3309,7 +3309,7 @@ class ia extends cr {
3309
3309
  return;
3310
3310
  this._resizing = !0, this.onContainerUpdated.trigger();
3311
3311
  const e = t ? t.x : this.container.clientWidth, i = t ? t.y : this.container.clientHeight;
3312
- this.three.setSize(e, i), this.onResize.trigger(new g.Vector2(e, i)), this._resizing = !1;
3312
+ this.three.setSize(e, i), this.onResize.trigger(new O.Vector2(e, i)), this._resizing = !1;
3313
3313
  });
3314
3314
  I(this, "resizeEvent", () => {
3315
3315
  this.resize();
@@ -3318,14 +3318,14 @@ class ia extends cr {
3318
3318
  t.preventDefault(), this.enabled = !1;
3319
3319
  });
3320
3320
  I(this, "onContextBack", () => {
3321
- this.three.setRenderTarget(null), this.three.dispose(), this.three = new g.WebGLRenderer({
3321
+ this.three.setRenderTarget(null), this.three.dispose(), this.three = new O.WebGLRenderer({
3322
3322
  canvas: this._canvas,
3323
3323
  antialias: !0,
3324
3324
  alpha: !0,
3325
3325
  ...this._parameters
3326
3326
  }), this.enabled = !0;
3327
3327
  });
3328
- this.container = e, this._parameters = i, this.three = new g.WebGLRenderer({
3328
+ this.container = e, this._parameters = i, this.three = new O.WebGLRenderer({
3329
3329
  antialias: !0,
3330
3330
  alpha: !0,
3331
3331
  ...i
@@ -3347,7 +3347,7 @@ class ia extends cr {
3347
3347
  }
3348
3348
  /** {@link Resizeable.getSize}. */
3349
3349
  getSize() {
3350
- return new g.Vector2(
3350
+ return new O.Vector2(
3351
3351
  this.three.domElement.clientWidth,
3352
3352
  this.three.domElement.clientHeight
3353
3353
  );
@@ -3448,8 +3448,8 @@ function rn(l, s, t, e, i = 1 / 0, o, n) {
3448
3448
  u = u / B * F, f = f / B * F, R = R / B * F;
3449
3449
  }
3450
3450
  h = l.x - u, d = l.y - f, E = l.z - R;
3451
- const O = (t.x + r * u) * o, _ = (t.y + r * f) * o, S = (t.z + r * R) * o;
3452
- t.x = (t.x - r * O) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x = h + (u + O) * c, n.y = d + (f + _) * c, n.z = E + (R + S) * c;
3451
+ const g = (t.x + r * u) * o, _ = (t.y + r * f) * o, S = (t.z + r * R) * o;
3452
+ t.x = (t.x - r * g) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x = h + (u + g) * c, n.y = d + (f + _) * c, n.z = E + (R + S) * c;
3453
3453
  const N = m - l.x, L = C - l.y, w = A - l.z, y = n.x - m, U = n.y - C, x = n.z - A;
3454
3454
  return N * y + L * U + w * x > 0 && (n.x = m, n.y = C, n.z = A, t.x = (n.x - m) / o, t.y = (n.y - C) / o, t.z = (n.z - A) / o), n;
3455
3455
  }
@@ -3461,7 +3461,7 @@ function $s(l, s) {
3461
3461
  function Js(l, s) {
3462
3462
  return bt(l) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
3463
3463
  }
3464
- class Or {
3464
+ class gr {
3465
3465
  constructor() {
3466
3466
  this._listeners = {};
3467
3467
  }
@@ -3525,9 +3525,9 @@ class Or {
3525
3525
  }
3526
3526
  }
3527
3527
  }
3528
- const gr = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Sr = !(bn && "PointerEvent" in window);
3529
- let Y, an, ds, ti, lt, G, z, Ee, Le, gt, _t, Qt, cn, ln, ut, ye, de, hn, ei, En, si, ii, us;
3530
- class ot extends Or {
3528
+ const Or = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Sr = !(bn && "PointerEvent" in window);
3529
+ let Y, an, ds, ti, lt, G, z, Ee, Le, Ot, _t, Qt, cn, ln, ut, ye, de, hn, ei, En, si, ii, us;
3530
+ class ot extends gr {
3531
3531
  /**
3532
3532
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
3533
3533
  *
@@ -3569,7 +3569,7 @@ class ot extends Or {
3569
3569
  * @category Statics
3570
3570
  */
3571
3571
  static install(s) {
3572
- Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(), gt = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), ut = new Y.Spherical(), ye = new Y.Spherical(), de = new Y.Box3(), hn = new Y.Box3(), ei = new Y.Sphere(), En = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), us = new Y.Raycaster();
3572
+ Y = s.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(), Ot = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), ut = new Y.Spherical(), ye = new Y.Spherical(), de = new Y.Box3(), hn = new Y.Box3(), ei = new Y.Sphere(), En = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), us = new Y.Raycaster();
3573
3573
  }
3574
3574
  /**
3575
3575
  * list all ACTIONs
@@ -3597,7 +3597,7 @@ class ot extends Or {
3597
3597
  */
3598
3598
  constructor(s, t) {
3599
3599
  super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.verticalDragToForward = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
3600
- }, this._enabled = !0, this._state = P.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (p, T, O) => {
3600
+ }, this._enabled = !0, this._state = P.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (p, T, g) => {
3601
3601
  let _, S;
3602
3602
  if (Zt(this._camera)) {
3603
3603
  const N = G.copy(this._camera.position).sub(this._target), L = this._camera.getEffectiveFOV() * Se, w = N.length() * Math.tan(L * 0.5);
@@ -3607,16 +3607,16 @@ class ot extends Or {
3607
3607
  _ = p * (N.right - N.left) / N.zoom / this._elementRect.width, S = T * (N.top - N.bottom) / N.zoom / this._elementRect.height;
3608
3608
  } else
3609
3609
  return;
3610
- this.verticalDragToForward ? (O ? this.setFocalOffset(this._focalOffsetEnd.x + _, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(_, 0, !0), this.forward(-S, !0)) : O ? this.setFocalOffset(this._focalOffsetEnd.x + _, this._focalOffsetEnd.y + S, this._focalOffsetEnd.z, !0) : this.truck(_, S, !0);
3610
+ this.verticalDragToForward ? (g ? this.setFocalOffset(this._focalOffsetEnd.x + _, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(_, 0, !0), this.forward(-S, !0)) : g ? this.setFocalOffset(this._focalOffsetEnd.x + _, this._focalOffsetEnd.y + S, this._focalOffsetEnd.z, !0) : this.truck(_, S, !0);
3611
3611
  }, this._rotateInternal = (p, T) => {
3612
- const O = he * this.azimuthRotateSpeed * p / this._elementRect.height, _ = he * this.polarRotateSpeed * T / this._elementRect.height;
3613
- this.rotate(O, _, !0);
3614
- }, this._dollyInternal = (p, T, O) => {
3612
+ const g = he * this.azimuthRotateSpeed * p / this._elementRect.height, _ = he * this.polarRotateSpeed * T / this._elementRect.height;
3613
+ this.rotate(g, _, !0);
3614
+ }, this._dollyInternal = (p, T, g) => {
3615
3615
  const _ = Math.pow(0.95, -p * this.dollySpeed), S = this._sphericalEnd.radius, N = this._sphericalEnd.radius * _, L = mt(N, this.minDistance, this.maxDistance), w = L - N;
3616
- this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - S, this._dollyControlCoord.set(T, O)), this._lastDollyDirection = Math.sign(-p);
3617
- }, this._zoomInternal = (p, T, O) => {
3616
+ this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - S, this._dollyControlCoord.set(T, g)), this._lastDollyDirection = Math.sign(-p);
3617
+ }, this._zoomInternal = (p, T, g) => {
3618
3618
  const _ = Math.pow(0.95, p * this.dollySpeed), S = this._zoom, N = this._zoom * _;
3619
- this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - S, this._dollyControlCoord.set(T, O));
3619
+ this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - S, this._dollyControlCoord.set(T, g));
3620
3620
  }, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, ds), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = P.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
3621
3621
  new Y.Vector3(),
3622
3622
  new Y.Vector3(),
@@ -3647,7 +3647,7 @@ class ot extends Or {
3647
3647
  }
3648
3648
  if ((p.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
3649
3649
  return;
3650
- const O = {
3650
+ const g = {
3651
3651
  pointerId: p.pointerId,
3652
3652
  clientX: p.clientX,
3653
3653
  clientY: p.clientY,
@@ -3655,7 +3655,7 @@ class ot extends Or {
3655
3655
  deltaY: 0,
3656
3656
  mouseButton: T
3657
3657
  };
3658
- this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, R(p);
3658
+ this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, R(p);
3659
3659
  }, r = (p) => {
3660
3660
  if (!this._enabled || !this._domElement || this._lockedPointer)
3661
3661
  return;
@@ -3669,7 +3669,7 @@ class ot extends Or {
3669
3669
  const _ = this._findPointerByMouseButton(T);
3670
3670
  _ && this._disposePointer(_);
3671
3671
  }
3672
- const O = {
3672
+ const g = {
3673
3673
  pointerId: 1,
3674
3674
  clientX: p.clientX,
3675
3675
  clientY: p.clientY,
@@ -3677,12 +3677,12 @@ class ot extends Or {
3677
3677
  deltaY: 0,
3678
3678
  mouseButton: (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.LEFT ? V.MIDDLE : (p.buttons & V.RIGHT) === V.LEFT ? V.RIGHT : null
3679
3679
  };
3680
- this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", c), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(p);
3680
+ this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", c), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(p);
3681
3681
  }, a = (p) => {
3682
3682
  p.cancelable && p.preventDefault();
3683
- const T = p.pointerId, O = this._lockedPointer || this._findPointerById(T);
3684
- if (O) {
3685
- if (O.clientX = p.clientX, O.clientY = p.clientY, O.deltaX = p.movementX, O.deltaY = p.movementY, this._state = 0, p.pointerType === "touch")
3683
+ const T = p.pointerId, g = this._lockedPointer || this._findPointerById(T);
3684
+ if (g) {
3685
+ if (g.clientX = p.clientX, g.clientY = p.clientY, g.deltaX = p.movementX, g.deltaY = p.movementY, this._state = 0, p.pointerType === "touch")
3686
3686
  switch (this._activePointers.length) {
3687
3687
  case 1:
3688
3688
  this._state = this.touches.one;
@@ -3740,7 +3740,7 @@ class ot extends Or {
3740
3740
  const N = performance.now();
3741
3741
  E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
3742
3742
  }
3743
- const T = _r ? -1 : -3, O = p.deltaMode === 1 ? p.deltaY / T : p.deltaY / (T * 10), _ = this.dollyToCursor ? (p.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (p.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3743
+ const T = _r ? -1 : -3, g = p.deltaMode === 1 ? p.deltaY / T : p.deltaY / (T * 10), _ = this.dollyToCursor ? (p.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (p.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3744
3744
  switch (this.mouseButtons.wheel) {
3745
3745
  case P.ROTATE: {
3746
3746
  this._rotateInternal(p.deltaX, p.deltaY), this._isUserControllingRotate = !0;
@@ -3755,11 +3755,11 @@ class ot extends Or {
3755
3755
  break;
3756
3756
  }
3757
3757
  case P.DOLLY: {
3758
- this._dollyInternal(-O, _, S), this._isUserControllingDolly = !0;
3758
+ this._dollyInternal(-g, _, S), this._isUserControllingDolly = !0;
3759
3759
  break;
3760
3760
  }
3761
3761
  case P.ZOOM: {
3762
- this._zoomInternal(-O, _, S), this._isUserControllingZoom = !0;
3762
+ this._zoomInternal(-g, _, S), this._isUserControllingZoom = !0;
3763
3763
  break;
3764
3764
  }
3765
3765
  }
@@ -3767,8 +3767,8 @@ class ot extends Or {
3767
3767
  }, f = (p) => {
3768
3768
  if (!(!this._domElement || !this._enabled)) {
3769
3769
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3770
- const T = p instanceof PointerEvent ? p.pointerId : (p instanceof MouseEvent, 0), O = this._findPointerById(T);
3771
- O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3770
+ const T = p instanceof PointerEvent ? p.pointerId : (p instanceof MouseEvent, 0), g = this._findPointerById(T);
3771
+ g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3772
3772
  return;
3773
3773
  }
3774
3774
  p.preventDefault();
@@ -3777,7 +3777,7 @@ class ot extends Or {
3777
3777
  if (!this._enabled)
3778
3778
  return;
3779
3779
  if ($s(this._activePointers, lt), this._getClientRect(this._elementRect), e.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
3780
- const O = lt.x - this._activePointers[1].clientX, _ = lt.y - this._activePointers[1].clientY, S = Math.sqrt(O * O + _ * _);
3780
+ const g = lt.x - this._activePointers[1].clientX, _ = lt.y - this._activePointers[1].clientY, S = Math.sqrt(g * g + _ * _);
3781
3781
  o.set(0, S);
3782
3782
  const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, L = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
3783
3783
  i.set(N, L);
@@ -3803,8 +3803,8 @@ class ot extends Or {
3803
3803
  if (!this._enabled || !this._dragNeedsUpdate)
3804
3804
  return;
3805
3805
  this._dragNeedsUpdate = !1, $s(this._activePointers, lt);
3806
- const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = T ? -T.deltaX : i.x - lt.x, _ = T ? -T.deltaY : i.y - lt.y;
3807
- if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, _), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
3806
+ const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, g = T ? -T.deltaX : i.x - lt.x, _ = T ? -T.deltaY : i.y - lt.y;
3807
+ if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(g, _), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
3808
3808
  const S = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, L = this.dollyDragInverted ? -1 : 1;
3809
3809
  (this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(L * _ * Es, S, N), this._isUserControllingDolly = !0) : (this._zoomInternal(L * _ * Es, S, N), this._isUserControllingZoom = !0);
3810
3810
  }
@@ -3814,7 +3814,7 @@ class ot extends Or {
3814
3814
  const y = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3815
3815
  (this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * Es, y, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * Es, y, U), this._isUserControllingZoom = !0);
3816
3816
  }
3817
- ((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, _, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, _, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3817
+ ((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(g, _, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(g, _, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3818
3818
  }, C = () => {
3819
3819
  $s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3820
3820
  };
@@ -4137,8 +4137,8 @@ class ot extends Or {
4137
4137
  * @category Methods
4138
4138
  */
4139
4139
  truck(s, t, e = !1) {
4140
- this._camera.updateMatrix(), gt.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), gt.multiplyScalar(s), _t.multiplyScalar(-t);
4141
- const i = G.copy(gt).add(_t), o = z.copy(this._targetEnd).add(i);
4140
+ this._camera.updateMatrix(), Ot.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Ot.multiplyScalar(s), _t.multiplyScalar(-t);
4141
+ const i = G.copy(Ot).add(_t), o = z.copy(this._targetEnd).add(i);
4142
4142
  return this.moveTo(o.x, o.y, o.z, e);
4143
4143
  }
4144
4144
  /**
@@ -4282,8 +4282,8 @@ class ot extends Or {
4282
4282
  ye.setFromVector3(A.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
4283
4283
  const F = ye.theta - ut.theta, p = ye.phi - ut.phi, T = ye.radius - ut.radius;
4284
4284
  this._sphericalEnd.set(ut.radius + T * u, ut.phi + p * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, f || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4285
- const O = !f || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4286
- return this._createOnRestPromise(O);
4285
+ const g = !f || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4286
+ return this._createOnRestPromise(g);
4287
4287
  }
4288
4288
  /**
4289
4289
  * Set angle and distance by given position.
@@ -4332,9 +4332,9 @@ class ot extends Or {
4332
4332
  * @category Methods
4333
4333
  */
4334
4334
  setOrbitPoint(s, t, e) {
4335
- this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), _t.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
4335
+ this._camera.updateMatrixWorld(), Ot.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), _t.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
4336
4336
  const i = G.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
4337
- gt.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(gt).add(_t).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
4337
+ Ot.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(Ot).add(_t).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
4338
4338
  }
4339
4339
  /**
4340
4340
  * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
@@ -4526,8 +4526,8 @@ class ot extends Or {
4526
4526
  if (Zt(this._camera) && this._changedDolly !== 0) {
4527
4527
  const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(Le), f = G.copy(u).cross(E.up).normalize();
4528
4528
  f.lengthSq() === 0 && (f.x = 1);
4529
- const R = z.crossVectors(f, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Se * 0.5), A = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * m)), p = G.copy(this._targetEnd).lerp(F, A), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4530
- if (this.infinityDolly && (T || O)) {
4529
+ const R = z.crossVectors(f, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Se * 0.5), A = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * m)), p = G.copy(this._targetEnd).lerp(F, A), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4530
+ if (this.infinityDolly && (T || g)) {
4531
4531
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4532
4532
  const S = z.copy(u).multiplyScalar(-d);
4533
4533
  p.add(S);
@@ -4536,15 +4536,15 @@ class ot extends Or {
4536
4536
  const _ = z.subVectors(p, this._targetEnd);
4537
4537
  this._targetEnd.copy(p), this._target.add(_), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4538
4538
  } else if (bt(this._camera) && this._changedZoom !== 0) {
4539
- const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), f = z.set(0, 0, -1).applyQuaternion(E.quaternion), R = Ee.copy(u).add(f.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, A = this._getCameraDirection(Le), F = this._targetEnd.dot(A), p = G.copy(this._targetEnd).lerp(R, C), T = p.dot(A), O = A.multiplyScalar(T - F);
4540
- p.sub(O), this._boundary.clampPoint(p, p);
4539
+ const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), f = z.set(0, 0, -1).applyQuaternion(E.quaternion), R = Ee.copy(u).add(f.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, A = this._getCameraDirection(Le), F = this._targetEnd.dot(A), p = G.copy(this._targetEnd).lerp(R, C), T = p.dot(A), g = A.multiplyScalar(T - F);
4540
+ p.sub(g), this._boundary.clampPoint(p, p);
4541
4541
  const _ = z.subVectors(p, this._targetEnd);
4542
4542
  this._targetEnd.copy(p), this._target.add(_), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
4543
4543
  }
4544
4544
  }
4545
4545
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
4546
4546
  const a = this._collisionTest();
4547
- this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4547
+ this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), Ot.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), Ot.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(Ot).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4548
4548
  const h = this._needsUpdate;
4549
4549
  return h && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : h ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !h && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = h, this._needsUpdate = !1, h;
4550
4550
  }
@@ -4598,7 +4598,7 @@ class ot extends Or {
4598
4598
  console.warn("camera-controls is already connected.");
4599
4599
  return;
4600
4600
  }
4601
- s.setAttribute("data-camera-controls-version", gr), this._addAllEventListeners(s), this._getClientRect(this._elementRect);
4601
+ s.setAttribute("data-camera-controls-version", Or), this._addAllEventListeners(s), this._getClientRect(this._elementRect);
4602
4602
  }
4603
4603
  /**
4604
4604
  * Detach all internal event handlers to disable drag control.
@@ -4770,7 +4770,7 @@ class He extends ar {
4770
4770
  I(this, "updateAspect", () => {
4771
4771
  var t;
4772
4772
  if (!(!this.currentWorld || !this.currentWorld.renderer)) {
4773
- if (this.three instanceof g.OrthographicCamera) {
4773
+ if (this.three instanceof O.OrthographicCamera) {
4774
4774
  this.onAspectUpdated.trigger();
4775
4775
  return;
4776
4776
  }
@@ -4835,8 +4835,8 @@ class He extends ar {
4835
4835
  this.enabled && (this.onBeforeUpdate.trigger(this), this.controls.update(t), this.onAfterUpdate.trigger(this));
4836
4836
  }
4837
4837
  setupCamera() {
4838
- const t = window.innerWidth / window.innerHeight, e = new g.PerspectiveCamera(60, t, 1, 1e3);
4839
- return e.position.set(50, 50, 50), e.lookAt(new g.Vector3(0, 0, 0)), e;
4838
+ const t = window.innerWidth / window.innerHeight, e = new O.PerspectiveCamera(60, t, 1, 1e3);
4839
+ return e.position.set(50, 50, 50), e.lookAt(new O.Vector3(0, 0, 0)), e;
4840
4840
  }
4841
4841
  newCameraControls() {
4842
4842
  if (!this.currentWorld)
@@ -4852,21 +4852,21 @@ class He extends ar {
4852
4852
  }
4853
4853
  static getSubsetOfThree() {
4854
4854
  return {
4855
- MOUSE: g.MOUSE,
4856
- Vector2: g.Vector2,
4857
- Vector3: g.Vector3,
4858
- Vector4: g.Vector4,
4859
- Quaternion: g.Quaternion,
4860
- Matrix4: g.Matrix4,
4861
- Spherical: g.Spherical,
4862
- Box3: g.Box3,
4863
- Sphere: g.Sphere,
4864
- Raycaster: g.Raycaster,
4865
- MathUtils: g.MathUtils
4855
+ MOUSE: O.MOUSE,
4856
+ Vector2: O.Vector2,
4857
+ Vector3: O.Vector3,
4858
+ Vector4: O.Vector4,
4859
+ Quaternion: O.Quaternion,
4860
+ Matrix4: O.Matrix4,
4861
+ Spherical: O.Spherical,
4862
+ Box3: O.Box3,
4863
+ Sphere: O.Sphere,
4864
+ Raycaster: O.Raycaster,
4865
+ MathUtils: O.MathUtils
4866
4866
  };
4867
4867
  }
4868
4868
  }
4869
- const gs = class gs extends et {
4869
+ const Os = class Os extends et {
4870
4870
  constructor(t) {
4871
4871
  super(t);
4872
4872
  /** {@link Updateable.onAfterUpdate} */
@@ -4892,7 +4892,7 @@ const gs = class gs extends et {
4892
4892
  I(this, "list", /* @__PURE__ */ new Map());
4893
4893
  /** {@link Component.enabled} */
4894
4894
  I(this, "enabled", !0);
4895
- t.add(gs.uuid, this);
4895
+ t.add(Os.uuid, this);
4896
4896
  }
4897
4897
  /**
4898
4898
  * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
@@ -4948,8 +4948,8 @@ const gs = class gs extends et {
4948
4948
  * A unique identifier for the component.
4949
4949
  * This UUID is used to register the component within the Components system.
4950
4950
  */
4951
- I(gs, "uuid", "fdb61dc4-2ec1-4966-b83d-54ea795fad4a");
4952
- let Ci = gs;
4951
+ I(Os, "uuid", "fdb61dc4-2ec1-4966-b83d-54ea795fad4a");
4952
+ let Ci = Os;
4953
4953
  class Nr {
4954
4954
  constructor(s, t, e) {
4955
4955
  /** {@link Disposable.onDisposed} */
@@ -4967,8 +4967,8 @@ class Nr {
4967
4967
  this.world = t;
4968
4968
  const { color: i, size1: o, size2: n, distance: r } = e;
4969
4969
  this.components = s;
4970
- const a = new g.PlaneGeometry(2, 2, 1, 1), c = new g.ShaderMaterial({
4971
- side: g.DoubleSide,
4970
+ const a = new O.PlaneGeometry(2, 2, 1, 1), c = new O.ShaderMaterial({
4971
+ side: O.DoubleSide,
4972
4972
  uniforms: {
4973
4973
  uSize1: {
4974
4974
  value: o
@@ -5057,7 +5057,7 @@ class Nr {
5057
5057
  derivatives: !0
5058
5058
  }
5059
5059
  });
5060
- this.three = new g.Mesh(a, c), this.three.frustumCulled = !1, t.scene.three.add(this.three), this.setupEvents(!0);
5060
+ this.three = new O.Mesh(a, c), this.three.frustumCulled = !1, t.scene.three.add(this.three), this.setupEvents(!0);
5061
5061
  }
5062
5062
  /** {@link Hideable.visible} */
5063
5063
  get visible() {
@@ -5107,7 +5107,7 @@ const _s = class _s extends et {
5107
5107
  * The default configuration for grid creation.
5108
5108
  */
5109
5109
  I(this, "config", {
5110
- color: new g.Color(12303291),
5110
+ color: new O.Color(12303291),
5111
5111
  size1: 1,
5112
5112
  size2: 10,
5113
5113
  distance: 500
@@ -5402,7 +5402,7 @@ class Ur extends ri {
5402
5402
  XZ: [
5403
5403
  [new v(new rt(0.15, 0.15, 0.01), c.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5404
5404
  ]
5405
- }, O = {
5405
+ }, g = {
5406
5406
  X: [
5407
5407
  [new v(new ct(0.2, 0, 0.6, 4), e), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
5408
5408
  [new v(new ct(0.2, 0, 0.6, 4), e), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
@@ -5557,7 +5557,7 @@ class Ur extends ri {
5557
5557
  }
5558
5558
  return H;
5559
5559
  }
5560
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), this.add(this.gizmo.rotate = x(S)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(O)), this.add(this.picker.rotate = x(L)), this.add(this.picker.scale = x(y)), this.add(this.helper.translate = x(_)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5560
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), this.add(this.gizmo.rotate = x(S)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(L)), this.add(this.picker.scale = x(y)), this.add(this.helper.translate = x(_)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5561
5561
  }
5562
5562
  // updateMatrixWorld will update transformations and appearance of individual handles
5563
5563
  updateMatrixWorld(s) {
@@ -5643,19 +5643,21 @@ class Pi {
5643
5643
  /**
5644
5644
  * The THREE.js Plane object representing the clipping plane.
5645
5645
  */
5646
- I(this, "three", new g.Plane());
5646
+ I(this, "three", new O.Plane());
5647
5647
  /** The components instance to which this plane belongs. */
5648
5648
  I(this, "components");
5649
5649
  /** The world instance to which this plane belongs. */
5650
5650
  I(this, "world");
5651
+ /** A custom string to identify what this plane is used for. */
5652
+ I(this, "type", "default");
5651
5653
  I(this, "_helper");
5652
5654
  I(this, "_visible", !0);
5653
5655
  I(this, "_enabled", !0);
5654
5656
  I(this, "_controlsActive", !1);
5655
- I(this, "_arrowBoundBox", new g.Mesh());
5657
+ I(this, "_arrowBoundBox", new O.Mesh());
5656
5658
  I(this, "_planeMesh");
5657
5659
  I(this, "_controls");
5658
- I(this, "_hiddenMaterial", new g.MeshBasicMaterial({
5660
+ I(this, "_hiddenMaterial", new O.MeshBasicMaterial({
5659
5661
  visible: !1
5660
5662
  }));
5661
5663
  /** {@link Updateable.update} */
@@ -5745,7 +5747,7 @@ class Pi {
5745
5747
  this._enabled = !1, this.onDraggingStarted.reset(), this.onDraggingEnded.reset(), this._helper.removeFromParent(), this.world.renderer && this.world.renderer.setPlane(!1, this.three), this._arrowBoundBox.removeFromParent(), this._arrowBoundBox.geometry.dispose(), this._planeMesh.geometry.dispose(), this._controls.removeFromParent(), this._controls.dispose(), this.onDisposed.trigger(), this.onDisposed.reset();
5746
5748
  }
5747
5749
  reset() {
5748
- const s = new g.Vector3(1, 0, 0), t = new g.Vector3();
5750
+ const s = new O.Vector3(1, 0, 0), t = new O.Vector3();
5749
5751
  this.normal.equals(s) || (this.normal.copy(s), this._helper.lookAt(s)), this.origin.copy(t), this._helper.position.copy(t), this._helper.updateMatrix();
5750
5752
  }
5751
5753
  toggleControls(s) {
@@ -5767,7 +5769,7 @@ class Pi {
5767
5769
  s.attach(this._helper), s.showX = !1, s.showY = !1, s.setSpace("local"), this.createArrowBoundingBox(), s.children[0].children[0].add(this._arrowBoundBox);
5768
5770
  }
5769
5771
  createArrowBoundingBox() {
5770
- this._arrowBoundBox.geometry = new g.CylinderGeometry(0.18, 0.18, 1.2), this._arrowBoundBox.material = this._hiddenMaterial, this._arrowBoundBox.rotateX(Math.PI / 2), this._arrowBoundBox.updateMatrix(), this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix);
5772
+ this._arrowBoundBox.geometry = new O.CylinderGeometry(0.18, 0.18, 1.2), this._arrowBoundBox.material = this._hiddenMaterial, this._arrowBoundBox.rotateX(Math.PI / 2), this._arrowBoundBox.updateMatrix(), this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix);
5771
5773
  }
5772
5774
  notifyDraggingChanged(s) {
5773
5775
  s.value ? this.onDraggingStarted.trigger() : this.onDraggingEnded.trigger();
@@ -5776,11 +5778,11 @@ class Pi {
5776
5778
  this.world.camera.enabled = this._visible;
5777
5779
  }
5778
5780
  newHelper() {
5779
- const s = new g.Object3D();
5781
+ const s = new O.Object3D();
5780
5782
  return s.lookAt(this.normal), s.position.copy(this.origin), this._planeMesh.position.z += 0.01, s.add(this._planeMesh), this.world.scene.three.add(s), s;
5781
5783
  }
5782
5784
  static newPlaneMesh(s, t) {
5783
- const e = new g.PlaneGeometry(1), i = new g.Mesh(e, t);
5785
+ const e = new O.PlaneGeometry(1), i = new O.Mesh(e, t);
5784
5786
  return i.scale.set(s, s, s), i;
5785
5787
  }
5786
5788
  }
@@ -5842,9 +5844,9 @@ const ve = class ve extends et {
5842
5844
  */
5843
5845
  I(this, "list", []);
5844
5846
  /** The material used in all the clipping planes. */
5845
- I(this, "_material", new g.MeshBasicMaterial({
5847
+ I(this, "_material", new O.MeshBasicMaterial({
5846
5848
  color: 12255487,
5847
- side: g.DoubleSide,
5849
+ side: O.DoubleSide,
5848
5850
  transparent: !0,
5849
5851
  opacity: 0.2
5850
5852
  }));
@@ -5910,7 +5912,7 @@ const ve = class ve extends et {
5910
5912
  /** {@link Createable.create} */
5911
5913
  create(t) {
5912
5914
  const o = this.components.get(ze).get(t).castRay();
5913
- o && this.createPlaneFromIntersection(t, o);
5915
+ return o ? this.createPlaneFromIntersection(t, o) : null;
5914
5916
  }
5915
5917
  /**
5916
5918
  * Creates a plane in a certain place and with a certain orientation,
@@ -5935,12 +5937,19 @@ const ve = class ve extends et {
5935
5937
  delete(t, e) {
5936
5938
  e || (e = this.pickPlane(t)), e && this.deletePlane(e);
5937
5939
  }
5938
- /** Deletes all the existing clipping planes. */
5939
- deleteAll() {
5940
- for (; this.list.length > 0; ) {
5941
- const t = this.list[0];
5942
- this.delete(t.world, t);
5943
- }
5940
+ /**
5941
+ * Deletes all the existing clipping planes.
5942
+ *
5943
+ * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
5944
+ */
5945
+ deleteAll(t) {
5946
+ const e = [...this.list];
5947
+ for (const i of e)
5948
+ if (!t || t.has(i.type)) {
5949
+ this.delete(i.world, i);
5950
+ const o = this.list.indexOf(i);
5951
+ o !== -1 && this.list.splice(o, 1);
5952
+ }
5944
5953
  }
5945
5954
  deletePlane(t) {
5946
5955
  const e = this.list.indexOf(t);
@@ -5967,20 +5976,20 @@ const ve = class ve extends et {
5967
5976
  var a;
5968
5977
  if (!t.renderer)
5969
5978
  throw new Error("The given world must have a renderer!");
5970
- const i = e.point.distanceTo(new g.Vector3(0, 0, 0)), o = (a = e.face) == null ? void 0 : a.normal;
5979
+ const i = e.point.distanceTo(new O.Vector3(0, 0, 0)), o = (a = e.face) == null ? void 0 : a.normal;
5971
5980
  if (!i || !o)
5972
- return;
5981
+ return null;
5973
5982
  const n = this.getWorldNormal(e, o), r = this.newPlane(t, e.point, n.negate());
5974
- r.visible = this._visible, r.size = this._size, t.renderer.setPlane(!0, r.three), this.updateMaterialsAndPlanes();
5983
+ return r.visible = this._visible, r.size = this._size, t.renderer.setPlane(!0, r.three), this.updateMaterialsAndPlanes(), r;
5975
5984
  }
5976
5985
  getWorldNormal(t, e) {
5977
5986
  const i = t.object;
5978
5987
  let o = t.object.matrixWorld.clone();
5979
- if (i instanceof g.InstancedMesh && t.instanceId !== void 0) {
5980
- const c = new g.Matrix4();
5988
+ if (i instanceof O.InstancedMesh && t.instanceId !== void 0) {
5989
+ const c = new O.Matrix4();
5981
5990
  i.getMatrixAt(t.instanceId, c), o = c.multiply(o);
5982
5991
  }
5983
- const r = new g.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
5992
+ const r = new O.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
5984
5993
  return this.normalizePlaneDirectionY(a), a;
5985
5994
  }
5986
5995
  normalizePlaneDirectionY(t) {
@@ -6077,7 +6086,7 @@ class Yr {
6077
6086
  I(this, "autoUpdate", !0);
6078
6087
  I(this, "updateInterval", 1e3);
6079
6088
  I(this, "worker");
6080
- I(this, "scene", new g.Scene());
6089
+ I(this, "scene", new O.Scene());
6081
6090
  I(this, "_width", 512);
6082
6091
  I(this, "_height", 512);
6083
6092
  I(this, "_availableColor", 1);
@@ -6114,7 +6123,7 @@ class Yr {
6114
6123
  });
6115
6124
  if (!t.renderer)
6116
6125
  throw new Error("The given world must have a renderer!");
6117
- this.components = s, this.applySettings(e), this.world = t, this.renderer = new g.WebGLRenderer(), this.renderTarget = new g.WebGLRenderTarget(this._width, this._height), this.bufferSize = this._width * this._height * 4, this._buffer = new Uint8Array(this.bufferSize), this.renderer.clippingPlanes = t.renderer.clippingPlanes;
6126
+ this.components = s, this.applySettings(e), this.world = t, this.renderer = new O.WebGLRenderer(), this.renderTarget = new O.WebGLRenderTarget(this._width, this._height), this.bufferSize = this._width * this._height * 4, this._buffer = new Uint8Array(this.bufferSize), this.renderer.clippingPlanes = t.renderer.clippingPlanes;
6118
6127
  const i = `
6119
6128
  addEventListener("message", (event) => {
6120
6129
  const { buffer } = event.data;
@@ -6199,7 +6208,7 @@ class Vr extends Yr {
6199
6208
  I(this, "_currentVisibleMeshes", /* @__PURE__ */ new Set());
6200
6209
  I(this, "_recentlyHiddenMeshes", /* @__PURE__ */ new Set());
6201
6210
  I(this, "_intervalID", null);
6202
- I(this, "_transparentMat", new g.MeshBasicMaterial({
6211
+ I(this, "_transparentMat", new O.MeshBasicMaterial({
6203
6212
  transparent: !0,
6204
6213
  opacity: 0
6205
6214
  }));
@@ -6251,7 +6260,7 @@ class Vr extends Yr {
6251
6260
  return;
6252
6261
  }
6253
6262
  this.isProcessing = !0;
6254
- const e = t instanceof g.InstancedMesh, { geometry: i, material: o } = t, { colorMaterial: n, code: r } = this.getAvailableMaterial();
6263
+ const e = t instanceof O.InstancedMesh, { geometry: i, material: o } = t, { colorMaterial: n, code: r } = this.getAvailableMaterial();
6255
6264
  let a;
6256
6265
  if (Array.isArray(o)) {
6257
6266
  let d = !0;
@@ -6269,8 +6278,8 @@ class Vr extends Yr {
6269
6278
  } else
6270
6279
  a = n;
6271
6280
  this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
6272
- const c = e ? t.count : 1, h = new g.InstancedMesh(i, a, c);
6273
- e ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new g.Matrix4()), t.visible = !1, t.updateWorldMatrix(!0, !1), h.applyMatrix4(t.matrixWorld), h.updateMatrix(), this.scene.add(h), this.colorMeshes.set(t.uuid, h), this.increaseColor(), this.isProcessing = !1;
6281
+ const c = e ? t.count : 1, h = new O.InstancedMesh(i, a, c);
6282
+ e ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new O.Matrix4()), t.visible = !1, t.updateWorldMatrix(!0, !1), h.applyMatrix4(t.matrixWorld), h.updateMatrix(), this.scene.add(h), this.colorMeshes.set(t.uuid, h), this.increaseColor(), this.isProcessing = !1;
6274
6283
  }
6275
6284
  /**
6276
6285
  * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
@@ -6288,23 +6297,23 @@ class Vr extends Yr {
6288
6297
  this._currentVisibleMeshes.delete(t), this._recentlyHiddenMeshes.delete(t);
6289
6298
  const i = this.colorMeshes.get(t.uuid), o = this._meshIDColorCodeMap.get(t.uuid);
6290
6299
  if (!i || !o) {
6291
- this.isProcessing = !1, console.log(t.visible);
6300
+ this.isProcessing = !1;
6292
6301
  return;
6293
6302
  }
6294
6303
  this._colorCodeMeshMap.delete(o), this._meshIDColorCodeMap.delete(t.uuid), this.colorMeshes.delete(t.uuid), i.geometry = void 0, i.material = [], e.destroy(i, !0), this._recentlyHiddenMeshes.delete(t), this._currentVisibleMeshes.delete(t), this.isProcessing = !1;
6295
6304
  }
6296
6305
  getAvailableMaterial() {
6297
- const { r: t, g: e, b: i, code: o } = this.getAvailableColor(), n = g.ColorManagement.enabled;
6298
- g.ColorManagement.enabled = !1;
6299
- const r = new g.Color(`rgb(${t}, ${e}, ${i})`);
6306
+ const { r: t, g: e, b: i, code: o } = this.getAvailableColor(), n = O.ColorManagement.enabled;
6307
+ O.ColorManagement.enabled = !1;
6308
+ const r = new O.Color(`rgb(${t}, ${e}, ${i})`);
6300
6309
  if (!this.world.renderer)
6301
6310
  throw new Error("Renderer not found in the world!");
6302
- const a = this.world.renderer.clippingPlanes, c = new g.MeshBasicMaterial({
6311
+ const a = this.world.renderer.clippingPlanes, c = new O.MeshBasicMaterial({
6303
6312
  color: r,
6304
6313
  clippingPlanes: a,
6305
- side: g.DoubleSide
6314
+ side: O.DoubleSide
6306
6315
  });
6307
- return g.ColorManagement.enabled = n, { colorMaterial: c, code: o };
6316
+ return O.ColorManagement.enabled = n, { colorMaterial: c, code: o };
6308
6317
  }
6309
6318
  }
6310
6319
  const Be = class Be extends et {
@@ -6392,12 +6401,12 @@ class Gr {
6392
6401
  * The override material for the minimap.
6393
6402
  * It is used to render the depth information of the world onto the minimap.
6394
6403
  */
6395
- I(this, "overrideMaterial", new g.MeshDepthMaterial());
6404
+ I(this, "overrideMaterial", new O.MeshDepthMaterial());
6396
6405
  /**
6397
6406
  * The background color of the minimap.
6398
6407
  * It is used to set the background color of the minimap's renderer.
6399
6408
  */
6400
- I(this, "backgroundColor", new g.Color(395274));
6409
+ I(this, "backgroundColor", new O.Color(395274));
6401
6410
  /**
6402
6411
  * The WebGL renderer for the minimap.
6403
6412
  * It is used to render the minimap onto the screen.
@@ -6416,11 +6425,11 @@ class Gr {
6416
6425
  I(this, "_lockRotation", !0);
6417
6426
  I(this, "_camera");
6418
6427
  I(this, "_plane");
6419
- I(this, "_size", new g.Vector2(320, 160));
6420
- I(this, "_tempVector1", new g.Vector3());
6421
- I(this, "_tempVector2", new g.Vector3());
6422
- I(this, "_tempTarget", new g.Vector3());
6423
- I(this, "down", new g.Vector3(0, -1, 0));
6428
+ I(this, "_size", new O.Vector2(320, 160));
6429
+ I(this, "_tempVector1", new O.Vector3());
6430
+ I(this, "_tempVector2", new O.Vector3());
6431
+ I(this, "_tempTarget", new O.Vector3());
6432
+ I(this, "down", new O.Vector3(0, -1, 0));
6424
6433
  I(this, "updatePlanes", () => {
6425
6434
  if (!this.world.renderer)
6426
6435
  throw new Error("The given world must have a renderer!");
@@ -6431,14 +6440,14 @@ class Gr {
6431
6440
  });
6432
6441
  if (this.world = s, !this.world.renderer)
6433
6442
  throw new Error("The given world must have a renderer!");
6434
- this.renderer = new g.WebGLRenderer(), this.renderer.setSize(this._size.x, this._size.y);
6443
+ this.renderer = new O.WebGLRenderer(), this.renderer.setSize(this._size.x, this._size.y);
6435
6444
  const t = 1, e = this._size.x / this._size.y;
6436
- this._camera = new g.OrthographicCamera(
6445
+ this._camera = new O.OrthographicCamera(
6437
6446
  t * e / -2,
6438
6447
  t * e / 2,
6439
6448
  t / 2,
6440
6449
  t / -2
6441
- ), this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes), this._camera.position.set(0, 200, 0), this._camera.zoom = 0.1, this._camera.rotation.x = -Math.PI / 2, this._plane = new g.Plane(this.down, 200), this.updatePlanes();
6450
+ ), this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes), this._camera.position.set(0, 200, 0), this._camera.zoom = 0.1, this._camera.rotation.x = -Math.PI / 2, this._plane = new O.Plane(this.down, 200), this.updatePlanes();
6442
6451
  }
6443
6452
  /**
6444
6453
  * Gets or sets whether the minimap rotation is locked.
@@ -6487,7 +6496,7 @@ class Gr {
6487
6496
  const s = this.world.scene.three, t = this.world.camera;
6488
6497
  if (!t.hasCameraControls())
6489
6498
  throw new Error("The given world must use camera controls!");
6490
- if (!(s instanceof g.Scene))
6499
+ if (!(s instanceof O.Scene))
6491
6500
  throw new Error("The given world must have a THREE.Scene as a root!");
6492
6501
  const e = t.controls;
6493
6502
  if (e.getPosition(this._tempVector1), this._camera.position.x = this._tempVector1.x, this._camera.position.z = this._tempVector1.z, this.frontOffset !== 0 && (e.getTarget(this._tempVector2), this._tempVector2.sub(this._tempVector1), this._tempVector2.normalize().multiplyScalar(this.frontOffset), this._camera.position.x += this._tempVector2.x, this._camera.position.z += this._tempVector2.z), !this._lockRotation) {
@@ -6592,7 +6601,7 @@ class zr {
6592
6601
  }
6593
6602
  }
6594
6603
  setupFirstPersonCamera() {
6595
- const s = this.camera.controls, t = new g.Vector3();
6604
+ const s = this.camera.controls, t = new O.Vector3();
6596
6605
  s.distance--, s.getPosition(t), s.minDistance = 1, s.maxDistance = 1, s.distance = 1, s.moveTo(
6597
6606
  t.x,
6598
6607
  t.y,
@@ -6615,11 +6624,11 @@ class Hr {
6615
6624
  activateOrbitControls() {
6616
6625
  const s = this.camera.controls;
6617
6626
  s.minDistance = 1, s.maxDistance = 300;
6618
- const t = new g.Vector3();
6627
+ const t = new O.Vector3();
6619
6628
  s.getPosition(t);
6620
6629
  const e = t.length();
6621
6630
  s.distance = e, s.truckSpeed = 2;
6622
- const { rotation: i } = this.camera.three, o = new g.Vector3(0, 0, -1).applyEuler(i), n = t.addScaledVector(o, e);
6631
+ const { rotation: i } = this.camera.three, o = new O.Vector3(0, 0, -1).applyEuler(i), n = t.addScaledVector(o, e);
6623
6632
  s.moveTo(n.x, n.y, n.z);
6624
6633
  }
6625
6634
  }
@@ -6696,9 +6705,9 @@ class Wr {
6696
6705
  const s = this._component.currentWorld;
6697
6706
  if (!s || !s.renderer)
6698
6707
  return null;
6699
- const t = new g.Vector3();
6708
+ const t = new O.Vector3();
6700
6709
  this._component.threePersp.getWorldDirection(t);
6701
- const e = new g.Vector3();
6710
+ const e = new O.Vector3();
6702
6711
  this._component.controls.getTarget(e);
6703
6712
  const o = e.clone().sub(this._component.threePersp.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.threePersp, c = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
6704
6713
  return { width: c * r, height: c };
@@ -6789,16 +6798,16 @@ class na extends He {
6789
6798
  async fit(t, e = 1.5) {
6790
6799
  if (!this.enabled)
6791
6800
  return;
6792
- const i = Number.MAX_VALUE, o = Number.MIN_VALUE, n = new g.Vector3(i, i, i), r = new g.Vector3(o, o, o);
6801
+ const i = Number.MAX_VALUE, o = Number.MIN_VALUE, n = new O.Vector3(i, i, i), r = new O.Vector3(o, o, o);
6793
6802
  for (const u of t) {
6794
- const f = new g.Box3().setFromObject(u);
6803
+ const f = new O.Box3().setFromObject(u);
6795
6804
  f.min.x < n.x && (n.x = f.min.x), f.min.y < n.y && (n.y = f.min.y), f.min.z < n.z && (n.z = f.min.z), f.max.x > r.x && (r.x = f.max.x), f.max.y > r.y && (r.y = f.max.y), f.max.z > r.z && (r.z = f.max.z);
6796
6805
  }
6797
- const a = new g.Box3(n, r), c = new g.Vector3();
6806
+ const a = new O.Box3(n, r), c = new O.Vector3();
6798
6807
  a.getSize(c);
6799
- const h = new g.Vector3();
6808
+ const h = new O.Vector3();
6800
6809
  a.getCenter(h);
6801
- const d = Math.max(c.x, c.y, c.z) * e, E = new g.Sphere(h, d);
6810
+ const d = Math.max(c.x, c.y, c.z) * e, E = new O.Sphere(h, d);
6802
6811
  await this.controls.fitToSphere(E, !0);
6803
6812
  }
6804
6813
  /**
@@ -6817,7 +6826,7 @@ class na extends He {
6817
6826
  }
6818
6827
  newOrthoCamera() {
6819
6828
  const t = window.innerWidth / window.innerHeight;
6820
- return new g.OrthographicCamera(
6829
+ return new O.OrthographicCamera(
6821
6830
  this._frustumSize * t / -2,
6822
6831
  this._frustumSize * t / 2,
6823
6832
  this._frustumSize / 2,
@@ -7145,6 +7154,30 @@ const Xr = /* @__PURE__ */ new Map([
7145
7154
  dispose() {
7146
7155
  this.relationMaps = {}, this.components.get(ht).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ye.uuid), this.onDisposed.reset();
7147
7156
  }
7157
+ /**
7158
+ * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
7159
+ *
7160
+ * @param model The BIM model whose children to get.
7161
+ * @param id The expressID of the item whose children to get.
7162
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
7163
+ *
7164
+ * @returns A `Set` with the expressIDs of the found items.
7165
+ */
7166
+ getElementsChildren(t, e, i = /* @__PURE__ */ new Set()) {
7167
+ if (i.add(e), this.relationMaps[t.uuid] === void 0)
7168
+ throw new Error(
7169
+ "The provided model has no indices. You have to generate them first."
7170
+ );
7171
+ const n = this.getEntityRelations(t, e, "IsDecomposedBy");
7172
+ if (n)
7173
+ for (const a of n)
7174
+ this.getElementsChildren(t, a, i);
7175
+ const r = this.getEntityRelations(t, e, "ContainsElements");
7176
+ if (r)
7177
+ for (const a of r)
7178
+ this.getElementsChildren(t, a, i);
7179
+ return i;
7180
+ }
7148
7181
  };
7149
7182
  /**
7150
7183
  * A unique identifier for the component.
@@ -7331,7 +7364,7 @@ const At = class At extends et {
7331
7364
  * @returns An object containing the width, height, depth, and center of the bounding box.
7332
7365
  */
7333
7366
  static getDimensions(t) {
7334
- const { min: e, max: i } = t, o = Math.abs(i.x - e.x), n = Math.abs(i.y - e.y), r = Math.abs(i.z - e.z), a = new g.Vector3();
7367
+ const { min: e, max: i } = t, o = Math.abs(i.x - e.x), n = Math.abs(i.y - e.y), r = Math.abs(i.z - e.z), a = new O.Vector3();
7335
7368
  return a.subVectors(i, e).divideScalar(2).add(e), { width: o, height: n, depth: r, center: a };
7336
7369
  }
7337
7370
  /**
@@ -7356,7 +7389,7 @@ const At = class At extends et {
7356
7389
  */
7357
7390
  static newBound(t) {
7358
7391
  const e = t ? 1 : -1;
7359
- return new g.Vector3(
7392
+ return new O.Vector3(
7360
7393
  e * Number.MAX_VALUE,
7361
7394
  e * Number.MAX_VALUE,
7362
7395
  e * Number.MAX_VALUE
@@ -7390,7 +7423,7 @@ const At = class At extends et {
7390
7423
  const o = i || this.newBound(!1), n = e || this.newBound(!0);
7391
7424
  for (const r of t)
7392
7425
  r.x < n.x && (n.x = r.x), r.y < n.y && (n.y = r.y), r.z < n.z && (n.z = r.z), r.x > o.x && (o.x = r.x), r.y > o.y && (o.y = r.y), r.z > o.z && (o.z = r.z);
7393
- return new g.Box3(e, i);
7426
+ return new O.Box3(e, i);
7394
7427
  }
7395
7428
  /** {@link Disposable.dispose} */
7396
7429
  dispose() {
@@ -7416,7 +7449,7 @@ const At = class At extends et {
7416
7449
  */
7417
7450
  get() {
7418
7451
  const t = this._absoluteMin.clone(), e = this._absoluteMax.clone();
7419
- return new g.Box3(t, e);
7452
+ return new O.Box3(t, e);
7420
7453
  }
7421
7454
  /**
7422
7455
  * Calculates and returns a sphere that encompasses the entire bounding box.
@@ -7437,8 +7470,8 @@ const At = class At extends et {
7437
7470
  * ```
7438
7471
  */
7439
7472
  getSphere() {
7440
- const t = this._absoluteMin.clone(), e = this._absoluteMax.clone(), i = Math.abs((e.x - t.x) / 2), o = Math.abs((e.y - t.y) / 2), n = Math.abs((e.z - t.z) / 2), r = new g.Vector3(t.x + i, t.y + o, t.z + n), a = r.distanceTo(t);
7441
- return new g.Sphere(r, a);
7473
+ const t = this._absoluteMin.clone(), e = this._absoluteMax.clone(), i = Math.abs((e.x - t.x) / 2), o = Math.abs((e.y - t.y) / 2), n = Math.abs((e.z - t.z) / 2), r = new O.Vector3(t.x + i, t.y + o, t.z + n), a = r.distanceTo(t);
7474
+ return new O.Sphere(r, a);
7442
7475
  }
7443
7476
  /**
7444
7477
  * Returns a THREE.Mesh instance representing the bounding box.
@@ -7460,7 +7493,7 @@ const At = class At extends et {
7460
7493
  * ```
7461
7494
  */
7462
7495
  getMesh() {
7463
- const t = new g.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new g.BoxGeometry(i, o, n), c = new g.Mesh(a);
7496
+ const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n), c = new O.Mesh(a);
7464
7497
  return this._meshes.push(c), c.position.copy(r), c;
7465
7498
  }
7466
7499
  /**
@@ -7523,7 +7556,7 @@ const At = class At extends et {
7523
7556
  return;
7524
7557
  const i = At.getFragmentBounds(t);
7525
7558
  t.updateMatrixWorld();
7526
- const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
7559
+ const o = t.matrixWorld, n = new O.Matrix4(), r = t instanceof O.InstancedMesh, a = /* @__PURE__ */ new Set();
7527
7560
  if (e && t instanceof Vt.FragmentMesh)
7528
7561
  for (const c of e) {
7529
7562
  const h = t.fragment.getInstancesIDs(c);
@@ -7571,7 +7604,7 @@ const At = class At extends et {
7571
7604
  }
7572
7605
  }
7573
7606
  static getFragmentBounds(t) {
7574
- const e = t.geometry.attributes.position, i = Number.MAX_VALUE, o = -i, n = new g.Vector3(i, i, i), r = new g.Vector3(o, o, o);
7607
+ const e = t.geometry.attributes.position, i = Number.MAX_VALUE, o = -i, n = new O.Vector3(i, i, i), r = new O.Vector3(o, o, o);
7575
7608
  if (!t.geometry.index)
7576
7609
  throw new Error("Geometry must be indexed!");
7577
7610
  const a = Array.from(t.geometry.index.array);
@@ -7583,7 +7616,7 @@ const At = class At extends et {
7583
7616
  const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
7584
7617
  d < n.x && (n.x = d), E < n.y && (n.y = E), u < n.z && (n.z = u), d > r.x && (r.x = d), E > r.y && (r.y = E), u > r.z && (r.z = u);
7585
7618
  }
7586
- return new g.Box3(n, r);
7619
+ return new O.Box3(n, r);
7587
7620
  }
7588
7621
  };
7589
7622
  I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
@@ -9229,7 +9262,7 @@ class Qr {
9229
9262
  }
9230
9263
  getScaleMatrix() {
9231
9264
  const s = this.factor;
9232
- return new g.Matrix4().fromArray([
9265
+ return new O.Matrix4().fromArray([
9233
9266
  s,
9234
9267
  0,
9235
9268
  0,
@@ -9365,7 +9398,7 @@ class Li {
9365
9398
  }
9366
9399
  class Vn {
9367
9400
  constructor() {
9368
- I(this, "defLineMat", new g.LineBasicMaterial({ color: 16777215 }));
9401
+ I(this, "defLineMat", new O.LineBasicMaterial({ color: 16777215 }));
9369
9402
  }
9370
9403
  read(s) {
9371
9404
  const t = s.GetAllAlignments(0), e = s.GetAllCrossSections2D(0), i = s.GetAllCrossSections3D(0), o = {
@@ -9382,7 +9415,7 @@ class Vn {
9382
9415
  const i = new Vt.Alignment();
9383
9416
  i.absolute = this.getCurves(e.curve3D, i), i.horizontal = this.getCurves(e.horizontal, i), i.vertical = this.getCurves(e.vertical, i), t.set(t.size, i);
9384
9417
  }
9385
- return { alignments: t, coordinationMatrix: new g.Matrix4() };
9418
+ return { alignments: t, coordinationMatrix: new O.Matrix4() };
9386
9419
  }
9387
9420
  }
9388
9421
  getCurves(s, t) {
@@ -9400,7 +9433,7 @@ class Vn {
9400
9433
  const { x: u, y: f, z: R } = r[E];
9401
9434
  a[E * 3] = u, a[E * 3 + 1] = f, a[E * 3 + 2] = R || 0;
9402
9435
  }
9403
- const c = new g.BufferAttribute(a, 3), h = new g.EdgesGeometry();
9436
+ const c = new O.BufferAttribute(a, 3), h = new O.EdgesGeometry();
9404
9437
  h.setAttribute("position", c);
9405
9438
  const d = new Vt.CurveMesh(
9406
9439
  i,
@@ -9473,13 +9506,13 @@ const Ve = class Ve extends et {
9473
9506
  I(this, "webIfc", new b.IfcAPI());
9474
9507
  /** {@link Component.enabled} */
9475
9508
  I(this, "enabled", !0);
9476
- I(this, "_material", new g.MeshLambertMaterial());
9509
+ I(this, "_material", new O.MeshLambertMaterial());
9477
9510
  I(this, "_spatialTree", new Yn());
9478
9511
  I(this, "_metaData", new Gn());
9479
9512
  I(this, "_fragmentInstances", /* @__PURE__ */ new Map());
9480
9513
  I(this, "_civil", new Vn());
9481
9514
  I(this, "_visitedFragments", /* @__PURE__ */ new Map());
9482
- I(this, "_materialT", new g.MeshLambertMaterial({
9515
+ I(this, "_materialT", new O.MeshLambertMaterial({
9483
9516
  transparent: !0,
9484
9517
  opacity: 0.5
9485
9518
  }));
@@ -9487,7 +9520,7 @@ const Ve = class Ve extends et {
9487
9520
  }
9488
9521
  /** {@link Disposable.dispose} */
9489
9522
  dispose() {
9490
- this.webIfc = null, this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
9523
+ this.webIfc.Dispose(), this.webIfc = null, this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
9491
9524
  }
9492
9525
  /**
9493
9526
  * Sets up the IfcLoader component with the provided configuration.
@@ -9578,7 +9611,7 @@ const Ve = class Ve extends et {
9578
9611
  * ```
9579
9612
  */
9580
9613
  cleanUp() {
9581
- this.webIfc = null, this.webIfc = new b.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
9614
+ this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new b.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
9582
9615
  }
9583
9616
  async getAllGeometries() {
9584
9617
  this._spatialTree.setUp(this.webIfc);
@@ -9627,12 +9660,12 @@ const Ve = class Ve extends et {
9627
9660
  for (let n = 0; n < i; n++) {
9628
9661
  const r = t.geometries.get(n), { x: a, y: c, z: h, w: d } = r.color, E = d !== 1, { geometryExpressID: u } = r, f = `${u}-${E}`;
9629
9662
  if (!this._visitedFragments.has(f)) {
9630
- const T = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, _ = new Vt.Fragment(T, O, 1);
9663
+ const T = this.getGeometry(this.webIfc, u), g = E ? this._materialT : this._material, _ = new Vt.Fragment(T, g, 1);
9631
9664
  e.add(_.mesh), e.items.push(_);
9632
9665
  const S = this._visitedFragments.size;
9633
9666
  this._visitedFragments.set(f, { index: S, fragment: _ });
9634
9667
  }
9635
- const R = new g.Color().setRGB(a, c, h, "srgb"), m = new g.Matrix4();
9668
+ const R = new O.Color().setRGB(a, c, h, "srgb"), m = new O.Matrix4();
9636
9669
  m.fromArray(r.flatTransformation);
9637
9670
  const C = this._visitedFragments.get(f);
9638
9671
  if (C === void 0)
@@ -9665,7 +9698,7 @@ const Ve = class Ve extends et {
9665
9698
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
9666
9699
  for (let E = 0; E < n.length; E += 6)
9667
9700
  r[E / 2] = n[E], r[E / 2 + 1] = n[E + 1], r[E / 2 + 2] = n[E + 2], a[E / 2] = n[E + 3], a[E / 2 + 1] = n[E + 4], a[E / 2 + 2] = n[E + 5];
9668
- const c = new g.BufferGeometry(), h = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
9701
+ const c = new O.BufferGeometry(), h = new O.BufferAttribute(r, 3), d = new O.BufferAttribute(a, 3);
9669
9702
  return c.setAttribute("position", h), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
9670
9703
  }
9671
9704
  async autoSetWasm() {
@@ -10048,7 +10081,7 @@ const Bt = class Bt extends et {
10048
10081
  * This UUID is used to register the component within the Components system.
10049
10082
  */
10050
10083
  I(Bt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
10051
- let On = Bt;
10084
+ let gn = Bt;
10052
10085
  const Ls = class Ls extends et {
10053
10086
  constructor(t) {
10054
10087
  super(t);
@@ -10071,7 +10104,7 @@ const Ls = class Ls extends et {
10071
10104
  for (const a of r) {
10072
10105
  const c = n[a];
10073
10106
  for (const h of i)
10074
- delete c[h];
10107
+ delete c.map[h];
10075
10108
  Object.values(c).length === 0 && delete n[a];
10076
10109
  }
10077
10110
  }
@@ -10093,7 +10126,7 @@ const Ls = class Ls extends et {
10093
10126
  const i = this.list[e];
10094
10127
  for (const o in i) {
10095
10128
  const n = i[o];
10096
- delete n[t];
10129
+ delete n.map[t];
10097
10130
  }
10098
10131
  }
10099
10132
  }
@@ -10128,9 +10161,9 @@ const Ls = class Ls extends et {
10128
10161
  for (const c of a) {
10129
10162
  const h = this.list[r][c];
10130
10163
  if (h)
10131
- for (const d in h) {
10164
+ for (const d in h.map) {
10132
10165
  o[d] || (o[d] = /* @__PURE__ */ new Map());
10133
- for (const E of h[d]) {
10166
+ for (const E of h.map[d]) {
10134
10167
  const u = o[d].get(E);
10135
10168
  u === void 0 ? o[d].set(E, 1) : o[d].set(E, u + 1);
10136
10169
  }
@@ -10164,13 +10197,13 @@ const Ls = class Ls extends et {
10164
10197
  byModel(t, e) {
10165
10198
  this.list.models || (this.list.models = {});
10166
10199
  const i = this.list.models;
10167
- i[t] || (i[t] = {});
10200
+ i[t] || (i[t] = { map: {}, id: null, name: t });
10168
10201
  const o = i[t];
10169
10202
  for (const [n, r] of e.data) {
10170
10203
  const a = r[0];
10171
10204
  for (const c of a) {
10172
10205
  const h = e.keyFragments.get(c);
10173
- h && (o[h] || (o[h] = /* @__PURE__ */ new Set()), o[h].add(n));
10206
+ h && (o.map[h] || (o.map[h] = /* @__PURE__ */ new Set()), o.map[h].add(n));
10174
10207
  }
10175
10208
  }
10176
10209
  }
@@ -10196,7 +10229,11 @@ const Ls = class Ls extends et {
10196
10229
  if (!r)
10197
10230
  continue;
10198
10231
  const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
10199
- e[a] || (e[a] = {});
10232
+ e[a] || (e[a] = {
10233
+ map: {},
10234
+ id: null,
10235
+ name: a
10236
+ });
10200
10237
  const c = e[a];
10201
10238
  for (const [h, d] of t.data) {
10202
10239
  const E = d[0];
@@ -10204,7 +10241,7 @@ const Ls = class Ls extends et {
10204
10241
  const f = t.keyFragments.get(u);
10205
10242
  if (!f)
10206
10243
  throw new Error("Fragment ID not found!");
10207
- c[f] || (c[f] = /* @__PURE__ */ new Set()), c[f].add(r.expressID);
10244
+ c.map[f] || (c.map[f] = /* @__PURE__ */ new Set()), c.map[f].add(r.expressID);
10208
10245
  }
10209
10246
  }
10210
10247
  }
@@ -10267,6 +10304,7 @@ const Ls = class Ls extends et {
10267
10304
  * Classifies fragments based on their spatial structure in the IFC model.
10268
10305
  *
10269
10306
  * @param model - The FragmentsGroup containing the fragments to be classified.
10307
+ * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
10270
10308
  *
10271
10309
  * @remarks
10272
10310
  * This method iterates through the relations of the fragments in the provided group,
@@ -10276,49 +10314,55 @@ const Ls = class Ls extends et {
10276
10314
  *
10277
10315
  * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
10278
10316
  */
10279
- async bySpatialStructure(t) {
10280
- var n, r;
10281
- const e = this.components.get(ke), i = e.relationMaps[t.uuid];
10282
- if (!i)
10317
+ async bySpatialStructure(t, e = { useProperties: !0 }) {
10318
+ var r, a;
10319
+ const i = this.components.get(ke), o = i.relationMaps[t.uuid];
10320
+ if (!o)
10283
10321
  throw new Error(
10284
10322
  `Classifier: model relations of ${t.name || t.uuid} have to exists to group by spatial structure.`
10285
10323
  );
10286
- const o = "spatialStructures";
10287
- for (const [a] of i) {
10288
- const c = e.getEntityRelations(
10324
+ const n = "spatialStructures";
10325
+ for (const [c] of o) {
10326
+ const h = i.getEntityRelations(
10289
10327
  t,
10290
- a,
10328
+ c,
10291
10329
  "Decomposes"
10292
10330
  );
10293
- if (c)
10294
- for (const u of c) {
10295
- const f = await t.getProperties(u);
10296
- if (!f)
10297
- continue;
10298
- const R = (n = f.Name) == null ? void 0 : n.value;
10299
- this.saveItem(t, o, R, a);
10331
+ if (h)
10332
+ for (const u of h) {
10333
+ let f = u.toString();
10334
+ if (e.useProperties) {
10335
+ const R = await t.getProperties(u);
10336
+ if (!R)
10337
+ continue;
10338
+ f = (r = R.Name) == null ? void 0 : r.value;
10339
+ }
10340
+ this.saveItem(t, n, f, c, u);
10300
10341
  }
10301
- const h = e.getEntityRelations(
10342
+ const d = i.getEntityRelations(
10302
10343
  t,
10303
- a,
10344
+ c,
10304
10345
  "ContainsElements"
10305
10346
  );
10306
- if (!h)
10307
- continue;
10308
- const d = await t.getProperties(a);
10309
10347
  if (!d)
10310
10348
  continue;
10311
- const E = (r = d.Name) == null ? void 0 : r.value;
10312
- for (const u of h) {
10313
- this.saveItem(t, o, E, u);
10314
- const f = e.getEntityRelations(
10349
+ let E = c.toString();
10350
+ if (e.useProperties) {
10351
+ const u = await t.getProperties(c);
10352
+ if (!u)
10353
+ continue;
10354
+ E = (a = u.Name) == null ? void 0 : a.value;
10355
+ }
10356
+ for (const u of d) {
10357
+ this.saveItem(t, n, E, u, c);
10358
+ const f = i.getEntityRelations(
10315
10359
  t,
10316
10360
  Number(u),
10317
10361
  "IsDecomposedBy"
10318
10362
  );
10319
10363
  if (f)
10320
10364
  for (const R of f)
10321
- this.saveItem(t, o, E, R);
10365
+ this.saveItem(t, n, E, R, c);
10322
10366
  }
10323
10367
  }
10324
10368
  }
@@ -10366,15 +10410,15 @@ const Ls = class Ls extends et {
10366
10410
  o.resetColor(n);
10367
10411
  }
10368
10412
  }
10369
- saveItem(t, e, i, o) {
10413
+ saveItem(t, e, i, o, n = null) {
10370
10414
  this.list[e] || (this.list[e] = {});
10371
- const n = t.data.get(o);
10372
- if (n)
10373
- for (const r of n[0]) {
10374
- const a = t.keyFragments.get(r);
10375
- if (a) {
10376
- const c = this.list[e];
10377
- c[i] || (c[i] = {}), c[i][a] || (c[i][a] = /* @__PURE__ */ new Set()), c[i][a].add(o);
10415
+ const r = t.data.get(o);
10416
+ if (r)
10417
+ for (const a of r[0]) {
10418
+ const c = t.keyFragments.get(a);
10419
+ if (c) {
10420
+ const h = this.list[e];
10421
+ h[i] || (h[i] = { map: {}, id: n, name: i }), h[i].map[c] || (h[i].map[c] = /* @__PURE__ */ new Set()), h[i].map[c].add(o);
10378
10422
  }
10379
10423
  }
10380
10424
  }
@@ -10434,16 +10478,16 @@ const ys = class ys extends et {
10434
10478
  return;
10435
10479
  const e = this.components.get(Ai), i = this.components.get(ht), o = t ? 1 : -1;
10436
10480
  let n = 0;
10437
- const r = e.list[this.groupName], a = new g.Matrix4();
10481
+ const r = e.list[this.groupName], a = new O.Matrix4();
10438
10482
  for (const c in r) {
10439
10483
  a.elements[13] = n * o * this.height;
10440
- for (const h in r[c]) {
10484
+ for (const h in r[c].map) {
10441
10485
  const d = i.list.get(h), E = c + h, u = this.list.has(E);
10442
10486
  if (!d || t && u || !t && !u)
10443
10487
  continue;
10444
10488
  t ? this.list.add(E) : this.list.delete(E);
10445
- const f = r[c][h];
10446
- d.applyTransform(f, a);
10489
+ const f = r[c].map[h];
10490
+ d.applyTransform(f, a), d.mesh.computeBoundingSphere(), d.mesh.computeBoundingBox();
10447
10491
  }
10448
10492
  n++;
10449
10493
  }
@@ -10454,7 +10498,7 @@ const ys = class ys extends et {
10454
10498
  * This UUID is used to register the component within the Components system.
10455
10499
  */
10456
10500
  I(ys, "uuid", "d260618b-ce88-4c7d-826c-6debb91de3e2");
10457
- let gn = ys;
10501
+ let On = ys;
10458
10502
  const Ms = class Ms extends et {
10459
10503
  constructor(t) {
10460
10504
  super(t);
@@ -10575,7 +10619,7 @@ const ws = class ws extends et {
10575
10619
  }
10576
10620
  /** {@link Disposable.dispose} */
10577
10621
  dispose() {
10578
- this.onIfcLoaded.reset(), this.onGeometryStreamed.reset(), this.onAssetStreamed.reset(), this.webIfc = null, this.onDisposed.trigger(), this.onDisposed.reset();
10622
+ this.onIfcLoaded.reset(), this.onGeometryStreamed.reset(), this.onAssetStreamed.reset(), this.webIfc.Dispose(), this.webIfc = null, this.onDisposed.trigger(), this.onDisposed.reset();
10579
10623
  }
10580
10624
  /**
10581
10625
  * This method streams the IFC file from a given buffer.
@@ -10644,8 +10688,8 @@ const ws = class ws extends et {
10644
10688
  const _ = (T == null ? void 0 : T.GlobalId.value) || (T == null ? void 0 : T.GlobalId);
10645
10689
  n.globalToExpressIDs.set(_, p);
10646
10690
  }
10647
- const O = this._spatialTree.itemsByFloor[p] || 0;
10648
- n.data.set(p, [[], [O, m]]), r++;
10691
+ const g = this._spatialTree.itemsByFloor[p] || 0;
10692
+ n.data.set(p, [[], [g, m]]), r++;
10649
10693
  }
10650
10694
  }
10651
10695
  this._spatialTree.cleanUp();
@@ -10672,7 +10716,7 @@ const ws = class ws extends et {
10672
10716
  this.onIfcLoaded.trigger(R), n.dispose(!0);
10673
10717
  }
10674
10718
  cleanUp() {
10675
- this.webIfc = null, this.webIfc = new b.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
10719
+ this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new b.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
10676
10720
  }
10677
10721
  getMesh(t, e, i) {
10678
10722
  const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
@@ -10680,8 +10724,8 @@ const ws = class ws extends et {
10680
10724
  const c = e.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
10681
10725
  if (!this._visitedGeometries.has(E)) {
10682
10726
  this._visitedGeometries.has(h) || this.getGeometry(t, h);
10683
- const T = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
10684
- this._visitedGeometries.set(E, { uuid: O, index: T });
10727
+ const T = this._visitedGeometries.size, g = O.MathUtils.generateUUID();
10728
+ this._visitedGeometries.set(E, { uuid: g, index: T });
10685
10729
  }
10686
10730
  const u = this._visitedGeometries.get(E);
10687
10731
  if (u === void 0)
@@ -10781,7 +10825,7 @@ class Kr extends et {
10781
10825
  }
10782
10826
  /** {@link Disposable.dispose} */
10783
10827
  async dispose() {
10784
- this.onIndicesStreamed.reset(), this.onPropertiesStreamed.reset(), this.webIfc = null, this.onDisposed.reset();
10828
+ this.onIndicesStreamed.reset(), this.onPropertiesStreamed.reset(), this.webIfc.Dispose(), this.webIfc = null, this.onDisposed.reset();
10785
10829
  }
10786
10830
  /**
10787
10831
  * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
@@ -10852,14 +10896,14 @@ class Kr extends et {
10852
10896
  }
10853
10897
  await this.onPropertiesStreamed.trigger({ type: c, data: R });
10854
10898
  }
10855
- const f = n / e.size;
10856
- f > o && (o += 0.01, o = Math.max(o, f), await this.onProgress.trigger(Math.round(o * 100) / 100));
10899
+ n / e.size > o && (o = Math.round(o * 100) / 100, await this.onProgress.trigger(o), o += 0.01);
10857
10900
  }
10901
+ await this.onProgress.trigger(1);
10858
10902
  const a = await this.components.get(ke).processFromWebIfc(this.webIfc, 0);
10859
10903
  await this.onIndicesStreamed.trigger(a);
10860
10904
  }
10861
10905
  cleanUp() {
10862
- this.webIfc = null, this.webIfc = new b.IfcAPI();
10906
+ this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new b.IfcAPI();
10863
10907
  }
10864
10908
  }
10865
10909
  /**
@@ -10884,7 +10928,7 @@ const Ds = class Ds extends et {
10884
10928
  * @returns The distance from the point to the line segment.
10885
10929
  */
10886
10930
  static distanceFromPointToLine(t, e, i, o = !1) {
10887
- const n = new g.Line3(), r = new g.Vector3();
10931
+ const n = new O.Line3(), r = new O.Vector3();
10888
10932
  return n.set(e, i), n.closestPointToPoint(t, o, r), r.distanceTo(t);
10889
10933
  }
10890
10934
  /**
@@ -10918,14 +10962,14 @@ const Ds = class Ds extends et {
10918
10962
  const f = /* @__PURE__ */ new Map();
10919
10963
  for (const { id: T } of u)
10920
10964
  if (h.has(T)) {
10921
- const O = h.get(T);
10922
- f.set(T, O);
10965
+ const g = h.get(T);
10966
+ f.set(T, g);
10923
10967
  }
10924
10968
  const R = u.map((T) => T.id);
10925
10969
  if (!f.size) {
10926
10970
  const T = c++;
10927
- for (const { id: O } of u)
10928
- h.set(O, T);
10971
+ for (const { id: g } of u)
10972
+ h.set(g, T);
10929
10973
  d.set(T, {
10930
10974
  edges: new Set(R),
10931
10975
  indices: /* @__PURE__ */ new Set([E])
@@ -10934,9 +10978,9 @@ const Ds = class Ds extends et {
10934
10978
  }
10935
10979
  let m = null;
10936
10980
  const C = /* @__PURE__ */ new Set(), A = new Set(R);
10937
- for (const [T, O] of f) {
10938
- m === null ? m = O : O !== m && C.add(O), h.delete(T);
10939
- const { edges: _ } = d.get(O);
10981
+ for (const [T, g] of f) {
10982
+ m === null ? m = g : g !== m && C.add(g), h.delete(T);
10983
+ const { edges: _ } = d.get(g);
10940
10984
  _.delete(T), A.delete(T);
10941
10985
  }
10942
10986
  if (m === null)
@@ -10945,11 +10989,11 @@ const Ds = class Ds extends et {
10945
10989
  p.add(E);
10946
10990
  for (const T of A) {
10947
10991
  h.set(T, m);
10948
- const { edges: O } = F;
10949
- O.add(T);
10992
+ const { edges: g } = F;
10993
+ g.add(T);
10950
10994
  }
10951
10995
  for (const T of C) {
10952
- const O = d.get(T), { edges: _, indices: S } = O, N = d.get(m), { edges: L, indices: w } = N;
10996
+ const g = d.get(T), { edges: _, indices: S } = g, N = d.get(m), { edges: L, indices: w } = N;
10953
10997
  for (const y of _)
10954
10998
  L.add(y), h.set(y, m);
10955
10999
  for (const y of S)
@@ -10981,12 +11025,12 @@ const Ds = class Ds extends et {
10981
11025
  getVerticesAndNormal(t, e, i) {
10982
11026
  if (!t.geometry.index)
10983
11027
  throw new Error("Geometry must be indexed!");
10984
- const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), E = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[h], n[h + 1], n[h + 2]), f = new g.Vector3(r[a], r[a + 1], r[a + 2]), R = new g.Vector3(r[c], r[c + 1], r[c + 2]), m = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (f.x + R.x + m.x) / 3, A = (f.y + R.y + m.y) / 3, F = (f.z + R.z + m.z) / 3, p = new g.Vector3(C, A, F);
10985
- if (i !== void 0 && t instanceof g.InstancedMesh) {
10986
- const T = new g.Matrix4();
11028
+ const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new O.Vector3(n[a], n[a + 1], n[a + 2]), E = new O.Vector3(n[c], n[c + 1], n[c + 2]), u = new O.Vector3(n[h], n[h + 1], n[h + 2]), f = new O.Vector3(r[a], r[a + 1], r[a + 2]), R = new O.Vector3(r[c], r[c + 1], r[c + 2]), m = new O.Vector3(r[h], r[h + 1], r[h + 2]), C = (f.x + R.x + m.x) / 3, A = (f.y + R.y + m.y) / 3, F = (f.z + R.z + m.z) / 3, p = new O.Vector3(C, A, F);
11029
+ if (i !== void 0 && t instanceof O.InstancedMesh) {
11030
+ const T = new O.Matrix4();
10987
11031
  t.getMatrixAt(i, T);
10988
- const O = new g.Matrix4();
10989
- O.extractRotation(T), p.applyMatrix4(O), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
11032
+ const g = new O.Matrix4();
11033
+ g.extractRotation(T), p.applyMatrix4(g), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
10990
11034
  }
10991
11035
  return { p1: d, p2: E, p3: u, faceNormal: p };
10992
11036
  }
@@ -11014,7 +11058,7 @@ const Ds = class Ds extends et {
11014
11058
  * @throws Will throw an error if the fragment manager is not available.
11015
11059
  */
11016
11060
  getVolumeFromFragments(t) {
11017
- const e = this.components.get(ht), i = new g.Matrix4(), o = [];
11061
+ const e = this.components.get(ht), i = new O.Matrix4(), o = [];
11018
11062
  for (const r in t) {
11019
11063
  const a = e.list.get(r);
11020
11064
  if (!a)
@@ -11025,7 +11069,7 @@ const Ds = class Ds extends et {
11025
11069
  const f = a.getInstancesIDs(u);
11026
11070
  f && (h += f.size);
11027
11071
  }
11028
- const d = new g.InstancedMesh(
11072
+ const d = new O.InstancedMesh(
11029
11073
  a.mesh.geometry,
11030
11074
  void 0,
11031
11075
  h
@@ -11090,23 +11134,23 @@ const Ds = class Ds extends et {
11090
11134
  distance: E.distanceTo(m),
11091
11135
  points: [E, m]
11092
11136
  }
11093
- ], A = new g.Plane();
11137
+ ], A = new O.Plane();
11094
11138
  return A.setFromNormalAndCoplanarPoint(c, n), A.constant = Math.round(A.constant * 10) / 10, { plane: A, edges: C };
11095
11139
  }
11096
11140
  // https://stackoverflow.com/a/1568551
11097
11141
  getVolumeOfMesh(t) {
11098
11142
  let e = 0;
11099
- const i = new g.Vector3(), o = new g.Vector3(), n = new g.Vector3(), { index: r } = t.geometry, a = t.geometry.attributes.position.array;
11143
+ const i = new O.Vector3(), o = new O.Vector3(), n = new O.Vector3(), { index: r } = t.geometry, a = t.geometry.attributes.position.array;
11100
11144
  if (!r)
11101
11145
  return console.warn("Geometry must be indexed to compute its volume!"), 0;
11102
11146
  const c = [];
11103
- if (t instanceof g.InstancedMesh)
11147
+ if (t instanceof O.InstancedMesh)
11104
11148
  for (let d = 0; d < t.count; d++) {
11105
- const E = new g.Matrix4();
11149
+ const E = new O.Matrix4();
11106
11150
  t.getMatrixAt(d, E), c.push(E);
11107
11151
  }
11108
11152
  else
11109
- c.push(new g.Matrix4().identity());
11153
+ c.push(new O.Matrix4().identity());
11110
11154
  const { matrixWorld: h } = t;
11111
11155
  for (let d = 0; d < r.array.length - 2; d += 3)
11112
11156
  for (const E of c) {
@@ -11142,7 +11186,7 @@ export {
11142
11186
  Ti as Cullers,
11143
11187
  zt as Disposer,
11144
11188
  D as Event,
11145
- gn as Exploder,
11189
+ On as Exploder,
11146
11190
  zr as FirstPersonMode,
11147
11191
  ht as FragmentsManager,
11148
11192
  vn as GeometryTypes,
@@ -11155,7 +11199,7 @@ export {
11155
11199
  Sn as IfcGeometryTiler,
11156
11200
  mi as IfcJsonExporter,
11157
11201
  Ri as IfcLoader,
11158
- On as IfcPropertiesManager,
11202
+ gn as IfcPropertiesManager,
11159
11203
  Kr as IfcPropertiesTiler,
11160
11204
  Kt as IfcPropertiesUtils,
11161
11205
  ke as IfcRelationsIndexer,