@thatopen/components 2.0.5 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -92,26 +92,26 @@ function Ae(l) {
92
92
  return 2 * (s * t + t * e + e * s);
93
93
  }
94
94
  function Gs(l, s, t, e, i = null) {
95
- let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, E = -1 / 0, d = 1 / 0, h = 1 / 0, u = 1 / 0, p = -1 / 0, A = -1 / 0, R = -1 / 0;
95
+ let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, h = -1 / 0, d = 1 / 0, E = 1 / 0, u = 1 / 0, p = -1 / 0, A = -1 / 0, R = -1 / 0;
96
96
  const C = i !== null;
97
97
  for (let T = s * 6, F = (s + t) * 6; T < F; T += 6) {
98
98
  const f = l[T + 0], m = l[T + 1], O = f - m, S = f + m;
99
99
  O < o && (o = O), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
100
100
  const _ = l[T + 2], N = l[T + 3], L = _ - N, M = _ + N;
101
- L < n && (n = L), M > c && (c = M), C && _ < h && (h = _), C && _ > A && (A = _);
101
+ L < n && (n = L), M > c && (c = M), C && _ < E && (E = _), C && _ > A && (A = _);
102
102
  const y = l[T + 4], x = l[T + 5], b = y - x, B = y + x;
103
- b < r && (r = b), B > E && (E = B), C && y < u && (u = y), C && y > R && (R = y);
103
+ b < r && (r = b), B > h && (h = B), C && y < u && (u = y), C && y > R && (R = y);
104
104
  }
105
- e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = A, i[5] = R);
105
+ e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] = h, C && (i[0] = d, i[1] = E, i[2] = u, i[3] = p, i[4] = A, i[5] = R);
106
106
  }
