bimatter-viewer-react 0.6.9 → 0.6.10

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
@@ -3,18 +3,18 @@ import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, r as l,
3
3
  import f, { Suspense as p, forwardRef as m, lazy as h, memo as g, useCallback as _, useEffect as v, useImperativeHandle as y, useMemo as b, useRef as x, useState as S } from "react";
4
4
  import { Canvas as C, useFrame as w, useThree as T } from "@react-three/fiber";
5
5
  import { CameraControls as E, Stats as ee } from "@react-three/drei";
6
- import { Box3 as D, BoxGeometry as O, BufferAttribute as k, BufferGeometry as A, CanvasTexture as j, Color as M, ConeGeometry as N, DoubleSide as te, DynamicDrawUsage as ne, Float32BufferAttribute as re, Group as P, Line as F, Line3 as I, LineBasicMaterial as L, LineDashedMaterial as R, LineSegments as ie, LinearFilter as z, LinearMipmapLinearFilter as ae, MathUtils as oe, Matrix4 as B, Mesh as V, MeshBasicMaterial as H, MeshLambertMaterial as se, Object3D as U, OrthographicCamera as ce, PerspectiveCamera as W, Plane as G, RepeatWrapping as le, SRGBColorSpace as ue, ShapeUtils as de, Sphere as fe, SphereGeometry as pe, Sprite as me, SpriteMaterial as he, Uint32BufferAttribute as ge, Vector2 as K, Vector3 as q } from "three";
7
- import { CONTAINED as _e, INTERSECTED as ve, MeshBVH as ye, NOT_INTERSECTED as be, acceleratedRaycast as xe } from "three-mesh-bvh";
8
- import { Fragment as Se, jsx as J, jsxs as Y } from "react/jsx-runtime";
9
- import Ce from "pako";
6
+ import { Box3 as D, BoxGeometry as O, BufferAttribute as k, BufferGeometry as A, CanvasTexture as j, Color as M, ConeGeometry as N, DoubleSide as te, DynamicDrawUsage as ne, Float32BufferAttribute as P, Group as F, Line as I, Line3 as L, LineBasicMaterial as R, LineDashedMaterial as z, LineSegments as re, LinearFilter as B, LinearMipmapLinearFilter as ie, MathUtils as ae, Matrix4 as V, Mesh as H, MeshBasicMaterial as U, MeshLambertMaterial as oe, Object3D as W, OrthographicCamera as se, PerspectiveCamera as ce, Plane as le, RepeatWrapping as ue, SRGBColorSpace as de, ShapeUtils as fe, Sphere as pe, SphereGeometry as me, Sprite as he, SpriteMaterial as ge, Uint32BufferAttribute as _e, Vector2 as G, Vector3 as K } from "three";
7
+ import { CONTAINED as ve, INTERSECTED as ye, MeshBVH as be, NOT_INTERSECTED as xe, acceleratedRaycast as Se } from "three-mesh-bvh";
8
+ import { Fragment as Ce, jsx as q, jsxs as J } from "react/jsx-runtime";
9
+ import we from "pako";
10
10
  //#region src/viewer/SelectableMesh.tsx
