bimatter-viewer-react 0.11.4 → 0.11.6

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/lib/index.js CHANGED
@@ -1631,6 +1631,9 @@ function Or(e, t, n, r) {
1631
1631
  }
1632
1632
  },
1633
1633
  geometryUtils: {
1634
+ get indexesState() {
1635
+ return t()?.geometryUtils.indexesState ?? null;
1636
+ },
1634
1637
  getAllIds: () => t()?.geometryUtils.getAllIds() ?? [],
1635
1638
  getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !1,
1636
1639
  getModelGeometry: (e) => t()?.geometryUtils.getModelGeometry(e) ?? null,
@@ -9598,8 +9601,8 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
9598
9601
  object: f
9599
9602
  }), /* @__PURE__ */ W("primitive", { object: v })]
9600
9603
  });
9601
- }), Yu = new R(), Xu = /* @__PURE__ */ new WeakMap();
9602
- function Zu(e) {
9604
+ }), Yu = new R(), Xu = /* @__PURE__ */ new WeakMap(), Zu = /* @__PURE__ */ new WeakMap();
9605
+ function Qu(e) {
9603
9606
  if (!e) return null;
9604
9607
  try {
9605
9608
  let t = JSON.parse(e);
@@ -9608,20 +9611,20 @@ function Zu(e) {
9608
9611
  return console.warn("Model matrix parsing error", e), null;
9609
9612
  }
9610
9613
  }
9611
- function Qu(e) {
9612
- return Zu($u(e));
9613
- }
9614
9614
  function $u(e) {
9615
+ return Qu(ed(e));
9616
+ }
9617
+ function ed(e) {
9615
9618
  if (e.coordinationMatrix) return e.coordinationMatrix;
9616
9619
  for (let t in e.data) {
9617
9620
  let n = e.data[Number(t)]?.matrix;
9618
9621
  if (n) return n;
9619
9622
  }
9620
9623
  }
9621
- function ed(e, t) {
9624
+ function td(e, t) {
9622
9625
  let n = e.matrix ?? t ?? "", r = Xu.get(e);
9623
9626
  if (r && r.sourceMatrixKey === n) return r;
9624
- let i = (Zu(n) ?? new R()).clone().invert(), a = e.pos, o = new U(), s = Infinity;
9627
+ let i = (Qu(n) ?? new R()).clone().invert(), a = e.pos, o = new U(), s = Infinity;
9625
9628
  for (let e = 0; e < a.length; e += 3) o.set(a[e], a[e + 1], a[e + 2]).applyMatrix4(i), Number.isFinite(o.y) && (s = Math.min(s, o.y));
9626
9629
  let c = {
9627
9630
  floorY: s,
@@ -9630,23 +9633,72 @@ function ed(e, t) {
9630
9633
  };
9631
9634
  return Xu.set(e, c), c;
9632
9635
  }
9633
- function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, loadGeneration: i, materialMode: a, onUploadComplete: o, onUploadProgress: s, useWebGPU: c = !1 }) {
9636
+ function nd(e, t) {
9637
+ let n = e[t];
9638
+ return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
9639
+ }
9640
+ function rd(e, t, n) {
9641
+ let r = nd(e, "x"), i = nd(e, "y"), a = nd(e, "z"), o = nd(t, "x"), s = nd(t, "y"), c = nd(t, "z");
9642
+ if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
9643
+ let l = new U(r + o, i + s, a + c).applyMatrix4(n);
9644
+ return {
9645
+ x: l.x,
9646
+ y: l.y,
9647
+ z: l.z
9648
+ };
9649
+ }
9650
+ function id(e, t, n) {
9651
+ let r = {};
9652
+ return Object.entries(e).forEach(([e, i]) => {
9653
+ let a = i.map((e) => rd(e, t, n)).filter((e) => e !== null);
9654
+ a.length >= 2 && (r[e] = a);
9655
+ }), r;
9656
+ }
9657
+ function ad(e, t) {
9658
+ return {
9659
+ loc: {
9660
+ x: 0,
9661
+ y: 0,
9662
+ z: 0
9663
+ },
9664
+ points: {
9665
+ u: id(e.points.u, e.loc, t),
9666
+ v: id(e.points.v, e.loc, t)
9667
+ }
9668
+ };
9669
+ }
9670
+ function od(e, t) {
9671
+ if (!e || !t) return e;
9672
+ let n = Zu.get(e);
9673
+ if (n && n.sourceMatrixKey === t) return n.grids;
9674
+ let r = Qu(t);
9675
+ if (!r) return e;
9676
+ let i = r.clone().invert(), a = {};
9677
+ return Object.entries(e).forEach(([e, t]) => {
9678
+ a[e] = ad(t, i);
9679
+ }), Zu.set(e, {
9680
+ grids: a,
9681
+ sourceMatrixKey: t
9682
+ }), a;
9683
+ }
9684
+ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, loadGeneration: i, materialMode: a, onUploadComplete: o, onUploadProgress: s, useWebGPU: c = !1 }) {
9634
9685
  let l = G((e) => e.gridAxesVisibility), u = b(() => {
9635
9686
  if (!r) return {
9636
9687
  data: [],
9637
9688
  coordinationMatrix: null,
9638
- floorY: 0
9689
+ floorY: 0,
9690
+ grids: void 0
9639
9691
  };
9640
9692
  let e = !1;
9641
9693
  for (let t in r.data) if (r.data[Number(t)]?.matrix) {
9642
9694
  e = !0;
9643
9695
  break;
9644
9696
  }
9645
- let i = r.coordinationMatrix, a = Qu(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
9697
+ let i = r.coordinationMatrix ?? ed(r), a = $u(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
9646
9698
  for (let e in r.data) {
9647
9699
  let t = r.data[Number(e)];
9648
9700
  if (!t) continue;
9649
- let a = ed(t, i), o = t.mat;
9701
+ let a = td(t, i), o = t.mat;
9650
9702
  s = Math.min(s, a.floorY), c.push({
9651
9703
  data: t,
9652
9704
  isIfcSpace: !!t.isIfcSpace,
@@ -9659,7 +9711,8 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
9659
9711
  return {
9660
9712
  data: c,
9661
9713
  coordinationMatrix: o,
9662
- floorY: Number.isFinite(s) ? s : 0
9714
+ floorY: Number.isFinite(s) ? s : 0,
9715
+ grids: od(r.grids, i)
9663
9716
  };
9664
9717
  }, [
9665
9718
  t,
@@ -9708,7 +9761,7 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
9708
9761
  useDoubleSideMaterial: y
9709
9762
  }, t.key)), /* @__PURE__ */ W(Su, {
9710
9763
  floorY: u.floorY,
9711
- grids: r.grids,
9764
+ grids: u.grids,
9712
9765
  showBottom: l.bottom,
9713
9766
  showLeft: l.left,
9714
9767
  showRight: l.right,
@@ -9717,10 +9770,10 @@ function td({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
9717
9770
  })]
9718
9771
  });
9719
9772
  }
9720
- var nd = m(td);
9773
+ var cd = m(sd);
9721
9774
  //#endregion
9722
9775
  //#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
9723
- function rd() {
9776
+ function ld() {
9724
9777
  return {
9725
9778
  elementBounds: /* @__PURE__ */ new Map(),
9726
9779
  elementIndex: /* @__PURE__ */ new Map(),
@@ -9732,16 +9785,16 @@ function rd() {
9732
9785
  version: ""
9733
9786
  };
9734
9787
  }
9735
- function id(e, t, n, r) {
9788
+ function ud(e, t, n, r) {
9736
9789
  let i = e.get(t);
9737
9790
  i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
9738
9791
  let a = i.get(n);
9739
9792
  a || (a = new A(), i.set(n, a)), a.expandByPoint(r);
9740
9793
  }
9741
- function ad(e) {
9794
+ function dd(e) {
9742
9795
  return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
9743
9796
  }
9744
- function od(e, t, n, r) {
9797
+ function fd(e, t, n, r) {
9745
9798
  let i = n.get(e);
9746
9799
  if (i) return i;
9747
9800
  i = {
@@ -9751,20 +9804,20 @@ function od(e, t, n, r) {
9751
9804
  let a = r.get(e);
9752
9805
  return a || (a = [], r.set(e, a)), a.push(i), i;
9753
9806
  }
9754
- function sd(e, t, n, r, i, a) {
9755
- n && od(e, r, i, a).vertexRanges.push({
9807
+ function pd(e, t, n, r, i, a) {
9808
+ n && fd(e, r, i, a).vertexRanges.push({
9756
9809
  count: n,
9757
9810
  start: t
9758
9811
  });
9759
9812
  }
9760
- function cd(e, t, n, r, i, a) {
9761
- n && (od(e, r, i, a), r.triangleRanges.push({
9813
+ function md(e, t, n, r, i, a) {
9814
+ n && (fd(e, r, i, a), r.triangleRanges.push({
9762
9815
  count: n,
9763
9816
  id: e,
9764
9817
  start: t
9765
9818
  }));
9766
9819
  }
9767
- function ld(e) {
9820
+ function hd(e) {
9768
9821
  let t = e;
9769
9822
  for (; t;) {
9770
9823
  let e = t.userData.modelID;
@@ -9773,10 +9826,10 @@ function ld(e) {
9773
9826
  }
9774
9827
  return 0;
9775
9828
  }
9776
- function ud(e) {
9829
+ function gd(e) {
9777
9830
  return e.name === "space" || e.userData.isIfcSpace === !0;
9778
9831
  }
9779
- function dd(e) {
9832
+ function _d(e) {
9780
9833
  if (!e) return "";
9781
9834
  let t = [];
9782
9835
  return e.traverse((e) => {
@@ -9788,18 +9841,18 @@ function dd(e) {
9788
9841
  t.push(e.uuid, n.uuid, String(n.attributes.ids?.count ?? 0), String(n.attributes.position?.count ?? 0));
9789
9842
  }), t.join(":");
9790
9843
  }
9791
- function fd(e) {
9792
- let t = x(rd()), n = h(() => {
9844
+ function vd(e) {
9845
+ let t = x(ld()), n = h(() => {
9793
9846
  let n = e.current, r = t.current;
9794
9847
  if (!n) return r;
9795
- let i = dd(n);
9848
+ let i = _d(n);
9796
9849
  if (r.indexedModel === n && r.records.size && r.version === i) return r;
9797
9850
  let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = new U();
9798
9851
  return n.updateMatrixWorld(!0), n.traverse((e) => {
9799
9852
  if (!(e instanceof z)) return;
9800
9853
  let t = e, n = t.geometry, i = n.index, l = n.attributes.ids;
9801
9854
  if (!i || !l) return;
9802
- let u = n.attributes.position, d = ld(t), f = ud(t), p = ad(i.array), m = {
9855
+ let u = n.attributes.position, d = hd(t), f = gd(t), p = dd(i.array), m = {
9803
9856
  hiddenIds: /* @__PURE__ */ new Set(),
9804
9857
  initialVisible: t.visible,
9805
9858
  isIfcSpace: f,
@@ -9812,16 +9865,16 @@ function fd(e) {
9812
9865
  }, h = /* @__PURE__ */ new Map(), g = null, _ = 0, v = p.length / 3;
9813
9866
  for (let e = 0; e < v; e++) {
9814
9867
  let t = l.getX(p[e * 3]);
9815
- g === null ? (g = t, _ = e) : t !== g && (cd(g, _, e - _, m, h, a), g = t, _ = e);
9868
+ g === null ? (g = t, _ = e) : t !== g && (md(g, _, e - _, m, h, a), g = t, _ = e);
9816
9869
  }
9817
- g !== null && cd(g, _, v - _, m, h, a);
9870
+ g !== null && md(g, _, v - _, m, h, a);
9818
9871
  let y = null, b = 0, x = u ? Math.min(l.count, u.count) : l.count;
9819
9872
  u && t.updateWorldMatrix(!0, !1);
9820
9873
  for (let e = 0; e < l.count; e++) {
9821
9874
  let n = l.getX(e);
9822
- u && e < x && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) && id(o, d, n, c)), y === null ? (y = n, b = e) : n !== y && (sd(y, b, e - b, m, h, a), y = n, b = e);
9875
+ u && e < x && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) && ud(o, d, n, c)), y === null ? (y = n, b = e) : n !== y && (pd(y, b, e - b, m, h, a), y = n, b = e);
9823
9876
  }
9824
- y !== null && sd(y, b, l.count - b, m, h, a), s.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
9877
+ y !== null && pd(y, b, l.count - b, m, h, a), s.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
9825
9878
  }), t.current = {
9826
9879
  elementBounds: o,
9827
9880
  elementIndex: a,
@@ -9833,7 +9886,7 @@ function fd(e) {
9833
9886
  version: i
9834
9887
  }, t.current;
9835
9888
  }, [e]), r = h(() => {
9836
- t.current = rd();
9889
+ t.current = ld();
9837
9890
  }, []);
9838
9891
  return b(() => ({
9839
9892
  buildIndex: n,
@@ -9842,112 +9895,112 @@ function fd(e) {
9842
9895
  }
9843
9896
  //#endregion
9844
9897
  //#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
9845
- var pd = -1;
9846
- function md(e, t) {
9898
+ var yd = -1;
9899
+ function bd(e, t) {
9847
9900
  return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
9848
9901
  }
9849
- function hd(e) {
9902
+ function xd(e) {
9850
9903
  let t = e.geometry;
9851
9904
  Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ft(e.geometry, { indirect: !0 }) });
9852
9905
  }
9853
- function gd(e, t, n = !0) {
9854
- e.mesh.geometry.setIndex(new j(t, 1)), n && hd(e.mesh);
9906
+ function Sd(e, t, n = !0) {
9907
+ e.mesh.geometry.setIndex(new j(t, 1)), n && xd(e.mesh);
9855
9908
  }
9856
- function _d(e, t) {
9909
+ function Cd(e, t) {
9857
9910
  return e.initialVisible && (!e.isIfcSpace || t);
9858
9911
  }
9859
- function vd(e, t) {
9912
+ function wd(e, t) {
9860
9913
  let n = e.mesh.geometry, r = n.index?.array;
9861
- e.mesh.visible = _d(e, t), r !== e.originalIndex && gd(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (hd(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
9914
+ e.mesh.visible = Cd(e, t), r !== e.originalIndex && Sd(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (xd(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
9862
9915
  }
9863
- function yd(e) {
9916
+ function Td(e) {
9864
9917
  return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
9865
9918
  }
9866
- function bd(e, t, n, r) {
9867
- return `h:${yd(e)}|i:${yd(n)}|s:${r ? Number(t) : ""}`;
9919
+ function Ed(e, t, n, r) {
9920
+ return `h:${Td(e)}|i:${Td(n)}|s:${r ? Number(t) : ""}`;
9868
9921
  }
9869
- function xd(e, t, n) {
9922
+ function Dd(e, t, n) {
9870
9923
  return !t.has(e) && (!n || n.has(e));
9871
9924
  }
9872
- function Sd(e, t) {
9925
+ function Od(e, t) {
9873
9926
  Object.entries(e).forEach(([e, n]) => {
9874
9927
  n.forEach((n) => t(Number(e), n));
9875
9928
  });
9876
9929
  }
9877
- function Cd(e, t, n) {
9930
+ function kd(e, t, n) {
9878
9931
  e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
9879
9932
  }
9880
- function wd(e, t, n) {
9933
+ function Ad(e, t, n) {
9881
9934
  e && console.log(`${t}:`, Date.now() - n, "ms");
9882
9935
  }
9883
- function Td(e, t, n, r) {
9884
- let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = bd(i, t, n, e.isIfcSpace);
9936
+ function jd(e, t, n, r) {
9937
+ let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Ed(i, t, n, e.isIfcSpace);
9885
9938
  if (e.visibleStateKey === s) return;
9886
9939
  if (!i.size && !n) {
9887
- vd(e, t), e.visibleStateKey = s;
9940
+ wd(e, t), e.visibleStateKey = s;
9888
9941
  return;
9889
9942
  }
9890
9943
  let c = 0, l = 0;
9891
9944
  if (o.forEach(({ count: e, id: t }) => {
9892
- xd(t, i, n) ? c += e * 3 : l += e * 3;
9945
+ Dd(t, i, n) ? c += e * 3 : l += e * 3;
9893
9946
  }), !c) {
9894
- vd(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
9947
+ wd(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
9895
9948
  return;
9896
9949
  }
9897
9950
  if (!l) {
9898
- vd(e, t), e.visibleStateKey = s;
9951
+ wd(e, t), e.visibleStateKey = s;
9899
9952
  return;
9900
9953
  }
9901
- e.mesh.visible = _d(e, t);
9902
- let u = md(a, c), d = 0;
9954
+ e.mesh.visible = Cd(e, t);
9955
+ let u = bd(a, c), d = 0;
9903
9956
  for (let e = 0; e < o.length; e++) {
9904
9957
  let { count: t, id: r, start: s } = o[e];
9905
- if (!xd(r, i, n)) continue;
9958
+ if (!Dd(r, i, n)) continue;
9906
9959
  let c = s * 3, l = c + t * 3;
9907
9960
  u.set(a.subarray(c, l), d), d += t * 3;
9908
9961
  }
9909
- r || (e.originalBoundsTree = null), gd(e, u), e.visibleStateKey = s;
9962
+ r || (e.originalBoundsTree = null), Sd(e, u), e.visibleStateKey = s;
9910
9963
  }
9911
- function Ed(e, t) {
9964
+ function Md(e, t) {
9912
9965
  return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
9913
9966
  }
9914
- function Dd(e) {
9967
+ function Nd(e) {
9915
9968
  let t = [];
9916
9969
  return e?.children.forEach((e) => {
9917
9970
  e instanceof I && typeof e.userData.modelID == "number" && t.push(e);
9918
9971
  }), t;
9919
9972
  }
9920
- function Od(e) {
9973
+ function Pd(e) {
9921
9974
  let t = e.userData.trueNorthBaseMatrix;
9922
9975
  if (t instanceof R) return t;
9923
9976
  let n = e.matrix.clone();
9924
9977
  return e.userData.trueNorthBaseMatrix = n, n;
9925
9978
  }
9926
- function kd(e, t) {
9927
- let n = Number(e.userData.trueNorthAngle ?? 0), r = Od(e).clone();
9928
- !t && Number.isFinite(n) && n !== 0 && r.multiply(new R().makeRotationY(n * pd)), e.matrix.copy(r), e.matrixAutoUpdate = !1, e.updateMatrixWorld(!0), e.userData.trueNorthEnabled = t, e.userData.geometryTransformVersion = (Number(e.userData.geometryTransformVersion) || 0) + 1;
9979
+ function Fd(e, t) {
9980
+ let n = Number(e.userData.trueNorthAngle ?? 0), r = Pd(e).clone();
9981
+ !t && Number.isFinite(n) && n !== 0 && r.multiply(new R().makeRotationY(n * yd)), e.matrix.copy(r), e.matrixAutoUpdate = !1, e.updateMatrixWorld(!0), e.userData.trueNorthEnabled = t, e.userData.geometryTransformVersion = (Number(e.userData.geometryTransformVersion) || 0) + 1;
9929
9982
  }
9930
- function Ad(e) {
9983
+ function Id(e) {
9931
9984
  let t = G((e) => e.selected), n = G((e) => e.resetSelected), r = G((e) => e.showStats), i = G((e) => e.userDevice) === "pc", a = e.buildIndex, o = h(() => Array.from(a().elementIndex.keys()), [a]), s = h(() => a().ifcSpacesVisible, [a]), c = h((e) => {
9932
9985
  let t = Date.now(), n = a(), o = /* @__PURE__ */ new Set();
9933
9986
  e.forEach((e) => {
9934
9987
  let t = n.elementIndex.get(e);
9935
9988
  t && t.forEach(({ record: t }) => {
9936
- Cd(t, e, o);
9989
+ kd(t, e, o);
9937
9990
  });
9938
- }), o.forEach((e) => Td(e, n.ifcSpacesVisible, Ed(n, e), i)), wd(r, "hideByIds", t);
9991
+ }), o.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "hideByIds", t);
9939
9992
  }, [
9940
9993
  a,
9941
9994
  i,
9942
9995
  r
9943
9996
  ]), l = h(() => {
9944
9997
  let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
9945
- Sd(t, (e, t) => {
9998
+ Od(t, (e, t) => {
9946
9999
  let n = o.elementIndex.get(t);
9947
10000
  n && n.forEach(({ record: n }) => {
9948
- n.modelID === e && Cd(n, t, s);
10001
+ n.modelID === e && kd(n, t, s);
9949
10002
  });
9950
- }), s.forEach((e) => Td(e, o.ifcSpacesVisible, Ed(o, e), i)), n(), wd(r, "hideSelected", e);
10003
+ }), s.forEach((e) => jd(e, o.ifcSpacesVisible, Md(o, e), i)), n(), Ad(r, "hideSelected", e);
9951
10004
  }, [
9952
10005
  a,
9953
10006
  i,
@@ -9961,24 +10014,24 @@ function Ad(e) {
9961
10014
  t && t.forEach(({ record: t }) => {
9962
10015
  t.hiddenIds.delete(e) && o.add(t);
9963
10016
  });
9964
- }), o.forEach((e) => Td(e, n.ifcSpacesVisible, Ed(n, e), i)), wd(r, "showByIds", t);
10017
+ }), o.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "showByIds", t);
9965
10018
  }, [
9966
10019
  a,
9967
10020
  i,
9968
10021
  r
9969
10022
  ]), d = h((e) => {
9970
10023
  let t = Date.now(), n = a();
9971
- n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => Td(e, n.ifcSpacesVisible, Ed(n, e), i)), wd(r, "isolateByIds", t);
10024
+ n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "isolateByIds", t);
9972
10025
  }, [
9973
10026
  a,
9974
10027
  i,
9975
10028
  r
9976
10029
  ]), f = h(() => {
9977
10030
  let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
9978
- Sd(t, (e, t) => {
10031
+ Od(t, (e, t) => {
9979
10032
  let n = o.get(e);
9980
10033
  n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
9981
- }), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => Td(e, n.ifcSpacesVisible, Ed(n, e), i)), wd(r, "isolateSelected", e);
10034
+ }), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => jd(e, n.ifcSpacesVisible, Md(n, e), i)), Ad(r, "isolateSelected", e);
9982
10035
  }, [
9983
10036
  a,
9984
10037
  i,
@@ -9986,7 +10039,7 @@ function Ad(e) {
9986
10039
  r
9987
10040
  ]), p = h(() => {
9988
10041
  let e = Date.now(), t = a();
9989
- t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => Td(e, t.ifcSpacesVisible, Ed(t, e), i)), wd(r, "resetIsolation", e);
10042
+ t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => jd(e, t.ifcSpacesVisible, Md(t, e), i)), Ad(r, "resetIsolation", e);
9990
10043
  }, [
9991
10044
  a,
9992
10045
  i,
@@ -9994,13 +10047,16 @@ function Ad(e) {
9994
10047
  ]), m = h((e) => {
9995
10048
  let t = a();
9996
10049
  t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
9997
- e.isIfcSpace && Td(e, t.ifcSpacesVisible, Ed(t, e), i);
10050
+ e.isIfcSpace && jd(e, t.ifcSpacesVisible, Md(t, e), i);
9998
10051
  }));
9999
10052
  }, [a, i]), g = h(() => {
10000
10053
  m(!s());
10001
10054
  }, [s, m]);
10002
10055
  return {
10003
10056
  buildIndex: a,
10057
+ get indexesState() {
10058
+ return a();
10059
+ },
10004
10060
  getAllIds: o,
10005
10061
  getIfcSpacesVisibility: s,
10006
10062
  hideByIds: c,
@@ -10012,8 +10068,8 @@ function Ad(e) {
10012
10068
  showAll: h(() => {
10013
10069
  let e = Date.now(), t = a();
10014
10070
  t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
10015
- e.hiddenIds.clear(), Td(e, t.ifcSpacesVisible, Ed(t, e), i);
10016
- }), wd(r, "showAll", e);
10071
+ e.hiddenIds.clear(), jd(e, t.ifcSpacesVisible, Md(t, e), i);
10072
+ }), Ad(r, "showAll", e);
10017
10073
  }, [
10018
10074
  a,
10019
10075
  i,
@@ -10022,23 +10078,23 @@ function Ad(e) {
10022
10078
  showByIds: u,
10023
10079
  toggleIIfcSpacesVisibility: g,
10024
10080
  useTrueNorth: h((t = !0) => {
10025
- let n = Dd(a().indexedModel);
10026
- n.length && (n.forEach((e) => kd(e, t)), e.resetIndex());
10081
+ let n = Nd(a().indexedModel);
10082
+ n.length && (n.forEach((e) => Fd(e, t)), e.resetIndex());
10027
10083
  }, [a, e])
10028
10084
  };
10029
10085
  }
10030
10086
  //#endregion
10031
10087
  //#region src/viewer/utils/ClippingUtils/PlaneHelper.ts
10032
- var jd = "#0b2f5f", Md = "#0b2f5f", Nd = 0, Pd = "#165eb0", Fd = .3, Id = .01, Ld = .025, Rd = .015, zd = .02, Bd = 1e-7, Vd = .25, Hd = .15, Ud = .25, Wd = 1e-5, Gd = .2, Kd = 1, qd = 1;
10033
- function Jd(e, t) {
10088
+ var Ld = "#0b2f5f", Rd = "#0b2f5f", zd = 0, Bd = "#165eb0", Vd = .3, Hd = .01, Ud = .025, Wd = .015, Gd = .02, Kd = 1e-7, qd = .25, Jd = .15, Yd = .25, Xd = 1e-5, Zd = .2, Qd = 1, $d = 1;
10089
+ function ef(e, t) {
10034
10090
  let n = t.getBoundingClientRect();
10035
10091
  return new H((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
10036
10092
  }
10037
- function Yd(e) {
10093
+ function tf(e) {
10038
10094
  let t = e.getSize(new U());
10039
- return Math.max(Ud, t.length() * Id);
10095
+ return Math.max(Yd, t.length() * Hd);
10040
10096
  }
10041
- var Xd = class extends ke {
10097
+ var nf = class extends ke {
10042
10098
  helper = new I();
10043
10099
  borderMaterial;
10044
10100
  material;
@@ -10058,15 +10114,15 @@ var Xd = class extends ke {
10058
10114
  listenersActive = !1;
10059
10115
  constructor(e, t, n, r) {
10060
10116
  super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new Ce({
10061
- color: Md,
10117
+ color: Rd,
10062
10118
  depthWrite: !1,
10063
- opacity: Nd,
10119
+ opacity: zd,
10064
10120
  side: ue,
10065
10121
  transparent: !0
10066
10122
  }), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
10067
- let i = Math.max(Vd, Math.min(this.layout.width, this.layout.height) * Ld), a = Math.max(Hd, Math.min(this.layout.width, this.layout.height) * Rd);
10123
+ let i = Math.max(qd, Math.min(this.layout.width, this.layout.height) * Ud), a = Math.max(Jd, Math.min(this.layout.width, this.layout.height) * Wd);
10068
10124
  this.borderMaterial = new ve({
10069
- color: jd,
10125
+ color: Ld,
10070
10126
  dashSize: i,
10071
10127
  depthWrite: !1,
10072
10128
  gapSize: a
@@ -10097,7 +10153,7 @@ var Xd = class extends ke {
10097
10153
  }
10098
10154
  updateBorderDash() {
10099
10155
  let e = Math.min(this.layout.width, this.layout.height);
10100
- this.borderMaterial.dashSize = Math.max(Vd, e * Ld), this.borderMaterial.gapSize = Math.max(Hd, e * Rd), this.borderMaterial.needsUpdate = !0;
10156
+ this.borderMaterial.dashSize = Math.max(qd, e * Ud), this.borderMaterial.gapSize = Math.max(Jd, e * Wd), this.borderMaterial.needsUpdate = !0;
10101
10157
  }
10102
10158
  addEventListeners() {
10103
10159
  if (this.listenersActive) return;
@@ -10159,10 +10215,10 @@ var Xd = class extends ke {
10159
10215
  return !1;
10160
10216
  }
10161
10217
  getEdgeInteractionWidth() {
10162
- return Math.min(Kd, Math.max(Gd, Math.min(this.layout.width, this.layout.height) * zd));
10218
+ return Math.min(Qd, Math.max(Zd, Math.min(this.layout.width, this.layout.height) * Gd));
10163
10219
  }
10164
10220
  getDragDistanceEpsilon() {
10165
- return Math.max(Wd, Math.min(this.layout.width, this.layout.height) * Bd);
10221
+ return Math.max(Xd, Math.min(this.layout.width, this.layout.height) * Kd);
10166
10222
  }
10167
10223
  getPointToSegmentDistanceSquared(e, t, n) {
10168
10224
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
@@ -10175,7 +10231,7 @@ var Xd = class extends ke {
10175
10231
  }
10176
10232
  getPointerPointOnPlane(e, t) {
10177
10233
  let n = this.context.getDomElement();
10178
- this.pointer.copy(Jd(e, n));
10234
+ this.pointer.copy(ef(e, n));
10179
10235
  let r = this.context.getRaycaster(), i = new U();
10180
10236
  return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
10181
10237
  }
@@ -10228,7 +10284,7 @@ var Xd = class extends ke {
10228
10284
  t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
10229
10285
  }
10230
10286
  setHovered(e) {
10231
- this.hovered = e, this.material.color.set(e ? Pd : Md), this.material.opacity = e ? Fd : Nd, this.material.needsUpdate = !0;
10287
+ this.hovered = e, this.material.color.set(e ? Bd : Rd), this.material.opacity = e ? Vd : zd, this.material.needsUpdate = !0;
10232
10288
  }
10233
10289
  createPlaneMesh() {
10234
10290
  let e = new z(new re(), this.material);
@@ -10304,12 +10360,12 @@ var Xd = class extends ke {
10304
10360
  getHelperLayout() {
10305
10361
  let e = this.getModelWorldBox();
10306
10362
  if (!e || e.isEmpty()) return {
10307
- height: qd,
10308
- maxU: qd / 2,
10309
- maxV: qd / 2,
10310
- minU: -qd / 2,
10311
- minV: -qd / 2,
10312
- width: qd
10363
+ height: $d,
10364
+ maxU: $d / 2,
10365
+ maxV: $d / 2,
10366
+ minU: -$d / 2,
10367
+ minV: -$d / 2,
10368
+ width: $d
10313
10369
  };
10314
10370
  let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new U(), a = new U(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
10315
10371
  if (r.forEach((e) => {
@@ -10317,14 +10373,14 @@ var Xd = class extends ke {
10317
10373
  let r = a.dot(t.u), u = a.dot(t.v);
10318
10374
  o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
10319
10375
  }), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
10320
- height: qd,
10321
- maxU: qd / 2,
10322
- maxV: qd / 2,
10323
- minU: -qd / 2,
10324
- minV: -qd / 2,
10325
- width: qd
10376
+ height: $d,
10377
+ maxU: $d / 2,
10378
+ maxV: $d / 2,
10379
+ minU: -$d / 2,
10380
+ minV: -$d / 2,
10381
+ width: $d
10326
10382
  };
10327
- let u = Yd(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(qd, f - d), g = Math.max(qd, m - p), _ = (d + f) / 2, v = (p + m) / 2;
10383
+ let u = tf(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max($d, f - d), g = Math.max($d, m - p), _ = (d + f) / 2, v = (p + m) / 2;
10328
10384
  return {
10329
10385
  height: g,
10330
10386
  maxU: _ + h / 2,
@@ -10365,8 +10421,8 @@ var Xd = class extends ke {
10365
10421
  new U(e.max.x, e.max.y, e.max.z)
10366
10422
  ];
10367
10423
  }
10368
- }, Zd = 250, Qd = "#a9a9a9", $d = new U(0, 0, -1), ef = "__bimatterCameraMotionHidden";
10369
- function tf(e, t) {
10424
+ }, rf = 250, af = "#a9a9a9", of = new U(0, 0, -1), sf = "__bimatterCameraMotionHidden";
10425
+ function cf(e, t) {
10370
10426
  if (Array.isArray(e)) {
10371
10427
  e.forEach((e) => {
10372
10428
  e.clippingPlanes = t, e.needsUpdate = !0;
@@ -10375,13 +10431,13 @@ function tf(e, t) {
10375
10431
  }
10376
10432
  e.clippingPlanes = t, e.needsUpdate = !0;
10377
10433
  }
10378
- function nf(e) {
10434
+ function lf(e) {
10379
10435
  let t = [];
10380
10436
  return e?.traverse((e) => {
10381
10437
  e instanceof z && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
10382
10438
  }), t;
10383
10439
  }
10384
- function rf(e) {
10440
+ function uf(e) {
10385
10441
  let t = e;
10386
10442
  for (; t;) {
10387
10443
  let e = t.userData.modelID;
@@ -10390,14 +10446,14 @@ function rf(e) {
10390
10446
  }
10391
10447
  return 0;
10392
10448
  }
10393
- function af(e, t, n) {
10449
+ function df(e, t, n) {
10394
10450
  let r = e;
10395
10451
  r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
10396
10452
  }
10397
- function of(e, t) {
10453
+ function ff(e, t) {
10398
10454
  return t.clone().transformDirection(e.matrixWorld).normalize();
10399
10455
  }
10400
- function sf(e) {
10456
+ function pf(e) {
10401
10457
  if (!e) return null;
10402
10458
  if ("x" in e) {
10403
10459
  let t = new U(e.x, e.y, e.z);
@@ -10406,7 +10462,7 @@ function sf(e) {
10406
10462
  let t = new U(e[0], e[1], e[2]);
10407
10463
  return Number.isFinite(t.x + t.y + t.z) ? t : null;
10408
10464
  }
10409
- var cf = class {
10465
+ var mf = class {
10410
10466
  planes = [];
10411
10467
  caps = [];
10412
10468
  edges = [];
@@ -10414,7 +10470,7 @@ var cf = class {
10414
10470
  active = !1;
10415
10471
  capsActive = !0;
10416
10472
  capsCameraMotionActive = !1;
10417
- capsColor = Qd;
10473
+ capsColor = af;
10418
10474
  context;
10419
10475
  edgesActive = !0;
10420
10476
  edgesCameraMotionActive = !1;
@@ -10471,13 +10527,13 @@ var cf = class {
10471
10527
  return this.context.controlRef;
10472
10528
  }
10473
10529
  getMeshes() {
10474
- return nf(this.context.modelRef.current);
10530
+ return lf(this.context.modelRef.current);
10475
10531
  }
10476
10532
  getPlanVisualObjects() {
10477
- return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[ef]), ...this.edges.flatMap((e) => e.getObjects(!0))];
10533
+ return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[sf]), ...this.edges.flatMap((e) => e.getObjects(!0))];
10478
10534
  }
10479
10535
  getObjectModelID(e) {
10480
- return rf(e);
10536
+ return uf(e);
10481
10537
  }
10482
10538
  getEdgeSegmentsForPlane(e) {
10483
10539
  return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
@@ -10516,12 +10572,12 @@ var cf = class {
10516
10572
  if (this.capsCameraMotionActive !== e) {
10517
10573
  if (this.capsCameraMotionActive = e, e) {
10518
10574
  this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => {
10519
- e.getObject().userData[ef] = !0, e.setVisible(!1);
10575
+ e.getObject().userData[sf] = !0, e.setVisible(!1);
10520
10576
  }), this.context.onVisualChange?.();
10521
10577
  return;
10522
10578
  }
10523
10579
  this.caps.forEach((e) => {
10524
- delete e.getObject().userData[ef], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
10580
+ delete e.getObject().userData[sf], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
10525
10581
  }), this.context.onVisualChange?.();
10526
10582
  }
10527
10583
  }
@@ -10536,7 +10592,7 @@ var cf = class {
10536
10592
  this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive || this.capsCameraMotionActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
10537
10593
  e.setVisible(!0), e.update();
10538
10594
  }), this.updateCapsVisualState());
10539
- }, Zd));
10595
+ }, rf));
10540
10596
  }
10541
10597
  clearCapsDragIdleTimeout() {
10542
10598
  this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
@@ -10566,7 +10622,7 @@ var cf = class {
10566
10622
  getSelectedWorldBox() {
10567
10623
  let e = this.context.viewerStore.getState().selected, t = new A(), n = new U();
10568
10624
  return this.getMeshes().forEach((r) => {
10569
- let i = e[rf(r)];
10625
+ let i = e[uf(r)];
10570
10626
  if (!i?.size) return;
10571
10627
  let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
10572
10628
  if (!a || !o) return;
@@ -10584,8 +10640,8 @@ var cf = class {
10584
10640
  }
10585
10641
  updateMaterials() {
10586
10642
  let e = this.active ? this.planes : [];
10587
- af(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
10588
- tf(t.material, e);
10643
+ df(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
10644
+ cf(t.material, e);
10589
10645
  }), this.context.camera.updateMatrixWorld();
10590
10646
  }
10591
10647
  setActive(e) {
@@ -10604,13 +10660,13 @@ var cf = class {
10604
10660
  recursive: !1
10605
10661
  });
10606
10662
  if (!n?.face) return null;
10607
- let r = n.point.clone(), i = of(n.object, n.face.normal);
10663
+ let r = n.point.clone(), i = ff(n.object, n.face.normal);
10608
10664
  r.add(i.clone().multiplyScalar(.001));
10609
10665
  let a = new Me().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
10610
10666
  return this.addPlane(a, r, i), a.clone();
10611
10667
  }
10612
10668
  createPlaneFromPointAndNormal(e, t) {
10613
- let n = typeof e == "number" ? this.getPointFromZ(e) : sf(e), r = sf(t ?? (typeof e == "number" ? $d : void 0));
10669
+ let n = typeof e == "number" ? this.getPointFromZ(e) : pf(e), r = pf(t ?? (typeof e == "number" ? of : void 0));
10614
10670
  if (!n || !r || r.lengthSq() === 0) return null;
10615
10671
  r.normalize();
10616
10672
  let i = new Me().setFromNormalAndCoplanarPoint(r, n);
@@ -10619,7 +10675,7 @@ var cf = class {
10619
10675
  createClippingRectangle(e = !1) {
10620
10676
  let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
10621
10677
  if (!t) return [];
10622
- let n = Yd(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new U()), o = [
10678
+ let n = tf(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new U()), o = [
10623
10679
  {
10624
10680
  normal: new U(1, 0, 0),
10625
10681
  point: new U(r.x, a.y, a.z)
@@ -10659,7 +10715,7 @@ var cf = class {
10659
10715
  return new U(t?.x ?? 0, t?.y ?? 0, e);
10660
10716
  }
10661
10717
  addPlane(e, t, n) {
10662
- if (this.active || this.setActive(!0), this.planes.push(e), new Xd(this, e, t, n), this.edgesActive) {
10718
+ if (this.active || this.setActive(!0), this.planes.push(e), new nf(this, e, t, n), this.edgesActive) {
10663
10719
  let t = new ul(this, e);
10664
10720
  t.create(), t.update();
10665
10721
  }
@@ -10718,9 +10774,9 @@ var cf = class {
10718
10774
  this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
10719
10775
  }
10720
10776
  };
10721
- function lf(e, t, n, r = !1, i) {
10777
+ function hf(e, t, n, r = !1, i) {
10722
10778
  let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.raycaster), c = D((e) => e.scene), l = Et(), u = x(null);
10723
- u.current ||= new cf({
10779
+ u.current ||= new mf({
10724
10780
  camera: a,
10725
10781
  cameraUtils: n,
10726
10782
  controlRef: t,
@@ -10801,15 +10857,15 @@ function lf(e, t, n, r = !1, i) {
10801
10857
  }
10802
10858
  //#endregion
10803
10859
  //#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
10804
- function uf(e) {
10860
+ function gf(e) {
10805
10861
  return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
10806
10862
  }
10807
- function df(e = !0) {
10863
+ function _f(e = !0) {
10808
10864
  let t = G((e) => e.api), n = G((e) => e.defaultHotkeysEnabled);
10809
10865
  _(() => {
10810
10866
  if (!e || !n) return;
10811
10867
  let r = (e) => {
10812
- uf(e.target) || (e.code === "KeyI" && t?.geometryUtils.isolateSelected(), e.code === "KeyH" && t?.geometryUtils.hideSelected(), e.code === "KeyC" && t?.geometryUtils.showAll(), e.code === "KeyP" && t?.clipping.createPlane(), e.code === "KeyM" && t?.dimensions.toggle(), e.code === "KeyN" && t?.notes.toggleNodeMode(), t?.notes.getNodeModeActive() && (e.code === "Digit1" && (e.preventDefault(), t.notes.createMarkupCloud()), e.code === "Digit2" && (e.preventDefault(), t.notes.createComment())));
10868
+ gf(e.target) || (e.code === "KeyI" && t?.geometryUtils.isolateSelected(), e.code === "KeyH" && t?.geometryUtils.hideSelected(), e.code === "KeyC" && t?.geometryUtils.showAll(), e.code === "KeyP" && t?.clipping.createPlane(), e.code === "KeyM" && t?.dimensions.toggle(), e.code === "KeyN" && t?.notes.toggleNodeMode(), t?.notes.getNodeModeActive() && (e.code === "Digit1" && (e.preventDefault(), t.notes.createMarkupCloud()), e.code === "Digit2" && (e.preventDefault(), t.notes.createComment())));
10813
10869
  };
10814
10870
  return window.addEventListener("keydown", r), () => {
10815
10871
  window.removeEventListener("keydown", r);
@@ -10822,8 +10878,8 @@ function df(e = !0) {
10822
10878
  }
10823
10879
  //#endregion
10824
10880
  //#region src/viewer/Selector/SelectionBox.ts
10825
- var ff = new U(), pf = new U(), mf = new H(), hf = new U(), gf = new U(), _f = new U(), vf = new U(), yf = new U(), bf = new U(), xf = new U();
10826
- function Sf(e) {
10881
+ var vf = new U(), yf = new U(), bf = new H(), xf = new U(), Sf = new U(), Cf = new U(), wf = new U(), Tf = new U(), Ef = new U(), Df = new U();
10882
+ function Of(e) {
10827
10883
  let t = e;
10828
10884
  for (; t;) {
10829
10885
  let e = t.modelID ?? t.userData.modelID;
@@ -10832,7 +10888,7 @@ function Sf(e) {
10832
10888
  }
10833
10889
  return 0;
10834
10890
  }
10835
- function Cf(e) {
10891
+ function kf(e) {
10836
10892
  let t = e;
10837
10893
  for (; t;) {
10838
10894
  if (!t.visible) return !1;
@@ -10840,16 +10896,16 @@ function Cf(e) {
10840
10896
  }
10841
10897
  return !0;
10842
10898
  }
10843
- function wf(e, t, n) {
10844
- return n.length ? (hf.copy(t).applyMatrix4(e.matrixWorld), Rs(hf, n)) : !0;
10899
+ function Af(e, t, n) {
10900
+ return n.length ? (xf.copy(t).applyMatrix4(e.matrixWorld), Rs(xf, n)) : !0;
10845
10901
  }
10846
- function Tf(e, t, n, r, i) {
10847
- return i.length ? (gf.copy(t).applyMatrix4(e.matrixWorld), _f.copy(n).applyMatrix4(e.matrixWorld), vf.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
10848
- let t = e.distanceToPoint(gf), n = e.distanceToPoint(_f), r = e.distanceToPoint(vf);
10902
+ function jf(e, t, n, r, i) {
10903
+ return i.length ? (Sf.copy(t).applyMatrix4(e.matrixWorld), Cf.copy(n).applyMatrix4(e.matrixWorld), wf.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
10904
+ let t = e.distanceToPoint(Sf), n = e.distanceToPoint(Cf), r = e.distanceToPoint(wf);
10849
10905
  return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
10850
10906
  })) : !0;
10851
10907
  }
10852
- function Ef(e) {
10908
+ function Mf(e) {
10853
10909
  let t = e.getBoundingClientRect();
10854
10910
  return {
10855
10911
  height: t.height,
@@ -10858,7 +10914,7 @@ function Ef(e) {
10858
10914
  width: t.width
10859
10915
  };
10860
10916
  }
10861
- function Df(e) {
10917
+ function Nf(e) {
10862
10918
  return {
10863
10919
  boundsCheckMs: 0,
10864
10920
  candidateIds: 0,
@@ -10884,7 +10940,7 @@ function Df(e) {
10884
10940
  triangleProjectionMs: 0
10885
10941
  };
10886
10942
  }
10887
- function Of(e, t) {
10943
+ function Pf(e, t) {
10888
10944
  return {
10889
10945
  minX: Math.min(e.x, t.x),
10890
10946
  minY: Math.min(e.y, t.y),
@@ -10892,43 +10948,43 @@ function Of(e, t) {
10892
10948
  maxY: Math.max(e.y, t.y)
10893
10949
  };
10894
10950
  }
10895
- function kf(e, t) {
10951
+ function Ff(e, t) {
10896
10952
  return t.x >= e.x ? "contains" : "intersects";
10897
10953
  }
10898
- function Af(e, t) {
10899
- return jf(e.x, e.y, t);
10954
+ function If(e, t) {
10955
+ return Lf(e.x, e.y, t);
10900
10956
  }
10901
- function jf(e, t, n) {
10957
+ function Lf(e, t, n) {
10902
10958
  return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
10903
10959
  }
10904
- function Mf(e, t, n, r, i, a) {
10960
+ function Rf(e, t, n, r, i, a) {
10905
10961
  return (a - t) * (n - e) > (r - t) * (i - e);
10906
10962
  }
10907
- function Nf(e, t, n, r, i, a, o, s) {
10908
- return Mf(e, t, i, a, o, s) !== Mf(n, r, i, a, o, s) && Mf(e, t, n, r, i, a) !== Mf(e, t, n, r, o, s);
10963
+ function zf(e, t, n, r, i, a, o, s) {
10964
+ return Rf(e, t, i, a, o, s) !== Rf(n, r, i, a, o, s) && Rf(e, t, n, r, i, a) !== Rf(e, t, n, r, o, s);
10909
10965
  }
10910
- function Pf(e, t, n, r, i) {
10966
+ function Bf(e, t, n, r, i) {
10911
10967
  let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
10912
10968
  return s >= 0 && c >= 0 && s + c <= 2 * a * o;
10913
10969
  }
10914
- function Ff(e, t, n, r) {
10915
- return Af(e, r) || Af(t, r) || Af(n, r) || Pf(r.minX, r.minY, e, t, n) || Pf(r.maxX, r.minY, e, t, n) || Pf(r.maxX, r.maxY, e, t, n) || Pf(r.minX, r.maxY, e, t, n) ? !0 : If(e, t, r) || If(t, n, r) || If(n, e, r);
10970
+ function Vf(e, t, n, r) {
10971
+ return If(e, r) || If(t, r) || If(n, r) || Bf(r.minX, r.minY, e, t, n) || Bf(r.maxX, r.minY, e, t, n) || Bf(r.maxX, r.maxY, e, t, n) || Bf(r.minX, r.maxY, e, t, n) ? !0 : Hf(e, t, r) || Hf(t, n, r) || Hf(n, e, r);
10916
10972
  }
10917
- function If(e, t, n) {
10918
- return Nf(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || Nf(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || Nf(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || Nf(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
10973
+ function Hf(e, t, n) {
10974
+ return zf(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || zf(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || zf(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || zf(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
10919
10975
  }
10920
- function Lf(e, t, n, r, i = new H()) {
10921
- let a = ff.copy(t).applyMatrix4(e.matrixWorld).project(n);
10976
+ function Uf(e, t, n, r, i = new H()) {
10977
+ let a = vf.copy(t).applyMatrix4(e.matrixWorld).project(n);
10922
10978
  return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
10923
10979
  }
10924
- function Rf(e, t, n, r, i) {
10980
+ function Wf(e, t, n, r, i) {
10925
10981
  let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
10926
- for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) pf.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Lf(e, pf, r, i, mf), a = Math.min(a, mf.x), o = Math.max(o, mf.x), s = Math.min(s, mf.y), c = Math.max(c, mf.y), Af(mf, n) && (l += 1);
10982
+ for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) yf.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Uf(e, yf, r, i, bf), a = Math.min(a, bf.x), o = Math.max(o, bf.x), s = Math.min(s, bf.y), c = Math.max(c, bf.y), If(bf, n) && (l += 1);
10927
10983
  return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? pt : l === 8 ? ut : dt;
10928
10984
  }
10929
- function zf(e, t, n, r) {
10985
+ function Gf(e, t, n, r) {
10930
10986
  let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
10931
- for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) pf.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Lf(e, pf, n, r, mf), i = Math.min(i, mf.x), a = Math.max(a, mf.x), o = Math.min(o, mf.y), s = Math.max(s, mf.y);
10987
+ for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) yf.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Uf(e, yf, n, r, bf), i = Math.min(i, bf.x), a = Math.max(a, bf.x), o = Math.min(o, bf.y), s = Math.max(s, bf.y);
10932
10988
  return {
10933
10989
  minX: i,
10934
10990
  minY: o,
@@ -10936,41 +10992,41 @@ function zf(e, t, n, r) {
10936
10992
  maxY: s
10937
10993
  };
10938
10994
  }
10939
- function Bf(e, t) {
10995
+ function Kf(e, t) {
10940
10996
  return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
10941
10997
  }
10942
- function Vf(e, t, n, r) {
10998
+ function qf(e, t, n, r) {
10943
10999
  e.geometry.boundingBox || e.geometry.computeBoundingBox();
10944
11000
  let i = e.geometry.boundingBox;
10945
- return i ? Bf(zf(e, i, n, r), t) : !0;
11001
+ return i ? Kf(Gf(e, i, n, r), t) : !0;
10946
11002
  }
10947
- function Hf(e, t, n) {
11003
+ function Jf(e, t, n) {
10948
11004
  let r = e.get(t);
10949
11005
  r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
10950
11006
  }
10951
- function Uf(e) {
11007
+ function Yf(e) {
10952
11008
  let t = 0;
10953
11009
  return e.forEach((e) => {
10954
11010
  t += e.size;
10955
11011
  }), t;
10956
11012
  }
10957
- function Wf(e, t, n, r = []) {
11013
+ function Xf(e, t, n, r = []) {
10958
11014
  let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
10959
11015
  if (!a || !o || !s) return;
10960
11016
  let c = t * 3;
10961
- r.length && (yf.fromBufferAttribute(s, a.getX(c)), bf.fromBufferAttribute(s, a.getX(c + 1)), xf.fromBufferAttribute(s, a.getX(c + 2)), !Tf(e, yf, bf, xf, r)) || Hf(n, Sf(e), o.getX(a.getX(c)));
11017
+ r.length && (Tf.fromBufferAttribute(s, a.getX(c)), Ef.fromBufferAttribute(s, a.getX(c + 1)), Df.fromBufferAttribute(s, a.getX(c + 2)), !jf(e, Tf, Ef, Df, r)) || Jf(n, Of(e), o.getX(a.getX(c)));
10962
11018
  }
10963
- function Gf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
11019
+ function Zf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
10964
11020
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new U();
10965
11021
  e.traverse((e) => {
10966
11022
  let s = e;
10967
- if (!s.isMesh || !Cf(s)) return;
11023
+ if (!s.isMesh || !kf(s)) return;
10968
11024
  let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
10969
11025
  if (!(!u || !d)) {
10970
11026
  o && (o.containedVerticesVisited += u.count);
10971
11027
  for (let e = 0; e < u.count; e++) {
10972
- let f = Sf(s), p = u.getX(e);
10973
- if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !wf(s, l, a))) continue;
11028
+ let f = Of(s), p = u.getX(e);
11029
+ if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Af(s, l, a))) continue;
10974
11030
  o && (o.containedCandidateVertices += 1);
10975
11031
  let m = `${f}:${p}`, h = c.get(m);
10976
11032
  h || (h = {
@@ -10978,23 +11034,23 @@ function Gf({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
10978
11034
  inside: 0,
10979
11035
  modelID: f,
10980
11036
  total: 0
10981
- }, c.set(m, h)), h.total += 1, Af(Lf(s, l, t, n), r) && (h.inside += 1);
11037
+ }, c.set(m, h)), h.total += 1, If(Uf(s, l, t, n), r) && (h.inside += 1);
10982
11038
  }
10983
11039
  }
10984
11040
  });
10985
11041
  let u = /* @__PURE__ */ new Map();
10986
11042
  return c.forEach((e) => {
10987
- e.total > 0 && e.total === e.inside && Hf(u, e.modelID, e.id);
11043
+ e.total > 0 && e.total === e.inside && Jf(u, e.modelID, e.id);
10988
11044
  }), o && (o.containedIdsMs += performance.now() - s), u;
10989
11045
  }
10990
- function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
11046
+ function Qf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
10991
11047
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
10992
11048
  if (!e) return c;
10993
- let u = Ef(r), d = performance.now();
11049
+ let u = Mf(r), d = performance.now();
10994
11050
  e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
10995
11051
  let r = e;
10996
11052
  if (!r.isMesh) return;
10997
- if (o && (o.meshCount += 1), !Cf(r)) {
11053
+ if (o && (o.meshCount += 1), !kf(r)) {
10998
11054
  o && (o.skippedMeshCount += 1);
10999
11055
  return;
11000
11056
  }
@@ -11003,7 +11059,7 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
11003
11059
  o && (o.skippedMeshCount += 1);
11004
11060
  return;
11005
11061
  }
11006
- let d = performance.now(), f = Vf(r, i, t, u);
11062
+ let d = performance.now(), f = qf(r, i, t, u);
11007
11063
  if (o && (o.boundsCheckMs += performance.now() - d), !f) {
11008
11064
  o && (o.skippedMeshCount += 1);
11009
11065
  return;
@@ -11011,26 +11067,26 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
11011
11067
  let p = performance.now();
11012
11068
  s.shapecast({
11013
11069
  intersectsBounds: (e) => {
11014
- let n = performance.now(), a = Rf(r, e, i, t, u);
11070
+ let n = performance.now(), a = Wf(r, e, i, t, u);
11015
11071
  return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
11016
11072
  },
11017
11073
  intersectsRange: (e, t, i) => {
11018
11074
  let u = performance.now();
11019
11075
  if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
11020
- for (let i = e; i < e + t; i++) Wf(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
11076
+ for (let i = e; i < e + t; i++) Xf(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
11021
11077
  return o && (o.intersectsRangeMs += performance.now() - u), !1;
11022
11078
  },
11023
11079
  intersectsTriangle: (e, s, d) => {
11024
11080
  let f = performance.now();
11025
11081
  if (o && (o.intersectsTriangleCalls += 1), !d) {
11026
- let n = performance.now(), a = Lf(r, e.a, t, u), s = Lf(r, e.b, t, u), c = Lf(r, e.c, t, u);
11027
- if (o && (o.triangleProjectionMs += performance.now() - n), !Ff(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
11082
+ let n = performance.now(), a = Uf(r, e.a, t, u), s = Uf(r, e.b, t, u), c = Uf(r, e.c, t, u);
11083
+ if (o && (o.triangleProjectionMs += performance.now() - n), !Vf(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
11028
11084
  }
11029
- return a === "contains" ? Wf(r, s, l, n) : Wf(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
11085
+ return a === "contains" ? Xf(r, s, l, n) : Xf(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
11030
11086
  }
11031
11087
  }), o && (o.shapecastMs += performance.now() - p);
11032
11088
  });
11033
- let f = a === "contains" ? Gf({
11089
+ let f = a === "contains" ? Zf({
11034
11090
  model: e,
11035
11091
  camera: t,
11036
11092
  clippingPlanes: n,
@@ -11039,19 +11095,19 @@ function Kf({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
11039
11095
  candidateIdsByModel: l,
11040
11096
  profile: o
11041
11097
  }) : c;
11042
- return o && (o.candidateIds = Uf(l), o.selectedIds = Uf(f), o.totalMs = performance.now() - s), f;
11098
+ return o && (o.candidateIds = Yf(l), o.selectedIds = Yf(f), o.totalMs = performance.now() - s), f;
11043
11099
  }
11044
- function qf(e) {
11045
- let t = Df(e.mode);
11100
+ function $f(e) {
11101
+ let t = Nf(e.mode);
11046
11102
  return {
11047
- ids: Kf({
11103
+ ids: Qf({
11048
11104
  ...e,
11049
11105
  profile: t
11050
11106
  }),
11051
11107
  profile: t
11052
11108
  };
11053
11109
  }
11054
- function Jf(e) {
11110
+ function ep(e) {
11055
11111
  return e === "contains" ? {
11056
11112
  border: "rgb(37, 99, 235)",
11057
11113
  background: "rgba(37, 99, 235, 0.16)"
@@ -11060,40 +11116,40 @@ function Jf(e) {
11060
11116
  background: "rgba(22, 163, 74, 0.16)"
11061
11117
  };
11062
11118
  }
11063
- function Yf(e, t, n) {
11064
- let r = Jf(kf(t, n));
11119
+ function tp(e, t, n) {
11120
+ let r = ep(Ff(t, n));
11065
11121
  if (!e.current) {
11066
11122
  let t = document.createElement("div");
11067
11123
  t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
11068
11124
  }
11069
- let i = Of(t, n);
11125
+ let i = Pf(t, n);
11070
11126
  e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
11071
11127
  }
11072
- function Xf(e) {
11128
+ function np(e) {
11073
11129
  e.current?.remove(), e.current = null;
11074
11130
  }
11075
11131
  //#endregion
11076
11132
  //#region src/viewer/Selector/useSelector.tsx
11077
- var Zf = 40;
11078
- function Qf(e) {
11079
- if (Array.isArray(e)) return e.flatMap((e) => Qf(e));
11133
+ var rp = 40;
11134
+ function ip(e) {
11135
+ if (Array.isArray(e)) return e.flatMap((e) => ip(e));
11080
11136
  let t = e.userData;
11081
11137
  return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
11082
11138
  }
11083
- function $f(e) {
11139
+ function ap(e) {
11084
11140
  let t = x(e);
11085
11141
  return t.current = e, t;
11086
11142
  }
11087
- function ep(e, t) {
11088
- Qf(e)?.forEach((e) => {
11143
+ function op(e, t) {
11144
+ ip(e)?.forEach((e) => {
11089
11145
  let n = e.uniforms.preSelectionId;
11090
11146
  n && (n.value = t);
11091
11147
  });
11092
11148
  }
11093
- function tp(e) {
11149
+ function sp(e) {
11094
11150
  return Number(e.current?.modelID ?? 0);
11095
11151
  }
11096
- function np(e) {
11152
+ function cp(e) {
11097
11153
  let t = e;
11098
11154
  for (; t;) {
11099
11155
  let e = t.modelID ?? t.userData.modelID;
@@ -11102,7 +11158,7 @@ function np(e) {
11102
11158
  }
11103
11159
  return 0;
11104
11160
  }
11105
- function rp(e) {
11161
+ function lp(e) {
11106
11162
  let t = e;
11107
11163
  for (; t;) {
11108
11164
  if (!t.visible) return !1;
@@ -11110,7 +11166,7 @@ function rp(e) {
11110
11166
  }
11111
11167
  return !0;
11112
11168
  }
11113
- function ip(e) {
11169
+ function up(e) {
11114
11170
  if (!e) return "";
11115
11171
  let t = [
11116
11172
  e.uuid,
@@ -11123,24 +11179,24 @@ function ip(e) {
11123
11179
  });
11124
11180
  }), t.join(":");
11125
11181
  }
11126
- function ap(e) {
11127
- if (!rp(e.object) || !(e.object instanceof z) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
11182
+ function dp(e) {
11183
+ if (!lp(e.object) || !(e.object instanceof z) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
11128
11184
  let t = e.object.geometry;
11129
11185
  return !!(t.index && t.attributes.ids);
11130
11186
  }
11131
- function op(e) {
11132
- if (!ap(e)) return null;
11187
+ function fp(e) {
11188
+ if (!dp(e)) return null;
11133
11189
  let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
11134
11190
  if (r >= i.count) return null;
11135
11191
  let a = n.attributes.modelID;
11136
11192
  return {
11137
11193
  elementID: i.getX(r),
11138
11194
  hit: e,
11139
- modelID: a ? a.getX(r) : np(t)
11195
+ modelID: a ? a.getX(r) : cp(t)
11140
11196
  };
11141
11197
  }
11142
- function sp(e, t, n, r, i, a, o, s = 0) {
11143
- let c = x("end"), l = G((e) => e.selected), u = G((e) => e.setSelected), d = G((e) => e.addSelected), f = G((e) => e.removeSelected), p = G((e) => e.showStats), m = G((e) => e.preselectionEnabled), h = $f(m), g = Et(), v = x(null), y = x(null), b = x(!1), S = x(!1), C = x("add"), w = x(null), ee = x(!1), T = x(0), E = x(null), O = x(null), te = x(null), k = x(m), A = x({
11198
+ function pp(e, t, n, r, i, a, o, s = 0) {
11199
+ let c = x("end"), l = G((e) => e.selected), u = G((e) => e.setSelected), d = G((e) => e.addSelected), f = G((e) => e.removeSelected), p = G((e) => e.showStats), m = G((e) => e.preselectionEnabled), h = ap(m), g = Et(), v = x(null), y = x(null), b = x(!1), S = x(!1), C = x("add"), w = x(null), ee = x(!1), T = x(0), E = x(null), O = x(null), te = x(null), k = x(m), A = x({
11144
11200
  meshesByModel: /* @__PURE__ */ new Map(),
11145
11201
  root: null,
11146
11202
  version: ""
@@ -11154,12 +11210,12 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11154
11210
  let n = t.current;
11155
11211
  n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
11156
11212
  }, M = () => {
11157
- let t = e.current, n = ip(t), r = A.current;
11213
+ let t = e.current, n = up(t), r = A.current;
11158
11214
  if (r.root !== t || r.version !== n) {
11159
11215
  let e = /* @__PURE__ */ new Map();
11160
11216
  return t?.traverse((t) => {
11161
11217
  if (!(t instanceof z) || !t.geometry.index || !t.geometry.attributes.ids) return;
11162
- let n = np(t), r = e.get(n) ?? [];
11218
+ let n = cp(t), r = e.get(n) ?? [];
11163
11219
  r.push(t), e.set(n, r);
11164
11220
  }), A.current = {
11165
11221
  meshesByModel: e,
@@ -11170,7 +11226,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11170
11226
  return r;
11171
11227
  }, oe = () => Array.from(M().meshesByModel.values()).flat(), se = (e) => M().meshesByModel.get(e) ?? [], ce = (e) => {
11172
11228
  e && se(e.modelID).forEach((e) => {
11173
- e.preselected = !1, ep(e.material, -1);
11229
+ e.preselected = !1, op(e.material, -1);
11174
11230
  });
11175
11231
  }, le = () => {
11176
11232
  a?.(null), ce(te.current), te.current = null;
@@ -11185,13 +11241,13 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11185
11241
  elementID: t,
11186
11242
  modelID: e
11187
11243
  }), se(e).forEach((e) => {
11188
- e.preselected = !0, ep(e.material, t);
11244
+ e.preselected = !0, op(e.material, t);
11189
11245
  }), te.current = {
11190
11246
  elementID: t,
11191
11247
  modelID: e
11192
11248
  });
11193
11249
  }, de = () => {
11194
- v.current = null, b.current = !1, Xf(y), t.current && (t.current.enabled = !0);
11250
+ v.current = null, b.current = !1, np(y), t.current && (t.current.enabled = !0);
11195
11251
  }, N = (e) => {
11196
11252
  if (re()) {
11197
11253
  ie(), le();
@@ -11233,7 +11289,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11233
11289
  return;
11234
11290
  }
11235
11291
  if (O.current = e, E.current !== null) return;
11236
- let t = fe() - T.current, n = Math.max(0, Zf - t);
11292
+ let t = fe() - T.current, n = Math.max(0, rp - t);
11237
11293
  E.current = window.setTimeout(() => {
11238
11294
  E.current = null;
11239
11295
  let e = O.current;
@@ -11270,7 +11326,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11270
11326
  c.current = "end";
11271
11327
  return;
11272
11328
  }
11273
- let n = t.shiftKey, r = t.ctrlKey, i = Se(t), a, o = tp(e), s = null;
11329
+ let n = t.shiftKey, r = t.ctrlKey, i = Se(t), a, o = sp(e), s = null;
11274
11330
  if (i && (o = i.modelID, s = i.hit.point, a = i.elementID), r) {
11275
11331
  a !== void 0 && f(o, [a]);
11276
11332
  return;
@@ -11288,7 +11344,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11288
11344
  }
11289
11345
  if (!v.current) return;
11290
11346
  let t = new H(e.clientX, e.clientY), n = Math.abs(t.x - v.current.x), r = Math.abs(t.y - v.current.y);
11291
- n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(), Yf(y, v.current, t));
11347
+ n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(), tp(y, v.current, t));
11292
11348
  }, ye = (r) => {
11293
11349
  if (ne()) {
11294
11350
  de();
@@ -11296,12 +11352,12 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11296
11352
  }
11297
11353
  if (!v.current) return;
11298
11354
  F.current = me();
11299
- let i = b.current, a = new H(r.clientX, r.clientY), o = Of(v.current, a), s = kf(v.current, a);
11300
- if (v.current = null, b.current = !1, Xf(y), t.current && setTimeout(() => {
11355
+ let i = b.current, a = new H(r.clientX, r.clientY), o = Pf(v.current, a), s = Ff(v.current, a);
11356
+ if (v.current = null, b.current = !1, np(y), t.current && setTimeout(() => {
11301
11357
  t.current && (t.current.enabled = !0);
11302
11358
  }, 100), !i) return;
11303
11359
  S.current = !0, r.preventDefault();
11304
- let { ids: c, profile: l } = qf({
11360
+ let { ids: c, profile: l } = $f({
11305
11361
  model: e.current,
11306
11362
  camera: pe,
11307
11363
  clippingPlanes: n.getActiveClippingPlanes(),
@@ -11321,7 +11377,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11321
11377
  let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
11322
11378
  return i.length ? n.getIntersection(!1, {
11323
11379
  event: e,
11324
- filter: ap,
11380
+ filter: dp,
11325
11381
  firstHitOnly: r,
11326
11382
  object: i,
11327
11383
  recursive: !0
@@ -11329,11 +11385,11 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11329
11385
  }, be = () => i?.().filter((e) => e.visible) ?? [], xe = (e, t) => {
11330
11386
  let n = L(e, t, !0);
11331
11387
  for (let e of n) {
11332
- let t = op(e);
11388
+ let t = fp(e);
11333
11389
  if (t) return t;
11334
11390
  }
11335
11391
  return null;
11336
- }, Se = (e) => xe(e, be()) || xe(e, oe()), R = $f({
11392
+ }, Se = (e) => xe(e, be()) || xe(e, oe()), R = ap({
11337
11393
  clearPreselection: le,
11338
11394
  onBoxPointerDown: _e,
11339
11395
  onBoxPointerMove: ve,
@@ -11365,7 +11421,7 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11365
11421
  e.ctrlKey && e.preventDefault();
11366
11422
  }
11367
11423
  return () => {
11368
- Xf(y), E.current !== null && (window.clearTimeout(E.current), E.current = null), O.current = null, R.current.clearPreselection(), e?.removeEventListener("controlstart", p), e?.removeEventListener("update", u), n.removeEventListener("pointerdown", r), n.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointerup", o), n.removeEventListener("contextmenu", g), n.removeEventListener("pointerup", h), n.removeEventListener("pointerdown", f), m && (n.removeEventListener("pointermove", s), n.removeEventListener("pointerleave", l));
11424
+ np(y), E.current !== null && (window.clearTimeout(E.current), E.current = null), O.current = null, R.current.clearPreselection(), e?.removeEventListener("controlstart", p), e?.removeEventListener("update", u), n.removeEventListener("pointerdown", r), n.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointerup", o), n.removeEventListener("contextmenu", g), n.removeEventListener("pointerup", h), n.removeEventListener("pointerdown", f), m && (n.removeEventListener("pointermove", s), n.removeEventListener("pointerleave", l));
11369
11425
  };
11370
11426
  }, [
11371
11427
  t,
@@ -11377,30 +11433,30 @@ function sp(e, t, n, r, i, a, o, s = 0) {
11377
11433
  }
11378
11434
  //#endregion
11379
11435
  //#region src/viewer/Camera/useCameraFit.tsx
11380
- var cp = new U(1, 1, 1).normalize(), lp = 1.18, up = .001, dp = .001, fp = 4, pp = 1.45;
11381
- function mp(e, t) {
11382
- let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(dp, t) * Math.max(e.zoom, 1e-4), i = r * n;
11436
+ var mp = new U(1, 1, 1).normalize(), hp = 1.18, gp = .001, _p = .001, vp = 4, yp = 1.45;
11437
+ function bp(e, t) {
11438
+ let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(_p, t) * Math.max(e.zoom, 1e-4), i = r * n;
11383
11439
  e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2;
11384
11440
  }
11385
- function hp(e, t) {
11441
+ function xp(e, t) {
11386
11442
  let n = Se.degToRad(e.fov), r = 2 * Math.atan(Math.tan(n / 2) * e.aspect);
11387
- return t / Math.sin(Math.min(n, r) / 2) * lp;
11443
+ return t / Math.sin(Math.min(n, r) / 2) * hp;
11388
11444
  }
11389
- function gp() {
11445
+ function Sp() {
11390
11446
  let { camera: e } = D();
11391
11447
  return h((t, n, r) => {
11392
11448
  if (!t.current || !(e instanceof je) && !(e instanceof Ae)) return;
11393
11449
  let i = new A().setFromObject(t.current);
11394
11450
  if (i.isEmpty()) return;
11395
- let a = i.getCenter(new U()), o = i.getBoundingSphere(new We()), s = n.current, c = e instanceof je ? hp(e, o.radius) : Math.max(o.radius * fp, up);
11451
+ let a = i.getCenter(new U()), o = i.getBoundingSphere(new We()), s = n.current, c = e instanceof je ? xp(e, o.radius) : Math.max(o.radius * vp, gp);
11396
11452
  e.up.set(0, 1, 0);
11397
- let l = a.clone().addScaledVector(cp, c);
11398
- s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof Ae && s.fitToSphere(new We(a, o.radius * pp), !1), s.update(0), e.updateMatrixWorld(!0)) : (e.position.copy(l), e.lookAt(a)), e instanceof Ae && (s || (e.zoom = 1, mp(e, o.radius * 2 * pp))), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), r.current && (r.current.position.copy(a).addScaledVector(cp, c * .8), r.current.lookAt(a));
11453
+ let l = a.clone().addScaledVector(mp, c);
11454
+ s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof Ae && s.fitToSphere(new We(a, o.radius * yp), !1), s.update(0), e.updateMatrixWorld(!0)) : (e.position.copy(l), e.lookAt(a)), e instanceof Ae && (s || (e.zoom = 1, bp(e, o.radius * 2 * yp))), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), r.current && (r.current.position.copy(a).addScaledVector(mp, c * .8), r.current.lookAt(a));
11399
11455
  }, [e]);
11400
11456
  }
11401
11457
  //#endregion
11402
11458
  //#region src/viewer/Camera/FirstPersonControls.tsx
11403
- var _p = 1, vp = .004, yp = -Math.PI / 2 + .01, bp = Math.PI / 2 - .01, xp = .24, Sp = 4, Cp = 1e4, wp = .5, Tp = .01, Ep = 1.5, Dp = 1500, Op = 3, kp = new Set([
11459
+ var Cp = 1, wp = .004, Tp = -Math.PI / 2 + .01, Ep = Math.PI / 2 - .01, Dp = .24, Op = 4, kp = 1e4, Ap = .5, jp = .01, Mp = 1.5, Np = 1500, Pp = 3, Fp = new Set([
11404
11460
  "KeyW",
11405
11461
  "KeyA",
11406
11462
  "KeyS",
@@ -11409,62 +11465,62 @@ var _p = 1, vp = .004, yp = -Math.PI / 2 + .01, bp = Math.PI / 2 - .01, xp = .24
11409
11465
  "ShiftRight",
11410
11466
  "ControlLeft",
11411
11467
  "ControlRight"
11412
- ]), Ap = new Set(["AltLeft", "AltRight"]), jp = new U(), Mp = new U(), Np = new U(), Pp = new U(), Fp = new U(0, -1, 0);
11413
- function Ip(e, t) {
11468
+ ]), Ip = new Set(["AltLeft", "AltRight"]), Lp = new U(), Rp = new U(), zp = new U(), Bp = new U(), Vp = new U(0, -1, 0);
11469
+ function Hp(e, t) {
11414
11470
  return typeof e == "number" && Number.isFinite(e) ? e : t;
11415
11471
  }
11416
- function Lp(e, t, n) {
11472
+ function Up(e, t, n) {
11417
11473
  return Math.min(n, Math.max(t, e));
11418
11474
  }
11419
- function Rp(e, t, n, r) {
11420
- return Lp(Ip(e, t), n, r);
11475
+ function Wp(e, t, n, r) {
11476
+ return Up(Hp(e, t), n, r);
11421
11477
  }
11422
- function zp(e) {
11478
+ function Gp(e) {
11423
11479
  if (!(e instanceof HTMLElement)) return !1;
11424
11480
  let t = e.tagName.toLowerCase();
11425
11481
  return e.isContentEditable || t === "input" || t === "textarea" || t === "select";
11426
11482
  }
11427
- function Bp(e) {
11483
+ function Kp(e) {
11428
11484
  if (!e) return {
11429
- eyeHeight: Ep,
11430
- groundMaxDistance: Ep * Op,
11431
- moveSpeed: Sp
11485
+ eyeHeight: Mp,
11486
+ groundMaxDistance: Mp * Pp,
11487
+ moveSpeed: Op
11432
11488
  };
11433
11489
  let t = new A().setFromObject(e);
11434
11490
  if (t.isEmpty()) return {
11435
- eyeHeight: Ep,
11436
- groundMaxDistance: Ep * Op,
11437
- moveSpeed: Sp
11491
+ eyeHeight: Mp,
11492
+ groundMaxDistance: Mp * Pp,
11493
+ moveSpeed: Op
11438
11494
  };
11439
- let n = t.getBoundingSphere(new We()).radius, r = Math.min(Dp, Math.max(Ep, n * Tp));
11495
+ let n = t.getBoundingSphere(new We()).radius, r = Math.min(Np, Math.max(Mp, n * jp));
11440
11496
  return {
11441
11497
  eyeHeight: r,
11442
- groundMaxDistance: r * Op,
11443
- moveSpeed: Math.min(Cp, Math.max(Sp, n * xp))
11498
+ groundMaxDistance: r * Pp,
11499
+ moveSpeed: Math.min(kp, Math.max(Op, n * Dp))
11444
11500
  };
11445
11501
  }
11446
- function Vp(e, t) {
11447
- let n = Bp(e), r = Rp(t.eyeHeight, n.eyeHeight, .01, Dp), i = Rp(t.groundSnapDistanceRatio, Op, .1, 100);
11502
+ function qp(e, t) {
11503
+ let n = Kp(e), r = Wp(t.eyeHeight, n.eyeHeight, .01, Np), i = Wp(t.groundSnapDistanceRatio, Pp, .1, 100);
11448
11504
  return {
11449
11505
  eyeHeight: r,
11450
- groundCheckInterval: Math.round(Rp(t.groundCheckInterval, _p, 1, 120)),
11506
+ groundCheckInterval: Math.round(Wp(t.groundCheckInterval, Cp, 1, 120)),
11451
11507
  groundMaxDistance: r * i,
11452
- lookSensitivity: Rp(t.lookSensitivity, vp, 1e-4, .1),
11453
- moveSpeed: Rp(t.speed, n.moveSpeed, .01, Cp)
11508
+ lookSensitivity: Wp(t.lookSensitivity, wp, 1e-4, .1),
11509
+ moveSpeed: Wp(t.speed, n.moveSpeed, .01, kp)
11454
11510
  };
11455
11511
  }
11456
- function Hp(e) {
11457
- return e.getWorldDirection(jp), jp.y = 0, jp.lengthSq() === 0 && jp.set(0, 0, -1), jp.normalize();
11512
+ function Jp(e) {
11513
+ return e.getWorldDirection(Lp), Lp.y = 0, Lp.lengthSq() === 0 && Lp.set(0, 0, -1), Lp.normalize();
11458
11514
  }
11459
- function Up(e) {
11460
- return Mp.copy(e).cross(Wp).normalize(), Mp.lengthSq() === 0 && Mp.set(1, 0, 0), Mp;
11515
+ function Yp(e) {
11516
+ return Rp.copy(e).cross(Xp).normalize(), Rp.lengthSq() === 0 && Rp.set(1, 0, 0), Rp;
11461
11517
  }
11462
- var Wp = new U(0, 1, 0);
11463
- function Gp(e, t) {
11518
+ var Xp = new U(0, 1, 0);
11519
+ function Zp(e, t) {
11464
11520
  let n = t.current;
11465
- n && (e.getWorldDirection(Pp), Pp.add(e.position), n.enabled = !0, n.cancel(), n.updateCameraUp(), n.setLookAt(e.position.x, e.position.y, e.position.z, Pp.x, Pp.y, Pp.z, !1), n.stop(), n.update(0));
11521
+ n && (e.getWorldDirection(Bp), Bp.add(e.position), n.enabled = !0, n.cancel(), n.updateCameraUp(), n.setLookAt(e.position.x, e.position.y, e.position.z, Bp.x, Bp.y, Bp.z, !1), n.stop(), n.update(0));
11466
11522
  }
11467
- function Kp(e) {
11523
+ function Qp(e) {
11468
11524
  return e.find((e) => {
11469
11525
  let t = e.object;
11470
11526
  for (; t;) {
@@ -11474,42 +11530,42 @@ function Kp(e) {
11474
11530
  return !0;
11475
11531
  });
11476
11532
  }
11477
- function qp(e, t) {
11478
- let n = Up(Hp(e));
11479
- return Np.set(0, 0, 0), t.has("KeyW") && (e.getWorldDirection(jp), Np.add(jp)), t.has("KeyS") && (e.getWorldDirection(jp), Np.sub(jp)), t.has("KeyD") && Np.add(n), t.has("KeyA") && Np.sub(n), (t.has("ShiftLeft") || t.has("ShiftRight")) && Np.add(Wp), (t.has("ControlLeft") || t.has("ControlRight")) && Np.sub(Wp), Np;
11533
+ function $p(e, t) {
11534
+ let n = Yp(Jp(e));
11535
+ return zp.set(0, 0, 0), t.has("KeyW") && (e.getWorldDirection(Lp), zp.add(Lp)), t.has("KeyS") && (e.getWorldDirection(Lp), zp.sub(Lp)), t.has("KeyD") && zp.add(n), t.has("KeyA") && zp.sub(n), (t.has("ShiftLeft") || t.has("ShiftRight")) && zp.add(Xp), (t.has("ControlLeft") || t.has("ControlRight")) && zp.sub(Xp), zp;
11480
11536
  }
11481
- function Jp(e) {
11537
+ function em(e) {
11482
11538
  return e.has("ShiftLeft") || e.has("ShiftRight") || e.has("ControlLeft") || e.has("ControlRight");
11483
11539
  }
11484
- function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
11485
- let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.invalidate), c = Et(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(Ep), f = x(0), p = x(Ep * Op), m = x(_p), h = x(vp), g = x(!1), v = x(!1), y = x(Sp), S = x({
11540
+ function tm({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
11541
+ let a = D((e) => e.camera), o = D((e) => e.gl), s = D((e) => e.invalidate), c = Et(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(Mp), f = x(0), p = x(Mp * Pp), m = x(Cp), h = x(wp), g = x(!1), v = x(!1), y = x(Op), S = x({
11486
11542
  pitch: 0,
11487
11543
  yaw: 0
11488
11544
  }), C = x(null), w = b(() => new Le(), []);
11489
11545
  return _(() => {
11490
11546
  t.current = e;
11491
11547
  }, [e, t]), _(() => {
11492
- let e = Vp(r.current, i);
11548
+ let e = qp(r.current, i);
11493
11549
  d.current = e.eyeHeight, m.current = e.groundCheckInterval, p.current = e.groundMaxDistance, h.current = e.lookSensitivity, y.current = e.moveSpeed;
11494
11550
  }, [r, i]), _(() => {
11495
11551
  let e = o.domElement, i = e.style.outline, c = e.style.userSelect;
11496
11552
  e.tabIndex = Math.max(e.tabIndex, 0), e.style.outline = "none", e.style.userSelect = "none";
11497
11553
  let _ = (e, t) => {
11498
11554
  let n = S.current, r = h.current;
11499
- n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(yp, Math.min(bp, n.pitch)), a.quaternion.setFromEuler(new N(n.pitch, n.yaw, 0, "YXZ")), a.updateMatrixWorld(), s();
11555
+ n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(Tp, Math.min(Ep, n.pitch)), a.quaternion.setFromEuler(new N(n.pitch, n.yaw, 0, "YXZ")), a.updateMatrixWorld(), s();
11500
11556
  }, b = () => {
11501
11557
  l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
11502
11558
  }, x = (e) => {
11503
11559
  if (!t.current) return;
11504
11560
  n.current?.cancel(), n.current && (n.current.enabled = !1);
11505
- let i = qp(a, u.current);
11561
+ let i = $p(a, u.current);
11506
11562
  if (i.lengthSq() === 0) return;
11507
- let o = v.current ? wp : 1;
11508
- if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !Jp(u.current) && f.current % m.current === 0) {
11563
+ let o = v.current ? Ap : 1;
11564
+ if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !em(u.current) && f.current % m.current === 0) {
11509
11565
  let e = w, t = e.firstHitOnly;
11510
- e.firstHitOnly = !0, w.set(a.position, Fp), w.far = p.current;
11566
+ e.firstHitOnly = !0, w.set(a.position, Vp), w.far = p.current;
11511
11567
  try {
11512
- let e = Kp(r.current ? w.intersectObject(r.current, !0) : []);
11568
+ let e = Qp(r.current ? w.intersectObject(r.current, !0) : []);
11513
11569
  e && (a.position.y = e.point.y + d.current);
11514
11570
  } finally {
11515
11571
  e.firstHitOnly = t, w.far = Infinity;
@@ -11533,18 +11589,18 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
11533
11589
  }, D = (n) => {
11534
11590
  t.current && document.pointerLockElement === e && _(n.movementX, n.movementY);
11535
11591
  }, O = (e) => {
11536
- if (t.current && !zp(e.target)) {
11537
- if (Ap.has(e.code)) {
11592
+ if (t.current && !Gp(e.target)) {
11593
+ if (Ip.has(e.code)) {
11538
11594
  e.repeat || (v.current = !v.current), e.preventDefault(), e.stopPropagation();
11539
11595
  return;
11540
11596
  }
11541
- kp.has(e.code) && (e.preventDefault(), e.stopPropagation(), u.current.add(e.code), C(), s());
11597
+ Fp.has(e.code) && (e.preventDefault(), e.stopPropagation(), u.current.add(e.code), C(), s());
11542
11598
  }
11543
11599
  }, te = (e) => {
11544
- kp.has(e.code) && (u.current.delete(e.code), u.current.size || b());
11600
+ Fp.has(e.code) && (u.current.delete(e.code), u.current.size || b());
11545
11601
  };
11546
11602
  return e.addEventListener("pointerdown", ee, !0), e.addEventListener("pointermove", E, !0), window.addEventListener("pointerup", T, !0), window.addEventListener("mousemove", D), window.addEventListener("keydown", O, !0), window.addEventListener("keyup", te, !0), () => {
11547
- e.removeEventListener("pointerdown", ee, !0), e.removeEventListener("pointermove", E, !0), window.removeEventListener("pointerup", T, !0), window.removeEventListener("mousemove", D), window.removeEventListener("keydown", O, !0), window.removeEventListener("keyup", te, !0), b(), e.style.outline = i, e.style.userSelect = c, g.current = !1, u.current.clear(), document.pointerLockElement === e && document.exitPointerLock(), Gp(a, n), s();
11603
+ e.removeEventListener("pointerdown", ee, !0), e.removeEventListener("pointermove", E, !0), window.removeEventListener("pointerup", T, !0), window.removeEventListener("mousemove", D), window.removeEventListener("keydown", O, !0), window.removeEventListener("keyup", te, !0), b(), e.style.outline = i, e.style.userSelect = c, g.current = !1, u.current.clear(), document.pointerLockElement === e && document.exitPointerLock(), Zp(a, n), s();
11548
11604
  };
11549
11605
  }, [
11550
11606
  a,
@@ -11564,14 +11620,14 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
11564
11620
  C.current = c.getState().preselectionEnabled, c.getState().setPreselectionEnabled(!1);
11565
11621
  let l = n.current;
11566
11622
  l && (l.enabled = !1, l.cancel());
11567
- let f = Vp(r.current, i);
11623
+ let f = qp(r.current, i);
11568
11624
  d.current = f.eyeHeight, m.current = f.groundCheckInterval, p.current = f.groundMaxDistance, h.current = f.lookSensitivity, y.current = f.moveSpeed;
11569
11625
  let g = new N().setFromQuaternion(a.quaternion, "YXZ");
11570
11626
  return S.current = {
11571
11627
  pitch: g.x,
11572
11628
  yaw: g.y
11573
11629
  }, () => {
11574
- u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), Gp(a, n), s();
11630
+ u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), Zp(a, n), s();
11575
11631
  };
11576
11632
  }, [
11577
11633
  e,
@@ -11586,8 +11642,8 @@ function Yp({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
11586
11642
  }
11587
11643
  //#endregion
11588
11644
  //#region src/viewer/ViewerComponents/ViewerScene.tsx
11589
- var Xp = .1, Zp = .02, Qp = 150, $p = 150, em = 500, tm = 5e6, nm = 50, rm = .001, im = .001, am = 1e3, om = 50, sm = 30, cm = 240, lm = 7, um = 1.25, dm = .08, fm = new U(1, 1, 1).normalize(), pm = new A(), mm = new We(), hm = new U(), gm = new U(), _m = new U();
11590
- function vm(e = !1) {
11645
+ var nm = .1, rm = .02, im = 150, am = 150, om = 500, sm = 5e6, cm = 50, lm = .001, um = .001, dm = 1e3, fm = 50, pm = 30, mm = 240, hm = 7, gm = 1.25, _m = .08, vm = new U(1, 1, 1).normalize(), ym = new A(), bm = new We(), xm = new U(), Sm = new U(), Cm = new U();
11646
+ function wm(e = !1) {
11591
11647
  return {
11592
11648
  active: e,
11593
11649
  finalFitDone: !1,
@@ -11595,23 +11651,23 @@ function vm(e = !1) {
11595
11651
  userInteractedAfterFirstFit: !1
11596
11652
  };
11597
11653
  }
11598
- function ym(e) {
11654
+ function Tm(e) {
11599
11655
  let t = [];
11600
11656
  return e?.traverse((e) => {
11601
11657
  e instanceof z && e.geometry.attributes.ids && t.push(e);
11602
11658
  }), t;
11603
11659
  }
11604
- function bm(e) {
11660
+ function Em(e) {
11605
11661
  let t = e.geometry.index?.count;
11606
11662
  return t === void 0 ? (e.geometry.attributes.position?.count ?? 0) / 3 : t / 3;
11607
11663
  }
11608
- function xm(e) {
11609
- return e.reduce((e, t) => e + bm(t), 0);
11664
+ function Dm(e) {
11665
+ return e.reduce((e, t) => e + Em(t), 0);
11610
11666
  }
11611
- function Sm(e) {
11612
- return xm(e) > tm;
11667
+ function Om(e) {
11668
+ return Dm(e) > sm;
11613
11669
  }
11614
- function Cm(e, t) {
11670
+ function km(e, t) {
11615
11671
  if (t <= 0 || !e.length) return [];
11616
11672
  let n = [...e];
11617
11673
  for (let e = n.length - 1; e > 0 && n.length - e <= t; e--) {
@@ -11620,10 +11676,10 @@ function Cm(e, t) {
11620
11676
  }
11621
11677
  return n.slice(-t);
11622
11678
  }
11623
- function wm(e, t) {
11679
+ function Am(e, t) {
11624
11680
  if (t <= 0) return null;
11625
- let n = ym(e);
11626
- if (!Sm(n)) return null;
11681
+ let n = Tm(e);
11682
+ if (!Om(n)) return null;
11627
11683
  let r = n.filter((e) => e.visible);
11628
11684
  if (r.length < 2) return null;
11629
11685
  let i = Math.min(r.length, Math.round(r.length * t));
@@ -11636,87 +11692,87 @@ function wm(e, t) {
11636
11692
  }
11637
11693
  o.push(e);
11638
11694
  });
11639
- let s = [...Cm(o, i)], c = i - s.length;
11640
- return c > 0 && s.push(...Cm(a, c)), s.length ? {
11695
+ let s = [...km(o, i)], c = i - s.length;
11696
+ return c > 0 && s.push(...km(a, c)), s.length ? {
11641
11697
  hiddenMeshes: s,
11642
11698
  root: e
11643
11699
  } : null;
11644
11700
  }
11645
- function Tm(e) {
11701
+ function jm(e) {
11646
11702
  let t = /* @__PURE__ */ new Map(), n = 0;
11647
11703
  return e.hiddenMeshes.forEach((e) => {
11648
11704
  e.parent && (t.set(e, e.visible), e.visible && (e.userData[dl] = !0, e.visible = !1, n++));
11649
11705
  }), n ? t : null;
11650
11706
  }
11651
- function Em(e) {
11707
+ function Mm(e) {
11652
11708
  e?.forEach((e, t) => {
11653
11709
  delete t.userData[dl], t.visible = e;
11654
11710
  });
11655
11711
  }
11656
- function Dm(e) {
11657
- let t = km(e);
11658
- return t ? Math.max(t.radius * Zp, Xp) : Xp;
11712
+ function Nm(e) {
11713
+ let t = Fm(e);
11714
+ return t ? Math.max(t.radius * rm, nm) : nm;
11659
11715
  }
11660
- function Om(e) {
11716
+ function Pm(e) {
11661
11717
  if (e.dollyToCursor = !0, e.camera instanceof Ae) {
11662
11718
  e.mouseButtons.middle = Fs.ACTION.ZOOM, e.mouseButtons.wheel = Fs.ACTION.ZOOM, e.touches.two = Fs.ACTION.TOUCH_ZOOM_TRUCK, e.infinityDolly = !1;
11663
11719
  return;
11664
11720
  }
11665
11721
  e.mouseButtons.middle = Fs.ACTION.DOLLY, e.mouseButtons.wheel = Fs.ACTION.DOLLY, e.touches.two = Fs.ACTION.TOUCH_DOLLY_TRUCK, e.infinityDolly = !0;
11666
11722
  }
11667
- function km(e) {
11668
- if (!e || (pm.setFromObject(e), pm.isEmpty())) return null;
11669
- let t = pm.getBoundingSphere(mm);
11723
+ function Fm(e) {
11724
+ if (!e || (ym.setFromObject(e), ym.isEmpty())) return null;
11725
+ let t = ym.getBoundingSphere(bm);
11670
11726
  return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
11671
11727
  }
11672
- function Am(e) {
11728
+ function Im(e) {
11673
11729
  return e.type === "Group" && typeof e.userData.modelID == "number";
11674
11730
  }
11675
- function jm(e) {
11676
- return e?.children.filter(Am) ?? [];
11731
+ function Lm(e) {
11732
+ return e?.children.filter(Im) ?? [];
11677
11733
  }
11678
- function Mm(e, t) {
11679
- return jm(e).find((e) => e.userData.modelID === t) ?? null;
11734
+ function Rm(e, t) {
11735
+ return Lm(e).find((e) => e.userData.modelID === t) ?? null;
11680
11736
  }
11681
- function Nm(e) {
11737
+ function zm(e) {
11682
11738
  return e instanceof Ae ? "orthographic" : "perspective";
11683
11739
  }
11684
- function Pm(e) {
11740
+ function Bm(e) {
11685
11741
  return e instanceof je || e instanceof Ae;
11686
11742
  }
11687
- function Fm(e) {
11743
+ function Vm(e) {
11688
11744
  return e.height > 0 ? e.width / e.height : 1;
11689
11745
  }
11690
- function Im(e) {
11691
- return Math.max(im, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
11746
+ function Hm(e) {
11747
+ return Math.max(um, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
11692
11748
  }
11693
- function Lm(e, t, n) {
11694
- let r = Math.max(im, n) * Math.max(e.zoom, 1e-4), i = r * t;
11749
+ function Um(e, t, n) {
11750
+ let r = Math.max(um, n) * Math.max(e.zoom, 1e-4), i = r * t;
11695
11751
  e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2, e.updateProjectionMatrix();
11696
11752
  }
11697
- function Rm(e, t) {
11698
- if (e instanceof Ae) return Im(e);
11753
+ function Wm(e, t) {
11754
+ if (e instanceof Ae) return Hm(e);
11699
11755
  if (e instanceof je) {
11700
- let n = Math.max(rm, e.position.distanceTo(t));
11756
+ let n = Math.max(lm, e.position.distanceTo(t));
11701
11757
  return 2 * Math.tan(Se.degToRad(e.fov) / 2) * n;
11702
11758
  }
11703
11759
  return 1;
11704
11760
  }
11705
- function zm(e, t) {
11706
- let n = Fm(t);
11761
+ function Gm(e, t) {
11762
+ let n = Vm(t);
11707
11763
  if (e instanceof je) {
11708
11764
  e.aspect = n, e.updateProjectionMatrix();
11709
11765
  return;
11710
11766
  }
11711
- e instanceof Ae && Lm(e, n, Im(e));
11767
+ e instanceof Ae && Um(e, n, Hm(e));
11712
11768
  }
11713
- function Bm(e, t) {
11714
- let n = km(t);
11769
+ function Km(e, t) {
11770
+ let n = Fm(t);
11715
11771
  if (!n) return;
11716
- let r = Math.max(am, n.radius * om, e.near + 1);
11772
+ let r = Math.max(dm, n.radius * fm, e.near + 1);
11717
11773
  Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
11718
11774
  }
11719
- function Vm(e, t) {
11775
+ function qm(e, t) {
11720
11776
  let n = new A();
11721
11777
  return Object.entries(e).forEach(([e, r]) => {
11722
11778
  let i = Number(e), a = t.elementBounds.get(i);
@@ -11726,16 +11782,16 @@ function Vm(e, t) {
11726
11782
  });
11727
11783
  }), n.isEmpty() ? null : n;
11728
11784
  }
11729
- function Hm(e) {
11730
- let t = e.getSize(_m), n = Math.max(t.x, t.y, t.z);
11731
- return Number.isFinite(n) && n > 0 ? n * dm : Xp;
11785
+ function Jm(e) {
11786
+ let t = e.getSize(Cm), n = Math.max(t.x, t.y, t.z);
11787
+ return Number.isFinite(n) && n > 0 ? n * _m : nm;
11732
11788
  }
11733
- function Um(e, t, n) {
11734
- let r = Math.max(Xp, (Number.isFinite(n) ? n : Xp) * um), i = t.position.distanceTo(e);
11735
- return Number.isFinite(i) && i >= r ? e : (hm.copy(e).sub(t.position), (!Number.isFinite(hm.x + hm.y + hm.z) || hm.lengthSq() === 0) && t.getWorldDirection(hm), hm.lengthSq() === 0 && hm.set(0, 0, -1), hm.normalize(), gm.copy(t.position).addScaledVector(hm, r));
11789
+ function Ym(e, t, n) {
11790
+ let r = Math.max(nm, (Number.isFinite(n) ? n : nm) * gm), i = t.position.distanceTo(e);
11791
+ return Number.isFinite(i) && i >= r ? e : (xm.copy(e).sub(t.position), (!Number.isFinite(xm.x + xm.y + xm.z) || xm.lengthSq() === 0) && t.getWorldDirection(xm), xm.lengthSq() === 0 && xm.set(0, 0, -1), xm.normalize(), Sm.copy(t.position).addScaledVector(xm, r));
11736
11792
  }
11737
- function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadGeneration: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, initialPlanPlane: u, createPlanComment: d, createPlanMarkupCloud: f, deleteAllPlanNotes: p, onReady: m, onModelsReady: g, onCameraDprModeChange: v, publicApi: C, invalidatePlanViews: w, setPlanPreselectionHandler: ee, setPlanVisualObjectsGetter: T, setSceneApi: E, setPlanNotesModeActive: O, usePerformanceMoving: te, useWebGPU: k }) {
11738
- let A = D((e) => e.camera), ne = D((e) => e.gl), j = D((e) => e.invalidate), re = D((e) => e.scene), ie = D((e) => e.set), ae = D((e) => e.size), M = fd(s), oe = Ad(M), { colorPaletteTexture: se, colorUtils: ce } = Ru(M), le = Et(), ue = G((e) => e.selected), de = Bs(s), N = lf(s, n, de, k, w), fe = h((e) => {
11793
+ function Xm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadGeneration: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, initialPlanPlane: u, createPlanComment: d, createPlanMarkupCloud: f, deleteAllPlanNotes: p, onReady: m, onModelsReady: g, onCameraDprModeChange: v, publicApi: C, invalidatePlanViews: w, setPlanPreselectionHandler: ee, setPlanVisualObjectsGetter: T, setSceneApi: E, setPlanNotesModeActive: O, usePerformanceMoving: te, useWebGPU: k }) {
11794
+ let A = D((e) => e.camera), ne = D((e) => e.gl), j = D((e) => e.invalidate), re = D((e) => e.scene), ie = D((e) => e.set), ae = D((e) => e.size), M = vd(s), oe = Id(M), { colorPaletteTexture: se, colorUtils: ce } = Ru(M), le = Et(), ue = G((e) => e.selected), de = Bs(s), N = hf(s, n, de, k, w), fe = h((e) => {
11739
11795
  N.setCapsPreselection(e), w();
11740
11796
  }, [N, w]);
11741
11797
  _(() => {
@@ -11778,7 +11834,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11778
11834
  I,
11779
11835
  me,
11780
11836
  he
11781
- ]), _e = b(() => new $n(), []), ve = oe.buildIndex, ye = M.resetIndex, L = ce.applyStoredColors, be = gp(), xe = x(null), R = x(null), z = x(null), Ce = x(null), we = x(null), Te = x(null), B = x(vm()), Ee = x([]), De = x(/* @__PURE__ */ new Map()), Oe = x(/* @__PURE__ */ new Set()), ke = x(l), Me = x(null), Ne = x(null), Pe = x(null), Fe = x(0), Ie = x(!1), Le = x(l), Re = x(!1), ze = x(!1), Be = x(i), Ve = x(/* @__PURE__ */ new Map()), [He, Ue] = S(0), [We, Ge] = S(0);
11837
+ ]), _e = b(() => new $n(), []), ve = oe.buildIndex, ye = M.resetIndex, L = ce.applyStoredColors, be = Sp(), xe = x(null), R = x(null), z = x(null), Ce = x(null), we = x(null), Te = x(null), B = x(wm()), Ee = x([]), De = x(/* @__PURE__ */ new Map()), Oe = x(/* @__PURE__ */ new Set()), ke = x(l), Me = x(null), Ne = x(null), Pe = x(null), Fe = x(0), Ie = x(!1), Le = x(l), Re = x(!1), ze = x(!1), Be = x(i), Ve = x(/* @__PURE__ */ new Map()), [He, Ue] = S(0), [We, Ge] = S(0);
11782
11838
  _(() => {
11783
11839
  let e = new Set(Object.keys(c).map((e) => Number(e)));
11784
11840
  Oe.current.forEach((t) => {
@@ -11786,7 +11842,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11786
11842
  }), Oe.current = e;
11787
11843
  }, [ce, c]);
11788
11844
  let [Ke, qe] = S(!1), [Je, Ye] = S({}), Xe = x(!1), V = G((e) => e.showStats), Ze = G((e) => e.lighting), Qe = G((e) => e.performanceMovingFactor);
11789
- Be.current !== i && (Be.current = i, Ve.current.clear(), B.current = vm(), Me.current = null);
11845
+ Be.current !== i && (Be.current = i, Ve.current.clear(), B.current = wm(), Me.current = null);
11790
11846
  let $e = h((e, t, n) => {
11791
11847
  let r = Ve.current.get(e) ?? 0;
11792
11848
  Ve.current.set(e, t), n > 0 && t >= n && r < n && Ue((e) => e + 1);
@@ -11799,10 +11855,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11799
11855
  if (!t || e.camera.uuid !== t.cameraUuid) return !1;
11800
11856
  Ne.current = null, e.cancel(), e.updateCameraUp();
11801
11857
  let n = e;
11802
- return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1), Om(e), e.minDistance = Dm(s.current), e.stop(), e.update(0), n.saveState?.(), j(), !0;
11858
+ return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1), Pm(e), e.minDistance = Nm(s.current), e.stop(), e.update(0), n.saveState?.(), j(), !0;
11803
11859
  }, [j, s]), tt = h((e) => {
11804
11860
  let t = n;
11805
- t.current !== e && (t.current = e, e && (e.minDistance = Dm(s.current), Om(e), et(e)), Ge((e) => e + 1));
11861
+ t.current !== e && (t.current = e, e && (e.minDistance = Nm(s.current), Pm(e), et(e)), Ge((e) => e + 1));
11806
11862
  }, [
11807
11863
  n,
11808
11864
  s,
@@ -11817,7 +11873,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11817
11873
  ...e
11818
11874
  }));
11819
11875
  }, []), st = h(() => {
11820
- R.current !== null && (window.clearTimeout(R.current), R.current = null), z.current !== null && (window.clearTimeout(z.current), z.current = null), Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null), Em(Te.current), Te.current = null, we.current = null, N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep"), j();
11876
+ R.current !== null && (window.clearTimeout(R.current), R.current = null), z.current !== null && (window.clearTimeout(z.current), z.current = null), Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null), Mm(Te.current), Te.current = null, we.current = null, N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep"), j();
11821
11877
  }, [
11822
11878
  N,
11823
11879
  j,
@@ -11855,7 +11911,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11855
11911
  s,
11856
11912
  k
11857
11913
  ]), _(() => {
11858
- zm(A, ae), j();
11914
+ Gm(A, ae), j();
11859
11915
  }, [
11860
11916
  A,
11861
11917
  j,
@@ -11873,11 +11929,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11873
11929
  let dt = b(() => {
11874
11930
  let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
11875
11931
  for (let t of e) {
11876
- let e = $u(c[Number(t)]);
11932
+ let e = ed(c[Number(t)]);
11877
11933
  if (e) return e;
11878
11934
  }
11879
11935
  return null;
11880
- }, [c]), ft = b(() => Zu(dt ?? void 0), [dt]), pt = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), mt = b(() => pt.map(([e]) => e), [pt]), ht = b(() => new Map(pt.map(([e, t]) => [e, Object.keys(t.data).length])), [pt]);
11936
+ }, [c]), ft = b(() => Qu(dt ?? void 0), [dt]), pt = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), mt = b(() => pt.map(([e]) => e), [pt]), ht = b(() => new Map(pt.map(([e, t]) => [e, Object.keys(t.data).length])), [pt]);
11881
11937
  Ee.current = mt, De.current = ht, ke.current = l, _(() => {
11882
11938
  let e = new Set(mt);
11883
11939
  Ve.current.forEach((t, n) => {
@@ -11885,11 +11941,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11885
11941
  });
11886
11942
  }, [mt]);
11887
11943
  let gt = o !== "performance", _t = h(() => {
11888
- n.current && (n.current.minDistance = Dm(s.current));
11944
+ n.current && (n.current.minDistance = Nm(s.current));
11889
11945
  }, [n, s]), vt = h((e, t = !1) => {
11890
11946
  let r = n.current;
11891
11947
  if (!r) return !1;
11892
- let i = t ? Um(e, A, r.minDistance) : e;
11948
+ let i = t ? Ym(e, A, r.minDistance) : e;
11893
11949
  return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
11894
11950
  }, [A, n]), yt = h((e) => {
11895
11951
  xe.current = e.clone(), vt(e, !0);
@@ -11901,18 +11957,18 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11901
11957
  a,
11902
11958
  s
11903
11959
  ]), xt = h((e) => {
11904
- if (!Pm(A)) return null;
11905
- if (Nm(A) === e) return A;
11960
+ if (!Bm(A)) return null;
11961
+ if (zm(A) === e) return A;
11906
11962
  let r = n.current, i = new U(), a = new U();
11907
11963
  r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (A.getWorldDirection(i), a.copy(A.position), i.add(a));
11908
11964
  let o = a.clone().sub(i);
11909
- o.lengthSq() < rm * rm && A.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < rm * rm && o.copy(fm), o.normalize();
11910
- let s = Fm(ae), c = Rm(A, i), l = A.near, u = A.far, d = e === "orthographic" ? new Ae(-s * c * .5, s * c * .5, c * .5, -c * .5, l, u) : new je(nm, s, l, u);
11965
+ o.lengthSq() < lm * lm && A.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < lm * lm && o.copy(vm), o.normalize();
11966
+ let s = Vm(ae), c = Wm(A, i), l = A.near, u = A.far, d = e === "orthographic" ? new Ae(-s * c * .5, s * c * .5, c * .5, -c * .5, l, u) : new je(cm, s, l, u);
11911
11967
  if (d.manual = !0, d instanceof je) {
11912
11968
  let e = c / (2 * Math.tan(Se.degToRad(d.fov) * .5));
11913
11969
  a.copy(i).addScaledVector(o, e);
11914
11970
  }
11915
- return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0), zm(d, ae), Ne.current = {
11971
+ return d.position.copy(a), d.up.copy(A.up), d.layers.mask = A.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0), Gm(d, ae), Ne.current = {
11916
11972
  cameraUuid: d.uuid,
11917
11973
  position: a.clone(),
11918
11974
  target: i.clone(),
@@ -11928,10 +11984,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11928
11984
  ae.height,
11929
11985
  ae.width
11930
11986
  ]), St = h(() => {
11931
- let e = Nm(A) === "perspective" ? "orthographic" : "perspective";
11987
+ let e = zm(A) === "perspective" ? "orthographic" : "perspective";
11932
11988
  return xt(e), e;
11933
11989
  }, [A, xt]), Ct = h((e, t, { createClippingPlane: r = !0 } = {}) => {
11934
- let i = xt("orthographic") ?? (Pm(A) ? A : null);
11990
+ let i = xt("orthographic") ?? (Bm(A) ? A : null);
11935
11991
  if (!i) return null;
11936
11992
  let a = e.clone().normalize(), o = !1;
11937
11993
  Fe.current += 1, ut(!0), N.setHelpersActive(!1), r && N.createPlaneFromPointAndNormal(wl(a), a.normal.clone());
@@ -11966,10 +12022,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
11966
12022
  ae
11967
12023
  ]);
11968
12024
  _(() => {
11969
- if (!u || ze.current || !s.current || !Pm(A)) return;
12025
+ if (!u || ze.current || !s.current || !Bm(A)) return;
11970
12026
  let e = u.clone().normalize();
11971
12027
  ze.current = !0;
11972
- let t = xt("orthographic") ?? (Pm(A) ? A : null);
12028
+ let t = xt("orthographic") ?? (Bm(A) ? A : null);
11973
12029
  t && (ut(!0), N.setHelpersActive(!1), N.createPlaneFromPointAndNormal(wl(e), e.normal.clone()), requestAnimationFrame(() => {
11974
12030
  Cl({
11975
12031
  camera: t,
@@ -12001,14 +12057,14 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12001
12057
  }, []), Tt = h((t) => {
12002
12058
  if (!t) return !1;
12003
12059
  let n = wt();
12004
- if (!e || !r) return n || (B.current = vm()), !1;
12060
+ if (!e || !r) return n || (B.current = wm()), !1;
12005
12061
  let i = B.current;
12006
12062
  if (n) {
12007
- i.active || (B.current = vm(!0));
12063
+ i.active || (B.current = wm(!0));
12008
12064
  let e = B.current;
12009
12065
  return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
12010
12066
  }
12011
- return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (B.current = vm(), !1) : (i.finalFitDone = !0, !0) : !0;
12067
+ return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (B.current = wm(), !1) : (i.finalFitDone = !0, !0) : !0;
12012
12068
  }, [
12013
12069
  e,
12014
12070
  r,
@@ -12016,11 +12072,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12016
12072
  ]), Dt = h((e, t = !1) => {
12017
12073
  let r = n.current;
12018
12074
  if (!r) return;
12019
- let i = Vm(e, M.buildIndex());
12075
+ let i = qm(e, M.buildIndex());
12020
12076
  if (!i) return;
12021
12077
  let a = i.getCenter(new U());
12022
12078
  if (xe.current = a.clone(), r.cancel(), t) {
12023
- let e = Hm(i);
12079
+ let e = Jm(i);
12024
12080
  r.fitToBox(i, !0, {
12025
12081
  paddingBottom: e,
12026
12082
  paddingLeft: e,
@@ -12055,7 +12111,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12055
12111
  let e = () => {
12056
12112
  R.current !== null && (window.clearTimeout(R.current), R.current = null);
12057
12113
  }, t = () => {
12058
- Te.current && (Em(Te.current), Te.current = null, j());
12114
+ Te.current && (Mm(Te.current), Te.current = null, j());
12059
12115
  };
12060
12116
  if (!te) {
12061
12117
  e(), t(), N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep");
@@ -12070,7 +12126,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12070
12126
  return;
12071
12127
  }
12072
12128
  R.current = null, v("move"), N.setCapsCameraMotionActive(!0), N.setEdgesCameraMotionActive?.(!0);
12073
- }, Qp));
12129
+ }, im));
12074
12130
  }, a = () => {
12075
12131
  e(), t(), N.setCapsCameraMotionActive(!1), N.setEdgesCameraMotionActive?.(!1), v("sleep");
12076
12132
  };
@@ -12090,11 +12146,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12090
12146
  }, t = () => {
12091
12147
  Ce.current !== null && (window.clearTimeout(Ce.current), Ce.current = null);
12092
12148
  }, r = (n = !1) => {
12093
- e(), Te.current && (Em(Te.current), Te.current = null, j()), n && (t(), we.current = null);
12149
+ e(), Te.current && (Mm(Te.current), Te.current = null, j()), n && (t(), we.current = null);
12094
12150
  }, i = () => {
12095
12151
  t(), Ce.current = window.setTimeout(() => {
12096
12152
  Ce.current = null, we.current = null;
12097
- }, em);
12153
+ }, om);
12098
12154
  };
12099
12155
  if (!te) {
12100
12156
  r(!0);
@@ -12104,13 +12160,13 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12104
12160
  if (!a) return;
12105
12161
  let o = () => {
12106
12162
  if (z.current = null, Ie.current || Te.current) return;
12107
- s.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== s.current) && (we.current = wm(s.current, Qe));
12163
+ s.current?.updateMatrixWorld(!0), (!we.current || we.current.root !== s.current) && (we.current = Am(s.current, Qe));
12108
12164
  let e = we.current;
12109
12165
  if (!e) return;
12110
- let t = Tm(e);
12166
+ let t = jm(e);
12111
12167
  t && (Te.current = t, j());
12112
12168
  }, c = () => {
12113
- Ie.current || (t(), !Te.current && z.current === null && (z.current = window.setTimeout(o, $p)));
12169
+ Ie.current || (t(), !Te.current && z.current === null && (z.current = window.setTimeout(o, am)));
12114
12170
  }, l = () => {
12115
12171
  r(), i();
12116
12172
  };
@@ -12125,7 +12181,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12125
12181
  Qe,
12126
12182
  te
12127
12183
  ]), _(() => {
12128
- l && !Le.current && (B.current = vm(!0)), Le.current = l;
12184
+ l && !Le.current && (B.current = wm(!0)), Le.current = l;
12129
12185
  }, [l]), _(() => {
12130
12186
  let e = n.current, t = ne.domElement, r = () => {
12131
12187
  let e = B.current;
@@ -12140,7 +12196,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12140
12196
  ne
12141
12197
  ]);
12142
12198
  let kt = h(() => !wt(), [wt]);
12143
- return sp(s, n, de, yt, N.getSelectableObjects, fe, kt, We), df(), _(() => {
12199
+ return pp(s, n, de, yt, N.getSelectableObjects, fe, kt, We), _f(), _(() => {
12144
12200
  let e = ne.domElement, t = (e) => {
12145
12201
  let t = xe.current;
12146
12202
  t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || vt(t, !0));
@@ -12161,11 +12217,11 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12161
12217
  if (!e) {
12162
12218
  let e = B.current;
12163
12219
  if (e.active && e.firstFitDone && e.userInteractedAfterFirstFit) {
12164
- B.current = vm();
12220
+ B.current = wm();
12165
12221
  return;
12166
12222
  }
12167
12223
  }
12168
- bt(), e || (B.current = vm());
12224
+ bt(), e || (B.current = wm());
12169
12225
  }, c = () => {
12170
12226
  if (e) {
12171
12227
  if (!k) {
@@ -12186,7 +12242,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12186
12242
  }
12187
12243
  }, l = () => {
12188
12244
  if (n !== null) return;
12189
- let e = lm, t = () => {
12245
+ let e = hm, t = () => {
12190
12246
  if (r) {
12191
12247
  n = null;
12192
12248
  return;
@@ -12204,7 +12260,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12204
12260
  n = requestAnimationFrame(t);
12205
12261
  }, u = (e) => {
12206
12262
  if (r || !s.current) return;
12207
- s.current.updateMatrixWorld(!0), (A instanceof je || A instanceof Ae) && Bm(A, s.current), _t(), ye();
12263
+ s.current.updateMatrixWorld(!0), (A instanceof je || A instanceof Ae) && Km(A, s.current), _t(), ye();
12208
12264
  let n = ve();
12209
12265
  if (!n.records.size && e > 0) {
12210
12266
  t = requestAnimationFrame(() => u(e - 1));
@@ -12212,7 +12268,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12212
12268
  }
12213
12269
  L(), N.syncWithModel(), P.syncWithModel(), n.records.size > 0 && !wt() && l(), Me.current !== A.uuid && Tt(n.records.size > 0) && c();
12214
12270
  };
12215
- return a(() => u(k ? cm : sm)), () => {
12271
+ return a(() => u(k ? mm : pm)), () => {
12216
12272
  r = !0, t !== null && cancelAnimationFrame(t), n !== null && cancelAnimationFrame(n);
12217
12273
  };
12218
12274
  }, [
@@ -12248,7 +12304,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12248
12304
  camera: {
12249
12305
  fitCamera: bt,
12250
12306
  getIntersection: de.getIntersection,
12251
- getProjection: () => Nm(A),
12307
+ getProjection: () => zm(A),
12252
12308
  setFirstPersonControlActive: it,
12253
12309
  setFirstPersonControlSettings: at,
12254
12310
  setProjection: xt,
@@ -12314,10 +12370,13 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12314
12370
  toggleNoteMode: ge.toggleNoteMode
12315
12371
  },
12316
12372
  geometryUtils: {
12373
+ get indexesState() {
12374
+ return oe.indexesState;
12375
+ },
12317
12376
  getAllIds: oe.getAllIds,
12318
12377
  getIfcSpacesVisibility: oe.getIfcSpacesVisibility,
12319
- getModelGeometry: (e) => Mm(s.current, e),
12320
- getModelsGeometry: () => jm(s.current),
12378
+ getModelGeometry: (e) => Rm(s.current, e),
12379
+ getModelsGeometry: () => Lm(s.current),
12321
12380
  hideByIds: (e) => t(() => oe.hideByIds(e)),
12322
12381
  hideSelected: () => t(oe.hideSelected),
12323
12382
  isolateByIds: (e) => t(() => oe.isolateByIds(e)),
@@ -12379,7 +12438,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12379
12438
  V && /* @__PURE__ */ W(ct, {}),
12380
12439
  /* @__PURE__ */ W("group", {
12381
12440
  ref: H,
12382
- children: pt.map(([e, t]) => /* @__PURE__ */ W(nd, {
12441
+ children: pt.map(([e, t]) => /* @__PURE__ */ W(cd, {
12383
12442
  colorPaletteTexture: se,
12384
12443
  coordinationMatrix: ft,
12385
12444
  data: t,
@@ -12392,7 +12451,7 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12392
12451
  }, e))
12393
12452
  }),
12394
12453
  ge.layer,
12395
- /* @__PURE__ */ W(Yp, {
12454
+ /* @__PURE__ */ W(tm, {
12396
12455
  active: Ke,
12397
12456
  activeRef: Xe,
12398
12457
  controlRef: n,
@@ -12400,10 +12459,10 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12400
12459
  settings: Je
12401
12460
  }),
12402
12461
  !Ke && /* @__PURE__ */ W(ot, {
12403
- camera: Pm(A) ? A : void 0,
12462
+ camera: Bm(A) ? A : void 0,
12404
12463
  dollyToCursor: !0,
12405
12464
  infinityDolly: A instanceof je,
12406
- minDistance: Xp,
12465
+ minDistance: nm,
12407
12466
  ref: tt,
12408
12467
  draggingSmoothTime: .03,
12409
12468
  smoothTime: .05
@@ -12412,8 +12471,8 @@ function Wm({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
12412
12471
  }
12413
12472
  //#endregion
12414
12473
  //#region src/viewer/Viewer.tsx
12415
- var Gm = .75, Km = .6;
12416
- function qm(e, t, n) {
12474
+ var Zm = .75, Qm = .6;
12475
+ function $m(e, t, n) {
12417
12476
  let r = e?.[t.modelID] ?? {
12418
12477
  coordinationMatrix: t.coordinationMatrix ?? t.geometry.matrix ?? void 0,
12419
12478
  data: {},
@@ -12438,11 +12497,11 @@ function qm(e, t, n) {
12438
12497
  }
12439
12498
  };
12440
12499
  }
12441
- function Jm(e) {
12500
+ function eh(e) {
12442
12501
  let t = {};
12443
12502
  return e.materialMode !== void 0 && (t.materialMode = e.materialMode), e.uploadMode !== void 0 && (t.uploadMode = e.uploadMode), e.useDoubleSideMaterial !== void 0 && (t.useDoubleSideMaterial = e.useDoubleSideMaterial), Object.keys(t).length ? t : void 0;
12444
12503
  }
12445
- function Ym(e, t, n) {
12504
+ function th(e, t, n) {
12446
12505
  let r = { ...e ?? {} };
12447
12506
  return Object.entries(t).forEach(([t, i]) => {
12448
12507
  let a = Number(t);
@@ -12455,22 +12514,22 @@ function Ym(e, t, n) {
12455
12514
  });
12456
12515
  }), r;
12457
12516
  }
12458
- function Xm(e, t) {
12517
+ function nh(e, t) {
12459
12518
  if (!e || !Object.prototype.hasOwnProperty.call(e, t)) return e;
12460
12519
  let n = { ...e };
12461
12520
  return delete n[t], Object.keys(n).length ? n : void 0;
12462
12521
  }
12463
- function Zm(e, t) {
12522
+ function rh(e, t) {
12464
12523
  return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
12465
12524
  }
12466
- function Qm(e) {
12525
+ function ih(e) {
12467
12526
  return Array.isArray(e) ? [Math.max(e[0], 2), Math.max(e[1], 2)] : typeof e == "number" ? Math.max(e, 2) : 2;
12468
12527
  }
12469
- function $m() {
12528
+ function ah() {
12470
12529
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
12471
12530
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
12472
12531
  }
12473
- function eh({ autoFitCamera: e = !0, camera: t = {
12532
+ function oh({ autoFitCamera: e = !0, camera: t = {
12474
12533
  position: [
12475
12534
  10,
12476
12535
  10,
@@ -12481,7 +12540,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12481
12540
  let E = x(null), D = x(null), O = x(null), te = x(null), [k, A] = S(), [ne, j] = S(!1), [re, ie] = S(!0), [ae, M] = S(null), oe = x(void 0), se = x(!1), ce = x(null), le = x(null), ue = x({
12482
12541
  lastProgress: 0,
12483
12542
  requestID: 0
12484
- }), de = x(null), N = x(/* @__PURE__ */ new Set()), fe = x(0), P = x(/* @__PURE__ */ new Map()), F = x(/* @__PURE__ */ new Set()), pe = x(/* @__PURE__ */ new Set()), I = x(!1), me = x(null), he = x(null), ge = x(/* @__PURE__ */ new Set()), _e = x(/* @__PURE__ */ new Map()), ve = x(!T), ye = x(/* @__PURE__ */ new Set()), L = Et(), be = G((e) => e.setModelNames), xe = G((e) => e.setModelProps), Se = G((e) => e.setModelStructure), R = G((e) => e.setShowNavCube), z = G((e) => e.setShowStats), Ce = G((e) => e.setUserDevice), we = G((e) => e.showNavCube), Te = ne, B = Te ? k ?? s : s ?? k, Ee = r ?? re, De = u ? Zm(n, 1) : n, Oe = Zm(De, u ? Km : Gm), ke = c ?? (u ? "performance" : void 0), [Ae, je] = S("sleep"), Me = Qm(De), Ne = b(() => T ? Po({ performanceMode: u }) : u ? Go : void 0, [u, T]), Pe = u ? Wo : Uo, Fe = h(() => {
12543
+ }), de = x(null), N = x(/* @__PURE__ */ new Set()), fe = x(0), P = x(/* @__PURE__ */ new Map()), F = x(/* @__PURE__ */ new Set()), pe = x(/* @__PURE__ */ new Set()), I = x(!1), me = x(null), he = x(null), ge = x(/* @__PURE__ */ new Set()), _e = x(/* @__PURE__ */ new Map()), ve = x(!T), ye = x(/* @__PURE__ */ new Set()), L = Et(), be = G((e) => e.setModelNames), xe = G((e) => e.setModelProps), Se = G((e) => e.setModelStructure), R = G((e) => e.setShowNavCube), z = G((e) => e.setShowStats), Ce = G((e) => e.setUserDevice), we = G((e) => e.showNavCube), Te = ne, B = Te ? k ?? s : s ?? k, Ee = r ?? re, De = u ? rh(n, 1) : n, Oe = rh(De, u ? Qm : Zm), ke = c ?? (u ? "performance" : void 0), [Ae, je] = S("sleep"), Me = ih(De), Ne = b(() => T ? Po({ performanceMode: u }) : u ? Go : void 0, [u, T]), Pe = u ? Wo : Uo, Fe = h(() => {
12485
12544
  F.current.forEach((e) => {
12486
12545
  e();
12487
12546
  });
@@ -12611,9 +12670,9 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12611
12670
  return t?.(r), r;
12612
12671
  });
12613
12672
  }, []), Ze = h((e, t, n) => {
12614
- V((t) => qm(t, e, n), t);
12673
+ V((t) => $m(t, e, n), t);
12615
12674
  }, [V]), Qe = h(async (e, t = {}) => {
12616
- let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = fe.current + 1, d = Jm(l), f = !1, p = !1, m = () => {
12675
+ let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = fe.current + 1, d = eh(l), f = !1, p = !1, m = () => {
12617
12676
  f || fe.current !== u || (f = !0, j(!1));
12618
12677
  }, h = () => {
12619
12678
  p || fe.current !== u || (p = !0, a?.(!1));
@@ -12644,7 +12703,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12644
12703
  });
12645
12704
  if (fe.current !== u) return r;
12646
12705
  let a = Object.fromEntries(Object.entries(r).filter(([e]) => !N.current.has(Number(e))));
12647
- return V((e) => t ? Ym(e, a, N.current) : {
12706
+ return V((e) => t ? th(e, a, N.current) : {
12648
12707
  ...e ?? {},
12649
12708
  ...a
12650
12709
  }, s), m(), Object.keys(a).length > 0 && await Je(u), h(), r;
@@ -12662,7 +12721,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12662
12721
  ]), $e = h((e) => {
12663
12722
  if (!Number.isFinite(e)) return;
12664
12723
  N.current.add(e);
12665
- let t = oe.current, n = Xm(t, e);
12724
+ let t = oe.current, n = nh(t, e);
12666
12725
  n !== t && (oe.current = n, A(n), de.current?.(n)), L.getState().removeModelState(e);
12667
12726
  }, [L]), H = b(() => ({
12668
12727
  getData: () => oe.current,
@@ -12677,7 +12736,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12677
12736
  $e
12678
12737
  ]);
12679
12738
  return _(() => (p(H), () => p(null)), [H, p]), _(() => {
12680
- Ce($m());
12739
+ Ce(ah());
12681
12740
  }, [Ce]), _(() => {
12682
12741
  z(!!y);
12683
12742
  }, [z, y]), _(() => {
@@ -12727,7 +12786,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12727
12786
  onReady: Ge
12728
12787
  }),
12729
12788
  /* @__PURE__ */ W(Io, { active: T }),
12730
- /* @__PURE__ */ W(Wm, {
12789
+ /* @__PURE__ */ W(Xm, {
12731
12790
  autoFitCamera: e,
12732
12791
  cameraRef: E,
12733
12792
  controlRef: D,
@@ -12775,7 +12834,7 @@ function eh({ autoFitCamera: e = !0, camera: t = {
12775
12834
  })]
12776
12835
  }) : /* @__PURE__ */ W(nt, {});
12777
12836
  }
12778
- var th = p(function(e, t) {
12837
+ var sh = p(function(e, t) {
12779
12838
  let [n] = S(Ct), r = x(!1), i = x(!1), a = b(() => new Ko(), []), o = b(() => new Jo(), []), { defaultSelected: s, onSelectedChange: c, selected: l } = e, u = h((e) => {
12780
12839
  a.set(e);
12781
12840
  }, [a]), d = b(() => new qo(), []), f = h((e) => {
@@ -12804,7 +12863,7 @@ var th = p(function(e, t) {
12804
12863
  });
12805
12864
  }, [c, n]), /* @__PURE__ */ W(Tt, {
12806
12865
  store: n,
12807
- children: /* @__PURE__ */ W(eh, {
12866
+ children: /* @__PURE__ */ W(oh, {
12808
12867
  ...e,
12809
12868
  publicApi: m,
12810
12869
  setModelsApi: f,
@@ -12813,6 +12872,6 @@ var th = p(function(e, t) {
12813
12872
  })
12814
12873
  });
12815
12874
  });
12816
- th.displayName = "Viewer";
12875
+ sh.displayName = "Viewer";
12817
12876
  //#endregion
12818
- export { Ar as BMTLoader, $n as BmtConverter, tr as ConvertIfcFileToBmt, nr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, mr as FilteredElementsCollector, Su as ModelGrids, ea as NavigationCube, th as Viewer, Tt as ViewerStoreProvider, er as bmtConverter, ti as convertIfcFilesToBmtInWorker, ni as createBmtConverterWorker, Br as createBmtWorker, mi as createIfcWorker, Ct as createViewerStore, gn as exportExcel, pn as exportModelPropertiesToExcel, zr as loadBmtModelsInWorker, pi as loadIfcModelsInWorker, xi as loader, rc as useDimensionsUtils, G as useViewerStore, Et as useViewerStoreApi };
12877
+ export { Ar as BMTLoader, $n as BmtConverter, tr as ConvertIfcFileToBmt, nr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, mr as FilteredElementsCollector, Su as ModelGrids, ea as NavigationCube, sh as Viewer, Tt as ViewerStoreProvider, er as bmtConverter, ti as convertIfcFilesToBmtInWorker, ni as createBmtConverterWorker, Br as createBmtWorker, mi as createIfcWorker, Ct as createViewerStore, gn as exportExcel, pn as exportModelPropertiesToExcel, zr as loadBmtModelsInWorker, pi as loadIfcModelsInWorker, xi as loader, rc as useDimensionsUtils, G as useViewerStore, Et as useViewerStoreApi };