107
107
  function ho(l, s, t, e) {
108
108
  let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
109
- for (let E = s * 6, d = (s + t) * 6; E < d; E += 6) {
110
- const h = l[E + 0];
111
- h < i && (i = h), h > r && (r = h);
112
- const u = l[E + 2];
109
+ for (let h = s * 6, d = (s + t) * 6; h < d; h += 6) {
110
+ const E = l[h + 0];
111
+ E < i && (i = E), E > r && (r = E);
112
+ const u = l[h + 2];
113
113
  u < o && (o = u), u > a && (a = u);
114
- const p = l[E + 4];
114
+ const p = l[h + 4];
115
115
  p < n && (n = p), p > c && (c = p);
116
116
  }
117
117
  e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = c;
@@ -121,14 +121,14 @@ function Eo(l, s) {
121
121
  const t = l.attributes.position, e = l.index ? l.index.array : null, i = Ce(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
122
  let c = 3;
123
123
  t.isInterleavedBufferAttribute && (c = t.data.stride);
124
- const E = ["getX", "getY", "getZ"];
124
+ const h = ["getX", "getY", "getZ"];
125
125
  for (let d = 0; d < i; d++) {
126
- const h = d * 3, u = d * 6;
127
- let p = h + 0, A = h + 1, R = h + 2;
126
+ const E = d * 3, u = d * 6;
127
+ let p = E + 0, A = E + 1, R = E + 2;
128
128
  e && (p = e[p], A = e[A], R = e[R]), n || (p = p * c + a, A = A * c + a, R = R * c + a);
129
129
  for (let C = 0; C < 3; C++) {
130
130
  let T, F, f;
131
- n ? (T = t[E[C]](p), F = t[E[C]](A), f = t[E[C]](R)) : (T = r[p + C], F = r[A + C], f = r[R + C]);
131
+ n ? (T = t[h[C]](p), F = t[h[C]](A), f = t[h[C]](R)) : (T = r[p + C], F = r[A + C], f = r[R + C]);
132
132
  let m = T;
133
133
  F < m && (m = F), f < m && (m = f);
134
134
  let O = T;
@@ -155,16 +155,16 @@ function Io(l, s, t, e, i, o) {
155
155
  else if (o === io) {
156
156
  const a = Ae(l);
157
157
  let c = Ys * i;
158
- const E = e * 6, d = (e + i) * 6;
159
- for (let h = 0; h < 3; h++) {
160
- const u = s[h], R = (s[h + 3] - u) / wt;
158
+ const h = e * 6, d = (e + i) * 6;
159
+ for (let E = 0; E < 3; E++) {
160
+ const u = s[E], R = (s[E + 3] - u) / wt;
161
161
  if (i < wt / 4) {
162
162
  const C = [...Ut];
163
163
  C.length = i;
164
164
  let T = 0;
165
- for (let f = E; f < d; f += 6, T++) {
165
+ for (let f = h; f < d; f += 6, T++) {
166
166
  const m = C[T];
167
- m.candidate = t[f + 2 * h], m.count = 0;
167
+ m.candidate = t[f + 2 * E], m.count = 0;
168
168
  const {
169
169
  bounds: O,
170
170
  leftCacheBounds: S,
@@ -181,8 +181,8 @@ function Io(l, s, t, e, i, o) {
181
181
  for (; f + 1 < F && C[f + 1].candidate === m.candidate; )
182
182
  C.splice(f + 1, 1), F--;
183
183
  }
184
- for (let f = E; f < d; f += 6) {
185
- const m = t[f + 2 * h];
184
+ for (let f = h; f < d; f += 6) {
185
+ const m = t[f + 2 * E];
186
186
  for (let O = 0; O < F; O++) {
187
187
  const S = C[O];
188
188
  m >= S.candidate ? je(f, t, S.rightCacheBounds) : (je(f, t, S.leftCacheBounds), S.count++);
@@ -195,7 +195,7 @@ function Io(l, s, t, e, i, o) {
195
195
  let M = 0;
196
196
  S !== 0 && (M = Ae(N) / a);
197
197
  const y = vi + Ys * (L * O + M * S);
198
- y < c && (n = h, c = y, r = m.candidate);
198
+ y < c && (n = E, c = y, r = m.candidate);
199
199
  }
200
200
  } else {
201
201
  for (let F = 0; F < wt; F++) {
@@ -205,8 +205,8 @@ function Io(l, s, t, e, i, o) {
205
205
  for (let O = 0; O < 3; O++)
206
206
  m[O] = 1 / 0, m[O + 3] = -1 / 0;
207
207
  }
208
- for (let F = E; F < d; F += 6) {
209
- let O = ~~((t[F + 2 * h] - u) / R);
208
+ for (let F = h; F < d; F += 6) {
209
+ let O = ~~((t[F + 2 * E] - u) / R);
210
210
  O >= wt && (O = wt - 1);
211
211
  const S = Ut[O];
212
212
  S.count++, je(F, t, S.bounds);
@@ -226,7 +226,7 @@ function Io(l, s, t, e, i, o) {
226
226
  const M = i - T;
227
227
  M !== 0 && (L = Ae(_) / a);
228
228
  const y = vi + Ys * (N * T + L * M);
229
- y < c && (n = h, c = y, r = f.candidate);
229
+ y < c && (n = E, c = y, r = f.candidate);
230
230
  }
231
231
  }
232
232
  }
@@ -253,13 +253,13 @@ function po(l, s, t, e, i, o) {
253
253
  for (; n <= r && t[r * 6 + c] >= a; )
254
254
  r--;
255
255
  if (n < r) {
256
- for (let E = 0; E < 3; E++) {
257
- let d = s[n * 3 + E];
258
- s[n * 3 + E] = s[r * 3 + E], s[r * 3 + E] = d;
256
+ for (let h = 0; h < 3; h++) {
257
+ let d = s[n * 3 + h];
258
+ s[n * 3 + h] = s[r * 3 + h], s[r * 3 + h] = d;
259
259
  }
260
- for (let E = 0; E < 6; E++) {
261
- let d = t[n * 6 + E];
262
- t[n * 6 + E] = t[r * 6 + E], t[r * 6 + E] = d;
260
+ for (let h = 0; h < 6; h++) {
261
+ let d = t[n * 6 + h];
262
+ t[n * 6 + h] = t[r * 6 + h], t[r * 6 + h] = d;
263
263
  }
264
264
  n++, r--;
265
265
  } else
@@ -275,11 +275,11 @@ function Co(l, s, t, e, i, o) {
275
275
  for (; n <= r && t[r * 6 + c] >= a; )
276
276
  r--;
277
277
  if (n < r) {
278
- let E = l[n];
279
- l[n] = l[r], l[r] = E;
278
+ let h = l[n];
279
+ l[n] = l[r], l[r] = h;
280
280
  for (let d = 0; d < 6; d++) {
281
- let h = t[n * 6 + d];
282
- t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = h;
281
+ let E = t[n * 6 + d];
282
+ t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = E;
283
283
  }
284
284
  n++, r--;
285
285
  } else
@@ -293,12 +293,12 @@ function To(l, s) {
293
293
  return n;
294
294
  }
295
295
  function mo(l, s) {
296
- const t = l.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, c = Ce(t), E = l._indirectBuffer;
296
+ const t = l.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, c = Ce(t), h = l._indirectBuffer;
297
297
  let d = !1;
298
- const h = new Float32Array(6), u = new Float32Array(6), p = Eo(t, h), A = s.indirect ? Co : po, R = [], C = s.indirect ? Dn(t) : Un(t);
298
+ const E = new Float32Array(6), u = new Float32Array(6), p = Eo(t, E), A = s.indirect ? Co : po, R = [], C = s.indirect ? Dn(t) : Un(t);
299
299
  if (C.length === 1) {
300
300
  const f = C[0], m = new $e();
301
- m.boundingData = h, ho(p, f.offset, f.count, u), F(m, f.offset, f.count, u), R.push(m);
301
+ m.boundingData = E, ho(p, f.offset, f.count, u), F(m, f.offset, f.count, u), R.push(m);
302
302
  } else
303
303
  for (let f of C) {
304
304
  const m = new $e();
@@ -314,7 +314,7 @@ function mo(l, s) {
314
314
  const N = Io(f.boundingData, S, p, m, O, r);
315
315
  if (N.axis === -1)
316
316
  return T(m + O), f.offset = m, f.count = O, f;
317
- const L = A(E, e, p, m, O, N);
317
+ const L = A(h, e, p, m, O, N);
318
318
  if (L === m || L === m + O)
319
319
  T(m + O), f.offset = m, f.count = O;
320
320
  else {
@@ -336,29 +336,29 @@ function Ro(l, s) {
336
336
  let i, o, n;
337
337
  const r = [], a = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
338
338
  for (let d = 0; d < e.length; d++) {
339
- const h = e[d];
340
- let u = c(h);
339
+ const E = e[d];
340
+ let u = c(E);
341
341
  const p = new a(Ts * u);
342
- i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), E(0, h), r.push(p);
342
+ i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), h(0, E), r.push(p);
343
343
  }
344
344
  l._roots = r;
345
345
  return;
346
346
  function c(d) {
347
347
  return d.count ? 1 : 1 + c(d.left) + c(d.right);
348
348
  }
349
- function E(d, h) {
350
- const u = d / 4, p = d / 2, A = !!h.count, R = h.boundingData;
349
+ function h(d, E) {
350
+ const u = d / 4, p = d / 2, A = !!E.count, R = E.boundingData;
351
351
  for (let C = 0; C < 6; C++)
352
352
  i[u + C] = R[C];
353
353
  if (A) {
354
- const C = h.offset, T = h.count;
354
+ const C = E.offset, T = E.count;
355
355
  return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Us, d + Ts;
356
356
  } else {
357
- const C = h.left, T = h.right, F = h.splitAxis;
357
+ const C = E.left, T = E.right, F = E.splitAxis;
358
358
  let f;
359
- if (f = E(d + Ts, C), f / 4 > Math.pow(2, 32))
359
+ if (f = h(d + Ts, C), f / 4 > Math.pow(2, 32))
360
360
  throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");
361
- return o[u + 6] = f / 4, f = E(f, T), o[u + 7] = F, f;
361
+ return o[u + 6] = f / 4, f = h(f, T), o[u + 7] = F, f;
362
362
  }
363
363
  }
364
364
  }
@@ -393,8 +393,8 @@ Mt.prototype.setFromBox = function() {
393
393
  let n = 1 / 0, r = -1 / 0;
394
394
  for (let a = 0; a <= 1; a++)
395
395
  for (let c = 0; c <= 1; c++)
396
- for (let E = 0; E <= 1; E++) {
397
- l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * E + o.z * (1 - E);
396
+ for (let h = 0; h <= 1; h++) {
397
+ l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * h + o.z * (1 - h);
398
398
  const d = t.dot(l);
399
399
  n = Math.min(d, n), r = Math.max(d, r);
400
400
  }
@@ -404,11 +404,11 @@ Mt.prototype.setFromBox = function() {
404
404
  const Ao = function() {
405
405
  const l = new w(), s = new w(), t = new w();
406
406
  return function(i, o, n) {
407
- const r = i.start, a = l, c = o.start, E = s;
407
+ const r = i.start, a = l, c = o.start, h = s;
408
408
  t.subVectors(r, c), l.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
409
- const d = t.dot(E), h = E.dot(a), u = E.dot(E), p = t.dot(a), R = a.dot(a) * u - h * h;
409
+ const d = t.dot(h), E = h.dot(a), u = h.dot(h), p = t.dot(a), R = a.dot(a) * u - E * E;
410
410
  let C, T;
411
- R !== 0 ? C = (d * h - p * u) / R : C = 0, T = (d + C * h) / u, n.x = C, n.y = T;
411
+ R !== 0 ? C = (d * E - p * u) / R : C = 0, T = (d + C * E) / u, n.x = C, n.y = T;
412
412
  };
413
413
  }(), Oi = function() {
414
414
  const l = new pe(), s = new w(), t = new w();
@@ -425,16 +425,16 @@ const Ao = function() {
425
425
  a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
426
426
  return;
427
427
  } else {
428
- let E;
429
- a < 0 ? E = i.start : E = i.end;
428
+ let h;
429
+ a < 0 ? h = i.start : h = i.end;
430
430
  let d;
431
431
  c < 0 ? d = o.start : d = o.end;
432
- const h = s, u = t;
433
- if (i.closestPointToPoint(d, !0, s), o.closestPointToPoint(E, !0, t), h.distanceToSquared(d) <= u.distanceToSquared(E)) {
434
- n.copy(h), r.copy(d);
432
+ const E = s, u = t;
433
+ if (i.closestPointToPoint(d, !0, s), o.closestPointToPoint(h, !0, t), E.distanceToSquared(d) <= u.distanceToSquared(h)) {
434
+ n.copy(E), r.copy(d);
435
435
  return;
436
436
  } else {
437
- n.copy(E), r.copy(u);
437
+ n.copy(h), r.copy(u);
438
438
  return;
439
439
  }
440
440
  }
@@ -442,8 +442,8 @@ const Ao = function() {
442
442
  }(), Fo = function() {
443
443
  const l = new w(), s = new w(), t = new Fi(), e = new Lt();
444
444
  return function(o, n) {
445
- const { radius: r, center: a } = o, { a: c, b: E, c: d } = n;
446
- if (e.start = c, e.end = E, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
445
+ const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
446
+ if (e.start = c, e.end = h, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = h, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
447
447
  return !0;
448
448
  const A = n.getPlane(t);
449
449
  if (Math.abs(A.distanceToPoint(a)) <= r) {
@@ -467,10 +467,10 @@ class Ft extends Ie {
467
467
  update() {
468
468
  const s = this.a, t = this.b, e = this.c, i = this.points, o = this.satAxes, n = this.satBounds, r = o[0], a = n[0];
469
469
  this.getNormal(r), a.setFromPoints(r, i);
470
- const c = o[1], E = n[1];
471
- c.subVectors(s, t), E.setFromPoints(c, i);
472
- const d = o[2], h = n[2];
473
- d.subVectors(t, e), h.setFromPoints(d, i);
470
+ const c = o[1], h = n[1];
471
+ c.subVectors(s, t), h.setFromPoints(c, i);
472
+ const d = o[2], E = n[2];
473
+ d.subVectors(t, e), E.setFromPoints(d, i);
474
474
  const u = o[3], p = n[3];
475
475
  u.subVectors(e, s), p.setFromPoints(u, i), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(r, s), this.needsUpdate = !1;
476
476
  }
@@ -479,28 +479,28 @@ Ft.prototype.closestPointToSegment = function() {
479
479
  const l = new w(), s = new w(), t = new Lt();
480
480
  return function(i, o = null, n = null) {
481
481
  const { start: r, end: a } = i, c = this.points;
482
- let E, d = 1 / 0;
483
- for (let h = 0; h < 3; h++) {
484
- const u = (h + 1) % 3;
485
- t.start.copy(c[h]), t.end.copy(c[u]), Oi(t, i, l, s), E = l.distanceToSquared(s), E < d && (d = E, o && o.copy(l), n && n.copy(s));
482
+ let h, d = 1 / 0;
483
+ for (let E = 0; E < 3; E++) {
484
+ const u = (E + 1) % 3;
485
+ t.start.copy(c[E]), t.end.copy(c[u]), Oi(t, i, l, s), h = l.distanceToSquared(s), h < d && (d = h, o && o.copy(l), n && n.copy(s));
486
486
  }
487
- return this.closestPointToPoint(r, l), E = r.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), E = a.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
487
+ return this.closestPointToPoint(r, l), h = r.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), h = a.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
488
488
  };
489
489
  }();
490
490
  Ft.prototype.intersectsTriangle = function() {
491
- const l = new Ft(), s = new Array(3), t = new Array(3), e = new Mt(), i = new Mt(), o = new w(), n = new w(), r = new w(), a = new w(), c = new w(), E = new Lt(), d = new Lt(), h = new Lt(), u = new w();
491
+ const l = new Ft(), s = new Array(3), t = new Array(3), e = new Mt(), i = new Mt(), o = new w(), n = new w(), r = new w(), a = new w(), c = new w(), h = new Lt(), d = new Lt(), E = new Lt(), u = new w();
492
492
  function p(A, R, C) {
493
493
  const T = A.points;
494
494
  let F = 0, f = -1;
495
495
  for (let m = 0; m < 3; m++) {
496
- const { start: O, end: S } = E;
497
- O.copy(T[m]), S.copy(T[(m + 1) % 3]), E.delta(n);
496
+ const { start: O, end: S } = h;
497
+ O.copy(T[m]), S.copy(T[(m + 1) % 3]), h.delta(n);
498
498
  const _ = zs(R.distanceToPoint(O));
499
499
  if (zs(R.normal.dot(n)) && _) {
500
- C.copy(E), F = 2;
500
+ C.copy(h), F = 2;
501
501
  break;
502
502
  }
503
- const N = R.intersectLine(E, u);
503
+ const N = R.intersectLine(h, u);
504
504
  if (!N && _ && u.copy(O), (N || _) && !zs(u.distanceTo(S))) {
505
505
  if (F <= 1)
506
506
  (F === 1 ? C.start : C.end).copy(u), _ && (f = F);
@@ -547,17 +547,17 @@ Ft.prototype.intersectsTriangle = function() {
547
547
  return C && (C.start.copy(d.end), C.end.copy(d.end)), !0;
548
548
  if (m !== 2)
549
549
  return !1;
550
- const O = p(R, F, h);
551
- if (O === 1 && this.containsPoint(h.end))
552
- return C && (C.start.copy(h.end), C.end.copy(h.end)), !0;
550
+ const O = p(R, F, E);
551
+ if (O === 1 && this.containsPoint(E.end))
552
+ return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
553
553
  if (O !== 2)
554
554
  return !1;
555
- if (d.delta(r), h.delta(a), r.dot(a) < 0) {
556
- let x = h.start;
557
- h.start = h.end, h.end = x;
555
+ if (d.delta(r), E.delta(a), r.dot(a) < 0) {
556
+ let x = E.start;
557
+ E.start = E.end, E.end = x;
558
558
  }
559
- const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r), L = h.end.dot(r), M = _ < N, y = S < L;
560
- return S !== L && N !== _ && M === y ? !1 : (C && (c.subVectors(d.start, h.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), c.subVectors(d.end, h.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
559
+ const S = d.start.dot(r), _ = d.end.dot(r), N = E.start.dot(r), L = E.end.dot(r), M = _ < N, y = S < L;
560
+ return S !== L && N !== _ && M === y ? !1 : (C && (c.subVectors(d.start, E.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(E.start), c.subVectors(d.end, E.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(E.end)), !0);
561
561
  }
562
562
  };
563
563
  }();
@@ -573,25 +573,25 @@ Ft.prototype.distanceToTriangle = function() {
573
573
  const c = r || a ? e : null;
574
574
  if (this.intersectsTriangle(n, c))
575
575
  return (r || a) && (r && c.getCenter(r), a && c.getCenter(a)), 0;
576
- let E = 1 / 0;
576
+ let h = 1 / 0;
577
577
  for (let d = 0; d < 3; d++) {
578
- let h;
578
+ let E;
579
579
  const u = t[d], p = n[u];
580
- this.closestPointToPoint(p, l), h = p.distanceToSquared(l), h < E && (E = h, r && r.copy(l), a && a.copy(p));
580
+ this.closestPointToPoint(p, l), E = p.distanceToSquared(l), E < h && (h = E, r && r.copy(l), a && a.copy(p));
581
581
  const A = this[u];
582
- n.closestPointToPoint(A, l), h = A.distanceToSquared(l), h < E && (E = h, r && r.copy(A), a && a.copy(l));
582
+ n.closestPointToPoint(A, l), E = A.distanceToSquared(l), E < h && (h = E, r && r.copy(A), a && a.copy(l));
583
583
  }
584
584
  for (let d = 0; d < 3; d++) {
585
- const h = t[d], u = t[(d + 1) % 3];
586
- e.set(this[h], this[u]);
585
+ const E = t[d], u = t[(d + 1) % 3];
586
+ e.set(this[E], this[u]);
587
587
  for (let p = 0; p < 3; p++) {
588
588
  const A = t[p], R = t[(p + 1) % 3];
589
589
  i.set(n[A], n[R]), Oi(e, i, l, s);
590
590
  const C = l.distanceToSquared(s);
591
- C < E && (E = C, r && r.copy(l), a && a.copy(s));
591
+ C < h && (h = C, r && r.copy(l), a && a.copy(s));
592
592
  }
593
593
  }
594
- return Math.sqrt(E);
594
+ return Math.sqrt(h);
595
595
  };
596
596
  }();
597
597
  class at {
@@ -609,15 +609,15 @@ at.prototype.update = /* @__PURE__ */ function() {
609
609
  return function() {
610
610
  const s = this.matrix, t = this.min, e = this.max, i = this.points;
611
611
  for (let c = 0; c <= 1; c++)
612
- for (let E = 0; E <= 1; E++)
612
+ for (let h = 0; h <= 1; h++)
613
613
  for (let d = 0; d <= 1; d++) {
614
- const h = 1 * c | 2 * E | 4 * d, u = i[h];
615
- u.x = c ? e.x : t.x, u.y = E ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
614
+ const E = 1 * c | 2 * h | 4 * d, u = i[E];
615
+ u.x = c ? e.x : t.x, u.y = h ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
616
616
  }
617
617
  const o = this.satBounds, n = this.satAxes, r = i[0];
618
618
  for (let c = 0; c < 3; c++) {
619
- const E = n[c], d = o[c], h = 1 << c, u = i[h];
620
- E.subVectors(r, u), d.setFromPoints(E, i);
619
+ const h = n[c], d = o[c], E = 1 << c, u = i[E];
620
+ h.subVectors(r, u), d.setFromPoints(h, i);
621
621
  }
622
622
  const a = this.alignedSatBounds;
623
623
  a[0].setFromPointsField(i, "x"), a[1].setFromPointsField(i, "y"), a[2].setFromPointsField(i, "z"), this.invMatrix.copy(this.matrix).invert(), this.needsUpdate = !1;
@@ -631,8 +631,8 @@ at.prototype.intersectsBox = function() {
631
631
  if (l.min = e.x, l.max = i.x, r[0].isSeparated(l) || (l.min = e.y, l.max = i.y, r[1].isSeparated(l)) || (l.min = e.z, l.max = i.z, r[2].isSeparated(l)))
632
632
  return !1;
633
633
  for (let a = 0; a < 3; a++) {
634
- const c = n[a], E = o[a];
635
- if (l.setFromBox(c, t), E.isSeparated(l))
634
+ const c = n[a], h = o[a];
635
+ if (l.setFromBox(c, t), h.isSeparated(l))
636
636
  return !1;
637
637
  }
638
638
  return !0;
@@ -644,21 +644,21 @@ at.prototype.intersectsTriangle = function() {
644
644
  this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (l.copy(n), l.update(), n = l);
645
645
  const r = this.satBounds, a = this.satAxes;
646
646
  s[0] = n.a, s[1] = n.b, s[2] = n.c;
647
- for (let h = 0; h < 3; h++) {
648
- const u = r[h], p = a[h];
647
+ for (let E = 0; E < 3; E++) {
648
+ const u = r[E], p = a[E];
649
649
  if (t.setFromPoints(p, s), u.isSeparated(t))
650
650
  return !1;
651
651
  }
652
- const c = n.satBounds, E = n.satAxes, d = this.points;
653
- for (let h = 0; h < 3; h++) {
654
- const u = c[h], p = E[h];
652
+ const c = n.satBounds, h = n.satAxes, d = this.points;
653
+ for (let E = 0; E < 3; E++) {
654
+ const u = c[E], p = h[E];
655
655
  if (t.setFromPoints(p, d), u.isSeparated(t))
656
656
  return !1;
657
657
  }
658
- for (let h = 0; h < 3; h++) {
659
- const u = a[h];
658
+ for (let E = 0; E < 3; E++) {
659
+ const u = a[E];
660
660
  for (let p = 0; p < 4; p++) {
661
- const A = E[p];
661
+ const A = h[p];
662
662
  if (i.crossVectors(u, A), t.setFromPoints(i, s), e.setFromPoints(i, d), t.isSeparated(e))
663
663
  return !1;
664
664
  }
@@ -682,13 +682,13 @@ at.prototype.distanceToBox = function() {
682
682
  return function(n, r = 0, a = null, c = null) {
683
683
  if (this.needsUpdate && this.update(), this.intersectsBox(n))
684
684
  return (a || c) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), c && c.copy(i)), 0;
685
- const E = r * r, d = n.min, h = n.max, u = this.points;
685
+ const h = r * r, d = n.min, E = n.max, u = this.points;
686
686
  let p = 1 / 0;
687
687
  for (let R = 0; R < 8; R++) {
688
688
  const C = u[R];
689
- i.copy(C).clamp(d, h);
689
+ i.copy(C).clamp(d, E);
690
690
  const T = C.distanceToSquared(i);
691
- if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T < E))
691
+ if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T < h))
692
692
  return Math.sqrt(T);
693
693
  }
694
694
  let A = 0;
@@ -698,14 +698,14 @@ at.prototype.distanceToBox = function() {
698
698
  const F = (R + 1) % 3, f = (R + 2) % 3, m = C << F | T << f, O = 1 << R | C << F | T << f, S = u[m], _ = u[O];
699
699
  s[A].set(S, _);
700
700
  const L = l[R], M = l[F], y = l[f], x = t[A], b = x.start, B = x.end;
701
- b[L] = d[L], b[M] = C ? d[M] : h[M], b[y] = T ? d[y] : h[M], B[L] = h[L], B[M] = C ? d[M] : h[M], B[y] = T ? d[y] : h[M], A++;
701
+ b[L] = d[L], b[M] = C ? d[M] : E[M], b[y] = T ? d[y] : E[M], B[L] = E[L], B[M] = C ? d[M] : E[M], B[y] = T ? d[y] : E[M], A++;
702
702
  }
703
703
  for (let R = 0; R <= 1; R++)
704
704
  for (let C = 0; C <= 1; C++)
705
705
  for (let T = 0; T <= 1; T++) {
706
- i.x = R ? h.x : d.x, i.y = C ? h.y : d.y, i.z = T ? h.z : d.z, this.closestPointToPoint(i, e);
706
+ i.x = R ? E.x : d.x, i.y = C ? E.y : d.y, i.z = T ? E.z : d.z, this.closestPointToPoint(i, e);
707
707
  const F = i.distanceToSquared(e);
708
- if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F < E))
708
+ if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F < h))
709
709
  return Math.sqrt(F);
710
710
  }
711
711
  for (let R = 0; R < 12; R++) {
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
714
714
  const F = t[T];
715
715
  Oi(C, F, e, i);
716
716
  const f = e.distanceToSquared(i);
717
- if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f < E))
717
+ if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f < h))
718
718
  return Math.sqrt(f);
719
719
  }
720
720
  }
@@ -781,10 +781,10 @@ function _o(l, s, t, e, i, o) {
781
781
  }
782
782
  function ai(l, s, t, e, i = null, o = 0, n = 0) {
783
783
  const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
784
- let E = l * 2;
785
- if (ht(E, a)) {
786
- const h = Et(l, c), u = ft(E, a);
787
- return $(l, r, Yt), e(h, u, !1, n, o + l, Yt);
784
+ let h = l * 2;
785
+ if (ht(h, a)) {
786
+ const E = Et(l, c), u = ft(h, a);
787
+ return $(l, r, Yt), e(E, u, !1, n, o + l, Yt);
788
788
  } else {
789
789
  let L = function(y) {
790
790
  const { uint16Array: x, uint32Array: b } = Z;
@@ -799,10 +799,10 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
799
799
  y = Ct(y, b), B = y * 2;
800
800
  return Et(y, b) + ft(B, x);
801
801
  };
802
- const h = pt(l), u = Ct(l, c);
803
- let p = h, A = u, R, C, T, F;
802
+ const E = pt(l), u = Ct(l, c);
803
+ let p = E, A = u, R, C, T, F;
804
804
  if (i && (T = Yt, F = fe, $(p, r, T), $(A, r, F), R = i(T), C = i(F), C < R)) {
805
- p = u, A = h;
805
+ p = u, A = E;
806
806
  const y = R;
807
807
  R = C, C = y, T = F;
808
808
  }
@@ -849,12 +849,12 @@ function No(l, s, t = {}, e = 0, i = 1 / 0) {
849
849
  let r = 1 / 0, a = null;
850
850
  if (l.shapecast(
851
851
  {
852
- boundsTraverseOrder: (E) => (Fe.copy(s).clamp(E.min, E.max), Fe.distanceToSquared(s)),
853
- intersectsBounds: (E, d, h) => h < r && h < n,
854
- intersectsTriangle: (E, d) => {
855
- E.closestPointToPoint(s, Fe);
856
- const h = s.distanceToSquared(Fe);
857
- return h < r && (Hs.copy(Fe), r = h, a = d), h < o;
852
+ boundsTraverseOrder: (h) => (Fe.copy(s).clamp(h.min, h.max), Fe.distanceToSquared(s)),
853
+ intersectsBounds: (h, d, E) => E < r && E < n,
854
+ intersectsTriangle: (h, d) => {
855
+ h.closestPointToPoint(s, Fe);
856
+ const E = s.distanceToSquared(Fe);
857
+ return E < r && (Hs.copy(Fe), r = E, a = d), E < o;
858
858
  }
859
859
  }
860
860
  ), r === 1 / 0)
@@ -875,14 +875,14 @@ function Lo(l, s, t, e, i, o, n, r, a) {
875
875
  const c = Po(l, ee, se, ie, ss, a);
876
876
  if (c) {
877
877
  e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), c.uv = Ie.getInterpolation(ss, ee, se, ie, Je, ts, es, new pe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), c.uv1 = Ie.getInterpolation(ss, ee, se, ie, Je, ts, es, new pe())), t && (Gi.fromBufferAttribute(t, o), zi.fromBufferAttribute(t, n), Hi.fromBufferAttribute(t, r), c.normal = Ie.getInterpolation(ss, ee, se, ie, Gi, zi, Hi, new w()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
878
- const E = {
878
+ const h = {
879
879
  a: o,
880
880
  b: n,
881
881
  c: r,
882
882
  normal: new w(),
883
883
  materialIndex: 0
884
884
  };
885
- Ie.getNormal(ee, se, ie, E.normal), c.face = E, c.faceIndex = o;
885
+ Ie.getNormal(ee, se, ie, h.normal), c.face = h, c.faceIndex = o;
886
886
  }
887
887
  return c;
888
888
  }
@@ -891,7 +891,7 @@ function xs(l, s, t, e, i) {
891
891
  let n = o + 0, r = o + 1, a = o + 2;
892
892
  const c = l.index;
893
893
  l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
894
- const { position: E, normal: d, uv: h, uv1: u } = l.attributes, p = Lo(t, E, d, h, u, n, r, a, s);
894
+ const { position: h, normal: d, uv: E, uv1: u } = l.attributes, p = Lo(t, h, d, E, u, n, r, a, s);
895
895
  return p ? (p.faceIndex = e, i && i.push(p), p) : null;
896
896
  }
897
897
  function et(l, s, t, e) {
@@ -907,7 +907,7 @@ function yo(l, s, t, e, i, o) {
907
907
  function wo(l, s, t, e, i) {
908
908
  const { geometry: o, _indirectBuffer: n } = l;
909
909
  let r = 1 / 0, a = null;
910
- for (let c = e, E = e + i; c < E; c++) {
910
+ for (let c = e, h = e + i; c < h; c++) {
911
911
  let d;
912
912
  d = xs(o, s, t, c), d && d.distance < r && (a = d, r = d.distance);
913
913
  }
@@ -915,9 +915,9 @@ function wo(l, s, t, e, i) {
915
915
  }
916
916
  function Mo(l, s, t, e, i, o, n) {
917
917
  const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
918
- for (let E = l, d = s + l; E < d; E++) {
919
- let h;
920
- if (h = E, et(n, h * 3, a, c), n.needsUpdate = !0, e(n, h, i, o))
918
+ for (let h = l, d = s + l; h < d; h++) {
919
+ let E;
920
+ if (E = h, et(n, E * 3, a, c), n.needsUpdate = !0, e(n, E, i, o))
921
921
  return !0;
922
922
  }
923
923
  return !1;
@@ -926,22 +926,22 @@ function Do(l, s = null) {
926
926
  s && Array.isArray(s) && (s = new Set(s));
927
927
  const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
928
928
  let o, n, r, a, c = 0;
929
- const E = l._roots;
930
- for (let h = 0, u = E.length; h < u; h++)
931
- o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
- function d(h, u, p = !1) {
933
- const A = h * 2;
929
+ const h = l._roots;
930
+ for (let E = 0, u = h.length; E < u; E++)
931
+ o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
+ function d(E, u, p = !1) {
933
+ const A = E * 2;
934
934
  if (r[A + 15] === Us) {
935
- const C = n[h + 6], T = r[A + 14];
935
+ const C = n[E + 6], T = r[A + 14];
936
936
  let F = 1 / 0, f = 1 / 0, m = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
937
937
  for (let N = 3 * C, L = 3 * (C + T); N < L; N++) {
938
938
  let M = e[N];
939
939
  const y = i.getX(M), x = i.getY(M), b = i.getZ(M);
940
940
  y < F && (F = y), y > O && (O = y), x < f && (f = x), x > S && (S = x), b < m && (m = b), b > _ && (_ = b);
941
941
  }
942
- return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== O || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = O, a[h + 4] = S, a[h + 5] = _, !0) : !1;
942
+ return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== m || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = m, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
943
943
  } else {
944
- const C = h + 8, T = n[h + 6], F = C + u, f = T + u;
944
+ const C = E + 8, T = n[E + 6], F = C + u, f = T + u;
945
945
  let m = p, O = !1, S = !1;
946
946
  s ? m || (O = s.has(F), S = s.has(f), m = !O && !S) : (O = !0, S = !0);
947
947
  const _ = m || O, N = m || S;
@@ -953,7 +953,7 @@ function Do(l, s = null) {
953
953
  if (y)
954
954
  for (let x = 0; x < 3; x++) {
955
955
  const b = C + x, B = T + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
956
- a[h + x] = H < st ? H : st, a[h + x + 3] = q > Q ? q : Q;
956
+ a[E + x] = H < st ? H : st, a[E + x + 3] = q > Q ? q : Q;
957
957
  }
958
958
  return y;
959
959
  }
@@ -966,14 +966,14 @@ function zt(l, s, t, e) {
966
966
  function Uo(l, s, t, e, i, o) {
967
967
  const { geometry: n, _indirectBuffer: r } = l;
968
968
  for (let a = e, c = e + i; a < c; a++) {
969
- let E = r ? r[a] : a;
970
- xs(n, s, t, E, o);
969
+ let h = r ? r[a] : a;
970
+ xs(n, s, t, h, o);
971
971
  }
972
972
  }
973
973
  function xo(l, s, t, e, i) {
974
974
  const { geometry: o, _indirectBuffer: n } = l;
975
975
  let r = 1 / 0, a = null;
976
- for (let c = e, E = e + i; c < E; c++) {
976
+ for (let c = e, h = e + i; c < h; c++) {
977
977
  let d;
978
978
  d = xs(o, s, t, n ? n[c] : c), d && d.distance < r && (a = d, r = d.distance);
979
979
  }
@@ -981,9 +981,9 @@ function xo(l, s, t, e, i) {
981
981
  }
982
982
  function bo(l, s, t, e, i, o, n) {
983
983
  const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
984
- for (let E = l, d = s + l; E < d; E++) {
985
- let h;
986
- if (h = t.resolveTriangleIndex(E), et(n, h * 3, a, c), n.needsUpdate = !0, e(n, h, i, o))
984
+ for (let h = l, d = s + l; h < d; h++) {
985
+ let E;
986
+ if (E = t.resolveTriangleIndex(h), et(n, E * 3, a, c), n.needsUpdate = !0, e(n, E, i, o))
987
987
  return !0;
988
988
  }
989
989
  return !1;
@@ -995,11 +995,11 @@ function vo(l, s, t, e, i) {
995
995
  function ci(l, s, t, e, i) {
996
996
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
997
997
  if (ht(a, n)) {
998
- const E = Et(l, r), d = ft(a, n);
999
- yo(s, t, e, E, d, i);
998
+ const h = Et(l, r), d = ft(a, n);
999
+ yo(s, t, e, h, d, i);
1000
1000
  } else {
1001
- const E = pt(l);
1002
- zt(E, o, e, Wi) && ci(E, s, t, e, i);
1001
+ const h = pt(l);
1002
+ zt(h, o, e, Wi) && ci(h, s, t, e, i);
1003
1003
  const d = Ct(l, r);
1004
1004
  zt(d, o, e, Wi) && ci(d, s, t, e, i);
1005
1005
  }
@@ -1014,16 +1014,16 @@ function li(l, s, t, e) {
1014
1014
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1015
1015
  let r = l * 2;
1016
1016
  if (ht(r, o)) {
1017
- const c = Et(l, n), E = ft(r, o);
1018
- return wo(s, t, e, c, E);
1017
+ const c = Et(l, n), h = ft(r, o);
1018
+ return wo(s, t, e, c, h);
1019
1019
  } else {
1020
- const c = xn(l, n), E = Bo[c], h = e.direction[E] >= 0;
1020
+ const c = xn(l, n), h = Bo[c], E = e.direction[h] >= 0;
1021
1021
  let u, p;
1022
- h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1022
+ E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1023
1023
  const R = zt(u, i, e, Xi) ? li(u, s, t, e) : null;
1024
1024
  if (R) {
1025
- const F = R.point[E];
1026
- if (h ? F <= i[p + c] : (
1025
+ const F = R.point[h];
1026
+ if (E ? F <= i[p + c] : (
1027
1027
  // min bounding data
1028
1028
  F >= i[p + c + 3]
1029
1029
  ))
@@ -1043,33 +1043,33 @@ function hi(l, s, t, e, i = null) {
1043
1043
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1044
1044
  let a = l * 2;
1045
1045
  if (i === null && (t.boundingBox || t.computeBoundingBox(), Zi.set(t.boundingBox.min, t.boundingBox.max, e), i = Zi), ht(a, n)) {
1046
- const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
1046
+ const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
1047
1047
  if (Oe.copy(e).invert(), t.boundsTree)
1048
1048
  return $(l, o, ns), ns.matrix.copy(Oe), ns.needsUpdate = !0, t.boundsTree.shapecast({
1049
1049
  intersectsBounds: (T) => ns.intersectsBox(T),
1050
1050
  intersectsTriangle: (T) => {
1051
1051
  T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
1052
1052
  for (let F = A * 3, f = (R + A) * 3; F < f; F += 3)
1053
- if (et(oe, F, d, h), oe.needsUpdate = !0, T.intersectsTriangle(oe))
1053
+ if (et(oe, F, d, E), oe.needsUpdate = !0, T.intersectsTriangle(oe))
1054
1054
  return !0;
1055
1055
  return !1;
1056
1056
  }
1057
1057
  });
1058
1058
  for (let C = A * 3, T = (R + A) * 3; C < T; C += 3) {
1059
- et(ne, C, d, h), ne.a.applyMatrix4(Oe), ne.b.applyMatrix4(Oe), ne.c.applyMatrix4(Oe), ne.needsUpdate = !0;
1059
+ et(ne, C, d, E), ne.a.applyMatrix4(Oe), ne.b.applyMatrix4(Oe), ne.c.applyMatrix4(Oe), ne.needsUpdate = !0;
1060
1060
  for (let F = 0, f = u.count; F < f; F += 3)
1061
1061
  if (et(oe, F, u, p), oe.needsUpdate = !0, ne.intersectsTriangle(oe))
1062
1062
  return !0;
1063
1063
  }
1064
1064
  } else {
1065
- const E = l + 8, d = r[l + 6];
1066
- return $(E, o, is), !!(i.intersectsBox(is) && hi(E, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && hi(d, s, t, e, i)));
1065
+ const h = l + 8, d = r[l + 6];
1066
+ return $(h, o, is), !!(i.intersectsBox(is) && hi(h, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && hi(d, s, t, e, i)));
1067
1067
  }
1068
1068
  }
1069
1069
  const os = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Go = /* @__PURE__ */ new w(), zo = /* @__PURE__ */ new w(), Ho = /* @__PURE__ */ new w(), ko = /* @__PURE__ */ new w();
1070
1070
  function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1071
1071
  s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
1072
- const r = l.geometry, a = r.attributes.position, c = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1072
+ const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
1073
1073
  let p = Go, A = zo, R = null, C = null;
1074
1074
  i && (R = Ho, C = ko);
1075
1075
  let T = 1 / 0, F = null, f = null;
@@ -1084,10 +1084,10 @@ function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1084
1084
  intersectsBounds: (_, N, L) => L < T && L < n,
1085
1085
  intersectsRange: (_, N) => {
1086
1086
  for (let L = _, M = _ + N; L < M; L++) {
1087
- et(u, 3 * L, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1087
+ et(u, 3 * L, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
1088
  for (let y = m, x = m + O; y < x; y++) {
1089
- et(h, 3 * y, c, a), h.needsUpdate = !0;
1090
- const b = h.distanceToTriangle(u, p, R);
1089
+ et(E, 3 * y, c, a), E.needsUpdate = !0;
1090
+ const b = E.distanceToTriangle(u, p, R);
1091
1091
  if (b < T && (A.copy(p), C && C.copy(R), T = b, F = y, f = L), b < o)
1092
1092
  return !0;
1093
1093
  }
@@ -1097,10 +1097,10 @@ function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1097
1097
  {
1098
1098
  const S = Ce(s);
1099
1099
  for (let _ = 0, N = S; _ < N; _++) {
1100
- et(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1100
+ et(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
1101
  for (let L = m, M = m + O; L < M; L++) {
1102
- et(h, 3 * L, c, a), h.needsUpdate = !0;
1103
- const y = h.distanceToTriangle(u, p, R);
1102
+ et(E, 3 * L, c, a), E.needsUpdate = !0;
1103
+ const y = E.distanceToTriangle(u, p, R);
1104
1104
  if (y < T && (A.copy(p), C && C.copy(R), T = y, F = L, f = _), y < o)
1105
1105
  return !0;
1106
1106
  }
@@ -1108,19 +1108,19 @@ function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1108
1108
  }
1109
1109
  }
1110
1110
  }
1111
- ), It.releasePrimitive(h), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), A.applyMatrix4(os), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1111
+ ), It.releasePrimitive(E), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), A.applyMatrix4(os), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1112
1112
  }
1113
1113
  function Xo(l, s = null) {
1114
1114
  s && Array.isArray(s) && (s = new Set(s));
1115
1115
  const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
1116
1116
  let o, n, r, a, c = 0;
1117
- const E = l._roots;
1118
- for (let h = 0, u = E.length; h < u; h++)
1119
- o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
- function d(h, u, p = !1) {
1121
- const A = h * 2;
1117
+ const h = l._roots;
1118
+ for (let E = 0, u = h.length; E < u; E++)
1119
+ o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
+ function d(E, u, p = !1) {
1121
+ const A = E * 2;
1122
1122
  if (r[A + 15] === Us) {
1123
- const C = n[h + 6], T = r[A + 14];
1123
+ const C = n[E + 6], T = r[A + 14];
1124
1124
  let F = 1 / 0, f = 1 / 0, m = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
1125
1125
  for (let N = C, L = C + T; N < L; N++) {
1126
1126
  const M = 3 * l.resolveTriangleIndex(N);
@@ -1131,9 +1131,9 @@ function Xo(l, s = null) {
1131
1131
  b < F && (F = b), b > O && (O = b), B < f && (f = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
1132
1132
  }
1133
1133
  }
1134
- return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== O || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = O, a[h + 4] = S, a[h + 5] = _, !0) : !1;
1134
+ return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== m || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = m, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
1135
1135
  } else {
1136
- const C = h + 8, T = n[h + 6], F = C + u, f = T + u;
1136
+ const C = E + 8, T = n[E + 6], F = C + u, f = T + u;
1137
1137
  let m = p, O = !1, S = !1;
1138
1138
  s ? m || (O = s.has(F), S = s.has(f), m = !O && !S) : (O = !0, S = !0);
1139
1139
  const _ = m || O, N = m || S;
@@ -1145,7 +1145,7 @@ function Xo(l, s = null) {
1145
1145
  if (y)
1146
1146
  for (let x = 0; x < 3; x++) {
1147
1147
  const b = C + x, B = T + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
1148
- a[h + x] = H < st ? H : st, a[h + x + 3] = q > Q ? q : Q;
1148
+ a[E + x] = H < st ? H : st, a[E + x + 3] = q > Q ? q : Q;
1149
1149
  }
1150
1150
  return y;
1151
1151
  }
@@ -1158,11 +1158,11 @@ function Zo(l, s, t, e, i) {
1158
1158
  function Ei(l, s, t, e, i) {
1159
1159
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
1160
1160
  if (ht(a, n)) {
1161
- const E = Et(l, r), d = ft(a, n);
1162
- Uo(s, t, e, E, d, i);
1161
+ const h = Et(l, r), d = ft(a, n);
1162
+ Uo(s, t, e, h, d, i);
1163
1163
  } else {
1164
- const E = pt(l);
1165
- zt(E, o, e, Qi) && Ei(E, s, t, e, i);
1164
+ const h = pt(l);
1165
+ zt(h, o, e, Qi) && Ei(h, s, t, e, i);
1166
1166
  const d = Ct(l, r);
1167
1167
  zt(d, o, e, Qi) && Ei(d, s, t, e, i);
1168
1168
  }
@@ -1177,16 +1177,16 @@ function di(l, s, t, e) {
1177
1177
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1178
1178
  let r = l * 2;
1179
1179
  if (ht(r, o)) {
1180
- const c = Et(l, n), E = ft(r, o);
1181
- return xo(s, t, e, c, E);
1180
+ const c = Et(l, n), h = ft(r, o);
1181
+ return xo(s, t, e, c, h);
1182
1182
  } else {
1183
- const c = xn(l, n), E = Qo[c], h = e.direction[E] >= 0;
1183
+ const c = xn(l, n), h = Qo[c], E = e.direction[h] >= 0;
1184
1184
  let u, p;
1185
- h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1185
+ E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1186
1186
  const R = zt(u, i, e, ji) ? di(u, s, t, e) : null;
1187
1187
  if (R) {
1188
- const F = R.point[E];
1189
- if (h ? F <= i[p + c] : (
1188
+ const F = R.point[h];
1189
+ if (E ? F <= i[p + c] : (
1190
1190
  // min bounding data
1191
1191
  F >= i[p + c + 3]
1192
1192
  ))
@@ -1206,34 +1206,34 @@ function ui(l, s, t, e, i = null) {
1206
1206
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1207
1207
  let a = l * 2;
1208
1208
  if (i === null && (t.boundingBox || t.computeBoundingBox(), qi.set(t.boundingBox.min, t.boundingBox.max, e), i = qi), ht(a, n)) {
1209
- const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
1209
+ const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
1210
1210
  if (Se.copy(e).invert(), t.boundsTree)
1211
1211
  return $(l, o, as), as.matrix.copy(Se), as.needsUpdate = !0, t.boundsTree.shapecast({
1212
1212
  intersectsBounds: (T) => as.intersectsBox(T),
1213
1213
  intersectsTriangle: (T) => {
1214
1214
  T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
1215
1215
  for (let F = A, f = R + A; F < f; F++)
1216
- if (et(ae, 3 * s.resolveTriangleIndex(F), d, h), ae.needsUpdate = !0, T.intersectsTriangle(ae))
1216
+ if (et(ae, 3 * s.resolveTriangleIndex(F), d, E), ae.needsUpdate = !0, T.intersectsTriangle(ae))
1217
1217
  return !0;
1218
1218
  return !1;
1219
1219
  }
1220
1220
  });
1221
1221
  for (let C = A, T = R + A; C < T; C++) {
1222
1222
  const F = s.resolveTriangleIndex(C);
1223
- et(re, 3 * F, d, h), re.a.applyMatrix4(Se), re.b.applyMatrix4(Se), re.c.applyMatrix4(Se), re.needsUpdate = !0;
1223
+ et(re, 3 * F, d, E), re.a.applyMatrix4(Se), re.b.applyMatrix4(Se), re.c.applyMatrix4(Se), re.needsUpdate = !0;
1224
1224
  for (let f = 0, m = u.count; f < m; f += 3)
1225
1225
  if (et(ae, f, u, p), ae.needsUpdate = !0, re.intersectsTriangle(ae))
1226
1226
  return !0;
1227
1227
  }
1228
1228
  } else {
1229
- const E = l + 8, d = r[l + 6];
1230
- return $(E, o, rs), !!(i.intersectsBox(rs) && ui(E, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && ui(d, s, t, e, i)));
1229
+ const h = l + 8, d = r[l + 6];
1230
+ return $(h, o, rs), !!(i.intersectsBox(rs) && ui(h, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && ui(d, s, t, e, i)));
1231
1231
  }
1232
1232
  }
1233
1233
  const cs = /* @__PURE__ */ new yt(), Ws = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), $o = /* @__PURE__ */ new w(), Ko = /* @__PURE__ */ new w(), Jo = /* @__PURE__ */ new w(), tr = /* @__PURE__ */ new w();
1234
1234
  function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
1235
  s.boundingBox || s.computeBoundingBox(), Ws.set(s.boundingBox.min, s.boundingBox.max, t), Ws.needsUpdate = !0;
1236
- const r = l.geometry, a = r.attributes.position, c = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1236
+ const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
1237
1237
  let p = $o, A = Ko, R = null, C = null;
1238
1238
  i && (R = Jo, C = tr);
1239
1239
  let T = 1 / 0, F = null, f = null;
@@ -1250,11 +1250,11 @@ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1250
1250
  intersectsRange: (_, N) => {
1251
1251
  for (let L = _, M = _ + N; L < M; L++) {
1252
1252
  const y = S.resolveTriangleIndex(L);
1253
- et(u, 3 * y, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1253
+ et(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
1254
  for (let x = m, b = m + O; x < b; x++) {
1255
1255
  const B = l.resolveTriangleIndex(x);
1256
- et(h, 3 * B, c, a), h.needsUpdate = !0;
1257
- const H = h.distanceToTriangle(u, p, R);
1256
+ et(E, 3 * B, c, a), E.needsUpdate = !0;
1257
+ const H = E.distanceToTriangle(u, p, R);
1258
1258
  if (H < T && (A.copy(p), C && C.copy(R), T = H, F = x, f = L), H < o)
1259
1259
  return !0;
1260
1260
  }
@@ -1264,11 +1264,11 @@ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1264
1264
  } else {
1265
1265
  const S = Ce(s);
1266
1266
  for (let _ = 0, N = S; _ < N; _++) {
1267
- et(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1267
+ et(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
1268
  for (let L = m, M = m + O; L < M; L++) {
1269
1269
  const y = l.resolveTriangleIndex(L);
1270
- et(h, 3 * y, c, a), h.needsUpdate = !0;
1271
- const x = h.distanceToTriangle(u, p, R);
1270
+ et(E, 3 * y, c, a), E.needsUpdate = !0;
1271
+ const x = E.distanceToTriangle(u, p, R);
1272
1272
  if (x < T && (A.copy(p), C && C.copy(R), T = x, F = L, f = _), x < o)
1273
1273
  return !0;
1274
1274
  }
@@ -1276,7 +1276,7 @@ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1276
1276
  }
1277
1277
  }
1278
1278
  }
1279
- ), It.releasePrimitive(h), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(cs), A.applyMatrix4(cs), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1279
+ ), It.releasePrimitive(E), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(cs), A.applyMatrix4(cs), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1280
1280
  }
1281
1281
  function sr() {
1282
1282
  return typeof SharedArrayBuffer < "u";
@@ -1290,11 +1290,11 @@ function ir(l, s, t, e) {
1290
1290
  const i = l._roots, o = s._roots;
1291
1291
  let n, r = 0, a = 0;
1292
1292
  const c = new yt().copy(t).invert();
1293
- for (let E = 0, d = i.length; E < d; E++) {
1294
- be.setBuffer(i[E]), a = 0;
1295
- const h = vt.getPrimitive();
1296
- $(0, be.float32Array, h), h.applyMatrix4(c);
1297
- for (let u = 0, p = o.length; u < p && (As.setBuffer(o[E]), n = Tt(
1293
+ for (let h = 0, d = i.length; h < d; h++) {
1294
+ be.setBuffer(i[h]), a = 0;
1295
+ const E = vt.getPrimitive();
1296
+ $(0, be.float32Array, E), E.applyMatrix4(c);
1297
+ for (let u = 0, p = o.length; u < p && (As.setBuffer(o[h]), n = Tt(
1298
1298
  0,
1299
1299
  0,
1300
1300
  t,
@@ -1304,21 +1304,21 @@ function ir(l, s, t, e) {
1304
1304
  a,
1305
1305
  0,
1306
1306
  0,
1307
- h
1307
+ E
1308
1308
  ), As.clearBuffer(), a += o[u].length, !n); u++)
1309
1309
  ;
1310
- if (vt.releasePrimitive(h), be.clearBuffer(), r += i[E].length, n)
1310
+ if (vt.releasePrimitive(E), be.clearBuffer(), r += i[h].length, n)
1311
1311
  break;
1312
1312
  }
1313
1313
  return Qs = !1, n;
1314
1314
  }
1315
- function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1316
- let d, h;
1317
- E ? (d = As, h = be) : (d = be, h = As);
1318
- const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, R = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = l * 2, f = s * 2, m = ht(F, A), O = ht(f, T);
1315
+ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1316
+ let d, E;
1317
+ h ? (d = As, E = be) : (d = be, E = As);
1318
+ const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, R = E.float32Array, C = E.uint32Array, T = E.uint16Array, F = l * 2, f = s * 2, m = ht(F, A), O = ht(f, T);
1319
1319
  let S = !1;
1320
1320
  if (O && m)
1321
- E ? S = i(
1321
+ h ? S = i(
1322
1322
  Et(s, C),
1323
1323
  ft(s * 2, T),
1324
1324
  Et(l, p),
@@ -1354,7 +1354,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1354
1354
  a,
1355
1355
  r + 1,
1356
1356
  _,
1357
- !E
1357
+ !h
1358
1358
  ) || y && Tt(
1359
1359
  s,
1360
1360
  L,
@@ -1366,7 +1366,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1366
1366
  a,
1367
1367
  r + 1,
1368
1368
  _,
1369
- !E
1369
+ !h
1370
1370
  ), vt.releasePrimitive(_);
1371
1371
  } else {
1372
1372
  const _ = pt(s), N = Ct(s, C);
@@ -1384,7 +1384,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1384
1384
  r,
1385
1385
  a + 1,
1386
1386
  c,
1387
- E
1387
+ h
1388
1388
  ) || Tt(
1389
1389
  l,
1390
1390
  N,
@@ -1396,7 +1396,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1396
1396
  r,
1397
1397
  a + 1,
1398
1398
  c,
1399
- E
1399
+ h
1400
1400
  );
1401
1401
  else if (L)
1402
1402
  if (m)
@@ -1411,7 +1411,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1411
1411
  r,
1412
1412
  a + 1,
1413
1413
  c,
1414
- E
1414
+ h
1415
1415
  );
1416
1416
  else {
1417
1417
  const y = vt.getPrimitive();
@@ -1430,7 +1430,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1430
1430
  a,
1431
1431
  r + 1,
1432
1432
  y,
1433
- !E
1433
+ !h
1434
1434
  ) || H && Tt(
1435
1435
  _,
1436
1436
  b,
@@ -1442,7 +1442,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1442
1442
  a,
1443
1443
  r + 1,
1444
1444
  y,
1445
- !E
1445
+ !h
1446
1446
  ), vt.releasePrimitive(y);
1447
1447
  }
1448
1448
  else if (M)
@@ -1458,7 +1458,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1458
1458
  r,
1459
1459
  a + 1,
1460
1460
  c,
1461
- E
1461
+ h
1462
1462
  );
1463
1463
  else {
1464
1464
  const y = vt.getPrimitive();
@@ -1477,7 +1477,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1477
1477
  a,
1478
1478
  r + 1,
1479
1479
  y,
1480
- !E
1480
+ !h
1481
1481
  ) || H && Tt(
1482
1482
  N,
1483
1483
  b,
@@ -1489,7 +1489,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1489
1489
  a,
1490
1490
  r + 1,
1491
1491
  y,
1492
- !E
1492
+ !h
1493
1493
  ), vt.releasePrimitive(y);
1494
1494
  }
1495
1495
  }
@@ -1565,22 +1565,22 @@ class Si {
1565
1565
  const e = this._roots[t], i = new Uint32Array(e), o = new Uint16Array(e);
1566
1566
  n(0);
1567
1567
  function n(r, a = 0) {
1568
- const c = r * 2, E = o[c + 15] === Us;
1569
- if (E) {
1570
- const d = i[r + 6], h = o[c + 14];
1571
- s(a, E, new Float32Array(e, r * 4, 6), d, h);
1568
+ const c = r * 2, h = o[c + 15] === Us;
1569
+ if (h) {
1570
+ const d = i[r + 6], E = o[c + 14];
1571
+ s(a, h, new Float32Array(e, r * 4, 6), d, E);
1572
1572
  } else {
1573
- const d = r + Ts / 4, h = i[r + 6], u = i[r + 7];
1574
- s(a, E, new Float32Array(e, r * 4, 6), u) || (n(d, a + 1), n(h, a + 1));
1573
+ const d = r + Ts / 4, E = i[r + 6], u = i[r + 7];
1574
+ s(a, h, new Float32Array(e, r * 4, 6), u) || (n(d, a + 1), n(E, a + 1));
1575
1575
  }
1576
1576
  }
1577
1577
  }
1578
1578
  /* Core Cast Functions */
1579
1579
  raycast(s, t = Di) {
1580
- const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, E = this.indirect ? Zo : vo;
1581
- for (let d = 0, h = e.length; d < h; d++) {
1580
+ const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Zo : vo;
1581
+ for (let d = 0, E = e.length; d < E; d++) {
1582
1582
  const u = r ? t[a[d].materialIndex].side : c, p = o.length;
1583
- if (E(this, d, u, s, o), r) {
1583
+ if (h(this, d, u, s, o), r) {
1584
1584
  const A = a[d].materialIndex;
1585
1585
  for (let R = p, C = o.length; R < C; R++)
1586
1586
  o[R].face.materialIndex = A;
@@ -1591,9 +1591,9 @@ class Si {
1591
1591
  raycastFirst(s, t = Di) {
1592
1592
  const e = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
1593
1593
  let r = null;
1594
- const a = i.groups, c = o ? t.side : t, E = this.indirect ? jo : Yo;
1595
- for (let d = 0, h = e.length; d < h; d++) {
1596
- const u = n ? t[a[d].materialIndex].side : c, p = E(this, d, u, s);
1594
+ const a = i.groups, c = o ? t.side : t, h = this.indirect ? jo : Yo;
1595
+ for (let d = 0, E = e.length; d < E; d++) {
1596
+ const u = n ? t[a[d].materialIndex].side : c, p = h(this, d, u, s);
1597
1597
  p != null && (r == null || p.distance < r.distance) && (r = p, n && (p.face.materialIndex = a[d].materialIndex));
1598
1598
  }
1599
1599
  return r;
@@ -1615,13 +1615,13 @@ class Si {
1615
1615
  } = s;
1616
1616
  if (n && r) {
1617
1617
  const d = n;
1618
- n = (h, u, p, A, R) => d(h, u, p, A, R) ? !0 : e(h, u, this, r, p, A, t);
1618
+ n = (E, u, p, A, R) => d(E, u, p, A, R) ? !0 : e(E, u, this, r, p, A, t);
1619
1619
  } else
1620
- n || (r ? n = (d, h, u, p) => e(d, h, this, r, u, p, t) : n = (d, h, u) => u);
1620
+ n || (r ? n = (d, E, u, p) => e(d, E, this, r, u, p, t) : n = (d, E, u) => u);
1621
1621
  let a = !1, c = 0;
1622
- const E = this._roots;
1623
- for (let d = 0, h = E.length; d < h; d++) {
1624
- const u = E[d];
1622
+ const h = this._roots;
1623
+ for (let d = 0, E = h.length; d < E; d++) {
1624
+ const u = h[d];
1625
1625
  if (a = _o(this, d, o, n, i, c), a)
1626
1626
  break;
1627
1627
  c += u.byteLength;
@@ -1638,18 +1638,18 @@ class Si {
1638
1638
  et(n, A * 3, r, a);
1639
1639
  } : (p) => {
1640
1640
  et(n, p * 3, r, a);
1641
- }, E = It.getPrimitive(), d = s.geometry.index, h = s.geometry.attributes.position, u = s.indirect ? (p) => {
1641
+ }, h = It.getPrimitive(), d = s.geometry.index, E = s.geometry.attributes.position, u = s.indirect ? (p) => {
1642
1642
  const A = s.resolveTriangleIndex(p);
1643
- et(E, A * 3, d, h);
1643
+ et(h, A * 3, d, E);
1644
1644
  } : (p) => {
1645
- et(E, p * 3, d, h);
1645
+ et(h, p * 3, d, E);
1646
1646
  };
1647
1647
  if (o) {
1648
1648
  const p = (A, R, C, T, F, f, m, O) => {
1649
1649
  for (let S = C, _ = C + T; S < _; S++) {
1650
- u(S), E.a.applyMatrix4(t), E.b.applyMatrix4(t), E.c.applyMatrix4(t), E.needsUpdate = !0;
1650
+ u(S), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
1651
1651
  for (let N = A, L = A + R; N < L; N++)
1652
- if (c(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, O))
1652
+ if (c(N), n.needsUpdate = !0, o(n, h, N, S, F, f, m, O))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
@@ -1987,11 +1987,11 @@ class ur {
1987
1987
  const e = this.faces;
1988
1988
  let i = -1 / 0, o = 1 / 0;
1989
1989
  for (let n = 0, r = e.length; n < r; n++) {
1990
- const a = e[n], c = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
1991
- if (c > 0 && E >= 0)
1990
+ const a = e[n], c = a.distanceToPoint(s.origin), h = a.normal.dot(s.direction);
1991
+ if (c > 0 && h >= 0)
1992
1992
  return null;
1993
- const d = E !== 0 ? -c / E : 0;
1994
- if (!(d <= 0) && (E > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
1993
+ const d = h !== 0 ? -c / h : 0;
1994
+ if (!(d <= 0) && (h > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
1995
1995
  return null;
1996
1996
  }
1997
1997
  return i !== -1 / 0 ? s.at(i, t) : s.at(o, t), t;
@@ -2075,15 +2075,15 @@ class ur {
2075
2075
  computeInitialHull() {
2076
2076
  const s = this.vertices, t = this.computeExtremes(), e = t.min, i = t.max;
2077
2077
  let o = 0, n = 0;
2078
- for (let h = 0; h < 3; h++) {
2079
- const u = i[h].point.getComponent(h) - e[h].point.getComponent(h);
2080
- u > o && (o = u, n = h);
2078
+ for (let E = 0; E < 3; E++) {
2079
+ const u = i[E].point.getComponent(E) - e[E].point.getComponent(E);
2080
+ u > o && (o = u, n = E);
2081
2081
  }
2082
2082
  const r = e[n], a = i[n];
2083
- let c, E;
2083
+ let c, h;
2084
2084
  o = 0, tn.set(r.point, a.point);
2085
- for (let h = 0, u = this.vertices.length; h < u; h++) {
2086
- const p = s[h];
2085
+ for (let E = 0, u = this.vertices.length; E < u; E++) {
2086
+ const p = s[E];
2087
2087
  if (p !== r && p !== a) {
2088
2088
  tn.closestPointToPoint(p.point, !0, en);
2089
2089
  const A = en.distanceToSquared(p.point);
@@ -2091,42 +2091,42 @@ class ur {
2091
2091
  }
2092
2092
  }
2093
2093
  o = -1, qs.setFromCoplanarPoints(r.point, a.point, c.point);
2094
- for (let h = 0, u = this.vertices.length; h < u; h++) {
2095
- const p = s[h];
2094
+ for (let E = 0, u = this.vertices.length; E < u; E++) {
2095
+ const p = s[E];
2096
2096
  if (p !== r && p !== a && p !== c) {
2097
2097
  const A = Math.abs(qs.distanceToPoint(p.point));
2098
- A > o && (o = A, E = p);
2098
+ A > o && (o = A, h = p);
2099
2099
  }
2100
2100
  }
2101
2101
  const d = [];
2102
- if (qs.distanceToPoint(E.point) < 0) {
2102
+ if (qs.distanceToPoint(h.point) < 0) {
2103
2103
  d.push(
2104
2104
  Rt.create(r, a, c),
2105
- Rt.create(E, a, r),
2106
- Rt.create(E, c, a),
2107
- Rt.create(E, r, c)
2105
+ Rt.create(h, a, r),
2106
+ Rt.create(h, c, a),
2107
+ Rt.create(h, r, c)
2108
2108
  );
2109
- for (let h = 0; h < 3; h++) {
2110
- const u = (h + 1) % 3;
2111
- d[h + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[h + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
2109
+ for (let E = 0; E < 3; E++) {
2110
+ const u = (E + 1) % 3;
2111
+ d[E + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[E + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
2112
2112
  }
2113
2113
  } else {
2114
2114
  d.push(
2115
2115
  Rt.create(r, c, a),
2116
- Rt.create(E, r, a),
2117
- Rt.create(E, a, c),
2118
- Rt.create(E, c, r)
2116
+ Rt.create(h, r, a),
2117
+ Rt.create(h, a, c),
2118
+ Rt.create(h, c, r)
2119
2119
  );
2120
- for (let h = 0; h < 3; h++) {
2121
- const u = (h + 1) % 3;
2122
- d[h + 1].getEdge(2).setTwin(d[0].getEdge((3 - h) % 3)), d[h + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
2120
+ for (let E = 0; E < 3; E++) {
2121
+ const u = (E + 1) % 3;
2122
+ d[E + 1].getEdge(2).setTwin(d[0].getEdge((3 - E) % 3)), d[E + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
2123
2123
  }
2124
2124
  }
2125
- for (let h = 0; h < 4; h++)
2126
- this.faces.push(d[h]);
2127
- for (let h = 0, u = s.length; h < u; h++) {
2128
- const p = s[h];
2129
- if (p !== r && p !== a && p !== c && p !== E) {
2125
+ for (let E = 0; E < 4; E++)
2126
+ this.faces.push(d[E]);
2127
+ for (let E = 0, u = s.length; E < u; E++) {
2128
+ const p = s[E];
2129
+ if (p !== r && p !== a && p !== c && p !== h) {
2130
2130
  o = this.tolerance;
2131
2131
  let A = null;
2132
2132
  for (let R = 0; R < 4; R++) {
@@ -2322,15 +2322,15 @@ function Cr(l, s) {
2322
2322
  let t = 0, e = 1;
2323
2323
  const i = l.elements;
2324
2324
  for (let c = 0; c < 3; c++) {
2325
- const E = Math.abs(i[Nt(Ii[c], fi[c])]);
2326
- E > t && (t = E, e = c);
2325
+ const h = Math.abs(i[Nt(Ii[c], fi[c])]);
2326
+ h > t && (t = h, e = c);
2327
2327
  }
2328
2328
  let o = 1, n = 0;
2329
2329
  const r = fi[e], a = Ii[e];
2330
2330
  if (Math.abs(i[Nt(a, r)]) > Number.EPSILON) {
2331
- const c = i[Nt(a, a)], E = i[Nt(r, r)], d = i[Nt(a, r)], h = (c - E) / 2 / d;
2331
+ const c = i[Nt(a, a)], h = i[Nt(r, r)], d = i[Nt(a, r)], E = (c - h) / 2 / d;
2332
2332
  let u;
2333
- h < 0 ? u = -1 / (-h + Math.sqrt(1 + h * h)) : u = 1 / (h + Math.sqrt(1 + h * h)), o = 1 / Math.sqrt(1 + u * u), n = u * o;
2333
+ E < 0 ? u = -1 / (-E + Math.sqrt(1 + E * E)) : u = 1 / (E + Math.sqrt(1 + E * E)), o = 1 / Math.sqrt(1 + u * u), n = u * o;
2334
2334
  }
2335
2335
  return s.identity(), s.elements[Nt(r, r)] = o, s.elements[Nt(a, a)] = o, s.elements[Nt(a, r)] = n, s.elements[Nt(r, a)] = -n, s;
2336
2336
  }
@@ -2368,12 +2368,12 @@ function mr(l) {
2368
2368
  n.push(bs.point.x, bs.point.y, bs.point.z), n.push(vs.point.x, vs.point.y, vs.point.z), n.push(Bs.point.x, Bs.point.y, Bs.point.z);
2369
2369
  }
2370
2370
  }
2371
- const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(), E = new g.Vector3(), d = new g.Vector3(), h = new g.Vector3(), u = new g.Vector3(), p = new g.Vector3();
2371
+ const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(), h = new g.Vector3(), d = new g.Vector3(), E = new g.Vector3(), u = new g.Vector3(), p = new g.Vector3();
2372
2372
  let A = 0, R = 0, C = 0, T = 0, F = 0, f = 0, m = 0;
2373
2373
  for (let it = 0, Zt = n.length; it < Zt; it += 9) {
2374
- r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), E.subVectors(a, r), d.subVectors(c, r);
2375
- const tt = h.crossVectors(E, d).length() / 2;
2376
- p.add(h.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (tt / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (tt / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (tt / 12);
2374
+ r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), h.subVectors(a, r), d.subVectors(c, r);
2375
+ const tt = E.crossVectors(h, d).length() / 2;
2376
+ p.add(E.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (tt / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (tt / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (tt / 12);
2377
2377
  }
2378
2378
  p.divideScalar(A), R /= A, C /= A, T /= A, F /= A, f /= A, m /= A, R -= p.x * p.x, C -= p.x * p.y, T -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, m -= p.z * p.z;
2379
2379
  const O = new g.Matrix3();
@@ -2739,23 +2739,26 @@ class sa extends J {
2739
2739
  getClosestVertex(t) {
2740
2740
  let e = new g.Vector3(), i = !1, o = Number.MAX_SAFE_INTEGER;
2741
2741
  const n = this.getVertices(t);
2742
- return n == null || n.forEach((r) => {
2742
+ if (n === null)
2743
+ return null;
2744
+ for (const r of n) {
2743
2745
  if (!r)
2744
- return;
2746
+ continue;
2745
2747
  const a = t.point.distanceTo(r);
2746
2748
  a > o || a > this._config.snapDistance || (i = !0, e = r, o = t.point.distanceTo(r));
2747
- }), i ? e : this.config.showOnlyVertex ? null : t.point;
2749
+ }
2750
+ return i ? e : this.config.showOnlyVertex ? null : t.point;
2748
2751
  }
2749
2752
  getVertices(t) {
2750
2753
  const e = t.object;
2751
2754
  if (!t.face || !e)
2752
2755
  return null;
2753
- const i = e.geometry;
2754
- return [
2756
+ const i = e.geometry, o = new g.Matrix4(), { instanceId: n } = t, r = n !== void 0, a = e instanceof g.InstancedMesh;
2757
+ return a && r && e.getMatrixAt(n, o), [
2755
2758
  this.getVertex(t.face.a, i),
2756
2759
  this.getVertex(t.face.b, i),
2757
2760
  this.getVertex(t.face.c, i)
2758
- ].map((o) => o == null ? void 0 : o.applyMatrix4(e.matrixWorld));
2761
+ ].map((c) => (c && (a && r && c.applyMatrix4(o), c.applyMatrix4(e.matrixWorld)), c));
2759
2762
  }
2760
2763
  getVertex(t, e) {
2761
2764
  if (t === void 0)
@@ -3184,25 +3187,25 @@ function Es(l, s, t, e, i = 1 / 0, o) {
3184
3187
  e = Math.max(1e-4, e);
3185
3188
  const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
3186
3189
  let c = l - s;
3187
- const E = s, d = i * e;
3190
+ const h = s, d = i * e;
3188
3191
  c = mt(c, -d, d), s = l - c;
3189
- const h = (t.value + n * c) * o;
3190
- t.value = (t.value - n * h) * a;
3191
- let u = s + (c + h) * a;
3192
- return E - l > 0 == u > E && (u = E, t.value = (u - E) / o), u;
3192
+ const E = (t.value + n * c) * o;
3193
+ t.value = (t.value - n * E) * a;
3194
+ let u = s + (c + E) * a;
3195
+ return h - l > 0 == u > h && (u = h, t.value = (u - h) / o), u;
3193
3196
  }
3194
3197
  function an(l, s, t, e, i = 1 / 0, o, n) {
3195
3198
  e = Math.max(1e-4, e);
3196
3199
  const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3197
- let E = s.x, d = s.y, h = s.z, u = l.x - E, p = l.y - d, A = l.z - h;
3198
- const R = E, C = d, T = h, F = i * e, f = F * F, m = u * u + p * p + A * A;
3200
+ let h = s.x, d = s.y, E = s.z, u = l.x - h, p = l.y - d, A = l.z - E;
3201
+ const R = h, C = d, T = E, F = i * e, f = F * F, m = u * u + p * p + A * A;
3199
3202
  if (m > f) {
3200
3203
  const B = Math.sqrt(m);
3201
3204
  u = u / B * F, p = p / B * F, A = A / B * F;
3202
3205
  }
3203
- E = l.x - u, d = l.y - p, h = l.z - A;
3206
+ h = l.x - u, d = l.y - p, E = l.z - A;
3204
3207
  const O = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * A) * o;
3205
- t.x = (t.x - r * O) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = E + (u + O) * c, n.y = d + (p + S) * c, n.z = h + (A + _) * c;
3208
+ t.x = (t.x - r * O) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = h + (u + O) * c, n.y = d + (p + S) * c, n.z = E + (A + _) * c;
3206
3209
  const N = R - l.x, L = C - l.y, M = T - l.z, y = n.x - R, x = n.y - C, b = n.z - T;
3207
3210
  return N * y + L * x + M * b > 0 && (n.x = R, n.y = C, n.z = T, t.x = (n.x - R) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
3208
3211
  }
@@ -3408,7 +3411,7 @@ class ot extends gr {
3408
3411
  deltaY: 0,
3409
3412
  mouseButton: m
3410
3413
  };
3411
- this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", E), this._isDragging = !0, A(f);
3414
+ this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, A(f);
3412
3415
  }, r = (f) => {
3413
3416
  if (!this._enabled || !this._domElement || this._lockedPointer)
3414
3417
  return;
@@ -3454,7 +3457,7 @@ class ot extends gr {
3454
3457
  }, c = (f) => {
3455
3458
  const m = this._lockedPointer || this._findPointerById(1);
3456
3459
  m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), R());
3457
- }, E = (f) => {
3460
+ }, h = (f) => {
3458
3461
  const m = this._findPointerById(f.pointerId);
3459
3462
  if (!(m && m === this._lockedPointer)) {
3460
3463
  if (m && this._disposePointer(m), f.pointerType === "touch")
@@ -3480,7 +3483,7 @@ class ot extends gr {
3480
3483
  const f = this._findPointerById(1);
3481
3484
  f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = P.NONE, C());
3482
3485
  };
3483
- let h = -1;
3486
+ let E = -1;
3484
3487
  const u = (f) => {
3485
3488
  if (!this._domElement || !this._enabled || this.mouseButtons.wheel === P.NONE)
3486
3489
  return;
@@ -3491,7 +3494,7 @@ class ot extends gr {
3491
3494
  }
3492
3495
  if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === P.ROTATE || this.mouseButtons.wheel === P.TRUCK) {
3493
3496
  const N = performance.now();
3494
- h - N < 1e3 && this._getClientRect(this._elementRect), h = N;
3497
+ E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
3495
3498
  }
3496
3499
  const m = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / m : f.deltaY / (m * 10), S = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3497
3500
  switch (this.mouseButtons.wheel) {
@@ -3521,7 +3524,7 @@ class ot extends gr {
3521
3524
  if (!(!this._domElement || !this._enabled)) {
3522
3525
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3523
3526
  const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(m);
3524
- O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3527
+ O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3525
3528
  return;
3526
3529
  }
3527
3530
  f.preventDefault();
@@ -3569,7 +3572,7 @@ class ot extends gr {
3569
3572
  }
3570
3573
  ((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, S, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3571
3574
  }, C = () => {
3572
- Ks(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3575
+ Ks(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3573
3576
  };
3574
3577
  this.lockPointer = () => {
3575
3578
  !this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
@@ -3579,7 +3582,7 @@ class ot extends gr {
3579
3582
  deltaX: 0,
3580
3583
  deltaY: 0,
3581
3584
  mouseButton: null
3582
- }, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener("pointerlockchange", T), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", E), A());
3585
+ }, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener("pointerlockchange", T), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), A());
3583
3586
  }, this.unlockPointer = () => {
3584
3587
  this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), document.exitPointerLock(), this.cancel(), this._domElement && (this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3585
3588
  };
@@ -3589,9 +3592,9 @@ class ot extends gr {
3589
3592
  this.unlockPointer();
3590
3593
  };
3591
3594
  this._addAllEventListeners = (f) => {
3592
- this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Nr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
3595
+ this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Nr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
3593
3596
  }, this._removeAllEventListeners = () => {
3594
- this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", E), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3597
+ this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", h), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3595
3598
  }, this.cancel = () => {
3596
3599
  this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
3597
3600
  }, t && this.connect(t), this.update(0);
@@ -3958,12 +3961,12 @@ class ot extends gr {
3958
3961
  fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
3959
3962
  const a = [], c = s.isBox3 ? ue.copy(s) : ue.setFromObject(s);
3960
3963
  c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
3961
- const E = rn(this._sphericalEnd.theta, on), d = rn(this._sphericalEnd.phi, on);
3962
- a.push(this.rotateTo(E, d, t));
3963
- const h = G.setFromSpherical(this._sphericalEnd).normalize(), u = dn.setFromUnitVectors(h, ti), p = k(Math.abs(h.y), 1);
3964
- p && u.multiply(si.setFromAxisAngle(us, E)), u.multiply(this._yAxisUpSpaceInverse);
3964
+ const h = rn(this._sphericalEnd.theta, on), d = rn(this._sphericalEnd.phi, on);
3965
+ a.push(this.rotateTo(h, d, t));
3966
+ const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = dn.setFromUnitVectors(E, ti), p = k(Math.abs(E.y), 1);
3967
+ p && u.multiply(si.setFromAxisAngle(us, h)), u.multiply(this._yAxisUpSpaceInverse);
3965
3968
  const A = En.makeEmpty();
3966
- z.copy(c.min).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(ti, h), p && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
3969
+ z.copy(c.min).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(ti, E), p && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
3967
3970
  const R = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
3968
3971
  if (Qt(this._camera)) {
3969
3972
  const T = this.getDistanceToFitBox(R.x, R.y, R.z, e);
@@ -4006,8 +4009,8 @@ class ot extends gr {
4006
4009
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
4007
4010
  const a = z.set(i, o, n), c = G.set(s, t, e);
4008
4011
  this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4009
- const E = !r || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4010
- return this._createOnRestPromise(E);
4012
+ const h = !r || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4013
+ return this._createOnRestPromise(h);
4011
4014
  }
4012
4015
  /**
4013
4016
  * Similar to setLookAt, but it interpolates between two states.
@@ -4027,11 +4030,11 @@ class ot extends gr {
4027
4030
  * @param enableTransition
4028
4031
  * @category Methods
4029
4032
  */
4030
- lerpLookAt(s, t, e, i, o, n, r, a, c, E, d, h, u, p = !1) {
4033
+ lerpLookAt(s, t, e, i, o, n, r, a, c, h, d, E, u, p = !1) {
4031
4034
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
4032
4035
  const A = G.set(i, o, n), R = z.set(s, t, e);
4033
4036
  dt.setFromVector3(R.sub(A).applyQuaternion(this._yAxisUpSpace));
4034
- const C = de.set(E, d, h), T = z.set(r, a, c);
4037
+ const C = de.set(h, d, E), T = z.set(r, a, c);
4035
4038
  we.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
4036
4039
  const F = we.theta - dt.theta, f = we.phi - dt.phi, m = we.radius - dt.radius;
4037
4040
  this._sphericalEnd.set(dt.radius + m * u, dt.phi + f * u, dt.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
@@ -4277,9 +4280,9 @@ class ot extends gr {
4277
4280
  }
4278
4281
  if (this.dollyToCursor) {
4279
4282
  if (Qt(this._camera) && this._changedDolly !== 0) {
4280
- const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(h.up).normalize();
4283
+ const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(E.up).normalize();
4281
4284
  p.lengthSq() === 0 && (p.x = 1);
4282
- const A = z.crossVectors(p, u), R = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * Ne * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = de.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * R * h.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * R)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === he.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === he.OUT && this.maxDistance <= this._spherical.radius;
4285
+ const A = z.crossVectors(p, u), R = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Ne * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = de.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * R * E.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * R)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === he.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === he.OUT && this.maxDistance <= this._spherical.radius;
4283
4286
  if (this.infinityDolly && (m || O)) {
4284
4287
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4285
4288
  const _ = z.copy(u).multiplyScalar(-d);
@@ -4289,7 +4292,7 @@ class ot extends gr {
4289
4292
  const S = z.subVectors(f, this._targetEnd);
4290
4293
  this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4291
4294
  } else if (bt(this._camera) && this._changedZoom !== 0) {
4292
- const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), A = de.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(ye), F = this._targetEnd.dot(T), f = G.copy(this._targetEnd).lerp(A, C), m = f.dot(T), O = T.multiplyScalar(m - F);
4295
+ const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), p = z.set(0, 0, -1).applyQuaternion(E.quaternion), A = de.copy(u).add(p.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(ye), F = this._targetEnd.dot(T), f = G.copy(this._targetEnd).lerp(A, C), m = f.dot(T), O = T.multiplyScalar(m - F);
4293
4296
  f.sub(O), this._boundary.clampPoint(f, f);
4294
4297
  const S = z.subVectors(f, this._targetEnd);
4295
4298
  this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
@@ -4298,8 +4301,8 @@ class ot extends gr {
4298
4301
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
4299
4302
  const a = this._collisionTest();
4300
4303
  this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrix, 0), St.setFromMatrixColumn(this._camera.matrix, 1), jt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), St.multiplyScalar(-this._focalOffset.y), jt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(St).add(jt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4301
- const E = this._needsUpdate;
4302
- return E && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : E ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !E && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = E, this._needsUpdate = !1, E;
4304
+ const h = this._needsUpdate;
4305
+ return h && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : h ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !h && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = h, this._needsUpdate = !1, h;
4303
4306
  }
4304
4307
  /**
4305
4308
  * Get all state in JSON string
@@ -4490,9 +4493,9 @@ class ot extends gr {
4490
4493
  return;
4491
4494
  const r = n, a = r.geometry.clone();
4492
4495
  a.applyMatrix4(r.matrixWorld);
4493
- const E = a.attributes.position;
4494
- for (let d = 0, h = E.count; d < h; d++)
4495
- G.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(G));
4496
+ const h = a.attributes.position;
4497
+ for (let d = 0, E = h.count; d < E; d++)
4498
+ G.fromBufferAttribute(h, d), o = Math.max(o, i.distanceToSquared(G));
4496
4499
  }), e.radius = Math.sqrt(o), e;
4497
4500
  }
4498
4501
  }
@@ -4801,9 +4804,6 @@ class Pr {
4801
4804
  set fade(s) {
4802
4805
  this._fade = s ? 3 : 0, this.material.uniforms.uFade.value = this._fade;
4803
4806
  }
4804
- [Symbol.dispose]() {
4805
- throw new Error("Method not implemented.");
4806
- }
4807
4807
  /** {@link Disposable.dispose} */
4808
4808
  dispose() {
4809
4809
  this.setupEvents(!1), this.components.get(Ht).destroy(this.three), this.onDisposed.trigger(), this.onDisposed.reset(), this.world = null, this.components = null;
@@ -4875,8 +4875,8 @@ class Lr extends ri {
4875
4875
  }), o[T] = F, i[T] = F, e[T] = F;
4876
4876
  }
4877
4877
  n("camera", s), n("object", void 0), n("enabled", !0), n("axis", null), n("mode", "translate"), n("translationSnap", null), n("rotationSnap", null), n("scaleSnap", null), n("space", "world"), n("size", 1), n("dragging", !1), n("showX", !0), n("showY", !0), n("showZ", !0);
4878
- const r = new w(), a = new w(), c = new Pt(), E = new Pt(), d = new w(), h = new Pt(), u = new w(), p = new w(), A = new w(), R = 0, C = new w();
4879
- n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", R), n("eye", C), this._offset = new w(), this._startNorm = new w(), this._endNorm = new w(), this._cameraScale = new w(), this._parentPosition = new w(), this._parentQuaternion = new Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new w(), this._worldScaleStart = new w(), this._worldQuaternionInv = new Pt(), this._worldScale = new w(), this._positionStart = new w(), this._quaternionStart = new Pt(), this._scaleStart = new w(), this._getPointer = yr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = wr.bind(this), this._onPointerMove = Dr.bind(this), this._onPointerUp = Ur.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
4878
+ const r = new w(), a = new w(), c = new Pt(), h = new Pt(), d = new w(), E = new Pt(), u = new w(), p = new w(), A = new w(), R = 0, C = new w();
4879
+ n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", h), n("cameraPosition", d), n("cameraQuaternion", E), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", R), n("eye", C), this._offset = new w(), this._startNorm = new w(), this._endNorm = new w(), this._cameraScale = new w(), this._parentPosition = new w(), this._parentQuaternion = new Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new w(), this._worldScaleStart = new w(), this._worldQuaternionInv = new Pt(), this._worldScale = new w(), this._positionStart = new w(), this._quaternionStart = new Pt(), this._scaleStart = new w(), this._getPointer = yr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = wr.bind(this), this._onPointerMove = Dr.bind(this), this._onPointerUp = Ur.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
4880
4880
  }
4881
4881
  // updateMatrixWorld updates key transformation variables
4882
4882
  updateMatrixWorld() {
@@ -5038,12 +5038,12 @@ class xr extends ri {
5038
5038
  a.color.setHex(16711680), a.opacity = 0.5;
5039
5039
  const c = s.clone();
5040
5040
  c.color.setHex(65280), c.opacity = 0.5;
5041
- const E = s.clone();
5042
- E.color.setHex(255), E.opacity = 0.5;
5041
+ const h = s.clone();
5042
+ h.color.setHex(255), h.opacity = 0.5;
5043
5043
  const d = s.clone();
5044
5044
  d.opacity = 0.25;
5045
- const h = s.clone();
5046
- h.color.setHex(16776960), h.opacity = 0.25, s.clone().color.setHex(16776960);
5045
+ const E = s.clone();
5046
+ E.color.setHex(16776960), E.opacity = 0.25, s.clone().color.setHex(16776960);
5047
5047
  const p = s.clone();
5048
5048
  p.color.setHex(7895160);
5049
5049
  const A = new ct(0, 0.04, 0.1, 12);
@@ -5082,7 +5082,7 @@ class xr extends ri {
5082
5082
  [new v(new Qe(0.1, 0), d.clone()), [0, 0, 0]]
5083
5083
  ],
5084
5084
  XY: [
5085
- [new v(new rt(0.15, 0.15, 0.01), E.clone()), [0.15, 0.15, 0]]
5085
+ [new v(new rt(0.15, 0.15, 0.01), h.clone()), [0.15, 0.15, 0]]
5086
5086
  ],
5087
5087
  YZ: [
5088
5088
  [new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
@@ -5148,7 +5148,7 @@ class xr extends ri {
5148
5148
  [new v(F(0.5, 0.5), r), null, [0, Math.PI / 2, 0]]
5149
5149
  ],
5150
5150
  E: [
5151
- [new v(F(0.75, 1), h), null, [0, Math.PI / 2, 0]]
5151
+ [new v(F(0.75, 1), E), null, [0, Math.PI / 2, 0]]
5152
5152
  ]
5153
5153
  }, N = {
5154
5154
  AXIS: [
@@ -5187,7 +5187,7 @@ class xr extends ri {
5187
5187
  [new v(R, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
5188
5188
  ],
5189
5189
  XY: [
5190
- [new v(new rt(0.15, 0.15, 0.01), E), [0.15, 0.15, 0]]
5190
+ [new v(new rt(0.15, 0.15, 0.01), h), [0.15, 0.15, 0]]
5191
5191
  ],
5192
5192
  YZ: [
5193
5193
  [new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
@@ -5853,22 +5853,22 @@ class Gr extends Vr {
5853
5853
  let a;
5854
5854
  if (Array.isArray(o)) {
5855
5855
  let d = !0;
5856
- const h = [];
5856
+ const E = [];
5857
5857
  for (const u of o)
5858
- nn.isTransparent(u) ? h.push(this._transparentMat) : (d = !1, h.push(n));
5858
+ nn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
5859
5859
  if (d) {
5860
5860
  n.dispose(), this.isProcessing = !1;
5861
5861
  return;
5862
5862
  }
5863
- a = h;
5863
+ a = E;
5864
5864
  } else if (nn.isTransparent(o)) {
5865
5865
  n.dispose(), this.isProcessing = !1;
5866
5866
  return;
5867
5867
  } else
5868
5868
  a = n;
5869
5869
  this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
5870
- const c = e ? t.count : 1, E = new g.InstancedMesh(i, a, c);
5871
- e ? E.instanceMatrix = t.instanceMatrix : E.setMatrixAt(0, new g.Matrix4()), t.visible = !1, E.applyMatrix4(t.matrix), E.updateMatrix(), this.scene.add(E), this.colorMeshes.set(t.uuid, E), this.increaseColor(), this.isProcessing = !1;
5870
+ const c = e ? t.count : 1, h = new g.InstancedMesh(i, a, c);
5871
+ e ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new g.Matrix4()), t.visible = !1, h.applyMatrix4(t.matrix), h.updateMatrix(), this.scene.add(h), this.colorMeshes.set(t.uuid, h), this.increaseColor(), this.isProcessing = !1;
5872
5872
  }
5873
5873
  remove(t) {
5874
5874
  if (this.isProcessing) {
@@ -6288,10 +6288,10 @@ class oa extends ke {
6288
6288
  }
6289
6289
  const a = new g.Box3(n, r), c = new g.Vector3();
6290
6290
  a.getSize(c);
6291
- const E = new g.Vector3();
6292
- a.getCenter(E);
6293
- const d = Math.max(c.x, c.y, c.z) * e, h = new g.Sphere(E, d);
6294
- await this.controls.fitToSphere(h, !0);
6291
+ const h = new g.Vector3();
6292
+ a.getCenter(h);
6293
+ const d = Math.max(c.x, c.y, c.z) * e, E = new g.Sphere(h, d);
6294
+ await this.controls.fitToSphere(E, !0);
6295
6295
  }
6296
6296
  /**
6297
6297
  * Allows or prevents all user input.
@@ -6389,16 +6389,16 @@ const At = class At extends J {
6389
6389
  const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
6390
6390
  if (e && t instanceof Vt.FragmentMesh)
6391
6391
  for (const c of e) {
6392
- const E = t.fragment.getInstancesIDs(c);
6393
- if (E)
6394
- for (const d of E)
6392
+ const h = t.fragment.getInstancesIDs(c);
6393
+ if (h)
6394
+ for (const d of h)
6395
6395
  a.add(d);
6396
6396
  }
6397
6397
  else
6398
6398
  a.add(0);
6399
6399
  for (const c of a) {
6400
- const E = i.min.clone(), d = i.max.clone();
6401
- r && (t.getMatrixAt(c, n), E.applyMatrix4(n), d.applyMatrix4(n)), E.applyMatrix4(o), d.applyMatrix4(o), E.x < this._absoluteMin.x && (this._absoluteMin.x = E.x), E.y < this._absoluteMin.y && (this._absoluteMin.y = E.y), E.z < this._absoluteMin.z && (this._absoluteMin.z = E.z), E.x > this._absoluteMax.x && (this._absoluteMax.x = E.x), E.y > this._absoluteMax.y && (this._absoluteMax.y = E.y), E.z > this._absoluteMax.z && (this._absoluteMax.z = E.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
6400
+ const h = i.min.clone(), d = i.max.clone();
6401
+ r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
6402
6402
  }
6403
6403
  }
6404
6404
  static getFragmentBounds(t) {
@@ -6411,8 +6411,8 @@ const At = class At extends J {
6411
6411
  c += 2;
6412
6412
  continue;
6413
6413
  }
6414
- const E = a[c], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
6415
- d < n.x && (n.x = d), h < n.y && (n.y = h), u < n.z && (n.z = u), d > r.x && (r.x = d), h > r.y && (r.y = h), u > r.z && (r.z = u);
6414
+ const h = a[c], d = e.getX(h), E = e.getY(h), u = e.getZ(h);
6415
+ d < n.x && (n.x = d), E < n.y && (n.y = E), u < n.z && (n.z = u), d > r.x && (r.x = d), E > r.y && (r.y = E), u > r.z && (r.z = u);
6416
6416
  }
6417
6417
  return new g.Box3(n, r);
6418
6418
  }
@@ -6581,9 +6581,9 @@ const Li = /* @__PURE__ */ new Set([
6581
6581
  for (const c of r) {
6582
6582
  if (Li.has(c))
6583
6583
  continue;
6584
- const E = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
6585
- for (const h of d) {
6586
- const u = t.GetLine(0, h, E, i);
6584
+ const h = a.has(c) && o, d = t.GetLineIDsWithType(e, c);
6585
+ for (const E of d) {
6586
+ const u = t.GetLine(0, E, h, i);
6587
6587
  n[u.expressID] = u;
6588
6588
  }
6589
6589
  }
@@ -6639,10 +6639,11 @@ const Ps = class Ps extends J {
6639
6639
  * @returns The loaded FragmentsGroup.
6640
6640
  */
6641
6641
  load(t, e) {
6642
- const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n, properties: r, relationsMap: a } = o, c = this._loader.import(t);
6643
- for (const E of c.items)
6644
- E.group = c, this.list.set(E.id, E);
6645
- return n && this.coordinate([c]), this.groups.set(c.uuid, c), r && c.setLocalProperties(r), a && this.components.get(We).setRelationMap(c, a), this.onFragmentsLoaded.trigger(c), c;
6642
+ const o = { ...{ coordinate: !0 }, ...e }, { coordinate: n, name: r, properties: a, relationsMap: c } = o, h = this._loader.import(t);
6643
+ r && (h.name = r);
6644
+ for (const d of h.items)
6645
+ d.group = h, this.list.set(d.id, d);
6646
+ return n && this.coordinate([h]), this.groups.set(h.uuid, h), a && h.setLocalProperties(a), c && this.components.get(We).setRelationMap(h, c), this.onFragmentsLoaded.trigger(h), h;
6646
6647
  }
6647
6648
  /**
6648
6649
  * Export the specified fragments.
@@ -7977,8 +7978,8 @@ class Gt {
7977
7978
  const a = await s.getProperties(r.value);
7978
7979
  if (!a || !a.UnitType || !a.UnitType.value || a.UnitType.value !== "LENGTHUNIT")
7979
7980
  continue;
7980
- let E = 1, d = 1;
7981
- return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (E = 1e-3), d * E;
7981
+ let h = 1, d = 1;
7982
+ return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (h = 1e-3), d * h;
7982
7983
  }
7983
7984
  return 1;
7984
7985
  }
@@ -7997,17 +7998,17 @@ class Gt {
7997
7998
  const o = e ?? (async () => {
7998
7999
  }), n = {}, r = s.getAllPropertiesIDs();
7999
8000
  for (const c of r) {
8000
- const E = await s.getProperties(c);
8001
- if (!E)
8001
+ const h = await s.getProperties(c);
8002
+ if (!h)
8002
8003
  continue;
8003
- const d = E.type === t, h = Object.keys(E).find(
8004
+ const d = h.type === t, E = Object.keys(h).find(
8004
8005
  (C) => C.startsWith("Relating")
8005
- ), u = Object.keys(E).find(
8006
+ ), u = Object.keys(h).find(
8006
8007
  (C) => C.startsWith("Related")
8007
8008
  );
8008
- if (!(d && h && u))
8009
+ if (!(d && E && u))
8009
8010
  continue;
8010
- const p = await s.getProperties((a = E[h]) == null ? void 0 : a.value), A = E[u];
8011
+ const p = await s.getProperties((a = h[E]) == null ? void 0 : a.value), A = h[u];
8011
8012
  if (!p || !A || !(A && Array.isArray(A)))
8012
8013
  continue;
8013
8014
  const R = A.map((C) => C.value);
@@ -8249,11 +8250,11 @@ const Qr = /* @__PURE__ */ new Map([
8249
8250
  const r = this._relToAttributesMap.get(i);
8250
8251
  if (!r)
8251
8252
  return;
8252
- const { forRelated: a, forRelating: c } = r, E = e.get(o) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(c);
8253
- E.set(d, n), e.set(o, E);
8254
- for (const h of n) {
8255
- const u = e.get(h) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(a), A = u.get(p) ?? [];
8256
- A.push(o), u.set(p, A), e.set(h, u);
8253
+ const { forRelated: a, forRelating: c } = r, h = e.get(o) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(c);
8254
+ h.set(d, n), e.set(o, h);
8255
+ for (const E of n) {
8256
+ const u = e.get(E) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(a), A = u.get(p) ?? [];
8257
+ A.push(o), u.set(p, A), e.set(E, u);
8257
8258
  }
8258
8259
  }
8259
8260
  );
@@ -8274,18 +8275,18 @@ const Qr = /* @__PURE__ */ new Map([
8274
8275
  if (!n)
8275
8276
  continue;
8276
8277
  const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
8277
- for (let E = 0; E < c.size(); E++) {
8278
+ for (let h = 0; h < c.size(); h++) {
8278
8279
  const d = await t.properties.getItemProperties(
8279
8280
  e,
8280
- c.get(E)
8281
- ), h = Object.keys(d).find(
8281
+ c.get(h)
8282
+ ), E = Object.keys(d).find(
8282
8283
  (T) => T.startsWith("Relating")
8283
8284
  ), u = Object.keys(d).find(
8284
8285
  (T) => T.startsWith("Related")
8285
8286
  );
8286
- if (!(h && u))
8287
+ if (!(E && u))
8287
8288
  continue;
8288
- const p = d[h].value, A = d[u].map((T) => T.value), R = i.get(p) ?? /* @__PURE__ */ new Map(), C = this._inverseAttributes.indexOf(a);
8289
+ const p = d[E].value, A = d[u].map((T) => T.value), R = i.get(p) ?? /* @__PURE__ */ new Map(), C = this._inverseAttributes.indexOf(a);
8289
8290
  R.set(C, A), i.set(p, R);
8290
8291
  for (const T of A) {
8291
8292
  const F = i.get(T) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(r), m = F.get(f) ?? [];
@@ -8483,48 +8484,48 @@ class Yn {
8483
8484
  e.add(i.get(c));
8484
8485
  const o = s.GetLineIDsWithType(0, U.IFCRELAGGREGATES), n = o.size();
8485
8486
  for (let c = 0; c < n; c++) {
8486
- const E = o.get(c), d = s.GetLine(0, E);
8487
+ const h = o.get(c), d = s.GetLine(0, h);
8487
8488
  if (!d || !d.RelatingObject || !d.RelatedObjects)
8488
8489
  continue;
8489
- const h = d.RelatingObject.value, u = d.RelatedObjects;
8490
+ const E = d.RelatingObject.value, u = d.RelatedObjects;
8490
8491
  for (const p of u) {
8491
8492
  const A = p.value;
8492
- e.has(A) && (this.itemsByFloor[A] = h);
8493
+ e.has(A) && (this.itemsByFloor[A] = E);
8493
8494
  }
8494
8495
  }
8495
8496
  const r = {}, a = t.size();
8496
8497
  for (let c = 0; c < a; c++) {
8497
- const E = t.get(c), d = s.GetLine(0, E);
8498
+ const h = t.get(c), d = s.GetLine(0, h);
8498
8499
  if (!d || !d.RelatingStructure || !d.RelatedElements)
8499
8500
  continue;
8500
- const h = d.RelatingStructure.value, u = d.RelatedElements;
8501
- if (e.has(h))
8501
+ const E = d.RelatingStructure.value, u = d.RelatedElements;
8502
+ if (e.has(E))
8502
8503
  for (const p of u) {
8503
- r[h] || (r[h] = []);
8504
+ r[E] || (r[E] = []);
8504
8505
  const A = p.value;
8505
- r[h].push(A);
8506
+ r[E].push(A);
8506
8507
  }
8507
8508
  else
8508
8509
  for (const p of u) {
8509
8510
  const A = p.value;
8510
- this.itemsByFloor[A] = h;
8511
+ this.itemsByFloor[A] = E;
8511
8512
  }
8512
8513
  }
8513
8514
  for (const c in r) {
8514
- const E = this.itemsByFloor[c];
8515
- if (E !== void 0) {
8515
+ const h = this.itemsByFloor[c];
8516
+ if (h !== void 0) {
8516
8517
  const d = r[c];
8517
- for (const h of d)
8518
- this.itemsByFloor[h] = E;
8518
+ for (const E of d)
8519
+ this.itemsByFloor[E] = h;
8519
8520
  }
8520
8521
  }
8521
8522
  for (let c = 0; c < n; c++) {
8522
- const E = o.get(c), d = s.GetLine(0, E);
8523
+ const h = o.get(c), d = s.GetLine(0, h);
8523
8524
  if (!d || !d.RelatingObject || !d.RelatedObjects)
8524
8525
  continue;
8525
- const h = d.RelatingObject.value, u = d.RelatedObjects;
8526
+ const E = d.RelatingObject.value, u = d.RelatedObjects;
8526
8527
  for (const p of u) {
8527
- const A = p.value, R = this.itemsByFloor[h];
8528
+ const A = p.value, R = this.itemsByFloor[E];
8528
8529
  R !== void 0 && (this.itemsByFloor[A] = R);
8529
8530
  }
8530
8531
  }
@@ -8594,22 +8595,22 @@ class Vn {
8594
8595
  for (const o of s) {
8595
8596
  const n = {};
8596
8597
  if (o.data)
8597
- for (const h of o.data) {
8598
- const [u, p] = h.split(": "), A = parseFloat(p);
8598
+ for (const E of o.data) {
8599
+ const [u, p] = E.split(": "), A = parseFloat(p);
8599
8600
  n[u] = A || p;
8600
8601
  }
8601
8602
  const { points: r } = o, a = new Float32Array(r.length * 3);
8602
- for (let h = 0; h < r.length; h++) {
8603
- const { x: u, y: p, z: A } = r[h];
8604
- a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = A || 0;
8603
+ for (let E = 0; E < r.length; E++) {
8604
+ const { x: u, y: p, z: A } = r[E];
8605
+ a[E * 3] = u, a[E * 3 + 1] = p, a[E * 3 + 2] = A || 0;
8605
8606
  }
8606
- const c = new g.BufferAttribute(a, 3), E = new g.EdgesGeometry();
8607
- E.setAttribute("position", c);
8607
+ const c = new g.BufferAttribute(a, 3), h = new g.EdgesGeometry();
8608
+ h.setAttribute("position", c);
8608
8609
  const d = new Vt.CurveMesh(
8609
8610
  i,
8610
8611
  n,
8611
8612
  t,
8612
- E,
8613
+ h,
8613
8614
  this.defLineMat
8614
8615
  );
8615
8616
  e.push(d.curve), i++;
@@ -8618,19 +8619,38 @@ class Vn {
8618
8619
  }
8619
8620
  }
8620
8621
  class Gn {
8621
- get(s, t) {
8622
- let e = "";
8623
- const i = s.GetHeaderLine(0, t) || "";
8624
- if (!i)
8625
- return e;
8626
- for (const o of i.arguments)
8627
- if (o != null)
8628
- if (Array.isArray(o))
8629
- for (const n of o)
8630
- e += `${n.value}|`;
8631
- else
8632
- e += `${o.value}|`;
8633
- return e;
8622
+ getNameInfo(s) {
8623
+ var d;
8624
+ const t = {}, { arguments: e } = s.GetHeaderLine(0, U.FILE_NAME) || {};
8625
+ if (!e)
8626
+ return t;
8627
+ const [
8628
+ i,
8629
+ o,
8630
+ n,
8631
+ r,
8632
+ a,
8633
+ c,
8634
+ h
8635
+ ] = e;
8636
+ if (i != null && i.value && (t.name = i.value), o != null && o.value && (t.creationDate = new Date(o.value)), n) {
8637
+ t.author = {};
8638
+ const [E, u] = n;
8639
+ E != null && E.value && (t.author.name = E.value), u != null && u.value && (t.author.email = u.value);
8640
+ }
8641
+ return (d = r[0]) != null && d.value && (t.organization = r[0].value), a != null && a.value && (t.preprocessorVersion = a == null ? void 0 : a.value), c != null && c.value && (t.originatingSystem = c == null ? void 0 : c.value), h != null && h.value && (t.authorization = h == null ? void 0 : h.value), t;
8642
+ }
8643
+ getDescriptionInfo(s) {
8644
+ var n;
8645
+ const t = {}, { arguments: e } = s.GetHeaderLine(0, U.FILE_DESCRIPTION) || {};
8646
+ if (!e)
8647
+ return t;
8648
+ const [i, o] = e;
8649
+ if ((n = i[0]) != null && n.value) {
8650
+ const r = i[0].value.match(/\[([^\]]+)\]/);
8651
+ r[1] && (t.viewDefinition = r[1]);
8652
+ }
8653
+ return o != null && o.value && (t.implementationLevel = o.value), t;
8634
8654
  }
8635
8655
  }
8636
8656
  const Ge = class Ge extends J {
@@ -8678,43 +8698,45 @@ const Ge = class Ge extends J {
8678
8698
  }
8679
8699
  async getAllGeometries() {
8680
8700
  this._spatialTree.setUp(this.webIfc);
8681
- const t = this.webIfc.GetIfcEntityList(0), e = new Vt.FragmentsGroup(), { FILE_NAME: i, FILE_DESCRIPTION: o } = U;
8701
+ const t = this.webIfc.GetIfcEntityList(0), e = new Vt.FragmentsGroup();
8682
8702
  e.ifcMetadata = {
8683
- name: this._metaData.get(this.webIfc, i),
8684
- description: this._metaData.get(this.webIfc, o),
8703
+ name: "",
8704
+ description: "",
8705
+ ...this._metaData.getNameInfo(this.webIfc),
8706
+ ...this._metaData.getDescriptionInfo(this.webIfc),
8685
8707
  schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
8686
8708
  maxExpressID: this.webIfc.GetMaxExpressID(0)
8687
8709
  };
8688
- const n = [];
8689
- for (const a of t) {
8690
- if (!this.webIfc.IsIfcElement(a) && a !== U.IFCSPACE || this.settings.excludedCategories.has(a))
8710
+ const i = [];
8711
+ for (const n of t) {
8712
+ if (!this.webIfc.IsIfcElement(n) && n !== U.IFCSPACE || this.settings.excludedCategories.has(n))
8691
8713
  continue;
8692
- const c = this.webIfc.GetLineIDsWithType(0, a), E = c.size();
8693
- for (let d = 0; d < E; d++) {
8694
- const h = c.get(d);
8695
- n.push(h);
8696
- const u = this._spatialTree.itemsByFloor[h] || 0;
8697
- e.data.set(h, [[], [u, a]]);
8714
+ const r = this.webIfc.GetLineIDsWithType(0, n), a = r.size();
8715
+ for (let c = 0; c < a; c++) {
8716
+ const h = r.get(c);
8717
+ i.push(h);
8718
+ const d = this._spatialTree.itemsByFloor[h] || 0;
8719
+ e.data.set(h, [[], [d, n]]);
8698
8720
  }
8699
8721
  }
8700
- this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0, n, (a) => {
8701
- this.getMesh(a, e);
8722
+ this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0, i, (n) => {
8723
+ this.getMesh(n, e);
8702
8724
  });
8703
- for (const a of this._visitedFragments) {
8704
- const { index: c, fragment: E } = a[1];
8705
- e.keyFragments.set(c, E.id);
8725
+ for (const n of this._visitedFragments) {
8726
+ const { index: r, fragment: a } = n[1];
8727
+ e.keyFragments.set(r, a.id);
8706
8728
  }
8707
- for (const a of e.items) {
8708
- const c = this._fragmentInstances.get(a.id);
8709
- if (!c)
8729
+ for (const n of e.items) {
8730
+ const r = this._fragmentInstances.get(n.id);
8731
+ if (!r)
8710
8732
  throw new Error("Fragment not found!");
8711
- const E = [];
8712
- for (const [d, h] of c)
8713
- E.push(h);
8714
- a.add(E);
8733
+ const a = [];
8734
+ for (const [c, h] of r)
8735
+ a.push(h);
8736
+ n.add(a);
8715
8737
  }
8716
- const r = this.webIfc.GetCoordinationMatrix(0);
8717
- return e.coordinationMatrix.fromArray(r), e.civilData = this._civil.read(this.webIfc), e;
8738
+ const o = this.webIfc.GetCoordinationMatrix(0);
8739
+ return e.coordinationMatrix.fromArray(o), e.civilData = this._civil.read(this.webIfc), e;
8718
8740
  }
8719
8741
  cleanUp() {
8720
8742
  this.webIfc = null, this.webIfc = new U.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
@@ -8722,14 +8744,14 @@ const Ge = class Ge extends J {
8722
8744
  getMesh(t, e) {
8723
8745
  const i = t.geometries.size(), o = t.expressID;
8724
8746
  for (let n = 0; n < i; n++) {
8725
- const r = t.geometries.get(n), { x: a, y: c, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
8747
+ const r = t.geometries.get(n), { x: a, y: c, z: h, w: d } = r.color, E = d !== 1, { geometryExpressID: u } = r, p = `${u}-${E}`;
8726
8748
  if (!this._visitedFragments.has(p)) {
8727
- const m = this.getGeometry(this.webIfc, u), O = h ? this._materialT : this._material, S = new Vt.Fragment(m, O, 1);
8749
+ const m = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, S = new Vt.Fragment(m, O, 1);
8728
8750
  e.add(S.mesh), e.items.push(S);
8729
8751
  const _ = this._visitedFragments.size;
8730
8752
  this._visitedFragments.set(p, { index: _, fragment: S });
8731
8753
  }
8732
- const A = new g.Color().setRGB(a, c, E, "srgb"), R = new g.Matrix4();
8754
+ const A = new g.Color().setRGB(a, c, h, "srgb"), R = new g.Matrix4();
8733
8755
  R.fromArray(r.flatTransformation);
8734
8756
  const C = this._visitedFragments.get(p);
8735
8757
  if (C === void 0)
@@ -8760,10 +8782,10 @@ const Ge = class Ge extends J {
8760
8782
  i.GetVertexData(),
8761
8783
  i.GetVertexDataSize()
8762
8784
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
8763
- for (let h = 0; h < n.length; h += 6)
8764
- r[h / 2] = n[h], r[h / 2 + 1] = n[h + 1], r[h / 2 + 2] = n[h + 2], a[h / 2] = n[h + 3], a[h / 2 + 1] = n[h + 4], a[h / 2 + 2] = n[h + 5];
8765
- const c = new g.BufferGeometry(), E = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
8766
- return c.setAttribute("position", E), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
8785
+ for (let E = 0; E < n.length; E += 6)
8786
+ r[E / 2] = n[E], r[E / 2 + 1] = n[E + 1], r[E / 2 + 2] = n[E + 2], a[E / 2] = n[E + 3], a[E / 2 + 1] = n[E + 4], a[E / 2 + 2] = n[E + 5];
8787
+ const c = new g.BufferGeometry(), h = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
8788
+ return c.setAttribute("position", h), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
8767
8789
  }
8768
8790
  async autoSetWasm() {
8769
8791
  const t = await fetch(
@@ -8846,23 +8868,23 @@ const Bt = class Bt extends J {
8846
8868
  }
8847
8869
  }
8848
8870
  async newPset(t, e, i) {
8849
- const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new U[o].IfcLabel(e), c = i ? new U[o].IfcText(i) : null, E = new U[o].IfcPropertySet(
8871
+ const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new U[o].IfcLabel(e), c = i ? new U[o].IfcText(i) : null, h = new U[o].IfcPropertySet(
8850
8872
  r,
8851
8873
  n,
8852
8874
  a,
8853
8875
  c,
8854
8876
  []
8855
8877
  );
8856
- E.expressID = this.increaseMaxID(t);
8857
- const d = this.newGUID(t), h = new U[o].IfcRelDefinesByProperties(
8878
+ h.expressID = this.increaseMaxID(t);
8879
+ const d = this.newGUID(t), E = new U[o].IfcRelDefinesByProperties(
8858
8880
  d,
8859
8881
  n,
8860
8882
  null,
8861
8883
  null,
8862
8884
  [],
8863
- new U.Handle(E.expressID)
8885
+ new U.Handle(h.expressID)
8864
8886
  );
8865
- return h.expressID = this.increaseMaxID(t), await this.setData(t, E, h), { pset: E, rel: h };
8887
+ return E.expressID = this.increaseMaxID(t), await this.setData(t, h, E), { pset: h, rel: E };
8866
8888
  }
8867
8889
  async removePset(t, ...e) {
8868
8890
  for (const i of e) {
@@ -8931,10 +8953,10 @@ const Bt = class Bt extends J {
8931
8953
  async saveToIfc(t, e) {
8932
8954
  const i = this.components.get(Ri), o = i.webIfc, n = await i.readIfcFile(e), r = this.changeMap[t.uuid] ?? [];
8933
8955
  for (const c of r) {
8934
- const E = await t.getProperties(c);
8935
- if (E)
8956
+ const h = await t.getProperties(c);
8957
+ if (h)
8936
8958
  try {
8937
- o.WriteLine(n, E);
8959
+ o.WriteLine(n, h);
8938
8960
  } catch {
8939
8961
  }
8940
8962
  else
@@ -8967,8 +8989,8 @@ const Bt = class Bt extends J {
8967
8989
  get() {
8968
8990
  return this._value;
8969
8991
  },
8970
- async set(E) {
8971
- this._value = E, c.trigger(E);
8992
+ async set(h) {
8993
+ this._value = h, c.trigger(h);
8972
8994
  }
8973
8995
  }), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = c, c;
8974
8996
  }
@@ -8992,8 +9014,8 @@ const Ls = class Ls extends J {
8992
9014
  else
8993
9015
  for (const a of r) {
8994
9016
  const c = n[a];
8995
- for (const E of i)
8996
- delete c[E];
9017
+ for (const h of i)
9018
+ delete c[h];
8997
9019
  Object.values(c).length === 0 && delete n[a];
8998
9020
  }
8999
9021
  }
@@ -9028,13 +9050,13 @@ const Ls = class Ls extends J {
9028
9050
  continue;
9029
9051
  }
9030
9052
  for (const c of a) {
9031
- const E = this.list[r][c];
9032
- if (E)
9033
- for (const d in E) {
9053
+ const h = this.list[r][c];
9054
+ if (h)
9055
+ for (const d in h) {
9034
9056
  o[d] || (o[d] = /* @__PURE__ */ new Map());
9035
- for (const h of E[d]) {
9036
- const u = o[d].get(h);
9037
- u === void 0 ? o[d].set(h, 1) : o[d].set(h, u + 1);
9057
+ for (const E of h[d]) {
9058
+ const u = o[d].get(E);
9059
+ u === void 0 ? o[d].set(E, 1) : o[d].set(E, u + 1);
9038
9060
  }
9039
9061
  }
9040
9062
  }
@@ -9042,10 +9064,10 @@ const Ls = class Ls extends J {
9042
9064
  const n = {};
9043
9065
  for (const r in o) {
9044
9066
  const a = o[r];
9045
- for (const [c, E] of a) {
9046
- if (E === void 0)
9067
+ for (const [c, h] of a) {
9068
+ if (h === void 0)
9047
9069
  throw new Error("Malformed fragments map!");
9048
- E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
9070
+ h === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
9049
9071
  }
9050
9072
  }
9051
9073
  return n;
@@ -9058,8 +9080,8 @@ const Ls = class Ls extends J {
9058
9080
  for (const [n, r] of e.data) {
9059
9081
  const a = r[0];
9060
9082
  for (const c of a) {
9061
- const E = e.keyFragments.get(c);
9062
- E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
9083
+ const h = e.keyFragments.get(c);
9084
+ h && (o[h] || (o[h] = /* @__PURE__ */ new Set()), o[h].add(n));
9063
9085
  }
9064
9086
  }
9065
9087
  }
@@ -9074,9 +9096,9 @@ const Ls = class Ls extends J {
9074
9096
  const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
9075
9097
  e[a] || (e[a] = {});
9076
9098
  const c = e[a];
9077
- for (const [E, d] of t.data) {
9078
- const h = d[0];
9079
- for (const u of h) {
9099
+ for (const [h, d] of t.data) {
9100
+ const E = d[0];
9101
+ for (const u of E) {
9080
9102
  const p = t.keyFragments.get(u);
9081
9103
  if (!p)
9082
9104
  throw new Error("Fragment ID not found!");
@@ -9127,17 +9149,17 @@ const Ls = class Ls extends J {
9127
9149
  ), c = await t.getProperties(r);
9128
9150
  if (!(a && c))
9129
9151
  continue;
9130
- const E = (n = c.Name) == null ? void 0 : n.value;
9152
+ const h = (n = c.Name) == null ? void 0 : n.value;
9131
9153
  for (const d of a) {
9132
- this.saveItem(t, o, E, d);
9133
- const h = e.getEntityRelations(
9154
+ this.saveItem(t, o, h, d);
9155
+ const E = e.getEntityRelations(
9134
9156
  t,
9135
9157
  Number(d),
9136
9158
  "IsDecomposedBy"
9137
9159
  );
9138
- if (h)
9139
- for (const u of h)
9140
- this.saveItem(t, o, E, u);
9160
+ if (E)
9161
+ for (const u of E)
9162
+ this.saveItem(t, o, h, u);
9141
9163
  }
9142
9164
  }
9143
9165
  }
@@ -9198,12 +9220,12 @@ const ys = class ys extends J {
9198
9220
  const r = e.list[this.groupName], a = new g.Matrix4();
9199
9221
  for (const c in r) {
9200
9222
  a.elements[13] = n * o * this.height;
9201
- for (const E in r[c]) {
9202
- const d = i.list.get(E), h = c + E, u = this.list.has(h);
9223
+ for (const h in r[c]) {
9224
+ const d = i.list.get(h), E = c + h, u = this.list.has(E);
9203
9225
  if (!d || t && u || !t && !u)
9204
9226
  continue;
9205
- t ? this.list.add(h) : this.list.delete(h);
9206
- const p = r[c][E];
9227
+ t ? this.list.add(E) : this.list.delete(E);
9228
+ const p = r[c][h];
9207
9229
  d.applyTransform(p, a);
9208
9230
  }
9209
9231
  n++;
@@ -9304,47 +9326,47 @@ class $r extends J {
9304
9326
  U.IFCBUILDINGSTOREY,
9305
9327
  U.IFCSPACE
9306
9328
  ]);
9307
- for (const E of n)
9308
- e.add(E);
9329
+ for (const h of n)
9330
+ e.add(h);
9309
9331
  let r = 0.01, a = 0;
9310
- for (const E of e) {
9311
- if (a++, Li.has(E))
9332
+ for (const h of e) {
9333
+ if (a++, Li.has(h))
9312
9334
  continue;
9313
- const d = n.has(E), h = this.webIfc.GetLineIDsWithType(0, E), u = h.size();
9335
+ const d = n.has(h), E = this.webIfc.GetLineIDsWithType(0, h), u = E.size();
9314
9336
  let p = 0;
9315
9337
  for (let R = 0; R < u - t; R += t) {
9316
9338
  const C = {};
9317
9339
  for (let T = 0; T < t; T++) {
9318
9340
  p++;
9319
- const F = h.get(R + T);
9341
+ const F = E.get(R + T);
9320
9342
  try {
9321
9343
  const f = this.webIfc.GetLine(0, F, d);
9322
- i.includes(E) && this.getIndices(f, F, o), C[f.expressID] = f;
9344
+ i.includes(h) && this.getIndices(f, F, o), C[f.expressID] = f;
9323
9345
  } catch {
9324
9346
  console.log(`Could not get property: ${F}`);
9325
9347
  }
9326
9348
  }
9327
- await this.onPropertiesStreamed.trigger({ type: E, data: C });
9349
+ await this.onPropertiesStreamed.trigger({ type: h, data: C });
9328
9350
  }
9329
9351
  if (p !== u) {
9330
9352
  const R = {};
9331
9353
  for (let C = p; C < u; C++) {
9332
- const T = h.get(C);
9354
+ const T = E.get(C);
9333
9355
  try {
9334
9356
  const F = this.webIfc.GetLine(0, T, d);
9335
- i.includes(E) && this.getIndices(F, T, o), R[F.expressID] = F;
9357
+ i.includes(h) && this.getIndices(F, T, o), R[F.expressID] = F;
9336
9358
  } catch {
9337
9359
  console.log(`Could not get property: ${T}`);
9338
9360
  }
9339
9361
  }
9340
- await this.onPropertiesStreamed.trigger({ type: E, data: R });
9362
+ await this.onPropertiesStreamed.trigger({ type: h, data: R });
9341
9363
  }
9342
9364
  const A = a / e.size;
9343
9365
  A > r && (r += 0.01, r = Math.max(r, A), await this.onProgress.trigger(Math.round(r * 100) / 100));
9344
9366
  }
9345
9367
  const c = [];
9346
- for (const [E, d] of o)
9347
- c.push([E, ...d]);
9368
+ for (const [h, d] of o)
9369
+ c.push([h, ...d]);
9348
9370
  await this.onIndicesStreamed.trigger(c);
9349
9371
  }
9350
9372
  getIndices(t, e, i) {
@@ -9419,49 +9441,50 @@ const Ms = class Ms extends J {
9419
9441
  async streamAllGeometries() {
9420
9442
  const { minGeometrySize: t, minAssetsSize: e } = this.settings;
9421
9443
  this._spatialTree.setUp(this.webIfc);
9422
- const i = this.webIfc.GetIfcEntityList(0), o = [[]], n = new Vt.FragmentsGroup(), { FILE_NAME: r, FILE_DESCRIPTION: a } = U;
9444
+ const i = this.webIfc.GetIfcEntityList(0), o = [[]], n = new Vt.FragmentsGroup();
9423
9445
  n.ifcMetadata = {
9424
- name: this._metaData.get(this.webIfc, r),
9425
- description: this._metaData.get(this.webIfc, a),
9446
+ name: "",
9447
+ description: "",
9448
+ ...this._metaData.getNameInfo(this.webIfc),
9449
+ ...this._metaData.getDescriptionInfo(this.webIfc),
9426
9450
  schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
9427
9451
  maxExpressID: this.webIfc.GetMaxExpressID(0)
9428
9452
  };
9429
- let c = 0, E = 0;
9430
- for (const T of i) {
9431
- if (!this.webIfc.IsIfcElement(T) && T !== U.IFCSPACE || this.settings.excludedCategories.has(T))
9453
+ let r = 0, a = 0;
9454
+ for (const R of i) {
9455
+ if (!this.webIfc.IsIfcElement(R) && R !== U.IFCSPACE || this.settings.excludedCategories.has(R))
9432
9456
  continue;
9433
- const F = this.webIfc.GetLineIDsWithType(0, T), f = F.size();
9434
- console.log(f);
9435
- for (let m = 0; m < f; m++) {
9436
- c > t && (c = 0, E++, o.push([]));
9437
- const O = F.get(m);
9438
- o[E].push(O);
9439
- const S = this._spatialTree.itemsByFloor[O] || 0;
9440
- n.data.set(O, [[], [S, T]]), c++;
9457
+ const C = this.webIfc.GetLineIDsWithType(0, R), T = C.size();
9458
+ for (let F = 0; F < T; F++) {
9459
+ r > t && (r = 0, a++, o.push([]));
9460
+ const f = C.get(F);
9461
+ o[a].push(f);
9462
+ const m = this._spatialTree.itemsByFloor[f] || 0;
9463
+ n.data.set(f, [[], [m, R]]), r++;
9441
9464
  }
9442
9465
  }
9443
9466
  this._spatialTree.cleanUp();
9444
- let d = 0.01, h = 0;
9445
- for (const T of o) {
9446
- h++, this.webIfc.StreamMeshes(0, T, (f) => {
9447
- this.getMesh(this.webIfc, f, n);
9467
+ let c = 0.01, h = 0;
9468
+ for (const R of o) {
9469
+ h++, this.webIfc.StreamMeshes(0, R, (T) => {
9470
+ this.getMesh(this.webIfc, T, n);
9448
9471
  }), this._geometryCount > t && await this.streamGeometries(), this._assets.length > e && await this.streamAssets();
9449
- const F = h / o.length;
9450
- F > d && (d += 0.01, d = Math.max(d, F), this.onProgress.trigger(Math.round(d * 100) / 100));
9472
+ const C = h / o.length;
9473
+ C > c && (c += 0.01, c = Math.max(c, C), this.onProgress.trigger(Math.round(c * 100) / 100));
9451
9474
  }
9452
9475
  this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
9453
- const { opaque: u, transparent: p } = n.geometryIDs;
9454
- for (const [T, { index: F, uuid: f }] of this._visitedGeometries)
9455
- n.keyFragments.set(F, f), (T > 1 ? u : p).set(T, F);
9456
- const A = n.data.keys();
9457
- for (const T of A) {
9458
- const [F] = n.data.get(T);
9459
- F.length || n.data.delete(T);
9460
- }
9461
- const R = this.webIfc.GetCoordinationMatrix(0);
9462
- n.coordinationMatrix.fromArray(R), n.civilData = this._civil.read(this.webIfc);
9463
- const C = this._groupSerializer.export(n);
9464
- this.onIfcLoaded.trigger(C), n.dispose(!0);
9476
+ const { opaque: d, transparent: E } = n.geometryIDs;
9477
+ for (const [R, { index: C, uuid: T }] of this._visitedGeometries)
9478
+ n.keyFragments.set(C, T), (R > 1 ? d : E).set(R, C);
9479
+ const u = n.data.keys();
9480
+ for (const R of u) {
9481
+ const [C] = n.data.get(R);
9482
+ C.length || n.data.delete(R);
9483
+ }
9484
+ const p = this.webIfc.GetCoordinationMatrix(0);
9485
+ n.coordinationMatrix.fromArray(p), n.civilData = this._civil.read(this.webIfc);
9486
+ const A = this._groupSerializer.export(n);
9487
+ this.onIfcLoaded.trigger(A), n.dispose(!0);
9465
9488
  }
9466
9489
  cleanUp() {
9467
9490
  this.webIfc = null, this.webIfc = new U.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
@@ -9469,13 +9492,13 @@ const Ms = class Ms extends J {
9469
9492
  getMesh(t, e, i) {
9470
9493
  const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
9471
9494
  for (let a = 0; a < o; a++) {
9472
- const c = e.geometries.get(a), E = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, h = E * d;
9473
- if (!this._visitedGeometries.has(h)) {
9474
- this._visitedGeometries.has(E) || this.getGeometry(t, E);
9495
+ const c = e.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
9496
+ if (!this._visitedGeometries.has(E)) {
9497
+ this._visitedGeometries.has(h) || this.getGeometry(t, h);
9475
9498
  const m = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
9476
- this._visitedGeometries.set(h, { uuid: O, index: m });
9499
+ this._visitedGeometries.set(E, { uuid: O, index: m });
9477
9500
  }
9478
- const u = this._visitedGeometries.get(h);
9501
+ const u = this._visitedGeometries.get(E);
9479
9502
  if (u === void 0)
9480
9503
  throw new Error("Error getting geometry data for streaming!");
9481
9504
  const p = i.data.get(n);
@@ -9483,7 +9506,7 @@ const Ms = class Ms extends J {
9483
9506
  throw new Error("Data not found!");
9484
9507
  p[0].push(u.index);
9485
9508
  const { x: A, y: R, z: C, w: T } = c.color, F = [A, R, C, T], f = c.flatTransformation;
9486
- r.geometries.push({ color: F, geometryID: E, transformation: f });
9509
+ r.geometries.push({ color: F, geometryID: h, transformation: f });
9487
9510
  }
9488
9511
  this._assets.push(r);
9489
9512
  }
@@ -9497,12 +9520,12 @@ const Ms = class Ms extends J {
9497
9520
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
9498
9521
  for (let u = 0; u < n.length; u += 6)
9499
9522
  r[u / 2] = n[u], r[u / 2 + 1] = n[u + 1], r[u / 2 + 2] = n[u + 2], a[u / 2] = n[u + 3], a[u / 2 + 1] = n[u + 4], a[u / 2 + 2] = n[u + 5];
9500
- const c = mr(r), E = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
9501
- let h = !1;
9523
+ const c = mr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
9524
+ let E = !1;
9502
9525
  for (let u = 0; u < r.length - 2; u += 3) {
9503
9526
  const p = r[u], A = r[u + 1], R = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
9504
9527
  if (Rr(d, [p, A, R], [C, T, F])) {
9505
- h = !0;
9528
+ E = !0;
9506
9529
  break;
9507
9530
  }
9508
9531
  }
@@ -9510,8 +9533,8 @@ const Ms = class Ms extends J {
9510
9533
  position: r,
9511
9534
  normal: a,
9512
9535
  index: o,
9513
- boundingBox: E,
9514
- hasHoles: h
9536
+ boundingBox: h,
9537
+ hasHoles: E
9515
9538
  }), i.delete(), this._geometryCount++;
9516
9539
  }
9517
9540
  async streamAssets() {
@@ -9571,15 +9594,15 @@ class Kr extends J {
9571
9594
  for (const c of e) {
9572
9595
  if (n++, Li.has(c))
9573
9596
  continue;
9574
- const E = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), h = d.size();
9597
+ const h = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), E = d.size();
9575
9598
  let u = 0;
9576
- for (let A = 0; A < h - t; A += t) {
9599
+ for (let A = 0; A < E - t; A += t) {
9577
9600
  const R = {};
9578
9601
  for (let C = 0; C < t; C++) {
9579
9602
  u++;
9580
9603
  const T = d.get(A + C);
9581
9604
  try {
9582
- const F = this.webIfc.GetLine(0, T, E);
9605
+ const F = this.webIfc.GetLine(0, T, h);
9583
9606
  R[F.expressID] = F;
9584
9607
  } catch {
9585
9608
  console.log(`Could not get property: ${T}`);
@@ -9587,12 +9610,12 @@ class Kr extends J {
9587
9610
  }
9588
9611
  await this.onPropertiesStreamed.trigger({ type: c, data: R });
9589
9612
  }
9590
- if (u !== h) {
9613
+ if (u !== E) {
9591
9614
  const A = {};
9592
- for (let R = u; R < h; R++) {
9615
+ for (let R = u; R < E; R++) {
9593
9616
  const C = d.get(R);
9594
9617
  try {
9595
- const T = this.webIfc.GetLine(0, C, E);
9618
+ const T = this.webIfc.GetLine(0, C, h);
9596
9619
  A[T.expressID] = T;
9597
9620
  } catch {
9598
9621
  console.log(`Could not get property: ${C}`);
@@ -9625,60 +9648,60 @@ const Ds = class Ds extends J {
9625
9648
  i,
9626
9649
  t
9627
9650
  ), a = [];
9628
- for (let h = 0; h < n.length / 3; h++) {
9629
- const { plane: u, edges: p } = this.getFaceData(h, i, t);
9651
+ for (let E = 0; E < n.length / 3; E++) {
9652
+ const { plane: u, edges: p } = this.getFaceData(E, i, t);
9630
9653
  if (u.equals(r)) {
9631
- a.push({ index: h, edges: p });
9654
+ a.push({ index: E, edges: p });
9632
9655
  for (const { id: A, points: R, distance: C } of p)
9633
9656
  o.set(A, { points: R, distance: C });
9634
9657
  }
9635
9658
  }
9636
9659
  let c = 0;
9637
- const E = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
9638
- for (const { index: h, edges: u } of a) {
9660
+ const h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
9661
+ for (const { index: E, edges: u } of a) {
9639
9662
  const p = /* @__PURE__ */ new Map();
9640
9663
  for (const { id: m } of u)
9641
- if (E.has(m)) {
9642
- const O = E.get(m);
9664
+ if (h.has(m)) {
9665
+ const O = h.get(m);
9643
9666
  p.set(m, O);
9644
9667
  }
9645
9668
  const A = u.map((m) => m.id);
9646
9669
  if (!p.size) {
9647
9670
  const m = c++;
9648
9671
  for (const { id: O } of u)
9649
- E.set(O, m);
9672
+ h.set(O, m);
9650
9673
  d.set(m, {
9651
9674
  edges: new Set(A),
9652
- indices: /* @__PURE__ */ new Set([h])
9675
+ indices: /* @__PURE__ */ new Set([E])
9653
9676
  });
9654
9677
  continue;
9655
9678
  }
9656
9679
  let R = null;
9657
9680
  const C = /* @__PURE__ */ new Set(), T = new Set(A);
9658
9681
  for (const [m, O] of p) {
9659
- R === null ? R = O : O !== R && C.add(O), E.delete(m);
9682
+ R === null ? R = O : O !== R && C.add(O), h.delete(m);
9660
9683
  const { edges: S } = d.get(O);
9661
9684
  S.delete(m), T.delete(m);
9662
9685
  }
9663
9686
  if (R === null)
9664
9687
  throw new Error("Error computing face!");
9665
9688
  const F = d.get(R), { indices: f } = F;
9666
- f.add(h);
9689
+ f.add(E);
9667
9690
  for (const m of T) {
9668
- E.set(m, R);
9691
+ h.set(m, R);
9669
9692
  const { edges: O } = F;
9670
9693
  O.add(m);
9671
9694
  }
9672
9695
  for (const m of C) {
9673
9696
  const O = d.get(m), { edges: S, indices: _ } = O, N = d.get(R), { edges: L, indices: M } = N;
9674
9697
  for (const y of S)
9675
- L.add(y), E.set(y, R);
9698
+ L.add(y), h.set(y, R);
9676
9699
  for (const y of _)
9677
9700
  M.add(y);
9678
9701
  d.delete(m);
9679
9702
  }
9680
9703
  }
9681
- for (const [h, { indices: u, edges: p }] of d)
9704
+ for (const [E, { indices: u, edges: p }] of d)
9682
9705
  if (u.has(e)) {
9683
9706
  const A = [];
9684
9707
  for (const R of p) {
@@ -9696,21 +9719,21 @@ const Ds = class Ds extends J {
9696
9719
  getFaceData(t, e, i) {
9697
9720
  const o = this.getVerticesAndNormal(i, t, e), { p1: n, p2: r, p3: a, faceNormal: c } = o;
9698
9721
  this.round(n), this.round(r), this.round(a), this.round(c);
9699
- const E = [
9722
+ const h = [
9700
9723
  { id: `${n.x}|${n.y}|${n.z}`, value: n },
9701
9724
  { id: `${r.x}|${r.y}|${r.z}`, value: r },
9702
9725
  { id: `${a.x}|${a.y}|${a.z}`, value: a }
9703
9726
  ];
9704
- E.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
9727
+ h.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
9705
9728
  const [
9706
- { id: d, value: h },
9729
+ { id: d, value: E },
9707
9730
  { id: u, value: p },
9708
9731
  { id: A, value: R }
9709
- ] = E, C = [
9732
+ ] = h, C = [
9710
9733
  {
9711
9734
  id: `${d}|${u}`,
9712
- distance: h.distanceTo(p),
9713
- points: [h, p]
9735
+ distance: E.distanceTo(p),
9736
+ points: [E, p]
9714
9737
  },
9715
9738
  {
9716
9739
  id: `${u}|${A}`,
@@ -9719,8 +9742,8 @@ const Ds = class Ds extends J {
9719
9742
  },
9720
9743
  {
9721
9744
  id: `${d}|${A}`,
9722
- distance: h.distanceTo(R),
9723
- points: [h, R]
9745
+ distance: E.distanceTo(R),
9746
+ points: [E, R]
9724
9747
  }
9725
9748
  ], T = new g.Plane();
9726
9749
  return T.setFromNormalAndCoplanarPoint(c, n), T.constant = Math.round(T.constant * 10) / 10, { plane: T, edges: C };
@@ -9728,14 +9751,14 @@ const Ds = class Ds extends J {
9728
9751
  getVerticesAndNormal(t, e, i) {
9729
9752
  if (!t.geometry.index)
9730
9753
  throw new Error("Geometry must be indexed!");
9731
- const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, E = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), h = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[E], n[E + 1], n[E + 2]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[c], r[c + 1], r[c + 2]), R = new g.Vector3(r[E], r[E + 1], r[E + 2]), C = (p.x + A.x + R.x) / 3, T = (p.y + A.y + R.y) / 3, F = (p.z + A.z + R.z) / 3, f = new g.Vector3(C, T, F);
9754
+ const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), E = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[h], n[h + 1], n[h + 2]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[c], r[c + 1], r[c + 2]), R = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (p.x + A.x + R.x) / 3, T = (p.y + A.y + R.y) / 3, F = (p.z + A.z + R.z) / 3, f = new g.Vector3(C, T, F);
9732
9755
  if (i !== void 0 && t instanceof g.InstancedMesh) {
9733
9756
  const m = new g.Matrix4();
9734
9757
  t.getMatrixAt(i, m);
9735
9758
  const O = new g.Matrix4();
9736
- O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m), h.applyMatrix4(m), u.applyMatrix4(m);
9759
+ O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m), E.applyMatrix4(m), u.applyMatrix4(m);
9737
9760
  }
9738
- return { p1: d, p2: h, p3: u, faceNormal: f };
9761
+ return { p1: d, p2: E, p3: u, faceNormal: f };
9739
9762
  }
9740
9763
  round(t) {
9741
9764
  t.x = Math.trunc(t.x * 1e3) / 1e3, t.y = Math.trunc(t.y * 1e3) / 1e3, t.z = Math.trunc(t.z * 1e3) / 1e3;