@thatopen/components 2.0.24 → 2.0.26

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
@@ -2,11 +2,11 @@ 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
4
  import * as g from "three";
5
- import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Oi, Line3 as Lt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as Ot, BackSide as Zn, DoubleSide as Ln, FrontSide as Di, 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 Ui, Float32BufferAttribute as xi, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as me, PlaneGeometry as Jn } 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";
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";
9
- const Mn = 0, eo = 1, so = 2, bi = 2, Ys = 1.25, vi = 1, Cs = 6 * 4 + 4 + 4, Us = 65535, io = Math.pow(2, -24), Vs = Symbol("SKIP_GENERATION");
9
+ const Mn = 0, eo = 1, so = 2, xi = 2, Ys = 1.25, bi = 1, Cs = 6 * 4 + 4 + 4, Us = 65535, io = Math.pow(2, -24), Vs = Symbol("SKIP_GENERATION");
10
10
  function no(l) {
11
11
  return l.index ? l.index.count : l.attributes.position.count;
12
12
  }
@@ -63,7 +63,7 @@ function K(l, s, t) {
63
63
  function co(l) {
64
64
  l[0] = l[1] = l[2] = 1 / 0, l[3] = l[4] = l[5] = -1 / 0;
65
65
  }
66
- function Bi(l) {
66
+ function vi(l) {
67
67
  let s = -1, t = -1 / 0;
68
68
  for (let e = 0; e < 3; e++) {
69
69
  const i = l[e + 3] - l[e];
@@ -71,10 +71,10 @@ function Bi(l) {
71
71
  }
72
72
  return s;
73
73
  }
74
- function Yi(l, s) {
74
+ function Bi(l, s) {
75
75
  s.set(l);
76
76
  }
77
- function Vi(l, s, t) {
77
+ function Yi(l, s, t) {
78
78
  let e, i;
79
79
  for (let o = 0; o < 3; o++) {
80
80
  const n = o + 3;
@@ -149,9 +149,9 @@ const Mt = 32, Eo = (l, s) => l.candidate - s.candidate, Ut = new Array(Mt).fill
149
149
  function uo(l, s, t, e, i, o) {
150
150
  let n = -1, r = 0;
151
151
  if (o === Mn)
152
- n = Bi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
152
+ n = vi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
153
153
  else if (o === eo)
154
- n = Bi(l), n !== -1 && (r = Io(t, e, i, n));
154
+ n = vi(l), n !== -1 && (r = Io(t, e, i, n));
155
155
  else if (o === so) {
156
156
  const a = Re(l);
157
157
  let c = Ys * i;
@@ -194,7 +194,7 @@ function uo(l, s, t, e, i, o) {
194
194
  O !== 0 && (L = Re(S) / a);
195
195
  let w = 0;
196
196
  _ !== 0 && (w = Re(N) / a);
197
- const y = vi + Ys * (L * O + w * _);
197
+ const y = bi + Ys * (L * O + w * _);
198
198
  y < c && (n = E, c = y, r = T.candidate);
199
199
  }
200
200
  } else {
@@ -212,20 +212,20 @@ function uo(l, s, t, e, i, o) {
212
212
  _.count++, Qe(F, t, _.bounds);
213
213
  }
214
214
  const C = Ut[Mt - 1];
215
- Yi(C.bounds, C.rightCacheBounds);
215
+ Bi(C.bounds, C.rightCacheBounds);
216
216
  for (let F = Mt - 2; F >= 0; F--) {
217
217
  const p = Ut[F], T = Ut[F + 1];
218
- Vi(p.bounds, T.rightCacheBounds, p.rightCacheBounds);
218
+ Yi(p.bounds, T.rightCacheBounds, p.rightCacheBounds);
219
219
  }
220
220
  let A = 0;
221
221
  for (let F = 0; F < Mt - 1; F++) {
222
222
  const p = Ut[F], T = p.count, O = p.bounds, S = Ut[F + 1].rightCacheBounds;
223
- T !== 0 && (A === 0 ? Yi(O, je) : Vi(O, je, je)), A += T;
223
+ T !== 0 && (A === 0 ? Bi(O, je) : Yi(O, 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;
227
227
  w !== 0 && (L = Re(S) / a);
228
- const y = vi + Ys * (N * A + L * w);
228
+ const y = bi + Ys * (N * A + L * w);
229
229
  y < c && (n = E, c = y, r = p.candidate);
230
230
  }
231
231
  }
@@ -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
- }(), gi = function() {
413
+ }(), Oi = 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);
@@ -440,7 +440,7 @@ const Ro = function() {
440
440
  }
441
441
  };
442
442
  }(), Ao = function() {
443
- const l = new M(), s = new M(), t = new Oi(), e = new Lt();
443
+ const l = new M(), s = new M(), t = new Fi(), e = new Lt();
444
444
  return function(o, n) {
445
445
  const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
446
446
  if (e.start = c, e.end = h, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = h, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
@@ -459,7 +459,7 @@ function zs(l) {
459
459
  }
460
460
  class Ft extends ue {
461
461
  constructor(...s) {
462
- super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new M()), this.satBounds = new Array(4).fill().map(() => new wt()), this.points = [this.a, this.b, this.c], this.sphere = new Xn(), this.plane = new Oi(), this.needsUpdate = !0;
462
+ super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new M()), this.satBounds = new Array(4).fill().map(() => new wt()), this.points = [this.a, this.b, this.c], this.sphere = new Xn(), this.plane = new Fi(), this.needsUpdate = !0;
463
463
  }
464
464
  intersectsSphere(s) {
465
465
  return Ao(s, this);
@@ -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]), gi(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]), Oi(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
  };
@@ -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]), gi(e, i, l, s);
589
+ i.set(n[R], n[m]), Oi(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
  }
@@ -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
- gi(C, F, e, i);
715
+ Oi(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 _i {
724
+ class gi {
725
725
  constructor(s) {
726
726
  this._getNewPrimitive = s, this._primitives = [];
727
727
  }
@@ -733,13 +733,13 @@ class _i {
733
733
  this._primitives.push(s);
734
734
  }
735
735
  }
736
- class Oo extends _i {
736
+ class Oo extends gi {
737
737
  constructor() {
738
738
  super(() => new Ft());
739
739
  }
740
740
  }
741
741
  const It = /* @__PURE__ */ new Oo();
742
- function ht(l, s) {
742
+ function Et(l, s) {
743
743
  return s[l + 15] === 65535;
744
744
  }
745
745
  function dt(l, s) {
@@ -771,7 +771,7 @@ class go {
771
771
  }
772
772
  const Z = new go();
773
773
  let Yt, Ie;
774
- const Jt = [], Ke = /* @__PURE__ */ new _i(() => new Ot());
774
+ const Jt = [], Ke = /* @__PURE__ */ new gi(() => new Ot());
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);
@@ -782,20 +782,20 @@ function _o(l, s, t, e, i, o) {
782
782
  function ai(l, s, t, e, i = null, o = 0, n = 0) {
783
783
  const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
784
784
  let h = l * 2;
785
- if (ht(h, a)) {
785
+ if (Et(h, a)) {
786
786
  const E = dt(l, c), u = ft(h, a);
787
787
  return K(l, r, Yt), e(E, u, !1, n, o + l, Yt);
788
788
  } else {
789
789
  let L = function(y) {
790
790
  const { uint16Array: U, uint32Array: x } = Z;
791
791
  let B = y * 2;
792
- for (; !ht(B, U); )
792
+ for (; !Et(B, U); )
793
793
  y = pt(y), B = y * 2;
794
794
  return dt(y, x);
795
795
  }, w = function(y) {
796
796
  const { uint16Array: U, uint32Array: x } = Z;
797
797
  let B = y * 2;
798
- for (; !ht(B, U); )
798
+ for (; !Et(B, U); )
799
799
  y = Ct(y, x), B = y * 2;
800
800
  return dt(y, x) + ft(B, U);
801
801
  };
@@ -807,9 +807,9 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
807
807
  m = C, C = y, A = F;
808
808
  }
809
809
  A || (A = Yt, K(f, r, A));
810
- const p = ht(f * 2, a), T = t(A, p, m, n + 1, o + f);
810
+ const p = Et(f * 2, a), T = t(A, p, m, n + 1, o + f);
811
811
  let O;
812
- if (T === bi) {
812
+ if (T === xi) {
813
813
  const y = L(f), x = w(f) - y;
814
814
  O = e(y, x, !0, n + 1, o + f, A);
815
815
  } else
@@ -825,9 +825,9 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
825
825
  if (O)
826
826
  return !0;
827
827
  F = Ie, K(R, r, F);
828
- const _ = ht(R * 2, a), S = t(F, _, C, n + 1, o + R);
828
+ const _ = Et(R * 2, a), S = t(F, _, C, n + 1, o + R);
829
829
  let N;
830
- if (S === bi) {
830
+ if (S === xi) {
831
831
  const y = L(R), x = w(R) - y;
832
832
  N = e(y, x, !0, n + 1, o + R, F);
833
833
  } else
@@ -862,7 +862,7 @@ function So(l, s, t = {}, e = 0, i = 1 / 0) {
862
862
  const c = Math.sqrt(r);
863
863
  return t.point ? t.point.copy(Hs) : t.point = Hs.clone(), t.distance = c, t.faceIndex = a, t;
864
864
  }
865
- const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), $e = /* @__PURE__ */ new fe(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), Gi = /* @__PURE__ */ new M(), zi = /* @__PURE__ */ new M(), Hi = /* @__PURE__ */ new M(), es = /* @__PURE__ */ new M();
865
+ const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), $e = /* @__PURE__ */ new fe(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), Vi = /* @__PURE__ */ new M(), Gi = /* @__PURE__ */ new M(), zi = /* @__PURE__ */ new M(), es = /* @__PURE__ */ new M();
866
866
  function No(l, s, t, e, i, o) {
867
867
  let n;
868
868
  return o === Zn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== Ln, i), n === null ? null : {
@@ -874,7 +874,7 @@ function Po(l, s, t, e, i, o, n, r, a) {
874
874
  te.fromBufferAttribute(s, o), ee.fromBufferAttribute(s, n), se.fromBufferAttribute(s, r);
875
875
  const c = No(l, te, ee, se, es, a);
876
876
  if (c) {
877
- e && ($e.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (Gi.fromBufferAttribute(t, o), zi.fromBufferAttribute(t, n), Hi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(es, te, ee, se, Gi, zi, Hi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
877
+ e && ($e.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(es, te, ee, se, Vi, Gi, zi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
878
878
  const h = {
879
879
  a: o,
880
880
  b: n,
@@ -959,9 +959,9 @@ function wo(l, s = null) {
959
959
  }
960
960
  }
961
961
  }
962
- const ki = /* @__PURE__ */ new Ot();
962
+ const Hi = /* @__PURE__ */ new Ot();
963
963
  function Gt(l, s, t, e) {
964
- return K(l, s, ki), t.intersectBox(ki, e);
964
+ return K(l, s, Hi), t.intersectBox(Hi, e);
965
965
  }
966
966
  function Do(l, s, t, e, i, o) {
967
967
  const { geometry: n, _indirectBuffer: r } = l;
@@ -988,23 +988,23 @@ function xo(l, s, t, e, i, o, n) {
988
988
  }
989
989
  return !1;
990
990
  }
991
- const Wi = /* @__PURE__ */ new M();
991
+ const ki = /* @__PURE__ */ new M();
992
992
  function bo(l, s, t, e, i) {
993
993
  Z.setBuffer(l._roots[s]), ci(0, l, t, e, i), Z.clearBuffer();
994
994
  }
995
995
  function ci(l, s, t, e, i) {
996
996
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
997
- if (ht(a, n)) {
997
+ if (Et(a, n)) {
998
998
  const h = dt(l, r), d = ft(a, n);
999
999
  Lo(s, t, e, h, d, i);
1000
1000
  } else {
1001
1001
  const h = pt(l);
1002
- Gt(h, o, e, Wi) && ci(h, s, t, e, i);
1002
+ Gt(h, o, e, ki) && ci(h, s, t, e, i);
1003
1003
  const d = Ct(l, r);
1004
- Gt(d, o, e, Wi) && ci(d, s, t, e, i);
1004
+ Gt(d, o, e, ki) && ci(d, s, t, e, i);
1005
1005
  }
1006
1006
  }
1007
- const Xi = /* @__PURE__ */ new M(), vo = ["x", "y", "z"];
1007
+ const Wi = /* @__PURE__ */ new M(), vo = ["x", "y", "z"];
1008
1008
  function Bo(l, s, t, e) {
1009
1009
  Z.setBuffer(l._roots[s]);
1010
1010
  const i = li(0, l, t, e);
@@ -1013,14 +1013,14 @@ function Bo(l, s, t, e) {
1013
1013
  function li(l, s, t, e) {
1014
1014
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1015
1015
  let r = l * 2;
1016
- if (ht(r, o)) {
1016
+ if (Et(r, o)) {
1017
1017
  const c = dt(l, n), h = ft(r, o);
1018
1018
  return yo(s, t, e, c, h);
1019
1019
  } else {
1020
1020
  const c = Un(l, n), h = vo[c], E = e.direction[h] >= 0;
1021
1021
  let u, f;
1022
1022
  E ? (u = pt(l), f = Ct(l, n)) : (u = Ct(l, n), f = pt(l));
1023
- const m = Gt(u, i, e, Xi) ? li(u, s, t, e) : null;
1023
+ const m = Gt(u, i, e, Wi) ? li(u, s, t, e) : null;
1024
1024
  if (m) {
1025
1025
  const F = m.point[h];
1026
1026
  if (E ? F <= i[f + c] : (
@@ -1029,11 +1029,11 @@ function li(l, s, t, e) {
1029
1029
  ))
1030
1030
  return m;
1031
1031
  }
1032
- const A = Gt(f, i, e, Xi) ? li(f, s, t, e) : null;
1032
+ const A = Gt(f, i, e, Wi) ? li(f, s, t, e) : null;
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(), Zi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
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();
1037
1037
  function Yo(l, s, t, e) {
1038
1038
  Z.setBuffer(l._roots[s]);
1039
1039
  const i = hi(0, l, t, e);
@@ -1042,7 +1042,7 @@ function Yo(l, s, t, e) {
1042
1042
  function hi(l, s, t, e, i = null) {
1043
1043
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1044
1044
  let a = l * 2;
1045
- if (i === null && (t.boundingBox || t.computeBoundingBox(), Zi.set(t.boundingBox.min, t.boundingBox.max, e), i = Zi), ht(a, n)) {
1045
+ if (i === null && (t.boundingBox || t.computeBoundingBox(), Xi.set(t.boundingBox.min, t.boundingBox.max, e), i = Xi), Et(a, n)) {
1046
1046
  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);
1047
1047
  if (Fe.copy(e).invert(), t.boundsTree)
1048
1048
  return K(l, o, is), is.matrix.copy(Fe), is.needsUpdate = !0, t.boundsTree.shapecast({
@@ -1151,23 +1151,23 @@ function Wo(l, s = null) {
1151
1151
  }
1152
1152
  }
1153
1153
  }
1154
- const Qi = /* @__PURE__ */ new M();
1154
+ const Zi = /* @__PURE__ */ new M();
1155
1155
  function Xo(l, s, t, e, i) {
1156
1156
  Z.setBuffer(l._roots[s]), Ei(0, l, t, e, i), Z.clearBuffer();
1157
1157
  }
1158
1158
  function Ei(l, s, t, e, i) {
1159
1159
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
1160
- if (ht(a, n)) {
1160
+ if (Et(a, n)) {
1161
1161
  const h = dt(l, r), d = ft(a, n);
1162
1162
  Do(s, t, e, h, d, i);
1163
1163
  } else {
1164
1164
  const h = pt(l);
1165
- Gt(h, o, e, Qi) && Ei(h, s, t, e, i);
1165
+ Gt(h, o, e, Zi) && Ei(h, s, t, e, i);
1166
1166
  const d = Ct(l, r);
1167
- Gt(d, o, e, Qi) && Ei(d, s, t, e, i);
1167
+ Gt(d, o, e, Zi) && Ei(d, s, t, e, i);
1168
1168
  }
1169
1169
  }
1170
- const ji = /* @__PURE__ */ new M(), Zo = ["x", "y", "z"];
1170
+ const Qi = /* @__PURE__ */ new M(), Zo = ["x", "y", "z"];
1171
1171
  function Qo(l, s, t, e) {
1172
1172
  Z.setBuffer(l._roots[s]);
1173
1173
  const i = di(0, l, t, e);
@@ -1176,14 +1176,14 @@ function Qo(l, s, t, e) {
1176
1176
  function di(l, s, t, e) {
1177
1177
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1178
1178
  let r = l * 2;
1179
- if (ht(r, o)) {
1179
+ if (Et(r, o)) {
1180
1180
  const c = dt(l, n), h = ft(r, o);
1181
1181
  return Uo(s, t, e, c, h);
1182
1182
  } else {
1183
1183
  const c = Un(l, n), h = Zo[c], E = e.direction[h] >= 0;
1184
1184
  let u, f;
1185
1185
  E ? (u = pt(l), f = Ct(l, n)) : (u = Ct(l, n), f = pt(l));
1186
- const m = Gt(u, i, e, ji) ? di(u, s, t, e) : null;
1186
+ const m = Gt(u, i, e, Qi) ? di(u, s, t, e) : null;
1187
1187
  if (m) {
1188
1188
  const F = m.point[h];
1189
1189
  if (E ? F <= i[f + c] : (
@@ -1192,11 +1192,11 @@ function di(l, s, t, e) {
1192
1192
  ))
1193
1193
  return m;
1194
1194
  }
1195
- const A = Gt(f, i, e, ji) ? di(f, s, t, e) : null;
1195
+ const A = Gt(f, i, e, Qi) ? di(f, s, t, e) : null;
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(), qi = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
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();
1200
1200
  function jo(l, s, t, e) {
1201
1201
  Z.setBuffer(l._roots[s]);
1202
1202
  const i = ui(0, l, t, e);
@@ -1205,7 +1205,7 @@ function jo(l, s, t, e) {
1205
1205
  function ui(l, s, t, e, i = null) {
1206
1206
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1207
1207
  let a = l * 2;
1208
- if (i === null && (t.boundingBox || t.computeBoundingBox(), qi.set(t.boundingBox.min, t.boundingBox.max, e), i = qi), ht(a, n)) {
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
1210
  if (ge.copy(e).invert(), t.boundsTree)
1211
1211
  return K(l, o, rs), rs.matrix.copy(ge), rs.needsUpdate = !0, t.boundsTree.shapecast({
@@ -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 _i(() => 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 gi(() => new Ot()), ae = new Ot(), ce = new Ot(), Xs = new Ot(), Zs = new Ot();
1285
1285
  let Qs = !1;
1286
1286
  function sr(l, s, t, e) {
1287
1287
  if (Qs)
@@ -1315,7 +1315,7 @@ 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 = ht(F, R), O = ht(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), O = Et(p, A);
1319
1319
  let _ = !1;
1320
1320
  if (O && T)
1321
1321
  h ? _ = i(
@@ -1495,8 +1495,8 @@ 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(), Ki = /* @__PURE__ */ new Ot();
1499
- class Si {
1498
+ const cs = /* @__PURE__ */ new at(), qi = /* @__PURE__ */ new Ot();
1499
+ class _i {
1500
1500
  static serialize(s, t = {}) {
1501
1501
  t = {
1502
1502
  cloneBuffers: !0,
@@ -1520,7 +1520,7 @@ class Si {
1520
1520
  indirect: !!s.indirectBuffer,
1521
1521
  ...e
1522
1522
  };
1523
- const { index: i, roots: o, indirectBuffer: n } = s, r = new Si(t, { ...e, [Vs]: !0 });
1523
+ const { index: i, roots: o, indirectBuffer: n } = s, r = new _i(t, { ...e, [Vs]: !0 });
1524
1524
  if (r._roots = o, r._indirectBuffer = n || null, e.setIndex) {
1525
1525
  const a = t.getIndex();
1526
1526
  if (a === null) {
@@ -1576,7 +1576,7 @@ class Si {
1576
1576
  }
1577
1577
  }
1578
1578
  /* Core Cast Functions */
1579
- raycast(s, t = Di) {
1579
+ raycast(s, t = wi) {
1580
1580
  const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Xo : bo;
1581
1581
  for (let d = 0, E = e.length; d < E; d++) {
1582
1582
  const u = r ? t[a[d].materialIndex].side : c, f = o.length;
@@ -1588,7 +1588,7 @@ class Si {
1588
1588
  }
1589
1589
  return o;
1590
1590
  }
1591
- raycastFirst(s, t = Di) {
1591
+ raycastFirst(s, t = wi) {
1592
1592
  const e = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
1593
1593
  let r = null;
1594
1594
  const a = i.groups, c = o ? t.side : t, h = this.indirect ? Qo : Bo;
@@ -1703,27 +1703,27 @@ class Si {
1703
1703
  }
1704
1704
  getBoundingBox(s) {
1705
1705
  return s.makeEmpty(), this._roots.forEach((e) => {
1706
- K(0, new Float32Array(e), Ki), s.union(Ki);
1706
+ K(0, new Float32Array(e), qi), s.union(qi);
1707
1707
  }), s;
1708
1708
  }
1709
1709
  }
1710
- function $i(l, s, t) {
1710
+ function Ki(l, s, t) {
1711
1711
  return l === null || (l.point.applyMatrix4(s.matrixWorld), l.distance = l.point.distanceTo(t.ray.origin), l.object = s, l.distance < t.near || l.distance > t.far) ? null : l;
1712
1712
  }
1713
- const js = /* @__PURE__ */ new Qn(), Ji = /* @__PURE__ */ new yt(), ir = v.prototype.raycast;
1713
+ const js = /* @__PURE__ */ new Qn(), $i = /* @__PURE__ */ new yt(), ir = v.prototype.raycast;
1714
1714
  function nr(l, s) {
1715
1715
  if (this.geometry.boundsTree) {
1716
1716
  if (this.material === void 0)
1717
1717
  return;
1718
- Ji.copy(this.matrixWorld).invert(), js.copy(l.ray).applyMatrix4(Ji);
1718
+ $i.copy(this.matrixWorld).invert(), js.copy(l.ray).applyMatrix4($i);
1719
1719
  const t = this.geometry.boundsTree;
1720
1720
  if (l.firstHitOnly === !0) {
1721
- const e = $i(t.raycastFirst(js, this.material), this, l);
1721
+ const e = Ki(t.raycastFirst(js, this.material), this, l);
1722
1722
  e && s.push(e);
1723
1723
  } else {
1724
1724
  const e = t.raycast(js, this.material);
1725
1725
  for (let i = 0, o = e.length; i < o; i++) {
1726
- const n = $i(e[i], this, l);
1726
+ const n = Ki(e[i], this, l);
1727
1727
  n && s.push(n);
1728
1728
  }
1729
1729
  }
@@ -1731,7 +1731,7 @@ function nr(l, s) {
1731
1731
  ir.call(this, l, s);
1732
1732
  }
1733
1733
  function or(l) {
1734
- return this.boundsTree = new Si(this, l), this.boundsTree;
1734
+ return this.boundsTree = new _i(this, l), this.boundsTree;
1735
1735
  }
1736
1736
  function rr() {
1737
1737
  this.boundsTree = null;
@@ -1794,7 +1794,7 @@ class Ts {
1794
1794
  this.handlers.length = 0;
1795
1795
  }
1796
1796
  }
1797
- class Ni {
1797
+ class Si {
1798
1798
  constructor(s) {
1799
1799
  /** Whether is component is {@link Disposable}. */
1800
1800
  I(this, "isDisposeable", () => "dispose" in this && "onDisposed" in this);
@@ -1809,9 +1809,9 @@ class Ni {
1809
1809
  this.components = s;
1810
1810
  }
1811
1811
  }
1812
- class et extends Ni {
1812
+ class et extends Si {
1813
1813
  }
1814
- class Pi extends Ni {
1814
+ class Ni extends Si {
1815
1815
  constructor(t) {
1816
1816
  super(t);
1817
1817
  I(this, "worlds", /* @__PURE__ */ new Map());
@@ -1829,7 +1829,7 @@ class Pi extends Ni {
1829
1829
  });
1830
1830
  }
1831
1831
  }
1832
- class ar extends Pi {
1832
+ class ar extends Ni {
1833
1833
  constructor() {
1834
1834
  super(...arguments);
1835
1835
  /**
@@ -1840,7 +1840,7 @@ class ar extends Pi {
1840
1840
  I(this, "hasCameraControls", () => "controls" in this);
1841
1841
  }
1842
1842
  }
1843
- class cr extends Pi {
1843
+ class cr extends Ni {
1844
1844
  constructor() {
1845
1845
  super(...arguments);
1846
1846
  /** {@link Updateable.onBeforeUpdate} */
@@ -1958,7 +1958,7 @@ const be = class be extends et {
1958
1958
  */
1959
1959
  I(be, "uuid", "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");
1960
1960
  let zt = be;
1961
- class lr extends Pi {
1961
+ class lr extends Ni {
1962
1962
  constructor(t) {
1963
1963
  super(t);
1964
1964
  /** {@link Disposable.onDisposed} */
@@ -1974,10 +1974,10 @@ class lr extends Pi {
1974
1974
  this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
1975
1975
  }
1976
1976
  }
1977
- const ms = 0, hr = 1, Er = new M(), tn = new Lt(), qs = new Oi(), en = new M(), ls = new ue();
1977
+ const ms = 0, hr = 1, Er = new M(), Ji = new Lt(), qs = new Fi(), tn = new M(), ls = new ue();
1978
1978
  class dr {
1979
1979
  constructor() {
1980
- this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new sn(), this.unassigned = new sn(), this.vertices = [];
1980
+ this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new en(), this.unassigned = new en(), this.vertices = [];
1981
1981
  }
1982
1982
  setFromPoints(s) {
1983
1983
  if (s.length >= 4) {
@@ -2107,12 +2107,12 @@ class dr {
2107
2107
  }
2108
2108
  const r = e[n], a = i[n];
2109
2109
  let c, h;
2110
- o = 0, tn.set(r.point, a.point);
2110
+ o = 0, Ji.set(r.point, a.point);
2111
2111
  for (let E = 0, u = this.vertices.length; E < u; E++) {
2112
2112
  const f = s[E];
2113
2113
  if (f !== r && f !== a) {
2114
- tn.closestPointToPoint(f.point, !0, en);
2115
- const R = en.distanceToSquared(f.point);
2114
+ Ji.closestPointToPoint(f.point, !0, tn);
2115
+ const R = tn.distanceToSquared(f.point);
2116
2116
  R > o && (o = R, c = f);
2117
2117
  }
2118
2118
  }
@@ -2281,7 +2281,7 @@ class ur {
2281
2281
  this.point = s, this.prev = null, this.next = null, this.face = null;
2282
2282
  }
2283
2283
  }
2284
- class sn {
2284
+ class en {
2285
2285
  constructor() {
2286
2286
  this.head = null, this.tail = null;
2287
2287
  }
@@ -2418,12 +2418,12 @@ function Tr(l) {
2418
2418
  We.makeScale(Ht * 2, kt * 2, Wt * 2);
2419
2419
  const Ce = new g.Matrix4();
2420
2420
  Ce.makeTranslation(-Ht, -kt, -Wt);
2421
+ const yi = new g.Matrix4();
2422
+ yi.makeTranslation(q.x, q.y, q.z);
2421
2423
  const Mi = new g.Matrix4();
2422
- Mi.makeTranslation(q.x, q.y, q.z);
2423
- const wi = new g.Matrix4();
2424
- wi.setFromMatrix3(Q);
2424
+ Mi.setFromMatrix3(Q);
2425
2425
  const Te = new g.Matrix4();
2426
- return Te.multiply(Mi), Te.multiply(wi), Te.multiply(Ce), Te.multiply(We), { center: q, halfSizes: st, rotation: Q, transformation: Te };
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) {
2429
2429
  const e = [
@@ -2433,7 +2433,7 @@ function mr(l, s, t) {
2433
2433
  ];
2434
2434
  return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
2435
2435
  }
2436
- class nn {
2436
+ class sn {
2437
2437
  static isTransparent(s) {
2438
2438
  return s.transparent && s.opacity < 1;
2439
2439
  }
@@ -2964,7 +2964,7 @@ const Fs = class Fs {
2964
2964
  /**
2965
2965
  * The version of the @thatopen/components library.
2966
2966
  */
2967
- I(Fs, "release", "2.0.24");
2967
+ I(Fs, "release", "2.0.26");
2968
2968
  let pi = Fs;
2969
2969
  class Rr {
2970
2970
  constructor(s) {
@@ -3127,7 +3127,7 @@ const Os = class Os extends et {
3127
3127
  */
3128
3128
  I(Os, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
3129
3129
  let ze = Os;
3130
- class Fr extends Ni {
3130
+ class Fr extends Si {
3131
3131
  constructor() {
3132
3132
  super(...arguments);
3133
3133
  /**
@@ -3404,7 +3404,7 @@ function Zt(l) {
3404
3404
  function bt(l) {
3405
3405
  return l.isOrthographicCamera;
3406
3406
  }
3407
- const he = Math.PI * 2, on = Math.PI / 2, xn = 1e-5, Se = Math.PI / 180;
3407
+ const he = Math.PI * 2, nn = Math.PI / 2, xn = 1e-5, Se = Math.PI / 180;
3408
3408
  function mt(l, s, t) {
3409
3409
  return Math.max(s, Math.min(t, l));
3410
3410
  }
@@ -3414,7 +3414,7 @@ function X(l, s = xn) {
3414
3414
  function k(l, s, t = xn) {
3415
3415
  return X(l - s, t);
3416
3416
  }
3417
- function rn(l, s) {
3417
+ function on(l, s) {
3418
3418
  return Math.round(l / s) * s;
3419
3419
  }
3420
3420
  function Ne(l) {
@@ -3434,7 +3434,7 @@ function hs(l, s, t, e, i = 1 / 0, o) {
3434
3434
  let u = s + (c + E) * a;
3435
3435
  return h - l > 0 == u > h && (u = h, t.value = (u - h) / o), u;
3436
3436
  }
3437
- function an(l, s, t, e, i = 1 / 0, o, n) {
3437
+ function rn(l, s, t, e, i = 1 / 0, o, n) {
3438
3438
  e = Math.max(1e-4, e);
3439
3439
  const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3440
3440
  let h = s.x, d = s.y, E = s.z, u = l.x - h, f = l.y - d, R = l.z - E;
@@ -3522,7 +3522,7 @@ class Or {
3522
3522
  }
3523
3523
  }
3524
3524
  const gr = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Sr = !(bn && "PointerEvent" in window);
3525
- let Y, cn, ds, ti, lt, G, z, Ee, Le, gt, _t, Qt, ln, hn, ut, ye, de, En, ei, dn, si, ii, us;
3525
+ let Y, an, ds, ti, lt, G, z, Ee, Le, gt, _t, Qt, cn, ln, ut, ye, de, hn, ei, En, si, ii, us;
3526
3526
  class ot extends Or {
3527
3527
  /**
3528
3528
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
@@ -3565,7 +3565,7 @@ class ot extends Or {
3565
3565
  * @category Statics
3566
3566
  */
3567
3567
  static install(s) {
3568
- Y = s.THREE, cn = 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(), ln = new Y.Vector3(), hn = new Y.Vector3(), ut = new Y.Spherical(), ye = new Y.Spherical(), de = new Y.Box3(), En = new Y.Box3(), ei = new Y.Sphere(), dn = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), us = new Y.Raycaster();
3568
+ 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();
3569
3569
  }
3570
3570
  /**
3571
3571
  * list all ACTIONs
@@ -4201,11 +4201,11 @@ class ot extends Or {
4201
4201
  fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
4202
4202
  const a = [], c = s.isBox3 ? de.copy(s) : de.setFromObject(s);
4203
4203
  c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
4204
- const h = rn(this._sphericalEnd.theta, on), d = rn(this._sphericalEnd.phi, on);
4204
+ const h = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
4205
4205
  a.push(this.rotateTo(h, d, t));
4206
- const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = dn.setFromUnitVectors(E, ti), f = k(Math.abs(E.y), 1);
4206
+ const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(E, ti), f = k(Math.abs(E.y), 1);
4207
4207
  f && u.multiply(si.setFromAxisAngle(ds, h)), u.multiply(this._yAxisUpSpaceInverse);
4208
- const R = En.makeEmpty();
4208
+ const R = hn.makeEmpty();
4209
4209
  z.copy(c.min).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(ti, E), f && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
4210
4210
  const m = R.getSize(G), C = R.getCenter(z).applyQuaternion(u);
4211
4211
  if (Zt(this._camera)) {
@@ -4481,7 +4481,7 @@ class ot extends Or {
4481
4481
  * @category Methods
4482
4482
  */
4483
4483
  update(s) {
4484
- const t = this._sphericalEnd.theta - this._spherical.theta, e = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, o = ln.subVectors(this._targetEnd, this._target), n = hn.subVectors(this._focalOffsetEnd, this._focalOffset), r = this._zoomEnd - this._zoom;
4484
+ const t = this._sphericalEnd.theta - this._spherical.theta, e = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, o = cn.subVectors(this._targetEnd, this._target), n = ln.subVectors(this._focalOffsetEnd, this._focalOffset), r = this._zoomEnd - this._zoom;
4485
4485
  if (X(t))
4486
4486
  this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
4487
4487
  else {
@@ -4504,13 +4504,13 @@ class ot extends Or {
4504
4504
  this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
4505
4505
  else {
4506
4506
  const d = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
4507
- an(this._target, this._targetEnd, this._targetVelocity, d, this.maxSpeed, s, this._target), this._needsUpdate = !0;
4507
+ rn(this._target, this._targetEnd, this._targetVelocity, d, this.maxSpeed, s, this._target), this._needsUpdate = !0;
4508
4508
  }
4509
4509
  if (X(n.x) && X(n.y) && X(n.z))
4510
4510
  this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
4511
4511
  else {
4512
4512
  const d = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
4513
- an(this._focalOffset, this._focalOffsetEnd, this._focalOffsetVelocity, d, this.maxSpeed, s, this._focalOffset), this._needsUpdate = !0;
4513
+ rn(this._focalOffset, this._focalOffsetEnd, this._focalOffsetVelocity, d, this.maxSpeed, s, this._focalOffset), this._needsUpdate = !0;
4514
4514
  }
4515
4515
  if (X(r))
4516
4516
  this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
@@ -4657,7 +4657,7 @@ class ot extends Or {
4657
4657
  if (!(this.colliderMeshes.length >= 1) || Js(this._camera, "_collisionTest"))
4658
4658
  return s;
4659
4659
  const e = this._getTargetDirection(Le);
4660
- ii.lookAt(cn, e, this._camera.up);
4660
+ ii.lookAt(an, e, this._camera.up);
4661
4661
  for (let i = 0; i < 4; i++) {
4662
4662
  const o = z.copy(this._nearPlaneCorners[i]);
4663
4663
  o.applyMatrix4(ii);
@@ -5157,12 +5157,12 @@ const _s = class _s extends et {
5157
5157
  * This UUID is used to register the component within the Components system.
5158
5158
  */
5159
5159
  I(_s, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
5160
- let un = _s;
5161
- const jt = new jn(), nt = new M(), xt = new M(), j = new Pt(), In = {
5160
+ let dn = _s;
5161
+ const jt = new jn(), nt = new M(), xt = new M(), j = new Pt(), un = {
5162
5162
  X: new M(1, 0, 0),
5163
5163
  Y: new M(0, 1, 0),
5164
5164
  Z: new M(0, 0, 1)
5165
- }, ni = { type: "change" }, fn = { type: "mouseDown" }, pn = { type: "mouseUp", mode: null }, Cn = { type: "objectChange" };
5165
+ }, ni = { type: "change" }, In = { type: "mouseDown" }, fn = { type: "mouseUp", mode: null }, pn = { type: "objectChange" };
5166
5166
  class Pr extends ri {
5167
5167
  constructor(s, t) {
5168
5168
  super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
@@ -5201,7 +5201,7 @@ class Pr extends ri {
5201
5201
  if (!(this.object === void 0 || this.dragging === !0 || s.button !== 0) && this.axis !== null) {
5202
5202
  jt.setFromCamera(s, this.camera);
5203
5203
  const t = oi(this._plane, jt, !0);
5204
- t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, fn.mode = this.mode, this.dispatchEvent(fn);
5204
+ t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, In.mode = this.mode, this.dispatchEvent(In);
5205
5205
  }
5206
5206
  }
5207
5207
  pointerMove(s) {
@@ -5225,13 +5225,13 @@ class Pr extends ri {
5225
5225
  this._offset.copy(this.pointEnd).sub(this.pointStart);
5226
5226
  const r = 20 / this.worldPosition.distanceTo(nt.setFromMatrixPosition(this.camera.matrixWorld));
5227
5227
  let a = !1;
5228
- t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(nt.copy(this.rotationAxis).cross(this.eye)) * r) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(In[t]), nt.copy(In[t]), o === "local" && nt.applyQuaternion(this.worldQuaternion), nt.cross(this.eye), nt.length() === 0 ? a = !0 : this.rotationAngle = this._offset.dot(nt.normalize()) * r), (t === "E" || a) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), o === "local" && t !== "E" && t !== "XYZE" ? (i.quaternion.copy(this._quaternionStart), i.quaternion.multiply(j.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), i.quaternion.copy(j.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), i.quaternion.multiply(this._quaternionStart).normalize());
5228
+ t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(nt.copy(this.rotationAxis).cross(this.eye)) * r) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(un[t]), nt.copy(un[t]), o === "local" && nt.applyQuaternion(this.worldQuaternion), nt.cross(this.eye), nt.length() === 0 ? a = !0 : this.rotationAngle = this._offset.dot(nt.normalize()) * r), (t === "E" || a) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), o === "local" && t !== "E" && t !== "XYZE" ? (i.quaternion.copy(this._quaternionStart), i.quaternion.multiply(j.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), i.quaternion.copy(j.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), i.quaternion.multiply(this._quaternionStart).normalize());
5229
5229
  }
5230
- this.dispatchEvent(ni), this.dispatchEvent(Cn);
5230
+ this.dispatchEvent(ni), this.dispatchEvent(pn);
5231
5231
  }
5232
5232
  }
5233
5233
  pointerUp(s) {
5234
- s.button === 0 && (this.dragging && this.axis !== null && (pn.mode = this.mode, this.dispatchEvent(pn)), this.dragging = !1, this.axis = null);
5234
+ s.button === 0 && (this.dragging && this.axis !== null && (fn.mode = this.mode, this.dispatchEvent(fn)), this.dragging = !1, this.axis = null);
5235
5235
  }
5236
5236
  dispose() {
5237
5237
  this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerHover), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.traverse(function(s) {
@@ -5247,7 +5247,7 @@ class Pr extends ri {
5247
5247
  return this.object = void 0, this.visible = !1, this.axis = null, this;
5248
5248
  }
5249
5249
  reset() {
5250
- this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ni), this.dispatchEvent(Cn), this.pointStart.copy(this.pointEnd));
5250
+ this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ni), this.dispatchEvent(pn), this.pointStart.copy(this.pointEnd));
5251
5251
  }
5252
5252
  getRaycaster() {
5253
5253
  return jt;
@@ -5316,7 +5316,7 @@ function oi(l, s, t) {
5316
5316
  return e[i];
5317
5317
  return !1;
5318
5318
  }
5319
- const Is = new qn(), W = new M(0, 1, 0), Tn = new M(0, 0, 0), mn = new yt(), fs = new Pt(), Rs = new Pt(), St = new M(), Rn = new yt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), ps = new M(), Me = new M(), we = new M();
5319
+ const Is = new qn(), W = new M(0, 1, 0), Cn = new M(0, 0, 0), Tn = new yt(), fs = new Pt(), Rs = new Pt(), St = new M(), mn = new yt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), ps = new M(), Me = new M(), we = new M();
5320
5320
  class Ur extends ri {
5321
5321
  constructor() {
5322
5322
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
@@ -5358,8 +5358,8 @@ class Ur extends ri {
5358
5358
  R.translate(0, 0.05, 0);
5359
5359
  const m = new rt(0.08, 0.08, 0.08);
5360
5360
  m.translate(0, 0.04, 0);
5361
- const C = new Ui();
5362
- C.setAttribute("position", new xi([0, 0, 0, 1, 0, 0], 3));
5361
+ const C = new Di();
5362
+ C.setAttribute("position", new Ui([0, 0, 0, 1, 0, 0], 3));
5363
5363
  const A = new ct(75e-4, 75e-4, 0.5, 3);
5364
5364
  A.translate(0, 0.25, 0);
5365
5365
  function F(B, H) {
@@ -5367,8 +5367,8 @@ class Ur extends ri {
5367
5367
  return q.rotateY(Math.PI / 2), q.rotateX(Math.PI / 2), q;
5368
5368
  }
5369
5369
  function p() {
5370
- const B = new Ui();
5371
- return B.setAttribute("position", new xi([0, 0, 0, 1, 1, 1], 3)), B;
5370
+ const B = new Di();
5371
+ return B.setAttribute("position", new Ui([0, 0, 0, 1, 1, 1], 3)), B;
5372
5372
  }
5373
5373
  const T = {
5374
5374
  X: [
@@ -5566,10 +5566,10 @@ class Ur extends ri {
5566
5566
  n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
5567
5567
  let r;
5568
5568
  if (this.camera.isOrthographicCamera ? r = (this.camera.top - this.camera.bottom) / this.camera.zoom : r = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), n.scale.set(1, 1, 1).multiplyScalar(r * this.size / 4), n.tag === "helper") {
5569
- n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(mn.lookAt(Tn, W, qt)), n.quaternion.multiply(j), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), nt.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), nt.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(nt), n.visible = this.dragging) : (n.quaternion.copy(e), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
5569
+ n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(Tn.lookAt(Cn, W, qt)), n.quaternion.multiply(j), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), nt.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), nt.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(nt), n.visible = this.dragging) : (n.quaternion.copy(e), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
5570
5570
  continue;
5571
5571
  }
5572
- n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(mn.lookAt(this.eye, Tn, qt)), n.name === "X" && (j.setFromAxisAngle(De, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle(qt, Math.atan2(W.x, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(Ue, Math.atan2(W.y, W.x)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(a) {
5572
+ n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(W.copy(De).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(Tn.lookAt(this.eye, Cn, qt)), n.name === "X" && (j.setFromAxisAngle(De, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle(qt, Math.atan2(W.x, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(Ue, Math.atan2(W.y, W.x)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(a) {
5573
5573
  return n.name === a;
5574
5574
  })) && (n.material.color.setHex(16776960), n.material.opacity = 1);
5575
5575
  }
@@ -5617,10 +5617,10 @@ class xr extends v {
5617
5617
  default:
5618
5618
  St.set(0, 0, 0);
5619
5619
  }
5620
- St.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Rn.lookAt(nt.set(0, 0, 0), St, W), this.quaternion.setFromRotationMatrix(Rn)), super.updateMatrixWorld(s);
5620
+ St.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (mn.lookAt(nt.set(0, 0, 0), St, W), this.quaternion.setFromRotationMatrix(mn)), super.updateMatrixWorld(s);
5621
5621
  }
5622
5622
  }
5623
- class Li {
5623
+ class Pi {
5624
5624
  constructor(s, t, e, i, o, n = 5, r = !0) {
5625
5625
  /** Event that fires when the user starts dragging a clipping plane. */
5626
5626
  I(this, "onDraggingStarted", new D());
@@ -5666,7 +5666,7 @@ class Li {
5666
5666
  });
5667
5667
  if (this.components = s, this.world = t, !t.renderer)
5668
5668
  throw new Error("The given world must have a renderer!");
5669
- this.normal = i, this.origin = e, t.renderer.setPlane(!0, this.three), this._planeMesh = Li.newPlaneMesh(n, o), this._helper = this.newHelper(), this._controls = this.newTransformControls(), this.three.setFromNormalAndCoplanarPoint(i, e), r && this.toggleControls(!0);
5669
+ this.normal = i, this.origin = e, t.renderer.setPlane(!0, this.three), this._planeMesh = Pi.newPlaneMesh(n, o), this._helper = this.newHelper(), this._controls = this.newTransformControls(), this.three.setFromNormalAndCoplanarPoint(i, e), r && this.toggleControls(!0);
5670
5670
  }
5671
5671
  /**
5672
5672
  * Getter for the enabled state of the clipping plane.
@@ -5832,7 +5832,7 @@ const ve = class ve extends et {
5832
5832
  * The type of clipping plane to be created.
5833
5833
  * Default is {@link SimplePlane}.
5834
5834
  */
5835
- I(this, "Type", Li);
5835
+ I(this, "Type", Pi);
5836
5836
  /**
5837
5837
  * A list of all the clipping planes created by this component.
5838
5838
  */
@@ -6014,7 +6014,7 @@ const ve = class ve extends et {
6014
6014
  * This UUID is used to register the component within the Components system.
6015
6015
  */
6016
6016
  I(ve, "uuid", "66290bc5-18c4-4cd1-9379-2e17a0617611");
6017
- let An = ve;
6017
+ let Rn = ve;
6018
6018
  function br(l, s, t, e) {
6019
6019
  return new Promise((i, o) => {
6020
6020
  function n() {
@@ -6253,13 +6253,13 @@ class Vr extends Yr {
6253
6253
  let d = !0;
6254
6254
  const E = [];
6255
6255
  for (const u of o)
6256
- nn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
6256
+ sn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
6257
6257
  if (d) {
6258
6258
  n.dispose(), this.isProcessing = !1;
6259
6259
  return;
6260
6260
  }
6261
6261
  a = E;
6262
- } else if (nn.isTransparent(o)) {
6262
+ } else if (sn.isTransparent(o)) {
6263
6263
  n.dispose(), this.isProcessing = !1;
6264
6264
  return;
6265
6265
  } else
@@ -6568,7 +6568,7 @@ const Ss = class Ss extends et {
6568
6568
  * This UUID is used to register the component within the Components system.
6569
6569
  */
6570
6570
  I(Ss, "uuid", "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");
6571
- let Fn = Ss;
6571
+ let An = Ss;
6572
6572
  class zr {
6573
6573
  constructor(s) {
6574
6574
  /** {@link NavigationMode.enabled} */
@@ -6829,428 +6829,326 @@ class na extends He {
6829
6829
  this.threeOrtho.left = -a, this.threeOrtho.right = a, this.threeOrtho.top = r, this.threeOrtho.bottom = -r, this.threeOrtho.updateProjectionMatrix(), this.previousSize.copy(t);
6830
6830
  }
6831
6831
  }
6832
- const At = class At extends et {
6832
+ const Xr = /* @__PURE__ */ new Map([
6833
+ [
6834
+ b.IFCRELAGGREGATES,
6835
+ {
6836
+ forRelating: "IsDecomposedBy",
6837
+ forRelated: "Decomposes"
6838
+ }
6839
+ ],
6840
+ [
6841
+ b.IFCRELASSOCIATESMATERIAL,
6842
+ {
6843
+ forRelating: "AssociatedTo",
6844
+ forRelated: "HasAssociations"
6845
+ }
6846
+ ],
6847
+ [
6848
+ b.IFCRELASSOCIATESCLASSIFICATION,
6849
+ {
6850
+ forRelating: "ClassificationForObjects",
6851
+ forRelated: "HasAssociations"
6852
+ }
6853
+ ],
6854
+ [
6855
+ b.IFCRELASSIGNSTOGROUP,
6856
+ {
6857
+ forRelating: "IsGroupedBy",
6858
+ forRelated: "HasAssignments"
6859
+ }
6860
+ ],
6861
+ [
6862
+ b.IFCRELDEFINESBYPROPERTIES,
6863
+ {
6864
+ forRelated: "IsDefinedBy",
6865
+ forRelating: "DefinesOcurrence"
6866
+ }
6867
+ ],
6868
+ [
6869
+ b.IFCRELDEFINESBYTYPE,
6870
+ {
6871
+ forRelated: "IsTypedBy",
6872
+ forRelating: "Types"
6873
+ }
6874
+ ],
6875
+ [
6876
+ b.IFCRELDEFINESBYTEMPLATE,
6877
+ {
6878
+ forRelated: "IsDefinedBy",
6879
+ forRelating: "Defines"
6880
+ }
6881
+ ],
6882
+ [
6883
+ b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
6884
+ {
6885
+ forRelated: "ContainedInStructure",
6886
+ forRelating: "ContainsElements"
6887
+ }
6888
+ ]
6889
+ ]), Ye = class Ye extends et {
6833
6890
  constructor(t) {
6834
6891
  super(t);
6835
- /** {@link Component.enabled} */
6836
- I(this, "enabled", !0);
6837
6892
  /** {@link Disposable.onDisposed} */
6838
6893
  I(this, "onDisposed", new D());
6839
- I(this, "_absoluteMin");
6840
- I(this, "_absoluteMax");
6841
- I(this, "_meshes", []);
6842
- this.components.add(At.uuid, this), this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
6894
+ /**
6895
+ * Event triggered when relations for a model have been indexed.
6896
+ * This event provides the model's UUID and the relations map generated for that model.
6897
+ *
6898
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
6899
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
6900
+ * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
6901
+ */
6902
+ I(this, "onRelationsIndexed", new D());
6903
+ /**
6904
+ * Holds the relationship mappings for each model processed by the indexer.
6905
+ * The structure is a map where each key is a model's UUID, and the value is another map.
6906
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
6907
+ * representing a specific relation type, and the value is an array of expressIDs of entities
6908
+ * that are related through that relation type. This structure allows for efficient querying
6909
+ * of entity relationships within a model.
6910
+ */
6911
+ I(this, "relationMaps", {});
6912
+ /** {@link Component.enabled} */
6913
+ I(this, "enabled", !0);
6914
+ I(this, "_relToAttributesMap", Xr);
6915
+ I(this, "_inverseAttributes", [
6916
+ "IsDecomposedBy",
6917
+ "Decomposes",
6918
+ "AssociatedTo",
6919
+ "HasAssociations",
6920
+ "ClassificationForObjects",
6921
+ "IsGroupedBy",
6922
+ "HasAssignments",
6923
+ "IsDefinedBy",
6924
+ "DefinesOcurrence",
6925
+ "IsTypedBy",
6926
+ "Types",
6927
+ "Defines",
6928
+ "ContainedInStructure",
6929
+ "ContainsElements"
6930
+ ]);
6931
+ I(this, "_ifcRels", [
6932
+ b.IFCRELAGGREGATES,
6933
+ b.IFCRELASSOCIATESMATERIAL,
6934
+ b.IFCRELASSOCIATESCLASSIFICATION,
6935
+ b.IFCRELASSIGNSTOGROUP,
6936
+ b.IFCRELDEFINESBYPROPERTIES,
6937
+ b.IFCRELDEFINESBYTYPE,
6938
+ b.IFCRELDEFINESBYTEMPLATE,
6939
+ b.IFCRELCONTAINEDINSPATIALSTRUCTURE
6940
+ ]);
6941
+ I(this, "onFragmentsDisposed", (t) => {
6942
+ delete this.relationMaps[t.groupID];
6943
+ });
6944
+ this.components.add(Ye.uuid, this), t.get(ht).onFragmentsDisposed.add(this.onFragmentsDisposed);
6843
6945
  }
6844
- /**
6845
- * A static method to calculate the dimensions of a given bounding box.
6846
- *
6847
- * @param bbox - The bounding box to calculate the dimensions for.
6848
- * @returns An object containing the width, height, depth, and center of the bounding box.
6849
- */
6850
- static getDimensions(t) {
6851
- 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();
6852
- return a.subVectors(i, e).divideScalar(2).add(e), { width: o, height: n, depth: r, center: a };
6946
+ indexRelations(t, e, i, o) {
6947
+ const n = Object.keys(e).find(
6948
+ (E) => E.startsWith("Relating")
6949
+ ), r = Object.keys(e).find(
6950
+ (E) => E.startsWith("Related")
6951
+ );
6952
+ if (!(n && r))
6953
+ return;
6954
+ const a = e[n].value, c = e[r].map((E) => E.value), h = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
6955
+ h.set(d, c), t.set(a, h);
6956
+ for (const E of c) {
6957
+ const u = t.get(E) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(i), R = u.get(f) ?? [];
6958
+ R.push(a), u.set(f, R), t.set(E, u);
6959
+ }
6853
6960
  }
6854
6961
  /**
6855
- * A static method to create a new bounding box boundary.
6856
- *
6857
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
6858
- * @returns A new THREE.Vector3 representing the boundary.
6859
- *
6860
- * @remarks
6861
- * This method is used to create a new boundary for calculating bounding boxes.
6862
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
6863
- * depending on the value of the `positive` parameter.
6962
+ * Adds a relation map to the model's relations map.
6864
6963
  *
6865
- * @example
6866
- * ```typescript
6867
- * const positiveBound = BoundingBoxer.newBound(true);
6868
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
6964
+ * @param model - The `FragmentsGroup` model to which the relation map will be added.
6965
+ * @param relationMap - The `RelationsMap` to be added to the model's relations map.
6869
6966
  *
6870
- * const negativeBound = BoundingBoxer.newBound(false);
6871
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
6872
- * ```
6967
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
6873
6968
  */
6874
- static newBound(t) {
6875
- const e = t ? 1 : -1;
6876
- return new g.Vector3(
6877
- e * Number.MAX_VALUE,
6878
- e * Number.MAX_VALUE,
6879
- e * Number.MAX_VALUE
6880
- );
6969
+ setRelationMap(t, e) {
6970
+ this.relationMaps[t.uuid] = e, this.onRelationsIndexed.trigger({
6971
+ modelID: t.uuid,
6972
+ relationsMap: e
6973
+ });
6881
6974
  }
6882
6975
  /**
6883
- * A static method to calculate the bounding box of a set of points.
6884
- *
6885
- * @param points - An array of THREE.Vector3 representing the points.
6886
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
6887
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
6888
- * @returns A THREE.Box3 representing the bounding box of the given points.
6889
- *
6890
- * @remarks
6891
- * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
6892
- * If the `min` or `max` parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
6976
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
6977
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
6978
+ * and maps them in a structured way to facilitate quick access to related entities.
6893
6979
  *
6894
- * @example
6895
- * ```typescript
6896
- * const points = [
6897
- * new THREE.Vector3(1, 2, 3),
6898
- * new THREE.Vector3(4, 5, 6),
6899
- * new THREE.Vector3(7, 8, 9),
6900
- * ];
6980
+ * The process involves querying the model for each relation type associated with the inverse attributes
6981
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
6982
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
6983
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
6984
+ * of entities that are related through that attribute.
6901
6985
  *
6902
- * const bbox = BoundingBoxer.getBounds(points);
6903
- * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
6904
- * ```
6986
+ * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
6987
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
6988
+ * representation of the relations indexed by entity expressIDs and relation types.
6989
+ * @throws An error if the model does not have properties loaded.
6905
6990
  */
6906
- static getBounds(t, e, i) {
6907
- const o = i || this.newBound(!1), n = e || this.newBound(!0);
6908
- for (const r of t)
6909
- 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);
6910
- return new g.Box3(e, i);
6911
- }
6912
- /** {@link Disposable.dispose} */
6913
- dispose() {
6914
- const t = this.components.get(zt);
6915
- for (const e of this._meshes)
6916
- t.destroy(e);
6917
- this._meshes = [], this.onDisposed.trigger(At.uuid), this.onDisposed.reset();
6991
+ async process(t) {
6992
+ if (!t.hasProperties)
6993
+ throw new Error("FragmentsGroup properties not found");
6994
+ let e = this.relationMaps[t.uuid];
6995
+ if (e)
6996
+ return e;
6997
+ e = /* @__PURE__ */ new Map();
6998
+ for (const i of this._ifcRels) {
6999
+ const o = await t.getAllPropertiesOfType(i);
7000
+ if (!o)
7001
+ continue;
7002
+ const n = this._relToAttributesMap.get(i);
7003
+ if (!n)
7004
+ continue;
7005
+ const { forRelated: r, forRelating: a } = n;
7006
+ for (const c in o) {
7007
+ const h = o[c];
7008
+ this.indexRelations(e, h, r, a);
7009
+ }
7010
+ }
7011
+ return this.setRelationMap(t, e), e;
6918
7012
  }
6919
7013
  /**
6920
- * Returns the bounding box of the calculated fragments.
6921
- *
6922
- * @returns A new THREE.Box3 instance representing the bounding box.
6923
- *
6924
- * @remarks
6925
- * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
6926
- * The returned box represents the bounding box of the calculated fragments.
7014
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
6927
7015
  *
6928
- * @example
6929
- * ```typescript
6930
- * const boundingBox = boundingBoxer.get();
6931
- * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
6932
- * ```
6933
- */
6934
- get() {
6935
- const t = this._absoluteMin.clone(), e = this._absoluteMax.clone();
6936
- return new g.Box3(t, e);
6937
- }
6938
- /**
6939
- * Calculates and returns a sphere that encompasses the entire bounding box.
6940
- *
6941
- * @returns A new THREE.Sphere instance representing the calculated sphere.
6942
- *
6943
- * @remarks
6944
- * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
6945
- * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
6946
- * The radius is calculated as the distance from the center to the minimum bound.
6947
- *
6948
- * @example
6949
- * ```typescript
6950
- * const boundingBoxer = components.get(BoundingBoxer);
6951
- * boundingBoxer.add(fragmentsGroup);
6952
- * const boundingSphere = boundingBoxer.getSphere();
6953
- * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
6954
- * ```
6955
- */
6956
- getSphere() {
6957
- 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);
6958
- return new g.Sphere(r, a);
6959
- }
6960
- /**
6961
- * Returns a THREE.Mesh instance representing the bounding box.
6962
- *
6963
- * @returns A new THREE.Mesh instance representing the bounding box.
6964
- *
6965
- * @remarks
6966
- * This method calculates the dimensions of the bounding box using the `getDimensions` method.
6967
- * It then creates a new THREE.BoxGeometry with the calculated dimensions.
6968
- * A new THREE.Mesh is created using the box geometry, and it is added to the `_meshes` array.
6969
- * The position of the mesh is set to the center of the bounding box.
6970
- *
6971
- * @example
6972
- * ```typescript
6973
- * const boundingBoxer = components.get(BoundingBoxer);
6974
- * boundingBoxer.add(fragmentsGroup);
6975
- * const boundingBoxMesh = boundingBoxer.getMesh();
6976
- * scene.add(boundingBoxMesh);
6977
- * ```
6978
- */
6979
- getMesh() {
6980
- 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);
6981
- return this._meshes.push(c), c.position.copy(r), c;
6982
- }
6983
- /**
6984
- * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
6985
- * This method is used to prepare the BoundingBoxer for a new set of fragments.
6986
- *
6987
- * @remarks
6988
- * This method is called when a new set of fragments is added to the BoundingBoxer.
6989
- * It ensures that the bounding box calculations are accurate and up-to-date.
6990
- *
6991
- * @example
6992
- * ```typescript
6993
- * const boundingBoxer = components.get(BoundingBoxer);
6994
- * boundingBoxer.add(fragmentsGroup);
6995
- * // ...
6996
- * boundingBoxer.reset();
6997
- * ```
7016
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
7017
+ * @param modelID - The unique identifier of the model within the WebIfc API.
7018
+ * @returns A promise that resolves to the relations map for the processed model.
7019
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
6998
7020
  */
6999
- reset() {
7000
- this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
7021
+ async processFromWebIfc(t, e) {
7022
+ const i = /* @__PURE__ */ new Map();
7023
+ for (const o of this._ifcRels) {
7024
+ const n = this._relToAttributesMap.get(o);
7025
+ if (!n)
7026
+ continue;
7027
+ const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
7028
+ for (let h = 0; h < c.size(); h++) {
7029
+ const d = await t.properties.getItemProperties(
7030
+ e,
7031
+ c.get(h)
7032
+ );
7033
+ this.indexRelations(i, d, r, a);
7034
+ }
7035
+ }
7036
+ return this.onRelationsIndexed.trigger({
7037
+ modelID: e.toString(),
7038
+ relationsMap: i
7039
+ }), i;
7001
7040
  }
7002
7041
  /**
7003
- * Adds a FragmentsGroup to the BoundingBoxer.
7004
- *
7005
- * @param group - The FragmentsGroup to add.
7006
- *
7007
- * @remarks
7008
- * This method iterates through each fragment in the provided FragmentsGroup,
7009
- * and calls the `addMesh` method for each fragment's mesh.
7042
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
7043
+ * This method searches the indexed relation maps for the specified model and entity,
7044
+ * returning the IDs of related entities if a match is found.
7010
7045
  *
7011
- * @example
7012
- * ```typescript
7013
- * const boundingBoxer = components.get(BoundingBoxer);
7014
- * boundingBoxer.add(fragmentsGroup);
7015
- * ```
7046
+ * @param model The `FragmentsGroup` model containing the entity.
7047
+ * @param expressID The unique identifier of the entity within the model.
7048
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
7049
+ * @returns An array of express IDs representing the related entities, or `null` if no relations are found
7050
+ * or the specified relation name is not indexed.
7016
7051
  */
7017
- add(t) {
7018
- for (const e of t.items)
7019
- this.addMesh(e.mesh);
7052
+ getEntityRelations(t, e, i) {
7053
+ const o = this.relationMaps[t.uuid];
7054
+ if (!o)
7055
+ return null;
7056
+ const n = o.get(e), r = this._inverseAttributes.indexOf(i);
7057
+ if (!n || r === -1)
7058
+ return null;
7059
+ const a = n.get(r);
7060
+ return a || null;
7020
7061
  }
7021
7062
  /**
7022
- * Adds a mesh to the BoundingBoxer and calculates the bounding box.
7023
- *
7024
- * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
7025
- * @param itemIDs - An optional iterable of numbers representing the item IDs.
7026
- *
7027
- * @remarks
7028
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
7029
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
7030
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
7031
- *
7032
- * @example
7033
- * ```typescript
7034
- * const boundingBoxer = components.get(BoundingBoxer);
7035
- * boundingBoxer.addMesh(mesh);
7036
- * ```
7037
- */
7038
- addMesh(t, e) {
7039
- if (!t.geometry.index)
7040
- return;
7041
- const i = At.getFragmentBounds(t);
7042
- t.updateMatrixWorld();
7043
- const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
7044
- if (e && t instanceof Vt.FragmentMesh)
7045
- for (const c of e) {
7046
- const h = t.fragment.getInstancesIDs(c);
7047
- if (h)
7048
- for (const d of h)
7049
- a.add(d);
7050
- }
7051
- else
7052
- a.add(0);
7053
- for (const c of a) {
7054
- const h = i.min.clone(), d = i.max.clone();
7055
- r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
7056
- }
7057
- }
7058
- static getFragmentBounds(t) {
7059
- 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);
7060
- if (!t.geometry.index)
7061
- throw new Error("Geometry must be indexed!");
7062
- const a = Array.from(t.geometry.index.array);
7063
- for (let c = 0; c < a.length; c++) {
7064
- if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
7065
- c += 2;
7066
- continue;
7067
- }
7068
- const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
7069
- 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);
7070
- }
7071
- return new g.Box3(n, r);
7072
- }
7073
- };
7074
- I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
7075
- let mi = At;
7076
- const vn = /* @__PURE__ */ new Set([
7077
- 1123145078,
7078
- 574549367,
7079
- 1675464909,
7080
- 2059837836,
7081
- 3798115385,
7082
- 32440307,
7083
- 3125803723,
7084
- 3207858831,
7085
- 2740243338,
7086
- 2624227202,
7087
- 4240577450,
7088
- 3615266464,
7089
- 3724593414,
7090
- 220341763,
7091
- 477187591,
7092
- 1878645084,
7093
- 1300840506,
7094
- 3303107099,
7095
- 1607154358,
7096
- 1878645084,
7097
- 846575682,
7098
- 1351298697,
7099
- 2417041796,
7100
- 3049322572,
7101
- 3331915920,
7102
- 1416205885,
7103
- 776857604,
7104
- 3285139300,
7105
- 3958052878,
7106
- 2827736869,
7107
- 2732653382,
7108
- 673634403,
7109
- 3448662350,
7110
- 4142052618,
7111
- 2924175390,
7112
- 803316827,
7113
- 2556980723,
7114
- 1809719519,
7115
- 2205249479,
7116
- 807026263,
7117
- 3737207727,
7118
- 1660063152,
7119
- 2347385850,
7120
- 3940055652,
7121
- 2705031697,
7122
- 3732776249,
7123
- 2485617015,
7124
- 2611217952,
7125
- 1704287377,
7126
- 2937912522,
7127
- 2770003689,
7128
- 1281925730,
7129
- 1484403080,
7130
- 3448662350,
7131
- 4142052618,
7132
- 3800577675,
7133
- 4006246654,
7134
- 3590301190,
7135
- 1383045692,
7136
- 2775532180,
7137
- 2047409740,
7138
- 370225590,
7139
- 3593883385,
7140
- 2665983363,
7141
- 4124623270,
7142
- 812098782,
7143
- 3649129432,
7144
- 987898635,
7145
- 1105321065,
7146
- 3510044353,
7147
- 1635779807,
7148
- 2603310189,
7149
- 3406155212,
7150
- 1310608509,
7151
- 4261334040,
7152
- 2736907675,
7153
- 3649129432,
7154
- 1136057603,
7155
- 1260505505,
7156
- 4182860854,
7157
- 2713105998,
7158
- 2898889636,
7159
- 59481748,
7160
- 3749851601,
7161
- 3486308946,
7162
- 3150382593,
7163
- 1062206242,
7164
- 3264961684,
7165
- 15328376,
7166
- 1485152156,
7167
- 370225590,
7168
- 1981873012,
7169
- 2859738748,
7170
- 45288368,
7171
- 2614616156,
7172
- 2732653382,
7173
- 775493141,
7174
- 2147822146,
7175
- 2601014836,
7176
- 2629017746,
7177
- 1186437898,
7178
- 2367409068,
7179
- 1213902940,
7180
- 3632507154,
7181
- 3900360178,
7182
- 476780140,
7183
- 1472233963,
7184
- 2804161546,
7185
- 3008276851,
7186
- 738692330,
7187
- 374418227,
7188
- 315944413,
7189
- 3905492369,
7190
- 3570813810,
7191
- 2571569899,
7192
- 178912537,
7193
- 2294589976,
7194
- 1437953363,
7195
- 2133299955,
7196
- 572779678,
7197
- 3092502836,
7198
- 388784114,
7199
- 2624227202,
7200
- 1425443689,
7201
- 3057273783,
7202
- 2347385850,
7203
- 1682466193,
7204
- 2519244187,
7205
- 2839578677,
7206
- 3958567839,
7207
- 2513912981,
7208
- 2830218821,
7209
- 427810014
7210
- ]), Ns = class Ns extends et {
7211
- constructor(t) {
7212
- super(t);
7213
- /** {@link Component.enabled} */
7214
- I(this, "enabled", !0);
7215
- t.add(Ns.uuid, this);
7063
+ * Serializes the relations of a given relation map into a JSON string.
7064
+ * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
7065
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
7066
+ * The resulting object is then serialized into a JSON string.
7067
+ *
7068
+ * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
7069
+ * @returns A JSON string representing the serialized relations of the given relation map.
7070
+ */
7071
+ serializeRelations(t) {
7072
+ const e = {};
7073
+ for (const [i, o] of t.entries()) {
7074
+ e[i] || (e[i] = {});
7075
+ for (const [n, r] of o.entries())
7076
+ e[i][n] = r;
7077
+ }
7078
+ return JSON.stringify(e);
7216
7079
  }
7217
7080
  /**
7218
- * Exports all the properties of an IFC into an array of JS objects.
7219
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
7220
- * @param modelID ID of the IFC model whose properties to extract.
7221
- * @param indirect whether to get the indirect relationships as well.
7222
- * @param recursiveSpatial whether to get the properties of spatial items recursively
7223
- * to make the location data available (e.g. absolute position of building).
7081
+ * Serializes the relations of a specific model into a JSON string.
7082
+ * This method iterates through the relations indexed for the given model,
7083
+ * organizing them into a structured object where each key is an expressID of an entity,
7084
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
7085
+ * The resulting object is then serialized into a JSON string.
7086
+ *
7087
+ * @param model The `FragmentsGroup` model whose relations are to be serialized.
7088
+ * @returns A JSON string representing the serialized relations of the specified model.
7089
+ * If the model has no indexed relations, `null` is returned.
7224
7090
  */
7225
- async export(t, e, i = !1, o = !0) {
7226
- const n = {}, r = new Set(t.GetIfcEntityList(e)), a = /* @__PURE__ */ new Set([
7227
- b.IFCPROJECT,
7228
- b.IFCSITE,
7229
- b.IFCBUILDING,
7230
- b.IFCBUILDINGSTOREY,
7231
- b.IFCSPACE
7232
- ]);
7233
- for (const c of a)
7234
- r.add(c);
7235
- for (const c of r) {
7236
- if (vn.has(c))
7237
- continue;
7238
- const h = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
7239
- for (const E of d) {
7240
- const u = t.GetLine(0, E, h, i);
7241
- n[u.expressID] = u;
7091
+ serializeModelRelations(t) {
7092
+ const e = this.relationMaps[t.uuid];
7093
+ return e ? this.serializeRelations(e) : null;
7094
+ }
7095
+ /**
7096
+ * Serializes all relations of every model processed by the indexer into a JSON string.
7097
+ * This method iterates through each model's relations indexed in `relationMaps`, organizing them
7098
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
7099
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
7100
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
7101
+ *
7102
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
7103
+ * If no relations have been indexed, an empty object is returned as a JSON string.
7104
+ */
7105
+ serializeAllRelations() {
7106
+ const t = {};
7107
+ for (const e in this.relationMaps) {
7108
+ const i = this.relationMaps[e], o = {};
7109
+ for (const [n, r] of i.entries()) {
7110
+ o[n] || (o[n] = {});
7111
+ for (const [a, c] of r.entries())
7112
+ o[n][a] = c;
7242
7113
  }
7114
+ t[e] = o;
7243
7115
  }
7244
- return n;
7116
+ return JSON.stringify(t);
7117
+ }
7118
+ /**
7119
+ * Converts a JSON string representing relations between entities into a structured map.
7120
+ * This method parses the JSON string to reconstruct the relations map that indexes
7121
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
7122
+ * and the values are maps where each key is a relation type ID and its value is an array
7123
+ * of express IDs of entities related through that relation type.
7124
+ *
7125
+ * @param json The JSON string to be parsed into the relations map.
7126
+ * @returns A `Map` where the key is the express ID of an entity as a number, and the value
7127
+ * is another `Map`. This inner map's key is the relation type ID as a number, and its value
7128
+ * is an array of express IDs (as numbers) of entities related through that relation type.
7129
+ */
7130
+ getRelationsMapFromJSON(t) {
7131
+ const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
7132
+ for (const o in e) {
7133
+ const n = e[o], r = /* @__PURE__ */ new Map();
7134
+ for (const a in n)
7135
+ r.set(Number(a), n[a]);
7136
+ i.set(Number(o), r);
7137
+ }
7138
+ return i;
7139
+ }
7140
+ /** {@link Disposable.dispose} */
7141
+ dispose() {
7142
+ this.relationMaps = {}, this.components.get(ht).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ye.uuid), this.onDisposed.reset();
7245
7143
  }
7246
7144
  };
7247
7145
  /**
7248
7146
  * A unique identifier for the component.
7249
7147
  * This UUID is used to register the component within the Components system.
7250
7148
  */
7251
- I(Ns, "uuid", "b32c4332-cd67-436e-ba7f-196646c7a635");
7252
- let Ri = Ns;
7253
- const Ps = class Ps extends et {
7149
+ I(Ye, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
7150
+ let ke = Ye;
7151
+ const Ns = class Ns extends et {
7254
7152
  constructor(t) {
7255
7153
  super(t);
7256
7154
  /** {@link Disposable.onDisposed} */
@@ -7277,7 +7175,7 @@ const Ps = class Ps extends et {
7277
7175
  /** {@link Component.enabled} */
7278
7176
  I(this, "enabled", !0);
7279
7177
  I(this, "_loader", new to());
7280
- this.components.add(Ps.uuid, this);
7178
+ this.components.add(Ns.uuid, this);
7281
7179
  }
7282
7180
  /**
7283
7181
  * Getter for the meshes of all fragments in the FragmentsManager.
@@ -7408,327 +7306,460 @@ const Ps = class Ps extends et {
7408
7306
  * A unique identifier for the component.
7409
7307
  * This UUID is used to register the component within the Components system.
7410
7308
  */
7411
- I(Ps, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
7412
- let Et = Ps;
7413
- const Xr = /* @__PURE__ */ new Map([
7414
- [
7415
- b.IFCRELAGGREGATES,
7416
- {
7417
- forRelating: "IsDecomposedBy",
7418
- forRelated: "Decomposes"
7419
- }
7420
- ],
7421
- [
7422
- b.IFCRELASSOCIATESMATERIAL,
7423
- {
7424
- forRelating: "AssociatedTo",
7425
- forRelated: "HasAssociations"
7426
- }
7427
- ],
7428
- [
7429
- b.IFCRELASSOCIATESCLASSIFICATION,
7430
- {
7431
- forRelating: "ClassificationForObjects",
7432
- forRelated: "HasAssociations"
7433
- }
7434
- ],
7435
- [
7436
- b.IFCRELASSIGNSTOGROUP,
7437
- {
7438
- forRelating: "IsGroupedBy",
7439
- forRelated: "HasAssignments"
7440
- }
7441
- ],
7442
- [
7443
- b.IFCRELDEFINESBYPROPERTIES,
7444
- {
7445
- forRelated: "IsDefinedBy",
7446
- forRelating: "DefinesOcurrence"
7447
- }
7448
- ],
7449
- [
7450
- b.IFCRELDEFINESBYTYPE,
7451
- {
7452
- forRelated: "IsTypedBy",
7453
- forRelating: "Types"
7454
- }
7455
- ],
7456
- [
7457
- b.IFCRELDEFINESBYTEMPLATE,
7458
- {
7459
- forRelated: "IsDefinedBy",
7460
- forRelating: "Defines"
7461
- }
7462
- ],
7463
- [
7464
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
7465
- {
7466
- forRelated: "ContainedInStructure",
7467
- forRelating: "ContainsElements"
7468
- }
7469
- ]
7470
- ]), Ye = class Ye extends et {
7309
+ I(Ns, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
7310
+ let ht = Ns;
7311
+ const At = class At extends et {
7471
7312
  constructor(t) {
7472
7313
  super(t);
7473
- /** {@link Disposable.onDisposed} */
7474
- I(this, "onDisposed", new D());
7475
- /**
7476
- * Event triggered when relations for a model have been indexed.
7477
- * This event provides the model's UUID and the relations map generated for that model.
7478
- *
7479
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
7480
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
7481
- * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
7482
- */
7483
- I(this, "onRelationsIndexed", new D());
7484
- /**
7485
- * Holds the relationship mappings for each model processed by the indexer.
7486
- * The structure is a map where each key is a model's UUID, and the value is another map.
7487
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
7488
- * representing a specific relation type, and the value is an array of expressIDs of entities
7489
- * that are related through that relation type. This structure allows for efficient querying
7490
- * of entity relationships within a model.
7491
- */
7492
- I(this, "relationMaps", {});
7493
7314
  /** {@link Component.enabled} */
7494
7315
  I(this, "enabled", !0);
7495
- I(this, "_relToAttributesMap", Xr);
7496
- I(this, "_inverseAttributes", [
7497
- "IsDecomposedBy",
7498
- "Decomposes",
7499
- "AssociatedTo",
7500
- "HasAssociations",
7501
- "ClassificationForObjects",
7502
- "IsGroupedBy",
7503
- "HasAssignments",
7504
- "IsDefinedBy",
7505
- "DefinesOcurrence",
7506
- "IsTypedBy",
7507
- "Types",
7508
- "Defines",
7509
- "ContainedInStructure",
7510
- "ContainsElements"
7511
- ]);
7512
- I(this, "_ifcRels", [
7513
- b.IFCRELAGGREGATES,
7514
- b.IFCRELASSOCIATESMATERIAL,
7515
- b.IFCRELASSOCIATESCLASSIFICATION,
7516
- b.IFCRELASSIGNSTOGROUP,
7517
- b.IFCRELDEFINESBYPROPERTIES,
7518
- b.IFCRELDEFINESBYTYPE,
7519
- b.IFCRELDEFINESBYTEMPLATE,
7520
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE
7521
- ]);
7522
- I(this, "onFragmentsDisposed", (t) => {
7523
- delete this.relationMaps[t.groupID];
7524
- });
7525
- this.components.add(Ye.uuid, this), t.get(Et).onFragmentsDisposed.add(this.onFragmentsDisposed);
7316
+ /** {@link Disposable.onDisposed} */
7317
+ I(this, "onDisposed", new D());
7318
+ I(this, "_absoluteMin");
7319
+ I(this, "_absoluteMax");
7320
+ I(this, "_meshes", []);
7321
+ this.components.add(At.uuid, this), this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
7526
7322
  }
7527
- indexRelations(t, e, i, o) {
7528
- const n = Object.keys(e).find(
7529
- (E) => E.startsWith("Relating")
7530
- ), r = Object.keys(e).find(
7531
- (E) => E.startsWith("Related")
7323
+ /**
7324
+ * A static method to calculate the dimensions of a given bounding box.
7325
+ *
7326
+ * @param bbox - The bounding box to calculate the dimensions for.
7327
+ * @returns An object containing the width, height, depth, and center of the bounding box.
7328
+ */
7329
+ static getDimensions(t) {
7330
+ 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();
7331
+ return a.subVectors(i, e).divideScalar(2).add(e), { width: o, height: n, depth: r, center: a };
7332
+ }
7333
+ /**
7334
+ * A static method to create a new bounding box boundary.
7335
+ *
7336
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
7337
+ * @returns A new THREE.Vector3 representing the boundary.
7338
+ *
7339
+ * @remarks
7340
+ * This method is used to create a new boundary for calculating bounding boxes.
7341
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
7342
+ * depending on the value of the `positive` parameter.
7343
+ *
7344
+ * @example
7345
+ * ```typescript
7346
+ * const positiveBound = BoundingBoxer.newBound(true);
7347
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
7348
+ *
7349
+ * const negativeBound = BoundingBoxer.newBound(false);
7350
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
7351
+ * ```
7352
+ */
7353
+ static newBound(t) {
7354
+ const e = t ? 1 : -1;
7355
+ return new g.Vector3(
7356
+ e * Number.MAX_VALUE,
7357
+ e * Number.MAX_VALUE,
7358
+ e * Number.MAX_VALUE
7532
7359
  );
7533
- if (!(n && r))
7534
- return;
7535
- const a = e[n].value, c = e[r].map((E) => E.value), h = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
7536
- h.set(d, c), t.set(a, h);
7537
- for (const E of c) {
7538
- const u = t.get(E) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(i), R = u.get(f) ?? [];
7539
- R.push(a), u.set(f, R), t.set(E, u);
7540
- }
7541
7360
  }
7542
7361
  /**
7543
- * Adds a relation map to the model's relations map.
7362
+ * A static method to calculate the bounding box of a set of points.
7544
7363
  *
7545
- * @param model - The `FragmentsGroup` model to which the relation map will be added.
7546
- * @param relationMap - The `RelationsMap` to be added to the model's relations map.
7364
+ * @param points - An array of THREE.Vector3 representing the points.
7365
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
7366
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
7367
+ * @returns A THREE.Box3 representing the bounding box of the given points.
7547
7368
  *
7548
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
7369
+ * @remarks
7370
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
7371
+ * If the `min` or `max` parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
7372
+ *
7373
+ * @example
7374
+ * ```typescript
7375
+ * const points = [
7376
+ * new THREE.Vector3(1, 2, 3),
7377
+ * new THREE.Vector3(4, 5, 6),
7378
+ * new THREE.Vector3(7, 8, 9),
7379
+ * ];
7380
+ *
7381
+ * const bbox = BoundingBoxer.getBounds(points);
7382
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
7383
+ * ```
7549
7384
  */
7550
- setRelationMap(t, e) {
7551
- this.relationMaps[t.uuid] = e, this.onRelationsIndexed.trigger({
7552
- modelID: t.uuid,
7553
- relationsMap: e
7554
- });
7385
+ static getBounds(t, e, i) {
7386
+ const o = i || this.newBound(!1), n = e || this.newBound(!0);
7387
+ for (const r of t)
7388
+ 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);
7389
+ return new g.Box3(e, i);
7390
+ }
7391
+ /** {@link Disposable.dispose} */
7392
+ dispose() {
7393
+ const t = this.components.get(zt);
7394
+ for (const e of this._meshes)
7395
+ t.destroy(e);
7396
+ this._meshes = [], this.onDisposed.trigger(At.uuid), this.onDisposed.reset();
7555
7397
  }
7556
7398
  /**
7557
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
7558
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
7559
- * and maps them in a structured way to facilitate quick access to related entities.
7399
+ * Returns the bounding box of the calculated fragments.
7560
7400
  *
7561
- * The process involves querying the model for each relation type associated with the inverse attributes
7562
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
7563
- * and contains a nested map where each key is an entity's expressID and its value is another map.
7564
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
7565
- * of entities that are related through that attribute.
7401
+ * @returns A new THREE.Box3 instance representing the bounding box.
7566
7402
  *
7567
- * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
7568
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
7569
- * representation of the relations indexed by entity expressIDs and relation types.
7570
- * @throws An error if the model does not have properties loaded.
7403
+ * @remarks
7404
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
7405
+ * The returned box represents the bounding box of the calculated fragments.
7406
+ *
7407
+ * @example
7408
+ * ```typescript
7409
+ * const boundingBox = boundingBoxer.get();
7410
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
7411
+ * ```
7571
7412
  */
7572
- async process(t) {
7573
- if (!t.hasProperties)
7574
- throw new Error("FragmentsGroup properties not found");
7575
- let e = this.relationMaps[t.uuid];
7576
- if (e)
7577
- return e;
7578
- e = /* @__PURE__ */ new Map();
7579
- for (const i of this._ifcRels) {
7580
- const o = await t.getAllPropertiesOfType(i);
7581
- if (!o)
7582
- continue;
7583
- const n = this._relToAttributesMap.get(i);
7584
- if (!n)
7585
- continue;
7586
- const { forRelated: r, forRelating: a } = n;
7587
- for (const c in o) {
7588
- const h = o[c];
7589
- this.indexRelations(e, h, r, a);
7590
- }
7591
- }
7592
- return this.setRelationMap(t, e), e;
7413
+ get() {
7414
+ const t = this._absoluteMin.clone(), e = this._absoluteMax.clone();
7415
+ return new g.Box3(t, e);
7593
7416
  }
7594
7417
  /**
7595
- * Processes a given model from a WebIfc API to index its IFC entities relations.
7418
+ * Calculates and returns a sphere that encompasses the entire bounding box.
7596
7419
  *
7597
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
7598
- * @param modelID - The unique identifier of the model within the WebIfc API.
7599
- * @returns A promise that resolves to the relations map for the processed model.
7600
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
7420
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
7421
+ *
7422
+ * @remarks
7423
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
7424
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
7425
+ * The radius is calculated as the distance from the center to the minimum bound.
7426
+ *
7427
+ * @example
7428
+ * ```typescript
7429
+ * const boundingBoxer = components.get(BoundingBoxer);
7430
+ * boundingBoxer.add(fragmentsGroup);
7431
+ * const boundingSphere = boundingBoxer.getSphere();
7432
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
7433
+ * ```
7601
7434
  */
7602
- async processFromWebIfc(t, e) {
7603
- const i = /* @__PURE__ */ new Map();
7604
- for (const o of this._ifcRels) {
7605
- const n = this._relToAttributesMap.get(o);
7606
- if (!n)
7607
- continue;
7608
- const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
7609
- for (let h = 0; h < c.size(); h++) {
7610
- const d = await t.properties.getItemProperties(
7611
- e,
7612
- c.get(h)
7613
- );
7614
- this.indexRelations(i, d, r, a);
7615
- }
7616
- }
7617
- return this.onRelationsIndexed.trigger({
7618
- modelID: e.toString(),
7619
- relationsMap: i
7620
- }), i;
7435
+ getSphere() {
7436
+ 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);
7437
+ return new g.Sphere(r, a);
7621
7438
  }
7622
7439
  /**
7623
- * Retrieves the relations of a specific entity within a model based on the given relation name.
7624
- * This method searches the indexed relation maps for the specified model and entity,
7625
- * returning the IDs of related entities if a match is found.
7440
+ * Returns a THREE.Mesh instance representing the bounding box.
7626
7441
  *
7627
- * @param model The `FragmentsGroup` model containing the entity.
7628
- * @param expressID The unique identifier of the entity within the model.
7629
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
7630
- * @returns An array of express IDs representing the related entities, or `null` if no relations are found
7631
- * or the specified relation name is not indexed.
7442
+ * @returns A new THREE.Mesh instance representing the bounding box.
7443
+ *
7444
+ * @remarks
7445
+ * This method calculates the dimensions of the bounding box using the `getDimensions` method.
7446
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
7447
+ * A new THREE.Mesh is created using the box geometry, and it is added to the `_meshes` array.
7448
+ * The position of the mesh is set to the center of the bounding box.
7449
+ *
7450
+ * @example
7451
+ * ```typescript
7452
+ * const boundingBoxer = components.get(BoundingBoxer);
7453
+ * boundingBoxer.add(fragmentsGroup);
7454
+ * const boundingBoxMesh = boundingBoxer.getMesh();
7455
+ * scene.add(boundingBoxMesh);
7456
+ * ```
7632
7457
  */
7633
- getEntityRelations(t, e, i) {
7634
- const o = this.relationMaps[t.uuid];
7635
- if (!o)
7636
- return null;
7637
- const n = o.get(e), r = this._inverseAttributes.indexOf(i);
7638
- if (!n || r === -1)
7639
- return null;
7640
- const a = n.get(r);
7641
- return a || null;
7458
+ getMesh() {
7459
+ 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);
7460
+ return this._meshes.push(c), c.position.copy(r), c;
7642
7461
  }
7643
7462
  /**
7644
- * Serializes the relations of a given relation map into a JSON string.
7645
- * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
7646
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
7647
- * The resulting object is then serialized into a JSON string.
7463
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
7464
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
7648
7465
  *
7649
- * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
7650
- * @returns A JSON string representing the serialized relations of the given relation map.
7466
+ * @remarks
7467
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
7468
+ * It ensures that the bounding box calculations are accurate and up-to-date.
7469
+ *
7470
+ * @example
7471
+ * ```typescript
7472
+ * const boundingBoxer = components.get(BoundingBoxer);
7473
+ * boundingBoxer.add(fragmentsGroup);
7474
+ * // ...
7475
+ * boundingBoxer.reset();
7476
+ * ```
7651
7477
  */
7652
- serializeRelations(t) {
7653
- const e = {};
7654
- for (const [i, o] of t.entries()) {
7655
- e[i] || (e[i] = {});
7656
- for (const [n, r] of o.entries())
7657
- e[i][n] = r;
7658
- }
7659
- return JSON.stringify(e);
7478
+ reset() {
7479
+ this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
7660
7480
  }
7661
7481
  /**
7662
- * Serializes the relations of a specific model into a JSON string.
7663
- * This method iterates through the relations indexed for the given model,
7664
- * organizing them into a structured object where each key is an expressID of an entity,
7665
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
7666
- * The resulting object is then serialized into a JSON string.
7482
+ * Adds a FragmentsGroup to the BoundingBoxer.
7667
7483
  *
7668
- * @param model The `FragmentsGroup` model whose relations are to be serialized.
7669
- * @returns A JSON string representing the serialized relations of the specified model.
7670
- * If the model has no indexed relations, `null` is returned.
7484
+ * @param group - The FragmentsGroup to add.
7485
+ *
7486
+ * @remarks
7487
+ * This method iterates through each fragment in the provided FragmentsGroup,
7488
+ * and calls the `addMesh` method for each fragment's mesh.
7489
+ *
7490
+ * @example
7491
+ * ```typescript
7492
+ * const boundingBoxer = components.get(BoundingBoxer);
7493
+ * boundingBoxer.add(fragmentsGroup);
7494
+ * ```
7671
7495
  */
7672
- serializeModelRelations(t) {
7673
- const e = this.relationMaps[t.uuid];
7674
- return e ? this.serializeRelations(e) : null;
7496
+ add(t) {
7497
+ for (const e of t.items)
7498
+ this.addMesh(e.mesh);
7499
+ }
7500
+ /**
7501
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
7502
+ *
7503
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
7504
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
7505
+ *
7506
+ * @remarks
7507
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
7508
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
7509
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
7510
+ *
7511
+ * @example
7512
+ * ```typescript
7513
+ * const boundingBoxer = components.get(BoundingBoxer);
7514
+ * boundingBoxer.addMesh(mesh);
7515
+ * ```
7516
+ */
7517
+ addMesh(t, e) {
7518
+ if (!t.geometry.index)
7519
+ return;
7520
+ const i = At.getFragmentBounds(t);
7521
+ t.updateMatrixWorld();
7522
+ const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
7523
+ if (e && t instanceof Vt.FragmentMesh)
7524
+ for (const c of e) {
7525
+ const h = t.fragment.getInstancesIDs(c);
7526
+ if (h)
7527
+ for (const d of h)
7528
+ a.add(d);
7529
+ }
7530
+ else
7531
+ a.add(0);
7532
+ for (const c of a) {
7533
+ const h = i.min.clone(), d = i.max.clone();
7534
+ r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
7535
+ }
7675
7536
  }
7676
7537
  /**
7677
- * Serializes all relations of every model processed by the indexer into a JSON string.
7678
- * This method iterates through each model's relations indexed in `relationMaps`, organizing them
7679
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
7680
- * and its value is another object mapping entity expressIDs to their related entities, categorized
7681
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
7538
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
7682
7539
  *
7683
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
7684
- * If no relations have been indexed, an empty object is returned as a JSON string.
7540
+ * This method iterates through the provided `fragmentIdMap`, retrieves the corresponding fragment from the `FragmentsManager`,
7541
+ * and then calls the `addMesh` method for each fragment's mesh, passing the expression IDs as the second parameter.
7542
+ *
7543
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
7544
+ *
7545
+ * @remarks
7546
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
7547
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
7548
+ *
7549
+ * @example
7550
+ * ```typescript
7551
+ * const boundingBoxer = components.get(BoundingBoxer);
7552
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
7553
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
7554
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
7555
+ * };
7556
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
7557
+ * ```
7685
7558
  */
7686
- serializeAllRelations() {
7687
- const t = {};
7688
- for (const e in this.relationMaps) {
7689
- const i = this.relationMaps[e], o = {};
7690
- for (const [n, r] of i.entries()) {
7691
- o[n] || (o[n] = {});
7692
- for (const [a, c] of r.entries())
7693
- o[n][a] = c;
7559
+ addFragmentIdMap(t) {
7560
+ const e = this.components.get(ht);
7561
+ for (const i in t) {
7562
+ const o = e.list.get(i);
7563
+ if (!o)
7564
+ continue;
7565
+ const n = t[i];
7566
+ this.addMesh(o.mesh, n);
7567
+ }
7568
+ }
7569
+ static getFragmentBounds(t) {
7570
+ 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);
7571
+ if (!t.geometry.index)
7572
+ throw new Error("Geometry must be indexed!");
7573
+ const a = Array.from(t.geometry.index.array);
7574
+ for (let c = 0; c < a.length; c++) {
7575
+ if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
7576
+ c += 2;
7577
+ continue;
7694
7578
  }
7695
- t[e] = o;
7579
+ const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
7580
+ 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);
7696
7581
  }
7697
- return JSON.stringify(t);
7582
+ return new g.Box3(n, r);
7583
+ }
7584
+ };
7585
+ I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
7586
+ let Fn = At;
7587
+ const vn = /* @__PURE__ */ new Set([
7588
+ 1123145078,
7589
+ 574549367,
7590
+ 1675464909,
7591
+ 2059837836,
7592
+ 3798115385,
7593
+ 32440307,
7594
+ 3125803723,
7595
+ 3207858831,
7596
+ 2740243338,
7597
+ 2624227202,
7598
+ 4240577450,
7599
+ 3615266464,
7600
+ 3724593414,
7601
+ 220341763,
7602
+ 477187591,
7603
+ 1878645084,
7604
+ 1300840506,
7605
+ 3303107099,
7606
+ 1607154358,
7607
+ 1878645084,
7608
+ 846575682,
7609
+ 1351298697,
7610
+ 2417041796,
7611
+ 3049322572,
7612
+ 3331915920,
7613
+ 1416205885,
7614
+ 776857604,
7615
+ 3285139300,
7616
+ 3958052878,
7617
+ 2827736869,
7618
+ 2732653382,
7619
+ 673634403,
7620
+ 3448662350,
7621
+ 4142052618,
7622
+ 2924175390,
7623
+ 803316827,
7624
+ 2556980723,
7625
+ 1809719519,
7626
+ 2205249479,
7627
+ 807026263,
7628
+ 3737207727,
7629
+ 1660063152,
7630
+ 2347385850,
7631
+ 2705031697,
7632
+ 3732776249,
7633
+ 2485617015,
7634
+ 2611217952,
7635
+ 1704287377,
7636
+ 2937912522,
7637
+ 2770003689,
7638
+ 1281925730,
7639
+ 1484403080,
7640
+ 3448662350,
7641
+ 4142052618,
7642
+ 3800577675,
7643
+ 4006246654,
7644
+ 3590301190,
7645
+ 1383045692,
7646
+ 2775532180,
7647
+ 2047409740,
7648
+ 370225590,
7649
+ 3593883385,
7650
+ 2665983363,
7651
+ 4124623270,
7652
+ 812098782,
7653
+ 3649129432,
7654
+ 987898635,
7655
+ 1105321065,
7656
+ 3510044353,
7657
+ 1635779807,
7658
+ 2603310189,
7659
+ 3406155212,
7660
+ 1310608509,
7661
+ 4261334040,
7662
+ 2736907675,
7663
+ 3649129432,
7664
+ 1136057603,
7665
+ 1260505505,
7666
+ 4182860854,
7667
+ 2713105998,
7668
+ 2898889636,
7669
+ 59481748,
7670
+ 3749851601,
7671
+ 3486308946,
7672
+ 3150382593,
7673
+ 1062206242,
7674
+ 3264961684,
7675
+ 15328376,
7676
+ 1485152156,
7677
+ 370225590,
7678
+ 1981873012,
7679
+ 2859738748,
7680
+ 45288368,
7681
+ 2614616156,
7682
+ 2732653382,
7683
+ 775493141,
7684
+ 2147822146,
7685
+ 2601014836,
7686
+ 2629017746,
7687
+ 1186437898,
7688
+ 2367409068,
7689
+ 1213902940,
7690
+ 3632507154,
7691
+ 3900360178,
7692
+ 476780140,
7693
+ 1472233963,
7694
+ 2804161546,
7695
+ 3008276851,
7696
+ 738692330,
7697
+ 374418227,
7698
+ 315944413,
7699
+ 3905492369,
7700
+ 3570813810,
7701
+ 2571569899,
7702
+ 178912537,
7703
+ 2294589976,
7704
+ 1437953363,
7705
+ 2133299955,
7706
+ 572779678,
7707
+ 3092502836,
7708
+ 388784114,
7709
+ 2624227202,
7710
+ 1425443689,
7711
+ 3057273783,
7712
+ 2347385850,
7713
+ 1682466193,
7714
+ 2519244187,
7715
+ 2839578677,
7716
+ 3958567839,
7717
+ 2513912981,
7718
+ 2830218821,
7719
+ 427810014
7720
+ ]), Ps = class Ps extends et {
7721
+ constructor(t) {
7722
+ super(t);
7723
+ /** {@link Component.enabled} */
7724
+ I(this, "enabled", !0);
7725
+ t.add(Ps.uuid, this);
7698
7726
  }
7699
7727
  /**
7700
- * Converts a JSON string representing relations between entities into a structured map.
7701
- * This method parses the JSON string to reconstruct the relations map that indexes
7702
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
7703
- * and the values are maps where each key is a relation type ID and its value is an array
7704
- * of express IDs of entities related through that relation type.
7705
- *
7706
- * @param json The JSON string to be parsed into the relations map.
7707
- * @returns A `Map` where the key is the express ID of an entity as a number, and the value
7708
- * is another `Map`. This inner map's key is the relation type ID as a number, and its value
7709
- * is an array of express IDs (as numbers) of entities related through that relation type.
7728
+ * Exports all the properties of an IFC into an array of JS objects.
7729
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
7730
+ * @param modelID ID of the IFC model whose properties to extract.
7731
+ * @param indirect whether to get the indirect relationships as well.
7732
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
7733
+ * to make the location data available (e.g. absolute position of building).
7710
7734
  */
7711
- getRelationsMapFromJSON(t) {
7712
- const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
7713
- for (const o in e) {
7714
- const n = e[o], r = /* @__PURE__ */ new Map();
7715
- for (const a in n)
7716
- r.set(Number(a), n[a]);
7717
- i.set(Number(o), r);
7735
+ async export(t, e, i = !1, o = !0) {
7736
+ const n = {}, r = new Set(t.GetIfcEntityList(e)), a = /* @__PURE__ */ new Set([
7737
+ b.IFCPROJECT,
7738
+ b.IFCSITE,
7739
+ b.IFCBUILDING,
7740
+ b.IFCBUILDINGSTOREY,
7741
+ b.IFCSPACE
7742
+ ]);
7743
+ for (const c of a)
7744
+ r.add(c);
7745
+ for (const c of r) {
7746
+ if (vn.has(c))
7747
+ continue;
7748
+ const h = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
7749
+ for (const E of d) {
7750
+ const u = t.GetLine(0, E, h, i);
7751
+ n[u.expressID] = u;
7752
+ }
7718
7753
  }
7719
- return i;
7720
- }
7721
- /** {@link Disposable.dispose} */
7722
- dispose() {
7723
- this.relationMaps = {}, this.components.get(Et).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ye.uuid), this.onDisposed.reset();
7754
+ return n;
7724
7755
  }
7725
7756
  };
7726
7757
  /**
7727
7758
  * A unique identifier for the component.
7728
7759
  * This UUID is used to register the component within the Components system.
7729
7760
  */
7730
- I(Ye, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
7731
- let ke = Ye;
7761
+ I(Ps, "uuid", "b32c4332-cd67-436e-ba7f-196646c7a635");
7762
+ let mi = Ps;
7732
7763
  const Zr = {
7733
7764
  103090709: "IFCPROJECT",
7734
7765
  4097777520: "IFCSITE",
@@ -9035,7 +9066,7 @@ class Kt {
9035
9066
  if (!h || !h.UnitType || !h.UnitType.value || h.UnitType.value !== "LENGTHUNIT")
9036
9067
  continue;
9037
9068
  let E = 1, u = 1;
9038
- return h.Name.value === "METRE" && (u = 1), h.Name.value === "FOOT" && (u = 0.3048), ((n = h.Prefix) == null ? void 0 : n.value) === "MILLI" ? E = 1e-3 : (((r = h.Prefix) == null ? void 0 : r.value) === "CENTI" || ((a = h.Prefix) == null ? void 0 : a.value) === "DECI") && (E = 0.01), u * E;
9069
+ return h.Name.value === "METRE" && (u = 1), h.Name.value === "FOOT" && (u = 0.3048), ((n = h.Prefix) == null ? void 0 : n.value) === "MILLI" ? E = 1e-3 : ((r = h.Prefix) == null ? void 0 : r.value) === "CENTI" ? E = 0.01 : ((a = h.Prefix) == null ? void 0 : a.value) === "DECI" && (E = 0.1), u * E;
9039
9070
  }
9040
9071
  return 1;
9041
9072
  }
@@ -9284,7 +9315,7 @@ class Yn {
9284
9315
  this.itemsByFloor = {};
9285
9316
  }
9286
9317
  }
9287
- class yi {
9318
+ class Li {
9288
9319
  constructor() {
9289
9320
  /** Whether to extract the IFC properties into a JSON. */
9290
9321
  I(this, "includeProperties", !0);
@@ -9431,7 +9462,7 @@ const Ve = class Ve extends et {
9431
9462
  * The settings for the IfcLoader.
9432
9463
  * It includes options for excluding categories, setting WASM paths, and more.
9433
9464
  */
9434
- I(this, "settings", new yi());
9465
+ I(this, "settings", new Li());
9435
9466
  /**
9436
9467
  * The instance of the Web-IFC library used for handling IFC data.
9437
9468
  */
@@ -9492,9 +9523,9 @@ const Ve = class Ve extends et {
9492
9523
  async load(t, e = !0) {
9493
9524
  const i = performance.now();
9494
9525
  this.onIfcStartedLoading.trigger(), await this.readIfcFile(t);
9495
- const o = await this.getAllGeometries(), r = await this.components.get(Ri).export(this.webIfc, 0);
9526
+ const o = await this.getAllGeometries(), r = await this.components.get(mi).export(this.webIfc, 0);
9496
9527
  o.setLocalProperties(r), this.cleanUp();
9497
- const a = this.components.get(Et);
9528
+ const a = this.components.get(ht);
9498
9529
  a.groups.set(o.uuid, o);
9499
9530
  for (const c of o.items)
9500
9531
  a.list.set(c.id, c), c.mesh.uuid = c.id, c.group = o;
@@ -9659,7 +9690,7 @@ const Ve = class Ve extends et {
9659
9690
  * This UUID is used to register the component within the Components system.
9660
9691
  */
9661
9692
  I(Ve, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
9662
- let Ai = Ve;
9693
+ let Ri = Ve;
9663
9694
  const Bt = class Bt extends et {
9664
9695
  constructor(t) {
9665
9696
  super(t);
@@ -9920,7 +9951,7 @@ const Bt = class Bt extends et {
9920
9951
  * @throws Will throw an error if any issues occur during the saving process.
9921
9952
  */
9922
9953
  async saveToIfc(t, e) {
9923
- const i = this.components.get(Ai), o = i.webIfc, n = await i.readIfcFile(e), r = this.changeMap[t.uuid] ?? [];
9954
+ const i = this.components.get(Ri), o = i.webIfc, n = await i.readIfcFile(e), r = this.changeMap[t.uuid] ?? [];
9924
9955
  for (const c of r) {
9925
9956
  const h = await t.getProperties(c);
9926
9957
  if (h)
@@ -10041,11 +10072,11 @@ const Ls = class Ls extends et {
10041
10072
  }
10042
10073
  }
10043
10074
  });
10044
- t.add(Ls.uuid, this), t.get(Et).onFragmentsDisposed.add(this.onFragmentsDisposed);
10075
+ t.add(Ls.uuid, this), t.get(ht).onFragmentsDisposed.add(this.onFragmentsDisposed);
10045
10076
  }
10046
10077
  /** {@link Disposable.dispose} */
10047
10078
  dispose() {
10048
- this.list = {}, this.components.get(Et).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(), this.onDisposed.reset();
10079
+ this.list = {}, this.components.get(ht).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(), this.onDisposed.reset();
10049
10080
  }
10050
10081
  /**
10051
10082
  * Removes a fragment from the classification based on its unique identifier (guid).
@@ -10076,7 +10107,7 @@ const Ls = class Ls extends et {
10076
10107
  * @throws Will throw an error if the fragments map is malformed.
10077
10108
  */
10078
10109
  find(t) {
10079
- const e = this.components.get(Et);
10110
+ const e = this.components.get(ht);
10080
10111
  if (!t) {
10081
10112
  const r = {};
10082
10113
  for (const [a, c] of e.list)
@@ -10242,32 +10273,48 @@ const Ls = class Ls extends et {
10242
10273
  * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
10243
10274
  */
10244
10275
  async bySpatialStructure(t) {
10245
- var n;
10276
+ var n, r;
10246
10277
  const e = this.components.get(ke), i = e.relationMaps[t.uuid];
10247
10278
  if (!i)
10248
10279
  throw new Error(
10249
10280
  `Classifier: model relations of ${t.name || t.uuid} have to exists to group by spatial structure.`
10250
10281
  );
10251
10282
  const o = "spatialStructures";
10252
- for (const [r] of i) {
10253
- const a = e.getEntityRelations(
10283
+ for (const [a] of i) {
10284
+ const c = e.getEntityRelations(
10254
10285
  t,
10255
- r,
10286
+ a,
10287
+ "Decomposes"
10288
+ );
10289
+ if (c)
10290
+ for (const u of c) {
10291
+ const f = await t.getProperties(u);
10292
+ if (!f)
10293
+ continue;
10294
+ const R = (n = f.Name) == null ? void 0 : n.value;
10295
+ this.saveItem(t, o, R, a);
10296
+ }
10297
+ const h = e.getEntityRelations(
10298
+ t,
10299
+ a,
10256
10300
  "ContainsElements"
10257
- ), c = await t.getProperties(r);
10258
- if (!(a && c))
10301
+ );
10302
+ if (!h)
10259
10303
  continue;
10260
- const h = (n = c.Name) == null ? void 0 : n.value;
10261
- for (const d of a) {
10262
- this.saveItem(t, o, h, d);
10263
- const E = e.getEntityRelations(
10304
+ const d = await t.getProperties(a);
10305
+ if (!d)
10306
+ continue;
10307
+ const E = (r = d.Name) == null ? void 0 : r.value;
10308
+ for (const u of h) {
10309
+ this.saveItem(t, o, E, u);
10310
+ const f = e.getEntityRelations(
10264
10311
  t,
10265
- Number(d),
10312
+ Number(u),
10266
10313
  "IsDecomposedBy"
10267
10314
  );
10268
- if (E)
10269
- for (const u of E)
10270
- this.saveItem(t, o, h, u);
10315
+ if (f)
10316
+ for (const R of f)
10317
+ this.saveItem(t, o, E, R);
10271
10318
  }
10272
10319
  }
10273
10320
  }
@@ -10285,7 +10332,7 @@ const Ls = class Ls extends et {
10285
10332
  * @throws Will throw an error if the fragment with the specified ID is not found.
10286
10333
  */
10287
10334
  setColor(t, e, i = !1) {
10288
- const o = this.components.get(Et);
10335
+ const o = this.components.get(ht);
10289
10336
  for (const n in t) {
10290
10337
  const r = o.list.get(n);
10291
10338
  if (!r)
@@ -10306,7 +10353,7 @@ const Ls = class Ls extends et {
10306
10353
  * @throws Will throw an error if the fragment with the specified ID is not found.
10307
10354
  */
10308
10355
  resetColor(t) {
10309
- const e = this.components.get(Et);
10356
+ const e = this.components.get(ht);
10310
10357
  for (const i in t) {
10311
10358
  const o = e.list.get(i);
10312
10359
  if (!o)
@@ -10333,7 +10380,7 @@ const Ls = class Ls extends et {
10333
10380
  * This UUID is used to register the component within the Components system.
10334
10381
  */
10335
10382
  I(Ls, "uuid", "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");
10336
- let Fi = Ls;
10383
+ let Ai = Ls;
10337
10384
  const ys = class ys extends et {
10338
10385
  constructor(t) {
10339
10386
  super(t);
@@ -10381,7 +10428,7 @@ const ys = class ys extends et {
10381
10428
  set(t) {
10382
10429
  if (!this.enabled)
10383
10430
  return;
10384
- const e = this.components.get(Fi), i = this.components.get(Et), o = t ? 1 : -1;
10431
+ const e = this.components.get(Ai), i = this.components.get(ht), o = t ? 1 : -1;
10385
10432
  let n = 0;
10386
10433
  const r = e.list[this.groupName], a = new g.Matrix4();
10387
10434
  for (const c in r) {
@@ -10423,7 +10470,7 @@ const Ms = class Ms extends et {
10423
10470
  * @returns {void}
10424
10471
  */
10425
10472
  set(t, e) {
10426
- const i = this.components.get(Et);
10473
+ const i = this.components.get(ht);
10427
10474
  if (!e) {
10428
10475
  for (const [o, n] of i.list)
10429
10476
  n && (n.setVisibility(t), this.updateCulledVisibility(n));
@@ -10460,7 +10507,7 @@ const Ms = class Ms extends et {
10460
10507
  */
10461
10508
  I(Ms, "uuid", "dd9ccf2d-8a21-4821-b7f6-2949add16a29");
10462
10509
  let _n = Ms;
10463
- class jr extends yi {
10510
+ class jr extends Li {
10464
10511
  constructor() {
10465
10512
  super(...arguments);
10466
10513
  /**
@@ -10687,7 +10734,7 @@ const ws = class ws extends et {
10687
10734
  */
10688
10735
  I(ws, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
10689
10736
  let Sn = ws;
10690
- class qr extends yi {
10737
+ class qr extends Li {
10691
10738
  constructor() {
10692
10739
  super(...arguments);
10693
10740
  /**
@@ -10963,7 +11010,7 @@ const Ds = class Ds extends et {
10963
11010
  * @throws Will throw an error if the fragment manager is not available.
10964
11011
  */
10965
11012
  getVolumeFromFragments(t) {
10966
- const e = this.components.get(Et), i = new g.Matrix4(), o = [];
11013
+ const e = this.components.get(ht), i = new g.Matrix4(), o = [];
10967
11014
  for (const r in t) {
10968
11015
  const a = e.list.get(r);
10969
11016
  if (!a)
@@ -11006,13 +11053,9 @@ const Ds = class Ds extends et {
11006
11053
  */
11007
11054
  getVolumeFromMeshes(t) {
11008
11055
  let e = 0;
11009
- for (const n of t)
11010
- e += this.getVolumeOfMesh(n);
11011
- const i = this.components.get(mi);
11012
- for (const n of t)
11013
- n.geometry.computeBoundingSphere(), i.addMesh(n);
11014
- const o = i.getSphere();
11015
- return i.reset(), { volume: e, sphere: o };
11056
+ for (const i of t)
11057
+ e += this.getVolumeOfMesh(i);
11058
+ return e;
11016
11059
  }
11017
11060
  getFaceData(t, e, i) {
11018
11061
  const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal: c } = o;
@@ -11081,14 +11124,14 @@ I(Ds, "uuid", "267ca032-672f-4cb0-afa9-d24e904f39d6");
11081
11124
  let Nn = Ds;
11082
11125
  export {
11083
11126
  Ts as AsyncEvent,
11084
- Ni as Base,
11127
+ Si as Base,
11085
11128
  ar as BaseCamera,
11086
11129
  cr as BaseRenderer,
11087
11130
  lr as BaseScene,
11088
- Pi as BaseWorldItem,
11089
- mi as BoundingBoxer,
11090
- Fi as Classifier,
11091
- An as Clipper,
11131
+ Ni as BaseWorldItem,
11132
+ Fn as BoundingBoxer,
11133
+ Ai as Classifier,
11134
+ Rn as Clipper,
11092
11135
  et as Component,
11093
11136
  pi as Components,
11094
11137
  Yr as CullerRenderer,
@@ -11097,27 +11140,27 @@ export {
11097
11140
  D as Event,
11098
11141
  gn as Exploder,
11099
11142
  zr as FirstPersonMode,
11100
- Et as FragmentsManager,
11143
+ ht as FragmentsManager,
11101
11144
  vn as GeometryTypes,
11102
- un as Grids,
11145
+ dn as Grids,
11103
11146
  _n as Hider,
11104
11147
  oa as IfcCategories,
11105
11148
  Bn as IfcCategoryMap,
11106
11149
  Zr as IfcElements,
11107
- yi as IfcFragmentSettings,
11150
+ Li as IfcFragmentSettings,
11108
11151
  Sn as IfcGeometryTiler,
11109
- Ri as IfcJsonExporter,
11110
- Ai as IfcLoader,
11152
+ mi as IfcJsonExporter,
11153
+ Ri as IfcLoader,
11111
11154
  On as IfcPropertiesManager,
11112
11155
  Kr as IfcPropertiesTiler,
11113
11156
  Kt as IfcPropertiesUtils,
11114
11157
  ke as IfcRelationsIndexer,
11115
11158
  jr as IfcStreamingSettings,
11116
- nn as MaterialsUtils,
11159
+ sn as MaterialsUtils,
11117
11160
  Nn as MeasurementUtils,
11118
11161
  Vr as MeshCullerRenderer,
11119
11162
  Gr as MiniMap,
11120
- Fn as MiniMaps,
11163
+ An as MiniMaps,
11121
11164
  Rr as Mouse,
11122
11165
  Hr as OrbitMode,
11123
11166
  na as OrthoPerspectiveCamera,
@@ -11127,7 +11170,7 @@ export {
11127
11170
  ze as Raycasters,
11128
11171
  He as SimpleCamera,
11129
11172
  Nr as SimpleGrid,
11130
- Li as SimplePlane,
11173
+ Pi as SimplePlane,
11131
11174
  Ar as SimpleRaycaster,
11132
11175
  ia as SimpleRenderer,
11133
11176
  sa as SimpleScene,