11
- V.prototype.raycast = xe;
12
- var we = 1 / 1.5, Te = f.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: o = !1 }) {
11
+ H.prototype.raycast = Se;
12
+ var Te = 1 / 1.5, Ee = f.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: o = !1 }) {
13
13
  let s = x(null), c = d((e) => e.preselectionColor), l = x(c);
14
14
  l.current = c;
15
15
  let u = b(() => {
16
16
  let r = new M(t.r, t.g, t.b);
17
- n === "performance" && r.multiplyScalar(we);
17
+ n === "performance" && r.multiplyScalar(Te);
18
18
  let i = {
19
19
  color: r.clone(),
20
20
  transparent: !!(t.opacity && t.opacity != 1),
@@ -22,7 +22,7 @@ var we = 1 / 1.5, Te = f.memo(function({ colorPaletteTexture: e, material: t, ma
22
22
  }, a = o ? {
23
23
  ...i,
24
24
  side: te
25
- } : i, s = n === "performance" ? new H(a) : new se(a), c = s;
25
+ } : i, s = n === "performance" ? new U(a) : new oe(a), c = s;
26
26
  return c.defaultAttributeValues = {
27
27
  ...c.defaultAttributeValues,
28
28
  colorIndex: [0]
@@ -56,11 +56,11 @@ var we = 1 / 1.5, Te = f.memo(function({ colorPaletteTexture: e, material: t, ma
56
56
  e && (e.value instanceof M ? e.value.set(c) : e.value = new M(c));
57
57
  }, [u, c]), v(() => {
58
58
  if (!s.current) return;
59
- let e = s.current.geometry, t = new ye(e, { indirect: !0 });
59
+ let e = s.current.geometry, t = new be(e, { indirect: !0 });
60
60
  return Object.assign(e, { boundsTree: t }), () => {
61
61
  u.dispose(), Object.assign(e, { boundsTree: null });
62
62
  };
63
- }, [u]), /* @__PURE__ */ Y("mesh", {
63
+ }, [u]), /* @__PURE__ */ J("mesh", {
64
64
  frustumCulled: !0,
65
65
  matrix: a,
66
66
  matrixAutoUpdate: !1,
@@ -71,38 +71,38 @@ var we = 1 / 1.5, Te = f.memo(function({ colorPaletteTexture: e, material: t, ma
71
71
  let t = e.object;
72
72
  t.preselected &&= !1;
73
73
  },
74
- children: [/* @__PURE__ */ Y("bufferGeometry", { children: [
75
- /* @__PURE__ */ J("bufferAttribute", {
74
+ children: [/* @__PURE__ */ J("bufferGeometry", { children: [
75
+ /* @__PURE__ */ q("bufferAttribute", {
76
76
  attach: "attributes-position",
77
77
  args: [r.pos, 3]
78
78
  }),
79
- r.norm && /* @__PURE__ */ J("bufferAttribute", {
79
+ r.norm && /* @__PURE__ */ q("bufferAttribute", {
80
80
  attach: "attributes-normal",
81
81
  args: [r.norm, 3]
82
82
  }),
83
- /* @__PURE__ */ J("bufferAttribute", {
83
+ /* @__PURE__ */ q("bufferAttribute", {
84
84
  attach: "attributes-ids",
85
85
  args: [r.ids, 1]
86
86
  }),
87
- /* @__PURE__ */ J("bufferAttribute", {
87
+ /* @__PURE__ */ q("bufferAttribute", {
88
88
  attach: "index",
89
89
  args: [r.ind, 1]
90
90
  })
91
- ] }), /* @__PURE__ */ J("primitive", { object: u })]
91
+ ] }), /* @__PURE__ */ q("primitive", { object: u })]
92
92
  });
93
- }), Ee = 10, De = "#1d2733", Oe = 2, ke = .05, Ae = "\0", je = /* @__PURE__ */ new Map();
94
- function Me() {
93
+ }), De = 10, Oe = "#1d2733", ke = 2, Ae = .05, je = "\0", Me = /* @__PURE__ */ new Map();
94
+ function Ne() {
95
95
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
96
96
  }
97
- function Ne(e, t, n, r) {
98
- let i = Me(), a = document.createElement("canvas"), o = a.getContext("2d");
97
+ function Pe(e, t, n, r) {
98
+ let i = Ne(), a = document.createElement("canvas"), o = a.getContext("2d");
99
99
  if (!o) throw Error("Could not create grid label canvas context");
100
100
  let s = `400 ${r}px system-ui, "Segoe UI", sans-serif`, c = Math.ceil(r * .5), l = Math.ceil(r * .35);
101
101
  o.font = s;
102
102
  let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
103
103
  a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
104
104
  let h = new j(a);
105
- return h.colorSpace = ue, h.generateMipmaps = !1, h.magFilter = z, h.minFilter = z, h.needsUpdate = !0, {
105
+ return h.colorSpace = de, h.generateMipmaps = !1, h.magFilter = B, h.minFilter = B, h.needsUpdate = !0, {
106
106
  disposeTimer: null,
107
107
  height: m,
108
108
  key: e,
@@ -111,49 +111,49 @@ function Ne(e, t, n, r) {
111
111
  width: p
112
112
  };
113
113
  }
114
- function Pe(e, t, n) {
114
+ function Fe(e, t, n) {
115
115
  let r = [
116
116
  e,
117
117
  t,
118
118
  n
119
- ].join(Ae), i = je.get(r);
120
- return i || (i = Ne(r, e, t, n), je.set(r, i)), i;
119
+ ].join(je), i = Me.get(r);
120
+ return i || (i = Pe(r, e, t, n), Me.set(r, i)), i;
121
121
  }
122
- function Fe(e, t, n) {
123
- let r = b(() => Pe(e, t, n), [
122
+ function Ie(e, t, n) {
123
+ let r = b(() => Fe(e, t, n), [
124
124
  t,
125
125
  n,
126
126
  e
127
127
  ]);
128
128
  return v(() => (r.disposeTimer &&= (clearTimeout(r.disposeTimer), null), r.refs++, () => {
129
129
  r.refs = Math.max(0, r.refs - 1), r.refs <= 0 && (r.disposeTimer = setTimeout(() => {
130
- r.refs > 0 || (r.texture.dispose(), je.delete(r.key), r.disposeTimer = null);
130
+ r.refs > 0 || (r.texture.dispose(), Me.delete(r.key), r.disposeTimer = null);
131
131
  }, 1e3));
132
132
  }), [r]), r;
133
133
  }
134
- function Ie(e, t, n, r) {
134
+ function Le(e, t, n, r) {
135
135
  let i = Math.abs(n.projectionMatrix.elements[5]) || 1, a = t.height * 2 / (Math.max(1, r) * i), o = a * (t.width / t.height);
136
136
  e.scale.set(o, a, 1);
137
137
  }
138
- function Le(e, t) {
138
+ function Re(e, t) {
139
139
  let n = e[t];
140
140
  return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
141
141
  }
142
- function Re(e, t) {
143
- return Le(e, t) ?? 0;
142
+ function ze(e, t) {
143
+ return Re(e, t) ?? 0;
144
144
  }
145
- function ze(e) {
146
- let t = Le(e, "x"), n = Le(e, "y"), r = Le(e, "z");
147
- return t === null || n === null || r === null ? null : new q(t, n, r);
145
+ function Be(e) {
146
+ let t = Re(e, "x"), n = Re(e, "y"), r = Re(e, "z");
147
+ return t === null || n === null || r === null ? null : new K(t, n, r);
148
148
  }
149
- function Be(e, t) {
149
+ function Ve(e, t) {
150
150
  return [
151
- Re(e, "x"),
152
- t !== void 0 && Number.isFinite(t) ? t : Re(e, "y"),
153
- Re(e, "z")
151
+ ze(e, "x"),
152
+ t !== void 0 && Number.isFinite(t) ? t : ze(e, "y"),
153
+ ze(e, "z")
154
154
  ];
155
155
  }
156
- function Ve(e) {
156
+ function He(e) {
157
157
  let { h: t, l: n } = e.getHSL({
158
158
  h: 0,
159
159
  s: 0,
@@ -161,14 +161,14 @@ function Ve(e) {
161
161
  });
162
162
  return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
163
163
  }
164
- function He(e) {
164
+ function Ue(e) {
165
165
  let t = T((e) => e.scene.background);
166
- return b(() => e || (t instanceof M ? Ve(t) : De), [t, e]);
166
+ return b(() => e || (t instanceof M ? He(t) : Oe), [t, e]);
167
167
  }
168
- function Ue({ axis: e, grid: t, endSide: n, startSide: r }) {
168
+ function We({ axis: e, grid: t, endSide: n, startSide: r }) {
169
169
  return Object.entries(e).flatMap(([e, i]) => {
170
170
  if (i.length < 2) return [];
171
- let a = ze(i[0]), o = ze(i[1]);
171
+ let a = Be(i[0]), o = Be(i[1]);
172
172
  return !a || !o ? [] : (a.y = 0, o.y = 0, [{
173
173
  endSide: n,
174
174
  loc: t.loc,
@@ -178,18 +178,18 @@ function Ue({ axis: e, grid: t, endSide: n, startSide: r }) {
178
178
  }]);
179
179
  });
180
180
  }
181
- function We({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
181
+ function Ge({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
182
182
  let o = {
183
183
  bottom: n,
184
184
  left: r,
185
185
  right: i,
186
186
  top: a
187
- }, s = Object.values(t).flatMap((e) => [...Ue({
187
+ }, s = Object.values(t).flatMap((e) => [...We({
188
188
  axis: e.points.u,
189
189
  endSide: "right",
190
190
  grid: e,
191
191
  startSide: "left"
192
- }), ...Ue({
192
+ }), ...We({
193
193
  axis: e.points.v,
194
194
  endSide: "bottom",
195
195
  grid: e,
@@ -202,8 +202,8 @@ function We({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
202
202
  e.startSide,
203
203
  e.endSide,
204
204
  e.name,
205
- Re(e.loc, "x"),
206
- Re(e.loc, "z"),
205
+ ze(e.loc, "x"),
206
+ ze(e.loc, "z"),
207
207
  e.points[0].x,
208
208
  e.points[0].z,
209
209
  e.points[1].x,
@@ -212,57 +212,57 @@ function We({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
212
212
  c.has(t) || c.set(t, e);
213
213
  }), Array.from(c.values());
214
214
  }
215
- function Ge(e, t) {
216
- return new q(...Be(e.loc, t));
215
+ function Ke(e, t) {
216
+ return new K(...Ve(e.loc, t));
217
217
  }
218
- function Ke({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
218
+ function qe({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
219
219
  let s = {
220
220
  bottom: r,
221
221
  left: i,
222
222
  right: a,
223
223
  top: o
224
- }, c = Ge(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
224
+ }, c = Ke(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
225
225
  return p(d) ? d : p(f) ? f : null;
226
226
  }
227
- function qe({ endpoint: e, labelOffset: t, line: n }) {
227
+ function Je({ endpoint: e, labelOffset: t, line: n }) {
228
228
  let r = e === "start" ? n.points[0].clone() : n.points[1].clone(), i = n.points[1].clone().sub(n.points[0]);
229
229
  return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
230
230
  }
231
- function Je(e, t) {
232
- let n = new q(), r = 0;
231
+ function Ye(e, t) {
232
+ let n = new K(), r = 0;
233
233
  return e.forEach((e) => {
234
- let i = Ge(e, t);
234
+ let i = Ke(e, t);
235
235
  e.points.forEach((e) => {
236
236
  n.add(e).add(i), r++;
237
237
  });
238
238
  }), r && n.divideScalar(r), n;
239
239
  }
240
- function Ye(e, t, n) {
240
+ function Xe(e, t, n) {
241
241
  let r = 0;
242
242
  return e.forEach((e) => {
243
- let i = Ge(e, n);
243
+ let i = Ke(e, n);
244
244
  e.points.forEach((e) => {
245
245
  r = Math.max(r, e.clone().add(i).distanceTo(t));
246
246
  });
247
247
  }), r;
248
248
  }
249
- function Xe({ color: e, fontSize: t, position: n, text: r }) {
250
- let { camera: i, size: a } = T(), o = x(null), s = Fe(r, e, t);
249
+ function Ze({ color: e, fontSize: t, position: n, text: r }) {
250
+ let { camera: i, size: a } = T(), o = x(null), s = Ie(r, e, t);
251
251
  return v(() => {
252
252
  let e = o.current;
253
- e && Ie(e, s, i, a.height);
253
+ e && Le(e, s, i, a.height);
254
254
  }, [
255
255
  i,
256
256
  a.height,
257
257
  s
258
258
  ]), w(({ camera: e, size: t }) => {
259
259
  let n = o.current;
260
- n && Ie(n, s, e, t.height);
261
- }), /* @__PURE__ */ J("sprite", {
260
+ n && Le(n, s, e, t.height);
261
+ }), /* @__PURE__ */ q("sprite", {
262
262
  ref: o,
263
263
  position: n,
264
264
  renderOrder: 2,
265
- children: /* @__PURE__ */ J("spriteMaterial", {
265
+ children: /* @__PURE__ */ q("spriteMaterial", {
266
266
  alphaTest: .1,
267
267
  depthTest: !0,
268
268
  depthWrite: !1,
@@ -273,8 +273,8 @@ function Xe({ color: e, fontSize: t, position: n, text: r }) {
273
273
  })
274
274
  });
275
275
  }
276
- function Ze({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: o, showLeft: s, showRight: c, showTop: l }) {
277
- let u = b(() => new A().setFromPoints(a.points), [a.points]), d = Ke({
276
+ function Qe({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: o, showLeft: s, showRight: c, showTop: l }) {
277
+ let u = b(() => new A().setFromPoints(a.points), [a.points]), d = qe({
278
278
  cameraPosition: e,
279
279
  floorY: n,
280
280
  line: a,
@@ -282,19 +282,19 @@ function Ze({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
282
282
  showLeft: s,
283
283
  showRight: c,
284
284
  showTop: l
285
- }), f = d ? qe({
285
+ }), f = d ? Je({
286
286
  endpoint: d,
287
287
  labelOffset: i,
288
288
  line: a
289
289
  }) : null;
290
- return v(() => () => u.dispose(), [u]), /* @__PURE__ */ Y("lineSegments", {
290
+ return v(() => () => u.dispose(), [u]), /* @__PURE__ */ J("lineSegments", {
291
291
  geometry: u,
292
- position: Be(a.loc, n),
293
- children: [/* @__PURE__ */ J("lineBasicMaterial", {
292
+ position: Ve(a.loc, n),
293
+ children: [/* @__PURE__ */ q("lineBasicMaterial", {
294
294
  color: t,
295
295
  depthWrite: !1,
296
296
  linewidth: 2
297
- }), f && /* @__PURE__ */ J(Xe, {
297
+ }), f && /* @__PURE__ */ q(Ze, {
298
298
  color: t,
299
299
  fontSize: r,
300
300
  position: f,
@@ -302,8 +302,8 @@ function Ze({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
302
302
  })]
303
303
  });
304
304
  }
305
- function Qe({ color: e, floorY: t, fontSize: n = Ee, grids: r, labelOffset: i = Oe, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: c = !0, visible: l = !0 }) {
306
- let u = T((e) => e.camera), d = x(null), [f, p] = S(() => new q()), m = He(e), h = b(() => r ? We({
305
+ function $e({ color: e, floorY: t, fontSize: n = De, grids: r, labelOffset: i = ke, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: c = !0, visible: l = !0 }) {
306
+ let u = T((e) => e.camera), d = x(null), [f, p] = S(() => new K()), m = Ue(e), h = b(() => r ? Ge({
307
307
  flattenToFloor: t !== void 0,
308
308
  grids: r,
309
309
  showBottom: a,
@@ -317,7 +317,7 @@ function Qe({ color: e, floorY: t, fontSize: n = Ee, grids: r, labelOffset: i =
317
317
  o,
318
318
  s,
319
319
  c
320
- ]), g = b(() => Je(h, t), [t, h]), _ = b(() => Math.max(i, Ye(h, g, t) * .015), [
320
+ ]), g = b(() => Ye(h, t), [t, h]), _ = b(() => Math.max(i, Xe(h, g, t) * .015), [
321
321
  g,
322
322
  t,
323
323
  i,
@@ -327,11 +327,11 @@ function Qe({ color: e, floorY: t, fontSize: n = Ee, grids: r, labelOffset: i =
327
327
  let e = d.current;
328
328
  if (!e) return;
329
329
  let t = u.position.clone();
330
- e.worldToLocal(t), !(t.distanceToSquared(f) < ke) && p(t);
331
- }), !l || !h.length ? null : /* @__PURE__ */ J("group", {
330
+ e.worldToLocal(t), !(t.distanceToSquared(f) < Ae) && p(t);
331
+ }), !l || !h.length ? null : /* @__PURE__ */ q("group", {
332
332
  ref: d,
333
333
  userData: { modelGrids: !0 },
334
- children: h.map((e) => /* @__PURE__ */ J(Ze, {
334
+ children: h.map((e) => /* @__PURE__ */ q(Qe, {
335
335
  cameraPosition: f,
336
336
  color: m,
337
337
  floorY: t,
@@ -346,9 +346,9 @@ function Qe({ color: e, floorY: t, fontSize: n = Ee, grids: r, labelOffset: i =
346
346
  e.startSide,
347
347
  e.endSide,
348
348
  e.name,
349
- Re(e.loc, "x"),
350
- t ?? Re(e.loc, "y"),
351
- Re(e.loc, "z"),
349
+ ze(e.loc, "x"),
350
+ t ?? ze(e.loc, "y"),
351
+ ze(e.loc, "z"),
352
352
  e.points[0].x,
353
353
  e.points[0].y,
354
354
  e.points[0].z,
@@ -360,33 +360,33 @@ function Qe({ color: e, floorY: t, fontSize: n = Ee, grids: r, labelOffset: i =
360
360
  }
361
361
  //#endregion
362
362
  //#region src/viewer/Model.tsx
363
- var $e = new B(), et = h(() => import("./WebGpuSelectableMesh-s4XT_3wd.js").then((e) => ({ default: e.WebGpuSelectableMesh })));
364
- function tt(e) {
363
+ var et = new V(), tt = h(() => import("./WebGpuSelectableMesh-s4XT_3wd.js").then((e) => ({ default: e.WebGpuSelectableMesh })));
364
+ function nt(e) {
365
365
  if (!e) return null;
366
366
  try {
367
367
  let t = JSON.parse(e);
368
- return !Array.isArray(t) || t.length !== 16 ? null : new B().fromArray(t);
368
+ return !Array.isArray(t) || t.length !== 16 ? null : new V().fromArray(t);
369
369
  } catch (e) {
370
370
  return console.warn("Model matrix parsing error", e), null;
371
371
  }
372
372
  }
373
- function nt(e) {
374
- return tt(rt(e));
375
- }
376
373
  function rt(e) {
374
+ return nt(it(e));
375
+ }
376
+ function it(e) {
377
377
  return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
378
378
  }
379
- function it({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, materialMode: i, useWebGPU: a = !1 }) {
379
+ function at({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, materialMode: i, useWebGPU: a = !1 }) {
380
380
  let o = d((e) => e.gridAxesVisibility), s = b(() => {
381
381
  if (!r) return {
382
382
  data: [],
383
383
  coordinationMatrix: null,
384
384
  floorY: 0
385
385
  };
386
- let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? nt(r) : null, i = Infinity, a = new q();
386
+ let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? rt(r) : null, i = Infinity, a = new K();
387
387
  return {
388
388
  data: Object.values(r.data).map((e) => {
389
- let t = (tt(e.matrix) ?? new B()).clone().invert(), r = e.mat, o = e.pos;
389
+ let t = (nt(e.matrix) ?? new V()).clone().invert(), r = e.mat, o = e.pos;
390
390
  for (let e = 0; e < o.length; e += 3) a.set(o[e], o[e + 1], o[e + 2]).applyMatrix4(t), Number.isFinite(a.y) && (i = Math.min(i, a.y));
391
391
  return {
392
392
  data: e,
@@ -404,8 +404,8 @@ function it({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
404
404
  r,
405
405
  n
406
406
  ]);
407
- if (!r) return /* @__PURE__ */ J(Se, {});
408
- let c = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0, u = s.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: o }) => /* @__PURE__ */ J(a ? et : Te, {
407
+ if (!r) return /* @__PURE__ */ q(Ce, {});
408
+ let c = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0, u = s.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: o }) => /* @__PURE__ */ q(a ? tt : Ee, {
409
409
  colorPaletteTexture: e,
410
410
  material: i,
411
411
  materialMode: c,
@@ -414,14 +414,14 @@ function it({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
414
414
  meshMatrix: o,
415
415
  useDoubleSideMaterial: l
416
416
  }, r));
417
- return /* @__PURE__ */ Y("group", {
418
- matrix: s.coordinationMatrix ?? $e,
417
+ return /* @__PURE__ */ J("group", {
418
+ matrix: s.coordinationMatrix ?? et,
419
419
  matrixAutoUpdate: !1,
420
420
  userData: { modelID: n },
421
- children: [a ? /* @__PURE__ */ J(p, {
421
+ children: [a ? /* @__PURE__ */ q(p, {
422
422
  fallback: null,
423
423
  children: u
424
- }) : u, /* @__PURE__ */ J(Qe, {
424
+ }) : u, /* @__PURE__ */ q($e, {
425
425
  floorY: s.floorY,
426
426
  grids: r.grids,
427
427
  showBottom: o.bottom,
@@ -432,10 +432,10 @@ function it({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
432
432
  })]
433
433
  });
434
434
  }
435
- var at = g(it);
435
+ var ot = g(at);
436
436
  //#endregion
437
437
  //#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
438
- function ot() {
438
+ function st() {
439
439
  return {
440
440
  elementBounds: /* @__PURE__ */ new Map(),
441
441
  elementIndex: /* @__PURE__ */ new Map(),
@@ -446,16 +446,16 @@ function ot() {
446
446
  records: /* @__PURE__ */ new Set()
447
447
  };
448
448
  }
449
- function st(e, t, n, r) {
449
+ function ct(e, t, n, r) {
450
450
  let i = e.get(t);
451
451
  i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
452
452
  let a = i.get(n);
453
453
  a || (a = new D(), i.set(n, a)), a.expandByPoint(r);
454
454
  }
455
- function ct(e) {
455
+ function lt(e) {
456
456
  return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
457
457
  }
458
- function lt(e, t, n, r) {
458
+ function ut(e, t, n, r) {
459
459
  let i = n.get(e);
460
460
  if (i) return i;
461
461
  i = {
@@ -465,20 +465,20 @@ function lt(e, t, n, r) {
465
465
  let a = r.get(e);
466
466
  return a || (a = [], r.set(e, a)), a.push(i), i;
467
467
  }
468
- function ut(e, t, n, r, i, a) {
469
- n && lt(e, r, i, a).vertexRanges.push({
468
+ function dt(e, t, n, r, i, a) {
469
+ n && ut(e, r, i, a).vertexRanges.push({
470
470
  count: n,
471
471
  start: t
472
472
  });
473
473
  }
474
- function dt(e, t, n, r, i, a) {
475
- n && (lt(e, r, i, a), r.triangleRanges.push({
474
+ function ft(e, t, n, r, i, a) {
475
+ n && (ut(e, r, i, a), r.triangleRanges.push({
476
476
  count: n,
477
477
  id: e,
478
478
  start: t
479
479
  }));
480
480
  }
481
- function ft(e) {
481
+ function pt(e) {
482
482
  let t = e;
483
483
  for (; t;) {
484
484
  let e = t.userData.modelID;
@@ -487,19 +487,19 @@ function ft(e) {
487
487
  }
488
488
  return 0;
489
489
  }
490
- function pt(e) {
490
+ function mt(e) {
491
491
  return e.name === "space" || e.userData.isIfcSpace === !0;
492
492
  }
493
- function mt(e) {
494
- let t = x(ot()), n = _(() => {
493
+ function ht(e) {
494
+ let t = x(st()), n = _(() => {
495
495
  let n = e.current, r = t.current;
496
496
  if (!n || r.indexedModel === n && r.records.size) return r;
497
- let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = new q();
497
+ let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = new K();
498
498
  return n.updateMatrixWorld(!0), n.traverse((e) => {
499
- if (!(e instanceof V)) return;
499
+ if (!(e instanceof H)) return;
500
500
  let t = e, n = t.geometry, c = n.index, l = n.attributes.ids;
501
501
  if (!c || !l) return;
502
- let u = n.attributes.position, d = ft(t), f = pt(t), p = ct(c.array), m = {
502
+ let u = n.attributes.position, d = pt(t), f = mt(t), p = lt(c.array), m = {
503
503
  hiddenIds: /* @__PURE__ */ new Set(),
504
504
  initialVisible: t.visible,
505
505
  isIfcSpace: f,
@@ -512,16 +512,16 @@ function mt(e) {
512
512
  }, h = /* @__PURE__ */ new Map(), g = null, _ = 0, v = p.length / 3;
513
513
  for (let e = 0; e < v; e++) {
514
514
  let t = l.getX(p[e * 3]);
515
- g === null ? (g = t, _ = e) : t !== g && (dt(g, _, e - _, m, h, i), g = t, _ = e);
515
+ g === null ? (g = t, _ = e) : t !== g && (ft(g, _, e - _, m, h, i), g = t, _ = e);
516
516
  }
517
- g !== null && dt(g, _, v - _, m, h, i);
517
+ g !== null && ft(g, _, v - _, m, h, i);
518
518
  let y = null, b = 0, x = u ? Math.min(l.count, u.count) : l.count;
519
519
  u && t.updateWorldMatrix(!0, !1);
520
520
  for (let e = 0; e < l.count; e++) {
521
521
  let n = l.getX(e);
522
- u && e < x && (s.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(s.x + s.y + s.z) && st(a, d, n, s)), y === null ? (y = n, b = e) : n !== y && (ut(y, b, e - b, m, h, i), y = n, b = e);
522
+ u && e < x && (s.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(s.x + s.y + s.z) && ct(a, d, n, s)), y === null ? (y = n, b = e) : n !== y && (dt(y, b, e - b, m, h, i), y = n, b = e);
523
523
  }
524
- y !== null && ut(y, b, l.count - b, m, h, i), o.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
524
+ y !== null && dt(y, b, l.count - b, m, h, i), o.add(m), f && !r.ifcSpacesVisible && (t.visible = !1);
525
525
  }), t.current = {
526
526
  elementBounds: a,
527
527
  elementIndex: i,
@@ -532,7 +532,7 @@ function mt(e) {
532
532
  records: o
533
533
  }, t.current;
534
534
  }, [e]), r = _(() => {
535
- t.current = ot();
535
+ t.current = st();
536
536
  }, []);
537
537
  return b(() => ({
538
538
  buildIndex: n,
@@ -541,95 +541,95 @@ function mt(e) {
541
541
  }
542
542
  //#endregion
543
543
  //#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
544
- function ht(e, t) {
544
+ function gt(e, t) {
545
545
  return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
546
546
  }
547
- function gt(e) {
547
+ function _t(e) {
548
548
  let t = e.geometry;
549
- Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ye(e.geometry, { indirect: !0 }) });
549
+ Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
550
550
  }
551
- function _t(e, t, n = !0) {
552
- e.mesh.geometry.setIndex(new k(t, 1)), n && gt(e.mesh);
551
+ function vt(e, t, n = !0) {
552
+ e.mesh.geometry.setIndex(new k(t, 1)), n && _t(e.mesh);
553
553
  }
554
- function vt(e, t) {
554
+ function yt(e, t) {
555
555
  return e.initialVisible && (!e.isIfcSpace || t);
556
556
  }
557
- function yt(e, t) {
557
+ function bt(e, t) {
558
558
  let n = e.mesh.geometry, r = n.index?.array;
559
- e.mesh.visible = vt(e, t), r !== e.originalIndex && _t(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (gt(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
559
+ e.mesh.visible = yt(e, t), r !== e.originalIndex && vt(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (_t(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
560
560
  }
561
- function bt(e) {
561
+ function xt(e) {
562
562
  return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
563
563
  }
564
- function xt(e, t, n, r) {
565
- return `h:${bt(e)}|i:${bt(n)}|s:${r ? Number(t) : ""}`;
564
+ function St(e, t, n, r) {
565
+ return `h:${xt(e)}|i:${xt(n)}|s:${r ? Number(t) : ""}`;
566
566
  }
567
- function St(e, t, n) {
567
+ function Ct(e, t, n) {
568
568
  return !t.has(e) && (!n || n.has(e));
569
569
  }
570
- function Ct(e, t) {
570
+ function wt(e, t) {
571
571
  Object.entries(e).forEach(([e, n]) => {
572
572
  n.forEach((n) => t(Number(e), n));
573
573
  });
574
574
  }
575
- function wt(e, t, n) {
575
+ function Tt(e, t, n) {
576
576
  e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
577
577
  }
578
- function Tt(e, t, n) {
578
+ function Et(e, t, n) {
579
579
  e && console.log(`${t}:`, Date.now() - n, "ms");
580
580
  }
581
- function Et(e, t, n, r) {
582
- let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = xt(i, t, n, e.isIfcSpace);
581
+ function Dt(e, t, n, r) {
582
+ let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = St(i, t, n, e.isIfcSpace);
583
583
  if (e.visibleStateKey === s) return;
584
584
  if (!i.size && !n) {
585
- yt(e, t), e.visibleStateKey = s;
585
+ bt(e, t), e.visibleStateKey = s;
586
586
  return;
587
587
  }
588
588
  let c = 0, l = 0;
589
589
  if (o.forEach(({ count: e, id: t }) => {
590
- St(t, i, n) ? c += e * 3 : l += e * 3;
590
+ Ct(t, i, n) ? c += e * 3 : l += e * 3;
591
591
  }), !c) {
592
- yt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
592
+ bt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
593
593
  return;
594
594
  }
595
595
  if (!l) {
596
- yt(e, t), e.visibleStateKey = s;
596
+ bt(e, t), e.visibleStateKey = s;
597
597
  return;
598
598
  }
599
- e.mesh.visible = vt(e, t);
600
- let u = ht(a, c), d = 0;
599
+ e.mesh.visible = yt(e, t);
600
+ let u = gt(a, c), d = 0;
601
601
  for (let e = 0; e < o.length; e++) {
602
602
  let { count: t, id: r, start: s } = o[e];
603
- if (!St(r, i, n)) continue;
603
+ if (!Ct(r, i, n)) continue;
604
604
  let c = s * 3, l = c + t * 3;
605
605
  u.set(a.subarray(c, l), d), d += t * 3;
606
606
  }
607
- r || (e.originalBoundsTree = null), _t(e, u), e.visibleStateKey = s;
607
+ r || (e.originalBoundsTree = null), vt(e, u), e.visibleStateKey = s;
608
608
  }
609
- function Dt(e, t) {
609
+ function Ot(e, t) {
610
610
  return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
611
611
  }
612
- function Ot(e) {
612
+ function kt(e) {
613
613
  let t = d((e) => e.selected), n = d((e) => e.resetSelected), r = d((e) => e.showStats), i = d((e) => e.userDevice) === "pc", a = e.buildIndex, o = _(() => Array.from(a().elementIndex.keys()), [a]), s = _(() => a().ifcSpacesVisible, [a]), c = _((e) => {
614
614
  let t = Date.now(), n = a(), o = /* @__PURE__ */ new Set();
615
615
  e.forEach((e) => {
616
616
  let t = n.elementIndex.get(e);
617
617
  t && t.forEach(({ record: t }) => {
618
- wt(t, e, o);
618
+ Tt(t, e, o);
619
619
  });
620
- }), o.forEach((e) => Et(e, n.ifcSpacesVisible, Dt(n, e), i)), Tt(r, "hideByIds", t);
620
+ }), o.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "hideByIds", t);
621
621
  }, [
622
622
  a,
623
623
  i,
624
624
  r
625
625
  ]), l = _(() => {
626
626
  let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
627
- Ct(t, (e, t) => {
627
+ wt(t, (e, t) => {
628
628
  let n = o.elementIndex.get(t);
629
629
  n && n.forEach(({ record: n }) => {
630
- n.modelID === e && wt(n, t, s);
630
+ n.modelID === e && Tt(n, t, s);
631
631
  });
632
- }), s.forEach((e) => Et(e, o.ifcSpacesVisible, Dt(o, e), i)), n(), Tt(r, "hideSelected", e);
632
+ }), s.forEach((e) => Dt(e, o.ifcSpacesVisible, Ot(o, e), i)), n(), Et(r, "hideSelected", e);
633
633
  }, [
634
634
  a,
635
635
  i,
@@ -643,24 +643,24 @@ function Ot(e) {
643
643
  t && t.forEach(({ record: t }) => {
644
644
  t.hiddenIds.delete(e) && o.add(t);
645
645
  });
646
- }), o.forEach((e) => Et(e, n.ifcSpacesVisible, Dt(n, e), i)), Tt(r, "showByIds", t);
646
+ }), o.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "showByIds", t);
647
647
  }, [
648
648
  a,
649
649
  i,
650
650
  r
651
651
  ]), f = _((e) => {
652
652
  let t = Date.now(), n = a();
653
- n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => Et(e, n.ifcSpacesVisible, Dt(n, e), i)), Tt(r, "isolateByIds", t);
653
+ n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "isolateByIds", t);
654
654
  }, [
655
655
  a,
656
656
  i,
657
657
  r
658
658
  ]), p = _(() => {
659
659
  let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
660
- Ct(t, (e, t) => {
660
+ wt(t, (e, t) => {
661
661
  let n = o.get(e);
662
662
  n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
663
- }), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => Et(e, n.ifcSpacesVisible, Dt(n, e), i)), Tt(r, "isolateSelected", e);
663
+ }), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => Dt(e, n.ifcSpacesVisible, Ot(n, e), i)), Et(r, "isolateSelected", e);
664
664
  }, [
665
665
  a,
666
666
  i,
@@ -668,7 +668,7 @@ function Ot(e) {
668
668
  r
669
669
  ]), m = _(() => {
670
670
  let e = Date.now(), t = a();
671
- t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => Et(e, t.ifcSpacesVisible, Dt(t, e), i)), Tt(r, "resetIsolation", e);
671
+ t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => Dt(e, t.ifcSpacesVisible, Ot(t, e), i)), Et(r, "resetIsolation", e);
672
672
  }, [
673
673
  a,
674
674
  i,
@@ -676,7 +676,7 @@ function Ot(e) {
676
676
  ]), h = _((e) => {
677
677
  let t = a();
678
678
  t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
679
- e.isIfcSpace && Et(e, t.ifcSpacesVisible, Dt(t, e), i);
679
+ e.isIfcSpace && Dt(e, t.ifcSpacesVisible, Ot(t, e), i);
680
680
  }));
681
681
  }, [a, i]), g = _(() => {
682
682
  h(!s());
@@ -694,8 +694,8 @@ function Ot(e) {
694
694
  showAll: _(() => {
695
695
  let e = Date.now(), t = a();
696
696
  t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
697
- e.hiddenIds.clear(), Et(e, t.ifcSpacesVisible, Dt(t, e), i);
698
- }), Tt(r, "showAll", e);
697
+ e.hiddenIds.clear(), Dt(e, t.ifcSpacesVisible, Ot(t, e), i);
698
+ }), Et(r, "showAll", e);
699
699
  }, [
700
700
  a,
701
701
  i,
@@ -707,11 +707,11 @@ function Ot(e) {
707
707
  }
708
708
  //#endregion
709
709
  //#region src/viewer/utils/ClippingUtils/ClippingCaps.ts
710
- var kt = "#ffffff", At = "#111111", jt = 1e-5, Mt = 1e-6, Nt = 2e-5, Pt = 50, Ft = 1e-6, It = 2, Lt = .005 / 3, Rt = .15 / 3, zt = 128, Bt = 24, Vt = 1e-8;
711
- function Ht(e) {
710
+ var At = "#ffffff", jt = "#111111", Mt = 1e-5, Nt = 1e-6, Pt = 2e-5, Ft = 50, It = 1e-6, Lt = 2, Rt = .005 / 3, zt = .15 / 3, Bt = 128, Vt = 24, Ht = 1e-8;
711
+ function Ut(e) {
712
712
  return !(!e.parent || !e.visible || !e.geometry.index?.count);
713
713
  }
714
- function Ut(e) {
714
+ function Wt(e) {
715
715
  let t = e;
716
716
  for (; t;) {
717
717
  let e = t.userData.modelID;
@@ -720,7 +720,7 @@ function Ut(e) {
720
720
  }
721
721
  return 0;
722
722
  }
723
- function Wt(e) {
723
+ function Gt(e) {
724
724
  let t = e;
725
725
  for (; t;) {
726
726
  if (typeof t.userData.modelID == "number") return t;
@@ -728,27 +728,27 @@ function Wt(e) {
728
728
  }
729
729
  return e;
730
730
  }
731
- function Gt(e) {
732
- return Math.abs(e.normal.y) < .9 ? new q(0, 1, 0) : new q(1, 0, 0);
731
+ function Kt(e) {
732
+ return Math.abs(e.normal.y) < .9 ? new K(0, 1, 0) : new K(1, 0, 0);
733
733
  }
734
- function Kt(e, t) {
734
+ function qt(e, t) {
735
735
  return e.clone().addScaledVector(t.normal, -e.dot(t.normal));
736
736
  }
737
- function qt(e, t) {
738
- let n = t ? Kt(t, e) : new q(), r = n.lengthSq() > Vt ? n.normalize() : Gt(e).cross(e.normal).normalize(), i = e.normal.clone().cross(r).normalize();
737
+ function Jt(e, t) {
738
+ let n = t ? qt(t, e) : new K(), r = n.lengthSq() > Ht ? n.normalize() : Kt(e).cross(e.normal).normalize(), i = e.normal.clone().cross(r).normalize();
739
739
  return {
740
- origin: e.coplanarPoint(new q()),
740
+ origin: e.coplanarPoint(new K()),
741
741
  u: r,
742
742
  v: i
743
743
  };
744
744
  }
745
- function Jt(e, t) {
745
+ function Yt(e, t) {
746
746
  return `${Math.round(e.x / t)}:${Math.round(e.y / t)}`;
747
747
  }
748
- function Yt(e, t) {
748
+ function Xt(e, t) {
749
749
  return e < t ? `${e}|${t}` : `${t}|${e}`;
750
750
  }
751
- function Xt(e) {
751
+ function Zt(e) {
752
752
  let t = 0;
753
753
  for (let n = 0; n < e.length; n++) {
754
754
  let r = e[n], i = e[(n + 1) % e.length];
@@ -756,12 +756,12 @@ function Xt(e) {
756
756
  }
757
757
  return t * .5;
758
758
  }
759
- function Zt(e) {
760
- let t = zt, n = document.createElement("canvas");
759
+ function Qt(e) {
760
+ let t = Bt, n = document.createElement("canvas");
761
761
  n.width = t, n.height = t;
762
762
  let r = n.getContext("2d");
763
763
  if (r) {
764
- r.fillStyle = kt, r.fillRect(0, 0, t, t), r.strokeStyle = At, r.lineWidth = Bt, r.lineCap = "square", r.beginPath();
764
+ r.fillStyle = At, r.fillRect(0, 0, t, t), r.strokeStyle = jt, r.lineWidth = Vt, r.lineCap = "square", r.beginPath();
765
765
  for (let e of [
766
766
  -t,
767
767
  0,
@@ -770,49 +770,49 @@ function Zt(e) {
770
770
  r.stroke();
771
771
  }
772
772
  let i = new j(n);
773
- return i.anisotropy = Math.max(1, e), i.magFilter = z, i.minFilter = ae, i.wrapS = le, i.wrapT = le, i.needsUpdate = !0, i;
773
+ return i.anisotropy = Math.max(1, e), i.magFilter = B, i.minFilter = ie, i.wrapS = ue, i.wrapT = ue, i.needsUpdate = !0, i;
774
774
  }
775
- function Qt(e, t) {
775
+ function $t(e, t) {
776
776
  return new k(t ? new Uint32Array(e) : new Uint8Array(e), 1);
777
777
  }
778
- var $t = class {
778
+ var en = class {
779
779
  active;
780
780
  plane;
781
781
  capMaterial;
782
782
  capMesh;
783
783
  capTexture;
784
784
  context;
785
- root = new P();
785
+ root = new F();
786
786
  box = new D();
787
787
  meshBox = new D();
788
- inverseMatrix = new B();
789
- localPlane = new G();
790
- tempLine = new I();
791
- tempVector = new q();
792
- tempVector1 = new q();
793
- tempAxisX = new q();
794
- tempAxisY = new q();
795
- tempAxisZ = new q();
796
- worldPoint = new q();
788
+ inverseMatrix = new V();
789
+ localPlane = new le();
790
+ tempLine = new L();
791
+ tempVector = new K();
792
+ tempVector1 = new K();
793
+ tempAxisX = new K();
794
+ tempAxisY = new K();
795
+ tempAxisZ = new K();
796
+ worldPoint = new K();
797
797
  capClippingPlanesKey = "";
798
798
  capShader = null;
799
- closeGapTolerance = jt;
799
+ closeGapTolerance = Mt;
800
800
  preselection = null;
801
- tolerance = jt;
801
+ tolerance = Mt;
802
802
  constructor(e, t) {
803
- this.context = e, this.plane = t, this.active = e.getActive() && e.getCapsActive(), this.capTexture = Zt(e.getMaxTextureAnisotropy()), this.capMaterial = this.createCapMaterial(), this.capMaterial.defaultAttributeValues = {
803
+ this.context = e, this.plane = t, this.active = e.getActive() && e.getCapsActive(), this.capTexture = Qt(e.getMaxTextureAnisotropy()), this.capMaterial = this.createCapMaterial(), this.capMaterial.defaultAttributeValues = {
804
804
  colorIndex: [0],
805
805
  ids: [0],
806
806
  modelID: [0]
807
- }, this.capMaterial.color.convertSRGBToLinear(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new V(new A(), this.capMaterial), this.capMesh.frustumCulled = !1, this.capMesh.renderOrder = It, this.root.add(this.capMesh), this.root.visible = this.active, this.root.name = "clipping-caps", this.root.renderOrder = It, this.context.getScene().add(this.root), this.context.caps.push(this), this.update();
807
+ }, this.capMaterial.color.convertSRGBToLinear(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new H(new A(), this.capMaterial), this.capMesh.frustumCulled = !1, this.capMesh.renderOrder = Lt, this.root.add(this.capMesh), this.root.visible = this.active, this.root.name = "clipping-caps", this.root.renderOrder = Lt, this.context.getScene().add(this.root), this.context.caps.push(this), this.update();
808
808
  }
809
809
  createCapMaterial() {
810
810
  return this.context.getUseWebGPU() ? new e({
811
- color: kt,
811
+ color: At,
812
812
  depthWrite: !1,
813
813
  side: te
814
- }) : new H({
815
- color: kt,
814
+ }) : new U({
815
+ color: At,
816
816
  depthWrite: !1,
817
817
  map: this.capTexture,
818
818
  side: te
@@ -838,7 +838,7 @@ var $t = class {
838
838
  let e = this.capMesh.geometry, t = e.getAttribute("ids"), n = e.getAttribute("modelID");
839
839
  if (!t || !n) return;
840
840
  let r = e.getAttribute("colorIndex");
841
- (!r || r.count !== t.count) && (r = Qt(t.count, this.context.getUseWebGPU()), e.setAttribute("colorIndex", r));
841
+ (!r || r.count !== t.count) && (r = $t(t.count, this.context.getUseWebGPU()), e.setAttribute("colorIndex", r));
842
842
  let i = this.context.getSelected();
843
843
  for (let e = 0; e < t.count; e++) {
844
844
  let a = n.getX(e), o = t.getX(e), s = i[a]?.has(o) ?? !1;
@@ -892,13 +892,13 @@ var $t = class {
892
892
  createCapGeometry() {
893
893
  let e = new A(), t = this.getModelWorldBox();
894
894
  if (!t) return e;
895
- let n = t.getSize(new q()).length();
896
- this.tolerance = Math.max(jt, n * Mt), this.closeGapTolerance = Math.max(this.tolerance * Pt, n * Nt);
897
- let r = qt(this.plane, this.getModelHatchReferenceDirection()), i = this.context.getEdgeSegmentsForPlane(this.plane), a = i ? this.getCapSegmentsFromEdgeSegments(i, r) : this.getCapSegments(r), o = this.getClosedContours(a), s = this.getHatchSpacing(n), { elementIDs: c, modelIDs: l, positions: u, uvs: d } = this.triangulateContours(o, r, s);
898
- if (e.setAttribute("position", new re(u, 3)), e.setAttribute("uv", new re(d, 2)), e.setAttribute("ids", new ge(c, 1)), e.setAttribute("modelID", new ge(l, 1)), e.setAttribute("colorIndex", Qt(c.length, this.context.getUseWebGPU())), c.length) {
895
+ let n = t.getSize(new K()).length();
896
+ this.tolerance = Math.max(Mt, n * Nt), this.closeGapTolerance = Math.max(this.tolerance * Ft, n * Pt);
897
+ let r = Jt(this.plane, this.getModelHatchReferenceDirection()), i = this.context.getEdgeSegmentsForPlane(this.plane), a = i ? this.getCapSegmentsFromEdgeSegments(i, r) : this.getCapSegments(r), o = this.getClosedContours(a), s = this.getHatchSpacing(n), { elementIDs: c, modelIDs: l, positions: u, uvs: d } = this.triangulateContours(o, r, s);
898
+ if (e.setAttribute("position", new P(u, 3)), e.setAttribute("uv", new P(d, 2)), e.setAttribute("ids", new _e(c, 1)), e.setAttribute("modelID", new _e(l, 1)), e.setAttribute("colorIndex", $t(c.length, this.context.getUseWebGPU())), c.length) {
899
899
  let t = new Uint32Array(c.length);
900
900
  for (let e = 0; e < t.length; e++) t[e] = e;
901
- e.setIndex(new ge(t, 1));
901
+ e.setIndex(new _e(t, 1));
902
902
  }
903
903
  return u.length && (e.computeVertexNormals(), e.computeBoundingSphere()), e;
904
904
  }
@@ -916,10 +916,10 @@ var $t = class {
916
916
  }
917
917
  getCapSegments(e) {
918
918
  let t = [];
919
- return this.context.getMeshes().filter(Ht).forEach((n) => {
919
+ return this.context.getMeshes().filter(Ut).forEach((n) => {
920
920
  let r = n.geometry.boundsTree;
921
921
  if (!r) return;
922
- let i = Ut(n);
922
+ let i = Wt(n);
923
923
  n.updateWorldMatrix(!0, !1), this.inverseMatrix.copy(n.matrixWorld).invert(), this.localPlane.copy(this.plane).applyMatrix4(this.inverseMatrix), r.shapecast({
924
924
  intersectsBounds: (e) => this.localPlane.intersectsBox(e),
925
925
  intersectsTriangle: (r, a) => {
@@ -951,7 +951,7 @@ var $t = class {
951
951
  return this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), n(this.localPlane.intersectLine(this.tempLine, this.tempVector)), t;
952
952
  }
953
953
  getPlanePoint(e, t) {
954
- return this.worldPoint.copy(e).sub(t.origin), new K(this.worldPoint.dot(t.u), this.worldPoint.dot(t.v));
954
+ return this.worldPoint.copy(e).sub(t.origin), new G(this.worldPoint.dot(t.u), this.worldPoint.dot(t.v));
955
955
  }
956
956
  getClosedContours(e) {
957
957
  let t = /* @__PURE__ */ new Map();
@@ -976,7 +976,7 @@ var $t = class {
976
976
  }
977
977
  getElementClosedContours(e) {
978
978
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = (e) => {
979
- let n = Jt(e, this.tolerance), r = t.get(n);
979
+ let n = Yt(e, this.tolerance), r = t.get(n);
980
980
  return r || (r = {
981
981
  edges: /* @__PURE__ */ new Set(),
982
982
  point: e.clone()
@@ -992,12 +992,12 @@ var $t = class {
992
992
  let i = [];
993
993
  return t.forEach((e, r) => {
994
994
  e.edges.forEach((e) => {
995
- let a = Yt(r, e);
995
+ let a = Xt(r, e);
996
996
  if (n.has(a)) return;
997
997
  let o = this.walkContour(r, e, t, n);
998
998
  if (!o) return;
999
999
  let s = this.cleanContour(o.contour);
1000
- s.length < 3 || Math.abs(Xt(s)) < Ft || (o.edges.forEach((e) => n.add(e)), i.push(s));
1000
+ s.length < 3 || Math.abs(Zt(s)) < It || (o.edges.forEach((e) => n.add(e)), i.push(s));
1001
1001
  });
1002
1002
  }), i;
1003
1003
  }
@@ -1007,7 +1007,7 @@ var $t = class {
1007
1007
  let t = n.get(s);
1008
1008
  if (!t || !c) return null;
1009
1009
  i.push(t.point.clone());
1010
- let l = Yt(s, c);
1010
+ let l = Xt(s, c);
1011
1011
  a.push(l), o.add(l);
1012
1012
  let u = s;
1013
1013
  if (s = c, s === e) return {
@@ -1031,7 +1031,7 @@ var $t = class {
1031
1031
  if (!o || !s) return null;
1032
1032
  let c = s.point.clone().sub(o.point), l = Array.from(s.edges).filter((n) => {
1033
1033
  if (n === e) return !1;
1034
- let r = Yt(t, n);
1034
+ let r = Xt(t, n);
1035
1035
  return !(i.has(r) || a.has(r));
1036
1036
  });
1037
1037
  return l.length ? l.includes(n) ? n : l.map((e) => {
@@ -1064,7 +1064,7 @@ var $t = class {
1064
1064
  triangulateContours(e, t, n) {
1065
1065
  let r = [], i = [], a = [], o = [];
1066
1066
  return e.forEach(({ elementID: e, modelID: s, points: c }) => {
1067
- de.triangulateShape(c, []).forEach(([l, u, d]) => {
1067
+ fe.triangulateShape(c, []).forEach(([l, u, d]) => {
1068
1068
  this.pushContourVertex(a, r, i, o, c[l], t, n, e, s), this.pushContourVertex(a, r, i, o, c[u], t, n, e, s), this.pushContourVertex(a, r, i, o, c[d], t, n, e, s);
1069
1069
  });
1070
1070
  }), {
@@ -1078,61 +1078,61 @@ var $t = class {
1078
1078
  this.tempVector1.copy(a.origin).addScaledVector(a.u, i.x).addScaledVector(a.v, i.y), e.push(this.tempVector1.x, this.tempVector1.y, this.tempVector1.z), t.push(s), n.push(c), r.push(i.x / o, i.y / o);
1079
1079
  }
1080
1080
  getHatchSpacing(e) {
1081
- return Math.max(Rt, e * Lt);
1081
+ return Math.max(zt, e * Rt);
1082
1082
  }
1083
1083
  getModelHatchReferenceDirection() {
1084
- let e = this.context.getMeshes().filter(Ht)[0];
1084
+ let e = this.context.getMeshes().filter(Ut)[0];
1085
1085
  if (!e) return null;
1086
- let t = Wt(e);
1086
+ let t = Gt(e);
1087
1087
  t.updateWorldMatrix(!0, !1), t.matrixWorld.extractBasis(this.tempAxisX, this.tempAxisY, this.tempAxisZ);
1088
1088
  for (let e of [
1089
1089
  this.tempAxisX,
1090
1090
  this.tempAxisZ,
1091
1091
  this.tempAxisY
1092
- ]) if (!(e.lengthSq() <= Vt) && (e.normalize(), Kt(e, this.plane).lengthSq() > Vt)) return e.clone();
1092
+ ]) if (!(e.lengthSq() <= Ht) && (e.normalize(), qt(e, this.plane).lengthSq() > Ht)) return e.clone();
1093
1093
  return null;
1094
1094
  }
1095
1095
  getModelWorldBox() {
1096
- return this.box.makeEmpty(), this.context.getMeshes().filter(Ht).forEach((e) => {
1096
+ return this.box.makeEmpty(), this.context.getMeshes().filter(Ut).forEach((e) => {
1097
1097
  e.updateWorldMatrix(!0, !1), e.geometry.boundingBox || e.geometry.computeBoundingBox(), e.geometry.boundingBox && (this.meshBox.copy(e.geometry.boundingBox).applyMatrix4(e.matrixWorld), this.box.union(this.meshBox));
1098
1098
  }), this.box.isEmpty() ? null : this.box;
1099
1099
  }
1100
- }, en = 1024, tn = 1;
1101
- function nn(e) {
1100
+ }, tn = 1024, nn = 1;
1101
+ function rn(e) {
1102
1102
  let t = new k(new Float32Array(e * 3), 3, !1);
1103
1103
  return t.setUsage(ne), t;
1104
1104
  }
1105
- function rn(e) {
1105
+ function an(e) {
1106
1106
  return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
1107
1107
  }
1108
- function an(e, t) {
1109
- let n = new A(), r = Math.ceil(Math.min(Math.max(en, rn(t) * .05), 32768));
1110
- n.setAttribute("position", nn(r)), n.setDrawRange(0, 0);
1111
- let i = new ie(n, e);
1112
- return i.frustumCulled = !1, i.renderOrder = tn, i.visible = !1, i;
1113
- }
1114
1108
  function on(e, t) {
1109
+ let n = new A(), r = Math.ceil(Math.min(Math.max(tn, an(t) * .05), 32768));
1110
+ n.setAttribute("position", rn(r)), n.setDrawRange(0, 0);
1111
+ let i = new re(n, e);
1112
+ return i.frustumCulled = !1, i.renderOrder = nn, i.visible = !1, i;
1113
+ }
1114
+ function sn(e, t) {
1115
1115
  let n = e.geometry.getAttribute("position");
1116
1116
  if (n.count > t) return n;
1117
- let r = nn(Math.max(n.count * 2, t + 1));
1117
+ let r = rn(Math.max(n.count * 2, t + 1));
1118
1118
  return r.array.set(n.array), e.geometry.setAttribute("position", r), n = r, n;
1119
1119
  }
1120
- function sn(e) {
1120
+ function cn(e) {
1121
1121
  return e.filter((e) => e.parent && e.visible && e.geometry.index?.count);
1122
1122
  }
1123
- var cn = class {
1123
+ var ln = class {
1124
1124
  active;
1125
1125
  material;
1126
1126
  plane;
1127
1127
  context;
1128
1128
  lines = /* @__PURE__ */ new Map();
1129
- inverseMatrix = new B();
1130
- localPlane = new G();
1131
- tempLine = new I();
1132
- tempVector = new q();
1133
- tempVector1 = new q();
1134
- tempVector2 = new q();
1135
- tempVector3 = new q();
1129
+ inverseMatrix = new V();
1130
+ localPlane = new le();
1131
+ tempLine = new L();
1132
+ tempVector = new K();
1133
+ tempVector1 = new K();
1134
+ tempVector2 = new K();
1135
+ tempVector3 = new K();
1136
1136
  intersectionSegments = [];
1137
1137
  constructor(e, t) {
1138
1138
  this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
@@ -1140,7 +1140,7 @@ var cn = class {
1140
1140
  e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
1141
1141
  });
1142
1142
  let n = e.planes.filter((e) => e !== t);
1143
- this.material = new L({
1143
+ this.material = new R({
1144
1144
  clippingPlanes: n,
1145
1145
  color: "black",
1146
1146
  depthTest: !0,
@@ -1151,12 +1151,12 @@ var cn = class {
1151
1151
  return this.syncMeshes(), Array.from(this.lines.values());
1152
1152
  }
1153
1153
  syncMeshes() {
1154
- let e = new Set(sn(this.context.getMeshes()));
1154
+ let e = new Set(cn(this.context.getMeshes()));
1155
1155
  this.lines.forEach((t, n) => {
1156
1156
  e.has(n) || (t.removeFromParent(), t.geometry.dispose(), this.lines.delete(n));
1157
1157
  }), e.forEach((e) => {
1158
1158
  if (this.lines.has(e)) return;
1159
- let t = an(this.material, e);
1159
+ let t = on(this.material, e);
1160
1160
  e.add(t), this.lines.set(e, t);
1161
1161
  }), this.setVisible(this.active);
1162
1162
  }
@@ -1185,7 +1185,7 @@ var cn = class {
1185
1185
  }
1186
1186
  t.updateWorldMatrix(!0, !1), this.inverseMatrix.copy(t.matrixWorld).invert(), this.localPlane.copy(this.plane).applyMatrix4(this.inverseMatrix);
1187
1187
  let r = 0, i = e.geometry.getAttribute("position"), a = (t) => {
1188
- i = on(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1188
+ i = sn(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1189
1189
  };
1190
1190
  n.shapecast({
1191
1191
  intersectsBounds: (e) => this.localPlane.intersectsBox(e),
@@ -1218,17 +1218,17 @@ var cn = class {
1218
1218
  let a = n.getX(i);
1219
1219
  return a >= r.count ? null : r.getX(a);
1220
1220
  }
1221
- }, ln = "#0b2f5f", un = "#0b2f5f", dn = 0, fn = "#1f7ae0", pn = .22, mn = .01, hn = .025, gn = .015, _n = .02, vn = 1e-7, yn = .25, bn = .15, xn = .25, Sn = 1e-5, Cn = .2, wn = 1, X = 1;
1222
- function Tn(e, t) {
1221
+ }, un = "#0b2f5f", dn = "#0b2f5f", fn = 0, pn = "#1f7ae0", mn = .22, hn = .01, gn = .025, _n = .015, vn = .02, yn = 1e-7, bn = .25, xn = .15, Sn = .25, Cn = 1e-5, wn = .2, Tn = 1, Y = 1;
1222
+ function En(e, t) {
1223
1223
  let n = t.getBoundingClientRect();
1224
- return new K((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1224
+ return new G((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1225
1225
  }
1226
- function En(e) {
1227
- let t = e.getSize(new q());
1228
- return Math.max(xn, t.length() * mn);
1226
+ function Dn(e) {
1227
+ let t = e.getSize(new K());
1228
+ return Math.max(Sn, t.length() * hn);
1229
1229
  }
1230
- var Dn = class extends U {
1231
- helper = new P();
1230
+ var On = class extends W {
1231
+ helper = new F();
1232
1232
  borderMaterial;
1233
1233
  material;
1234
1234
  plane;
@@ -1236,26 +1236,26 @@ var Dn = class extends U {
1236
1236
  border;
1237
1237
  context;
1238
1238
  location;
1239
- localHitPoint = new q();
1239
+ localHitPoint = new K();
1240
1240
  normal;
1241
1241
  planeMesh;
1242
- pointer = new K();
1242
+ pointer = new G();
1243
1243
  layout;
1244
1244
  polygon = [];
1245
1245
  dragState = null;
1246
1246
  hovered = !1;
1247
1247
  listenersActive = !1;
1248
1248
  constructor(e, t, n, r) {
1249
- super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new H({
1250
- color: un,
1249
+ super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new U({
1250
+ color: dn,
1251
1251
  depthWrite: !1,
1252
- opacity: dn,
1252
+ opacity: fn,
1253
1253
  side: te,
1254
1254
  transparent: !0
1255
1255
  }), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
1256
- let i = Math.max(yn, Math.min(this.layout.width, this.layout.height) * hn), a = Math.max(bn, Math.min(this.layout.width, this.layout.height) * gn);
1257
- this.borderMaterial = new R({
1258
- color: ln,
1256
+ let i = Math.max(bn, Math.min(this.layout.width, this.layout.height) * gn), a = Math.max(xn, Math.min(this.layout.width, this.layout.height) * _n);
1257
+ this.borderMaterial = new z({
1258
+ color: un,
1259
1259
  dashSize: i,
1260
1260
  depthWrite: !1,
1261
1261
  gapSize: a
@@ -1286,7 +1286,7 @@ var Dn = class extends U {
1286
1286
  }
1287
1287
  updateBorderDash() {
1288
1288
  let e = Math.min(this.layout.width, this.layout.height);
1289
- this.borderMaterial.dashSize = Math.max(yn, e * hn), this.borderMaterial.gapSize = Math.max(bn, e * gn), this.borderMaterial.needsUpdate = !0;
1289
+ this.borderMaterial.dashSize = Math.max(bn, e * gn), this.borderMaterial.gapSize = Math.max(xn, e * _n), this.borderMaterial.needsUpdate = !0;
1290
1290
  }
1291
1291
  addEventListeners() {
1292
1292
  if (this.listenersActive) return;
@@ -1329,7 +1329,7 @@ var Dn = class extends U {
1329
1329
  hasModelIntersection(e) {
1330
1330
  return !!this.context.getCameraUtils().getIntersection(!0, {
1331
1331
  event: e,
1332
- filter: (e) => !(e.object instanceof V) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1332
+ filter: (e) => !(e.object instanceof H) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1333
1333
  object: this.context.getMeshes(),
1334
1334
  recursive: !1
1335
1335
  });
@@ -1348,10 +1348,10 @@ var Dn = class extends U {
1348
1348
  return !1;
1349
1349
  }
1350
1350
  getEdgeInteractionWidth() {
1351
- return Math.min(wn, Math.max(Cn, Math.min(this.layout.width, this.layout.height) * _n));
1351
+ return Math.min(Tn, Math.max(wn, Math.min(this.layout.width, this.layout.height) * vn));
1352
1352
  }
1353
1353
  getDragDistanceEpsilon() {
1354
- return Math.max(Sn, Math.min(this.layout.width, this.layout.height) * vn);
1354
+ return Math.max(Cn, Math.min(this.layout.width, this.layout.height) * yn);
1355
1355
  }
1356
1356
  getPointToSegmentDistanceSquared(e, t, n) {
1357
1357
  let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
@@ -1364,8 +1364,8 @@ var Dn = class extends U {
1364
1364
  }
1365
1365
  getPointerPointOnPlane(e, t) {
1366
1366
  let n = this.context.getDomElement();
1367
- this.pointer.copy(Tn(e, n));
1368
- let r = this.context.getRaycaster(), i = new q();
1367
+ this.pointer.copy(En(e, n));
1368
+ let r = this.context.getRaycaster(), i = new K();
1369
1369
  return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
1370
1370
  }
1371
1371
  onPointerDown = (e) => {
@@ -1373,9 +1373,9 @@ var Dn = class extends U {
1373
1373
  let t = this.getPointerIntersection(e);
1374
1374
  if (!t) return;
1375
1375
  this.stopHelperPriorityEvent(e), this.context.clearHelpersHover(this), this.setHovered(!0), this.context.setHelperDragActive(!0), this.context.setCapsDragActive(!0), this.context.requestCapsDragIdleUpdate(), this.context.setSelectionInteractionDisabled(!0);
1376
- let n = new q();
1376
+ let n = new K();
1377
1377
  this.context.getCamera().getWorldDirection(n), n.normalize();
1378
- let r = new G().setFromNormalAndCoplanarPoint(n, t.point);
1378
+ let r = new le().setFromNormalAndCoplanarPoint(n, t.point);
1379
1379
  this.dragState = {
1380
1380
  dragPlane: r,
1381
1381
  helperStart: this.helper.position.clone(),
@@ -1417,14 +1417,14 @@ var Dn = class extends U {
1417
1417
  t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
1418
1418
  }
1419
1419
  setHovered(e) {
1420
- this.hovered = e, this.material.color.set(e ? fn : un), this.material.opacity = e ? pn : dn, this.material.needsUpdate = !0;
1420
+ this.hovered = e, this.material.color.set(e ? pn : dn), this.material.opacity = e ? mn : fn, this.material.needsUpdate = !0;
1421
1421
  }
1422
1422
  createPlaneMesh() {
1423
- let e = new V(new A(), this.material);
1423
+ let e = new H(new A(), this.material);
1424
1424
  return e.renderOrder = 2, e;
1425
1425
  }
1426
1426
  createBorder() {
1427
- let e = new ie(new A(), this.borderMaterial);
1427
+ let e = new re(new A(), this.borderMaterial);
1428
1428
  return e.renderOrder = 3, e;
1429
1429
  }
1430
1430
  replaceGeometry(e, t) {
@@ -1439,7 +1439,7 @@ var Dn = class extends U {
1439
1439
  n.push(t.x, t.y, 0, i.x, i.y, 0, a.x, a.y, 0);
1440
1440
  }
1441
1441
  }
1442
- return t.setAttribute("position", new re(n, 3)), n.length && t.computeBoundingSphere(), t;
1442
+ return t.setAttribute("position", new P(n, 3)), n.length && t.computeBoundingSphere(), t;
1443
1443
  }
1444
1444
  createBorderGeometry(e) {
1445
1445
  let t = new A(), n = [];
@@ -1447,7 +1447,7 @@ var Dn = class extends U {
1447
1447
  let r = e[t], i = e[(t + 1) % e.length];
1448
1448
  n.push(r.x, r.y, 0, i.x, i.y, 0);
1449
1449
  }
1450
- return t.setAttribute("position", new re(n, 3)), n.length && t.computeBoundingSphere(), t;
1450
+ return t.setAttribute("position", new P(n, 3)), n.length && t.computeBoundingSphere(), t;
1451
1451
  }
1452
1452
  getClippedPolygon() {
1453
1453
  let e = this.getPlaneBasis(), t = [
@@ -1493,27 +1493,27 @@ var Dn = class extends U {
1493
1493
  getHelperLayout() {
1494
1494
  let e = this.getModelWorldBox();
1495
1495
  if (!e || e.isEmpty()) return {
1496
- height: X,
1497
- maxU: X / 2,
1498
- maxV: X / 2,
1499
- minU: -X / 2,
1500
- minV: -X / 2,
1501
- width: X
1496
+ height: Y,
1497
+ maxU: Y / 2,
1498
+ maxV: Y / 2,
1499
+ minU: -Y / 2,
1500
+ minV: -Y / 2,
1501
+ width: Y
1502
1502
  };
1503
- let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new q(), a = new q(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1503
+ let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new K(), a = new K(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1504
1504
  if (r.forEach((e) => {
1505
1505
  this.plane.projectPoint(e, i), a.copy(i).sub(n);
1506
1506
  let r = a.dot(t.u), u = a.dot(t.v);
1507
1507
  o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
1508
1508
  }), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
1509
- height: X,
1510
- maxU: X / 2,
1511
- maxV: X / 2,
1512
- minU: -X / 2,
1513
- minV: -X / 2,
1514
- width: X
1509
+ height: Y,
1510
+ maxU: Y / 2,
1511
+ maxV: Y / 2,
1512
+ minU: -Y / 2,
1513
+ minV: -Y / 2,
1514
+ width: Y
1515
1515
  };
1516
- let u = En(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(X, f - d), g = Math.max(X, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1516
+ let u = Dn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(Y, f - d), g = Math.max(Y, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1517
1517
  return {
1518
1518
  height: g,
1519
1519
  maxU: _ + h / 2,
@@ -1524,14 +1524,14 @@ var Dn = class extends U {
1524
1524
  };
1525
1525
  }
1526
1526
  getPlaneBasis() {
1527
- let e = (Math.abs(this.normal.y) < .9 ? new q(0, 1, 0) : new q(1, 0, 0)).cross(this.normal).normalize();
1527
+ let e = (Math.abs(this.normal.y) < .9 ? new K(0, 1, 0) : new K(1, 0, 0)).cross(this.normal).normalize();
1528
1528
  return {
1529
1529
  u: e,
1530
1530
  v: this.normal.clone().cross(e).normalize()
1531
1531
  };
1532
1532
  }
1533
1533
  applyPlaneOrientation() {
1534
- let e = this.getPlaneBasis(), t = new B().makeBasis(e.u, e.v, this.normal);
1534
+ let e = this.getPlaneBasis(), t = new V().makeBasis(e.u, e.v, this.normal);
1535
1535
  this.helper.quaternion.setFromRotationMatrix(t);
1536
1536
  }
1537
1537
  getModelWorldBox() {
@@ -1544,18 +1544,18 @@ var Dn = class extends U {
1544
1544
  }
1545
1545
  getBoxCorners(e) {
1546
1546
  return [
1547
- new q(e.min.x, e.min.y, e.min.z),
1548
- new q(e.min.x, e.min.y, e.max.z),
1549
- new q(e.min.x, e.max.y, e.min.z),
1550
- new q(e.min.x, e.max.y, e.max.z),
1551
- new q(e.max.x, e.min.y, e.min.z),
1552
- new q(e.max.x, e.min.y, e.max.z),
1553
- new q(e.max.x, e.max.y, e.min.z),
1554
- new q(e.max.x, e.max.y, e.max.z)
1547
+ new K(e.min.x, e.min.y, e.min.z),
1548
+ new K(e.min.x, e.min.y, e.max.z),
1549
+ new K(e.min.x, e.max.y, e.min.z),
1550
+ new K(e.min.x, e.max.y, e.max.z),
1551
+ new K(e.max.x, e.min.y, e.min.z),
1552
+ new K(e.max.x, e.min.y, e.max.z),
1553
+ new K(e.max.x, e.max.y, e.min.z),
1554
+ new K(e.max.x, e.max.y, e.max.z)
1555
1555
  ];
1556
1556
  }
1557
- }, On = 250;
1558
- function kn(e, t) {
1557
+ }, kn = 250;
1558
+ function An(e, t) {
1559
1559
  if (Array.isArray(e)) {
1560
1560
  e.forEach((e) => {
1561
1561
  e.clippingPlanes = t, e.needsUpdate = !0;
@@ -1564,13 +1564,13 @@ function kn(e, t) {
1564
1564
  }
1565
1565
  e.clippingPlanes = t, e.needsUpdate = !0;
1566
1566
  }
1567
- function An(e) {
1567
+ function jn(e) {
1568
1568
  let t = [];
1569
1569
  return e?.traverse((e) => {
1570
- e instanceof V && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1570
+ e instanceof H && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1571
1571
  }), t;
1572
1572
  }
1573
- function jn(e) {
1573
+ function Mn(e) {
1574
1574
  let t = e;
1575
1575
  for (; t;) {
1576
1576
  let e = t.userData.modelID;
@@ -1579,14 +1579,14 @@ function jn(e) {
1579
1579
  }
1580
1580
  return 0;
1581
1581
  }
1582
- function Mn(e, t, n) {
1582
+ function Nn(e, t, n) {
1583
1583
  let r = e;
1584
1584
  r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
1585
1585
  }
1586
- function Nn(e, t) {
1586
+ function Pn(e, t) {
1587
1587
  return t.clone().transformDirection(e.matrixWorld).normalize();
1588
1588
  }
1589
- var Pn = class {
1589
+ var Fn = class {
1590
1590
  planes = [];
1591
1591
  caps = [];
1592
1592
  edges = [];
@@ -1648,10 +1648,10 @@ var Pn = class {
1648
1648
  return this.context.controlRef;
1649
1649
  }
1650
1650
  getMeshes() {
1651
- return An(this.context.modelRef.current);
1651
+ return jn(this.context.modelRef.current);
1652
1652
  }
1653
1653
  getObjectModelID(e) {
1654
- return jn(e);
1654
+ return Mn(e);
1655
1655
  }
1656
1656
  getEdgeSegmentsForPlane(e) {
1657
1657
  return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
@@ -1691,7 +1691,7 @@ var Pn = class {
1691
1691
  this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
1692
1692
  e.setVisible(!0), e.update();
1693
1693
  }), this.updateCapsVisualState());
1694
- }, On));
1694
+ }, kn));
1695
1695
  }
1696
1696
  clearCapsDragIdleTimeout() {
1697
1697
  this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
@@ -1719,9 +1719,9 @@ var Pn = class {
1719
1719
  }), e.isEmpty() ? null : e;
1720
1720
  }
1721
1721
  getSelectedWorldBox() {
1722
- let e = this.context.viewerStore.getState().selected, t = new D(), n = new q();
1722
+ let e = this.context.viewerStore.getState().selected, t = new D(), n = new K();
1723
1723
  return this.getMeshes().forEach((r) => {
1724
- let i = e[jn(r)];
1724
+ let i = e[Mn(r)];
1725
1725
  if (!i?.size) return;
1726
1726
  let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
1727
1727
  if (!a || !o) return;
@@ -1739,8 +1739,8 @@ var Pn = class {
1739
1739
  }
1740
1740
  updateMaterials() {
1741
1741
  let e = this.active ? this.planes : [];
1742
- Mn(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
1743
- kn(t.material, e);
1742
+ Nn(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
1743
+ An(t.material, e);
1744
1744
  }), this.context.camera.updateMatrixWorld();
1745
1745
  }
1746
1746
  setActive(e) {
@@ -1759,42 +1759,42 @@ var Pn = class {
1759
1759
  recursive: !1
1760
1760
  });
1761
1761
  if (!n?.face) return null;
1762
- let r = n.point.clone(), i = Nn(n.object, n.face.normal);
1762
+ let r = n.point.clone(), i = Pn(n.object, n.face.normal);
1763
1763
  r.add(i.clone().multiplyScalar(.001));
1764
- let a = new G().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1764
+ let a = new le().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1765
1765
  return this.addPlane(a, r, i), a.clone();
1766
1766
  }
1767
1767
  createClippingRectangle(e = !1) {
1768
1768
  let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
1769
1769
  if (!t) return [];
1770
- let n = En(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new q()), o = [
1770
+ let n = Dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new K()), o = [
1771
1771
  {
1772
- normal: new q(1, 0, 0),
1773
- point: new q(r.x, a.y, a.z)
1772
+ normal: new K(1, 0, 0),
1773
+ point: new K(r.x, a.y, a.z)
1774
1774
  },
1775
1775
  {
1776
- normal: new q(-1, 0, 0),
1777
- point: new q(i.x, a.y, a.z)
1776
+ normal: new K(-1, 0, 0),
1777
+ point: new K(i.x, a.y, a.z)
1778
1778
  },
1779
1779
  {
1780
- normal: new q(0, 1, 0),
1781
- point: new q(a.x, r.y, a.z)
1780
+ normal: new K(0, 1, 0),
1781
+ point: new K(a.x, r.y, a.z)
1782
1782
  },
1783
1783
  {
1784
- normal: new q(0, -1, 0),
1785
- point: new q(a.x, i.y, a.z)
1784
+ normal: new K(0, -1, 0),
1785
+ point: new K(a.x, i.y, a.z)
1786
1786
  },
1787
1787
  {
1788
- normal: new q(0, 0, 1),
1789
- point: new q(a.x, a.y, r.z)
1788
+ normal: new K(0, 0, 1),
1789
+ point: new K(a.x, a.y, r.z)
1790
1790
  },
1791
1791
  {
1792
- normal: new q(0, 0, -1),
1793
- point: new q(a.x, a.y, i.z)
1792
+ normal: new K(0, 0, -1),
1793
+ point: new K(a.x, a.y, i.z)
1794
1794
  }
1795
1795
  ].map(({ normal: e, point: t }) => ({
1796
1796
  normal: e,
1797
- plane: new G().setFromNormalAndCoplanarPoint(e, t),
1797
+ plane: new le().setFromNormalAndCoplanarPoint(e, t),
1798
1798
  point: t
1799
1799
  }));
1800
1800
  return o.forEach(({ normal: e, plane: t, point: n }) => {
@@ -1802,11 +1802,11 @@ var Pn = class {
1802
1802
  }), this.updateHelpers(), o.map(({ plane: e }) => e.clone());
1803
1803
  }
1804
1804
  addPlane(e, t, n) {
1805
- if (this.active || this.setActive(!0), this.planes.push(e), new Dn(this, e, t, n), this.edgesActive) {
1806
- let t = new cn(this, e);
1805
+ if (this.active || this.setActive(!0), this.planes.push(e), new On(this, e, t, n), this.edgesActive) {
1806
+ let t = new ln(this, e);
1807
1807
  t.create(), t.update();
1808
1808
  }
1809
- let r = new $t(this, e);
1809
+ let r = new en(this, e);
1810
1810
  r.setVisible(this.active && this.capsActive && !this.capsDragActive), this.updateHelpers(), this.updateCaps(r), this.updateMaterials();
1811
1811
  }
1812
1812
  deleteAllPlanes() {
@@ -1823,7 +1823,7 @@ var Pn = class {
1823
1823
  this.edgesActive = e;
1824
1824
  let t = !1;
1825
1825
  e && this.edges.length !== this.planes.length && (t = !0, this.edges.forEach((e) => e.dispose()), this.edges = [], this.planes.forEach((e) => {
1826
- let t = new cn(this, e);
1826
+ let t = new ln(this, e);
1827
1827
  t.create(), t.update();
1828
1828
  })), this.edges.forEach((t) => t.setVisible(this.active && e)), this.active && e && (t || this.updateEdges(), this.capsActive && !this.capsDragActive && this.updateCaps());
1829
1829
  }
@@ -1858,8 +1858,8 @@ var Pn = class {
1858
1858
  this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
1859
1859
  }
1860
1860
  };
1861
- function Fn(e, t, n, i = !1) {
1862
- let a = T((e) => e.camera), o = T((e) => e.gl), s = T((e) => e.raycaster), c = T((e) => e.scene), l = r(), u = b(() => new Pn({
1861
+ function In(e, t, n, i = !1) {
1862
+ let a = T((e) => e.camera), o = T((e) => e.gl), s = T((e) => e.raycaster), c = T((e) => e.scene), l = r(), u = b(() => new Fn({
1863
1863
  camera: a,
1864
1864
  cameraUtils: n,
1865
1865
  controlRef: t,
@@ -1939,15 +1939,15 @@ function Fn(e, t, n, i = !1) {
1939
1939
  }
1940
1940
  //#endregion
1941
1941
  //#region src/viewer/Camera/useCameraUtils.ts
1942
- var In = 1e-6;
1943
- function Ln(e, t) {
1942
+ var Ln = 1e-6;
1943
+ function Rn(e, t) {
1944
1944
  let n = t.getBoundingClientRect();
1945
- return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new K((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1945
+ return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new G((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1946
1946
  }
1947
- function Rn(e, t) {
1948
- return t.every((t) => t.distanceToPoint(e) >= -In);
1947
+ function zn(e, t) {
1948
+ return t.every((t) => t.distanceToPoint(e) >= -Ln);
1949
1949
  }
1950
- function zn(e) {
1950
+ function Bn(e) {
1951
1951
  let t = e;
1952
1952
  for (; t;) {
1953
1953
  if (!t.visible) return !1;
@@ -1955,8 +1955,8 @@ function zn(e) {
1955
1955
  }
1956
1956
  return !0;
1957
1957
  }
1958
- function Bn(e) {
1959
- let t = T((e) => e.camera), n = T((e) => e.gl), r = T((e) => e.raycaster), i = x(null), a = x(null), o = x(new K()), s = _((e) => {
1958
+ function Vn(e) {
1959
+ let t = T((e) => e.camera), n = T((e) => e.gl), r = T((e) => e.raycaster), i = x(null), a = x(null), o = x(new G()), s = _((e) => {
1960
1960
  i.current = e;
1961
1961
  }, []), c = _(() => {
1962
1962
  let e = i.current;
@@ -1964,7 +1964,7 @@ function Bn(e) {
1964
1964
  }, []);
1965
1965
  v(() => {
1966
1966
  let e = n.domElement, t = (t) => {
1967
- let n = Ln(t, e);
1967
+ let n = Rn(t, e);
1968
1968
  n && (a.current = n);
1969
1969
  }, r = () => {
1970
1970
  a.current = null;
@@ -1974,7 +1974,7 @@ function Bn(e) {
1974
1974
  };
1975
1975
  }, [n]);
1976
1976
  let l = _((i = !1, { event: s, filter: l, firstHitOnly: u = !1, object: d = e.current, recursive: f = !0, respectClipping: p = !0 } = {}) => {
1977
- let m = s ? Ln(s, n.domElement) : a.current;
1977
+ let m = s ? Rn(s, n.domElement) : a.current;
1978
1978
  if (!m || !d) return i ? null : [];
1979
1979
  let h = p ? c() : [], g = Array.isArray(d) ? d : [d];
1980
1980
  t.updateMatrixWorld(), e.current?.updateMatrixWorld(!0), o.current.copy(m);
@@ -1982,7 +1982,7 @@ function Bn(e) {
1982
1982
  _.firstHitOnly = u;
1983
1983
  let y;
1984
1984
  try {
1985
- r.setFromCamera(o.current, t), y = r.intersectObjects(g, f).filter((e) => zn(e.object) ? h.length ? Rn(e.point, h) : !0 : !1).filter((e) => l ? l(e) : !0);
1985
+ r.setFromCamera(o.current, t), y = r.intersectObjects(g, f).filter((e) => Bn(e.object) ? h.length ? zn(e.point, h) : !0 : !1).filter((e) => l ? l(e) : !0);
1986
1986
  } finally {
1987
1987
  _.firstHitOnly = v;
1988
1988
  }
@@ -2006,32 +2006,32 @@ function Bn(e) {
2006
2006
  }
2007
2007
  //#endregion
2008
2008
  //#region src/viewer/utils/DimentionsUtils/DimentionLine.ts
2009
- var Vn = 12, Hn = 6, Un = 4;
2010
- function Wn() {
2009
+ var Hn = 12, Un = 6, Wn = 4;
2010
+ function Gn() {
2011
2011
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
2012
2012
  }
2013
- function Gn(e, t) {
2014
- return e instanceof ce ? (e.top - e.bottom) / e.zoom : e instanceof W ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
2013
+ function Kn(e, t) {
2014
+ return e instanceof se ? (e.top - e.bottom) / e.zoom : e instanceof ce ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
2015
2015
  }
2016
- function Kn(e) {
2017
- let t = Wn(), n = document.createElement("canvas"), r = n.getContext("2d");
2016
+ function qn(e) {
2017
+ let t = Gn(), n = document.createElement("canvas"), r = n.getContext("2d");
2018
2018
  if (!r) throw Error("Could not create dimension label canvas context");
2019
- let i = `600 ${Vn}px system-ui, "Segoe UI", sans-serif`;
2019
+ let i = `600 ${Hn}px system-ui, "Segoe UI", sans-serif`;
2020
2020
  r.font = i;
2021
- let a = r.measureText(e), o = a.actualBoundingBoxAscent || Vn * .8, s = a.actualBoundingBoxDescent || Vn * .2, c = Math.max(1, Math.ceil(a.width + Hn * 2)), l = Math.max(1, Math.ceil(o + s + Un * 2));
2021
+ let a = r.measureText(e), o = a.actualBoundingBoxAscent || Hn * .8, s = a.actualBoundingBoxDescent || Hn * .2, c = Math.max(1, Math.ceil(a.width + Un * 2)), l = Math.max(1, Math.ceil(o + s + Wn * 2));
2022
2022
  n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
2023
2023
  let u = new j(n);
2024
- return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = z, u.minFilter = z, u.needsUpdate = !0, {
2024
+ return u.colorSpace = de, u.generateMipmaps = !1, u.magFilter = B, u.minFilter = B, u.needsUpdate = !0, {
2025
2025
  height: l,
2026
2026
  texture: u,
2027
2027
  width: c
2028
2028
  };
2029
2029
  }
2030
- var qn = class e {
2030
+ var Jn = class e {
2031
2031
  static scale = 1;
2032
2032
  static scaleFactor = .015;
2033
2033
  static units = "m";
2034
- root = new P();
2034
+ root = new F();
2035
2035
  start;
2036
2036
  endpointMeshes = [];
2037
2037
  boundingMesh = null;
@@ -2050,14 +2050,14 @@ var qn = class e {
2050
2050
  labelTexture = null;
2051
2051
  labelWidth = 1;
2052
2052
  constructor({ boundingMaterial: e, endpointGeometry: t, endpointMaterial: n, endpointScale: r, lineMaterial: i, root: a, start: o, end: s }) {
2053
- this.boundingMaterial = e, this.endpointGeometry = t, this.endpointMaterial = n, this.endpointBaseScale = r.clone(), this.lineMaterial = i, this.ownerRoot = a, this.start = o.clone(), this.end = s.clone(), this.root.renderOrder = 4, this.lineGeometry.setAttribute("position", new re([
2053
+ this.boundingMaterial = e, this.endpointGeometry = t, this.endpointMaterial = n, this.endpointBaseScale = r.clone(), this.lineMaterial = i, this.ownerRoot = a, this.start = o.clone(), this.end = s.clone(), this.root.renderOrder = 4, this.lineGeometry.setAttribute("position", new P([
2054
2054
  this.start.x,
2055
2055
  this.start.y,
2056
2056
  this.start.z,
2057
2057
  this.end.x,
2058
2058
  this.end.y,
2059
2059
  this.end.z
2060
- ], 3)), this.line = new F(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
2060
+ ], 3)), this.line = new I(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
2061
2061
  }
2062
2062
  get length() {
2063
2063
  return this.start.distanceTo(this.end);
@@ -2099,11 +2099,11 @@ var qn = class e {
2099
2099
  this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
2100
2100
  }
2101
2101
  addEndpointMesh(e, t) {
2102
- let n = new V(this.endpointGeometry, this.endpointMaterial);
2102
+ let n = new H(this.endpointGeometry, this.endpointMaterial);
2103
2103
  n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
2104
2104
  }
2105
2105
  createLabelSprite() {
2106
- let e = new me(new he({
2106
+ let e = new he(new ge({
2107
2107
  depthTest: !1,
2108
2108
  depthWrite: !1,
2109
2109
  transparent: !0
@@ -2111,7 +2111,7 @@ var qn = class e {
2111
2111
  return e.renderOrder = 5, e;
2112
2112
  }
2113
2113
  createBoundingBoxMesh() {
2114
- let e = new V(new O(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
2114
+ let e = new H(new O(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
2115
2115
  return e.renderOrder = 3, e;
2116
2116
  }
2117
2117
  getTextContent() {
@@ -2122,7 +2122,7 @@ var qn = class e {
2122
2122
  let e = this.getTextContent();
2123
2123
  if (this.labelText === e) return;
2124
2124
  this.labelText = e, this.labelTexture?.dispose();
2125
- let t = Kn(e);
2125
+ let t = qn(e);
2126
2126
  this.labelHeight = t.height, this.labelTexture = t.texture, this.labelWidth = t.width, this.labelSprite.material.map = t.texture, this.labelSprite.material.needsUpdate = !0;
2127
2127
  }
2128
2128
  updatePositions() {
@@ -2133,37 +2133,37 @@ var qn = class e {
2133
2133
  this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new O(1, 1, Math.max(this.length, .001)));
2134
2134
  }
2135
2135
  rescaleMesh(t, n, r) {
2136
- let i = Gn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
2136
+ let i = Kn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
2137
2137
  t.scale.setScalar(i);
2138
2138
  }
2139
2139
  rescaleBoundingMesh(e, t) {
2140
2140
  if (!this.boundingMesh) return;
2141
- let n = Gn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
2141
+ let n = Kn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
2142
2142
  this.boundingMesh.scale.set(n, n, 1);
2143
2143
  }
2144
2144
  rescaleLabel(e, t) {
2145
- let n = Gn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
2145
+ let n = Kn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
2146
2146
  this.labelSprite.scale.set(i, r, 1);
2147
2147
  }
2148
- }, Jn = "#111827", Yn = 1, Xn = "x";
2149
- function Zn(e) {
2148
+ }, Yn = "#111827", Xn = 1, Zn = "x";
2149
+ function Qn(e) {
2150
2150
  let t = [];
2151
2151
  return e?.traverse((e) => {
2152
- e instanceof V && e.geometry.attributes.position && t.push(e);
2152
+ e instanceof H && e.geometry.attributes.position && t.push(e);
2153
2153
  }), t;
2154
2154
  }
2155
- function Qn(e, t, n) {
2155
+ function $n(e, t, n) {
2156
2156
  let r = e.clone();
2157
2157
  return r[n] = t[n], r;
2158
2158
  }
2159
- function $n(e, t) {
2159
+ function er(e, t) {
2160
2160
  let n = Math.hypot(t.y - e.y, t.z - e.z), r = Math.hypot(t.x - e.x, t.z - e.z), i = Math.hypot(t.x - e.x, t.y - e.y), a = Math.min(n, r, i);
2161
2161
  return a === n ? "x" : a === r ? "y" : "z";
2162
2162
  }
2163
- var er = class e {
2163
+ var tr = class e {
2164
2164
  active = !1;
2165
2165
  axis = null;
2166
- boundingMaterial = new H({
2166
+ boundingMaterial = new U({
2167
2167
  color: 0,
2168
2168
  depthTest: !1,
2169
2169
  depthWrite: !1,
@@ -2174,14 +2174,14 @@ var er = class e {
2174
2174
  currentDimension = null;
2175
2175
  dimensions = [];
2176
2176
  endpointGeometry = e.createEndpointGeometry();
2177
- endpointMaterial = new H({
2178
- color: Jn,
2177
+ endpointMaterial = new U({
2178
+ color: Yn,
2179
2179
  depthTest: !1,
2180
2180
  depthWrite: !1
2181
2181
  });
2182
- endpointScale = new q(1, 1, 1);
2183
- lineMaterial = new R({
2184
- color: Jn,
2182
+ endpointScale = new K(1, 1, 1);
2183
+ lineMaterial = new z({
2184
+ color: Yn,
2185
2185
  dashSize: .2,
2186
2186
  depthTest: !1,
2187
2187
  depthWrite: !1,
@@ -2189,14 +2189,14 @@ var er = class e {
2189
2189
  });
2190
2190
  measureInProcess = !1;
2191
2191
  moveState = "end";
2192
- previewMarker = new V(e.createPreviewGeometry(), new H({
2192
+ previewMarker = new H(e.createPreviewGeometry(), new U({
2193
2193
  color: 0,
2194
2194
  depthTest: !1,
2195
2195
  depthWrite: !1
2196
2196
  }));
2197
- root = new P();
2198
- snapDistance = Yn;
2199
- startPoint = new q();
2197
+ root = new F();
2198
+ snapDistance = Xn;
2199
+ startPoint = new K();
2200
2200
  unit = "m";
2201
2201
  constructor(e) {
2202
2202
  this.context = e, this.root.name = "BimatterDimensions", this.previewMarker.renderOrder = 5, this.previewMarker.visible = !1, this.root.add(this.previewMarker), this.context.scene.add(this.root);
@@ -2229,13 +2229,13 @@ var er = class e {
2229
2229
  });
2230
2230
  }
2231
2231
  setEndpointScaleFactor(e) {
2232
- !Number.isFinite(e) || e <= 0 || (qn.scaleFactor = e);
2232
+ !Number.isFinite(e) || e <= 0 || (Jn.scaleFactor = e);
2233
2233
  }
2234
2234
  setSnapDistance(e) {
2235
2235
  !Number.isFinite(e) || e < 0 || (this.snapDistance = e);
2236
2236
  }
2237
2237
  setUnit(e) {
2238
- this.unit = e, qn.units = e, qn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
2238
+ this.unit = e, Jn.units = e, Jn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
2239
2239
  e.endPoint = e.end;
2240
2240
  }), this.currentDimension && (this.currentDimension.endPoint = this.currentDimension.end);
2241
2241
  }
@@ -2261,7 +2261,7 @@ var er = class e {
2261
2261
  changeAxes() {
2262
2262
  if (!this.measureInProcess || !this.currentDimension) return;
2263
2263
  let e = this.currentDimension.end, t = this.getNextAxis();
2264
- this.axis = t, this.currentDimension.endPoint = Qn(this.startPoint, e, t);
2264
+ this.axis = t, this.currentDimension.endPoint = $n(this.startPoint, e, t);
2265
2265
  }
2266
2266
  updateFrame() {
2267
2267
  if (!this.active) return;
@@ -2305,7 +2305,7 @@ var er = class e {
2305
2305
  this.currentDimension && (this.currentDimension.createBoundingBox(), this.dimensions.push(this.currentDimension), this.currentDimension = null, this.measureInProcess = !1, this.axis = null);
2306
2306
  }
2307
2307
  createDimension(e, t) {
2308
- return new qn({
2308
+ return new Jn({
2309
2309
  boundingMaterial: this.boundingMaterial,
2310
2310
  endpointGeometry: this.endpointGeometry,
2311
2311
  endpointMaterial: this.endpointMaterial,
@@ -2317,7 +2317,7 @@ var er = class e {
2317
2317
  });
2318
2318
  }
2319
2319
  getSnapObjects() {
2320
- let e = Zn(this.context.modelRef.current);
2320
+ let e = Qn(this.context.modelRef.current);
2321
2321
  return this.context.getExtraSnapObjects?.().forEach((t) => {
2322
2322
  t.visible && e.push(t);
2323
2323
  }), e;
@@ -2335,7 +2335,7 @@ var er = class e {
2335
2335
  return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
2336
2336
  }
2337
2337
  getClosestVertex(e) {
2338
- if (!(e.object instanceof V) || !e.face) return e.point.clone();
2338
+ if (!(e.object instanceof H) || !e.face) return e.point.clone();
2339
2339
  let t = e.object.geometry.attributes.position;
2340
2340
  if (!t) return e.point.clone();
2341
2341
  let n = this.context.cameraUtils.getActiveClippingPlanes(), r = [
@@ -2343,29 +2343,29 @@ var er = class e {
2343
2343
  e.face.b,
2344
2344
  e.face.c
2345
2345
  ].map((n) => {
2346
- let r = new q(t.getX(n), t.getY(n), t.getZ(n));
2346
+ let r = new K(t.getX(n), t.getY(n), t.getZ(n));
2347
2347
  return e.object.localToWorld(r);
2348
- }).filter((t) => t.distanceTo(e.point) <= this.snapDistance && Rn(t, n));
2348
+ }).filter((t) => t.distanceTo(e.point) <= this.snapDistance && zn(t, n));
2349
2349
  return r.length ? r.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
2350
2350
  }
2351
2351
  getPreviewEndPoint(e, t) {
2352
2352
  if (!t) return this.axis = null, e.clone();
2353
- let n = this.axis ?? $n(this.startPoint, e);
2354
- return this.axis = n, Qn(this.startPoint, e, n);
2353
+ let n = this.axis ?? er(this.startPoint, e);
2354
+ return this.axis = n, $n(this.startPoint, e, n);
2355
2355
  }
2356
2356
  getNextAxis() {
2357
2357
  switch (this.axis) {
2358
2358
  case "x": return "y";
2359
2359
  case "y": return "z";
2360
2360
  case "z": return "x";
2361
- default: return Xn;
2361
+ default: return Zn;
2362
2362
  }
2363
2363
  }
2364
2364
  getIsMoving() {
2365
2365
  return this.moveState !== "end" && this.moveState !== "start";
2366
2366
  }
2367
2367
  rescalePreviewMarker() {
2368
- let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof W ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
2368
+ let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof ce ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
2369
2369
  this.previewMarker.scale.setScalar(r);
2370
2370
  }
2371
2371
  setSelectionInteractionDisabled(e) {
@@ -2402,11 +2402,11 @@ var er = class e {
2402
2402
  return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
2403
2403
  }
2404
2404
  static createPreviewGeometry() {
2405
- return new pe(.5, 16, 12);
2405
+ return new me(.5, 16, 12);
2406
2406
  }
2407
2407
  };
2408
- function tr(e, t, n, i) {
2409
- let a = T((e) => e.camera), o = T((e) => e.gl), s = T((e) => e.scene), c = T((e) => e.size), l = r(), u = b(() => new er({
2408
+ function nr(e, t, n, i) {
2409
+ let a = T((e) => e.camera), o = T((e) => e.gl), s = T((e) => e.scene), c = T((e) => e.size), l = r(), u = b(() => new tr({
2410
2410
  camera: a,
2411
2411
  cameraUtils: n,
2412
2412
  controlRef: t,
@@ -2473,15 +2473,15 @@ function tr(e, t, n, i) {
2473
2473
  }
2474
2474
  //#endregion
2475
2475
  //#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
2476
- function nr(e) {
2476
+ function rr(e) {
2477
2477
  return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
2478
2478
  }
2479
- function rr() {
2479
+ function ir() {
2480
2480
  let e = d((e) => e.api), t = d((e) => e.defaultHotkeysEnabled);
2481
2481
  v(() => {
2482
2482
  if (!t) return;
2483
2483
  let n = (t) => {
2484
- nr(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
2484
+ rr(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
2485
2485
  };
2486
2486
  return window.addEventListener("keydown", n), () => {
2487
2487
  window.removeEventListener("keydown", n);
@@ -2490,8 +2490,8 @@ function rr() {
2490
2490
  }
2491
2491
  //#endregion
2492
2492
  //#region src/viewer/Selector/SelectionBox.ts
2493
- var ir = new q(), ar = new q(), Z = new K(), or = new q(), sr = new q(), cr = new q(), lr = new q(), ur = new q(), dr = new q(), fr = new q();
2494
- function pr(e) {
2493
+ var ar = new K(), or = new K(), X = new G(), sr = new K(), cr = new K(), lr = new K(), ur = new K(), dr = new K(), fr = new K(), pr = new K();
2494
+ function mr(e) {
2495
2495
  let t = e;
2496
2496
  for (; t;) {
2497
2497
  let e = t.modelID ?? t.userData.modelID;
@@ -2500,7 +2500,7 @@ function pr(e) {
2500
2500
  }
2501
2501
  return 0;
2502
2502
  }
2503
- function mr(e) {
2503
+ function hr(e) {
2504
2504
  let t = e;
2505
2505
  for (; t;) {
2506
2506
  if (!t.visible) return !1;
@@ -2508,16 +2508,16 @@ function mr(e) {
2508
2508
  }
2509
2509
  return !0;
2510
2510
  }
2511
- function hr(e, t, n) {
2512
- return n.length ? (or.copy(t).applyMatrix4(e.matrixWorld), Rn(or, n)) : !0;
2511
+ function gr(e, t, n) {
2512
+ return n.length ? (sr.copy(t).applyMatrix4(e.matrixWorld), zn(sr, n)) : !0;
2513
2513
  }
2514
- function gr(e, t, n, r, i) {
2515
- return i.length ? (sr.copy(t).applyMatrix4(e.matrixWorld), cr.copy(n).applyMatrix4(e.matrixWorld), lr.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2516
- let t = e.distanceToPoint(sr), n = e.distanceToPoint(cr), r = e.distanceToPoint(lr);
2514
+ function _r(e, t, n, r, i) {
2515
+ return i.length ? (cr.copy(t).applyMatrix4(e.matrixWorld), lr.copy(n).applyMatrix4(e.matrixWorld), ur.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2516
+ let t = e.distanceToPoint(cr), n = e.distanceToPoint(lr), r = e.distanceToPoint(ur);
2517
2517
  return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
2518
2518
  })) : !0;
2519
2519
  }
2520
- function _r(e) {
2520
+ function vr(e) {
2521
2521
  let t = e.getBoundingClientRect();
2522
2522
  return {
2523
2523
  height: t.height,
@@ -2526,7 +2526,7 @@ function _r(e) {
2526
2526
  width: t.width
2527
2527
  };
2528
2528
  }
2529
- function vr(e) {
2529
+ function yr(e) {
2530
2530
  return {
2531
2531
  boundsCheckMs: 0,
2532
2532
  candidateIds: 0,
@@ -2552,7 +2552,7 @@ function vr(e) {
2552
2552
  triangleProjectionMs: 0
2553
2553
  };
2554
2554
  }
2555
- function yr(e, t) {
2555
+ function br(e, t) {
2556
2556
  return {
2557
2557
  minX: Math.min(e.x, t.x),
2558
2558
  minY: Math.min(e.y, t.y),
@@ -2560,43 +2560,43 @@ function yr(e, t) {
2560
2560
  maxY: Math.max(e.y, t.y)
2561
2561
  };
2562
2562
  }
2563
- function br(e, t) {
2563
+ function xr(e, t) {
2564
2564
  return t.x >= e.x ? "contains" : "intersects";
2565
2565
  }
2566
- function xr(e, t) {
2567
- return Sr(e.x, e.y, t);
2566
+ function Sr(e, t) {
2567
+ return Cr(e.x, e.y, t);
2568
2568
  }
2569
- function Sr(e, t, n) {
2569
+ function Cr(e, t, n) {
2570
2570
  return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
2571
2571
  }
2572
- function Cr(e, t, n, r, i, a) {
2572
+ function wr(e, t, n, r, i, a) {
2573
2573
  return (a - t) * (n - e) > (r - t) * (i - e);
2574
2574
  }
2575
- function wr(e, t, n, r, i, a, o, s) {
2576
- return Cr(e, t, i, a, o, s) !== Cr(n, r, i, a, o, s) && Cr(e, t, n, r, i, a) !== Cr(e, t, n, r, o, s);
2575
+ function Tr(e, t, n, r, i, a, o, s) {
2576
+ return wr(e, t, i, a, o, s) !== wr(n, r, i, a, o, s) && wr(e, t, n, r, i, a) !== wr(e, t, n, r, o, s);
2577
2577
  }
2578
- function Tr(e, t, n, r, i) {
2578
+ function Er(e, t, n, r, i) {
2579
2579
  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;
2580
2580
  return s >= 0 && c >= 0 && s + c <= 2 * a * o;
2581
2581
  }
2582
- function Er(e, t, n, r) {
2583
- return xr(e, r) || xr(t, r) || xr(n, r) || Tr(r.minX, r.minY, e, t, n) || Tr(r.maxX, r.minY, e, t, n) || Tr(r.maxX, r.maxY, e, t, n) || Tr(r.minX, r.maxY, e, t, n) ? !0 : Dr(e, t, r) || Dr(t, n, r) || Dr(n, e, r);
2582
+ function Dr(e, t, n, r) {
2583
+ return Sr(e, r) || Sr(t, r) || Sr(n, r) || Er(r.minX, r.minY, e, t, n) || Er(r.maxX, r.minY, e, t, n) || Er(r.maxX, r.maxY, e, t, n) || Er(r.minX, r.maxY, e, t, n) ? !0 : Or(e, t, r) || Or(t, n, r) || Or(n, e, r);
2584
2584
  }
2585
- function Dr(e, t, n) {
2586
- return wr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || wr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || wr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || wr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2585
+ function Or(e, t, n) {
2586
+ return Tr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || Tr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || Tr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || Tr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2587
2587
  }
2588
- function Or(e, t, n, r, i = new K()) {
2589
- let a = ir.copy(t).applyMatrix4(e.matrixWorld).project(n);
2588
+ function kr(e, t, n, r, i = new G()) {
2589
+ let a = ar.copy(t).applyMatrix4(e.matrixWorld).project(n);
2590
2590
  return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
2591
2591
  }
2592
- function kr(e, t, n, r, i) {
2592
+ function Ar(e, t, n, r, i) {
2593
2593
  let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
2594
- for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) ar.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Or(e, ar, r, i, Z), a = Math.min(a, Z.x), o = Math.max(o, Z.x), s = Math.min(s, Z.y), c = Math.max(c, Z.y), xr(Z, n) && (l += 1);
2595
- return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? be : l === 8 ? _e : ve;
2594
+ for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) or.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), kr(e, or, r, i, X), a = Math.min(a, X.x), o = Math.max(o, X.x), s = Math.min(s, X.y), c = Math.max(c, X.y), Sr(X, n) && (l += 1);
2595
+ return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
2596
2596
  }
2597
- function Ar(e, t, n, r) {
2597
+ function jr(e, t, n, r) {
2598
2598
  let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
2599
- for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) ar.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Or(e, ar, n, r, Z), i = Math.min(i, Z.x), a = Math.max(a, Z.x), o = Math.min(o, Z.y), s = Math.max(s, Z.y);
2599
+ for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) or.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), kr(e, or, n, r, X), i = Math.min(i, X.x), a = Math.max(a, X.x), o = Math.min(o, X.y), s = Math.max(s, X.y);
2600
2600
  return {
2601
2601
  minX: i,
2602
2602
  minY: o,
@@ -2604,41 +2604,41 @@ function Ar(e, t, n, r) {
2604
2604
  maxY: s
2605
2605
  };
2606
2606
  }
2607
- function jr(e, t) {
2607
+ function Mr(e, t) {
2608
2608
  return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
2609
2609
  }
2610
- function Mr(e, t, n, r) {
2610
+ function Nr(e, t, n, r) {
2611
2611
  e.geometry.boundingBox || e.geometry.computeBoundingBox();
2612
2612
  let i = e.geometry.boundingBox;
2613
- return i ? jr(Ar(e, i, n, r), t) : !0;
2613
+ return i ? Mr(jr(e, i, n, r), t) : !0;
2614
2614
  }
2615
- function Nr(e, t, n) {
2615
+ function Pr(e, t, n) {
2616
2616
  let r = e.get(t);
2617
2617
  r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
2618
2618
  }
2619
- function Pr(e) {
2619
+ function Fr(e) {
2620
2620
  let t = 0;
2621
2621
  return e.forEach((e) => {
2622
2622
  t += e.size;
2623
2623
  }), t;
2624
2624
  }
2625
- function Fr(e, t, n, r = []) {
2625
+ function Ir(e, t, n, r = []) {
2626
2626
  let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
2627
2627
  if (!a || !o || !s) return;
2628
2628
  let c = t * 3;
2629
- r.length && (ur.fromBufferAttribute(s, a.getX(c)), dr.fromBufferAttribute(s, a.getX(c + 1)), fr.fromBufferAttribute(s, a.getX(c + 2)), !gr(e, ur, dr, fr, r)) || Nr(n, pr(e), o.getX(a.getX(c)));
2629
+ r.length && (dr.fromBufferAttribute(s, a.getX(c)), fr.fromBufferAttribute(s, a.getX(c + 1)), pr.fromBufferAttribute(s, a.getX(c + 2)), !_r(e, dr, fr, pr, r)) || Pr(n, mr(e), o.getX(a.getX(c)));
2630
2630
  }
2631
- function Ir({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2632
- let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new q();
2631
+ function Lr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2632
+ let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new K();
2633
2633
  e.traverse((e) => {
2634
2634
  let s = e;
2635
- if (!s.isMesh || !mr(s)) return;
2635
+ if (!s.isMesh || !hr(s)) return;
2636
2636
  let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
2637
2637
  if (!(!u || !d)) {
2638
2638
  o && (o.containedVerticesVisited += u.count);
2639
2639
  for (let e = 0; e < u.count; e++) {
2640
- let f = pr(s), p = u.getX(e);
2641
- if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !hr(s, l, a))) continue;
2640
+ let f = mr(s), p = u.getX(e);
2641
+ if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !gr(s, l, a))) continue;
2642
2642
  o && (o.containedCandidateVertices += 1);
2643
2643
  let m = `${f}:${p}`, h = c.get(m);
2644
2644
  h || (h = {
@@ -2646,23 +2646,23 @@ function Ir({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
2646
2646
  inside: 0,
2647
2647
  modelID: f,
2648
2648
  total: 0
2649
- }, c.set(m, h)), h.total += 1, xr(Or(s, l, t, n), r) && (h.inside += 1);
2649
+ }, c.set(m, h)), h.total += 1, Sr(kr(s, l, t, n), r) && (h.inside += 1);
2650
2650
  }
2651
2651
  }
2652
2652
  });
2653
2653
  let u = /* @__PURE__ */ new Map();
2654
2654
  return c.forEach((e) => {
2655
- e.total > 0 && e.total === e.inside && Nr(u, e.modelID, e.id);
2655
+ e.total > 0 && e.total === e.inside && Pr(u, e.modelID, e.id);
2656
2656
  }), o && (o.containedIdsMs += performance.now() - s), u;
2657
2657
  }
2658
- function Lr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2658
+ function Rr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2659
2659
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2660
2660
  if (!e) return c;
2661
- let u = _r(r), d = performance.now();
2661
+ let u = vr(r), d = performance.now();
2662
2662
  e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
2663
2663
  let r = e;
2664
2664
  if (!r.isMesh) return;
2665
- if (o && (o.meshCount += 1), !mr(r)) {
2665
+ if (o && (o.meshCount += 1), !hr(r)) {
2666
2666
  o && (o.skippedMeshCount += 1);
2667
2667
  return;
2668
2668
  }
@@ -2671,7 +2671,7 @@ function Lr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2671
2671
  o && (o.skippedMeshCount += 1);
2672
2672
  return;
2673
2673
  }
2674
- let d = performance.now(), f = Mr(r, i, t, u);
2674
+ let d = performance.now(), f = Nr(r, i, t, u);
2675
2675
  if (o && (o.boundsCheckMs += performance.now() - d), !f) {
2676
2676
  o && (o.skippedMeshCount += 1);
2677
2677
  return;
@@ -2679,26 +2679,26 @@ function Lr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2679
2679
  let p = performance.now();
2680
2680
  s.shapecast({
2681
2681
  intersectsBounds: (e) => {
2682
- let n = performance.now(), a = kr(r, e, i, t, u);
2682
+ let n = performance.now(), a = Ar(r, e, i, t, u);
2683
2683
  return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
2684
2684
  },
2685
2685
  intersectsRange: (e, t, i) => {
2686
2686
  let u = performance.now();
2687
2687
  if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
2688
- for (let i = e; i < e + t; i++) Fr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2688
+ for (let i = e; i < e + t; i++) Ir(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2689
2689
  return o && (o.intersectsRangeMs += performance.now() - u), !1;
2690
2690
  },
2691
2691
  intersectsTriangle: (e, s, d) => {
2692
2692
  let f = performance.now();
2693
2693
  if (o && (o.intersectsTriangleCalls += 1), !d) {
2694
- let n = performance.now(), a = Or(r, e.a, t, u), s = Or(r, e.b, t, u), c = Or(r, e.c, t, u);
2695
- if (o && (o.triangleProjectionMs += performance.now() - n), !Er(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2694
+ let n = performance.now(), a = kr(r, e.a, t, u), s = kr(r, e.b, t, u), c = kr(r, e.c, t, u);
2695
+ if (o && (o.triangleProjectionMs += performance.now() - n), !Dr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2696
2696
  }
2697
- return a === "contains" ? Fr(r, s, l, n) : Fr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2697
+ return a === "contains" ? Ir(r, s, l, n) : Ir(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2698
2698
  }
2699
2699
  }), o && (o.shapecastMs += performance.now() - p);
2700
2700
  });
2701
- let f = a === "contains" ? Ir({
2701
+ let f = a === "contains" ? Lr({
2702
2702
  model: e,
2703
2703
  camera: t,
2704
2704
  clippingPlanes: n,
@@ -2707,19 +2707,19 @@ function Lr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2707
2707
  candidateIdsByModel: l,
2708
2708
  profile: o
2709
2709
  }) : c;
2710
- return o && (o.candidateIds = Pr(l), o.selectedIds = Pr(f), o.totalMs = performance.now() - s), f;
2710
+ return o && (o.candidateIds = Fr(l), o.selectedIds = Fr(f), o.totalMs = performance.now() - s), f;
2711
2711
  }
2712
- function Rr(e) {
2713
- let t = vr(e.mode);
2712
+ function zr(e) {
2713
+ let t = yr(e.mode);
2714
2714
  return {
2715
- ids: Lr({
2715
+ ids: Rr({
2716
2716
  ...e,
2717
2717
  profile: t
2718
2718
  }),
2719
2719
  profile: t
2720
2720
  };
2721
2721
  }
2722
- function zr(e) {
2722
+ function Br(e) {
2723
2723
  return e === "contains" ? {
2724
2724
  border: "rgb(37, 99, 235)",
2725
2725
  background: "rgba(37, 99, 235, 0.16)"
@@ -2728,32 +2728,32 @@ function zr(e) {
2728
2728
  background: "rgba(22, 163, 74, 0.16)"
2729
2729
  };
2730
2730
  }
2731
- function Br(e, t, n) {
2732
- let r = zr(br(t, n));
2731
+ function Vr(e, t, n) {
2732
+ let r = Br(xr(t, n));
2733
2733
  if (!e.current) {
2734
2734
  let t = document.createElement("div");
2735
2735
  t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
2736
2736
  }
2737
- let i = yr(t, n);
2737
+ let i = br(t, n);
2738
2738
  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`;
2739
2739
  }
2740
- function Vr(e) {
2740
+ function Hr(e) {
2741
2741
  e.current?.remove(), e.current = null;
2742
2742
  }
2743
2743
  //#endregion
2744
2744
  //#region src/viewer/Selector/useSelector.tsx
2745
- var Hr = 40;
2746
- function Ur(e) {
2745
+ var Ur = 40;
2746
+ function Wr(e) {
2747
2747
  if (!Array.isArray(e)) return e.userData.shader;
2748
2748
  }
2749
- function Wr(e, t) {
2750
- let n = Ur(e)?.uniforms.preSelectionId;
2749
+ function Gr(e, t) {
2750
+ let n = Wr(e)?.uniforms.preSelectionId;
2751
2751
  n && (n.value = t);
2752
2752
  }
2753
- function Gr(e) {
2753
+ function Kr(e) {
2754
2754
  return Number(e.current?.modelID ?? 0);
2755
2755
  }
2756
- function Kr(e) {
2756
+ function qr(e) {
2757
2757
  let t = e;
2758
2758
  for (; t;) {
2759
2759
  let e = t.modelID ?? t.userData.modelID;
@@ -2762,7 +2762,7 @@ function Kr(e) {
2762
2762
  }
2763
2763
  return 0;
2764
2764
  }
2765
- function qr(e) {
2765
+ function Jr(e) {
2766
2766
  let t = e;
2767
2767
  for (; t;) {
2768
2768
  if (!t.visible) return !1;
@@ -2770,7 +2770,7 @@ function qr(e) {
2770
2770
  }
2771
2771
  return !0;
2772
2772
  }
2773
- function Jr(e) {
2773
+ function Yr(e) {
2774
2774
  if (!e) return "";
2775
2775
  let t = [e.uuid, String(e.children.length)];
2776
2776
  return e.children.forEach((e) => {
@@ -2779,23 +2779,23 @@ function Jr(e) {
2779
2779
  });
2780
2780
  }), t.join(":");
2781
2781
  }
2782
- function Yr(e) {
2783
- if (!qr(e.object) || !(e.object instanceof V) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2782
+ function Xr(e) {
2783
+ if (!Jr(e.object) || !(e.object instanceof H) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2784
2784
  let t = e.object.geometry;
2785
2785
  return !!(t.index && t.attributes.ids);
2786
2786
  }
2787
- function Xr(e) {
2788
- if (!Yr(e)) return null;
2787
+ function Zr(e) {
2788
+ if (!Xr(e)) return null;
2789
2789
  let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
2790
2790
  if (r >= i.count) return null;
2791
2791
  let a = n.attributes.modelID;
2792
2792
  return {
2793
2793
  elementID: i.getX(r),
2794
2794
  hit: e,
2795
- modelID: a ? a.getX(r) : Kr(t)
2795
+ modelID: a ? a.getX(r) : qr(t)
2796
2796
  };
2797
2797
  }
2798
- function Zr(e, t, n, i, a, o) {
2798
+ function Qr(e, t, n, i, a, o) {
2799
2799
  let s = x("end"), c = d((e) => e.selected), l = d((e) => e.setSelected), u = d((e) => e.addSelected), f = d((e) => e.removeSelected), p = d((e) => e.showStats), m = r(), h = x(null), g = x(null), _ = x(!1), y = x(!1), b = x("add"), S = x(null), C = x(!1), w = x(0), E = x(null), ee = x(null), D = x(null), O = x({
2800
2800
  meshesByModel: /* @__PURE__ */ new Map(),
2801
2801
  root: null,
@@ -2808,12 +2808,12 @@ function Zr(e, t, n, i, a, o) {
2808
2808
  let n = t.current;
2809
2809
  n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
2810
2810
  }, j = (t) => {
2811
- let n = e.current, r = Jr(n), i = O.current;
2811
+ let n = e.current, r = Yr(n), i = O.current;
2812
2812
  if (i.root !== n || i.version !== r) {
2813
2813
  let e = /* @__PURE__ */ new Map();
2814
2814
  return n?.traverse((t) => {
2815
- if (!(t instanceof V) || !t.geometry.index || !t.geometry.attributes.ids) return;
2816
- let n = Kr(t), r = e.get(n) ?? [];
2815
+ if (!(t instanceof H) || !t.geometry.index || !t.geometry.attributes.ids) return;
2816
+ let n = qr(t), r = e.get(n) ?? [];
2817
2817
  r.push(t), e.set(n, r);
2818
2818
  }), O.current = {
2819
2819
  meshesByModel: e,
@@ -2824,7 +2824,7 @@ function Zr(e, t, n, i, a, o) {
2824
2824
  return i.meshesByModel.get(t) ?? [];
2825
2825
  }, M = (e) => {
2826
2826
  e && j(e.modelID).forEach((e) => {
2827
- e.preselected = !1, Wr(e.material, -1);
2827
+ e.preselected = !1, Gr(e.material, -1);
2828
2828
  });
2829
2829
  }, N = () => {
2830
2830
  o?.(null), M(D.current), D.current = null;
@@ -2834,14 +2834,14 @@ function Zr(e, t, n, i, a, o) {
2834
2834
  elementID: t,
2835
2835
  modelID: e
2836
2836
  }), j(e).forEach((e) => {
2837
- e.preselected = !0, Wr(e.material, t);
2837
+ e.preselected = !0, Gr(e.material, t);
2838
2838
  }), D.current = {
2839
2839
  elementID: t,
2840
2840
  modelID: e
2841
2841
  });
2842
2842
  }, ne = () => {
2843
- h.current = null, _.current = !1, Vr(g), t.current && (t.current.enabled = !0);
2844
- }, re = (e) => {
2843
+ h.current = null, _.current = !1, Hr(g), t.current && (t.current.enabled = !0);
2844
+ }, P = (e) => {
2845
2845
  if (k()) {
2846
2846
  N();
2847
2847
  return;
@@ -2854,45 +2854,45 @@ function Zr(e, t, n, i, a, o) {
2854
2854
  N();
2855
2855
  return;
2856
2856
  }
2857
- let t = W(e);
2857
+ let t = ce(e);
2858
2858
  if (!t) {
2859
2859
  N();
2860
2860
  return;
2861
2861
  }
2862
2862
  te(t.modelID, t.elementID);
2863
2863
  };
2864
- function P() {
2864
+ function F() {
2865
2865
  return performance.now();
2866
2866
  }
2867
- let F = (e) => {
2867
+ let I = (e) => {
2868
2868
  if (k()) {
2869
2869
  ee.current = null, E.current !== null && (window.clearTimeout(E.current), E.current = null), N();
2870
2870
  return;
2871
2871
  }
2872
2872
  if (ee.current = e, E.current !== null) return;
2873
- let t = P() - w.current, n = Math.max(0, Hr - t);
2873
+ let t = F() - w.current, n = Math.max(0, Ur - t);
2874
2874
  E.current = window.setTimeout(() => {
2875
2875
  E.current = null;
2876
2876
  let e = ee.current;
2877
- ee.current = null, e && (w.current = performance.now(), re(e));
2877
+ ee.current = null, e && (w.current = performance.now(), P(e));
2878
2878
  }, n);
2879
- }, I = x(null);
2879
+ }, L = x(null);
2880
2880
  v(() => {
2881
2881
  let e = S.current;
2882
2882
  if (e) {
2883
- p && I.current !== null && console.log(`selection ${e.action}:`, Date.now() - I.current, "ms"), S.current = null, I.current = null;
2883
+ p && L.current !== null && console.log(`selection ${e.action}:`, Date.now() - L.current, "ms"), S.current = null, L.current = null;
2884
2884
  return;
2885
2885
  }
2886
- p && I.current !== null && (console.log("selection spend:", Date.now() - I.current, "ms"), I.current = null);
2886
+ p && L.current !== null && (console.log("selection spend:", Date.now() - L.current, "ms"), L.current = null);
2887
2887
  }, [c, p]);
2888
- let { camera: L, gl: R } = T();
2889
- function ie() {
2888
+ let { camera: R, gl: z } = T();
2889
+ function re() {
2890
2890
  return Date.now();
2891
2891
  }
2892
- let z = (e) => {
2893
- let t = R.domElement.getBoundingClientRect();
2892
+ let B = (e) => {
2893
+ let t = z.domElement.getBoundingClientRect();
2894
2894
  return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
2895
- }, ae = (t) => {
2895
+ }, ie = (t) => {
2896
2896
  if (k()) {
2897
2897
  C.current = !1, y.current = !1, N();
2898
2898
  return;
@@ -2902,12 +2902,12 @@ function Zr(e, t, n, i, a, o) {
2902
2902
  y.current = !1;
2903
2903
  return;
2904
2904
  }
2905
- if (!z(t)) return;
2906
- if (I.current = ie(), s.current !== "end" && s.current !== "start" && s.current > 15) {
2905
+ if (!B(t)) return;
2906
+ if (L.current = re(), s.current !== "end" && s.current !== "start" && s.current > 15) {
2907
2907
  s.current = "end";
2908
2908
  return;
2909
2909
  }
2910
- let n = t.shiftKey, r = t.ctrlKey, i = W(t), a, o = Gr(e), d = null;
2910
+ let n = t.shiftKey, r = t.ctrlKey, i = ce(t), a, o = Kr(e), d = null;
2911
2911
  if (i && (o = i.modelID, d = i.hit.point, a = i.elementID), r) {
2912
2912
  a !== void 0 && f(o, [a]);
2913
2913
  return;
@@ -2916,33 +2916,33 @@ function Zr(e, t, n, i, a, o) {
2916
2916
  return;
2917
2917
  }
2918
2918
  l(o, a === void 0 ? [] : [a], !0), d && A(d);
2919
- }, oe = (e) => {
2920
- k() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (h.current = new K(e.clientX, e.clientY), b.current = e.ctrlKey ? "remove" : "add", _.current = !1, t.current && (t.current.enabled = !1));
2921
- }, B = (e) => {
2919
+ }, ae = (e) => {
2920
+ k() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (h.current = new G(e.clientX, e.clientY), b.current = e.ctrlKey ? "remove" : "add", _.current = !1, t.current && (t.current.enabled = !1));
2921
+ }, V = (e) => {
2922
2922
  if (k()) {
2923
2923
  ne();
2924
2924
  return;
2925
2925
  }
2926
2926
  if (!h.current) return;
2927
- let t = new K(e.clientX, e.clientY), n = Math.abs(t.x - h.current.x), r = Math.abs(t.y - h.current.y);
2928
- n < 6 && r < 6 || (_.current ||= !0, e.preventDefault(), Br(g, h.current, t));
2929
- }, H = (r) => {
2927
+ let t = new G(e.clientX, e.clientY), n = Math.abs(t.x - h.current.x), r = Math.abs(t.y - h.current.y);
2928
+ n < 6 && r < 6 || (_.current ||= !0, e.preventDefault(), Vr(g, h.current, t));
2929
+ }, U = (r) => {
2930
2930
  if (k()) {
2931
2931
  ne();
2932
2932
  return;
2933
2933
  }
2934
2934
  if (!h.current) return;
2935
- I.current = ie();
2936
- let i = _.current, a = new K(r.clientX, r.clientY), o = yr(h.current, a), s = br(h.current, a);
2937
- if (h.current = null, _.current = !1, Vr(g), t.current && setTimeout(() => {
2935
+ L.current = re();
2936
+ let i = _.current, a = new G(r.clientX, r.clientY), o = br(h.current, a), s = xr(h.current, a);
2937
+ if (h.current = null, _.current = !1, Hr(g), t.current && setTimeout(() => {
2938
2938
  t.current && (t.current.enabled = !0);
2939
2939
  }, 100), !i) return;
2940
2940
  y.current = !0, r.preventDefault();
2941
- let { ids: c, profile: l } = Rr({
2941
+ let { ids: c, profile: l } = zr({
2942
2942
  model: e.current,
2943
- camera: L,
2943
+ camera: R,
2944
2944
  clippingPlanes: n.getActiveClippingPlanes(),
2945
- domElement: R.domElement,
2945
+ domElement: z.domElement,
2946
2946
  rect: o,
2947
2947
  mode: s
2948
2948
  }), d = Array.from(c.values()).reduce((e, t) => e + t.size, 0), p = {
@@ -2954,27 +2954,27 @@ function Zr(e, t, n, i, a, o) {
2954
2954
  let n = Array.from(e);
2955
2955
  b.current === "remove" ? f(t, n) : u(t, n);
2956
2956
  }));
2957
- }, se = (e, t, r = !1) => {
2957
+ }, oe = (e, t, r = !1) => {
2958
2958
  let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
2959
2959
  return i.length ? n.getIntersection(!1, {
2960
2960
  event: e,
2961
- filter: Yr,
2961
+ filter: Xr,
2962
2962
  firstHitOnly: r,
2963
2963
  object: i,
2964
2964
  recursive: !0
2965
2965
  }) : [];
2966
- }, U = () => a?.().filter((e) => e.visible) ?? [], ce = (e, t) => {
2967
- let n = se(e, t, !0);
2966
+ }, W = () => a?.().filter((e) => e.visible) ?? [], se = (e, t) => {
2967
+ let n = oe(e, t, !0);
2968
2968
  for (let e of n) {
2969
- let t = Xr(e);
2969
+ let t = Zr(e);
2970
2970
  if (t) return t;
2971
2971
  }
2972
2972
  return null;
2973
- }, W = (t) => ce(t, U()) || ce(t, e.current);
2973
+ }, ce = (t) => se(t, W()) || se(t, e.current);
2974
2974
  v(() => {
2975
2975
  let e = t.current;
2976
2976
  if (!e) return;
2977
- R.domElement.addEventListener("pointerdown", oe), R.domElement.addEventListener("pointermove", B), window.addEventListener("pointerup", H), window.addEventListener("pointerup", ae), R.domElement.addEventListener("contextmenu", a), R.domElement.addEventListener("pointerup", i), R.domElement.addEventListener("pointermove", F), R.domElement.addEventListener("pointerleave", N), R.domElement.addEventListener("pointerdown", r), e.addEventListener("update", n);
2977
+ z.domElement.addEventListener("pointerdown", ae), z.domElement.addEventListener("pointermove", V), window.addEventListener("pointerup", U), window.addEventListener("pointerup", ie), z.domElement.addEventListener("contextmenu", a), z.domElement.addEventListener("pointerup", i), z.domElement.addEventListener("pointermove", I), z.domElement.addEventListener("pointerleave", N), z.domElement.addEventListener("pointerdown", r), e.addEventListener("update", n);
2978
2978
  function n() {
2979
2979
  typeof s.current == "number" ? s.current += 1 : s.current === "start" && (s.current = 1);
2980
2980
  }
@@ -2990,49 +2990,49 @@ function Zr(e, t, n, i, a, o) {
2990
2990
  e.ctrlKey && e.preventDefault();
2991
2991
  }
2992
2992
  return () => {
2993
- Vr(g), E.current !== null && (window.clearTimeout(E.current), E.current = null), ee.current = null, N(), e.removeEventListener("update", n), R.domElement.removeEventListener("pointerdown", oe), R.domElement.removeEventListener("pointermove", B), window.removeEventListener("pointerup", H), window.removeEventListener("pointerup", ae), R.domElement.removeEventListener("contextmenu", a), R.domElement.removeEventListener("pointerup", i), R.domElement.removeEventListener("pointerdown", r), R.domElement.removeEventListener("pointermove", F), R.domElement.removeEventListener("pointerleave", N);
2993
+ Hr(g), E.current !== null && (window.clearTimeout(E.current), E.current = null), ee.current = null, N(), e.removeEventListener("update", n), z.domElement.removeEventListener("pointerdown", ae), z.domElement.removeEventListener("pointermove", V), window.removeEventListener("pointerup", U), window.removeEventListener("pointerup", ie), z.domElement.removeEventListener("contextmenu", a), z.domElement.removeEventListener("pointerup", i), z.domElement.removeEventListener("pointerdown", r), z.domElement.removeEventListener("pointermove", I), z.domElement.removeEventListener("pointerleave", N);
2994
2994
  };
2995
2995
  });
2996
2996
  }
2997
2997
  //#endregion
2998
2998
  //#region src/viewer/Camera/useCameraFit.tsx
2999
- var Qr = new q(1, 1, 1).normalize(), $r = 1.18;
3000
- function ei() {
2999
+ var $r = new K(1, 1, 1).normalize(), ei = 1.18;
3000
+ function ti() {
3001
3001
  let { camera: e } = T();
3002
3002
  return _((t, n, r) => {
3003
- if (!t.current || !(e instanceof W)) return;
3003
+ if (!t.current || !(e instanceof ce)) return;
3004
3004
  let i = new D().setFromObject(t.current);
3005
3005
  if (i.isEmpty()) return;
3006
- let a = i.getCenter(new q()), o = i.getBoundingSphere(new fe()), s = oe.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * $r;
3007
- e.position.copy(a).addScaledVector(Qr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
3006
+ let a = i.getCenter(new K()), o = i.getBoundingSphere(new pe()), s = ae.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * ei;
3007
+ e.position.copy(a).addScaledVector($r, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
3008
3008
  let d = n.current;
3009
- d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(Qr, u * .8), r.current.lookAt(a));
3009
+ d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector($r, u * .8), r.current.lookAt(a));
3010
3010
  }, [e]);
3011
3011
  }
3012
3012
  //#endregion
3013
3013
  //#region src/viewer/store/ViewerStoreProvider.tsx
3014
- function ti({ children: e, store: t }) {
3014
+ function ni({ children: e, store: t }) {
3015
3015
  let [n] = S(() => t ?? o());
3016
- return /* @__PURE__ */ J(i.Provider, {
3016
+ return /* @__PURE__ */ q(i.Provider, {
3017
3017
  value: n,
3018
3018
  children: e
3019
3019
  });
3020
3020
  }
3021
3021
  //#endregion
3022
3022
  //#region src/viewer/utils/ExportUtils/ExportUtils.ts
3023
- var ni = new TextEncoder(), ri = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", ii = "Unknown", ai = ["elementID", "ifcguid"], oi = 0, si = 33;
3024
- function ci(e) {
3023
+ var ri = new TextEncoder(), ii = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", ai = "Unknown", oi = ["elementID", "ifcguid"], si = 0, ci = 33;
3024
+ function li(e) {
3025
3025
  return !!e && typeof e == "object" && !Array.isArray(e);
3026
3026
  }
3027
- function li(e, t) {
3028
- return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : ci(e) && "value" in e ? li(e.value, t) : null;
3029
- }
3030
3027
  function ui(e, t) {
3031
- let n = li(e, t);
3028
+ return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : li(e) && "value" in e ? ui(e.value, t) : null;
3029
+ }
3030
+ function di(e, t) {
3031
+ let n = ui(e, t);
3032
3032
  if (n !== null) return n;
3033
3033
  if (Array.isArray(e)) {
3034
3034
  if (!e.length) return t;
3035
- let n = e.map((e) => li(e, t));
3035
+ let n = e.map((e) => ui(e, t));
3036
3036
  if (n.every((e) => e !== null)) {
3037
3037
  let e = n.join(", ");
3038
3038
  return e.trim() ? e : t;
@@ -3045,21 +3045,21 @@ function ui(e, t) {
3045
3045
  return t;
3046
3046
  }
3047
3047
  }
3048
- function di(e) {
3049
- return typeof e == "string" && e.trim() ? e : null;
3050
- }
3051
3048
  function fi(e) {
3052
- let t = ci(e.props) ? e.props : {};
3053
- return di(e.type ?? e.Type ?? t.type ?? t.Type) ?? ii;
3049
+ return typeof e == "string" && e.trim() ? e : null;
3054
3050
  }
3055
3051
  function pi(e) {
3056
- let t = ci(e.props) ? e.props : {};
3057
- return di(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
3052
+ let t = li(e.props) ? e.props : {};
3053
+ return fi(e.type ?? e.Type ?? t.type ?? t.Type) ?? ai;
3054
+ }
3055
+ function mi(e) {
3056
+ let t = li(e.props) ? e.props : {};
3057
+ return fi(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
3058
3058
  }
3059
- function mi(e, t) {
3060
- return di(e.Name) ?? di(e.name) ?? di(e.DisplayName) ?? di(e.displayName) ?? `Property ${t + 1}`;
3059
+ function hi(e, t) {
3060
+ return fi(e.Name) ?? fi(e.name) ?? fi(e.DisplayName) ?? fi(e.displayName) ?? `Property ${t + 1}`;
3061
3061
  }
3062
- function hi(e) {
3062
+ function gi(e) {
3063
3063
  for (let t of [
3064
3064
  "NominalValue",
3065
3065
  "nominalValue",
@@ -3082,18 +3082,18 @@ function hi(e) {
3082
3082
  "description"
3083
3083
  ].includes(e)));
3084
3084
  }
3085
- function gi(e, t) {
3086
- return di(e.name) ?? di(e.Name) ?? `Set ${t + 1}`;
3085
+ function _i(e, t) {
3086
+ return fi(e.name) ?? fi(e.Name) ?? `Set ${t + 1}`;
3087
3087
  }
3088
- function _i(e) {
3088
+ function vi(e) {
3089
3089
  let t = e.props;
3090
- return Array.isArray(t) ? t.map((e, t) => ci(e) ? {
3091
- label: mi(e, t),
3092
- value: hi(e)
3090
+ return Array.isArray(t) ? t.map((e, t) => li(e) ? {
3091
+ label: hi(e, t),
3092
+ value: gi(e)
3093
3093
  } : {
3094
3094
  label: `Property ${t + 1}`,
3095
3095
  value: e
3096
- }) : ci(t) ? Object.entries(t).map(([e, t]) => ({
3096
+ }) : li(t) ? Object.entries(t).map(([e, t]) => ({
3097
3097
  label: e,
3098
3098
  value: t
3099
3099
  })) : Object.entries(e).filter(([e]) => ![
@@ -3107,14 +3107,14 @@ function _i(e) {
3107
3107
  value: t
3108
3108
  }));
3109
3109
  }
3110
- function vi(e, t) {
3110
+ function yi(e, t) {
3111
3111
  e.columnSet.has(t) || (e.columnSet.add(t), e.columns.push(t));
3112
3112
  }
3113
- function yi(e, t, n, r, i) {
3113
+ function bi(e, t, n, r, i) {
3114
3114
  let a = n.trim();
3115
- a && (vi(e, a), t[a] = ui(r, i));
3115
+ a && (yi(e, a), t[a] = di(r, i));
3116
3116
  }
3117
- function bi(e, t, n) {
3117
+ function xi(e, t, n) {
3118
3118
  let r = {};
3119
3119
  return Object.entries(t).forEach(([t, i]) => {
3120
3120
  [
@@ -3122,33 +3122,33 @@ function bi(e, t, n) {
3122
3122
  "guid",
3123
3123
  "props",
3124
3124
  "sets"
3125
- ].includes(t) || yi(e, r, t, i, n);
3126
- }), ci(t.props) && Object.entries(t.props).forEach(([t, i]) => {
3127
- yi(e, r, t, i, n);
3125
+ ].includes(t) || bi(e, r, t, i, n);
3126
+ }), li(t.props) && Object.entries(t.props).forEach(([t, i]) => {
3127
+ bi(e, r, t, i, n);
3128
3128
  }), Array.isArray(t.sets) && t.sets.forEach((t, i) => {
3129
- let a = gi(t, i);
3130
- _i(t).forEach((t) => {
3131
- yi(e, r, `${a}.${t.label}`, t.value, n);
3129
+ let a = _i(t, i);
3130
+ vi(t).forEach((t) => {
3131
+ bi(e, r, `${a}.${t.label}`, t.value, n);
3132
3132
  });
3133
3133
  }), r;
3134
3134
  }
3135
- function xi(e, t, n) {
3135
+ function Si(e, t, n) {
3136
3136
  Object.entries(t).forEach(([t, r]) => {
3137
3137
  let i = Number(t);
3138
3138
  if (!Number.isFinite(i)) return;
3139
- let a = fi(r), o = e.get(a);
3139
+ let a = pi(r), o = e.get(a);
3140
3140
  o || (o = {
3141
3141
  columns: [],
3142
3142
  columnSet: /* @__PURE__ */ new Set(),
3143
3143
  rows: []
3144
3144
  }, e.set(a, o)), o.rows.push({
3145
3145
  elementID: i,
3146
- ifcguid: pi(r),
3147
- values: bi(o, r, n)
3146
+ ifcguid: mi(r),
3147
+ values: xi(o, r, n)
3148
3148
  });
3149
3149
  });
3150
3150
  }
3151
- function Si(e) {
3151
+ function Ci(e) {
3152
3152
  return e.replace(/[<>&'"]/g, (e) => {
3153
3153
  switch (e) {
3154
3154
  case "<": return "&lt;";
@@ -3160,7 +3160,7 @@ function Si(e) {
3160
3160
  }
3161
3161
  });
3162
3162
  }
3163
- function Ci(e) {
3163
+ function wi(e) {
3164
3164
  let t = e, n = "";
3165
3165
  for (; t > 0;) {
3166
3166
  let e = (t - 1) % 26;
@@ -3168,45 +3168,45 @@ function Ci(e) {
3168
3168
  }
3169
3169
  return n;
3170
3170
  }
3171
- function wi(e, t, n) {
3172
- return `<c r="${`${Ci(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${Si(e)}</t></is></c>`;
3171
+ function Ti(e, t, n) {
3172
+ return `<c r="${`${wi(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${Ci(e)}</t></is></c>`;
3173
3173
  }
3174
- function Ti(e) {
3175
- return `${ri}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
3174
+ function Ei(e) {
3175
+ return `${ii}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
3176
3176
  let n = t + 1;
3177
- return `<row r="${n}">${e.map((e, t) => wi(e, n, t + 1)).join("")}</row>`;
3177
+ return `<row r="${n}">${e.map((e, t) => Ti(e, n, t + 1)).join("")}</row>`;
3178
3178
  }).join("")}</sheetData></worksheet>`;
3179
3179
  }
3180
- function Ei(e) {
3181
- return e.replace(/[\\/?*[\]:]/g, " ").trim() || ii;
3180
+ function Di(e) {
3181
+ return e.replace(/[\\/?*[\]:]/g, " ").trim() || ai;
3182
3182
  }
3183
- function Di(e, t) {
3184
- let n = Ei(e).slice(0, 31), r = n, i = 2;
3183
+ function Oi(e, t) {
3184
+ let n = Di(e).slice(0, 31), r = n, i = 2;
3185
3185
  for (; t.has(r.toLowerCase());) {
3186
3186
  let e = ` (${i})`;
3187
3187
  r = `${n.slice(0, 31 - e.length)}${e}`, i += 1;
3188
3188
  }
3189
3189
  return t.add(r.toLowerCase()), r;
3190
3190
  }
3191
- function Oi(e) {
3192
- return `${ri}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
3191
+ function ki(e) {
3192
+ return `${ii}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
3193
3193
  let n = t + 1;
3194
- return `<sheet name="${Si(e)}" sheetId="${n}" r:id="rId${n}"/>`;
3194
+ return `<sheet name="${Ci(e)}" sheetId="${n}" r:id="rId${n}"/>`;
3195
3195
  }).join("")}</sheets></workbook>`;
3196
3196
  }
3197
- function ki(e) {
3198
- return `${ri}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
3197
+ function Ai(e) {
3198
+ return `${ii}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
3199
3199
  let n = t + 1;
3200
3200
  return `<Relationship Id="rId${n}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${n}.xml"/>`;
3201
3201
  }).join("")}</Relationships>`;
3202
3202
  }
3203
- function Ai() {
3204
- return `${ri}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
3203
+ function ji() {
3204
+ return `${ii}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
3205
3205
  }
3206
- function ji(e) {
3207
- return `${ri}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
3206
+ function Mi(e) {
3207
+ return `${ii}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
3208
3208
  }
3209
- function Mi() {
3209
+ function Ni() {
3210
3210
  let e = new Uint32Array(256);
3211
3211
  for (let t = 0; t < 256; t++) {
3212
3212
  let n = t;
@@ -3215,121 +3215,121 @@ function Mi() {
3215
3215
  }
3216
3216
  return e;
3217
3217
  }
3218
- var Ni = Mi();
3219
- function Pi(e) {
3218
+ var Pi = Ni();
3219
+ function Fi(e) {
3220
3220
  let t = 4294967295;
3221
- for (let n of e) t = Ni[(t ^ n) & 255] ^ t >>> 8;
3221
+ for (let n of e) t = Pi[(t ^ n) & 255] ^ t >>> 8;
3222
3222
  return (t ^ 4294967295) >>> 0;
3223
3223
  }
3224
- function Fi(e) {
3224
+ function Ii(e) {
3225
3225
  let t = new Uint8Array(30 + e.nameBytes.length), n = new DataView(t.buffer);
3226
- return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, oi, !0), n.setUint16(12, si, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
3226
+ return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, si, !0), n.setUint16(12, ci, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
3227
3227
  }
3228
- function Ii(e) {
3228
+ function Li(e) {
3229
3229
  let t = new Uint8Array(46 + e.nameBytes.length), n = new DataView(t.buffer);
3230
- return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, oi, !0), n.setUint16(14, si, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
3230
+ return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, si, !0), n.setUint16(14, ci, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
3231
3231
  }
3232
- function Li(e, t, n) {
3232
+ function Ri(e, t, n) {
3233
3233
  let r = new Uint8Array(22), i = new DataView(r.buffer);
3234
3234
  return i.setUint32(0, 101010256, !0), i.setUint16(4, 0, !0), i.setUint16(6, 0, !0), i.setUint16(8, e, !0), i.setUint16(10, e, !0), i.setUint32(12, t, !0), i.setUint32(16, n, !0), i.setUint16(20, 0, !0), r;
3235
3235
  }
3236
- function Ri(e, t) {
3236
+ function zi(e, t) {
3237
3237
  let n = new Uint8Array(t), r = 0;
3238
3238
  return e.forEach((e) => {
3239
3239
  n.set(e, r), r += e.length;
3240
3240
  }), n;
3241
3241
  }
3242
- function zi(e) {
3242
+ function Bi(e) {
3243
3243
  let t = 0, n = e.map((e) => {
3244
3244
  let n = {
3245
3245
  ...e,
3246
- crc: Pi(e.data),
3247
- nameBytes: ni.encode(e.path),
3246
+ crc: Fi(e.data),
3247
+ nameBytes: ri.encode(e.path),
3248
3248
  offset: t
3249
3249
  };
3250
3250
  return t += 30 + n.nameBytes.length + n.data.length, n;
3251
3251
  }), r = [];
3252
3252
  n.forEach((e) => {
3253
- r.push(Fi(e), e.data);
3253
+ r.push(Ii(e), e.data);
3254
3254
  });
3255
3255
  let i = t, a = 0;
3256
3256
  return n.forEach((e) => {
3257
- let t = Ii(e);
3257
+ let t = Li(e);
3258
3258
  a += t.length, r.push(t);
3259
- }), r.push(Li(n.length, a, i)), Ri(r, r.reduce((e, t) => e + t.length, 0));
3259
+ }), r.push(Ri(n.length, a, i)), zi(r, r.reduce((e, t) => e + t.length, 0));
3260
3260
  }
3261
- function Bi(e, t) {
3261
+ function Vi(e, t) {
3262
3262
  let n = /* @__PURE__ */ new Map();
3263
- e && xi(n, e.props, t);
3263
+ e && Si(n, e.props, t);
3264
3264
  let r = /* @__PURE__ */ new Set(), i = Array.from(n.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
3265
- let i = [...ai, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
3265
+ let i = [...oi, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
3266
3266
  String(e.elementID),
3267
3267
  e.ifcguid || t,
3268
3268
  ...n.columns.map((n) => e.values[n] ?? t)
3269
3269
  ]);
3270
3270
  return {
3271
- name: Di(e, r),
3271
+ name: Oi(e, r),
3272
3272
  rows: [i, ...a]
3273
3273
  };
3274
3274
  });
3275
3275
  return i.length || i.push({
3276
- name: Di(ii, r),
3277
- rows: [ai]
3276
+ name: Oi(ai, r),
3277
+ rows: [oi]
3278
3278
  }), i;
3279
3279
  }
3280
- function Vi(e, t = {}) {
3281
- let n = Bi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
3280
+ function Hi(e, t = {}) {
3281
+ let n = Vi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
3282
3282
  {
3283
3283
  path: "[Content_Types].xml",
3284
- data: ni.encode(ji(r))
3284
+ data: ri.encode(Mi(r))
3285
3285
  },
3286
3286
  {
3287
3287
  path: "_rels/.rels",
3288
- data: ni.encode(Ai())
3288
+ data: ri.encode(ji())
3289
3289
  },
3290
3290
  {
3291
3291
  path: "xl/workbook.xml",
3292
- data: ni.encode(Oi(r))
3292
+ data: ri.encode(ki(r))
3293
3293
  },
3294
3294
  {
3295
3295
  path: "xl/_rels/workbook.xml.rels",
3296
- data: ni.encode(ki(r))
3296
+ data: ri.encode(Ai(r))
3297
3297
  },
3298
3298
  ...n.map((e, t) => ({
3299
3299
  path: `xl/worksheets/sheet${t + 1}.xml`,
3300
- data: ni.encode(Ti(e.rows))
3300
+ data: ri.encode(Ei(e.rows))
3301
3301
  }))
3302
3302
  ];
3303
- return new Blob([zi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
3303
+ return new Blob([Bi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
3304
3304
  }
3305
- function Hi(e) {
3305
+ function Ui(e) {
3306
3306
  return e.split(/[?#]/)[0].split(/[\\/]/).pop()?.replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "").trim() || "model";
3307
3307
  }
3308
- function Ui(e, t) {
3309
- let n = t.fileName?.trim() || `${Hi(t.modelName ?? e?.name ?? "model")}_properties`;
3308
+ function Wi(e, t) {
3309
+ let n = t.fileName?.trim() || `${Ui(t.modelName ?? e?.name ?? "model")}_properties`;
3310
3310
  return n.toLowerCase().endsWith(".xlsx") ? n : `${n}.xlsx`;
3311
3311
  }
3312
- function Wi(e, t = {}) {
3312
+ function Gi(e, t = {}) {
3313
3313
  return {
3314
- blob: Vi(e, t),
3315
- name: Ui(e, t)
3314
+ blob: Hi(e, t),
3315
+ name: Wi(e, t)
3316
3316
  };
3317
3317
  }
3318
3318
  //#endregion
3319
3319
  //#region src/viewer/api/ViewerPropertiesApi.ts
3320
- function Gi(e) {
3320
+ function Ki(e) {
3321
3321
  return !!e && typeof e == "object" && !Array.isArray(e);
3322
3322
  }
3323
- function Ki(e, t) {
3323
+ function qi(e, t) {
3324
3324
  return Object.prototype.hasOwnProperty.call(e, t);
3325
3325
  }
3326
- function qi(e) {
3327
- return Gi(e);
3328
- }
3329
3326
  function Ji(e) {
3330
- return Array.isArray(e) ? e.filter(qi) : Gi(e) ? Object.values(e).filter(qi) : [];
3327
+ return Ki(e);
3331
3328
  }
3332
3329
  function Yi(e) {
3330
+ return Array.isArray(e) ? e.filter(Ji) : Ki(e) ? Object.values(e).filter(Ji) : [];
3331
+ }
3332
+ function Xi(e) {
3333
3333
  if (typeof e == "number" && Number.isFinite(e)) return e;
3334
3334
  if (typeof e == "string") {
3335
3335
  let t = Number(e);
@@ -3337,10 +3337,10 @@ function Yi(e) {
3337
3337
  }
3338
3338
  return null;
3339
3339
  }
3340
- function Xi(e) {
3341
- return Yi(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
3342
- }
3343
3340
  function Zi(e) {
3341
+ return Xi(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
3342
+ }
3343
+ function Qi(e) {
3344
3344
  let t = [
3345
3345
  e.children,
3346
3346
  e.items,
@@ -3348,40 +3348,40 @@ function Zi(e) {
3348
3348
  e.childs
3349
3349
  ];
3350
3350
  for (let e of t) {
3351
- let t = Ji(e);
3351
+ let t = Yi(e);
3352
3352
  if (t.length) return t;
3353
3353
  }
3354
3354
  return [];
3355
3355
  }
3356
- function Qi(e) {
3357
- let t = Gi(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
3356
+ function $i(e) {
3357
+ let t = Ki(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
3358
3358
  return typeof n == "string" ? n : "";
3359
3359
  }
3360
- function $i(e) {
3360
+ function ea(e) {
3361
3361
  return e.replace(/[^a-z0-9]/gi, "").toUpperCase();
3362
3362
  }
3363
- function ea(e) {
3364
- return $i(Qi(e)) === "IFCBUILDINGSTOREY";
3363
+ function ta(e) {
3364
+ return ea($i(e)) === "IFCBUILDINGSTOREY";
3365
3365
  }
3366
- var ta = new Set([
3366
+ var na = new Set([
3367
3367
  "children",
3368
3368
  "childs",
3369
3369
  "elements",
3370
3370
  "items"
3371
3371
  ]);
3372
- function na(e) {
3372
+ function ra(e) {
3373
3373
  let t = {};
3374
3374
  return Object.entries(e).forEach(([e, n]) => {
3375
- ta.has(e) || (t[e] = n);
3375
+ na.has(e) || (t[e] = n);
3376
3376
  }), t;
3377
3377
  }
3378
- function ra(e, t) {
3378
+ function ia(e, t) {
3379
3379
  return Array.isArray(t) ? {
3380
- children: Ji(t),
3380
+ children: Yi(t),
3381
3381
  name: `Model ${e}`,
3382
3382
  type: "Model"
3383
- } : Gi(t) ? Xi(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
3384
- children: Ji(t),
3383
+ } : Ki(t) ? Zi(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
3384
+ children: Yi(t),
3385
3385
  name: `Model ${e}`,
3386
3386
  type: "Model"
3387
3387
  } : {
@@ -3390,46 +3390,46 @@ function ra(e, t) {
3390
3390
  type: "Model"
3391
3391
  };
3392
3392
  }
3393
- function ia(e) {
3393
+ function aa(e) {
3394
3394
  let t = [];
3395
- return Zi(e).forEach((e) => {
3396
- let n = Xi(e);
3397
- n !== null && t.push(n), t.push(...ia(e));
3395
+ return Qi(e).forEach((e) => {
3396
+ let n = Zi(e);
3397
+ n !== null && t.push(n), t.push(...aa(e));
3398
3398
  }), t;
3399
3399
  }
3400
- function aa(e, t, n, r) {
3401
- let i = Xi(t), a = i === null ? void 0 : n[e]?.[i], o = {
3402
- ...na(t),
3400
+ function oa(e, t, n, r) {
3401
+ let i = Zi(t), a = i === null ? void 0 : n[e]?.[i], o = {
3402
+ ...ra(t),
3403
3403
  ...a ?? {},
3404
3404
  modelID: e
3405
3405
  };
3406
- return r && (o.elements = ia(t)), o;
3406
+ return r && (o.elements = aa(t)), o;
3407
3407
  }
3408
- function oa(e, t, n, r, i) {
3409
- ea(t) && n.push(aa(e, t, r, i)), Zi(t).forEach((t) => oa(e, t, n, r, i));
3408
+ function sa(e, t, n, r, i) {
3409
+ ta(t) && n.push(oa(e, t, r, i)), Qi(t).forEach((t) => sa(e, t, n, r, i));
3410
3410
  }
3411
- function sa(e, t, n = !1) {
3411
+ function ca(e, t, n = !1) {
3412
3412
  let r = {};
3413
3413
  return Object.entries(e).forEach(([e, i]) => {
3414
3414
  let a = Number(e), o = [];
3415
- oa(a, ra(a, i), o, t, n), r[a] = o;
3415
+ sa(a, ia(a, i), o, t, n), r[a] = o;
3416
3416
  }), r;
3417
3417
  }
3418
- function ca(e, t, n, r = !1) {
3418
+ function la(e, t, n, r = !1) {
3419
3419
  let i = [], a = e[n];
3420
3420
  if (!a) throw Error(`Model with modelID ${n} not found`);
3421
- return oa(Number(n), ra(Number(n), a), i, t, r), i;
3421
+ return sa(Number(n), ia(Number(n), a), i, t, r), i;
3422
3422
  }
3423
- function la(e, t, n) {
3423
+ function ua(e, t, n) {
3424
3424
  return e[t]?.[n];
3425
3425
  }
3426
- function ua(e) {
3427
- return typeof e == "string" ? e : Gi(e) && typeof e.value == "string" ? e.value : "";
3426
+ function da(e) {
3427
+ return typeof e == "string" ? e : Ki(e) && typeof e.value == "string" ? e.value : "";
3428
3428
  }
3429
- function da(e, t) {
3430
- return ua(e.Name) || ua(e.name) || ua(e.DisplayName) || ua(e.displayName) || `Property ${t + 1}`;
3429
+ function fa(e, t) {
3430
+ return da(e.Name) || da(e.name) || da(e.DisplayName) || da(e.displayName) || `Property ${t + 1}`;
3431
3431
  }
3432
- function fa(e) {
3432
+ function pa(e) {
3433
3433
  for (let t of [
3434
3434
  "NominalValue",
3435
3435
  "nominalValue",
@@ -3452,44 +3452,44 @@ function fa(e) {
3452
3452
  "description"
3453
3453
  ].includes(e)));
3454
3454
  }
3455
- function pa(e) {
3456
- return ua(e.name) || ua(e.Name);
3457
- }
3458
- function ma(e, t) {
3459
- return Ki(e, t) ? e[t] : void 0;
3455
+ function ma(e) {
3456
+ return da(e.name) || da(e.Name);
3460
3457
  }
3461
3458
  function ha(e, t) {
3459
+ return qi(e, t) ? e[t] : void 0;
3460
+ }
3461
+ function ga(e, t) {
3462
3462
  let n = e.props;
3463
- if (Gi(n)) {
3464
- let e = ma(n, t);
3463
+ if (Ki(n)) {
3464
+ let e = ha(n, t);
3465
3465
  if (e !== void 0) return e;
3466
3466
  }
3467
3467
  if (Array.isArray(n)) for (let e = 0; e < n.length; e += 1) {
3468
3468
  let r = n[e];
3469
- if (!Gi(r)) continue;
3469
+ if (!Ki(r)) continue;
3470
3470
  let i = r;
3471
- if (da(i, e) === t) return fa(i);
3471
+ if (fa(i, e) === t) return pa(i);
3472
3472
  }
3473
- return ma(e, t);
3473
+ return ha(e, t);
3474
3474
  }
3475
- function ga(e, t, n) {
3475
+ function _a(e, t, n) {
3476
3476
  if (!e) return;
3477
3477
  if (n !== void 0) {
3478
- let r = e.sets?.find((e) => pa(e) === n);
3479
- return r ? ha(r, t) : void 0;
3478
+ let r = e.sets?.find((e) => ma(e) === n);
3479
+ return r ? ga(r, t) : void 0;
3480
3480
  }
3481
- if (Gi(e.props)) {
3482
- let n = ma(e.props, t);
3481
+ if (Ki(e.props)) {
3482
+ let n = ha(e.props, t);
3483
3483
  if (n !== void 0) return n;
3484
3484
  }
3485
- let r = ma(e, t);
3485
+ let r = ha(e, t);
3486
3486
  if (r !== void 0) return r;
3487
3487
  for (let n of e.sets ?? []) {
3488
- let e = ha(n, t);
3488
+ let e = ga(n, t);
3489
3489
  if (e !== void 0) return e;
3490
3490
  }
3491
3491
  }
3492
- function _a(e, t, n, r) {
3492
+ function va(e, t, n, r) {
3493
3493
  let i = t[e];
3494
3494
  return i ? {
3495
3495
  data: {},
@@ -3498,44 +3498,44 @@ function _a(e, t, n, r) {
3498
3498
  structure: n[e] ?? {}
3499
3499
  } : null;
3500
3500
  }
3501
- function va(e) {
3501
+ function ya(e) {
3502
3502
  return {
3503
3503
  exportAllExcel: (t) => {
3504
3504
  let n = e.getState();
3505
3505
  return Object.keys(n.modelProps).flatMap((e) => {
3506
- let r = _a(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3507
- return r ? [Wi(r, t)] : [];
3506
+ let r = va(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3507
+ return r ? [Gi(r, t)] : [];
3508
3508
  });
3509
3509
  },
3510
3510
  exportExcel: (t, n) => {
3511
- let r = e.getState(), i = _a(t, r.modelProps, r.modelStructure, r.modelNames);
3512
- return i ? Wi(i, n) : null;
3511
+ let r = e.getState(), i = va(t, r.modelProps, r.modelStructure, r.modelNames);
3512
+ return i ? Gi(i, n) : null;
3513
3513
  },
3514
3514
  getAllLevels: (t = !1) => {
3515
3515
  let n = e.getState();
3516
- return sa(n.modelStructure, n.modelProps, t);
3516
+ return ca(n.modelStructure, n.modelProps, t);
3517
3517
  },
3518
3518
  getAllModelLevels: (t, n = !1) => {
3519
3519
  let r = e.getState();
3520
- return ca(r.modelStructure, r.modelProps, t, n);
3520
+ return la(r.modelStructure, r.modelProps, t, n);
3521
3521
  },
3522
3522
  getModelProps: () => e.getState().modelProps,
3523
3523
  getModelStructure: () => e.getState().modelStructure,
3524
- getParamsByElement: (t, n) => la(e.getState().modelProps, t, n),
3525
- getParamValueByName: ga,
3526
- getParamValueByElement: (t, n, r, i) => ga(la(e.getState().modelProps, t, n), r, i)
3524
+ getParamsByElement: (t, n) => ua(e.getState().modelProps, t, n),
3525
+ getParamValueByName: _a,
3526
+ getParamValueByElement: (t, n, r, i) => _a(ua(e.getState().modelProps, t, n), r, i)
3527
3527
  };
3528
3528
  }
3529
3529
  //#endregion
3530
3530
  //#region src/viewer/Loaders/BmtConverter.ts
3531
- var ya = "BMT", ba = 1, xa = {
3531
+ var ba = "BMT", xa = 1, Sa = {
3532
3532
  PROP: 1,
3533
3533
  MESH: 2,
3534
3534
  STRUCTURE: 3,
3535
3535
  GRIDS: 4,
3536
3536
  MATRIX: 5,
3537
3537
  MESHSPACE: 6
3538
- }, Sa = "application/json", Ca = "application/octet-stream", wa = class {
3538
+ }, Ca = "application/json", wa = "application/octet-stream", Ta = class {
3539
3539
  chunks = [];
3540
3540
  length = 0;
3541
3541
  writeUint8(e) {
@@ -3555,7 +3555,7 @@ var ya = "BMT", ba = 1, xa = {
3555
3555
  e.set(n, t), t += n.byteLength;
3556
3556
  }), e;
3557
3557
  }
3558
- }, Ta = class {
3558
+ }, Ea = class {
3559
3559
  textEncoder = new TextEncoder();
3560
3560
  ifcLoader = null;
3561
3561
  async ConvertIfcFileToBmt(e, t = {}) {
@@ -3657,7 +3657,7 @@ var ya = "BMT", ba = 1, xa = {
3657
3657
  progress: this.clampProgress(e.progress) * a
3658
3658
  });
3659
3659
  }), s = [{
3660
- blob: new Blob([o], { type: Ca }),
3660
+ blob: new Blob([o], { type: wa }),
3661
3661
  bytes: o,
3662
3662
  name: i,
3663
3663
  type: "bmt"
@@ -3677,7 +3677,7 @@ var ya = "BMT", ba = 1, xa = {
3677
3677
  phase: "metadata",
3678
3678
  progress: .95
3679
3679
  }), s.push({
3680
- blob: new Blob([n], { type: Sa }),
3680
+ blob: new Blob([n], { type: Ca }),
3681
3681
  bytes: n,
3682
3682
  name: `${t}_props.json`,
3683
3683
  type: "json"
@@ -3690,7 +3690,7 @@ var ya = "BMT", ba = 1, xa = {
3690
3690
  return s;
3691
3691
  }
3692
3692
  createBmtBytes(e, t, n) {
3693
- let r = new wa(), i = e.grids !== void 0, a = t, o = !!e.coordinationMatrix && !this.hasMeshMatrices(e), s = t ? .45 : 0, c = i ? .05 : 0, l = a ? .12 : 0, u = o ? .03 : 0, d = Math.max(.1, 1 - s - c - l - u), f = 0, p = (e) => {
3693
+ let r = new Ta(), i = e.grids !== void 0, a = t, o = !!e.coordinationMatrix && !this.hasMeshMatrices(e), s = t ? .45 : 0, c = i ? .05 : 0, l = a ? .12 : 0, u = o ? .03 : 0, d = Math.max(.1, 1 - s - c - l - u), f = 0, p = (e) => {
3694
3694
  n?.({
3695
3695
  ...e,
3696
3696
  progress: this.clampProgress(e.progress)
@@ -3707,19 +3707,19 @@ var ya = "BMT", ba = 1, xa = {
3707
3707
  progress: f
3708
3708
  });
3709
3709
  };
3710
- return r.writeBytes(this.textEncoder.encode(ya)), r.writeUint8(ba), t && (this.writeProps(r, e.props, (e) => m(s, e)), h(s, "properties", "Properties written")), e.grids !== void 0 && (p({
3710
+ return r.writeBytes(this.textEncoder.encode(ba)), r.writeUint8(xa), t && (this.writeProps(r, e.props, (e) => m(s, e)), h(s, "properties", "Properties written")), e.grids !== void 0 && (p({
3711
3711
  message: "Writing grids",
3712
3712
  phase: "metadata",
3713
3713
  progress: f
3714
- }), this.writeJsonChunk(r, xa.GRIDS, e.grids), h(c, "metadata", "Grids written")), this.writeMeshes(r, e, (e) => m(d, e)), h(d, "geometry", "Geometry written"), t && (p({
3714
+ }), this.writeJsonChunk(r, Sa.GRIDS, e.grids), h(c, "metadata", "Grids written")), this.writeMeshes(r, e, (e) => m(d, e)), h(d, "geometry", "Geometry written"), t && (p({
3715
3715
  message: "Writing structure",
3716
3716
  phase: "metadata",
3717
3717
  progress: f
3718
- }), this.writeJsonChunk(r, xa.STRUCTURE, e.structure), h(l, "metadata", "Structure written")), o && e.coordinationMatrix && (p({
3718
+ }), this.writeJsonChunk(r, Sa.STRUCTURE, e.structure), h(l, "metadata", "Structure written")), o && e.coordinationMatrix && (p({
3719
3719
  message: "Writing coordination matrix",
3720
3720
  phase: "metadata",
3721
3721
  progress: f
3722
- }), this.writeTextChunk(r, xa.MATRIX, e.coordinationMatrix), h(u, "metadata", "Coordination matrix written")), p({
3722
+ }), this.writeTextChunk(r, Sa.MATRIX, e.coordinationMatrix), h(u, "metadata", "Coordination matrix written")), p({
3723
3723
  message: "BMT bytes ready",
3724
3724
  phase: "writing",
3725
3725
  progress: 1
@@ -3738,7 +3738,7 @@ var ya = "BMT", ba = 1, xa = {
3738
3738
  ...o,
3739
3739
  id: s
3740
3740
  } : o;
3741
- this.writeJsonChunk(e, xa.PROP, c);
3741
+ this.writeJsonChunk(e, Sa.PROP, c);
3742
3742
  let l = a + 1;
3743
3743
  this.shouldEmitItemProgress(l, i) && n?.({
3744
3744
  loaded: l,
@@ -3758,7 +3758,7 @@ var ya = "BMT", ba = 1, xa = {
3758
3758
  progress: a > 0 ? 0 : 1,
3759
3759
  total: a
3760
3760
  }), i.forEach((t, i) => {
3761
- t.matrix && t.matrix !== r && (this.writeTextChunk(e, xa.MATRIX, t.matrix), r = t.matrix), this.writeChunk(e, t.isIfcSpace ? xa.MESHSPACE : xa.MESH, this.createMeshPayload(t));
3761
+ t.matrix && t.matrix !== r && (this.writeTextChunk(e, Sa.MATRIX, t.matrix), r = t.matrix), this.writeChunk(e, t.isIfcSpace ? Sa.MESHSPACE : Sa.MESH, this.createMeshPayload(t));
3762
3762
  let o = i + 1;
3763
3763
  this.shouldEmitItemProgress(o, a) && n?.({
3764
3764
  loaded: o,
@@ -3770,7 +3770,7 @@ var ya = "BMT", ba = 1, xa = {
3770
3770
  });
3771
3771
  }
3772
3772
  createMeshPayload(e) {
3773
- let t = new wa(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3773
+ let t = new Ta(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3774
3774
  return t.writeUint32(n.byteLength), t.writeBytes(n), t.writeUint32(r.byteLength), t.writeBytes(r), t.writeUint32(i.byteLength), t.writeUint32(this.getIndexType(e.ind)), t.writeBytes(i), t.writeUint8(this.colorToByte(e.mat.r)), t.writeUint8(this.colorToByte(e.mat.g)), t.writeUint8(this.colorToByte(e.mat.b)), t.writeUint8(this.colorToByte(e.mat.opacity ?? 1)), t.writeUint32(e.mat.name), t.toUint8Array();
3775
3775
  }
3776
3776
  writeJsonChunk(e, t, n) {
@@ -3923,7 +3923,7 @@ var ya = "BMT", ba = 1, xa = {
3923
3923
  let t = /* @__PURE__ */ new Map();
3924
3924
  return (Array.isArray(e) ? e : [e]).forEach((e) => {
3925
3925
  e.traverse((e) => {
3926
- if (!(e instanceof V) || !this.isIfcSpaceObject(e)) return;
3926
+ if (!(e instanceof H) || !this.isIfcSpaceObject(e)) return;
3927
3927
  let n = this.getObjectModelID(e);
3928
3928
  if (n === null) return;
3929
3929
  let r = e.geometry.getAttribute("ids");
@@ -3937,7 +3937,7 @@ var ya = "BMT", ba = 1, xa = {
3937
3937
  addVisibleIdsFromObject3D(e, t) {
3938
3938
  (Array.isArray(e) ? e : [e]).forEach((e) => {
3939
3939
  e.traverse((e) => {
3940
- if (!(e instanceof V) || !this.isObjectVisible(e)) return;
3940
+ if (!(e instanceof H) || !this.isObjectVisible(e)) return;
3941
3941
  let n = this.getObjectModelID(e);
3942
3942
  if (n === null) return;
3943
3943
  let r = e.geometry.getAttribute("ids");
@@ -3989,7 +3989,7 @@ var ya = "BMT", ba = 1, xa = {
3989
3989
  return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3990
3990
  }
3991
3991
  deflateBytes(e) {
3992
- return Ce.deflate(e);
3992
+ return we.deflate(e);
3993
3993
  }
3994
3994
  encodeText(e) {
3995
3995
  return this.textEncoder.encode(e);
@@ -4006,43 +4006,43 @@ var ya = "BMT", ba = 1, xa = {
4006
4006
  isRecord(e) {
4007
4007
  return typeof e == "object" && !!e;
4008
4008
  }
4009
- }, Ea = new Ta();
4010
- async function Da(e, t) {
4011
- return Ea.ConvertIfcFileToBmt(e, t);
4009
+ }, Da = new Ea();
4010
+ async function Oa(e, t) {
4011
+ return Da.ConvertIfcFileToBmt(e, t);
4012
4012
  }
4013
- function Oa(e, t) {
4014
- return Ea.ConvertToBmt(e, t);
4013
+ function ka(e, t) {
4014
+ return Da.ConvertToBmt(e, t);
4015
4015
  }
4016
4016
  //#endregion
4017
4017
  //#region src/viewer/Selector/FilteredElementsCollector.ts
4018
- function ka(e) {
4018
+ function Aa(e) {
4019
4019
  return !!e && typeof e == "object" && !Array.isArray(e);
4020
4020
  }
4021
- function Aa(e) {
4021
+ function ja(e) {
4022
4022
  let t = Number(e);
4023
4023
  return Number.isFinite(t) ? t : null;
4024
4024
  }
4025
- function ja(e) {
4026
- return ka(e) && ka(e.data) && ka(e.props) && "structure" in e;
4027
- }
4028
4025
  function Ma(e) {
4029
- return ka(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
4026
+ return Aa(e) && Aa(e.data) && Aa(e.props) && "structure" in e;
4030
4027
  }
4031
4028
  function Na(e) {
4032
- if (!ka(e)) return !1;
4033
- let t = Object.entries(e);
4034
- return t.length ? t.every(([e, t]) => Aa(e) !== null && Ma(t)) : !0;
4029
+ return Aa(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
4035
4030
  }
4036
4031
  function Pa(e) {
4037
- return typeof e == "string" ? e : null;
4032
+ if (!Aa(e)) return !1;
4033
+ let t = Object.entries(e);
4034
+ return t.length ? t.every(([e, t]) => ja(e) !== null && Na(t)) : !0;
4038
4035
  }
4039
4036
  function Fa(e) {
4040
- let t = ka(e.props.props) ? e.props.props : {};
4041
- return Pa(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
4037
+ return typeof e == "string" ? e : null;
4038
+ }
4039
+ function Ia(e) {
4040
+ let t = Aa(e.props.props) ? e.props.props : {};
4041
+ return Fa(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
4042
4042
  }
4043
- function Ia(e, t, n) {
4043
+ function La(e, t, n) {
4044
4044
  Object.entries(n).forEach(([n, r]) => {
4045
- let i = Aa(n);
4045
+ let i = ja(n);
4046
4046
  i !== null && e.push({
4047
4047
  elementID: i,
4048
4048
  modelID: t,
@@ -4050,29 +4050,29 @@ function Ia(e, t, n) {
4050
4050
  });
4051
4051
  });
4052
4052
  }
4053
- function La(e) {
4054
- if (!e || !ka(e)) return [];
4055
- if (ja(e)) {
4053
+ function Ra(e) {
4054
+ if (!e || !Aa(e)) return [];
4055
+ if (Ma(e)) {
4056
4056
  let t = [];
4057
- return Ia(t, 0, e.props), t;
4057
+ return La(t, 0, e.props), t;
4058
4058
  }
4059
- if (Na(e)) {
4059
+ if (Pa(e)) {
4060
4060
  let t = [];
4061
- return Ia(t, 0, e), t;
4061
+ return La(t, 0, e), t;
4062
4062
  }
4063
4063
  let t = [];
4064
4064
  return Object.entries(e).forEach(([e, n]) => {
4065
- let r = Aa(e);
4065
+ let r = ja(e);
4066
4066
  if (r !== null) {
4067
- if (ja(n)) {
4068
- Ia(t, r, n.props);
4067
+ if (Ma(n)) {
4068
+ La(t, r, n.props);
4069
4069
  return;
4070
4070
  }
4071
- Na(n) && Ia(t, r, n);
4071
+ Pa(n) && La(t, r, n);
4072
4072
  }
4073
4073
  }), t;
4074
4074
  }
4075
- function Ra(e) {
4075
+ function za(e) {
4076
4076
  let t = {};
4077
4077
  return e.forEach(({ elementID: e, modelID: n, props: r }) => {
4078
4078
  t[n] ??= [], t[n].push({
@@ -4081,26 +4081,26 @@ function Ra(e) {
4081
4081
  });
4082
4082
  }), t;
4083
4083
  }
4084
- function za(e) {
4084
+ function Ba(e) {
4085
4085
  let t = {};
4086
4086
  return e.forEach(({ elementID: e, modelID: n }) => {
4087
4087
  t[n] ??= [], t[n].push(e);
4088
4088
  }), t;
4089
4089
  }
4090
- var Ba = class {
4090
+ var Va = class {
4091
4091
  elements;
4092
4092
  filters = [];
4093
4093
  selectedModelIDs = null;
4094
4094
  constructor(e) {
4095
- this.elements = La(e);
4095
+ this.elements = Ra(e);
4096
4096
  }
4097
4097
  from(e) {
4098
- return this.elements = La(e), this.filters = [], this.selectedModelIDs = null, this;
4098
+ return this.elements = Ra(e), this.filters = [], this.selectedModelIDs = null, this;
4099
4099
  }
4100
4100
  ofType(e) {
4101
4101
  let t = new Set((Array.isArray(e) ? e : [e]).map((e) => e.toLowerCase()));
4102
4102
  return this.filters.push((e) => {
4103
- let n = Fa(e);
4103
+ let n = Ia(e);
4104
4104
  return !!(n && t.has(n.toLowerCase()));
4105
4105
  }), this;
4106
4106
  }
@@ -4129,11 +4129,11 @@ var Ba = class {
4129
4129
  return this.hasSingleSelectedModel() ? e.map(({ elementID: e, props: t }) => ({
4130
4130
  elementID: e,
4131
4131
  props: t
4132
- })) : Ra(e);
4132
+ })) : za(e);
4133
4133
  }
4134
4134
  toElementsIds() {
4135
4135
  let e = this.getFilteredElements();
4136
- return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : za(e);
4136
+ return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : Ba(e);
4137
4137
  }
4138
4138
  toElementIds() {
4139
4139
  return this.toElementsIds();
@@ -4141,20 +4141,20 @@ var Ba = class {
4141
4141
  };
4142
4142
  //#endregion
4143
4143
  //#region src/viewer/api/ViewerApi.ts
4144
- function Va(e) {
4144
+ function Ha(e) {
4145
4145
  let t = {};
4146
4146
  return Object.entries(e).forEach(([e, n]) => {
4147
4147
  t[Number(e)] = Array.from(n);
4148
4148
  }), t;
4149
4149
  }
4150
- function Ha(e) {
4150
+ function Ua(e) {
4151
4151
  let t = {};
4152
4152
  return Object.entries(e).forEach(([e, n]) => {
4153
4153
  t[Number(e)] = new Set(n);
4154
4154
  }), t;
4155
4155
  }
4156
- function Ua(e, t, n) {
4157
- let r = new Ta();
4156
+ function Wa(e, t, n) {
4157
+ let r = new Ea();
4158
4158
  return {
4159
4159
  camera: {
4160
4160
  fitCamera: () => {
@@ -4312,16 +4312,16 @@ function Ua(e, t, n) {
4312
4312
  n()?.reset();
4313
4313
  }
4314
4314
  },
4315
- properties: va(e),
4315
+ properties: ya(e),
4316
4316
  selector: {
4317
4317
  addSelected: (n, r, i = !0, a = !1) => {
4318
4318
  let o = i || a;
4319
- e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(Va(e.getState().selected), a);
4319
+ e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(Ha(e.getState().selected), a);
4320
4320
  },
4321
- collector: () => new Ba(e.getState().modelProps),
4321
+ collector: () => new Va(e.getState().modelProps),
4322
4322
  getPreselectionColor: () => e.getState().preselectionColor,
4323
4323
  getSelectionColor: () => e.getState().selectionColor,
4324
- getSelected: () => Va(e.getState().selected),
4324
+ getSelected: () => Ha(e.getState().selected),
4325
4325
  removeSelected: (t, n) => {
4326
4326
  e.getState().removeSelected(t, n);
4327
4327
  },
@@ -4336,7 +4336,7 @@ function Ua(e, t, n) {
4336
4336
  },
4337
4337
  setSelected: (n, r, i = !1, a = !0, o = !1) => {
4338
4338
  let s = a || o;
4339
- e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(Va(e.getState().selected), o);
4339
+ e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(Ha(e.getState().selected), o);
4340
4340
  }
4341
4341
  },
4342
4342
  utils: {
@@ -4381,7 +4381,7 @@ function Ua(e, t, n) {
4381
4381
  }
4382
4382
  //#endregion
4383
4383
  //#region src/viewer/Loaders/BmtLoader.ts
4384
- var Wa = class {
4384
+ var Ga = class {
4385
4385
  view;
4386
4386
  offset = 0;
4387
4387
  constructor(e) {
@@ -4401,11 +4401,11 @@ var Wa = class {
4401
4401
  eof() {
4402
4402
  return this.offset >= this.view.byteLength;
4403
4403
  }
4404
- }, Ga = class {
4404
+ }, Ka = class {
4405
4405
  decodeBuffer(e) {
4406
- return this.textDecoder.decode(Ce.inflate(e));
4406
+ return this.textDecoder.decode(we.inflate(e));
4407
4407
  }
4408
- decoder = Ce;
4408
+ decoder = we;
4409
4409
  textDecoder = new TextDecoder("utf-8");
4410
4410
  ChunkType = {
4411
4411
  PROP: 1,
@@ -4474,7 +4474,7 @@ var Wa = class {
4474
4474
  return a?.props && (i.props = a.props), a?.grids && (i.grids = a.grids), a?.coordinationMatrix && (i.coordinationMatrix = a.coordinationMatrix), a?.structure !== void 0 && (i.structure = a.structure), i;
4475
4475
  }
4476
4476
  parseBinaryFile(e, t = {}) {
4477
- let n = new Wa(e);
4477
+ let n = new Ga(e);
4478
4478
  if (new TextDecoder().decode(n.readBytes(3)) !== "BMT") throw Error("Invalid file");
4479
4479
  let r = n.readUint8();
4480
4480
  console.log(`model version: ${r}`);
@@ -4542,24 +4542,24 @@ var Wa = class {
4542
4542
  };
4543
4543
  //#endregion
4544
4544
  //#region src/viewer/workers/BMTWorker.ts?worker
4545
- function Ka(e) {
4545
+ function qa(e) {
4546
4546
  return new Worker("" + new URL("assets/BMTWorker-yhSXOg2i.js", import.meta.url).href, { name: e?.name });
4547
4547
  }
4548
4548
  //#endregion
4549
4549
  //#region src/viewer/workers/BMTWorkerClient.ts
4550
- function qa() {
4550
+ function Ja() {
4551
4551
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4552
4552
  }
4553
- function Ja(e) {
4553
+ function Ya(e) {
4554
4554
  return Array.isArray(e) ? e : [e];
4555
4555
  }
4556
- function Ya(e) {
4556
+ function Xa(e) {
4557
4557
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.bmt";
4558
4558
  }
4559
- function Xa(e) {
4559
+ function Za(e) {
4560
4560
  return typeof e == "string" ? {
4561
4561
  kind: "url",
4562
- name: Ya(e),
4562
+ name: Xa(e),
4563
4563
  url: new URL(e, globalThis.location.href).href
4564
4564
  } : e instanceof File ? {
4565
4565
  file: e,
@@ -4570,18 +4570,18 @@ function Xa(e) {
4570
4570
  kind: "buffer"
4571
4571
  };
4572
4572
  }
4573
- function Za(e) {
4573
+ function Qa(e) {
4574
4574
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4575
4575
  }
4576
- function Qa() {
4577
- return new Ka();
4576
+ function $a() {
4577
+ return new qa();
4578
4578
  }
4579
- function $a(e) {
4579
+ function eo(e) {
4580
4580
  return { streamGeometryChunks: e.streamGeometryChunks ?? !!e.onChunk };
4581
4581
  }
4582
- function eo(e, t = {}) {
4583
- let n = t.worker ?? Qa(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Ja(e).map(Xa), o = qa(), s = {}, c = {
4584
- options: $a(t),
4582
+ function to(e, t = {}) {
4583
+ let n = t.worker ?? $a(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Ya(e).map(Za), o = Ja(), s = {}, c = {
4584
+ options: eo(t),
4585
4585
  sources: a,
4586
4586
  taskId: o,
4587
4587
  type: "load-bmt-model"
@@ -4619,39 +4619,39 @@ function eo(e, t = {}) {
4619
4619
  let a = Error(r.error.message);
4620
4620
  r.error.stack && (a.stack = r.error.stack), l(a);
4621
4621
  };
4622
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Za(a));
4622
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Qa(a));
4623
4623
  });
4624
4624
  }
4625
- function to() {
4626
- return Qa();
4625
+ function no() {
4626
+ return $a();
4627
4627
  }
4628
4628
  //#endregion
4629
4629
  //#region src/viewer/workers/BmtConverterWorker.ts?worker
4630
- function no(e) {
4630
+ function ro(e) {
4631
4631
  return new Worker("" + new URL("assets/BmtConverterWorker-BHhPlty_.js", import.meta.url).href, { name: e?.name });
4632
4632
  }
4633
4633
  //#endregion
4634
4634
  //#region src/viewer/workers/BmtConverterWorkerClient.ts
4635
- function ro() {
4635
+ function io() {
4636
4636
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4637
4637
  }
4638
- function io(e) {
4638
+ function ao(e) {
4639
4639
  return Array.isArray(e) ? e : [e];
4640
4640
  }
4641
- function ao(e) {
4641
+ function oo(e) {
4642
4642
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4643
4643
  }
4644
- function oo() {
4644
+ function so() {
4645
4645
  return globalThis.document?.baseURI ?? globalThis.location.href;
4646
4646
  }
4647
- function so(e) {
4647
+ function co(e) {
4648
4648
  let t = e ?? "ifc-parser.wasm";
4649
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, oo()).href;
4649
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, so()).href;
4650
4650
  }
4651
- function co(e) {
4651
+ function lo(e) {
4652
4652
  return typeof e == "string" ? {
4653
4653
  kind: "url",
4654
- name: ao(e),
4654
+ name: oo(e),
4655
4655
  url: new URL(e, globalThis.location.href).href
4656
4656
  } : e instanceof File ? {
4657
4657
  file: e,
@@ -4662,13 +4662,13 @@ function co(e) {
4662
4662
  kind: "buffer"
4663
4663
  };
4664
4664
  }
4665
- function lo(e) {
4665
+ function uo(e) {
4666
4666
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4667
4667
  }
4668
- function uo() {
4669
- return new no();
4668
+ function fo() {
4669
+ return new ro();
4670
4670
  }
4671
- function fo(e) {
4671
+ function po(e) {
4672
4672
  return {
4673
4673
  chunk: e.chunk,
4674
4674
  coordinationMatrix: e.coordinationMatrix,
@@ -4680,23 +4680,23 @@ function fo(e) {
4680
4680
  useIfcSpace: e.useIfcSpace,
4681
4681
  useMinVersion: e.useMinVersion,
4682
4682
  visibleIdsByModel: e.visibleIdsByModel,
4683
- wasmPath: so(e.wasmPath)
4683
+ wasmPath: co(e.wasmPath)
4684
4684
  };
4685
4685
  }
4686
- function po(e) {
4686
+ function mo(e) {
4687
4687
  let t = new Uint8Array(e.bytes.byteLength);
4688
4688
  return t.set(e.bytes), {
4689
4689
  ...e,
4690
4690
  blob: new Blob([t.buffer], { type: e.mimeType })
4691
4691
  };
4692
4692
  }
4693
- function mo(e) {
4693
+ function ho(e) {
4694
4694
  return {
4695
- files: e.result.files.map(po),
4695
+ files: e.result.files.map(mo),
4696
4696
  models: e.result.models
4697
4697
  };
4698
4698
  }
4699
- function ho(e) {
4699
+ function go(e) {
4700
4700
  if (e.error instanceof Error) return e.error;
4701
4701
  let t = [
4702
4702
  e.message || "Unknown worker error",
@@ -4706,12 +4706,12 @@ function ho(e) {
4706
4706
  ].filter(Boolean);
4707
4707
  return /* @__PURE__ */ Error(`BMT converter worker failed: ${t.join(", ")}`);
4708
4708
  }
4709
- function go(e) {
4709
+ function _o(e) {
4710
4710
  return /* @__PURE__ */ Error(`BMT converter worker response could not be cloned: ${String(e.data ?? "unknown message error")}`);
4711
4711
  }
4712
- function _o(e, t = {}) {
4713
- let n = t.worker ?? uo(), r = t.terminateOnComplete ?? !t.worker, i = io(e).map(co), a = ro(), o = {
4714
- options: fo(t),
4712
+ function vo(e, t = {}) {
4713
+ let n = t.worker ?? fo(), r = t.terminateOnComplete ?? !t.worker, i = ao(e).map(lo), a = io(), o = {
4714
+ options: po(t),
4715
4715
  sources: i,
4716
4716
  taskId: a,
4717
4717
  type: "convert-ifc-to-bmt"
@@ -4720,9 +4720,9 @@ function _o(e, t = {}) {
4720
4720
  let c = () => {
4721
4721
  n.removeEventListener("message", d), n.removeEventListener("error", l), n.removeEventListener("messageerror", u), r && n.terminate();
4722
4722
  }, l = (e) => {
4723
- c(), s(ho(e));
4724
- }, u = (e) => {
4725
4723
  c(), s(go(e));
4724
+ }, u = (e) => {
4725
+ c(), s(_o(e));
4726
4726
  }, d = (n) => {
4727
4727
  let r = n.data;
4728
4728
  if (r.taskId !== a) return;
@@ -4731,35 +4731,35 @@ function _o(e, t = {}) {
4731
4731
  return;
4732
4732
  }
4733
4733
  if (c(), r.type === "complete") {
4734
- e(mo(r));
4734
+ e(ho(r));
4735
4735
  return;
4736
4736
  }
4737
4737
  let i = Error(r.error.message);
4738
4738
  r.error.stack && (i.stack = r.error.stack), s(i);
4739
4739
  };
4740
- n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, lo(i));
4740
+ n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, uo(i));
4741
4741
  });
4742
4742
  }
4743
- function vo() {
4744
- return uo();
4743
+ function yo() {
4744
+ return fo();
4745
4745
  }
4746
4746
  //#endregion
4747
4747
  //#region src/viewer/workers/IFCWorker.ts?worker
4748
- function yo(e) {
4748
+ function bo(e) {
4749
4749
  return new Worker("" + new URL("assets/IFCWorker-DipGoUKy.js", import.meta.url).href, { name: e?.name });
4750
4750
  }
4751
4751
  //#endregion
4752
4752
  //#region src/viewer/workers/IFCWorkerClient.ts
4753
- function bo() {
4753
+ function xo() {
4754
4754
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4755
4755
  }
4756
- function xo(e) {
4756
+ function So(e) {
4757
4757
  return Array.isArray(e) ? e : [e];
4758
4758
  }
4759
- function So(e) {
4759
+ function Co(e) {
4760
4760
  return typeof e == "string" ? {
4761
4761
  kind: "url",
4762
- name: Co(e),
4762
+ name: wo(e),
4763
4763
  url: new URL(e, globalThis.location.href).href
4764
4764
  } : e instanceof File ? {
4765
4765
  file: e,
@@ -4770,23 +4770,23 @@ function So(e) {
4770
4770
  kind: "buffer"
4771
4771
  };
4772
4772
  }
4773
- function Co(e) {
4773
+ function wo(e) {
4774
4774
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4775
4775
  }
4776
- function wo() {
4776
+ function To() {
4777
4777
  return globalThis.document?.baseURI ?? globalThis.location.href;
4778
4778
  }
4779
- function To(e) {
4779
+ function Eo(e) {
4780
4780
  let t = e ?? "ifc-parser.wasm";
4781
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, wo()).href;
4781
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, To()).href;
4782
4782
  }
4783
- function Eo(e) {
4783
+ function Do(e) {
4784
4784
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4785
4785
  }
4786
- function Do() {
4787
- return new yo();
4786
+ function Oo() {
4787
+ return new bo();
4788
4788
  }
4789
- function Oo(e) {
4789
+ function ko(e) {
4790
4790
  return {
4791
4791
  chunk: e.chunk,
4792
4792
  coordinationMatrix: e.coordinationMatrix,
@@ -4795,12 +4795,12 @@ function Oo(e) {
4795
4795
  useIfcColors: e.useIfcColors,
4796
4796
  useIfcElementAssembly: e.useIfcElementAssembly,
4797
4797
  useIfcSpace: e.useIfcSpace,
4798
- wasmPath: To(e.wasmPath)
4798
+ wasmPath: Eo(e.wasmPath)
4799
4799
  };
4800
4800
  }
4801
- function ko(e, t = {}) {
4802
- let n = t.worker ?? Do(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = xo(e).map(So), o = bo(), s = {}, c = {
4803
- options: Oo(t),
4801
+ function Ao(e, t = {}) {
4802
+ let n = t.worker ?? Oo(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = So(e).map(Co), o = xo(), s = {}, c = {
4803
+ options: ko(t),
4804
4804
  sources: a,
4805
4805
  taskId: o,
4806
4806
  type: "load-ifc-model"
@@ -4838,34 +4838,34 @@ function ko(e, t = {}) {
4838
4838
  let a = Error(r.error.message);
4839
4839
  r.error.stack && (a.stack = r.error.stack), l(a);
4840
4840
  };
4841
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Eo(a));
4841
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Do(a));
4842
4842
  });
4843
4843
  }
4844
- function Ao() {
4845
- return Do();
4844
+ function jo() {
4845
+ return Oo();
4846
4846
  }
4847
4847
  //#endregion
4848
4848
  //#region src/viewer/api/loader.ts
4849
- function jo(e) {
4850
- return typeof e == "string" ? e : e.name;
4851
- }
4852
4849
  function Mo(e) {
4853
- return (jo(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4850
+ return typeof e == "string" ? e : e.name;
4854
4851
  }
4855
4852
  function No(e) {
4856
- let t = jo(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4857
- return n === -1 ? "" : t.slice(n + 1);
4853
+ return (Mo(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4858
4854
  }
4859
4855
  function Po(e) {
4860
- return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4856
+ let t = Mo(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4857
+ return n === -1 ? "" : t.slice(n + 1);
4861
4858
  }
4862
4859
  function Fo(e) {
4863
- return /_props\.json$/i.test(jo(e).split(/[?#]/)[0]);
4860
+ return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4864
4861
  }
4865
4862
  function Io(e) {
4863
+ return /_props\.json$/i.test(Mo(e).split(/[?#]/)[0]);
4864
+ }
4865
+ function Lo(e) {
4866
4866
  return e.coordinationMatrix ? e.coordinationMatrix : Object.values(e.data)[0]?.matrix || void 0;
4867
4867
  }
4868
- var Lo = new class {
4868
+ var Ro = new class {
4869
4869
  coordinationMatrix;
4870
4870
  useIfcSpace = !0;
4871
4871
  bmtLoader = null;
@@ -4876,7 +4876,7 @@ var Lo = new class {
4876
4876
  this.getBmtLoader();
4877
4877
  }
4878
4878
  getBmtLoader() {
4879
- return this.bmtLoader ||= new Ga(), this.bmtLoader;
4879
+ return this.bmtLoader ||= new Ka(), this.bmtLoader;
4880
4880
  }
4881
4881
  async getIfcLoader(e = {}) {
4882
4882
  if (!this.ifcLoader) {
@@ -4904,7 +4904,7 @@ var Lo = new class {
4904
4904
  async loadBmtModel(e, t) {
4905
4905
  let n = this.getBmtLoader();
4906
4906
  if (typeof e == "string") return n.loadModel(e);
4907
- let r = n.parseBinaryFile(await e.arrayBuffer()), i = Po(e), a = i ? t.get(i) : void 0;
4907
+ let r = n.parseBinaryFile(await e.arrayBuffer()), i = Fo(e), a = i ? t.get(i) : void 0;
4908
4908
  return this.applyBmtMetadata(r, a);
4909
4909
  }
4910
4910
  createWorkerProgressHandler(e, t, n, r) {
@@ -4927,7 +4927,7 @@ var Lo = new class {
4927
4927
  };
4928
4928
  }
4929
4929
  async loadIfcModelInWorker(e, t, n, r, i) {
4930
- return (await ko(e, {
4930
+ return (await Ao(e, {
4931
4931
  chunk: t.chunk,
4932
4932
  collectChunks: t.collectWorkerChunks,
4933
4933
  coordinationMatrix: this.coordinationMatrix,
@@ -4940,14 +4940,14 @@ var Lo = new class {
4940
4940
  }))[0];
4941
4941
  }
4942
4942
  async loadBmtModelInWorker(e, t, n, r, i, a) {
4943
- let o = (await eo(e, {
4943
+ let o = (await to(e, {
4944
4944
  collectChunks: n.collectWorkerChunks,
4945
4945
  onChunk: this.createWorkerChunkHandler(n, r),
4946
4946
  onProgress: this.createWorkerProgressHandler(n, r, i, a),
4947
4947
  streamGeometryChunks: n.streamGeometryChunks ?? !!n.onChunk
4948
4948
  }))[0];
4949
4949
  if (e instanceof File) {
4950
- let n = Po(e), r = n ? t.get(n) : void 0;
4950
+ let n = Fo(e), r = n ? t.get(n) : void 0;
4951
4951
  return this.applyBmtMetadata(o, r);
4952
4952
  }
4953
4953
  return o;
@@ -4967,21 +4967,21 @@ var Lo = new class {
4967
4967
  }
4968
4968
  async loadModel(e, t = {}) {
4969
4969
  this.initLoaders();
4970
- let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !Fo(e)).length, o = 0;
4970
+ let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !Io(e)).length, o = 0;
4971
4971
  this.loadedModelCount === 0 && this.resetCoordinationMatrixState();
4972
4972
  for (let e = 0; e < n.length; e++) {
4973
- let s = n[e], c = No(s), l;
4974
- if (c === "json" && Fo(s)) continue;
4973
+ let s = n[e], c = Po(s), l;
4974
+ if (c === "json" && Io(s)) continue;
4975
4975
  let u = this.nextModelID, d = o;
4976
4976
  if (o++, c === "ifc") l = t.useWorker ? await this.loadIfcModelInWorker(s, t, u, d, a) : (await (await this.getIfcLoader(t)).loadModel(s, this.coordinationMatrix))[0];
4977
4977
  else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
4978
- else throw Error(`Unsupported model format: ${jo(s)}`);
4979
- let f = Io(l);
4980
- !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), this.applyRenderSettings(l, t), l.name ??= Mo(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4978
+ else throw Error(`Unsupported model format: ${Mo(s)}`);
4979
+ let f = Lo(l);
4980
+ !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), this.applyRenderSettings(l, t), l.name ??= No(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4981
4981
  }
4982
4982
  return i;
4983
4983
  }
4984
- }(), Ro = .5, zo = .04, Bo = .16, Vo = Bo, Q = Ro * 2 - Bo * 2, Ho = Ro - zo / 2, Uo = Ro - Bo / 2, Wo = Ro - Vo / 2, Go = .63, Ko = "#dfe6ec", qo = 260, Jo = 30, Yo = .3, Xo = 8, Zo = new q(0, 1, 0), Qo = 1e-8, $o = new D(), es = new fe(), ts = [
4984
+ }(), zo = .5, Bo = .04, Z = .16, Vo = Z, Q = zo * 2 - Z * 2, Ho = zo - Bo / 2, Uo = zo - Z / 2, Wo = zo - Vo / 2, Go = .63, Ko = "#dfe6ec", qo = 260, Jo = 30, Yo = .3, Xo = 8, Zo = new K(0, 1, 0), Qo = 1e-8, $o = new D(), es = new pe(), ts = [
4985
4985
  {
4986
4986
  direction: [
4987
4987
  0,
@@ -4997,7 +4997,7 @@ var Lo = new class {
4997
4997
  scale: [
4998
4998
  Q,
4999
4999
  Q,
5000
- zo
5000
+ Bo
5001
5001
  ],
5002
5002
  title: "Front",
5003
5003
  type: "face"
@@ -5022,7 +5022,7 @@ var Lo = new class {
5022
5022
  scale: [
5023
5023
  Q,
5024
5024
  Q,
5025
- zo
5025
+ Bo
5026
5026
  ],
5027
5027
  title: "Back",
5028
5028
  type: "face"
@@ -5045,7 +5045,7 @@ var Lo = new class {
5045
5045
  0
5046
5046
  ],
5047
5047
  scale: [
5048
- zo,
5048
+ Bo,
5049
5049
  Q,
5050
5050
  Q
5051
5051
  ],
@@ -5070,7 +5070,7 @@ var Lo = new class {
5070
5070
  0
5071
5071
  ],
5072
5072
  scale: [
5073
- zo,
5073
+ Bo,
5074
5074
  Q,
5075
5075
  Q
5076
5076
  ],
@@ -5096,7 +5096,7 @@ var Lo = new class {
5096
5096
  ],
5097
5097
  scale: [
5098
5098
  Q,
5099
- zo,
5099
+ Bo,
5100
5100
  Q
5101
5101
  ],
5102
5102
  title: "Top",
@@ -5121,7 +5121,7 @@ var Lo = new class {
5121
5121
  ],
5122
5122
  scale: [
5123
5123
  Q,
5124
- zo,
5124
+ Bo,
5125
5125
  Q
5126
5126
  ],
5127
5127
  title: "Bottom",
@@ -5145,8 +5145,8 @@ function ns() {
5145
5145
  ],
5146
5146
  scale: [
5147
5147
  Q,
5148
- Bo,
5149
- Bo
5148
+ Z,
5149
+ Z
5150
5150
  ],
5151
5151
  title: `${n > 0 ? "Top" : "Bottom"} ${t > 0 ? "Front" : "Back"}`,
5152
5152
  type: "edge"
@@ -5166,9 +5166,9 @@ function ns() {
5166
5166
  t * Uo
5167
5167
  ],
5168
5168
  scale: [
5169
- Bo,
5169
+ Z,
5170
5170
  Q,
5171
- Bo
5171
+ Z
5172
5172
  ],
5173
5173
  title: `${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
5174
5174
  type: "edge"
@@ -5188,8 +5188,8 @@ function ns() {
5188
5188
  0
5189
5189
  ],
5190
5190
  scale: [
5191
- Bo,
5192
- Bo,
5191
+ Z,
5192
+ Z,
5193
5193
  Q
5194
5194
  ],
5195
5195
  title: `${t > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"}`,
@@ -5243,18 +5243,18 @@ function ss(e, t) {
5243
5243
  let a = r.measureText(e), o = a.actualBoundingBoxAscent || Jo * .8, s = a.actualBoundingBoxDescent || Jo * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
5244
5244
  n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
5245
5245
  let u = new j(n);
5246
- return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = z, u.minFilter = z, u.anisotropy = Xo, u.needsUpdate = !0, {
5246
+ return u.colorSpace = de, u.generateMipmaps = !1, u.magFilter = B, u.minFilter = B, u.anisotropy = Xo, u.needsUpdate = !0, {
5247
5247
  aspect: c / l,
5248
5248
  texture: u
5249
5249
  };
5250
5250
  }
5251
5251
  function cs({ color: e, label: t, position: n, rotation: r }) {
5252
5252
  let { aspect: i, texture: a } = b(() => ss(t, e), [e, t]);
5253
- return v(() => () => a.dispose(), [a]), /* @__PURE__ */ Y("mesh", {
5253
+ return v(() => () => a.dispose(), [a]), /* @__PURE__ */ J("mesh", {
5254
5254
  position: n,
5255
5255
  renderOrder: 2,
5256
5256
  rotation: r,
5257
- children: [/* @__PURE__ */ J("planeGeometry", { args: [Yo * i, Yo] }), /* @__PURE__ */ J("meshBasicMaterial", {
5257
+ children: [/* @__PURE__ */ q("planeGeometry", { args: [Yo * i, Yo] }), /* @__PURE__ */ q("meshBasicMaterial", {
5258
5258
  alphaTest: .1,
5259
5259
  depthWrite: !1,
5260
5260
  map: a,
@@ -5264,14 +5264,14 @@ function cs({ color: e, label: t, position: n, rotation: r }) {
5264
5264
  });
5265
5265
  }
5266
5266
  function ls(e) {
5267
- return Math.abs(e.y) > .9 ? new q(0, 0, e.y > 0 ? -1 : 1) : new q(0, 1, 0);
5267
+ return Math.abs(e.y) > .9 ? new K(0, 0, e.y > 0 ? -1 : 1) : new K(0, 1, 0);
5268
5268
  }
5269
5269
  function us(e, t) {
5270
5270
  let n = e.current;
5271
5271
  return !n || (n.updateWorldMatrix(!0, !0), $o.setFromObject(n), $o.isEmpty()) ? (es.center.copy(t), es.radius = 10, es) : ($o.getBoundingSphere(es), (!Number.isFinite(es.radius) || es.radius <= 0) && (es.radius = 10), es);
5272
5272
  }
5273
5273
  function ds(e) {
5274
- return e.current?.getTarget(new q()) ?? new q();
5274
+ return e.current?.getTarget(new K()) ?? new K();
5275
5275
  }
5276
5276
  function fs(e, t) {
5277
5277
  if (e.up.distanceToSquared(Zo) <= Qo) return;
@@ -5279,7 +5279,7 @@ function fs(e, t) {
5279
5279
  e.up.copy(Zo), n ? (n.updateCameraUp(), n.normalizeRotations(), n.setLookAt(r.x, r.y, r.z, i.x, i.y, i.z, !1), n.update(0)) : (e.lookAt(i), e.updateMatrixWorld());
5280
5280
  }
5281
5281
  function ps({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
5282
- let a = ds(t), o = us(r, a), s = o.center.clone(), c = new q(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
5282
+ let a = ds(t), o = us(r, a), s = o.center.clone(), c = new K(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
5283
5283
  t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
5284
5284
  endPosition: d,
5285
5285
  endTarget: s,
@@ -5292,7 +5292,7 @@ function ps({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef
5292
5292
  }
5293
5293
  function ms({ action: e, onPick: t }) {
5294
5294
  let [n, r] = S(!1);
5295
- return /* @__PURE__ */ Y("group", {
5295
+ return /* @__PURE__ */ J("group", {
5296
5296
  position: e.position,
5297
5297
  onClick: is,
5298
5298
  onPointerDown: (n) => {
@@ -5304,18 +5304,18 @@ function ms({ action: e, onPick: t }) {
5304
5304
  onPointerLeave: (e) => {
5305
5305
  is(e), r(!1);
5306
5306
  },
5307
- children: [/* @__PURE__ */ Y("mesh", {
5307
+ children: [/* @__PURE__ */ J("mesh", {
5308
5308
  scale: e.scale,
5309
- children: [/* @__PURE__ */ J("boxGeometry", { args: [
5309
+ children: [/* @__PURE__ */ q("boxGeometry", { args: [
5310
5310
  1,
5311
5311
  1,
5312
5312
  1
5313
- ] }), /* @__PURE__ */ J("meshBasicMaterial", {
5313
+ ] }), /* @__PURE__ */ q("meshBasicMaterial", {
5314
5314
  color: as(n),
5315
5315
  opacity: os(n),
5316
5316
  transparent: !0
5317
5317
  })]
5318
- }), e.label && /* @__PURE__ */ J(cs, {
5318
+ }), e.label && /* @__PURE__ */ q(cs, {
5319
5319
  color: n ? "#ffffff" : "#50606f",
5320
5320
  label: e.label,
5321
5321
  position: [
@@ -5352,14 +5352,14 @@ function hs({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
5352
5352
  if (!o) return;
5353
5353
  let s = performance.now() - o.startTime, c = Math.min(s / qo, 1), l = 1 - (1 - c) ** 3, u = n.current;
5354
5354
  if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
5355
- let e = new q().lerpVectors(o.startTarget, o.endTarget, l);
5355
+ let e = new K().lerpVectors(o.startTarget, o.endTarget, l);
5356
5356
  u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
5357
5357
  } else r.lookAt(o.endTarget);
5358
5358
  c >= 1 && (r.up.copy(o.endUp), u?.setLookAt(o.endPosition.x, o.endPosition.y, o.endPosition.z, o.endTarget.x, o.endTarget.y, o.endTarget.z, !1), a.current = null);
5359
- }), e ? /* @__PURE__ */ J("group", {
5359
+ }), e ? /* @__PURE__ */ q("group", {
5360
5360
  ref: i,
5361
5361
  scale: Go,
5362
- children: o.map((e) => /* @__PURE__ */ J(ms, {
5362
+ children: o.map((e) => /* @__PURE__ */ q(ms, {
5363
5363
  action: e,
5364
5364
  onPick: (e) => {
5365
5365
  let i = t.current;
@@ -5420,8 +5420,8 @@ var gs = class {
5420
5420
  }, Cs = {
5421
5421
  antialias: !1,
5422
5422
  powerPreference: "high-performance"
5423
- }, ws = .1, Ts = .02, Es = 150, Ds = .75, Os = .6, ks = 1e3, As = 50, js = 30, Ms = 2, Ns = 1.25, Ps = .08, Fs = 1.2, Is = 2, Ls = new D(), Rs = new fe(), $ = new q(), zs = new q(), Bs = new q();
5424
- function Vs({ alpha: e = !0, performanceMode: t }) {
5423
+ }, ws = .1, Ts = .02, Es = 150, Ds = .75, Os = .6, ks = 1e3, As = 50, js = 30, Ms = 240, Ns = 2, Ps = 1.25, Fs = .08, Is = 1.2, Ls = 2, Rs = new D(), zs = new pe(), $ = new K(), Bs = new K(), Vs = new K();
5424
+ function Hs({ alpha: e = !0, performanceMode: t }) {
5425
5425
  return async ({ canvas: n }) => {
5426
5426
  let { WebGPURenderer: r } = await import("./three.webgpu-vPugBGTK.js").then((e) => e.i), i = new r({
5427
5427
  alpha: e,
@@ -5431,7 +5431,7 @@ function Vs({ alpha: e = !0, performanceMode: t }) {
5431
5431
  return await i.init?.(), i.setClearColor(0, 0), i;
5432
5432
  };
5433
5433
  }
5434
- function Hs(e = !1) {
5434
+ function Us(e = !1) {
5435
5435
  return {
5436
5436
  active: e,
5437
5437
  finalFitDone: !1,
@@ -5439,7 +5439,7 @@ function Hs(e = !1) {
5439
5439
  userInteractedAfterFirstFit: !1
5440
5440
  };
5441
5441
  }
5442
- function Us(e, t) {
5442
+ function Ws(e, t) {
5443
5443
  let n = e?.[t.modelID] ?? {
5444
5444
  data: {},
5445
5445
  name: t.modelName,
@@ -5457,7 +5457,7 @@ function Us(e, t) {
5457
5457
  }
5458
5458
  };
5459
5459
  }
5460
- function Ws(e, t) {
5460
+ function Gs(e, t) {
5461
5461
  let n = { ...e ?? {} };
5462
5462
  return Object.entries(t).forEach(([t, r]) => {
5463
5463
  let i = Number(t);
@@ -5470,41 +5470,41 @@ function Ws(e, t) {
5470
5470
  };
5471
5471
  }), n;
5472
5472
  }
5473
- function Gs(e, t) {
5473
+ function Ks(e, t) {
5474
5474
  return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
5475
5475
  }
5476
- function Ks(e) {
5477
- return Array.isArray(e) ? [Math.max(e[0], Ms), Math.max(e[1], Ms)] : typeof e == "number" ? Math.max(e, Ms) : Ms;
5476
+ function qs(e) {
5477
+ return Array.isArray(e) ? [Math.max(e[0], Ns), Math.max(e[1], Ns)] : typeof e == "number" ? Math.max(e, Ns) : Ns;
5478
5478
  }
5479
- function qs() {
5479
+ function Js() {
5480
5480
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
5481
5481
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
5482
5482
  }
5483
- function Js(e) {
5484
- let t = Ys(e);
5485
- return t ? Math.max(t.radius * Ts, ws) : ws;
5486
- }
5487
5483
  function Ys(e) {
5488
- if (!e || (Ls.setFromObject(e), Ls.isEmpty())) return null;
5489
- let t = Ls.getBoundingSphere(Rs);
5490
- return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
5484
+ let t = Xs(e);
5485
+ return t ? Math.max(t.radius * Ts, ws) : ws;
5491
5486
  }
5492
5487
  function Xs(e) {
5493
- return e.type === "Group" && typeof e.userData.modelID == "number";
5488
+ if (!e || (Rs.setFromObject(e), Rs.isEmpty())) return null;
5489
+ let t = Rs.getBoundingSphere(zs);
5490
+ return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
5494
5491
  }
5495
5492
  function Zs(e) {
5496
- return e?.children.filter(Xs) ?? [];
5493
+ return e.type === "Group" && typeof e.userData.modelID == "number";
5497
5494
  }
5498
- function Qs(e, t) {
5499
- return Zs(e).find((e) => e.userData.modelID === t) ?? null;
5495
+ function Qs(e) {
5496
+ return e?.children.filter(Zs) ?? [];
5500
5497
  }
5501
5498
  function $s(e, t) {
5502
- let n = Ys(t);
5499
+ return Qs(e).find((e) => e.userData.modelID === t) ?? null;
5500
+ }
5501
+ function ec(e, t) {
5502
+ let n = Xs(t);
5503
5503
  if (!n) return;
5504
5504
  let r = Math.max(ks, n.radius * As, e.near + 1);
5505
5505
  Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
5506
5506
  }
5507
- function ec(e, t) {
5507
+ function tc(e, t) {
5508
5508
  let n = new D();
5509
5509
  return Object.entries(e).forEach(([e, r]) => {
5510
5510
  let i = Number(e), a = t.elementBounds.get(i);
@@ -5514,16 +5514,16 @@ function ec(e, t) {
5514
5514
  });
5515
5515
  }), n.isEmpty() ? null : n;
5516
5516
  }
5517
- function tc(e) {
5518
- let t = e.getSize(Bs), n = Math.max(t.x, t.y, t.z);
5519
- return Number.isFinite(n) && n > 0 ? n * Ps : ws;
5517
+ function nc(e) {
5518
+ let t = e.getSize(Vs), n = Math.max(t.x, t.y, t.z);
5519
+ return Number.isFinite(n) && n > 0 ? n * Fs : ws;
5520
5520
  }
5521
- function nc(e, t, n) {
5522
- let r = Math.max(ws, (Number.isFinite(n) ? n : ws) * Ns), i = t.position.distanceTo(e);
5523
- return Number.isFinite(i) && i >= r ? e : ($.copy(e).sub(t.position), (!Number.isFinite($.x + $.y + $.z) || $.lengthSq() === 0) && t.getWorldDirection($), $.lengthSq() === 0 && $.set(0, 0, -1), $.normalize(), zs.copy(t.position).addScaledVector($, r));
5521
+ function rc(e, t, n) {
5522
+ let r = Math.max(ws, (Number.isFinite(n) ? n : ws) * Ps), i = t.position.distanceTo(e);
5523
+ return Number.isFinite(i) && i >= r ? e : ($.copy(e).sub(t.position), (!Number.isFinite($.x + $.y + $.z) || $.lengthSq() === 0) && t.getWorldDirection($), $.lengthSq() === 0 && $.set(0, 0, -1), $.normalize(), Bs.copy(t.position).addScaledVector($, r));
5524
5524
  }
5525
- function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, onReady: u, onCameraDprModeChange: f, publicApi: p, setSceneApi: m, usePerformanceMoving: h, useWebGPU: g }) {
5526
- let y = T((e) => e.camera), S = T((e) => e.gl), C = mt(s), w = Ot(C), { colorPaletteTexture: D, colorUtils: O } = n(C), k = Bn(s), A = Fn(s, r, k, g), j = tr(s, r, k, A.getSelectableObjects), M = b(() => new Ta(), []), N = w.buildIndex, te = C.resetIndex, ne = O.applyStoredColors, re = ei(), P = x(null), F = x(null), I = x(null), L = x(Hs()), R = x(l), ie = x(!1), z = d((e) => e.showStats), ae = _((e) => {
5525
+ function ic({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, onReady: u, onCameraDprModeChange: f, publicApi: p, setSceneApi: m, usePerformanceMoving: h, useWebGPU: g }) {
5526
+ let y = T((e) => e.camera), S = T((e) => e.gl), C = ht(s), w = kt(C), { colorPaletteTexture: D, colorUtils: O } = n(C), k = Vn(s), A = In(s, r, k, g), j = nr(s, r, k, A.getSelectableObjects), M = b(() => new Ea(), []), N = w.buildIndex, te = C.resetIndex, ne = O.applyStoredColors, P = ti(), F = x(null), I = x(null), L = x(null), R = x(Us()), z = x(l), re = x(!1), B = d((e) => e.showStats), ie = _((e) => {
5527
5527
  if (s.current = e, !e) return;
5528
5528
  let t = e;
5529
5529
  t.isClippingGroup = g, t.enabled = !1, t.clipIntersection = !1, t.clipShadows = !1, t.clippingPlanes = [];
@@ -5535,73 +5535,73 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5535
5535
  s,
5536
5536
  g
5537
5537
  ]);
5538
- let oe = b(() => {
5538
+ let ae = b(() => {
5539
5539
  let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
5540
5540
  for (let t of e) {
5541
- let e = rt(c[Number(t)]);
5541
+ let e = it(c[Number(t)]);
5542
5542
  if (e) return e;
5543
5543
  }
5544
5544
  return null;
5545
- }, [c]), B = b(() => tt(oe ?? void 0), [oe]), V = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), H = o !== "performance", se = _(() => {
5546
- r.current && (r.current.minDistance = Js(s.current));
5547
- }, [r, s]), U = _((e, t = !1) => {
5545
+ }, [c]), V = b(() => nt(ae ?? void 0), [ae]), H = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), U = o !== "performance", oe = _(() => {
5546
+ r.current && (r.current.minDistance = Ys(s.current));
5547
+ }, [r, s]), W = _((e, t = !1) => {
5548
5548
  let n = r.current;
5549
5549
  if (!n) return !1;
5550
- let i = t ? nc(e, y, n.minDistance) : e;
5550
+ let i = t ? rc(e, y, n.minDistance) : e;
5551
5551
  return n.cancel(), n.setOrbitPoint(i.x, i.y, i.z), !0;
5552
- }, [y, r]), G = _((e) => {
5553
- P.current = e.clone(), U(e, !0);
5554
- }, [U]), le = _(() => {
5555
- P.current = null, re(s, r, a);
5552
+ }, [y, r]), le = _((e) => {
5553
+ F.current = e.clone(), W(e, !0);
5554
+ }, [W]), ue = _(() => {
5555
+ F.current = null, P(s, r, a);
5556
5556
  }, [
5557
5557
  r,
5558
- re,
5558
+ P,
5559
5559
  a,
5560
5560
  s
5561
- ]), ue = _((t) => {
5561
+ ]), de = _((t) => {
5562
5562
  if (!t) return !1;
5563
- if (!e || !i) return l || (L.current = Hs()), !1;
5564
- let n = L.current;
5563
+ if (!e || !i) return l || (R.current = Us()), !1;
5564
+ let n = R.current;
5565
5565
  if (l) {
5566
- n.active || (L.current = Hs(!0));
5567
- let e = L.current;
5566
+ n.active || (R.current = Us(!0));
5567
+ let e = R.current;
5568
5568
  return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
5569
5569
  }
5570
5570
  if (n.active) {
5571
5571
  if (n.finalFitDone) return !1;
5572
5572
  let e = !n.firstFitDone || !n.userInteractedAfterFirstFit;
5573
- return L.current = Hs(), e;
5573
+ return R.current = Us(), e;
5574
5574
  }
5575
5575
  return !0;
5576
5576
  }, [
5577
5577
  e,
5578
5578
  i,
5579
5579
  l
5580
- ]), de = _((e, t = !1) => {
5580
+ ]), fe = _((e, t = !1) => {
5581
5581
  let n = r.current;
5582
5582
  if (!n) return;
5583
- let i = ec(e, C.buildIndex());
5583
+ let i = tc(e, C.buildIndex());
5584
5584
  if (!i) return;
5585
- let a = i.getCenter(new q());
5586
- if (P.current = a.clone(), n.cancel(), t) {
5587
- let e = tc(i);
5585
+ let a = i.getCenter(new K());
5586
+ if (F.current = a.clone(), n.cancel(), t) {
5587
+ let e = nc(i);
5588
5588
  n.fitToBox(i, !0, {
5589
5589
  paddingBottom: e,
5590
5590
  paddingLeft: e,
5591
5591
  paddingRight: e,
5592
5592
  paddingTop: e
5593
5593
  }).then(() => {
5594
- let e = P.current;
5595
- e && U(e, !0);
5594
+ let e = F.current;
5595
+ e && W(e, !0);
5596
5596
  });
5597
5597
  return;
5598
5598
  }
5599
- U(a, !0);
5599
+ W(a, !0);
5600
5600
  }, [
5601
- U,
5601
+ W,
5602
5602
  r,
5603
5603
  C
5604
- ]), fe = b(() => {
5604
+ ]), pe = b(() => {
5605
5605
  let e = (e) => ({
5606
5606
  ...e,
5607
5607
  activeViewRoot: s.current
@@ -5617,10 +5617,10 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5617
5617
  ]);
5618
5618
  return v(() => {
5619
5619
  let e = () => {
5620
- F.current !== null && (window.clearTimeout(F.current), F.current = null);
5620
+ I.current !== null && (window.clearTimeout(I.current), I.current = null);
5621
5621
  }, t = () => {
5622
- let e = I.current;
5623
- e !== null && (I.current = null, A.setEdgesActive(e));
5622
+ let e = L.current;
5623
+ e !== null && (L.current = null, A.setEdgesActive(e));
5624
5624
  };
5625
5625
  if (!h) {
5626
5626
  e(), t(), f("sleep");
@@ -5629,8 +5629,8 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5629
5629
  let n = r.current;
5630
5630
  if (!n) return;
5631
5631
  let i = () => {
5632
- e(), f("wake"), F.current = window.setTimeout(() => {
5633
- F.current = null, f("move"), I.current === null && (I.current = A.getEdgesActive()), I.current && A.setEdgesActive(!1);
5632
+ e(), f("wake"), I.current = window.setTimeout(() => {
5633
+ I.current = null, f("move"), L.current === null && (L.current = A.getEdgesActive()), L.current && A.setEdgesActive(!1);
5634
5634
  }, Es);
5635
5635
  }, a = () => {
5636
5636
  e(), t(), f("sleep");
@@ -5644,26 +5644,26 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5644
5644
  f,
5645
5645
  h
5646
5646
  ]), v(() => {
5647
- l && !R.current && (L.current = Hs(!0)), R.current = l;
5647
+ l && !z.current && (R.current = Us(!0)), z.current = l;
5648
5648
  }, [l]), v(() => {
5649
5649
  let e = r.current;
5650
5650
  if (!e) return;
5651
5651
  let t = () => {
5652
- let e = L.current;
5652
+ let e = R.current;
5653
5653
  !e.active || !e.firstFitDone || (e.userInteractedAfterFirstFit = !0);
5654
5654
  };
5655
5655
  return e.addEventListener("controlstart", t), e.addEventListener("control", t), () => {
5656
5656
  e.removeEventListener("controlstart", t), e.removeEventListener("control", t);
5657
5657
  };
5658
- }, [r]), Zr(s, r, k, G, A.getSelectableObjects, A.setCapsPreselection), rr(), v(() => {
5658
+ }, [r]), Qr(s, r, k, le, A.getSelectableObjects, A.setCapsPreselection), ir(), v(() => {
5659
5659
  let e = S.domElement, t = (e) => {
5660
- let t = P.current;
5661
- t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || U(t, !0));
5660
+ let t = F.current;
5661
+ t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || W(t, !0));
5662
5662
  };
5663
5663
  return e.addEventListener("pointerdown", t, !0), () => {
5664
5664
  e.removeEventListener("pointerdown", t, !0);
5665
5665
  };
5666
- }, [U, S]), v(() => (k.setClippingSource(A), () => {
5666
+ }, [W, S]), v(() => (k.setClippingSource(A), () => {
5667
5667
  k.setClippingSource(null);
5668
5668
  }), [k, A]), v(() => (t.current = y, () => {
5669
5669
  t.current === y && (t.current = null);
@@ -5674,26 +5674,26 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5674
5674
  }, i = () => {
5675
5675
  if (e) {
5676
5676
  if (!g) {
5677
- le();
5677
+ ue();
5678
5678
  return;
5679
5679
  }
5680
5680
  r(() => {
5681
5681
  n || !s.current || (s.current.updateMatrixWorld(!0), r(() => {
5682
- n || !s.current || (s.current.updateMatrixWorld(!0), le());
5682
+ n || !s.current || (s.current.updateMatrixWorld(!0), ue());
5683
5683
  }));
5684
5684
  });
5685
5685
  }
5686
5686
  }, a = (e) => {
5687
5687
  if (n || !s.current) return;
5688
- s.current.updateMatrixWorld(!0), (y instanceof W || y instanceof ce) && $s(y, s.current), se(), te();
5688
+ s.current.updateMatrixWorld(!0), (y instanceof ce || y instanceof se) && ec(y, s.current), oe(), te();
5689
5689
  let r = N();
5690
5690
  if (!r.records.size && e > 0) {
5691
5691
  t = requestAnimationFrame(() => a(e - 1));
5692
5692
  return;
5693
5693
  }
5694
- ne(), A.syncWithModel(), j.syncWithModel(), ue(r.records.size > 0) && i();
5694
+ ne(), A.syncWithModel(), j.syncWithModel(), de(r.records.size > 0) && i();
5695
5695
  };
5696
- return r(() => a(js)), () => {
5696
+ return r(() => a(g ? Ms : js)), () => {
5697
5697
  n = !0, t !== null && cancelAnimationFrame(t);
5698
5698
  };
5699
5699
  }, [
@@ -5704,13 +5704,13 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5704
5704
  A,
5705
5705
  r,
5706
5706
  j,
5707
- le,
5707
+ ue,
5708
5708
  a,
5709
5709
  s,
5710
5710
  c,
5711
5711
  te,
5712
- ue,
5713
- se,
5712
+ de,
5713
+ oe,
5714
5714
  g
5715
5715
  ]), v(() => {
5716
5716
  let e = () => {
@@ -5720,7 +5720,7 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5720
5720
  };
5721
5721
  return m({
5722
5722
  camera: {
5723
- fitCamera: le,
5723
+ fitCamera: ue,
5724
5724
  getIntersection: k.getIntersection
5725
5725
  },
5726
5726
  clipping: {
@@ -5748,7 +5748,7 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5748
5748
  rebuildModelByColors: O.rebuildModelByColors,
5749
5749
  setColor: O.setColor
5750
5750
  },
5751
- converter: fe,
5751
+ converter: pe,
5752
5752
  dimensions: {
5753
5753
  cancelDrawing: j.cancelDrawing,
5754
5754
  changeAxes: j.changeAxes,
@@ -5769,8 +5769,8 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5769
5769
  geometryUtils: {
5770
5770
  getAllIds: w.getAllIds,
5771
5771
  getIfcSpacesVisibility: w.getIfcSpacesVisibility,
5772
- getModelGeometry: (e) => Qs(s.current, e),
5773
- getModelsGeometry: () => Zs(s.current),
5772
+ getModelGeometry: (e) => $s(s.current, e),
5773
+ getModelsGeometry: () => Qs(s.current),
5774
5774
  hideByIds: (e) => t(() => w.hideByIds(e)),
5775
5775
  hideSelected: () => t(w.hideSelected),
5776
5776
  isolateByIds: (e) => t(() => w.isolateByIds(e)),
@@ -5781,28 +5781,28 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5781
5781
  showByIds: (e) => t(() => w.showByIds(e)),
5782
5782
  toggleIIfcSpacesVisibility: () => t(w.toggleIIfcSpacesVisibility)
5783
5783
  },
5784
- selector: { setTargetToSelection: de }
5785
- }), ie.current || (ie.current = !0, u?.(p)), () => m(null);
5784
+ selector: { setTargetToSelection: fe }
5785
+ }), re.current || (re.current = !0, u?.(p)), () => m(null);
5786
5786
  }, [
5787
5787
  A,
5788
5788
  k,
5789
5789
  O,
5790
5790
  r,
5791
- fe,
5791
+ pe,
5792
5792
  j,
5793
- le,
5793
+ ue,
5794
5794
  w,
5795
5795
  a,
5796
5796
  s,
5797
5797
  u,
5798
5798
  p,
5799
5799
  m,
5800
- de
5801
- ]), /* @__PURE__ */ Y(Se, { children: [
5802
- H && /* @__PURE__ */ Y(Se, { children: [/* @__PURE__ */ J("ambientLight", {
5803
- intensity: Fs,
5800
+ fe
5801
+ ]), /* @__PURE__ */ J(Ce, { children: [
5802
+ U && /* @__PURE__ */ J(Ce, { children: [/* @__PURE__ */ q("ambientLight", {
5803
+ intensity: Is,
5804
5804
  color: "#ffffff"
5805
- }), /* @__PURE__ */ J("directionalLight", {
5805
+ }), /* @__PURE__ */ q("directionalLight", {
5806
5806
  ref: a,
5807
5807
  position: [
5808
5808
  10,
@@ -5810,21 +5810,21 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5810
5810
  10
5811
5811
  ],
5812
5812
  color: "#ffffff",
5813
- intensity: Is
5813
+ intensity: Ls
5814
5814
  })] }),
5815
- z && /* @__PURE__ */ J(ee, {}),
5816
- /* @__PURE__ */ J("group", {
5817
- ref: ae,
5818
- children: V.map(([e, t]) => /* @__PURE__ */ J(at, {
5815
+ B && /* @__PURE__ */ q(ee, {}),
5816
+ /* @__PURE__ */ q("group", {
5817
+ ref: ie,
5818
+ children: H.map(([e, t]) => /* @__PURE__ */ q(ot, {
5819
5819
  colorPaletteTexture: D,
5820
- coordinationMatrix: B,
5820
+ coordinationMatrix: V,
5821
5821
  data: t,
5822
5822
  materialMode: o,
5823
5823
  modelID: e,
5824
5824
  useWebGPU: g
5825
5825
  }, e))
5826
5826
  }),
5827
- /* @__PURE__ */ J(E, {
5827
+ /* @__PURE__ */ q(E, {
5828
5828
  dollyToCursor: !0,
5829
5829
  infinityDolly: !0,
5830
5830
  minDistance: ws,
@@ -5834,142 +5834,145 @@ function rc({ autoFitCamera: e, cameraRef: t, controlRef: r, fitToView: i, light
5834
5834
  })
5835
5835
  ] });
5836
5836
  }
5837
- function ic({ autoFitCamera: e = !0, camera: t = {
5837
+ function ac({ autoFitCamera: e = !0, camera: t = {
5838
5838
  position: [
5839
5839
  10,
5840
5840
  10,
5841
5841
  10
5842
5842
  ],
5843
5843
  fov: 50
5844
- }, dpr: n = window.devicePixelRatio, fitToView: i, modelUrls: a, modelSources: o, modelsLoading: s = !1, modelsData: c, materialMode: l, onModelsDataChange: u, onModelLoadingChange: f, onModelProgress: p, onReady: m, performanceMode: h = !1, publicApi: g, setModelsApi: y, setSceneApi: w, showNavCube: T, showStats: E, usePerformanceMoving: ee = !1, useWebGPU: D = !1 }) {
5845
- let O = x(null), k = x(null), A = x(null), j = x(null), [M, N] = S(), [te, ne] = S(!1), [re, P] = S(!0), [F, I] = S(null), L = x(void 0), R = x(!1), ie = x(null), z = x(0), ae = r(), oe = d((e) => e.setModelNames), B = d((e) => e.setModelProps), V = d((e) => e.setModelStructure), H = d((e) => e.setShowNavCube), se = d((e) => e.setShowStats), U = d((e) => e.setUserDevice), ce = d((e) => e.showNavCube), W = c ?? M, G = s || te, le = i ?? re, ue = h ? Gs(n, 1) : n, de = Gs(ue, h ? Os : Ds), fe = l ?? (h ? "performance" : void 0), [pe, me] = S("sleep"), he = Ks(ue), ge = b(() => D ? Vs({ performanceMode: h }) : h ? Cs : void 0, [h, D]), K = h ? Ss : xs;
5844
+ }, dpr: n = window.devicePixelRatio, fitToView: i, modelUrls: a, modelSources: o, modelsData: s, materialMode: c, onReady: l, performanceMode: u = !1, publicApi: f, setModelsApi: p, setSceneApi: m, showNavCube: h, showStats: g, usePerformanceMoving: y = !1, useWebGPU: w = !1 }) {
5845
+ let T = x(null), E = x(null), ee = x(null), D = x(null), [O, k] = S(), [A, j] = S(!1), [M, N] = S(!0), [te, ne] = S(null), P = x(void 0), F = x(!1), I = x(null), L = x(0), R = r(), z = d((e) => e.setModelNames), re = d((e) => e.setModelProps), B = d((e) => e.setModelStructure), ie = d((e) => e.setShowNavCube), ae = d((e) => e.setShowStats), V = d((e) => e.setUserDevice), H = d((e) => e.showNavCube), U = s ?? O, oe = A, W = i ?? M, se = u ? Ks(n, 1) : n, ce = Ks(se, u ? Os : Ds), le = c ?? (u ? "performance" : void 0), [ue, de] = S("sleep"), fe = qs(se), pe = b(() => w ? Hs({ performanceMode: u }) : u ? Cs : void 0, [u, w]), me = u ? Ss : xs;
5846
5846
  v(() => {
5847
- L.current = W;
5848
- }, [W]), v(() => {
5849
- R.current = G;
5850
- }, [G]), v(() => {
5851
- ie.current = F;
5852
- }, [F]), v(() => {
5853
- u?.(W);
5854
- }, [W, u]), v(() => {
5855
- f?.(G);
5856
- }, [f, G]), v(() => {
5857
- p?.(F);
5858
- }, [F, p]);
5859
- let q = _(() => {
5860
- z.current += 1, ne(!1), I(null), N(void 0), ae.getState().setSelection({});
5861
- }, [ae]), _e = _((e) => {
5862
- N((t) => Us(t, e));
5863
- }, []), ve = _(async (e, t = {}) => {
5864
- let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onProgress: a, ...o } = t, s = z.current + 1;
5865
- z.current = s, I(null), P(r), ne(!0), ae.getState().setSelection({}), n && N({});
5866
- let c = (e) => {
5867
- z.current === s && I(e), a?.(e);
5847
+ P.current = U;
5848
+ }, [U]), v(() => {
5849
+ F.current = oe;
5850
+ }, [oe]), v(() => {
5851
+ I.current = te;
5852
+ }, [te]);
5853
+ let he = _(() => {
5854
+ L.current += 1, j(!1), ne(null), k(void 0), R.getState().setSelection({});
5855
+ }, [R]), ge = _((e, t) => {
5856
+ k((n) => {
5857
+ let r = e(n);
5858
+ return t?.(r), r;
5859
+ });
5860
+ }, []), _e = _((e, t) => {
5861
+ ge((t) => Ws(t, e), t);
5862
+ }, [ge]), G = _(async (e, t = {}) => {
5863
+ let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = L.current + 1;
5864
+ L.current = u, ne(null), N(r), j(!0), o?.(null), a?.(!0), R.getState().setSelection({}), n && (k({}), s?.({}));
5865
+ let d = (e) => {
5866
+ L.current === u && ne(e), o?.(e), c?.(e);
5868
5867
  };
5869
5868
  try {
5870
- let t = !!o.useWorker, n = await Lo.loadModel(e, {
5871
- ...o,
5869
+ let t = !!l.useWorker, n = await Ro.loadModel(e, {
5870
+ ...l,
5872
5871
  ...t ? {
5873
- collectWorkerChunks: o.collectWorkerChunks ?? !1,
5872
+ collectWorkerChunks: l.collectWorkerChunks ?? !1,
5874
5873
  onChunk: (e) => {
5875
- z.current === s && _e(e), i?.(e);
5874
+ L.current === u && _e(e, s), i?.(e);
5876
5875
  },
5877
- onProgress: c
5878
- } : { onProgress: c }
5876
+ onProgress: d
5877
+ } : { onProgress: d }
5879
5878
  });
5880
- return z.current === s && N((e) => t ? Ws(e, n) : {
5879
+ return L.current === u && ge((e) => t ? Gs(e, n) : {
5881
5880
  ...e ?? {},
5882
5881
  ...n
5883
- }), n;
5882
+ }, s), n;
5884
5883
  } finally {
5885
- z.current === s && ne(!1);
5884
+ L.current === u && (j(!1), a?.(!1));
5886
5885
  }
5887
- }, [_e, ae]), ye = b(() => ({
5888
- getData: () => L.current,
5889
- getLoading: () => R.current,
5890
- getProgress: () => ie.current,
5891
- loadModels: ve,
5892
- reset: q
5893
- }), [ve, q]);
5894
- return v(() => (y(ye), () => y(null)), [ye, y]), v(() => {
5895
- U(qs());
5896
- }, [U]), v(() => {
5897
- se(!!E);
5898
- }, [se, E]), v(() => {
5899
- T !== void 0 && H(T);
5900
- }, [H, T]), v(() => {
5886
+ }, [
5887
+ _e,
5888
+ ge,
5889
+ R
5890
+ ]), K = b(() => ({
5891
+ getData: () => P.current,
5892
+ getLoading: () => F.current,
5893
+ getProgress: () => I.current,
5894
+ loadModels: G,
5895
+ reset: he
5896
+ }), [G, he]);
5897
+ return v(() => (p(K), () => p(null)), [K, p]), v(() => {
5898
+ V(Js());
5899
+ }, [V]), v(() => {
5900
+ ae(!!g);
5901
+ }, [ae, g]), v(() => {
5902
+ h !== void 0 && ie(h);
5903
+ }, [ie, h]), v(() => {
5901
5904
  let e = {}, t = {}, n = {};
5902
- W && Object.entries(W).forEach(([r, i]) => {
5905
+ U && Object.entries(U).forEach(([r, i]) => {
5903
5906
  let a = Number(r);
5904
5907
  i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
5905
- }), oe(e), B(t), V(n);
5908
+ }), z(e), re(t), B(n);
5906
5909
  }, [
5907
- W,
5908
- oe,
5909
- B,
5910
- V
5910
+ U,
5911
+ z,
5912
+ re,
5913
+ B
5911
5914
  ]), v(() => {
5912
- if (c) return;
5915
+ if (s) return;
5913
5916
  let t = o ?? a;
5914
- t?.length && ve(t, {
5917
+ t?.length && G(t, {
5915
5918
  clearViewer: !0,
5916
5919
  fitToView: e
5917
5920
  });
5918
5921
  }, [
5919
5922
  e,
5920
- c,
5921
- ve,
5923
+ s,
5924
+ G,
5922
5925
  o,
5923
5926
  a
5924
- ]), W ? /* @__PURE__ */ Y("div", {
5927
+ ]), U ? /* @__PURE__ */ J("div", {
5925
5928
  style: ys,
5926
- children: [/* @__PURE__ */ J(C, {
5929
+ children: [/* @__PURE__ */ q(C, {
5927
5930
  camera: t,
5928
- dpr: ee && pe === "move" ? de : ue,
5929
- gl: ge,
5930
- children: /* @__PURE__ */ J(ti, {
5931
- store: ae,
5932
- children: /* @__PURE__ */ J(rc, {
5931
+ dpr: y && ue === "move" ? ce : se,
5932
+ gl: pe,
5933
+ children: /* @__PURE__ */ q(ni, {
5934
+ store: R,
5935
+ children: /* @__PURE__ */ q(ic, {
5933
5936
  autoFitCamera: e,
5934
- cameraRef: O,
5935
- controlRef: k,
5936
- fitToView: le,
5937
- lightRef: j,
5938
- materialMode: fe,
5939
- modelRef: A,
5940
- modelsData: W,
5941
- modelsLoading: G,
5942
- onReady: m,
5943
- onCameraDprModeChange: me,
5944
- publicApi: g,
5945
- setSceneApi: w,
5946
- usePerformanceMoving: ee,
5947
- useWebGPU: D
5937
+ cameraRef: T,
5938
+ controlRef: E,
5939
+ fitToView: W,
5940
+ lightRef: D,
5941
+ materialMode: le,
5942
+ modelRef: ee,
5943
+ modelsData: U,
5944
+ modelsLoading: oe,
5945
+ onReady: l,
5946
+ onCameraDprModeChange: de,
5947
+ publicApi: f,
5948
+ setSceneApi: m,
5949
+ usePerformanceMoving: y,
5950
+ useWebGPU: w
5948
5951
  })
5949
5952
  })
5950
- }, D ? "viewer-webgpu" : "viewer-webgl"), ce && /* @__PURE__ */ J("div", {
5953
+ }, w ? "viewer-webgpu" : "viewer-webgl"), H && /* @__PURE__ */ q("div", {
5951
5954
  style: vs,
5952
- children: /* @__PURE__ */ J(C, {
5955
+ children: /* @__PURE__ */ q(C, {
5953
5956
  camera: bs,
5954
- dpr: he,
5955
- gl: K,
5957
+ dpr: fe,
5958
+ gl: me,
5956
5959
  orthographic: !0,
5957
- children: /* @__PURE__ */ J(hs, {
5960
+ children: /* @__PURE__ */ q(hs, {
5958
5961
  active: !0,
5959
- cameraRef: O,
5960
- controlRef: k,
5961
- modelRef: A
5962
+ cameraRef: T,
5963
+ controlRef: E,
5964
+ modelRef: ee
5962
5965
  })
5963
5966
  }, "nav-cube-webgl")
5964
5967
  })]
5965
- }) : /* @__PURE__ */ J(Se, {});
5968
+ }) : /* @__PURE__ */ q(Ce, {});
5966
5969
  }
5967
- var ac = m(function(e, t) {
5970
+ var oc = m(function(e, t) {
5968
5971
  let [n] = S(o), r = x(!1), i = x(!1), a = b(() => new gs(), []), { defaultSelected: s, onSelectedChange: c, selected: l } = e, u = _((e) => {
5969
5972
  a.set(e);
5970
5973
  }, [a]), d = b(() => new _s(), []), f = _((e) => {
5971
5974
  d.set(e);
5972
- }, [d]), p = b(() => Ua(n, a.get, d.get), [
5975
+ }, [d]), p = b(() => Wa(n, a.get, d.get), [
5973
5976
  d,
5974
5977
  a,
5975
5978
  n
@@ -5977,20 +5980,20 @@ var ac = m(function(e, t) {
5977
5980
  return y(t, () => p, [p]), v(() => (n.getState().setApi(p), () => {
5978
5981
  n.getState().api === p && n.getState().setApi(null);
5979
5982
  }), [p, n]), v(() => {
5980
- r.current || !s || l !== void 0 || (r.current = !0, n.getState().setSelection(Ha(s)));
5983
+ r.current || !s || l !== void 0 || (r.current = !0, n.getState().setSelection(Ua(s)));
5981
5984
  }, [
5982
5985
  l,
5983
5986
  s,
5984
5987
  n
5985
5988
  ]), v(() => {
5986
- l !== void 0 && (i.current = !0, n.getState().setSelection(Ha(l)), i.current = !1);
5989
+ l !== void 0 && (i.current = !0, n.getState().setSelection(Ua(l)), i.current = !1);
5987
5990
  }, [l, n]), v(() => {
5988
5991
  if (c) return n.subscribe((e, t) => {
5989
- e.selected !== t.selected && (i.current || c(Va(e.selected)));
5992
+ e.selected !== t.selected && (i.current || c(Ha(e.selected)));
5990
5993
  });
5991
- }, [c, n]), /* @__PURE__ */ J(ti, {
5994
+ }, [c, n]), /* @__PURE__ */ q(ni, {
5992
5995
  store: n,
5993
- children: /* @__PURE__ */ J(ic, {
5996
+ children: /* @__PURE__ */ q(ac, {
5994
5997
  ...e,
5995
5998
  publicApi: p,
5996
5999
  setModelsApi: f,
@@ -5998,6 +6001,6 @@ var ac = m(function(e, t) {
5998
6001
  })
5999
6002
  });
6000
6003
  });
6001
- ac.displayName = "Viewer";
6004
+ oc.displayName = "Viewer";
6002
6005
  //#endregion
6003
- export { Ga as BMTLoader, Ta as BmtConverter, Da as ConvertIfcFileToBmt, Oa as ConvertToBmt, qn as DimensionLine, er as DimensionsUtils, Ba as FilteredElementsCollector, Qe as ModelGrids, hs as NavigationCube, ac as Viewer, ti as ViewerStoreProvider, Ea as bmtConverter, _o as convertIfcFilesToBmtInWorker, vo as createBmtConverterWorker, to as createBmtWorker, Ao as createIfcWorker, o as createViewerStore, Wi as exportExcel, Vi as exportModelPropertiesToExcel, eo as loadBmtModelsInWorker, ko as loadIfcModelsInWorker, Lo as loader, tr as useDimensionsUtils, d as useViewerStore, r as useViewerStoreApi };
6006
+ export { Ka as BMTLoader, Ea as BmtConverter, Oa as ConvertIfcFileToBmt, ka as ConvertToBmt, Jn as DimensionLine, tr as DimensionsUtils, Va as FilteredElementsCollector, $e as ModelGrids, hs as NavigationCube, oc as Viewer, ni as ViewerStoreProvider, Da as bmtConverter, vo as convertIfcFilesToBmtInWorker, yo as createBmtConverterWorker, no as createBmtWorker, jo as createIfcWorker, o as createViewerStore, Gi as exportExcel, Hi as exportModelPropertiesToExcel, to as loadBmtModelsInWorker, Ao as loadIfcModelsInWorker, Ro as loader, nr as useDimensionsUtils, d as useViewerStore, r as useViewerStoreApi };