@thatopen/components 2.0.0-alpha.6 → 2.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,131 +1,131 @@
1
1
  var vn = Object.defineProperty;
2
- var Bn = (c, s, t) => s in c ? vn(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
3
- var I = (c, s, t) => (Bn(c, typeof s != "symbol" ? s + "" : s, t), t);
2
+ var Bn = (l, s, t) => s in l ? vn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
3
+ var I = (l, s, t) => (Bn(l, typeof s != "symbol" ? s + "" : s, t), t);
4
4
  import * as O from "three";
5
- import { BufferAttribute as An, Vector3 as M, Vector2 as fe, Plane as pi, Line3 as Lt, Triangle as ue, Sphere as Yn, Matrix4 as Mt, Box3 as Ot, BackSide as Vn, DoubleSide as Fn, FrontSide as _i, Mesh as v, Ray as Gn, Raycaster as zn, Quaternion as yt, Object3D as ei, Euler as Hn, MeshBasicMaterial as gn, LineBasicMaterial as kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Ni, Float32BufferAttribute as Pi, OctahedronGeometry as Qe, Line as Ut, SphereGeometry as Wn, TorusGeometry as me, PlaneGeometry as Xn } from "three";
5
+ import { BufferAttribute as An, Vector3 as M, Vector2 as fe, Plane as pi, Line3 as Pt, Triangle as ue, Sphere as Yn, Matrix4 as Mt, Box3 as Ot, BackSide as Gn, DoubleSide as Fn, FrontSide as _i, Mesh as v, Ray as Vn, Raycaster as zn, Quaternion as Lt, Object3D as ei, Euler as Hn, MeshBasicMaterial as gn, LineBasicMaterial as kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Ni, Float32BufferAttribute as yi, OctahedronGeometry as Qe, Line as Ut, SphereGeometry as Wn, TorusGeometry as me, PlaneGeometry as Xn } from "three";
6
6
  import * as b from "web-ifc";
7
7
  import * as $t from "@thatopen/fragments";
8
8
  import { Serializer as Zn } from "@thatopen/fragments";
9
- const On = 0, Qn = 1, jn = 2, yi = 2, Us = 1.25, Li = 1, Ts = 6 * 4 + 4 + 4, ys = 65535, qn = Math.pow(2, -24), xs = Symbol("SKIP_GENERATION");
10
- function $n(c) {
11
- return c.index ? c.index.count : c.attributes.position.count;
9
+ const On = 0, Qn = 1, jn = 2, Li = 2, Us = 1.25, Pi = 1, Ts = 6 * 4 + 4 + 4, Ls = 65535, qn = Math.pow(2, -24), xs = Symbol("SKIP_GENERATION");
10
+ function $n(l) {
11
+ return l.index ? l.index.count : l.attributes.position.count;
12
12
  }
13
- function pe(c) {
14
- return $n(c) / 3;
13
+ function pe(l) {
14
+ return $n(l) / 3;
15
15
  }
16
- function Kn(c, s = ArrayBuffer) {
17
- return c > 65535 ? new Uint32Array(new s(4 * c)) : new Uint16Array(new s(2 * c));
16
+ function Kn(l, s = ArrayBuffer) {
17
+ return l > 65535 ? new Uint32Array(new s(4 * l)) : new Uint16Array(new s(2 * l));
18
18
  }
19
- function Jn(c, s) {
20
- if (!c.index) {
21
- const t = c.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = Kn(t, e);
22
- c.setIndex(new An(i, 1));
19
+ function Jn(l, s) {
20
+ if (!l.index) {
21
+ const t = l.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = Kn(t, e);
22
+ l.setIndex(new An(i, 1));
23
23
  for (let o = 0; o < t; o++)
24
24
  i[o] = o;
25
25
  }
26
26
  }
27
- function Sn(c) {
28
- const s = pe(c), t = c.drawRange, e = t.start / 3, i = (t.start + t.count) / 3, o = Math.max(0, e), n = Math.min(s, i) - o;
27
+ function Sn(l) {
28
+ const s = pe(l), t = l.drawRange, e = t.start / 3, i = (t.start + t.count) / 3, o = Math.max(0, e), n = Math.min(s, i) - o;
29
29
  return [{
30
30
  offset: Math.floor(o),
31
31
  count: Math.floor(n)
32
32
  }];
33
33
  }
34
- function _n(c) {
35
- if (!c.groups || !c.groups.length)
36
- return Sn(c);
37
- const s = [], t = /* @__PURE__ */ new Set(), e = c.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
38
- for (const r of c.groups) {
39
- const a = r.start / 3, l = (r.start + r.count) / 3;
40
- t.add(Math.max(i, a)), t.add(Math.min(o, l));
34
+ function _n(l) {
35
+ if (!l.groups || !l.groups.length)
36
+ return Sn(l);
37
+ const s = [], t = /* @__PURE__ */ new Set(), e = l.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
38
+ for (const r of l.groups) {
39
+ const a = r.start / 3, c = (r.start + r.count) / 3;
40
+ t.add(Math.max(i, a)), t.add(Math.min(o, c));
41
41
  }
42
42
  const n = Array.from(t.values()).sort((r, a) => r - a);
43
43
  for (let r = 0; r < n.length - 1; r++) {
44
- const a = n[r], l = n[r + 1];
44
+ const a = n[r], c = n[r + 1];
45
45
  s.push({
46
46
  offset: Math.floor(a),
47
- count: Math.floor(l - a)
47
+ count: Math.floor(c - a)
48
48
  });
49
49
  }
50
50
  return s;
51
51
  }
52
- function to(c) {
53
- if (c.groups.length === 0)
52
+ function to(l) {
53
+ if (l.groups.length === 0)
54
54
  return !1;
55
- const s = pe(c), t = _n(c).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
55
+ const s = pe(l), t = _n(l).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
56
56
  e.count = Math.min(s - e.offset, e.count);
57
57
  let i = 0;
58
58
  return t.forEach(({ count: o }) => i += o), s !== i;
59
59
  }
60
- function $(c, s, t) {
61
- return t.min.x = s[c], t.min.y = s[c + 1], t.min.z = s[c + 2], t.max.x = s[c + 3], t.max.y = s[c + 4], t.max.z = s[c + 5], t;
60
+ function $(l, s, t) {
61
+ return t.min.x = s[l], t.min.y = s[l + 1], t.min.z = s[l + 2], t.max.x = s[l + 3], t.max.y = s[l + 4], t.max.z = s[l + 5], t;
62
62
  }
63
- function eo(c) {
64
- c[0] = c[1] = c[2] = 1 / 0, c[3] = c[4] = c[5] = -1 / 0;
63
+ function eo(l) {
64
+ l[0] = l[1] = l[2] = 1 / 0, l[3] = l[4] = l[5] = -1 / 0;
65
65
  }
66
- function Mi(c) {
66
+ function Mi(l) {
67
67
  let s = -1, t = -1 / 0;
68
68
  for (let e = 0; e < 3; e++) {
69
- const i = c[e + 3] - c[e];
69
+ const i = l[e + 3] - l[e];
70
70
  i > t && (t = i, s = e);
71
71
  }
72
72
  return s;
73
73
  }
74
- function wi(c, s) {
75
- s.set(c);
74
+ function wi(l, s) {
75
+ s.set(l);
76
76
  }
77
- function Di(c, s, t) {
77
+ function Di(l, s, t) {
78
78
  let e, i;
79
79
  for (let o = 0; o < 3; o++) {
80
80
  const n = o + 3;
81
- e = c[o], i = s[o], t[o] = e < i ? e : i, e = c[n], i = s[n], t[n] = e > i ? e : i;
81
+ e = l[o], i = s[o], t[o] = e < i ? e : i, e = l[n], i = s[n], t[n] = e > i ? e : i;
82
82
  }
83
83
  }
84
- function je(c, s, t) {
84
+ function je(l, s, t) {
85
85
  for (let e = 0; e < 3; e++) {
86
- const i = s[c + 2 * e], o = s[c + 2 * e + 1], n = i - o, r = i + o;
86
+ const i = s[l + 2 * e], o = s[l + 2 * e + 1], n = i - o, r = i + o;
87
87
  n < t[e] && (t[e] = n), r > t[e + 3] && (t[e + 3] = r);
88
88
  }
89
89
  }
90
- function Re(c) {
91
- const s = c[3] - c[0], t = c[4] - c[1], e = c[5] - c[2];
90
+ function Re(l) {
91
+ const s = l[3] - l[0], t = l[4] - l[1], e = l[5] - l[2];
92
92
  return 2 * (s * t + t * e + e * s);
93
93
  }
94
- function bs(c, s, t, e, i = null) {
95
- let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, l = -1 / 0, E = -1 / 0, d = 1 / 0, h = 1 / 0, u = 1 / 0, p = -1 / 0, R = -1 / 0, A = -1 / 0;
94
+ function bs(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, R = -1 / 0, A = -1 / 0;
96
96
  const C = i !== null;
97
97
  for (let T = s * 6, F = (s + t) * 6; T < F; T += 6) {
98
- const f = c[T + 0], m = c[T + 1], g = f - m, S = f + m;
98
+ const f = l[T + 0], m = l[T + 1], g = f - m, S = f + m;
99
99
  g < o && (o = g), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
100
- const _ = c[T + 2], N = c[T + 3], y = _ - N, w = _ + N;
101
- y < n && (n = y), w > l && (l = w), C && _ < h && (h = _), C && _ > R && (R = _);
102
- const L = c[T + 4], U = c[T + 5], x = L - U, B = L + U;
103
- x < r && (r = x), B > E && (E = B), C && L < u && (u = L), C && L > A && (A = L);
100
+ const _ = l[T + 2], N = l[T + 3], L = _ - N, w = _ + N;
101
+ L < n && (n = L), w > c && (c = w), C && _ < h && (h = _), C && _ > R && (R = _);
102
+ const P = l[T + 4], D = l[T + 5], x = P - D, B = P + D;
103
+ x < r && (r = x), B > E && (E = B), C && P < u && (u = P), C && P > A && (A = P);
104
104
  }
105
- e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = l, e[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = R, i[5] = A);
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] = R, i[5] = A);
106
106
  }
107
- function so(c, s, t, e) {
108
- let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, l = -1 / 0;
107
+ function so(l, s, t, e) {
108
+ let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
109
109
  for (let E = s * 6, d = (s + t) * 6; E < d; E += 6) {
110
- const h = c[E + 0];
110
+ const h = l[E + 0];
111
111
  h < i && (i = h), h > r && (r = h);
112
- const u = c[E + 2];
112
+ const u = l[E + 2];
113
113
  u < o && (o = u), u > a && (a = u);
114
- const p = c[E + 4];
115
- p < n && (n = p), p > l && (l = p);
114
+ const p = l[E + 4];
115
+ p < n && (n = p), p > c && (c = p);
116
116
  }
117
- e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = l;
117
+ e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = c;
118
118
  }
119
- function io(c, s) {
119
+ function io(l, s) {
120
120
  eo(s);
121
- const t = c.attributes.position, e = c.index ? c.index.array : null, i = pe(c), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
- let l = 3;
123
- t.isInterleavedBufferAttribute && (l = t.data.stride);
121
+ const t = l.attributes.position, e = l.index ? l.index.array : null, i = pe(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
+ let c = 3;
123
+ t.isInterleavedBufferAttribute && (c = t.data.stride);
124
124
  const E = ["getX", "getY", "getZ"];
125
125
  for (let d = 0; d < i; d++) {
126
126
  const h = d * 3, u = d * 6;
127
127
  let p = h + 0, R = h + 1, A = h + 2;
128
- e && (p = e[p], R = e[R], A = e[A]), n || (p = p * l + a, R = R * l + a, A = A * l + a);
128
+ e && (p = e[p], R = e[R], A = e[A]), n || (p = p * c + a, R = R * c + a, A = A * c + a);
129
129
  for (let C = 0; C < 3; C++) {
130
130
  let T, F, f;
131
131
  n ? (T = t[E[C]](p), F = t[E[C]](R), f = t[E[C]](A)) : (T = r[p + C], F = r[R + C], f = r[A + C]);
@@ -139,22 +139,22 @@ function io(c, s) {
139
139
  }
140
140
  return o;
141
141
  }
142
- const wt = 32, no = (c, s) => c.candidate - s.candidate, xt = new Array(wt).fill().map(() => ({
142
+ const wt = 32, no = (l, s) => l.candidate - s.candidate, xt = new Array(wt).fill().map(() => ({
143
143
  count: 0,
144
144
  bounds: new Float32Array(6),
145
145
  rightCacheBounds: new Float32Array(6),
146
146
  leftCacheBounds: new Float32Array(6),
147
147
  candidate: 0
148
148
  })), qe = new Float32Array(6);
149
- function oo(c, s, t, e, i, o) {
149
+ function oo(l, s, t, e, i, o) {
150
150
  let n = -1, r = 0;
151
151
  if (o === On)
152
152
  n = Mi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
153
153
  else if (o === Qn)
154
- n = Mi(c), n !== -1 && (r = ro(t, e, i, n));
154
+ n = Mi(l), n !== -1 && (r = ro(t, e, i, n));
155
155
  else if (o === jn) {
156
- const a = Re(c);
157
- let l = Us * i;
156
+ const a = Re(l);
157
+ let c = Us * i;
158
158
  const E = e * 6, d = (e + i) * 6;
159
159
  for (let h = 0; h < 3; h++) {
160
160
  const u = s[h], A = (s[h + 3] - u) / wt;
@@ -190,12 +190,12 @@ function oo(c, s, t, e, i, o) {
190
190
  }
191
191
  for (let f = 0; f < F; f++) {
192
192
  const m = C[f], g = m.count, S = i - m.count, _ = m.leftCacheBounds, N = m.rightCacheBounds;
193
- let y = 0;
194
- g !== 0 && (y = Re(_) / a);
193
+ let L = 0;
194
+ g !== 0 && (L = Re(_) / a);
195
195
  let w = 0;
196
196
  S !== 0 && (w = Re(N) / a);
197
- const L = Li + Us * (y * g + w * S);
198
- L < l && (n = h, l = L, r = m.candidate);
197
+ const P = Pi + Us * (L * g + w * S);
198
+ P < c && (n = h, c = P, r = m.candidate);
199
199
  }
200
200
  } else {
201
201
  for (let F = 0; F < wt; F++) {
@@ -221,12 +221,12 @@ function oo(c, s, t, e, i, o) {
221
221
  for (let F = 0; F < wt - 1; F++) {
222
222
  const f = xt[F], m = f.count, g = f.bounds, _ = xt[F + 1].rightCacheBounds;
223
223
  m !== 0 && (T === 0 ? wi(g, qe) : Di(g, qe, qe)), T += m;
224
- let N = 0, y = 0;
224
+ let N = 0, L = 0;
225
225
  T !== 0 && (N = Re(qe) / a);
226
226
  const w = i - T;
227
- w !== 0 && (y = Re(_) / a);
228
- const L = Li + Us * (N * T + y * w);
229
- L < l && (n = h, l = L, r = f.candidate);
227
+ w !== 0 && (L = Re(_) / a);
228
+ const P = Pi + Us * (N * T + L * w);
229
+ P < c && (n = h, c = P, r = f.candidate);
230
230
  }
231
231
  }
232
232
  }
@@ -234,23 +234,23 @@ function oo(c, s, t, e, i, o) {
234
234
  console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);
235
235
  return { axis: n, pos: r };
236
236
  }
237
- function ro(c, s, t, e) {
237
+ function ro(l, s, t, e) {
238
238
  let i = 0;
239
239
  for (let o = s, n = s + t; o < n; o++)
240
- i += c[o * 6 + e * 2];
240
+ i += l[o * 6 + e * 2];
241
241
  return i / t;
242
242
  }
243
243
  class $e {
244
244
  constructor() {
245
245
  }
246
246
  }
247
- function ao(c, s, t, e, i, o) {
247
+ function ao(l, s, t, e, i, o) {
248
248
  let n = e, r = e + i - 1;
249
- const a = o.pos, l = o.axis * 2;
249
+ const a = o.pos, c = o.axis * 2;
250
250
  for (; ; ) {
251
- for (; n <= r && t[n * 6 + l] < a; )
251
+ for (; n <= r && t[n * 6 + c] < a; )
252
252
  n++;
253
- for (; n <= r && t[r * 6 + l] >= a; )
253
+ for (; n <= r && t[r * 6 + c] >= a; )
254
254
  r--;
255
255
  if (n < r) {
256
256
  for (let E = 0; E < 3; E++) {
@@ -266,17 +266,17 @@ function ao(c, s, t, e, i, o) {
266
266
  return n;
267
267
  }
268
268
  }
269
- function co(c, s, t, e, i, o) {
269
+ function co(l, s, t, e, i, o) {
270
270
  let n = e, r = e + i - 1;
271
- const a = o.pos, l = o.axis * 2;
271
+ const a = o.pos, c = o.axis * 2;
272
272
  for (; ; ) {
273
- for (; n <= r && t[n * 6 + l] < a; )
273
+ for (; n <= r && t[n * 6 + c] < a; )
274
274
  n++;
275
- for (; n <= r && t[r * 6 + l] >= a; )
275
+ for (; n <= r && t[r * 6 + c] >= a; )
276
276
  r--;
277
277
  if (n < r) {
278
- let E = c[n];
279
- c[n] = c[r], c[r] = E;
278
+ let E = l[n];
279
+ l[n] = l[r], l[r] = E;
280
280
  for (let d = 0; d < 6; d++) {
281
281
  let h = t[n * 6 + d];
282
282
  t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = h;
@@ -286,14 +286,14 @@ function co(c, s, t, e, i, o) {
286
286
  return n;
287
287
  }
288
288
  }
289
- function lo(c, s) {
290
- const t = (c.index ? c.index.count : c.attributes.position.count) / 3, e = t > 2 ** 16, i = e ? 4 : 2, o = s ? new SharedArrayBuffer(t * i) : new ArrayBuffer(t * i), n = e ? new Uint32Array(o) : new Uint16Array(o);
289
+ function lo(l, s) {
290
+ const t = (l.index ? l.index.count : l.attributes.position.count) / 3, e = t > 2 ** 16, i = e ? 4 : 2, o = s ? new SharedArrayBuffer(t * i) : new ArrayBuffer(t * i), n = e ? new Uint32Array(o) : new Uint16Array(o);
291
291
  for (let r = 0, a = n.length; r < a; r++)
292
292
  n[r] = r;
293
293
  return n;
294
294
  }
295
- function ho(c, s) {
296
- const t = c.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, l = pe(t), E = c._indirectBuffer;
295
+ function ho(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 = pe(t), E = l._indirectBuffer;
297
297
  let d = !1;
298
298
  const h = new Float32Array(6), u = new Float32Array(6), p = io(t, h), R = s.indirect ? co : ao, A = [], C = s.indirect ? Sn(t) : _n(t);
299
299
  if (C.length === 1) {
@@ -306,7 +306,7 @@ function ho(c, s) {
306
306
  }
307
307
  return A;
308
308
  function T(f) {
309
- a && a(f / l);
309
+ a && a(f / c);
310
310
  }
311
311
  function F(f, m, g, S = null, _ = 0) {
312
312
  if (!d && _ >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))), g <= n || _ >= i)
@@ -314,37 +314,37 @@ function ho(c, s) {
314
314
  const N = oo(f.boundingData, S, p, m, g, r);
315
315
  if (N.axis === -1)
316
316
  return T(m + g), f.offset = m, f.count = g, f;
317
- const y = R(E, e, p, m, g, N);
318
- if (y === m || y === m + g)
317
+ const L = R(E, e, p, m, g, N);
318
+ if (L === m || L === m + g)
319
319
  T(m + g), f.offset = m, f.count = g;
320
320
  else {
321
321
  f.splitAxis = N.axis;
322
- const w = new $e(), L = m, U = y - m;
323
- f.left = w, w.boundingData = new Float32Array(6), bs(p, L, U, w.boundingData, u), F(w, L, U, u, _ + 1);
324
- const x = new $e(), B = y, H = g - U;
322
+ const w = new $e(), P = m, D = L - m;
323
+ f.left = w, w.boundingData = new Float32Array(6), bs(p, P, D, w.boundingData, u), F(w, P, D, u, _ + 1);
324
+ const x = new $e(), B = L, H = g - D;
325
325
  f.right = x, x.boundingData = new Float32Array(6), bs(p, B, H, x.boundingData, u), F(x, B, H, u, _ + 1);
326
326
  }
327
327
  return f;
328
328
  }
329
329
  }
330
- function Eo(c, s) {
331
- const t = c.geometry;
332
- s.indirect && (c._indirectBuffer = lo(t, s.useSharedArrayBuffer), to(t) && !s.verbose && console.warn(
330
+ function Eo(l, s) {
331
+ const t = l.geometry;
332
+ s.indirect && (l._indirectBuffer = lo(t, s.useSharedArrayBuffer), to(t) && !s.verbose && console.warn(
333
333
  'MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.'
334
- )), c._indirectBuffer || Jn(t, s);
335
- const e = ho(c, s);
334
+ )), l._indirectBuffer || Jn(t, s);
335
+ const e = ho(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
339
  const h = e[d];
340
- let u = l(h);
340
+ let u = c(h);
341
341
  const p = new a(Ts * u);
342
342
  i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), E(0, h), r.push(p);
343
343
  }
344
- c._roots = r;
344
+ l._roots = r;
345
345
  return;
346
- function l(d) {
347
- return d.count ? 1 : 1 + l(d.left) + l(d.right);
346
+ function c(d) {
347
+ return d.count ? 1 : 1 + c(d.left) + c(d.right);
348
348
  }
349
349
  function E(d, h) {
350
350
  const u = d / 4, p = d / 2, R = !!h.count, A = h.boundingData;
@@ -352,7 +352,7 @@ function Eo(c, s) {
352
352
  i[u + C] = A[C];
353
353
  if (R) {
354
354
  const C = h.offset, T = h.count;
355
- return o[u + 6] = C, n[p + 14] = T, n[p + 15] = ys, d + Ts;
355
+ return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Ls, d + Ts;
356
356
  } else {
357
357
  const C = h.left, T = h.right, F = h.splitAxis;
358
358
  let f;
@@ -387,48 +387,48 @@ class Dt {
387
387
  }
388
388
  }
389
389
  Dt.prototype.setFromBox = function() {
390
- const c = new M();
390
+ const l = new M();
391
391
  return function(t, e) {
392
392
  const i = e.min, o = e.max;
393
393
  let n = 1 / 0, r = -1 / 0;
394
394
  for (let a = 0; a <= 1; a++)
395
- for (let l = 0; l <= 1; l++)
395
+ for (let c = 0; c <= 1; c++)
396
396
  for (let E = 0; E <= 1; E++) {
397
- c.x = i.x * a + o.x * (1 - a), c.y = i.y * l + o.y * (1 - l), c.z = i.z * E + o.z * (1 - E);
398
- const d = t.dot(c);
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);
398
+ const d = t.dot(l);
399
399
  n = Math.min(d, n), r = Math.max(d, r);
400
400
  }
401
401
  this.min = n, this.max = r;
402
402
  };
403
403
  }();
404
404
  const uo = function() {
405
- const c = new M(), s = new M(), t = new M();
405
+ const l = new M(), s = new M(), t = new M();
406
406
  return function(i, o, n) {
407
- const r = i.start, a = c, l = o.start, E = s;
408
- t.subVectors(r, l), c.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
407
+ const r = i.start, a = l, c = o.start, E = s;
408
+ t.subVectors(r, c), l.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
409
409
  const d = t.dot(E), h = E.dot(a), u = E.dot(E), p = t.dot(a), A = a.dot(a) * u - h * h;
410
410
  let C, T;
411
411
  A !== 0 ? C = (d * h - p * u) / A : C = 0, T = (d + C * h) / u, n.x = C, n.y = T;
412
412
  };
413
413
  }(), Ci = function() {
414
- const c = new fe(), s = new M(), t = new M();
414
+ const l = new fe(), s = new M(), t = new M();
415
415
  return function(i, o, n, r) {
416
- uo(i, o, c);
417
- let a = c.x, l = c.y;
418
- if (a >= 0 && a <= 1 && l >= 0 && l <= 1) {
419
- i.at(a, n), o.at(l, r);
416
+ uo(i, o, l);
417
+ let a = l.x, c = l.y;
418
+ if (a >= 0 && a <= 1 && c >= 0 && c <= 1) {
419
+ i.at(a, n), o.at(c, r);
420
420
  return;
421
421
  } else if (a >= 0 && a <= 1) {
422
- l < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
422
+ c < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
423
423
  return;
424
- } else if (l >= 0 && l <= 1) {
424
+ } else if (c >= 0 && c <= 1) {
425
425
  a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
426
426
  return;
427
427
  } else {
428
428
  let E;
429
429
  a < 0 ? E = i.start : E = i.end;
430
430
  let d;
431
- l < 0 ? d = o.start : d = o.end;
431
+ c < 0 ? d = o.start : d = o.end;
432
432
  const h = s, u = t;
433
433
  if (i.closestPointToPoint(d, !0, s), o.closestPointToPoint(E, !0, t), h.distanceToSquared(d) <= u.distanceToSquared(E)) {
434
434
  n.copy(h), r.copy(d);
@@ -440,10 +440,10 @@ const uo = function() {
440
440
  }
441
441
  };
442
442
  }(), Io = function() {
443
- const c = new M(), s = new M(), t = new pi(), e = new Lt();
443
+ const l = new M(), s = new M(), t = new pi(), e = new Pt();
444
444
  return function(o, n) {
445
- const { radius: r, center: a } = o, { a: l, b: E, c: d } = n;
446
- if (e.start = l, e.end = E, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r || (e.start = l, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r))
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))
447
447
  return !0;
448
448
  const R = n.getPlane(t);
449
449
  if (Math.abs(R.distanceToPoint(a)) <= r) {
@@ -454,8 +454,8 @@ const uo = function() {
454
454
  return !1;
455
455
  };
456
456
  }(), fo = 1e-15;
457
- function vs(c) {
458
- return Math.abs(c) < fo;
457
+ function vs(l) {
458
+ return Math.abs(l) < fo;
459
459
  }
460
460
  class gt extends ue {
461
461
  constructor(...s) {
@@ -467,8 +467,8 @@ class gt extends ue {
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 l = o[1], E = n[1];
471
- l.subVectors(s, t), E.setFromPoints(l, i);
470
+ const c = o[1], E = n[1];
471
+ c.subVectors(s, t), E.setFromPoints(c, i);
472
472
  const d = o[2], h = n[2];
473
473
  d.subVectors(t, e), h.setFromPoints(d, i);
474
474
  const u = o[3], p = n[3];
@@ -476,19 +476,19 @@ class gt extends ue {
476
476
  }
477
477
  }
478
478
  gt.prototype.closestPointToSegment = function() {
479
- const c = new M(), s = new M(), t = new Lt();
479
+ const l = new M(), s = new M(), t = new Pt();
480
480
  return function(i, o = null, n = null) {
481
- const { start: r, end: a } = i, l = this.points;
481
+ const { start: r, end: a } = i, c = this.points;
482
482
  let E, d = 1 / 0;
483
483
  for (let h = 0; h < 3; h++) {
484
484
  const u = (h + 1) % 3;
485
- t.start.copy(l[h]), t.end.copy(l[u]), Ci(t, i, c, s), E = c.distanceToSquared(s), E < d && (d = E, o && o.copy(c), n && n.copy(s));
485
+ t.start.copy(c[h]), t.end.copy(c[u]), Ci(t, i, l, s), E = l.distanceToSquared(s), E < d && (d = E, o && o.copy(l), n && n.copy(s));
486
486
  }
487
- return this.closestPointToPoint(r, c), E = r.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(r)), this.closestPointToPoint(a, c), E = a.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(a)), Math.sqrt(d);
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);
488
488
  };
489
489
  }();
490
490
  gt.prototype.intersectsTriangle = function() {
491
- const c = new gt(), s = new Array(3), t = new Array(3), e = new Dt(), i = new Dt(), o = new M(), n = new M(), r = new M(), a = new M(), l = new M(), E = new Lt(), d = new Lt(), h = new Lt(), u = new M();
491
+ const l = new gt(), s = new Array(3), t = new Array(3), e = new Dt(), i = new Dt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), E = new Pt(), d = new Pt(), h = new Pt(), u = new M();
492
492
  function p(R, A, C) {
493
493
  const T = R.points;
494
494
  let F = 0, f = -1;
@@ -515,28 +515,28 @@ gt.prototype.intersectsTriangle = function() {
515
515
  return F;
516
516
  }
517
517
  return function(A, C = null, T = !1) {
518
- this.needsUpdate && this.update(), A.isExtendedTriangle ? A.needsUpdate && A.update() : (c.copy(A), c.update(), A = c);
518
+ this.needsUpdate && this.update(), A.isExtendedTriangle ? A.needsUpdate && A.update() : (l.copy(A), l.update(), A = l);
519
519
  const F = this.plane, f = A.plane;
520
520
  if (Math.abs(F.normal.dot(f.normal)) > 1 - 1e-10) {
521
521
  const m = this.satBounds, g = this.satAxes;
522
522
  t[0] = A.a, t[1] = A.b, t[2] = A.c;
523
523
  for (let N = 0; N < 4; N++) {
524
- const y = m[N], w = g[N];
525
- if (e.setFromPoints(w, t), y.isSeparated(e))
524
+ const L = m[N], w = g[N];
525
+ if (e.setFromPoints(w, t), L.isSeparated(e))
526
526
  return !1;
527
527
  }
528
528
  const S = A.satBounds, _ = A.satAxes;
529
529
  s[0] = this.a, s[1] = this.b, s[2] = this.c;
530
530
  for (let N = 0; N < 4; N++) {
531
- const y = S[N], w = _[N];
532
- if (e.setFromPoints(w, s), y.isSeparated(e))
531
+ const L = S[N], w = _[N];
532
+ if (e.setFromPoints(w, s), L.isSeparated(e))
533
533
  return !1;
534
534
  }
535
535
  for (let N = 0; N < 4; N++) {
536
- const y = g[N];
536
+ const L = g[N];
537
537
  for (let w = 0; w < 4; w++) {
538
- const L = _[w];
539
- if (o.crossVectors(y, L), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
538
+ const P = _[w];
539
+ if (o.crossVectors(L, P), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
540
540
  return !1;
541
541
  }
542
542
  }
@@ -553,42 +553,42 @@ gt.prototype.intersectsTriangle = function() {
553
553
  if (g !== 2)
554
554
  return !1;
555
555
  if (d.delta(r), h.delta(a), r.dot(a) < 0) {
556
- let U = h.start;
557
- h.start = h.end, h.end = U;
556
+ let D = h.start;
557
+ h.start = h.end, h.end = D;
558
558
  }
559
- const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r), y = h.end.dot(r), w = _ < N, L = S < y;
560
- return S !== y && N !== _ && w === L ? !1 : (C && (l.subVectors(d.start, h.start), l.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), l.subVectors(d.end, h.end), l.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 = h.start.dot(r), L = h.end.dot(r), w = _ < N, P = S < L;
560
+ return S !== L && N !== _ && w === P ? !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);
561
561
  }
562
562
  };
563
563
  }();
564
564
  gt.prototype.distanceToPoint = function() {
565
- const c = new M();
565
+ const l = new M();
566
566
  return function(t) {
567
- return this.closestPointToPoint(t, c), t.distanceTo(c);
567
+ return this.closestPointToPoint(t, l), t.distanceTo(l);
568
568
  };
569
569
  }();
570
570
  gt.prototype.distanceToTriangle = function() {
571
- const c = new M(), s = new M(), t = ["a", "b", "c"], e = new Lt(), i = new Lt();
571
+ const l = new M(), s = new M(), t = ["a", "b", "c"], e = new Pt(), i = new Pt();
572
572
  return function(n, r = null, a = null) {
573
- const l = r || a ? e : null;
574
- if (this.intersectsTriangle(n, l))
575
- return (r || a) && (r && l.getCenter(r), a && l.getCenter(a)), 0;
573
+ const c = r || a ? e : null;
574
+ if (this.intersectsTriangle(n, c))
575
+ return (r || a) && (r && c.getCenter(r), a && c.getCenter(a)), 0;
576
576
  let E = 1 / 0;
577
577
  for (let d = 0; d < 3; d++) {
578
578
  let h;
579
579
  const u = t[d], p = n[u];
580
- this.closestPointToPoint(p, c), h = p.distanceToSquared(c), h < E && (E = h, r && r.copy(c), a && a.copy(p));
580
+ this.closestPointToPoint(p, l), h = p.distanceToSquared(l), h < E && (E = h, r && r.copy(l), a && a.copy(p));
581
581
  const R = this[u];
582
- n.closestPointToPoint(R, c), h = R.distanceToSquared(c), h < E && (E = h, r && r.copy(R), a && a.copy(c));
582
+ n.closestPointToPoint(R, l), h = R.distanceToSquared(l), h < E && (E = h, r && r.copy(R), a && a.copy(l));
583
583
  }
584
584
  for (let d = 0; d < 3; d++) {
585
585
  const h = t[d], u = t[(d + 1) % 3];
586
586
  e.set(this[h], this[u]);
587
587
  for (let p = 0; p < 3; p++) {
588
588
  const R = t[p], A = t[(p + 1) % 3];
589
- i.set(n[R], n[A]), Ci(e, i, c, s);
590
- const C = c.distanceToSquared(s);
591
- C < E && (E = C, r && r.copy(c), a && a.copy(s));
589
+ i.set(n[R], n[A]), Ci(e, i, l, s);
590
+ const C = l.distanceToSquared(s);
591
+ C < E && (E = C, r && r.copy(l), a && a.copy(s));
592
592
  }
593
593
  }
594
594
  return Math.sqrt(E);
@@ -608,15 +608,15 @@ class at {
608
608
  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
- for (let l = 0; l <= 1; l++)
611
+ for (let c = 0; c <= 1; c++)
612
612
  for (let E = 0; E <= 1; E++)
613
613
  for (let d = 0; d <= 1; d++) {
614
- const h = 1 * l | 2 * E | 4 * d, u = i[h];
615
- u.x = l ? e.x : t.x, u.y = E ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
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);
616
616
  }
617
617
  const o = this.satBounds, n = this.satAxes, r = i[0];
618
- for (let l = 0; l < 3; l++) {
619
- const E = n[l], d = o[l], h = 1 << l, u = i[h];
618
+ for (let c = 0; c < 3; c++) {
619
+ const E = n[c], d = o[c], h = 1 << c, u = i[h];
620
620
  E.subVectors(r, u), d.setFromPoints(E, i);
621
621
  }
622
622
  const a = this.alignedSatBounds;
@@ -624,24 +624,24 @@ at.prototype.update = /* @__PURE__ */ function() {
624
624
  };
625
625
  }();
626
626
  at.prototype.intersectsBox = function() {
627
- const c = new Dt();
627
+ const l = new Dt();
628
628
  return function(t) {
629
629
  this.needsUpdate && this.update();
630
630
  const e = t.min, i = t.max, o = this.satBounds, n = this.satAxes, r = this.alignedSatBounds;
631
- if (c.min = e.x, c.max = i.x, r[0].isSeparated(c) || (c.min = e.y, c.max = i.y, r[1].isSeparated(c)) || (c.min = e.z, c.max = i.z, r[2].isSeparated(c)))
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 l = n[a], E = o[a];
635
- if (c.setFromBox(l, t), E.isSeparated(c))
634
+ const c = n[a], E = o[a];
635
+ if (l.setFromBox(c, t), E.isSeparated(l))
636
636
  return !1;
637
637
  }
638
638
  return !0;
639
639
  };
640
640
  }();
641
641
  at.prototype.intersectsTriangle = function() {
642
- const c = new gt(), s = new Array(3), t = new Dt(), e = new Dt(), i = new M();
642
+ const l = new gt(), s = new Array(3), t = new Dt(), e = new Dt(), i = new M();
643
643
  return function(n) {
644
- this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (c.copy(n), c.update(), n = c);
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
647
  for (let h = 0; h < 3; h++) {
@@ -649,9 +649,9 @@ at.prototype.intersectsTriangle = function() {
649
649
  if (t.setFromPoints(p, s), u.isSeparated(t))
650
650
  return !1;
651
651
  }
652
- const l = n.satBounds, E = n.satAxes, d = this.points;
652
+ const c = n.satBounds, E = n.satAxes, d = this.points;
653
653
  for (let h = 0; h < 3; h++) {
654
- const u = l[h], p = E[h];
654
+ const u = c[h], p = E[h];
655
655
  if (t.setFromPoints(p, d), u.isSeparated(t))
656
656
  return !1;
657
657
  }
@@ -672,23 +672,23 @@ at.prototype.closestPointToPoint = /* @__PURE__ */ function() {
672
672
  };
673
673
  }();
674
674
  at.prototype.distanceToPoint = function() {
675
- const c = new M();
675
+ const l = new M();
676
676
  return function(t) {
677
- return this.closestPointToPoint(t, c), t.distanceTo(c);
677
+ return this.closestPointToPoint(t, l), t.distanceTo(l);
678
678
  };
679
679
  }();
680
680
  at.prototype.distanceToBox = function() {
681
- const c = ["x", "y", "z"], s = new Array(12).fill().map(() => new Lt()), t = new Array(12).fill().map(() => new Lt()), e = new M(), i = new M();
682
- return function(n, r = 0, a = null, l = null) {
681
+ const l = ["x", "y", "z"], s = new Array(12).fill().map(() => new Pt()), t = new Array(12).fill().map(() => new Pt()), e = new M(), i = new M();
682
+ return function(n, r = 0, a = null, c = null) {
683
683
  if (this.needsUpdate && this.update(), this.intersectsBox(n))
684
- return (a || l) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), l && l.copy(i)), 0;
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
685
  const E = r * r, d = n.min, h = n.max, u = this.points;
686
686
  let p = 1 / 0;
687
687
  for (let A = 0; A < 8; A++) {
688
688
  const C = u[A];
689
689
  i.copy(C).clamp(d, h);
690
690
  const T = C.distanceToSquared(i);
691
- if (T < p && (p = T, a && a.copy(C), l && l.copy(i), T < E))
691
+ if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T < E))
692
692
  return Math.sqrt(T);
693
693
  }
694
694
  let R = 0;
@@ -697,15 +697,15 @@ at.prototype.distanceToBox = function() {
697
697
  for (let T = 0; T <= 1; T++) {
698
698
  const F = (A + 1) % 3, f = (A + 2) % 3, m = C << F | T << f, g = 1 << A | C << F | T << f, S = u[m], _ = u[g];
699
699
  s[R].set(S, _);
700
- const y = c[A], w = c[F], L = c[f], U = t[R], x = U.start, B = U.end;
701
- x[y] = d[y], x[w] = C ? d[w] : h[w], x[L] = T ? d[L] : h[w], B[y] = h[y], B[w] = C ? d[w] : h[w], B[L] = T ? d[L] : h[w], R++;
700
+ const L = l[A], w = l[F], P = l[f], D = t[R], x = D.start, B = D.end;
701
+ x[L] = d[L], x[w] = C ? d[w] : h[w], x[P] = T ? d[P] : h[w], B[L] = h[L], B[w] = C ? d[w] : h[w], B[P] = T ? d[P] : h[w], R++;
702
702
  }
703
703
  for (let A = 0; A <= 1; A++)
704
704
  for (let C = 0; C <= 1; C++)
705
705
  for (let T = 0; T <= 1; T++) {
706
706
  i.x = A ? h.x : d.x, i.y = C ? h.y : d.y, i.z = T ? h.z : d.z, this.closestPointToPoint(i, e);
707
707
  const F = i.distanceToSquared(e);
708
- if (F < p && (p = F, a && a.copy(e), l && l.copy(i), F < E))
708
+ if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F < E))
709
709
  return Math.sqrt(F);
710
710
  }
711
711
  for (let A = 0; A < 12; A++) {
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
714
714
  const F = t[T];
715
715
  Ci(C, F, e, i);
716
716
  const f = e.distanceToSquared(i);
717
- if (f < p && (p = f, a && a.copy(e), l && l.copy(i), f < E))
717
+ if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f < E))
718
718
  return Math.sqrt(f);
719
719
  }
720
720
  }
@@ -739,23 +739,23 @@ class po extends Ti {
739
739
  }
740
740
  }
741
741
  const It = /* @__PURE__ */ new po();
742
- function ht(c, s) {
743
- return s[c + 15] === 65535;
742
+ function ht(l, s) {
743
+ return s[l + 15] === 65535;
744
744
  }
745
- function Et(c, s) {
746
- return s[c + 6];
745
+ function Et(l, s) {
746
+ return s[l + 6];
747
747
  }
748
- function ft(c, s) {
749
- return s[c + 14];
748
+ function ft(l, s) {
749
+ return s[l + 14];
750
750
  }
751
- function pt(c) {
752
- return c + 8;
751
+ function pt(l) {
752
+ return l + 8;
753
753
  }
754
- function Ct(c, s) {
755
- return s[c + 6];
754
+ function Ct(l, s) {
755
+ return s[l + 6];
756
756
  }
757
- function Nn(c, s) {
758
- return s[c + 7];
757
+ function Nn(l, s) {
758
+ return s[l + 7];
759
759
  }
760
760
  class Co {
761
761
  constructor() {
@@ -770,48 +770,48 @@ class Co {
770
770
  }
771
771
  }
772
772
  const Z = new Co();
773
- let Vt, Ie;
773
+ let Gt, Ie;
774
774
  const Jt = [], Ke = /* @__PURE__ */ new Ti(() => new Ot());
775
- function To(c, s, t, e, i, o) {
776
- Vt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Vt, Ie), Z.setBuffer(c._roots[s]);
777
- const n = si(0, c.geometry, t, e, i, o);
778
- Z.clearBuffer(), Ke.releasePrimitive(Vt), Ke.releasePrimitive(Ie), Jt.pop(), Jt.pop();
775
+ function To(l, s, t, e, i, o) {
776
+ Gt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Gt, Ie), Z.setBuffer(l._roots[s]);
777
+ const n = si(0, l.geometry, t, e, i, o);
778
+ Z.clearBuffer(), Ke.releasePrimitive(Gt), Ke.releasePrimitive(Ie), Jt.pop(), Jt.pop();
779
779
  const r = Jt.length;
780
- return r > 0 && (Ie = Jt[r - 1], Vt = Jt[r - 2]), n;
780
+ return r > 0 && (Ie = Jt[r - 1], Gt = Jt[r - 2]), n;
781
781
  }
782
- function si(c, s, t, e, i = null, o = 0, n = 0) {
783
- const { float32Array: r, uint16Array: a, uint32Array: l } = Z;
784
- let E = c * 2;
782
+ function si(l, s, t, e, i = null, o = 0, n = 0) {
783
+ const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
784
+ let E = l * 2;
785
785
  if (ht(E, a)) {
786
- const h = Et(c, l), u = ft(E, a);
787
- return $(c, r, Vt), e(h, u, !1, n, o + c, Vt);
786
+ const h = Et(l, c), u = ft(E, a);
787
+ return $(l, r, Gt), e(h, u, !1, n, o + l, Gt);
788
788
  } else {
789
- let y = function(L) {
790
- const { uint16Array: U, uint32Array: x } = Z;
791
- let B = L * 2;
792
- for (; !ht(B, U); )
793
- L = pt(L), B = L * 2;
794
- return Et(L, x);
795
- }, w = function(L) {
796
- const { uint16Array: U, uint32Array: x } = Z;
797
- let B = L * 2;
798
- for (; !ht(B, U); )
799
- L = Ct(L, x), B = L * 2;
800
- return Et(L, x) + ft(B, U);
789
+ let L = function(P) {
790
+ const { uint16Array: D, uint32Array: x } = Z;
791
+ let B = P * 2;
792
+ for (; !ht(B, D); )
793
+ P = pt(P), B = P * 2;
794
+ return Et(P, x);
795
+ }, w = function(P) {
796
+ const { uint16Array: D, uint32Array: x } = Z;
797
+ let B = P * 2;
798
+ for (; !ht(B, D); )
799
+ P = Ct(P, x), B = P * 2;
800
+ return Et(P, x) + ft(B, D);
801
801
  };
802
- const h = pt(c), u = Ct(c, l);
802
+ const h = pt(l), u = Ct(l, c);
803
803
  let p = h, R = u, A, C, T, F;
804
- if (i && (T = Vt, F = Ie, $(p, r, T), $(R, r, F), A = i(T), C = i(F), C < A)) {
804
+ if (i && (T = Gt, F = Ie, $(p, r, T), $(R, r, F), A = i(T), C = i(F), C < A)) {
805
805
  p = u, R = h;
806
- const L = A;
807
- A = C, C = L, T = F;
806
+ const P = A;
807
+ A = C, C = P, T = F;
808
808
  }
809
- T || (T = Vt, $(p, r, T));
809
+ T || (T = Gt, $(p, r, T));
810
810
  const f = ht(p * 2, a), m = t(T, f, A, n + 1, o + p);
811
811
  let g;
812
- if (m === yi) {
813
- const L = y(p), x = w(p) - L;
814
- g = e(L, x, !0, n + 1, o + p, T);
812
+ if (m === Li) {
813
+ const P = L(p), x = w(p) - P;
814
+ g = e(P, x, !0, n + 1, o + p, T);
815
815
  } else
816
816
  g = m && si(
817
817
  p,
@@ -827,9 +827,9 @@ function si(c, s, t, e, i = null, o = 0, n = 0) {
827
827
  F = Ie, $(R, r, F);
828
828
  const S = ht(R * 2, a), _ = t(F, S, C, n + 1, o + R);
829
829
  let N;
830
- if (_ === yi) {
831
- const L = y(R), x = w(R) - L;
832
- N = e(L, x, !0, n + 1, o + R, F);
830
+ if (_ === Li) {
831
+ const P = L(R), x = w(R) - P;
832
+ N = e(P, x, !0, n + 1, o + R, F);
833
833
  } else
834
834
  N = _ && si(
835
835
  R,
@@ -844,10 +844,10 @@ function si(c, s, t, e, i = null, o = 0, n = 0) {
844
844
  }
845
845
  }
846
846
  const Ae = /* @__PURE__ */ new M(), Bs = /* @__PURE__ */ new M();
847
- function mo(c, s, t = {}, e = 0, i = 1 / 0) {
847
+ function mo(l, s, t = {}, e = 0, i = 1 / 0) {
848
848
  const o = e * e, n = i * i;
849
849
  let r = 1 / 0, a = null;
850
- if (c.shapecast(
850
+ if (l.shapecast(
851
851
  {
852
852
  boundsTraverseOrder: (E) => (Ae.copy(s).clamp(E.min, E.max), Ae.distanceToSquared(s)),
853
853
  intersectsBounds: (E, d, h) => h < r && h < n,
@@ -859,22 +859,22 @@ function mo(c, s, t = {}, e = 0, i = 1 / 0) {
859
859
  }
860
860
  ), r === 1 / 0)
861
861
  return null;
862
- const l = Math.sqrt(r);
863
- return t.point ? t.point.copy(Bs) : t.point = Bs.clone(), t.distance = l, t.faceIndex = a, t;
862
+ const c = Math.sqrt(r);
863
+ return t.point ? t.point.copy(Bs) : t.point = Bs.clone(), t.distance = c, t.faceIndex = a, t;
864
864
  }
865
865
  const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), es = /* @__PURE__ */ new fe(), Ui = /* @__PURE__ */ new M(), xi = /* @__PURE__ */ new M(), bi = /* @__PURE__ */ new M(), ss = /* @__PURE__ */ new M();
866
- function Ro(c, s, t, e, i, o) {
866
+ function Ro(l, s, t, e, i, o) {
867
867
  let n;
868
- return o === Vn ? n = c.intersectTriangle(e, t, s, !0, i) : n = c.intersectTriangle(s, t, e, o !== Fn, i), n === null ? null : {
869
- distance: c.origin.distanceTo(i),
868
+ return o === Gn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== Fn, i), n === null ? null : {
869
+ distance: l.origin.distanceTo(i),
870
870
  point: i.clone()
871
871
  };
872
872
  }
873
- function Ao(c, s, t, e, i, o, n, r, a) {
873
+ function Ao(l, s, t, e, i, o, n, r, a) {
874
874
  te.fromBufferAttribute(s, o), ee.fromBufferAttribute(s, n), se.fromBufferAttribute(s, r);
875
- const l = Ro(c, te, ee, se, ss, a);
876
- if (l) {
877
- e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), l.uv = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), l.uv1 = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), t && (Ui.fromBufferAttribute(t, o), xi.fromBufferAttribute(t, n), bi.fromBufferAttribute(t, r), l.normal = ue.getInterpolation(ss, te, ee, se, Ui, xi, bi, new M()), l.normal.dot(c.direction) > 0 && l.normal.multiplyScalar(-1));
875
+ const c = Ro(l, te, ee, se, ss, a);
876
+ if (c) {
877
+ e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), t && (Ui.fromBufferAttribute(t, o), xi.fromBufferAttribute(t, n), bi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(ss, te, ee, se, Ui, xi, bi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
878
878
  const E = {
879
879
  a: o,
880
880
  b: n,
@@ -882,62 +882,62 @@ function Ao(c, s, t, e, i, o, n, r, a) {
882
882
  normal: new M(),
883
883
  materialIndex: 0
884
884
  };
885
- ue.getNormal(te, ee, se, E.normal), l.face = E, l.faceIndex = o;
885
+ ue.getNormal(te, ee, se, E.normal), c.face = E, c.faceIndex = o;
886
886
  }
887
- return l;
887
+ return c;
888
888
  }
889
- function Ls(c, s, t, e, i) {
889
+ function Ps(l, s, t, e, i) {
890
890
  const o = e * 3;
891
891
  let n = o + 0, r = o + 1, a = o + 2;
892
- const l = c.index;
893
- c.index && (n = l.getX(n), r = l.getX(r), a = l.getX(a));
894
- const { position: E, normal: d, uv: h, uv1: u } = c.attributes, p = Ao(t, E, d, h, u, n, r, a, s);
892
+ const c = l.index;
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 = Ao(t, E, d, h, u, n, r, a, s);
895
895
  return p ? (p.faceIndex = e, i && i.push(p), p) : null;
896
896
  }
897
- function tt(c, s, t, e) {
898
- const i = c.a, o = c.b, n = c.c;
899
- let r = s, a = s + 1, l = s + 2;
900
- t && (r = t.getX(r), a = t.getX(a), l = t.getX(l)), i.x = e.getX(r), i.y = e.getY(r), i.z = e.getZ(r), o.x = e.getX(a), o.y = e.getY(a), o.z = e.getZ(a), n.x = e.getX(l), n.y = e.getY(l), n.z = e.getZ(l);
897
+ function tt(l, s, t, e) {
898
+ const i = l.a, o = l.b, n = l.c;
899
+ let r = s, a = s + 1, c = s + 2;
900
+ t && (r = t.getX(r), a = t.getX(a), c = t.getX(c)), i.x = e.getX(r), i.y = e.getY(r), i.z = e.getZ(r), o.x = e.getX(a), o.y = e.getY(a), o.z = e.getZ(a), n.x = e.getX(c), n.y = e.getY(c), n.z = e.getZ(c);
901
901
  }
902
- function Fo(c, s, t, e, i, o) {
903
- const { geometry: n, _indirectBuffer: r } = c;
904
- for (let a = e, l = e + i; a < l; a++)
905
- Ls(n, s, t, a, o);
902
+ function Fo(l, s, t, e, i, o) {
903
+ const { geometry: n, _indirectBuffer: r } = l;
904
+ for (let a = e, c = e + i; a < c; a++)
905
+ Ps(n, s, t, a, o);
906
906
  }
907
- function go(c, s, t, e, i) {
908
- const { geometry: o, _indirectBuffer: n } = c;
907
+ function go(l, s, t, e, i) {
908
+ const { geometry: o, _indirectBuffer: n } = l;
909
909
  let r = 1 / 0, a = null;
910
- for (let l = e, E = e + i; l < E; l++) {
910
+ for (let c = e, E = e + i; c < E; c++) {
911
911
  let d;
912
- d = Ls(o, s, t, l), d && d.distance < r && (a = d, r = d.distance);
912
+ d = Ps(o, s, t, c), d && d.distance < r && (a = d, r = d.distance);
913
913
  }
914
914
  return a;
915
915
  }
916
- function Oo(c, s, t, e, i, o, n) {
917
- const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
918
- for (let E = c, d = s + c; E < d; E++) {
916
+ function Oo(l, s, t, e, i, o, n) {
917
+ const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
918
+ for (let E = l, d = s + l; E < d; E++) {
919
919
  let h;
920
- if (h = E, tt(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
920
+ if (h = E, tt(n, h * 3, a, c), n.needsUpdate = !0, e(n, h, i, o))
921
921
  return !0;
922
922
  }
923
923
  return !1;
924
924
  }
925
- function So(c, s = null) {
925
+ function So(l, s = null) {
926
926
  s && Array.isArray(s) && (s = new Set(s));
927
- const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
928
- let o, n, r, a, l = 0;
929
- const E = c._roots;
927
+ const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
928
+ let o, n, r, a, c = 0;
929
+ const E = l._roots;
930
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, l), l += o.byteLength;
931
+ o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
932
  function d(h, u, p = !1) {
933
933
  const R = h * 2;
934
- if (r[R + 15] === ys) {
934
+ if (r[R + 15] === Ls) {
935
935
  const C = n[h + 6], T = r[R + 14];
936
936
  let F = 1 / 0, f = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
937
- for (let N = 3 * C, y = 3 * (C + T); N < y; N++) {
937
+ for (let N = 3 * C, L = 3 * (C + T); N < L; N++) {
938
938
  let w = e[N];
939
- const L = i.getX(w), U = i.getY(w), x = i.getZ(w);
940
- L < F && (F = L), L > g && (g = L), U < f && (f = U), U > S && (S = U), x < m && (m = x), x > _ && (_ = x);
939
+ const P = i.getX(w), D = i.getY(w), x = i.getZ(w);
940
+ P < F && (F = P), P > g && (g = P), D < f && (f = D), D > S && (S = D), x < m && (m = x), x > _ && (_ = x);
941
941
  }
942
942
  return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== g || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = g, a[h + 4] = S, a[h + 5] = _, !0) : !1;
943
943
  } else {
@@ -945,107 +945,107 @@ function So(c, s = null) {
945
945
  let m = p, g = !1, S = !1;
946
946
  s ? m || (g = s.has(F), S = s.has(f), m = !g && !S) : (g = !0, S = !0);
947
947
  const _ = m || g, N = m || S;
948
- let y = !1;
949
- _ && (y = d(C, u, m));
948
+ let L = !1;
949
+ _ && (L = d(C, u, m));
950
950
  let w = !1;
951
951
  N && (w = d(T, u, m));
952
- const L = y || w;
953
- if (L)
954
- for (let U = 0; U < 3; U++) {
955
- const x = C + U, B = T + U, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
956
- a[h + U] = H < et ? H : et, a[h + U + 3] = q > Q ? q : Q;
952
+ const P = L || w;
953
+ if (P)
954
+ for (let D = 0; D < 3; D++) {
955
+ const x = C + D, B = T + D, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
956
+ a[h + D] = H < et ? H : et, a[h + D + 3] = q > Q ? q : Q;
957
957
  }
958
- return L;
958
+ return P;
959
959
  }
960
960
  }
961
961
  }
962
962
  const vi = /* @__PURE__ */ new Ot();
963
- function Gt(c, s, t, e) {
964
- return $(c, s, vi), t.intersectBox(vi, e);
963
+ function Vt(l, s, t, e) {
964
+ return $(l, s, vi), t.intersectBox(vi, e);
965
965
  }
966
- function _o(c, s, t, e, i, o) {
967
- const { geometry: n, _indirectBuffer: r } = c;
968
- for (let a = e, l = e + i; a < l; a++) {
966
+ function _o(l, s, t, e, i, o) {
967
+ const { geometry: n, _indirectBuffer: r } = l;
968
+ for (let a = e, c = e + i; a < c; a++) {
969
969
  let E = r ? r[a] : a;
970
- Ls(n, s, t, E, o);
970
+ Ps(n, s, t, E, o);
971
971
  }
972
972
  }
973
- function No(c, s, t, e, i) {
974
- const { geometry: o, _indirectBuffer: n } = c;
973
+ function No(l, s, t, e, i) {
974
+ const { geometry: o, _indirectBuffer: n } = l;
975
975
  let r = 1 / 0, a = null;
976
- for (let l = e, E = e + i; l < E; l++) {
976
+ for (let c = e, E = e + i; c < E; c++) {
977
977
  let d;
978
- d = Ls(o, s, t, n ? n[l] : l), d && d.distance < r && (a = d, r = d.distance);
978
+ d = Ps(o, s, t, n ? n[c] : c), d && d.distance < r && (a = d, r = d.distance);
979
979
  }
980
980
  return a;
981
981
  }
982
- function Po(c, s, t, e, i, o, n) {
983
- const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
984
- for (let E = c, d = s + c; E < d; E++) {
982
+ function yo(l, s, t, e, i, o, n) {
983
+ const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
984
+ for (let E = l, d = s + l; E < d; E++) {
985
985
  let h;
986
- if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
986
+ if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a, c), n.needsUpdate = !0, e(n, h, i, o))
987
987
  return !0;
988
988
  }
989
989
  return !1;
990
990
  }
991
991
  const Bi = /* @__PURE__ */ new M();
992
- function yo(c, s, t, e, i) {
993
- Z.setBuffer(c._roots[s]), ii(0, c, t, e, i), Z.clearBuffer();
992
+ function Lo(l, s, t, e, i) {
993
+ Z.setBuffer(l._roots[s]), ii(0, l, t, e, i), Z.clearBuffer();
994
994
  }
995
- function ii(c, s, t, e, i) {
996
- const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
995
+ function ii(l, s, t, e, i) {
996
+ const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
997
997
  if (ht(a, n)) {
998
- const E = Et(c, r), d = ft(a, n);
998
+ const E = Et(l, r), d = ft(a, n);
999
999
  Fo(s, t, e, E, d, i);
1000
1000
  } else {
1001
- const E = pt(c);
1002
- Gt(E, o, e, Bi) && ii(E, s, t, e, i);
1003
- const d = Ct(c, r);
1004
- Gt(d, o, e, Bi) && ii(d, s, t, e, i);
1001
+ const E = pt(l);
1002
+ Vt(E, o, e, Bi) && ii(E, s, t, e, i);
1003
+ const d = Ct(l, r);
1004
+ Vt(d, o, e, Bi) && ii(d, s, t, e, i);
1005
1005
  }
1006
1006
  }
1007
- const Yi = /* @__PURE__ */ new M(), Lo = ["x", "y", "z"];
1008
- function Mo(c, s, t, e) {
1009
- Z.setBuffer(c._roots[s]);
1010
- const i = ni(0, c, t, e);
1007
+ const Yi = /* @__PURE__ */ new M(), Po = ["x", "y", "z"];
1008
+ function Mo(l, s, t, e) {
1009
+ Z.setBuffer(l._roots[s]);
1010
+ const i = ni(0, l, t, e);
1011
1011
  return Z.clearBuffer(), i;
1012
1012
  }
1013
- function ni(c, s, t, e) {
1013
+ function ni(l, s, t, e) {
1014
1014
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1015
- let r = c * 2;
1015
+ let r = l * 2;
1016
1016
  if (ht(r, o)) {
1017
- const l = Et(c, n), E = ft(r, o);
1018
- return go(s, t, e, l, E);
1017
+ const c = Et(l, n), E = ft(r, o);
1018
+ return go(s, t, e, c, E);
1019
1019
  } else {
1020
- const l = Nn(c, n), E = Lo[l], h = e.direction[E] >= 0;
1020
+ const c = Nn(l, n), E = Po[c], h = e.direction[E] >= 0;
1021
1021
  let u, p;
1022
- h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
1023
- const A = Gt(u, i, e, Yi) ? ni(u, s, t, e) : null;
1022
+ h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1023
+ const A = Vt(u, i, e, Yi) ? ni(u, s, t, e) : null;
1024
1024
  if (A) {
1025
1025
  const F = A.point[E];
1026
- if (h ? F <= i[p + l] : (
1026
+ if (h ? F <= i[p + c] : (
1027
1027
  // min bounding data
1028
- F >= i[p + l + 3]
1028
+ F >= i[p + c + 3]
1029
1029
  ))
1030
1030
  return A;
1031
1031
  }
1032
- const T = Gt(p, i, e, Yi) ? ni(p, s, t, e) : null;
1032
+ const T = Vt(p, i, e, Yi) ? ni(p, s, t, e) : null;
1033
1033
  return A && T ? A.distance <= T.distance ? A : T : A || T || null;
1034
1034
  }
1035
1035
  }
1036
- const is = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new gt(), ne = /* @__PURE__ */ new gt(), Fe = /* @__PURE__ */ new Mt(), Vi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
1037
- function wo(c, s, t, e) {
1038
- Z.setBuffer(c._roots[s]);
1039
- const i = oi(0, c, t, e);
1036
+ const is = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new gt(), ne = /* @__PURE__ */ new gt(), Fe = /* @__PURE__ */ new Mt(), Gi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
1037
+ function wo(l, s, t, e) {
1038
+ Z.setBuffer(l._roots[s]);
1039
+ const i = oi(0, l, t, e);
1040
1040
  return Z.clearBuffer(), i;
1041
1041
  }
1042
- function oi(c, s, t, e, i = null) {
1042
+ function oi(l, s, t, e, i = null) {
1043
1043
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1044
- let a = c * 2;
1045
- if (i === null && (t.boundingBox || t.computeBoundingBox(), Vi.set(t.boundingBox.min, t.boundingBox.max, e), i = Vi), ht(a, n)) {
1046
- const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(c, r), A = ft(a, n);
1044
+ let a = l * 2;
1045
+ if (i === null && (t.boundingBox || t.computeBoundingBox(), Gi.set(t.boundingBox.min, t.boundingBox.max, e), i = Gi), ht(a, n)) {
1046
+ const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(l, r), A = ft(a, n);
1047
1047
  if (Fe.copy(e).invert(), t.boundsTree)
1048
- return $(c, o, ns), ns.matrix.copy(Fe), ns.needsUpdate = !0, t.boundsTree.shapecast({
1048
+ return $(l, o, ns), ns.matrix.copy(Fe), 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;
@@ -1062,18 +1062,18 @@ function oi(c, s, t, e, i = null) {
1062
1062
  return !0;
1063
1063
  }
1064
1064
  } else {
1065
- const E = c + 8, d = r[c + 6];
1065
+ const E = l + 8, d = r[l + 6];
1066
1066
  return $(E, o, is), !!(i.intersectsBox(is) && oi(E, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && oi(d, s, t, e, i)));
1067
1067
  }
1068
1068
  }
1069
1069
  const os = /* @__PURE__ */ new Mt(), Ys = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Do = /* @__PURE__ */ new M(), Uo = /* @__PURE__ */ new M(), xo = /* @__PURE__ */ new M(), bo = /* @__PURE__ */ new M();
1070
- function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1070
+ function vo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1071
1071
  s.boundingBox || s.computeBoundingBox(), Ys.set(s.boundingBox.min, s.boundingBox.max, t), Ys.needsUpdate = !0;
1072
- const r = c.geometry, a = r.attributes.position, l = 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, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1073
1073
  let p = Do, R = Uo, A = null, C = null;
1074
1074
  i && (A = xo, C = bo);
1075
1075
  let T = 1 / 0, F = null, f = null;
1076
- return os.copy(t).invert(), ge.matrix.copy(os), c.shapecast(
1076
+ return os.copy(t).invert(), ge.matrix.copy(os), l.shapecast(
1077
1077
  {
1078
1078
  boundsTraverseOrder: (m) => Ys.distanceToBox(m),
1079
1079
  intersectsBounds: (m, g, S) => S < T && S < n ? (g && (ge.min.copy(m.min), ge.max.copy(m.max), ge.needsUpdate = !0), !0) : !1,
@@ -1081,14 +1081,14 @@ function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1081
1081
  if (s.boundsTree)
1082
1082
  return s.boundsTree.shapecast({
1083
1083
  boundsTraverseOrder: (_) => ge.distanceToBox(_),
1084
- intersectsBounds: (_, N, y) => y < T && y < n,
1084
+ intersectsBounds: (_, N, L) => L < T && L < n,
1085
1085
  intersectsRange: (_, N) => {
1086
- for (let y = _, w = _ + N; y < w; y++) {
1087
- tt(u, 3 * y, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
- for (let L = m, U = m + g; L < U; L++) {
1089
- tt(h, 3 * L, l, a), h.needsUpdate = !0;
1086
+ for (let L = _, w = _ + N; L < w; L++) {
1087
+ tt(u, 3 * L, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
+ for (let P = m, D = m + g; P < D; P++) {
1089
+ tt(h, 3 * P, c, a), h.needsUpdate = !0;
1090
1090
  const x = h.distanceToTriangle(u, p, A);
1091
- if (x < T && (R.copy(p), C && C.copy(A), T = x, F = L, f = y), x < o)
1091
+ if (x < T && (R.copy(p), C && C.copy(A), T = x, F = P, f = L), x < o)
1092
1092
  return !0;
1093
1093
  }
1094
1094
  }
@@ -1098,10 +1098,10 @@ function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1098
1098
  const S = pe(s);
1099
1099
  for (let _ = 0, N = S; _ < N; _++) {
1100
1100
  tt(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
- for (let y = m, w = m + g; y < w; y++) {
1102
- tt(h, 3 * y, l, a), h.needsUpdate = !0;
1103
- const L = h.distanceToTriangle(u, p, A);
1104
- if (L < T && (R.copy(p), C && C.copy(A), T = L, F = y, f = _), L < o)
1101
+ for (let L = m, w = m + g; L < w; L++) {
1102
+ tt(h, 3 * L, c, a), h.needsUpdate = !0;
1103
+ const P = h.distanceToTriangle(u, p, A);
1104
+ if (P < T && (R.copy(p), C && C.copy(A), T = P, F = L, f = _), P < o)
1105
1105
  return !0;
1106
1106
  }
1107
1107
  }
@@ -1110,24 +1110,24 @@ function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1110
1110
  }
1111
1111
  ), It.releasePrimitive(h), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(R) : e.point = R.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), R.applyMatrix4(os), i.distance = R.sub(i.point).length(), i.faceIndex = f), e);
1112
1112
  }
1113
- function Bo(c, s = null) {
1113
+ function Bo(l, s = null) {
1114
1114
  s && Array.isArray(s) && (s = new Set(s));
1115
- const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
1116
- let o, n, r, a, l = 0;
1117
- const E = c._roots;
1115
+ const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
1116
+ let o, n, r, a, c = 0;
1117
+ const E = l._roots;
1118
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, l), l += o.byteLength;
1119
+ o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
1120
  function d(h, u, p = !1) {
1121
1121
  const R = h * 2;
1122
- if (r[R + 15] === ys) {
1122
+ if (r[R + 15] === Ls) {
1123
1123
  const C = n[h + 6], T = r[R + 14];
1124
1124
  let F = 1 / 0, f = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
1125
- for (let N = C, y = C + T; N < y; N++) {
1126
- const w = 3 * c.resolveTriangleIndex(N);
1127
- for (let L = 0; L < 3; L++) {
1128
- let U = w + L;
1129
- U = e ? e[U] : U;
1130
- const x = i.getX(U), B = i.getY(U), H = i.getZ(U);
1125
+ for (let N = C, L = C + T; N < L; N++) {
1126
+ const w = 3 * l.resolveTriangleIndex(N);
1127
+ for (let P = 0; P < 3; P++) {
1128
+ let D = w + P;
1129
+ D = e ? e[D] : D;
1130
+ const x = i.getX(D), B = i.getY(D), H = i.getZ(D);
1131
1131
  x < F && (F = x), x > g && (g = x), B < f && (f = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
1132
1132
  }
1133
1133
  }
@@ -1137,78 +1137,78 @@ function Bo(c, s = null) {
1137
1137
  let m = p, g = !1, S = !1;
1138
1138
  s ? m || (g = s.has(F), S = s.has(f), m = !g && !S) : (g = !0, S = !0);
1139
1139
  const _ = m || g, N = m || S;
1140
- let y = !1;
1141
- _ && (y = d(C, u, m));
1140
+ let L = !1;
1141
+ _ && (L = d(C, u, m));
1142
1142
  let w = !1;
1143
1143
  N && (w = d(T, u, m));
1144
- const L = y || w;
1145
- if (L)
1146
- for (let U = 0; U < 3; U++) {
1147
- const x = C + U, B = T + U, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
1148
- a[h + U] = H < et ? H : et, a[h + U + 3] = q > Q ? q : Q;
1144
+ const P = L || w;
1145
+ if (P)
1146
+ for (let D = 0; D < 3; D++) {
1147
+ const x = C + D, B = T + D, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
1148
+ a[h + D] = H < et ? H : et, a[h + D + 3] = q > Q ? q : Q;
1149
1149
  }
1150
- return L;
1150
+ return P;
1151
1151
  }
1152
1152
  }
1153
1153
  }
1154
- const Gi = /* @__PURE__ */ new M();
1155
- function Yo(c, s, t, e, i) {
1156
- Z.setBuffer(c._roots[s]), ri(0, c, t, e, i), Z.clearBuffer();
1154
+ const Vi = /* @__PURE__ */ new M();
1155
+ function Yo(l, s, t, e, i) {
1156
+ Z.setBuffer(l._roots[s]), ri(0, l, t, e, i), Z.clearBuffer();
1157
1157
  }
1158
- function ri(c, s, t, e, i) {
1159
- const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
1158
+ function ri(l, s, t, e, i) {
1159
+ const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
1160
1160
  if (ht(a, n)) {
1161
- const E = Et(c, r), d = ft(a, n);
1161
+ const E = Et(l, r), d = ft(a, n);
1162
1162
  _o(s, t, e, E, d, i);
1163
1163
  } else {
1164
- const E = pt(c);
1165
- Gt(E, o, e, Gi) && ri(E, s, t, e, i);
1166
- const d = Ct(c, r);
1167
- Gt(d, o, e, Gi) && ri(d, s, t, e, i);
1164
+ const E = pt(l);
1165
+ Vt(E, o, e, Vi) && ri(E, s, t, e, i);
1166
+ const d = Ct(l, r);
1167
+ Vt(d, o, e, Vi) && ri(d, s, t, e, i);
1168
1168
  }
1169
1169
  }
1170
- const zi = /* @__PURE__ */ new M(), Vo = ["x", "y", "z"];
1171
- function Go(c, s, t, e) {
1172
- Z.setBuffer(c._roots[s]);
1173
- const i = ai(0, c, t, e);
1170
+ const zi = /* @__PURE__ */ new M(), Go = ["x", "y", "z"];
1171
+ function Vo(l, s, t, e) {
1172
+ Z.setBuffer(l._roots[s]);
1173
+ const i = ai(0, l, t, e);
1174
1174
  return Z.clearBuffer(), i;
1175
1175
  }
1176
- function ai(c, s, t, e) {
1176
+ function ai(l, s, t, e) {
1177
1177
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1178
- let r = c * 2;
1178
+ let r = l * 2;
1179
1179
  if (ht(r, o)) {
1180
- const l = Et(c, n), E = ft(r, o);
1181
- return No(s, t, e, l, E);
1180
+ const c = Et(l, n), E = ft(r, o);
1181
+ return No(s, t, e, c, E);
1182
1182
  } else {
1183
- const l = Nn(c, n), E = Vo[l], h = e.direction[E] >= 0;
1183
+ const c = Nn(l, n), E = Go[c], h = e.direction[E] >= 0;
1184
1184
  let u, p;
1185
- h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
1186
- const A = Gt(u, i, e, zi) ? ai(u, s, t, e) : null;
1185
+ h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1186
+ const A = Vt(u, i, e, zi) ? ai(u, s, t, e) : null;
1187
1187
  if (A) {
1188
1188
  const F = A.point[E];
1189
- if (h ? F <= i[p + l] : (
1189
+ if (h ? F <= i[p + c] : (
1190
1190
  // min bounding data
1191
- F >= i[p + l + 3]
1191
+ F >= i[p + c + 3]
1192
1192
  ))
1193
1193
  return A;
1194
1194
  }
1195
- const T = Gt(p, i, e, zi) ? ai(p, s, t, e) : null;
1195
+ const T = Vt(p, i, e, zi) ? ai(p, s, t, e) : null;
1196
1196
  return A && T ? A.distance <= T.distance ? A : T : A || T || null;
1197
1197
  }
1198
1198
  }
1199
1199
  const rs = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new gt(), re = /* @__PURE__ */ new gt(), Oe = /* @__PURE__ */ new Mt(), Hi = /* @__PURE__ */ new at(), as = /* @__PURE__ */ new at();
1200
- function zo(c, s, t, e) {
1201
- Z.setBuffer(c._roots[s]);
1202
- const i = ci(0, c, t, e);
1200
+ function zo(l, s, t, e) {
1201
+ Z.setBuffer(l._roots[s]);
1202
+ const i = ci(0, l, t, e);
1203
1203
  return Z.clearBuffer(), i;
1204
1204
  }
1205
- function ci(c, s, t, e, i = null) {
1205
+ function ci(l, s, t, e, i = null) {
1206
1206
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1207
- let a = c * 2;
1207
+ let a = l * 2;
1208
1208
  if (i === null && (t.boundingBox || t.computeBoundingBox(), Hi.set(t.boundingBox.min, t.boundingBox.max, e), i = Hi), ht(a, n)) {
1209
- const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(c, r), A = ft(a, n);
1209
+ const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(l, r), A = ft(a, n);
1210
1210
  if (Oe.copy(e).invert(), t.boundsTree)
1211
- return $(c, o, as), as.matrix.copy(Oe), as.needsUpdate = !0, t.boundsTree.shapecast({
1211
+ return $(l, o, as), as.matrix.copy(Oe), 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;
@@ -1226,36 +1226,36 @@ function ci(c, s, t, e, i = null) {
1226
1226
  return !0;
1227
1227
  }
1228
1228
  } else {
1229
- const E = c + 8, d = r[c + 6];
1229
+ const E = l + 8, d = r[l + 6];
1230
1230
  return $(E, o, rs), !!(i.intersectsBox(rs) && ci(E, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && ci(d, s, t, e, i)));
1231
1231
  }
1232
1232
  }
1233
- const cs = /* @__PURE__ */ new Mt(), Vs = /* @__PURE__ */ new at(), Se = /* @__PURE__ */ new at(), Ho = /* @__PURE__ */ new M(), ko = /* @__PURE__ */ new M(), Wo = /* @__PURE__ */ new M(), Xo = /* @__PURE__ */ new M();
1234
- function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
- s.boundingBox || s.computeBoundingBox(), Vs.set(s.boundingBox.min, s.boundingBox.max, t), Vs.needsUpdate = !0;
1236
- const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1233
+ const cs = /* @__PURE__ */ new Mt(), Gs = /* @__PURE__ */ new at(), Se = /* @__PURE__ */ new at(), Ho = /* @__PURE__ */ new M(), ko = /* @__PURE__ */ new M(), Wo = /* @__PURE__ */ new M(), Xo = /* @__PURE__ */ new M();
1234
+ function Zo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
+ s.boundingBox || s.computeBoundingBox(), Gs.set(s.boundingBox.min, s.boundingBox.max, t), Gs.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();
1237
1237
  let p = Ho, R = ko, A = null, C = null;
1238
1238
  i && (A = Wo, C = Xo);
1239
1239
  let T = 1 / 0, F = null, f = null;
1240
- return cs.copy(t).invert(), Se.matrix.copy(cs), c.shapecast(
1240
+ return cs.copy(t).invert(), Se.matrix.copy(cs), l.shapecast(
1241
1241
  {
1242
- boundsTraverseOrder: (m) => Vs.distanceToBox(m),
1242
+ boundsTraverseOrder: (m) => Gs.distanceToBox(m),
1243
1243
  intersectsBounds: (m, g, S) => S < T && S < n ? (g && (Se.min.copy(m.min), Se.max.copy(m.max), Se.needsUpdate = !0), !0) : !1,
1244
1244
  intersectsRange: (m, g) => {
1245
1245
  if (s.boundsTree) {
1246
1246
  const S = s.boundsTree;
1247
1247
  return S.shapecast({
1248
1248
  boundsTraverseOrder: (_) => Se.distanceToBox(_),
1249
- intersectsBounds: (_, N, y) => y < T && y < n,
1249
+ intersectsBounds: (_, N, L) => L < T && L < n,
1250
1250
  intersectsRange: (_, N) => {
1251
- for (let y = _, w = _ + N; y < w; y++) {
1252
- const L = S.resolveTriangleIndex(y);
1253
- tt(u, 3 * L, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
- for (let U = m, x = m + g; U < x; U++) {
1255
- const B = c.resolveTriangleIndex(U);
1256
- tt(h, 3 * B, l, a), h.needsUpdate = !0;
1251
+ for (let L = _, w = _ + N; L < w; L++) {
1252
+ const P = S.resolveTriangleIndex(L);
1253
+ tt(u, 3 * P, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
+ for (let D = m, x = m + g; D < x; D++) {
1255
+ const B = l.resolveTriangleIndex(D);
1256
+ tt(h, 3 * B, c, a), h.needsUpdate = !0;
1257
1257
  const H = h.distanceToTriangle(u, p, A);
1258
- if (H < T && (R.copy(p), C && C.copy(A), T = H, F = U, f = y), H < o)
1258
+ if (H < T && (R.copy(p), C && C.copy(A), T = H, F = D, f = L), H < o)
1259
1259
  return !0;
1260
1260
  }
1261
1261
  }
@@ -1265,11 +1265,11 @@ function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1265
1265
  const S = pe(s);
1266
1266
  for (let _ = 0, N = S; _ < N; _++) {
1267
1267
  tt(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
- for (let y = m, w = m + g; y < w; y++) {
1269
- const L = c.resolveTriangleIndex(y);
1270
- tt(h, 3 * L, l, a), h.needsUpdate = !0;
1271
- const U = h.distanceToTriangle(u, p, A);
1272
- if (U < T && (R.copy(p), C && C.copy(A), T = U, F = y, f = _), U < o)
1268
+ for (let L = m, w = m + g; L < w; L++) {
1269
+ const P = l.resolveTriangleIndex(L);
1270
+ tt(h, 3 * P, c, a), h.needsUpdate = !0;
1271
+ const D = h.distanceToTriangle(u, p, A);
1272
+ if (D < T && (R.copy(p), C && C.copy(A), T = D, F = L, f = _), D < o)
1273
1273
  return !0;
1274
1274
  }
1275
1275
  }
@@ -1281,24 +1281,24 @@ function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1281
1281
  function Qo() {
1282
1282
  return typeof SharedArrayBuffer < "u";
1283
1283
  }
1284
- const xe = new Z.constructor(), As = new Z.constructor(), Bt = new Ti(() => new Ot()), ae = new Ot(), ce = new Ot(), Gs = new Ot(), zs = new Ot();
1284
+ const xe = new Z.constructor(), As = new Z.constructor(), Bt = new Ti(() => new Ot()), ae = new Ot(), ce = new Ot(), Vs = new Ot(), zs = new Ot();
1285
1285
  let Hs = !1;
1286
- function jo(c, s, t, e) {
1286
+ function jo(l, s, t, e) {
1287
1287
  if (Hs)
1288
1288
  throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
1289
1289
  Hs = !0;
1290
- const i = c._roots, o = s._roots;
1290
+ const i = l._roots, o = s._roots;
1291
1291
  let n, r = 0, a = 0;
1292
- const l = new Mt().copy(t).invert();
1292
+ const c = new Mt().copy(t).invert();
1293
1293
  for (let E = 0, d = i.length; E < d; E++) {
1294
1294
  xe.setBuffer(i[E]), a = 0;
1295
1295
  const h = Bt.getPrimitive();
1296
- $(0, xe.float32Array, h), h.applyMatrix4(l);
1296
+ $(0, xe.float32Array, h), h.applyMatrix4(c);
1297
1297
  for (let u = 0, p = o.length; u < p && (As.setBuffer(o[E]), n = Tt(
1298
1298
  0,
1299
1299
  0,
1300
1300
  t,
1301
- l,
1301
+ c,
1302
1302
  e,
1303
1303
  r,
1304
1304
  a,
@@ -1312,37 +1312,37 @@ function jo(c, s, t, e) {
1312
1312
  }
1313
1313
  return Hs = !1, n;
1314
1314
  }
1315
- function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1315
+ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1316
1316
  let d, h;
1317
1317
  E ? (d = As, h = xe) : (d = xe, h = As);
1318
- const u = d.float32Array, p = d.uint32Array, R = d.uint16Array, A = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = c * 2, f = s * 2, m = ht(F, R), g = ht(f, T);
1318
+ const u = d.float32Array, p = d.uint32Array, R = d.uint16Array, A = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = l * 2, f = s * 2, m = ht(F, R), g = ht(f, T);
1319
1319
  let S = !1;
1320
1320
  if (g && m)
1321
1321
  E ? S = i(
1322
1322
  Et(s, C),
1323
1323
  ft(s * 2, T),
1324
- Et(c, p),
1325
- ft(c * 2, R),
1324
+ Et(l, p),
1325
+ ft(l * 2, R),
1326
1326
  a,
1327
1327
  n + s,
1328
1328
  r,
1329
- o + c
1329
+ o + l
1330
1330
  ) : S = i(
1331
- Et(c, p),
1332
- ft(c * 2, R),
1331
+ Et(l, p),
1332
+ ft(l * 2, R),
1333
1333
  Et(s, C),
1334
1334
  ft(s * 2, T),
1335
1335
  r,
1336
- o + c,
1336
+ o + l,
1337
1337
  a,
1338
1338
  n + s
1339
1339
  );
1340
1340
  else if (g) {
1341
1341
  const _ = Bt.getPrimitive();
1342
1342
  $(s, A, _), _.applyMatrix4(t);
1343
- const N = pt(c), y = Ct(c, p);
1344
- $(N, u, ae), $(y, u, ce);
1345
- const w = _.intersectsBox(ae), L = _.intersectsBox(ce);
1343
+ const N = pt(l), L = Ct(l, p);
1344
+ $(N, u, ae), $(L, u, ce);
1345
+ const w = _.intersectsBox(ae), P = _.intersectsBox(ce);
1346
1346
  S = w && Tt(
1347
1347
  s,
1348
1348
  N,
@@ -1355,9 +1355,9 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1355
1355
  r + 1,
1356
1356
  _,
1357
1357
  !E
1358
- ) || L && Tt(
1358
+ ) || P && Tt(
1359
1359
  s,
1360
- y,
1360
+ L,
1361
1361
  e,
1362
1362
  t,
1363
1363
  i,
@@ -1370,11 +1370,11 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1370
1370
  ), Bt.releasePrimitive(_);
1371
1371
  } else {
1372
1372
  const _ = pt(s), N = Ct(s, C);
1373
- $(_, A, Gs), $(N, A, zs);
1374
- const y = l.intersectsBox(Gs), w = l.intersectsBox(zs);
1375
- if (y && w)
1373
+ $(_, A, Vs), $(N, A, zs);
1374
+ const L = c.intersectsBox(Vs), w = c.intersectsBox(zs);
1375
+ if (L && w)
1376
1376
  S = Tt(
1377
- c,
1377
+ l,
1378
1378
  _,
1379
1379
  t,
1380
1380
  e,
@@ -1383,10 +1383,10 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1383
1383
  n,
1384
1384
  r,
1385
1385
  a + 1,
1386
- l,
1386
+ c,
1387
1387
  E
1388
1388
  ) || Tt(
1389
- c,
1389
+ l,
1390
1390
  N,
1391
1391
  t,
1392
1392
  e,
@@ -1395,13 +1395,13 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1395
1395
  n,
1396
1396
  r,
1397
1397
  a + 1,
1398
- l,
1398
+ c,
1399
1399
  E
1400
1400
  );
1401
- else if (y)
1401
+ else if (L)
1402
1402
  if (m)
1403
1403
  S = Tt(
1404
- c,
1404
+ l,
1405
1405
  _,
1406
1406
  t,
1407
1407
  e,
@@ -1410,18 +1410,18 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1410
1410
  n,
1411
1411
  r,
1412
1412
  a + 1,
1413
- l,
1413
+ c,
1414
1414
  E
1415
1415
  );
1416
1416
  else {
1417
- const L = Bt.getPrimitive();
1418
- L.copy(Gs).applyMatrix4(t);
1419
- const U = pt(c), x = Ct(c, p);
1420
- $(U, u, ae), $(x, u, ce);
1421
- const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
1417
+ const P = Bt.getPrimitive();
1418
+ P.copy(Vs).applyMatrix4(t);
1419
+ const D = pt(l), x = Ct(l, p);
1420
+ $(D, u, ae), $(x, u, ce);
1421
+ const B = P.intersectsBox(ae), H = P.intersectsBox(ce);
1422
1422
  S = B && Tt(
1423
1423
  _,
1424
- U,
1424
+ D,
1425
1425
  e,
1426
1426
  t,
1427
1427
  i,
@@ -1429,7 +1429,7 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1429
1429
  o,
1430
1430
  a,
1431
1431
  r + 1,
1432
- L,
1432
+ P,
1433
1433
  !E
1434
1434
  ) || H && Tt(
1435
1435
  _,
@@ -1441,14 +1441,14 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1441
1441
  o,
1442
1442
  a,
1443
1443
  r + 1,
1444
- L,
1444
+ P,
1445
1445
  !E
1446
- ), Bt.releasePrimitive(L);
1446
+ ), Bt.releasePrimitive(P);
1447
1447
  }
1448
1448
  else if (w)
1449
1449
  if (m)
1450
1450
  S = Tt(
1451
- c,
1451
+ l,
1452
1452
  N,
1453
1453
  t,
1454
1454
  e,
@@ -1457,18 +1457,18 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1457
1457
  n,
1458
1458
  r,
1459
1459
  a + 1,
1460
- l,
1460
+ c,
1461
1461
  E
1462
1462
  );
1463
1463
  else {
1464
- const L = Bt.getPrimitive();
1465
- L.copy(zs).applyMatrix4(t);
1466
- const U = pt(c), x = Ct(c, p);
1467
- $(U, u, ae), $(x, u, ce);
1468
- const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
1464
+ const P = Bt.getPrimitive();
1465
+ P.copy(zs).applyMatrix4(t);
1466
+ const D = pt(l), x = Ct(l, p);
1467
+ $(D, u, ae), $(x, u, ce);
1468
+ const B = P.intersectsBox(ae), H = P.intersectsBox(ce);
1469
1469
  S = B && Tt(
1470
1470
  N,
1471
- U,
1471
+ D,
1472
1472
  e,
1473
1473
  t,
1474
1474
  i,
@@ -1476,7 +1476,7 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1476
1476
  o,
1477
1477
  a,
1478
1478
  r + 1,
1479
- L,
1479
+ P,
1480
1480
  !E
1481
1481
  ) || H && Tt(
1482
1482
  N,
@@ -1488,9 +1488,9 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1488
1488
  o,
1489
1489
  a,
1490
1490
  r + 1,
1491
- L,
1491
+ P,
1492
1492
  !E
1493
- ), Bt.releasePrimitive(L);
1493
+ ), Bt.releasePrimitive(P);
1494
1494
  }
1495
1495
  }
1496
1496
  return S;
@@ -1524,8 +1524,8 @@ class mi {
1524
1524
  if (r._roots = o, r._indirectBuffer = n || null, e.setIndex) {
1525
1525
  const a = t.getIndex();
1526
1526
  if (a === null) {
1527
- const l = new An(s.index, 1, !1);
1528
- t.setIndex(l);
1527
+ const c = new An(s.index, 1, !1);
1528
+ t.setIndex(c);
1529
1529
  } else
1530
1530
  a.array !== i && (a.array.set(i), a.needsUpdate = !0);
1531
1531
  }
@@ -1565,9 +1565,9 @@ class mi {
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 l = r * 2, E = o[l + 15] === ys;
1568
+ const c = r * 2, E = o[c + 15] === Ls;
1569
1569
  if (E) {
1570
- const d = i[r + 6], h = o[l + 14];
1570
+ const d = i[r + 6], h = o[c + 14];
1571
1571
  s(a, E, new Float32Array(e, r * 4, 6), d, h);
1572
1572
  } else {
1573
1573
  const d = r + Ts / 4, h = i[r + 6], u = i[r + 7];
@@ -1577,9 +1577,9 @@ class mi {
1577
1577
  }
1578
1578
  /* Core Cast Functions */
1579
1579
  raycast(s, t = _i) {
1580
- const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, l = n ? t.side : t, E = this.indirect ? Yo : yo;
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 ? Yo : Lo;
1581
1581
  for (let d = 0, h = e.length; d < h; d++) {
1582
- const u = r ? t[a[d].materialIndex].side : l, p = o.length;
1582
+ const u = r ? t[a[d].materialIndex].side : c, p = o.length;
1583
1583
  if (E(this, d, u, s, o), r) {
1584
1584
  const R = a[d].materialIndex;
1585
1585
  for (let A = p, C = o.length; A < C; A++)
@@ -1591,9 +1591,9 @@ class mi {
1591
1591
  raycastFirst(s, t = _i) {
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, l = o ? t.side : t, E = this.indirect ? Go : Mo;
1594
+ const a = i.groups, c = o ? t.side : t, E = this.indirect ? Vo : Mo;
1595
1595
  for (let d = 0, h = e.length; d < h; d++) {
1596
- const u = n ? t[a[d].materialIndex].side : l, p = E(this, d, u, s);
1596
+ const u = n ? t[a[d].materialIndex].side : c, p = E(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;
@@ -1606,7 +1606,7 @@ class mi {
1606
1606
  return e;
1607
1607
  }
1608
1608
  shapecast(s) {
1609
- const t = It.getPrimitive(), e = this.indirect ? Po : Oo;
1609
+ const t = It.getPrimitive(), e = this.indirect ? yo : Oo;
1610
1610
  let {
1611
1611
  boundsTraverseOrder: i,
1612
1612
  intersectsBounds: o,
@@ -1618,13 +1618,13 @@ class mi {
1618
1618
  n = (h, u, p, R, A) => d(h, u, p, R, A) ? !0 : e(h, u, this, r, p, R, t);
1619
1619
  } else
1620
1620
  n || (r ? n = (d, h, u, p) => e(d, h, this, r, u, p, t) : n = (d, h, u) => u);
1621
- let a = !1, l = 0;
1621
+ let a = !1, c = 0;
1622
1622
  const E = this._roots;
1623
1623
  for (let d = 0, h = E.length; d < h; d++) {
1624
1624
  const u = E[d];
1625
- if (a = To(this, d, o, n, i, l), a)
1625
+ if (a = To(this, d, o, n, i, c), a)
1626
1626
  break;
1627
- l += u.byteLength;
1627
+ c += u.byteLength;
1628
1628
  }
1629
1629
  return It.releasePrimitive(t), a;
1630
1630
  }
@@ -1633,7 +1633,7 @@ class mi {
1633
1633
  intersectsRanges: i,
1634
1634
  intersectsTriangles: o
1635
1635
  } = e;
1636
- const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, l = this.indirect ? (p) => {
1636
+ const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, c = this.indirect ? (p) => {
1637
1637
  const R = this.resolveTriangleIndex(p);
1638
1638
  tt(n, R * 3, r, a);
1639
1639
  } : (p) => {
@@ -1648,8 +1648,8 @@ class mi {
1648
1648
  const p = (R, A, C, T, F, f, m, g) => {
1649
1649
  for (let S = C, _ = C + T; S < _; S++) {
1650
1650
  u(S), E.a.applyMatrix4(t), E.b.applyMatrix4(t), E.c.applyMatrix4(t), E.needsUpdate = !0;
1651
- for (let N = R, y = R + A; N < y; N++)
1652
- if (l(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, g))
1651
+ for (let N = R, L = R + A; N < L; N++)
1652
+ if (c(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, g))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
@@ -1707,36 +1707,36 @@ class mi {
1707
1707
  }), s;
1708
1708
  }
1709
1709
  }
1710
- function Wi(c, s, t) {
1711
- return c === null || (c.point.applyMatrix4(s.matrixWorld), c.distance = c.point.distanceTo(t.ray.origin), c.object = s, c.distance < t.near || c.distance > t.far) ? null : c;
1710
+ function Wi(l, s, t) {
1711
+ return l === null || (l.point.applyMatrix4(s.matrixWorld), l.distance = l.point.distanceTo(t.ray.origin), l.object = s, l.distance < t.near || l.distance > t.far) ? null : l;
1712
1712
  }
1713
- const ks = /* @__PURE__ */ new Gn(), Xi = /* @__PURE__ */ new Mt(), qo = v.prototype.raycast;
1714
- function $o(c, s) {
1713
+ const ks = /* @__PURE__ */ new Vn(), Xi = /* @__PURE__ */ new Mt(), qo = v.prototype.raycast;
1714
+ function $o(l, s) {
1715
1715
  if (this.geometry.boundsTree) {
1716
1716
  if (this.material === void 0)
1717
1717
  return;
1718
- Xi.copy(this.matrixWorld).invert(), ks.copy(c.ray).applyMatrix4(Xi);
1718
+ Xi.copy(this.matrixWorld).invert(), ks.copy(l.ray).applyMatrix4(Xi);
1719
1719
  const t = this.geometry.boundsTree;
1720
- if (c.firstHitOnly === !0) {
1721
- const e = Wi(t.raycastFirst(ks, this.material), this, c);
1720
+ if (l.firstHitOnly === !0) {
1721
+ const e = Wi(t.raycastFirst(ks, this.material), this, l);
1722
1722
  e && s.push(e);
1723
1723
  } else {
1724
1724
  const e = t.raycast(ks, this.material);
1725
1725
  for (let i = 0, o = e.length; i < o; i++) {
1726
- const n = Wi(e[i], this, c);
1726
+ const n = Wi(e[i], this, l);
1727
1727
  n && s.push(n);
1728
1728
  }
1729
1729
  }
1730
1730
  } else
1731
- qo.call(this, c, s);
1731
+ qo.call(this, l, s);
1732
1732
  }
1733
- function Ko(c) {
1734
- return this.boundsTree = new mi(this, c), this.boundsTree;
1733
+ function Ko(l) {
1734
+ return this.boundsTree = new mi(this, l), this.boundsTree;
1735
1735
  }
1736
1736
  function Jo() {
1737
1737
  this.boundsTree = null;
1738
1738
  }
1739
- class D {
1739
+ class U {
1740
1740
  constructor() {
1741
1741
  /** Triggers all the callbacks assigned to this event. */
1742
1742
  I(this, "trigger", (s) => {
@@ -1815,7 +1815,7 @@ class Ai extends Ri {
1815
1815
  constructor(t) {
1816
1816
  super(t);
1817
1817
  I(this, "worlds", /* @__PURE__ */ new Map());
1818
- I(this, "onWorldChanged", new D());
1818
+ I(this, "onWorldChanged", new U());
1819
1819
  I(this, "currentWorld", null);
1820
1820
  this.onWorldChanged.add(({ world: e, action: i }) => {
1821
1821
  i === "removed" && this.worlds.delete(e.uuid);
@@ -1833,17 +1833,17 @@ class sr extends Ai {
1833
1833
  constructor() {
1834
1834
  super(...arguments);
1835
1835
  /** {@link Updateable.onBeforeUpdate} */
1836
- I(this, "onAfterUpdate", new D());
1836
+ I(this, "onAfterUpdate", new U());
1837
1837
  /** {@link Updateable.onAfterUpdate} */
1838
- I(this, "onBeforeUpdate", new D());
1838
+ I(this, "onBeforeUpdate", new U());
1839
1839
  /** {@link Disposable.onDisposed} */
1840
- I(this, "onDisposed", new D());
1841
- I(this, "onResize", new D());
1840
+ I(this, "onDisposed", new U());
1841
+ I(this, "onResize", new U());
1842
1842
  /**
1843
1843
  * Event that fires when there has been a change to the list of clipping
1844
1844
  * planes used by the active renderer.
1845
1845
  */
1846
- I(this, "onClippingPlanesUpdated", new D());
1846
+ I(this, "onClippingPlanesUpdated", new U());
1847
1847
  /**
1848
1848
  * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1849
1849
  * instance of the renderer.
@@ -1936,7 +1936,7 @@ class ir extends Ai {
1936
1936
  constructor(t) {
1937
1937
  super(t);
1938
1938
  /** {@link Disposable.onDisposed} */
1939
- I(this, "onDisposed", new D());
1939
+ I(this, "onDisposed", new U());
1940
1940
  }
1941
1941
  /** {@link Disposable.dispose} */
1942
1942
  dispose() {
@@ -1948,7 +1948,7 @@ class ir extends Ai {
1948
1948
  this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
1949
1949
  }
1950
1950
  }
1951
- const ms = 0, nr = 1, or = new M(), Zi = new Lt(), Ws = new pi(), Qi = new M(), hs = new ue();
1951
+ const ms = 0, nr = 1, or = new M(), Zi = new Pt(), Ws = new pi(), Qi = new M(), hs = new ue();
1952
1952
  class rr {
1953
1953
  constructor() {
1954
1954
  this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new ji(), this.unassigned = new ji(), this.vertices = [];
@@ -1987,10 +1987,10 @@ class rr {
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], l = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
1991
- if (l > 0 && E >= 0)
1990
+ const a = e[n], c = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
1991
+ if (c > 0 && E >= 0)
1992
1992
  return null;
1993
- const d = E !== 0 ? -l / E : 0;
1993
+ const d = E !== 0 ? -c / E : 0;
1994
1994
  if (!(d <= 0) && (E > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
1995
1995
  return null;
1996
1996
  }
@@ -2063,10 +2063,10 @@ class rr {
2063
2063
  s.copy(this.vertices[0].point), t.copy(this.vertices[0].point);
2064
2064
  for (let o = 0, n = this.vertices.length; o < n; o++) {
2065
2065
  const r = this.vertices[o], a = r.point;
2066
- for (let l = 0; l < 3; l++)
2067
- a.getComponent(l) < s.getComponent(l) && (s.setComponent(l, a.getComponent(l)), e[l] = r);
2068
- for (let l = 0; l < 3; l++)
2069
- a.getComponent(l) > t.getComponent(l) && (t.setComponent(l, a.getComponent(l)), i[l] = r);
2066
+ for (let c = 0; c < 3; c++)
2067
+ a.getComponent(c) < s.getComponent(c) && (s.setComponent(c, a.getComponent(c)), e[c] = r);
2068
+ for (let c = 0; c < 3; c++)
2069
+ a.getComponent(c) > t.getComponent(c) && (t.setComponent(c, a.getComponent(c)), i[c] = r);
2070
2070
  }
2071
2071
  return this.tolerance = 3 * Number.EPSILON * (Math.max(Math.abs(s.x), Math.abs(t.x)) + Math.max(Math.abs(s.y), Math.abs(t.y)) + Math.max(Math.abs(s.z), Math.abs(t.z))), { min: e, max: i };
2072
2072
  }
@@ -2080,20 +2080,20 @@ class rr {
2080
2080
  u > o && (o = u, n = h);
2081
2081
  }
2082
2082
  const r = e[n], a = i[n];
2083
- let l, E;
2083
+ let c, E;
2084
2084
  o = 0, Zi.set(r.point, a.point);
2085
2085
  for (let h = 0, u = this.vertices.length; h < u; h++) {
2086
2086
  const p = s[h];
2087
2087
  if (p !== r && p !== a) {
2088
2088
  Zi.closestPointToPoint(p.point, !0, Qi);
2089
2089
  const R = Qi.distanceToSquared(p.point);
2090
- R > o && (o = R, l = p);
2090
+ R > o && (o = R, c = p);
2091
2091
  }
2092
2092
  }
2093
- o = -1, Ws.setFromCoplanarPoints(r.point, a.point, l.point);
2093
+ o = -1, Ws.setFromCoplanarPoints(r.point, a.point, c.point);
2094
2094
  for (let h = 0, u = this.vertices.length; h < u; h++) {
2095
2095
  const p = s[h];
2096
- if (p !== r && p !== a && p !== l) {
2096
+ if (p !== r && p !== a && p !== c) {
2097
2097
  const R = Math.abs(Ws.distanceToPoint(p.point));
2098
2098
  R > o && (o = R, E = p);
2099
2099
  }
@@ -2101,10 +2101,10 @@ class rr {
2101
2101
  const d = [];
2102
2102
  if (Ws.distanceToPoint(E.point) < 0) {
2103
2103
  d.push(
2104
- Rt.create(r, a, l),
2104
+ Rt.create(r, a, c),
2105
2105
  Rt.create(E, a, r),
2106
- Rt.create(E, l, a),
2107
- Rt.create(E, r, l)
2106
+ Rt.create(E, c, a),
2107
+ Rt.create(E, r, c)
2108
2108
  );
2109
2109
  for (let h = 0; h < 3; h++) {
2110
2110
  const u = (h + 1) % 3;
@@ -2112,10 +2112,10 @@ class rr {
2112
2112
  }
2113
2113
  } else {
2114
2114
  d.push(
2115
- Rt.create(r, l, a),
2115
+ Rt.create(r, c, a),
2116
2116
  Rt.create(E, r, a),
2117
- Rt.create(E, a, l),
2118
- Rt.create(E, l, r)
2117
+ Rt.create(E, a, c),
2118
+ Rt.create(E, c, r)
2119
2119
  );
2120
2120
  for (let h = 0; h < 3; h++) {
2121
2121
  const u = (h + 1) % 3;
@@ -2126,7 +2126,7 @@ class rr {
2126
2126
  this.faces.push(d[h]);
2127
2127
  for (let h = 0, u = s.length; h < u; h++) {
2128
2128
  const p = s[h];
2129
- if (p !== r && p !== a && p !== l && p !== E) {
2129
+ if (p !== r && p !== a && p !== c && p !== E) {
2130
2130
  o = this.tolerance;
2131
2131
  let R = null;
2132
2132
  for (let A = 0; A < 4; A++) {
@@ -2299,54 +2299,54 @@ class ji {
2299
2299
  }
2300
2300
  }
2301
2301
  const li = [2, 2, 1], hi = [1, 0, 0];
2302
- function Pt(c, s) {
2303
- return c * 3 + s;
2302
+ function yt(l, s) {
2303
+ return l * 3 + s;
2304
2304
  }
2305
- function cr(c) {
2306
- const s = c.elements;
2305
+ function cr(l) {
2306
+ const s = l.elements;
2307
2307
  let t = 0;
2308
2308
  for (let e = 0; e < 9; e++)
2309
2309
  t += s[e] * s[e];
2310
2310
  return Math.sqrt(t);
2311
2311
  }
2312
- function lr(c) {
2313
- const s = c.elements;
2312
+ function lr(l) {
2313
+ const s = l.elements;
2314
2314
  let t = 0;
2315
2315
  for (let e = 0; e < 3; e++) {
2316
- const i = s[Pt(li[e], hi[e])];
2316
+ const i = s[yt(li[e], hi[e])];
2317
2317
  t += 2 * i * i;
2318
2318
  }
2319
2319
  return Math.sqrt(t);
2320
2320
  }
2321
- function hr(c, s) {
2321
+ function hr(l, s) {
2322
2322
  let t = 0, e = 1;
2323
- const i = c.elements;
2324
- for (let l = 0; l < 3; l++) {
2325
- const E = Math.abs(i[Pt(li[l], hi[l])]);
2326
- E > t && (t = E, e = l);
2323
+ const i = l.elements;
2324
+ for (let c = 0; c < 3; c++) {
2325
+ const E = Math.abs(i[yt(li[c], hi[c])]);
2326
+ E > t && (t = E, e = c);
2327
2327
  }
2328
2328
  let o = 1, n = 0;
2329
2329
  const r = hi[e], a = li[e];
2330
- if (Math.abs(i[Pt(a, r)]) > Number.EPSILON) {
2331
- const l = i[Pt(a, a)], E = i[Pt(r, r)], d = i[Pt(a, r)], h = (l - E) / 2 / d;
2330
+ if (Math.abs(i[yt(a, r)]) > Number.EPSILON) {
2331
+ const c = i[yt(a, a)], E = i[yt(r, r)], d = i[yt(a, r)], h = (c - E) / 2 / d;
2332
2332
  let u;
2333
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;
2334
2334
  }
2335
- return s.identity(), s.elements[Pt(r, r)] = o, s.elements[Pt(a, a)] = o, s.elements[Pt(a, r)] = n, s.elements[Pt(r, a)] = -n, s;
2335
+ return s.identity(), s.elements[yt(r, r)] = o, s.elements[yt(a, a)] = o, s.elements[yt(a, r)] = n, s.elements[yt(r, a)] = -n, s;
2336
2336
  }
2337
- function Er(c, s) {
2337
+ function Er(l, s) {
2338
2338
  let t = 0, e = 0;
2339
2339
  const i = 10;
2340
- s.unitary.identity(), s.diagonal.copy(c);
2341
- const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), l = Number.EPSILON * cr(n);
2342
- for (; e < i && lr(n) > l; )
2340
+ s.unitary.identity(), s.diagonal.copy(l);
2341
+ const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), c = Number.EPSILON * cr(n);
2342
+ for (; e < i && lr(n) > c; )
2343
2343
  hr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
2344
2344
  return s;
2345
2345
  }
2346
- function dr(c) {
2346
+ function dr(l) {
2347
2347
  const s = [];
2348
- for (let st = 0; st < c.length - 2; st += 3) {
2349
- const Xt = c[st], J = c[st + 1], Kt = c[st + 2];
2348
+ for (let st = 0; st < l.length - 2; st += 3) {
2349
+ const Xt = l[st], J = l[st + 1], Kt = l[st + 2];
2350
2350
  s.push(new O.Vector3(Xt, J, Kt));
2351
2351
  }
2352
2352
  const t = new rr();
@@ -2368,26 +2368,26 @@ function dr(c) {
2368
2368
  n.push(Ms.point.x, Ms.point.y, Ms.point.z), n.push(ws.point.x, ws.point.y, ws.point.z), n.push(Ds.point.x, Ds.point.y, Ds.point.z);
2369
2369
  }
2370
2370
  }
2371
- const r = new O.Vector3(), a = new O.Vector3(), l = new O.Vector3(), E = new O.Vector3(), d = new O.Vector3(), h = new O.Vector3(), u = new O.Vector3(), p = new O.Vector3();
2371
+ const r = new O.Vector3(), a = new O.Vector3(), c = new O.Vector3(), E = new O.Vector3(), d = new O.Vector3(), h = new O.Vector3(), u = new O.Vector3(), p = new O.Vector3();
2372
2372
  let R = 0, A = 0, C = 0, T = 0, F = 0, f = 0, m = 0;
2373
2373
  for (let st = 0, Xt = n.length; st < Xt; st += 9) {
2374
- r.fromArray(n, st), a.fromArray(n, st + 3), l.fromArray(n, st + 6), u.set(0, 0, 0), u.add(r).add(a).add(l).divideScalar(3), E.subVectors(a, r), d.subVectors(l, r);
2374
+ r.fromArray(n, st), a.fromArray(n, st + 3), c.fromArray(n, st + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), E.subVectors(a, r), d.subVectors(c, r);
2375
2375
  const J = h.crossVectors(E, d).length() / 2;
2376
- p.add(h.copy(u).multiplyScalar(J)), R += J, A += (9 * u.x * u.x + r.x * r.x + a.x * a.x + l.x * l.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + l.x * l.y) * (J / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + l.x * l.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + l.y * l.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + l.y * l.z) * (J / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + l.z * l.z) * (J / 12);
2376
+ p.add(h.copy(u).multiplyScalar(J)), R += J, A += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (J / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
2377
2377
  }
2378
2378
  p.divideScalar(R), A /= R, C /= R, T /= R, F /= R, f /= R, m /= R, A -= 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 g = new O.Matrix3();
2380
2380
  g.elements[0] = A, g.elements[1] = C, g.elements[2] = T, g.elements[3] = C, g.elements[4] = F, g.elements[5] = f, g.elements[6] = T, g.elements[7] = f, g.elements[8] = m, Er(g, e);
2381
- const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(), y = new O.Vector3();
2382
- S.extractBasis(_, N, y);
2383
- let w = -1 / 0, L = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
2381
+ const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(), L = new O.Vector3();
2382
+ S.extractBasis(_, N, L);
2383
+ let w = -1 / 0, P = -1 / 0, D = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
2384
2384
  for (let st = 0, Xt = s.length; st < Xt; st++) {
2385
2385
  const J = s[st];
2386
- w = Math.max(_.dot(J), w), L = Math.max(N.dot(J), L), U = Math.max(y.dot(J), U), x = Math.min(_.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(y.dot(J), H);
2386
+ w = Math.max(_.dot(J), w), P = Math.max(N.dot(J), P), D = Math.max(L.dot(J), D), x = Math.min(_.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(L.dot(J), H);
2387
2387
  }
2388
- _.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + L)), y.multiplyScalar(0.5 * (H + U));
2388
+ _.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + P)), L.multiplyScalar(0.5 * (H + D));
2389
2389
  const q = new O.Vector3(), et = new O.Vector3(), Q = new O.Matrix3();
2390
- q.add(_).add(N).add(y), et.x = w - x, et.y = L - B, et.z = U - H, et.multiplyScalar(0.5), Q.copy(S);
2390
+ q.add(_).add(N).add(L), et.x = w - x, et.y = P - B, et.z = D - H, et.multiplyScalar(0.5), Q.copy(S);
2391
2391
  const { x: Ht, y: kt, z: Wt } = et, Xe = new O.Matrix4();
2392
2392
  Xe.makeScale(Ht * 2, kt * 2, Wt * 2);
2393
2393
  const Ce = new O.Matrix4();
@@ -2399,11 +2399,11 @@ function dr(c) {
2399
2399
  const Te = new O.Matrix4();
2400
2400
  return Te.multiply(Oi), Te.multiply(Si), Te.multiply(Ce), Te.multiply(Xe), { center: q, halfSizes: et, rotation: Q, transformation: Te };
2401
2401
  }
2402
- function ur(c, s, t) {
2402
+ function ur(l, s, t) {
2403
2403
  const e = [
2404
- c[0] - s[0],
2405
- c[1] - s[1],
2406
- c[2] - s[2]
2404
+ l[0] - s[0],
2405
+ l[1] - s[1],
2406
+ l[2] - s[2]
2407
2407
  ];
2408
2408
  return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
2409
2409
  }
@@ -2693,15 +2693,15 @@ let He = K;
2693
2693
  class jr extends it {
2694
2694
  constructor(t, e) {
2695
2695
  super(t);
2696
- I(this, "onVertexFound", new D());
2697
- I(this, "onVertexLost", new D());
2696
+ I(this, "onVertexFound", new U());
2697
+ I(this, "onVertexLost", new U());
2698
2698
  I(this, "components");
2699
2699
  I(this, "_pickedPoint", null);
2700
2700
  I(this, "_config");
2701
2701
  I(this, "_enabled", !1);
2702
2702
  I(this, "_workingPlane", null);
2703
2703
  /** {@link Disposable.onDisposed} */
2704
- I(this, "onDisposed", new D());
2704
+ I(this, "onDisposed", new U());
2705
2705
  this.components = t, this.config = {
2706
2706
  snapDistance: 0.25,
2707
2707
  showOnlyVertex: !1,
@@ -2776,7 +2776,7 @@ class jr extends it {
2776
2776
  const Fs = class Fs {
2777
2777
  constructor() {
2778
2778
  /** {@link Disposable.onDisposed} */
2779
- I(this, "onDisposed", new D());
2779
+ I(this, "onDisposed", new U());
2780
2780
  /** The list of components created in this app. */
2781
2781
  I(this, "list", /* @__PURE__ */ new Map());
2782
2782
  /** If disabled, the animation loop will be stopped. */
@@ -2854,7 +2854,7 @@ class Ir {
2854
2854
  I(this, "_event");
2855
2855
  I(this, "_position", new O.Vector2());
2856
2856
  /** {@link Disposable.onDisposed} */
2857
- I(this, "onDisposed", new D());
2857
+ I(this, "onDisposed", new U());
2858
2858
  I(this, "updateMouseInfo", (s) => {
2859
2859
  this._event = s;
2860
2860
  });
@@ -2890,7 +2890,7 @@ class fr {
2890
2890
  I(this, "enabled", !0);
2891
2891
  I(this, "components");
2892
2892
  /** {@link Disposable.onDisposed} */
2893
- I(this, "onDisposed", new D());
2893
+ I(this, "onDisposed", new U());
2894
2894
  /** The position of the mouse in the screen. */
2895
2895
  I(this, "mouse");
2896
2896
  I(this, "three", new O.Raycaster());
@@ -2943,7 +2943,7 @@ const gs = class gs extends it {
2943
2943
  super(t);
2944
2944
  I(this, "enabled", !0);
2945
2945
  I(this, "list", /* @__PURE__ */ new Map());
2946
- I(this, "onDisposed", new D());
2946
+ I(this, "onDisposed", new U());
2947
2947
  t.add(gs.uuid, this);
2948
2948
  }
2949
2949
  get(t) {
@@ -2973,11 +2973,11 @@ class pr extends Ri {
2973
2973
  * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
2974
2974
  */
2975
2975
  I(this, "meshes", /* @__PURE__ */ new Set());
2976
- I(this, "onAfterUpdate", new D());
2977
- I(this, "onBeforeUpdate", new D());
2976
+ I(this, "onAfterUpdate", new U());
2977
+ I(this, "onBeforeUpdate", new U());
2978
2978
  I(this, "enabled", !0);
2979
2979
  I(this, "uuid", He.create());
2980
- I(this, "onDisposed", new D());
2980
+ I(this, "onDisposed", new U());
2981
2981
  I(this, "_scene");
2982
2982
  I(this, "_camera");
2983
2983
  I(this, "_renderer", null);
@@ -3025,7 +3025,7 @@ class qr extends ir {
3025
3025
  I(this, "isSetup", !1);
3026
3026
  I(this, "three");
3027
3027
  /** {@link Configurable.onSetup} */
3028
- I(this, "onSetup", new D());
3028
+ I(this, "onSetup", new U());
3029
3029
  I(this, "config", {
3030
3030
  directionalLight: {
3031
3031
  color: new O.Color("white"),
@@ -3064,7 +3064,7 @@ class $r extends sr {
3064
3064
  I(this, "three");
3065
3065
  I(this, "_canvas");
3066
3066
  I(this, "_parameters");
3067
- I(this, "onContainerUpdated", new D());
3067
+ I(this, "onContainerUpdated", new U());
3068
3068
  /** {@link Resizeable.resize} */
3069
3069
  I(this, "resize", (t) => {
3070
3070
  if (this.updateContainer(), !this.container)
@@ -3133,11 +3133,11 @@ class $r extends sr {
3133
3133
  * (c) 2017 @yomotsu
3134
3134
  * Released under the MIT License.
3135
3135
  */
3136
- const V = {
3136
+ const G = {
3137
3137
  LEFT: 1,
3138
3138
  RIGHT: 2,
3139
3139
  MIDDLE: 4
3140
- }, P = Object.freeze({
3140
+ }, y = Object.freeze({
3141
3141
  NONE: 0,
3142
3142
  ROTATE: 1,
3143
3143
  TRUCK: 2,
@@ -3160,64 +3160,64 @@ const V = {
3160
3160
  IN: 1,
3161
3161
  OUT: -1
3162
3162
  };
3163
- function Zt(c) {
3164
- return c.isPerspectiveCamera;
3163
+ function Zt(l) {
3164
+ return l.isPerspectiveCamera;
3165
3165
  }
3166
- function vt(c) {
3167
- return c.isOrthographicCamera;
3166
+ function vt(l) {
3167
+ return l.isOrthographicCamera;
3168
3168
  }
3169
- const he = Math.PI * 2, $i = Math.PI / 2, Pn = 1e-5, _e = Math.PI / 180;
3170
- function mt(c, s, t) {
3171
- return Math.max(s, Math.min(t, c));
3169
+ const he = Math.PI * 2, $i = Math.PI / 2, yn = 1e-5, _e = Math.PI / 180;
3170
+ function mt(l, s, t) {
3171
+ return Math.max(s, Math.min(t, l));
3172
3172
  }
3173
- function X(c, s = Pn) {
3174
- return Math.abs(c) < s;
3173
+ function X(l, s = yn) {
3174
+ return Math.abs(l) < s;
3175
3175
  }
3176
- function k(c, s, t = Pn) {
3177
- return X(c - s, t);
3176
+ function k(l, s, t = yn) {
3177
+ return X(l - s, t);
3178
3178
  }
3179
- function Ki(c, s) {
3180
- return Math.round(c / s) * s;
3179
+ function Ki(l, s) {
3180
+ return Math.round(l / s) * s;
3181
3181
  }
3182
- function Ne(c) {
3183
- return isFinite(c) ? c : c < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
3182
+ function Ne(l) {
3183
+ return isFinite(l) ? l : l < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
3184
3184
  }
3185
- function Pe(c) {
3186
- return Math.abs(c) < Number.MAX_VALUE ? c : c * (1 / 0);
3185
+ function ye(l) {
3186
+ return Math.abs(l) < Number.MAX_VALUE ? l : l * (1 / 0);
3187
3187
  }
3188
- function Es(c, s, t, e, i = 1 / 0, o) {
3188
+ function Es(l, s, t, e, i = 1 / 0, o) {
3189
3189
  e = Math.max(1e-4, e);
3190
3190
  const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
3191
- let l = c - s;
3191
+ let c = l - s;
3192
3192
  const E = s, d = i * e;
3193
- l = mt(l, -d, d), s = c - l;
3194
- const h = (t.value + n * l) * o;
3193
+ c = mt(c, -d, d), s = l - c;
3194
+ const h = (t.value + n * c) * o;
3195
3195
  t.value = (t.value - n * h) * a;
3196
- let u = s + (l + h) * a;
3197
- return E - c > 0 == u > E && (u = E, t.value = (u - E) / o), u;
3196
+ let u = s + (c + h) * a;
3197
+ return E - l > 0 == u > E && (u = E, t.value = (u - E) / o), u;
3198
3198
  }
3199
- function Ji(c, s, t, e, i = 1 / 0, o, n) {
3199
+ function Ji(l, s, t, e, i = 1 / 0, o, n) {
3200
3200
  e = Math.max(1e-4, e);
3201
- const r = 2 / e, a = r * o, l = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3202
- let E = s.x, d = s.y, h = s.z, u = c.x - E, p = c.y - d, R = c.z - h;
3201
+ const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3202
+ let E = s.x, d = s.y, h = s.z, u = l.x - E, p = l.y - d, R = l.z - h;
3203
3203
  const A = E, C = d, T = h, F = i * e, f = F * F, m = u * u + p * p + R * R;
3204
3204
  if (m > f) {
3205
3205
  const B = Math.sqrt(m);
3206
3206
  u = u / B * F, p = p / B * F, R = R / B * F;
3207
3207
  }
3208
- E = c.x - u, d = c.y - p, h = c.z - R;
3208
+ E = l.x - u, d = l.y - p, h = l.z - R;
3209
3209
  const g = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * R) * o;
3210
- t.x = (t.x - r * g) * l, t.y = (t.y - r * S) * l, t.z = (t.z - r * _) * l, n.x = E + (u + g) * l, n.y = d + (p + S) * l, n.z = h + (R + _) * l;
3211
- const N = A - c.x, y = C - c.y, w = T - c.z, L = n.x - A, U = n.y - C, x = n.z - T;
3212
- return N * L + y * U + w * x > 0 && (n.x = A, n.y = C, n.z = T, t.x = (n.x - A) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
3210
+ t.x = (t.x - r * g) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = E + (u + g) * c, n.y = d + (p + S) * c, n.z = h + (R + _) * c;
3211
+ const N = A - l.x, L = C - l.y, w = T - l.z, P = n.x - A, D = n.y - C, x = n.z - T;
3212
+ return N * P + L * D + w * x > 0 && (n.x = A, n.y = C, n.z = T, t.x = (n.x - A) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
3213
3213
  }
3214
- function Zs(c, s) {
3215
- s.set(0, 0), c.forEach((t) => {
3214
+ function Zs(l, s) {
3215
+ s.set(0, 0), l.forEach((t) => {
3216
3216
  s.x += t.clientX, s.y += t.clientY;
3217
- }), s.x /= c.length, s.y /= c.length;
3217
+ }), s.x /= l.length, s.y /= l.length;
3218
3218
  }
3219
- function Qs(c, s) {
3220
- return vt(c) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
3219
+ function Qs(l, s) {
3220
+ return vt(l) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
3221
3221
  }
3222
3222
  class Cr {
3223
3223
  constructor() {
@@ -3283,8 +3283,8 @@ class Cr {
3283
3283
  }
3284
3284
  }
3285
3285
  }
3286
- const Tr = "2.7.3", ds = 1 / 8, yn = typeof window < "u", mr = yn && /Mac/.test(navigator.platform), Rr = !(yn && "PointerEvent" in window);
3287
- let Y, tn, us, js, lt, G, z, Ee, ye, St, _t, Qt, en, sn, ut, Le, de, nn, qs, on, $s, Ks, Is;
3286
+ const Tr = "2.7.3", ds = 1 / 8, Ln = typeof window < "u", mr = Ln && /Mac/.test(navigator.platform), Rr = !(Ln && "PointerEvent" in window);
3287
+ let Y, tn, us, js, lt, V, z, Ee, Le, St, _t, Qt, en, sn, ut, Pe, de, nn, qs, on, $s, Ks, Is;
3288
3288
  class ot extends Cr {
3289
3289
  /**
3290
3290
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
@@ -3327,14 +3327,14 @@ class ot extends Cr {
3327
3327
  * @category Statics
3328
3328
  */
3329
3329
  static install(s) {
3330
- Y = s.THREE, tn = Object.freeze(new Y.Vector3(0, 0, 0)), us = Object.freeze(new Y.Vector3(0, 1, 0)), js = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), ye = new Y.Vector3(), St = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), en = new Y.Vector3(), sn = new Y.Vector3(), ut = new Y.Spherical(), Le = new Y.Spherical(), de = new Y.Box3(), nn = new Y.Box3(), qs = new Y.Sphere(), on = new Y.Quaternion(), $s = new Y.Quaternion(), Ks = new Y.Matrix4(), Is = new Y.Raycaster();
3330
+ Y = s.THREE, tn = Object.freeze(new Y.Vector3(0, 0, 0)), us = Object.freeze(new Y.Vector3(0, 1, 0)), js = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), V = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(), St = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), en = new Y.Vector3(), sn = new Y.Vector3(), ut = new Y.Spherical(), Pe = new Y.Spherical(), de = new Y.Box3(), nn = new Y.Box3(), qs = new Y.Sphere(), on = new Y.Quaternion(), $s = new Y.Quaternion(), Ks = new Y.Matrix4(), Is = new Y.Raycaster();
3331
3331
  }
3332
3332
  /**
3333
3333
  * list all ACTIONs
3334
3334
  * @category Statics
3335
3335
  */
3336
3336
  static get ACTION() {
3337
- return P;
3337
+ return y;
3338
3338
  }
3339
3339
  /**
3340
3340
  * Creates a `CameraControls` instance.
@@ -3355,10 +3355,10 @@ class ot extends Cr {
3355
3355
  */
3356
3356
  constructor(s, t) {
3357
3357
  super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.verticalDragToForward = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
3358
- }, this._enabled = !0, this._state = P.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, m, g) => {
3358
+ }, this._enabled = !0, this._state = y.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, m, g) => {
3359
3359
  let S, _;
3360
3360
  if (Zt(this._camera)) {
3361
- const N = G.copy(this._camera.position).sub(this._target), y = this._camera.getEffectiveFOV() * _e, w = N.length() * Math.tan(y * 0.5);
3361
+ const N = V.copy(this._camera.position).sub(this._target), L = this._camera.getEffectiveFOV() * _e, w = N.length() * Math.tan(L * 0.5);
3362
3362
  S = this.truckSpeed * f * w / this._elementRect.height, _ = this.truckSpeed * m * w / this._elementRect.height;
3363
3363
  } else if (vt(this._camera)) {
3364
3364
  const N = this._camera;
@@ -3370,25 +3370,25 @@ class ot extends Cr {
3370
3370
  const g = he * this.azimuthRotateSpeed * f / this._elementRect.height, S = he * this.polarRotateSpeed * m / this._elementRect.height;
3371
3371
  this.rotate(g, S, !0);
3372
3372
  }, this._dollyInternal = (f, m, g) => {
3373
- const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, y = mt(N, this.minDistance, this.maxDistance), w = y - N;
3374
- this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(y, !0)) : this._dollyToNoClamp(y, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : y) - _, this._dollyControlCoord.set(m, g)), this._lastDollyDirection = Math.sign(-f);
3373
+ const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, L = mt(N, this.minDistance, this.maxDistance), w = L - N;
3374
+ this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - _, this._dollyControlCoord.set(m, g)), this._lastDollyDirection = Math.sign(-f);
3375
3375
  }, this._zoomInternal = (f, m, g) => {
3376
3376
  const S = Math.pow(0.95, f * this.dollySpeed), _ = this._zoom, N = this._zoom * S;
3377
3377
  this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(m, g));
3378
- }, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = P.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
3378
+ }, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = y.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(V.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
3379
3379
  new Y.Vector3(),
3380
3380
  new Y.Vector3(),
3381
3381
  new Y.Vector3(),
3382
3382
  new Y.Vector3()
3383
3383
  ], this._updateNearPlaneCorners(), this._boundary = new Y.Box3(new Y.Vector3(-1 / 0, -1 / 0, -1 / 0), new Y.Vector3(1 / 0, 1 / 0, 1 / 0)), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new Y.Vector2(), this.mouseButtons = {
3384
- left: P.ROTATE,
3385
- middle: P.DOLLY,
3386
- right: P.TRUCK,
3387
- wheel: Zt(this._camera) ? P.DOLLY : vt(this._camera) ? P.ZOOM : P.NONE
3384
+ left: y.ROTATE,
3385
+ middle: y.DOLLY,
3386
+ right: y.TRUCK,
3387
+ wheel: Zt(this._camera) ? y.DOLLY : vt(this._camera) ? y.ZOOM : y.NONE
3388
3388
  }, this.touches = {
3389
- one: P.TOUCH_ROTATE,
3390
- two: Zt(this._camera) ? P.TOUCH_DOLLY_TRUCK : vt(this._camera) ? P.TOUCH_ZOOM_TRUCK : P.NONE,
3391
- three: P.TOUCH_TRUCK
3389
+ one: y.TOUCH_ROTATE,
3390
+ two: Zt(this._camera) ? y.TOUCH_DOLLY_TRUCK : vt(this._camera) ? y.TOUCH_ZOOM_TRUCK : y.NONE,
3391
+ three: y.TOUCH_TRUCK
3392
3392
  };
3393
3393
  const e = new Y.Vector2(), i = new Y.Vector2(), o = new Y.Vector2(), n = (f) => {
3394
3394
  if (!this._enabled || !this._domElement)
@@ -3398,12 +3398,12 @@ class ot extends Cr {
3398
3398
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3399
3399
  return;
3400
3400
  }
3401
- const m = f.pointerType !== "mouse" ? null : (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3401
+ const m = f.pointerType !== "mouse" ? null : (f.buttons & G.LEFT) === G.LEFT ? G.LEFT : (f.buttons & G.MIDDLE) === G.MIDDLE ? G.MIDDLE : (f.buttons & G.RIGHT) === G.RIGHT ? G.RIGHT : null;
3402
3402
  if (m !== null) {
3403
3403
  const S = this._findPointerByMouseButton(m);
3404
3404
  S && this._disposePointer(S);
3405
3405
  }
3406
- if ((f.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
3406
+ if ((f.buttons & G.LEFT) === G.LEFT && this._lockedPointer)
3407
3407
  return;
3408
3408
  const g = {
3409
3409
  pointerId: f.pointerId,
@@ -3422,7 +3422,7 @@ class ot extends Cr {
3422
3422
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3423
3423
  return;
3424
3424
  }
3425
- const m = (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3425
+ const m = (f.buttons & G.LEFT) === G.LEFT ? G.LEFT : (f.buttons & G.MIDDLE) === G.MIDDLE ? G.MIDDLE : (f.buttons & G.RIGHT) === G.RIGHT ? G.RIGHT : null;
3426
3426
  if (m !== null) {
3427
3427
  const S = this._findPointerByMouseButton(m);
3428
3428
  S && this._disposePointer(S);
@@ -3433,9 +3433,9 @@ class ot extends Cr {
3433
3433
  clientY: f.clientY,
3434
3434
  deltaX: 0,
3435
3435
  deltaY: 0,
3436
- mouseButton: (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.LEFT ? V.MIDDLE : (f.buttons & V.RIGHT) === V.LEFT ? V.RIGHT : null
3436
+ mouseButton: (f.buttons & G.LEFT) === G.LEFT ? G.LEFT : (f.buttons & G.MIDDLE) === G.LEFT ? G.MIDDLE : (f.buttons & G.RIGHT) === G.LEFT ? G.RIGHT : null
3437
3437
  };
3438
- this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", l), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(f);
3438
+ this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", c), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(f);
3439
3439
  }, a = (f) => {
3440
3440
  f.cancelable && f.preventDefault();
3441
3441
  const m = f.pointerId, g = this._lockedPointer || this._findPointerById(m);
@@ -3453,19 +3453,19 @@ class ot extends Cr {
3453
3453
  break;
3454
3454
  }
3455
3455
  else
3456
- (!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3456
+ (!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons & G.LEFT) === G.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (f.buttons & G.MIDDLE) === G.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (f.buttons & G.RIGHT) === G.RIGHT && (this._state = this._state | this.mouseButtons.right);
3457
3457
  A();
3458
3458
  }
3459
- }, l = (f) => {
3459
+ }, c = (f) => {
3460
3460
  const m = this._lockedPointer || this._findPointerById(1);
3461
- 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), A());
3461
+ m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & G.LEFT) === G.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & G.MIDDLE) === G.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & G.RIGHT) === G.RIGHT && (this._state = this._state | this.mouseButtons.right), A());
3462
3462
  }, E = (f) => {
3463
3463
  const m = this._findPointerById(f.pointerId);
3464
3464
  if (!(m && m === this._lockedPointer)) {
3465
3465
  if (m && this._disposePointer(m), f.pointerType === "touch")
3466
3466
  switch (this._activePointers.length) {
3467
3467
  case 0:
3468
- this._state = P.NONE;
3468
+ this._state = y.NONE;
3469
3469
  break;
3470
3470
  case 1:
3471
3471
  this._state = this.touches.one;
@@ -3478,45 +3478,45 @@ class ot extends Cr {
3478
3478
  break;
3479
3479
  }
3480
3480
  else
3481
- this._state = P.NONE;
3481
+ this._state = y.NONE;
3482
3482
  C();
3483
3483
  }
3484
3484
  }, d = () => {
3485
3485
  const f = this._findPointerById(1);
3486
- f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = P.NONE, C());
3486
+ f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = y.NONE, C());
3487
3487
  };
3488
3488
  let h = -1;
3489
3489
  const u = (f) => {
3490
- if (!this._domElement || !this._enabled || this.mouseButtons.wheel === P.NONE)
3490
+ if (!this._domElement || !this._enabled || this.mouseButtons.wheel === y.NONE)
3491
3491
  return;
3492
3492
  if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
3493
- const N = this._domElement.getBoundingClientRect(), y = f.clientX / N.width, w = f.clientY / N.height;
3494
- if (y < this._interactiveArea.left || y > this._interactiveArea.right || w < this._interactiveArea.top || w > this._interactiveArea.bottom)
3493
+ const N = this._domElement.getBoundingClientRect(), L = f.clientX / N.width, w = f.clientY / N.height;
3494
+ if (L < this._interactiveArea.left || L > this._interactiveArea.right || w < this._interactiveArea.top || w > this._interactiveArea.bottom)
3495
3495
  return;
3496
3496
  }
3497
- if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === P.ROTATE || this.mouseButtons.wheel === P.TRUCK) {
3497
+ if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === y.ROTATE || this.mouseButtons.wheel === y.TRUCK) {
3498
3498
  const N = performance.now();
3499
3499
  h - N < 1e3 && this._getClientRect(this._elementRect), h = N;
3500
3500
  }
3501
3501
  const m = mr ? -1 : -3, g = 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;
3502
3502
  switch (this.mouseButtons.wheel) {
3503
- case P.ROTATE: {
3503
+ case y.ROTATE: {
3504
3504
  this._rotateInternal(f.deltaX, f.deltaY), this._isUserControllingRotate = !0;
3505
3505
  break;
3506
3506
  }
3507
- case P.TRUCK: {
3507
+ case y.TRUCK: {
3508
3508
  this._truckInternal(f.deltaX, f.deltaY, !1), this._isUserControllingTruck = !0;
3509
3509
  break;
3510
3510
  }
3511
- case P.OFFSET: {
3511
+ case y.OFFSET: {
3512
3512
  this._truckInternal(f.deltaX, f.deltaY, !0), this._isUserControllingOffset = !0;
3513
3513
  break;
3514
3514
  }
3515
- case P.DOLLY: {
3515
+ case y.DOLLY: {
3516
3516
  this._dollyInternal(-g, S, _), this._isUserControllingDolly = !0;
3517
3517
  break;
3518
3518
  }
3519
- case P.ZOOM: {
3519
+ case y.ZOOM: {
3520
3520
  this._zoomInternal(-g, S, _), this._isUserControllingZoom = !0;
3521
3521
  break;
3522
3522
  }
@@ -3526,7 +3526,7 @@ class ot extends Cr {
3526
3526
  if (!(!this._domElement || !this._enabled)) {
3527
3527
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3528
3528
  const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), g = this._findPointerById(m);
3529
- g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3529
+ g && this._disposePointer(g), 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);
3530
3530
  return;
3531
3531
  }
3532
3532
  f.preventDefault();
@@ -3537,8 +3537,8 @@ class ot extends Cr {
3537
3537
  if (Zs(this._activePointers, lt), this._getClientRect(this._elementRect), e.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
3538
3538
  const g = lt.x - this._activePointers[1].clientX, S = lt.y - this._activePointers[1].clientY, _ = Math.sqrt(g * g + S * S);
3539
3539
  o.set(0, _);
3540
- const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, y = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
3541
- i.set(N, y);
3540
+ const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, L = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
3541
+ i.set(N, L);
3542
3542
  }
3543
3543
  if (this._state = 0, !f)
3544
3544
  this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
@@ -3555,26 +3555,26 @@ class ot extends Cr {
3555
3555
  break;
3556
3556
  }
3557
3557
  else
3558
- !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);
3559
- ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((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._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & P.DOLLY) === P.DOLLY || (this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & P.ZOOM) === P.ZOOM || (this._state & P.TOUCH_ZOOM) === P.TOUCH_ZOOM || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 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._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
3558
+ !this._lockedPointer && (f.buttons & G.LEFT) === G.LEFT && (this._state = this._state | this.mouseButtons.left), (f.buttons & G.MIDDLE) === G.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & G.RIGHT) === G.RIGHT && (this._state = this._state | this.mouseButtons.right);
3559
+ ((this._state & y.ROTATE) === y.ROTATE || (this._state & y.TOUCH_ROTATE) === y.TOUCH_ROTATE || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & y.TRUCK) === y.TRUCK || (this._state & y.TOUCH_TRUCK) === y.TOUCH_TRUCK || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & y.DOLLY) === y.DOLLY || (this._state & y.TOUCH_DOLLY) === y.TOUCH_DOLLY || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & y.ZOOM) === y.ZOOM || (this._state & y.TOUCH_ZOOM) === y.TOUCH_ZOOM || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & y.OFFSET) === y.OFFSET || (this._state & y.TOUCH_OFFSET) === y.TOUCH_OFFSET || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
3560
3560
  }, A = () => {
3561
3561
  if (!this._enabled || !this._dragNeedsUpdate)
3562
3562
  return;
3563
3563
  this._dragNeedsUpdate = !1, Zs(this._activePointers, lt);
3564
3564
  const m = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, g = m ? -m.deltaX : i.x - lt.x, S = m ? -m.deltaY : i.y - lt.y;
3565
- if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(g, S), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
3566
- const _ = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, y = this.dollyDragInverted ? -1 : 1;
3567
- (this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(y * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(y * S * ds, _, N), this._isUserControllingZoom = !0);
3565
+ if (i.copy(lt), ((this._state & y.ROTATE) === y.ROTATE || (this._state & y.TOUCH_ROTATE) === y.TOUCH_ROTATE || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(g, S), this._isUserControllingRotate = !0), (this._state & y.DOLLY) === y.DOLLY || (this._state & y.ZOOM) === y.ZOOM) {
3566
+ const _ = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, L = this.dollyDragInverted ? -1 : 1;
3567
+ (this._state & y.DOLLY) === y.DOLLY ? (this._dollyInternal(L * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(L * S * ds, _, N), this._isUserControllingZoom = !0);
3568
3568
  }
3569
- if ((this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_ZOOM) === P.TOUCH_ZOOM || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) {
3570
- const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, y = Math.sqrt(_ * _ + N * N), w = o.y - y;
3571
- o.set(0, y);
3572
- const L = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3573
- (this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * ds, L, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * ds, L, U), this._isUserControllingZoom = !0);
3569
+ if ((this._state & y.TOUCH_DOLLY) === y.TOUCH_DOLLY || (this._state & y.TOUCH_ZOOM) === y.TOUCH_ZOOM || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) {
3570
+ const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, L = Math.sqrt(_ * _ + N * N), w = o.y - L;
3571
+ o.set(0, L);
3572
+ const P = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, D = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3573
+ (this._state & y.TOUCH_DOLLY) === y.TOUCH_DOLLY || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * ds, P, D), this._isUserControllingDolly = !0) : (this._zoomInternal(w * ds, P, D), this._isUserControllingZoom = !0);
3574
3574
  }
3575
- ((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(g, 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(g, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3575
+ ((this._state & y.TRUCK) === y.TRUCK || (this._state & y.TOUCH_TRUCK) === y.TOUCH_TRUCK || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK) && (this._truckInternal(g, S, !1), this._isUserControllingTruck = !0), ((this._state & y.OFFSET) === y.OFFSET || (this._state & y.TOUCH_OFFSET) === y.TOUCH_OFFSET || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET) && (this._truckInternal(g, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3576
3576
  }, C = () => {
3577
- Zs(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", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3577
+ Zs(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" }));
3578
3578
  };
3579
3579
  this.lockPointer = () => {
3580
3580
  !this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
@@ -3596,9 +3596,9 @@ class ot extends Cr {
3596
3596
  this._addAllEventListeners = (f) => {
3597
3597
  this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Rr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
3598
3598
  }, this._removeAllEventListeners = () => {
3599
- 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", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3599
+ 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));
3600
3600
  }, this.cancel = () => {
3601
- this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
3601
+ this._state !== y.NONE && (this._state = y.NONE, this._activePointers.length = 0, C());
3602
3602
  }, t && this.connect(t), this.update(0);
3603
3603
  }
3604
3604
  /**
@@ -3854,7 +3854,7 @@ class ot extends Cr {
3854
3854
  * @category Methods
3855
3855
  */
3856
3856
  dollyInFixed(s, t = !1) {
3857
- this._targetEnd.add(this._getCameraDirection(ye).multiplyScalar(s)), t || this._target.copy(this._targetEnd);
3857
+ this._targetEnd.add(this._getCameraDirection(Le).multiplyScalar(s)), t || this._target.copy(this._targetEnd);
3858
3858
  const e = !t || 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);
3859
3859
  return this._createOnRestPromise(e);
3860
3860
  }
@@ -3896,7 +3896,7 @@ class ot extends Cr {
3896
3896
  */
3897
3897
  truck(s, t, e = !1) {
3898
3898
  this._camera.updateMatrix(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), St.multiplyScalar(s), _t.multiplyScalar(-t);
3899
- const i = G.copy(St).add(_t), o = z.copy(this._targetEnd).add(i);
3899
+ const i = V.copy(St).add(_t), o = z.copy(this._targetEnd).add(i);
3900
3900
  return this.moveTo(o.x, o.y, o.z, e);
3901
3901
  }
3902
3902
  /**
@@ -3906,8 +3906,8 @@ class ot extends Cr {
3906
3906
  * @category Methods
3907
3907
  */
3908
3908
  forward(s, t = !1) {
3909
- G.setFromMatrixColumn(this._camera.matrix, 0), G.crossVectors(this._camera.up, G), G.multiplyScalar(s);
3910
- const e = z.copy(this._targetEnd).add(G);
3909
+ V.setFromMatrixColumn(this._camera.matrix, 0), V.crossVectors(this._camera.up, V), V.multiplyScalar(s);
3910
+ const e = z.copy(this._targetEnd).add(V);
3911
3911
  return this.moveTo(e.x, e.y, e.z, t);
3912
3912
  }
3913
3913
  /**
@@ -3917,7 +3917,7 @@ class ot extends Cr {
3917
3917
  * @category Methods
3918
3918
  */
3919
3919
  elevate(s, t = !1) {
3920
- return G.copy(this._camera.up).multiplyScalar(s), this.moveTo(this._targetEnd.x + G.x, this._targetEnd.y + G.y, this._targetEnd.z + G.z, t);
3920
+ return V.copy(this._camera.up).multiplyScalar(s), this.moveTo(this._targetEnd.x + V.x, this._targetEnd.y + V.y, this._targetEnd.z + V.z, t);
3921
3921
  }
3922
3922
  /**
3923
3923
  * Move target position to given point.
@@ -3929,7 +3929,7 @@ class ot extends Cr {
3929
3929
  */
3930
3930
  moveTo(s, t, e, i = !1) {
3931
3931
  this._isUserControllingTruck = !1;
3932
- const o = G.set(s, t, e).sub(this._targetEnd);
3932
+ const o = V.set(s, t, e).sub(this._targetEnd);
3933
3933
  this._encloseToBoundary(this._targetEnd, o, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
3934
3934
  const n = !i || 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);
3935
3935
  return this._createOnRestPromise(n);
@@ -3944,7 +3944,7 @@ class ot extends Cr {
3944
3944
  * @category Methods
3945
3945
  */
3946
3946
  lookInDirectionOf(s, t, e, i = !1) {
3947
- const r = G.set(s, t, e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);
3947
+ const r = V.set(s, t, e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);
3948
3948
  return this.setPosition(r.x, r.y, r.z, i);
3949
3949
  }
3950
3950
  /**
@@ -3961,15 +3961,15 @@ class ot extends Cr {
3961
3961
  * @category Methods
3962
3962
  */
3963
3963
  fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
3964
- const a = [], l = s.isBox3 ? de.copy(s) : de.setFromObject(s);
3965
- l.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
3964
+ const a = [], c = s.isBox3 ? de.copy(s) : de.setFromObject(s);
3965
+ c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
3966
3966
  const E = Ki(this._sphericalEnd.theta, $i), d = Ki(this._sphericalEnd.phi, $i);
3967
3967
  a.push(this.rotateTo(E, d, t));
3968
- const h = G.setFromSpherical(this._sphericalEnd).normalize(), u = on.setFromUnitVectors(h, js), p = k(Math.abs(h.y), 1);
3968
+ const h = V.setFromSpherical(this._sphericalEnd).normalize(), u = on.setFromUnitVectors(h, js), p = k(Math.abs(h.y), 1);
3969
3969
  p && u.multiply($s.setFromAxisAngle(us, E)), u.multiply(this._yAxisUpSpaceInverse);
3970
3970
  const R = nn.makeEmpty();
3971
- z.copy(l.min).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setX(l.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setY(l.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setZ(l.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setZ(l.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setY(l.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setX(l.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(js, h), p && u.premultiply($s.invert()), u.premultiply(this._yAxisUpSpace);
3972
- const A = R.getSize(G), C = R.getCenter(z).applyQuaternion(u);
3971
+ z.copy(c.min).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(js, h), p && u.premultiply($s.invert()), u.premultiply(this._yAxisUpSpace);
3972
+ const A = R.getSize(V), C = R.getCenter(z).applyQuaternion(u);
3973
3973
  if (Zt(this._camera)) {
3974
3974
  const T = this.getDistanceToFitBox(A.x, A.y, A.z, e);
3975
3975
  a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
@@ -3991,8 +3991,8 @@ class ot extends Cr {
3991
3991
  const n = this.getDistanceToFitSphere(o.radius);
3992
3992
  e.push(this.dollyTo(n, t));
3993
3993
  } else if (vt(this._camera)) {
3994
- const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, l = Math.min(n / a, r / a);
3995
- e.push(this.zoomTo(l, t));
3994
+ const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, c = Math.min(n / a, r / a);
3995
+ e.push(this.zoomTo(c, t));
3996
3996
  }
3997
3997
  return e.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(e);
3998
3998
  }
@@ -4009,8 +4009,8 @@ class ot extends Cr {
4009
4009
  */
4010
4010
  setLookAt(s, t, e, i, o, n, r = !1) {
4011
4011
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4012
- const a = z.set(i, o, n), l = G.set(s, t, e);
4013
- this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4012
+ const a = z.set(i, o, n), c = V.set(s, t, e);
4013
+ 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));
4014
4014
  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);
4015
4015
  return this._createOnRestPromise(E);
4016
4016
  }
@@ -4032,13 +4032,13 @@ class ot extends Cr {
4032
4032
  * @param enableTransition
4033
4033
  * @category Methods
4034
4034
  */
4035
- lerpLookAt(s, t, e, i, o, n, r, a, l, E, d, h, u, p = !1) {
4035
+ lerpLookAt(s, t, e, i, o, n, r, a, c, E, d, h, u, p = !1) {
4036
4036
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4037
- const R = G.set(i, o, n), A = z.set(s, t, e);
4037
+ const R = V.set(i, o, n), A = z.set(s, t, e);
4038
4038
  ut.setFromVector3(A.sub(R).applyQuaternion(this._yAxisUpSpace));
4039
- const C = Ee.set(E, d, h), T = z.set(r, a, l);
4040
- Le.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
4041
- const F = Le.theta - ut.theta, f = Le.phi - ut.phi, m = Le.radius - ut.radius;
4039
+ const C = Ee.set(E, d, h), T = z.set(r, a, c);
4040
+ Pe.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
4041
+ const F = Pe.theta - ut.theta, f = Pe.phi - ut.phi, m = Pe.radius - ut.radius;
4042
4042
  this._sphericalEnd.set(ut.radius + m * u, ut.phi + f * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4043
4043
  const g = !p || 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);
4044
4044
  return this._createOnRestPromise(g);
@@ -4065,7 +4065,7 @@ class ot extends Cr {
4065
4065
  * @category Methods
4066
4066
  */
4067
4067
  setTarget(s, t, e, i = !1) {
4068
- const o = this.getPosition(G), n = this.setLookAt(o.x, o.y, o.z, s, t, e, i);
4068
+ const o = this.getPosition(V), n = this.setLookAt(o.x, o.y, o.z, s, t, e, i);
4069
4069
  return this._sphericalEnd.phi = mt(this._sphericalEnd.phi, this.minPolarAngle, this.maxPolarAngle), n;
4070
4070
  }
4071
4071
  /**
@@ -4091,8 +4091,8 @@ class ot extends Cr {
4091
4091
  */
4092
4092
  setOrbitPoint(s, t, e) {
4093
4093
  this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), _t.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
4094
- const i = G.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
4095
- St.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(St).add(_t).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
4094
+ const i = V.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
4095
+ St.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), V.copy(St).add(_t).add(Qt), V.z = V.z + o, this.dollyTo(o, !1), this.setFocalOffset(-V.x, V.y, -V.z, !1), this.moveTo(s, t, e, !1);
4096
4096
  }
4097
4097
  /**
4098
4098
  * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
@@ -4199,7 +4199,7 @@ class ot extends Cr {
4199
4199
  reset(s = !1) {
4200
4200
  if (!k(this._camera.up.x, this._cameraUp0.x) || !k(this._camera.up.y, this._cameraUp0.y) || !k(this._camera.up.z, this._cameraUp0.z)) {
4201
4201
  this._camera.up.copy(this._cameraUp0);
4202
- const e = this.getPosition(G);
4202
+ const e = this.getPosition(V);
4203
4203
  this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
4204
4204
  }
4205
4205
  const t = [
@@ -4230,9 +4230,9 @@ class ot extends Cr {
4230
4230
  * @category Methods
4231
4231
  */
4232
4232
  applyCameraUp() {
4233
- const s = G.subVectors(this._target, this._camera.position).normalize(), t = z.crossVectors(s, this._camera.up);
4233
+ const s = V.subVectors(this._target, this._camera.position).normalize(), t = z.crossVectors(s, this._camera.up);
4234
4234
  this._camera.up.crossVectors(t, s).normalize(), this._camera.updateMatrixWorld();
4235
- const e = this.getPosition(G);
4235
+ const e = this.getPosition(V);
4236
4236
  this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
4237
4237
  }
4238
4238
  /**
@@ -4282,9 +4282,9 @@ class ot extends Cr {
4282
4282
  }
4283
4283
  if (this.dollyToCursor) {
4284
4284
  if (Zt(this._camera) && this._changedDolly !== 0) {
4285
- const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(h.up).normalize();
4285
+ const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(Le), p = V.copy(u).cross(h.up).normalize();
4286
4286
  p.lengthSq() === 0 && (p.x = 1);
4287
- const R = z.crossVectors(p, u), A = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * _e * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * A * h.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * A)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4287
+ const R = z.crossVectors(p, u), A = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * _e * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * A * h.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * A)), f = V.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4288
4288
  if (this.infinityDolly && (m || g)) {
4289
4289
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4290
4290
  const _ = z.copy(u).multiplyScalar(-d);
@@ -4294,7 +4294,7 @@ class ot extends Cr {
4294
4294
  const S = z.subVectors(f, this._targetEnd);
4295
4295
  this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4296
4296
  } else if (vt(this._camera) && this._changedZoom !== 0) {
4297
- 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), R = Ee.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(R, C), m = f.dot(T), g = T.multiplyScalar(m - F);
4297
+ const d = this._zoom - this._lastZoom, h = this._camera, u = V.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), R = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(Le), F = this._targetEnd.dot(T), f = V.copy(this._targetEnd).lerp(R, C), m = f.dot(T), g = T.multiplyScalar(m - F);
4298
4298
  f.sub(g), this._boundary.clampPoint(f, f);
4299
4299
  const S = z.subVectors(f, this._targetEnd);
4300
4300
  this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
@@ -4302,7 +4302,7 @@ class ot extends Cr {
4302
4302
  }
4303
4303
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
4304
4304
  const a = this._collisionTest();
4305
- 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(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), St.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(St).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4305
+ 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(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), St.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), V.copy(St).add(_t).add(Qt), this._camera.position.add(V)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), V.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4306
4306
  const E = this._needsUpdate;
4307
4307
  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;
4308
4308
  }
@@ -4328,7 +4328,7 @@ class ot extends Cr {
4328
4328
  dollyToCursor: this.dollyToCursor,
4329
4329
  verticalDragToForward: this.verticalDragToForward,
4330
4330
  target: this._targetEnd.toArray(),
4331
- position: G.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
4331
+ position: V.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
4332
4332
  zoom: this._zoomEnd,
4333
4333
  focalOffset: this._focalOffsetEnd.toArray(),
4334
4334
  target0: this._target0.toArray(),
@@ -4345,7 +4345,7 @@ class ot extends Cr {
4345
4345
  */
4346
4346
  fromJSON(s, t = !1) {
4347
4347
  const e = JSON.parse(s);
4348
- this.enabled = e.enabled, this.minDistance = e.minDistance, this.maxDistance = Pe(e.maxDistance), this.minZoom = e.minZoom, this.maxZoom = Pe(e.maxZoom), this.minPolarAngle = e.minPolarAngle, this.maxPolarAngle = Pe(e.maxPolarAngle), this.minAzimuthAngle = Pe(e.minAzimuthAngle), this.maxAzimuthAngle = Pe(e.maxAzimuthAngle), this.smoothTime = e.smoothTime, this.draggingSmoothTime = e.draggingSmoothTime, this.dollySpeed = e.dollySpeed, this.truckSpeed = e.truckSpeed, this.dollyToCursor = e.dollyToCursor, this.verticalDragToForward = e.verticalDragToForward, this._target0.fromArray(e.target0), this._position0.fromArray(e.position0), this._zoom0 = e.zoom0, this._focalOffset0.fromArray(e.focalOffset0), this.moveTo(e.target[0], e.target[1], e.target[2], t), ut.setFromVector3(G.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(ut.theta, ut.phi, t), this.dollyTo(ut.radius, t), this.zoomTo(e.zoom, t), this.setFocalOffset(e.focalOffset[0], e.focalOffset[1], e.focalOffset[2], t), this._needsUpdate = !0;
4348
+ this.enabled = e.enabled, this.minDistance = e.minDistance, this.maxDistance = ye(e.maxDistance), this.minZoom = e.minZoom, this.maxZoom = ye(e.maxZoom), this.minPolarAngle = e.minPolarAngle, this.maxPolarAngle = ye(e.maxPolarAngle), this.minAzimuthAngle = ye(e.minAzimuthAngle), this.maxAzimuthAngle = ye(e.maxAzimuthAngle), this.smoothTime = e.smoothTime, this.draggingSmoothTime = e.draggingSmoothTime, this.dollySpeed = e.dollySpeed, this.truckSpeed = e.truckSpeed, this.dollyToCursor = e.dollyToCursor, this.verticalDragToForward = e.verticalDragToForward, this._target0.fromArray(e.target0), this._position0.fromArray(e.position0), this._zoom0 = e.zoom0, this._focalOffset0.fromArray(e.focalOffset0), this.moveTo(e.target[0], e.target[1], e.target[2], t), ut.setFromVector3(V.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(ut.theta, ut.phi, t), this.dollyTo(ut.radius, t), this.zoomTo(e.zoom, t), this.setFocalOffset(e.focalOffset[0], e.focalOffset[1], e.focalOffset[2], t), this._needsUpdate = !0;
4349
4349
  }
4350
4350
  /**
4351
4351
  * Attach all internal event handlers to enable drag control.
@@ -4400,8 +4400,8 @@ class ot extends Cr {
4400
4400
  if (e === 0)
4401
4401
  return s.add(t).add(r);
4402
4402
  {
4403
- const l = 1 + e * a / t.dot(r);
4404
- return s.add(z.copy(t).multiplyScalar(l)).add(r.multiplyScalar(1 - e));
4403
+ const c = 1 + e * a / t.dot(r);
4404
+ return s.add(z.copy(t).multiplyScalar(c)).add(r.multiplyScalar(1 - e));
4405
4405
  }
4406
4406
  }
4407
4407
  _updateNearPlaneCorners() {
@@ -4418,7 +4418,7 @@ class ot extends Cr {
4418
4418
  let s = 1 / 0;
4419
4419
  if (!(this.colliderMeshes.length >= 1) || Qs(this._camera, "_collisionTest"))
4420
4420
  return s;
4421
- const e = this._getTargetDirection(ye);
4421
+ const e = this._getTargetDirection(Le);
4422
4422
  Ks.lookAt(tn, e, this._camera.up);
4423
4423
  for (let i = 0; i < 4; i++) {
4424
4424
  const o = z.copy(this._nearPlaneCorners[i]);
@@ -4497,7 +4497,7 @@ class ot extends Cr {
4497
4497
  a.applyMatrix4(r.matrixWorld);
4498
4498
  const E = a.attributes.position;
4499
4499
  for (let d = 0, h = E.count; d < h; d++)
4500
- G.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(G));
4500
+ V.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(V));
4501
4501
  }), e.radius = Math.sqrt(o), e;
4502
4502
  }
4503
4503
  }
@@ -4505,12 +4505,12 @@ class We extends er {
4505
4505
  constructor(t) {
4506
4506
  super(t);
4507
4507
  /** {@link Updateable.onBeforeUpdate} */
4508
- I(this, "onBeforeUpdate", new D());
4508
+ I(this, "onBeforeUpdate", new U());
4509
4509
  /** {@link Updateable.onAfterUpdate} */
4510
- I(this, "onAfterUpdate", new D());
4511
- I(this, "onAspectUpdated", new D());
4510
+ I(this, "onAfterUpdate", new U());
4511
+ I(this, "onAspectUpdated", new U());
4512
4512
  /** {@link Disposable.onDisposed} */
4513
- I(this, "onDisposed", new D());
4513
+ I(this, "onDisposed", new U());
4514
4514
  I(this, "three");
4515
4515
  I(this, "_allControls", /* @__PURE__ */ new Map());
4516
4516
  /**
@@ -4602,9 +4602,9 @@ class We extends er {
4602
4602
  const Os = class Os extends it {
4603
4603
  constructor(t) {
4604
4604
  super(t);
4605
- I(this, "onAfterUpdate", new D());
4606
- I(this, "onBeforeUpdate", new D());
4607
- I(this, "onDisposed", new D());
4605
+ I(this, "onAfterUpdate", new U());
4606
+ I(this, "onBeforeUpdate", new U());
4607
+ I(this, "onDisposed", new U());
4608
4608
  I(this, "list", /* @__PURE__ */ new Map());
4609
4609
  I(this, "enabled", !0);
4610
4610
  t.add(Os.uuid, this);
@@ -4635,7 +4635,7 @@ let di = Os;
4635
4635
  class Ar {
4636
4636
  constructor(s, t, e) {
4637
4637
  /** {@link Disposable.onDisposed} */
4638
- I(this, "onDisposed", new D());
4638
+ I(this, "onDisposed", new U());
4639
4639
  I(this, "world");
4640
4640
  I(this, "components");
4641
4641
  I(this, "_grid");
@@ -4646,7 +4646,7 @@ class Ar {
4646
4646
  this.world = t;
4647
4647
  const { color: i, size1: o, size2: n, distance: r } = e;
4648
4648
  this.components = s;
4649
- const a = new O.PlaneGeometry(2, 2, 1, 1), l = new O.ShaderMaterial({
4649
+ const a = new O.PlaneGeometry(2, 2, 1, 1), c = new O.ShaderMaterial({
4650
4650
  side: O.DoubleSide,
4651
4651
  uniforms: {
4652
4652
  uSize1: {
@@ -4736,7 +4736,7 @@ class Ar {
4736
4736
  derivatives: !0
4737
4737
  }
4738
4738
  });
4739
- this._grid = new O.Mesh(a, l), this._grid.frustumCulled = !1, t.scene.three.add(this._grid), this.setupEvents(!0);
4739
+ this._grid = new O.Mesh(a, c), this._grid.frustumCulled = !1, t.scene.three.add(this._grid), this.setupEvents(!0);
4740
4740
  }
4741
4741
  /** {@link Hideable.visible} */
4742
4742
  get visible() {
@@ -4786,7 +4786,7 @@ class Fr extends it {
4786
4786
  constructor() {
4787
4787
  super(...arguments);
4788
4788
  I(this, "list", /* @__PURE__ */ new Map());
4789
- I(this, "onDisposed", new D());
4789
+ I(this, "onDisposed", new U());
4790
4790
  I(this, "config", {
4791
4791
  color: new O.Color(12303291),
4792
4792
  size1: 1,
@@ -4815,7 +4815,7 @@ class Fr extends it {
4815
4815
  }
4816
4816
  }
4817
4817
  I(Fr, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
4818
- const jt = new zn(), nt = new M(), bt = new M(), j = new yt(), rn = {
4818
+ const jt = new zn(), nt = new M(), bt = new M(), j = new Lt(), rn = {
4819
4819
  X: new M(1, 0, 0),
4820
4820
  Y: new M(0, 1, 0),
4821
4821
  Z: new M(0, 0, 1)
@@ -4823,9 +4823,9 @@ const jt = new zn(), nt = new M(), bt = new M(), j = new yt(), rn = {
4823
4823
  class gr extends ei {
4824
4824
  constructor(s, t) {
4825
4825
  super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
4826
- const e = new yr();
4826
+ const e = new Lr();
4827
4827
  this._gizmo = e, this.add(e);
4828
- const i = new Lr();
4828
+ const i = new Pr();
4829
4829
  this._plane = i, this.add(i);
4830
4830
  const o = this;
4831
4831
  function n(T, F) {
@@ -4840,8 +4840,8 @@ class gr extends ei {
4840
4840
  }), o[T] = F, i[T] = F, e[T] = F;
4841
4841
  }
4842
4842
  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);
4843
- const r = new M(), a = new M(), l = new yt(), E = new yt(), d = new M(), h = new yt(), u = new M(), p = new M(), R = new M(), A = 0, C = new M();
4844
- n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", l), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", R), n("rotationAngle", A), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new yt(), this._parentQuaternionInv = new yt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new yt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new yt(), this._scaleStart = new M(), this._getPointer = Or.bind(this), this._onPointerDown = _r.bind(this), this._onPointerHover = Sr.bind(this), this._onPointerMove = Nr.bind(this), this._onPointerUp = Pr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
4843
+ const r = new M(), a = new M(), c = new Lt(), E = new Lt(), d = new M(), h = new Lt(), u = new M(), p = new M(), R = new M(), A = 0, C = new M();
4844
+ 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", R), n("rotationAngle", A), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new Lt(), this._parentQuaternionInv = new Lt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Lt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Lt(), this._scaleStart = new M(), this._getPointer = Or.bind(this), this._onPointerDown = _r.bind(this), this._onPointerHover = Sr.bind(this), this._onPointerMove = Nr.bind(this), this._onPointerUp = yr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
4845
4845
  }
4846
4846
  // updateMatrixWorld updates key transformation variables
4847
4847
  updateMatrixWorld() {
@@ -4932,49 +4932,49 @@ class gr extends ei {
4932
4932
  this.space = s;
4933
4933
  }
4934
4934
  }
4935
- function Or(c) {
4935
+ function Or(l) {
4936
4936
  if (this.domElement.ownerDocument.pointerLockElement)
4937
4937
  return {
4938
4938
  x: 0,
4939
4939
  y: 0,
4940
- button: c.button
4940
+ button: l.button
4941
4941
  };
4942
4942
  {
4943
4943
  const s = this.domElement.getBoundingClientRect();
4944
4944
  return {
4945
- x: (c.clientX - s.left) / s.width * 2 - 1,
4946
- y: -(c.clientY - s.top) / s.height * 2 + 1,
4947
- button: c.button
4945
+ x: (l.clientX - s.left) / s.width * 2 - 1,
4946
+ y: -(l.clientY - s.top) / s.height * 2 + 1,
4947
+ button: l.button
4948
4948
  };
4949
4949
  }
4950
4950
  }
4951
- function Sr(c) {
4951
+ function Sr(l) {
4952
4952
  if (this.enabled)
4953
- switch (c.pointerType) {
4953
+ switch (l.pointerType) {
4954
4954
  case "mouse":
4955
4955
  case "pen":
4956
- this.pointerHover(this._getPointer(c));
4956
+ this.pointerHover(this._getPointer(l));
4957
4957
  break;
4958
4958
  }
4959
4959
  }
4960
- function _r(c) {
4961
- this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(c.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(c)), this.pointerDown(this._getPointer(c)));
4960
+ function _r(l) {
4961
+ this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(l.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(l)), this.pointerDown(this._getPointer(l)));
4962
4962
  }
4963
- function Nr(c) {
4964
- this.enabled && this.pointerMove(this._getPointer(c));
4963
+ function Nr(l) {
4964
+ this.enabled && this.pointerMove(this._getPointer(l));
4965
4965
  }
4966
- function Pr(c) {
4967
- this.enabled && (this.domElement.releasePointerCapture(c.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(c)));
4966
+ function yr(l) {
4967
+ this.enabled && (this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(l)));
4968
4968
  }
4969
- function ti(c, s, t) {
4970
- const e = s.intersectObject(c, !0);
4969
+ function ti(l, s, t) {
4970
+ const e = s.intersectObject(l, !0);
4971
4971
  for (let i = 0; i < e.length; i++)
4972
4972
  if (e[i].object.visible || t)
4973
4973
  return e[i];
4974
4974
  return !1;
4975
4975
  }
4976
- const fs = new Hn(), W = new M(0, 1, 0), hn = new M(0, 0, 0), En = new Mt(), ps = new yt(), Rs = new yt(), Nt = new M(), dn = new Mt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), Cs = new M(), Me = new M(), we = new M();
4977
- class yr extends ei {
4976
+ const fs = new Hn(), W = new M(0, 1, 0), hn = new M(0, 0, 0), En = new Mt(), ps = new Lt(), Rs = new Lt(), Nt = new M(), dn = new Mt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), Cs = new M(), Me = new M(), we = new M();
4977
+ class Lr extends ei {
4978
4978
  constructor() {
4979
4979
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
4980
4980
  const s = new gn({
@@ -5001,8 +5001,8 @@ class yr extends ei {
5001
5001
  r.color.setHex(255);
5002
5002
  const a = s.clone();
5003
5003
  a.color.setHex(16711680), a.opacity = 0.5;
5004
- const l = s.clone();
5005
- l.color.setHex(65280), l.opacity = 0.5;
5004
+ const c = s.clone();
5005
+ c.color.setHex(65280), c.opacity = 0.5;
5006
5006
  const E = s.clone();
5007
5007
  E.color.setHex(255), E.opacity = 0.5;
5008
5008
  const d = s.clone();
@@ -5016,7 +5016,7 @@ class yr extends ei {
5016
5016
  const A = new rt(0.08, 0.08, 0.08);
5017
5017
  A.translate(0, 0.04, 0);
5018
5018
  const C = new Ni();
5019
- C.setAttribute("position", new Pi([0, 0, 0, 1, 0, 0], 3));
5019
+ C.setAttribute("position", new yi([0, 0, 0, 1, 0, 0], 3));
5020
5020
  const T = new ct(75e-4, 75e-4, 0.5, 3);
5021
5021
  T.translate(0, 0.25, 0);
5022
5022
  function F(B, H) {
@@ -5025,7 +5025,7 @@ class yr extends ei {
5025
5025
  }
5026
5026
  function f() {
5027
5027
  const B = new Ni();
5028
- return B.setAttribute("position", new Pi([0, 0, 0, 1, 1, 1], 3)), B;
5028
+ return B.setAttribute("position", new yi([0, 0, 0, 1, 1, 1], 3)), B;
5029
5029
  }
5030
5030
  const m = {
5031
5031
  X: [
@@ -5053,7 +5053,7 @@ class yr extends ei {
5053
5053
  [new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
5054
5054
  ],
5055
5055
  XZ: [
5056
- [new v(new rt(0.15, 0.15, 0.01), l.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5056
+ [new v(new rt(0.15, 0.15, 0.01), c.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5057
5057
  ]
5058
5058
  }, g = {
5059
5059
  X: [
@@ -5119,7 +5119,7 @@ class yr extends ei {
5119
5119
  AXIS: [
5120
5120
  [new Ut(C, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
5121
5121
  ]
5122
- }, y = {
5122
+ }, L = {
5123
5123
  XYZE: [
5124
5124
  [new v(new Wn(0.25, 10, 8), e)]
5125
5125
  ],
@@ -5158,12 +5158,12 @@ class yr extends ei {
5158
5158
  [new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
5159
5159
  ],
5160
5160
  XZ: [
5161
- [new v(new rt(0.15, 0.15, 0.01), l), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5161
+ [new v(new rt(0.15, 0.15, 0.01), c), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5162
5162
  ],
5163
5163
  XYZ: [
5164
5164
  [new v(new rt(0.1, 0.1, 0.1), d.clone())]
5165
5165
  ]
5166
- }, L = {
5166
+ }, P = {
5167
5167
  X: [
5168
5168
  [new v(new ct(0.2, 0, 0.6, 4), e), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
5169
5169
  [new v(new ct(0.2, 0, 0.6, 4), e), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
@@ -5188,7 +5188,7 @@ class yr extends ei {
5188
5188
  XYZ: [
5189
5189
  [new v(new rt(0.2, 0.2, 0.2), e), [0, 0, 0]]
5190
5190
  ]
5191
- }, U = {
5191
+ }, D = {
5192
5192
  X: [
5193
5193
  [new Ut(C, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
5194
5194
  ],
@@ -5210,7 +5210,7 @@ class yr extends ei {
5210
5210
  }
5211
5211
  return H;
5212
5212
  }
5213
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(m)), this.add(this.gizmo.rotate = x(_)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(y)), this.add(this.picker.scale = x(L)), this.add(this.helper.translate = x(S)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5213
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(m)), this.add(this.gizmo.rotate = x(_)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(L)), this.add(this.picker.scale = x(P)), this.add(this.helper.translate = x(S)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(D)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5214
5214
  }
5215
5215
  // updateMatrixWorld will update transformations and appearance of individual handles
5216
5216
  updateMatrixWorld(s) {
@@ -5233,7 +5233,7 @@ class yr extends ei {
5233
5233
  super.updateMatrixWorld(s);
5234
5234
  }
5235
5235
  }
5236
- class Lr extends v {
5236
+ class Pr extends v {
5237
5237
  constructor() {
5238
5238
  super(
5239
5239
  new Xn(1e5, 1e5, 2, 2),
@@ -5280,11 +5280,11 @@ class Lr extends v {
5280
5280
  class Fi {
5281
5281
  constructor(s, t, e, i, o, n = 5, r = !0) {
5282
5282
  /** Event that fires when the user starts dragging a clipping plane. */
5283
- I(this, "onDraggingStarted", new D());
5283
+ I(this, "onDraggingStarted", new U());
5284
5284
  /** Event that fires when the user stops dragging a clipping plane. */
5285
- I(this, "onDraggingEnded", new D());
5285
+ I(this, "onDraggingEnded", new U());
5286
5286
  /** {@link Disposable.onDisposed} */
5287
- I(this, "onDisposed", new D());
5287
+ I(this, "onDisposed", new U());
5288
5288
  I(this, "normal");
5289
5289
  I(this, "origin");
5290
5290
  I(this, "three", new O.Plane());
@@ -5405,19 +5405,19 @@ const ve = class ve extends it {
5405
5405
  constructor(t) {
5406
5406
  super(t);
5407
5407
  /** {@link Createable.onAfterCreate} */
5408
- I(this, "onAfterCreate", new D());
5408
+ I(this, "onAfterCreate", new U());
5409
5409
  /** {@link Createable.onAfterDelete} */
5410
- I(this, "onAfterDelete", new D());
5410
+ I(this, "onAfterDelete", new U());
5411
5411
  /** Event that fires when the user starts dragging a clipping plane. */
5412
- I(this, "onBeforeDrag", new D());
5412
+ I(this, "onBeforeDrag", new U());
5413
5413
  /** Event that fires when the user stops dragging a clipping plane. */
5414
- I(this, "onAfterDrag", new D());
5415
- I(this, "onBeforeCreate", new D());
5416
- I(this, "onBeforeCancel", new D());
5417
- I(this, "onAfterCancel", new D());
5418
- I(this, "onBeforeDelete", new D());
5414
+ I(this, "onAfterDrag", new U());
5415
+ I(this, "onBeforeCreate", new U());
5416
+ I(this, "onBeforeCancel", new U());
5417
+ I(this, "onAfterCancel", new U());
5418
+ I(this, "onBeforeDelete", new U());
5419
5419
  /** {@link Disposable.onDisposed} */
5420
- I(this, "onDisposed", new D());
5420
+ I(this, "onDisposed", new U());
5421
5421
  /**
5422
5422
  * Whether to force the clipping plane to be orthogonal in the Y direction
5423
5423
  * (up). This is desirable when clipping a building horizontally and a
@@ -5575,8 +5575,8 @@ const ve = class ve extends it {
5575
5575
  const i = t.object;
5576
5576
  let o = t.object.matrixWorld.clone();
5577
5577
  if (i instanceof O.InstancedMesh && t.instanceId !== void 0) {
5578
- const l = new O.Matrix4();
5579
- i.getMatrixAt(t.instanceId, l), o = l.multiply(o);
5578
+ const c = new O.Matrix4();
5579
+ i.getMatrixAt(t.instanceId, c), o = c.multiply(o);
5580
5580
  }
5581
5581
  const r = new O.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
5582
5582
  return this.normalizePlaneDirectionY(a), a;
@@ -5622,7 +5622,7 @@ const Be = class Be extends it {
5622
5622
  I(this, "enabled", !0);
5623
5623
  I(this, "_originalBackground", /* @__PURE__ */ new Map());
5624
5624
  /** {@link Disposable.onDisposed} */
5625
- I(this, "onDisposed", new D());
5625
+ I(this, "onDisposed", new U());
5626
5626
  I(this, "list", {});
5627
5627
  I(this, "_originals", {});
5628
5628
  this.components.add(Be.uuid, this);
@@ -5711,15 +5711,15 @@ const Be = class Be extends it {
5711
5711
  };
5712
5712
  I(Be, "uuid", "24989d27-fa2f-4797-8b08-35918f74e502");
5713
5713
  let In = Be;
5714
- function Mr(c, s, t, e) {
5714
+ function Mr(l, s, t, e) {
5715
5715
  return new Promise((i, o) => {
5716
5716
  function n() {
5717
- const r = c.clientWaitSync(s, t, 0);
5718
- if (r === c.WAIT_FAILED) {
5717
+ const r = l.clientWaitSync(s, t, 0);
5718
+ if (r === l.WAIT_FAILED) {
5719
5719
  o();
5720
5720
  return;
5721
5721
  }
5722
- if (r === c.TIMEOUT_EXPIRED) {
5722
+ if (r === l.TIMEOUT_EXPIRED) {
5723
5723
  setTimeout(n, e);
5724
5724
  return;
5725
5725
  }
@@ -5728,18 +5728,18 @@ function Mr(c, s, t, e) {
5728
5728
  n();
5729
5729
  });
5730
5730
  }
5731
- async function wr(c, s, t, e, i, o, n) {
5732
- const r = c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE, 0);
5733
- c.flush(), await Mr(c, r, 0, 10), c.deleteSync(r), c.bindBuffer(s, t), c.getBufferSubData(s, e, i, o, n), c.bindBuffer(s, null);
5731
+ async function wr(l, s, t, e, i, o, n) {
5732
+ const r = l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE, 0);
5733
+ l.flush(), await Mr(l, r, 0, 10), l.deleteSync(r), l.bindBuffer(s, t), l.getBufferSubData(s, e, i, o, n), l.bindBuffer(s, null);
5734
5734
  }
5735
- async function Dr(c, s, t, e, i, o, n, r) {
5736
- const a = c.createBuffer();
5737
- return c.bindBuffer(c.PIXEL_PACK_BUFFER, a), c.bufferData(c.PIXEL_PACK_BUFFER, r.byteLength, c.STREAM_READ), c.readPixels(s, t, e, i, o, n, 0), c.bindBuffer(c.PIXEL_PACK_BUFFER, null), await wr(c, c.PIXEL_PACK_BUFFER, a, 0, r), c.deleteBuffer(a), r;
5735
+ async function Dr(l, s, t, e, i, o, n, r) {
5736
+ const a = l.createBuffer();
5737
+ return l.bindBuffer(l.PIXEL_PACK_BUFFER, a), l.bufferData(l.PIXEL_PACK_BUFFER, r.byteLength, l.STREAM_READ), l.readPixels(s, t, e, i, o, n, 0), l.bindBuffer(l.PIXEL_PACK_BUFFER, null), await wr(l, l.PIXEL_PACK_BUFFER, a, 0, r), l.deleteBuffer(a), r;
5738
5738
  }
5739
5739
  class Ur {
5740
5740
  constructor(s, t, e) {
5741
5741
  /** {@link Disposable.onDisposed} */
5742
- I(this, "onDisposed", new D());
5742
+ I(this, "onDisposed", new U());
5743
5743
  /**
5744
5744
  * Fires after making the visibility check to the meshes. It lists the
5745
5745
  * meshes that are currently visible, and the ones that were visible
@@ -5863,7 +5863,7 @@ class xr extends Ur {
5863
5863
  super(t, e, i);
5864
5864
  /* Pixels in screen a geometry must occupy to be considered "seen". */
5865
5865
  I(this, "threshold", 100);
5866
- I(this, "onViewUpdated", new D());
5866
+ I(this, "onViewUpdated", new U());
5867
5867
  I(this, "colorMeshes", /* @__PURE__ */ new Map());
5868
5868
  I(this, "isProcessing", !1);
5869
5869
  I(this, "_colorCodeMeshMap", /* @__PURE__ */ new Map());
@@ -5935,7 +5935,7 @@ class xr extends Ur {
5935
5935
  } else
5936
5936
  a = n;
5937
5937
  this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
5938
- const l = e ? t.count : 1, E = new O.InstancedMesh(i, a, l);
5938
+ const c = e ? t.count : 1, E = new O.InstancedMesh(i, a, c);
5939
5939
  e ? E.instanceMatrix = t.instanceMatrix : E.setMatrixAt(0, new O.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;
5940
5940
  }
5941
5941
  remove(t) {
@@ -5959,12 +5959,12 @@ class xr extends Ur {
5959
5959
  const r = new O.Color(`rgb(${t}, ${e}, ${i})`);
5960
5960
  if (!this.world.renderer)
5961
5961
  throw new Error("Renderer not found in the world!");
5962
- const a = this.world.renderer.clippingPlanes, l = new O.MeshBasicMaterial({
5962
+ const a = this.world.renderer.clippingPlanes, c = new O.MeshBasicMaterial({
5963
5963
  color: r,
5964
5964
  clippingPlanes: a,
5965
5965
  side: O.DoubleSide
5966
5966
  });
5967
- return O.ColorManagement.enabled = n, { colorMaterial: l, code: o };
5967
+ return O.ColorManagement.enabled = n, { colorMaterial: c, code: o };
5968
5968
  }
5969
5969
  }
5970
5970
  const Ye = class Ye extends it {
@@ -5973,7 +5973,7 @@ const Ye = class Ye extends it {
5973
5973
  I(this, "_enabled", !0);
5974
5974
  I(this, "list", /* @__PURE__ */ new Map());
5975
5975
  /** {@link Disposable.onDisposed} */
5976
- I(this, "onDisposed", new D());
5976
+ I(this, "onDisposed", new U());
5977
5977
  t.add(Ye.uuid, this);
5978
5978
  }
5979
5979
  /** {@link Component.enabled} */
@@ -6011,7 +6011,7 @@ const At = class At extends it {
6011
6011
  /** {@link Component.enabled} */
6012
6012
  I(this, "enabled", !0);
6013
6013
  /** {@link Disposable.onDisposed} */
6014
- I(this, "onDisposed", new D());
6014
+ I(this, "onDisposed", new U());
6015
6015
  I(this, "_absoluteMin");
6016
6016
  I(this, "_absoluteMax");
6017
6017
  I(this, "_meshes", []);
@@ -6051,8 +6051,8 @@ const At = class At extends it {
6051
6051
  return new O.Sphere(r, a);
6052
6052
  }
6053
6053
  getMesh() {
6054
- const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n), l = new O.Mesh(a);
6055
- return this._meshes.push(l), l.position.copy(r), l;
6054
+ const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n), c = new O.Mesh(a);
6055
+ return this._meshes.push(c), c.position.copy(r), c;
6056
6056
  }
6057
6057
  reset() {
6058
6058
  this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
@@ -6068,8 +6068,8 @@ const At = class At extends it {
6068
6068
  t.updateMatrixWorld();
6069
6069
  const i = t.matrixWorld, o = new O.Matrix4(), n = t instanceof O.InstancedMesh, r = n ? t.count : 1;
6070
6070
  for (let a = 0; a < r; a++) {
6071
- const l = e.min.clone(), E = e.max.clone();
6072
- n && (t.getMatrixAt(a, o), l.applyMatrix4(o), E.applyMatrix4(o)), l.applyMatrix4(i), E.applyMatrix4(i), l.x < this._absoluteMin.x && (this._absoluteMin.x = l.x), l.y < this._absoluteMin.y && (this._absoluteMin.y = l.y), l.z < this._absoluteMin.z && (this._absoluteMin.z = l.z), l.x > this._absoluteMax.x && (this._absoluteMax.x = l.x), l.y > this._absoluteMax.y && (this._absoluteMax.y = l.y), l.z > this._absoluteMax.z && (this._absoluteMax.z = l.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), 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);
6071
+ const c = e.min.clone(), E = e.max.clone();
6072
+ n && (t.getMatrixAt(a, o), c.applyMatrix4(o), E.applyMatrix4(o)), c.applyMatrix4(i), E.applyMatrix4(i), c.x < this._absoluteMin.x && (this._absoluteMin.x = c.x), c.y < this._absoluteMin.y && (this._absoluteMin.y = c.y), c.z < this._absoluteMin.z && (this._absoluteMin.z = c.z), c.x > this._absoluteMax.x && (this._absoluteMax.x = c.x), c.y > this._absoluteMax.y && (this._absoluteMax.y = c.y), c.z > this._absoluteMax.z && (this._absoluteMax.z = c.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), 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);
6073
6073
  }
6074
6074
  }
6075
6075
  static getFragmentBounds(t) {
@@ -6077,12 +6077,12 @@ const At = class At extends it {
6077
6077
  if (!t.geometry.index)
6078
6078
  throw new Error("Geometry must be indexed!");
6079
6079
  const a = Array.from(t.geometry.index.array);
6080
- for (let l = 0; l < a.length; l++) {
6081
- if (l % 3 === 0 && a[l] === 0 && a[l + 1] === 0 && a[l + 2] === 0) {
6082
- l += 2;
6080
+ for (let c = 0; c < a.length; c++) {
6081
+ if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
6082
+ c += 2;
6083
6083
  continue;
6084
6084
  }
6085
- const E = a[l], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
6085
+ const E = a[c], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
6086
6086
  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);
6087
6087
  }
6088
6088
  return new O.Box3(n, r);
@@ -6090,7 +6090,7 @@ const At = class At extends it {
6090
6090
  };
6091
6091
  I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
6092
6092
  let fn = At;
6093
- const Ln = /* @__PURE__ */ new Set([
6093
+ const Pn = /* @__PURE__ */ new Set([
6094
6094
  1123145078,
6095
6095
  574549367,
6096
6096
  1675464909,
@@ -6245,11 +6245,11 @@ class br {
6245
6245
  for (const a of r)
6246
6246
  n.add(a);
6247
6247
  for (const a of n) {
6248
- if (Ln.has(a))
6248
+ if (Pn.has(a))
6249
6249
  continue;
6250
- const l = r.has(a) && i, E = s.GetLineIDsWithType(t, a);
6250
+ const c = r.has(a) && i, E = s.GetLineIDsWithType(t, a);
6251
6251
  for (const d of E) {
6252
- const h = s.GetLine(0, d, l, e);
6252
+ const h = s.GetLine(0, d, c, e);
6253
6253
  o[h.expressID] = h;
6254
6254
  }
6255
6255
  }
@@ -6400,8 +6400,8 @@ class Kr {
6400
6400
  const e = {}, i = Object.keys(vr).map((o) => parseInt(o, 10));
6401
6401
  for (let o = 0; o < i.length; o++) {
6402
6402
  const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
6403
- for (let l = 0; l < a; l++)
6404
- e[r.get(l)] = n;
6403
+ for (let c = 0; c < a; c++)
6404
+ e[r.get(c)] = n;
6405
6405
  }
6406
6406
  return e;
6407
6407
  }
@@ -7580,8 +7580,8 @@ class Ft {
7580
7580
  var a;
7581
7581
  const o = e ?? (() => {
7582
7582
  }), n = {}, r = s.getAllPropertiesIDs();
7583
- for (const l of r) {
7584
- const E = await s.getProperties(l);
7583
+ for (const c of r) {
7584
+ const E = await s.getProperties(c);
7585
7585
  if (!E)
7586
7586
  continue;
7587
7587
  const d = E.type === t, h = Object.keys(E).find(
@@ -7602,12 +7602,12 @@ class Ft {
7602
7602
  static async getQsetQuantities(s, t, e) {
7603
7603
  const o = e ?? (() => {
7604
7604
  }), n = await s.getProperties(t);
7605
- return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
7605
+ return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
7606
7606
  }
7607
7607
  static async getPsetProps(s, t, e) {
7608
7608
  const o = e ?? (() => {
7609
7609
  }), n = await s.getProperties(t);
7610
- return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
7610
+ return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
7611
7611
  }
7612
7612
  static async getPsetRel(s, t) {
7613
7613
  var r;
@@ -7687,9 +7687,9 @@ const Ss = class Ss extends it {
7687
7687
  constructor(t) {
7688
7688
  super(t);
7689
7689
  /** {@link Disposable.onDisposed} */
7690
- I(this, "onDisposed", new D());
7691
- I(this, "onFragmentsLoaded", new D());
7692
- I(this, "onFragmentsDisposed", new D());
7690
+ I(this, "onDisposed", new U());
7691
+ I(this, "onFragmentsLoaded", new U());
7692
+ I(this, "onFragmentsDisposed", new U());
7693
7693
  /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
7694
7694
  I(this, "list", /* @__PURE__ */ new Map());
7695
7695
  I(this, "groups", /* @__PURE__ */ new Map());
@@ -7764,9 +7764,9 @@ let dt = Ss;
7764
7764
  class Jr extends it {
7765
7765
  constructor(t) {
7766
7766
  super(t);
7767
- I(this, "onFound", new D());
7767
+ I(this, "onFound", new U());
7768
7768
  /** {@link Disposable.onDisposed} */
7769
- I(this, "onDisposed", new D());
7769
+ I(this, "onDisposed", new U());
7770
7770
  I(this, "enabled", !0);
7771
7771
  I(this, "indexedModels", {});
7772
7772
  I(this, "_conditionFunctions");
@@ -7792,8 +7792,8 @@ class Jr extends it {
7792
7792
  });
7793
7793
  for (const a of n) {
7794
7794
  e[o].add(a);
7795
- for (const l of r)
7796
- e[l].add(a);
7795
+ for (const c of r)
7796
+ e[c].add(a);
7797
7797
  e[a] || (e[a] = /* @__PURE__ */ new Set()), e[a].add(a);
7798
7798
  }
7799
7799
  }
@@ -7818,13 +7818,13 @@ class Jr extends it {
7818
7818
  async find(t, e) {
7819
7819
  const i = this.components.get(dt), o = e || i.groups.values(), n = {};
7820
7820
  for (const a of o) {
7821
- let l = this.indexedModels[a.uuid];
7822
- l || (l = await this.indexEntityRelations(a));
7821
+ let c = this.indexedModels[a.uuid];
7822
+ c || (c = await this.indexEntityRelations(a));
7823
7823
  let E = [];
7824
7824
  for (const [u, p] of t.entries()) {
7825
7825
  const R = /* @__PURE__ */ new Set(), A = this.simpleQuery(a, p, R), C = [];
7826
7826
  for (const T of A) {
7827
- const F = l[T];
7827
+ const F = c[T];
7828
7828
  if (F) {
7829
7829
  C.push(T);
7830
7830
  for (const f of F)
@@ -7852,9 +7852,9 @@ class Jr extends it {
7852
7852
  continue;
7853
7853
  const r = t[o].modelEntities;
7854
7854
  for (const a of r) {
7855
- const l = n.data.get(a);
7856
- if (l)
7857
- for (const E of l[0]) {
7855
+ const c = n.data.get(a);
7856
+ if (c)
7857
+ for (const E of c[0]) {
7858
7858
  const d = n.keyFragments.get(E);
7859
7859
  if (!d)
7860
7860
  throw new Error("Fragment ID not found!");
@@ -7869,24 +7869,24 @@ class Jr extends it {
7869
7869
  if (!o)
7870
7870
  throw new Error("Model has no properties");
7871
7871
  let n = {}, r = 0, a = [];
7872
- for (const l of e.queries) {
7872
+ for (const c of e.queries) {
7873
7873
  let E = [];
7874
- const d = l.operator === "AND" ? n : o;
7875
- if (l.condition) {
7874
+ const d = c.operator === "AND" ? n : o;
7875
+ if (c.condition) {
7876
7876
  const u = this.getMatchingEntities(
7877
7877
  d,
7878
- l,
7878
+ c,
7879
7879
  i
7880
7880
  );
7881
7881
  E = u.expressIDs, n = { ...n, ...u.entities };
7882
7882
  } else
7883
7883
  E = [
7884
- ...this.simpleQuery(t, l, i)
7884
+ ...this.simpleQuery(t, c, i)
7885
7885
  ];
7886
7886
  a = r === 0 ? E : this.combineArrays(
7887
7887
  a,
7888
7888
  E,
7889
- l.operator ?? "AND"
7889
+ c.operator ?? "AND"
7890
7890
  // Defaults to AND if iterations > 0 and query.operator is not defined
7891
7891
  ), r++;
7892
7892
  }
@@ -7895,7 +7895,7 @@ class Jr extends it {
7895
7895
  getMatchingEntities(t, e, i) {
7896
7896
  const { attribute: o, condition: n } = e;
7897
7897
  let { value: r } = e;
7898
- const a = !this._noHandleAttributes.includes(o), l = [], E = [];
7898
+ const a = !this._noHandleAttributes.includes(o), c = [], E = [];
7899
7899
  for (const d in t) {
7900
7900
  const h = t[d];
7901
7901
  if (h === void 0)
@@ -7914,9 +7914,9 @@ class Jr extends it {
7914
7914
  e.negateResult && i.add(h.expressID);
7915
7915
  continue;
7916
7916
  }
7917
- l.push(h.expressID), E.push(h);
7917
+ c.push(h.expressID), E.push(h);
7918
7918
  }
7919
- return { expressIDs: l, entities: E, excludedItems: i };
7919
+ return { expressIDs: c, entities: E, excludedItems: i };
7920
7920
  }
7921
7921
  combineArrays(t, e, i) {
7922
7922
  return i ? i === "AND" ? this.arrayIntersection(t, e) : this.arrayUnion(t, e) : e;
@@ -7948,137 +7948,236 @@ class Jr extends it {
7948
7948
  };
7949
7949
  }
7950
7950
  }
7951
- const Ve = class Ve extends it {
7951
+ const Ge = class Ge extends it {
7952
7952
  constructor(t) {
7953
7953
  super(t);
7954
7954
  /** {@link Disposable.onDisposed} */
7955
- I(this, "onDisposed", new D());
7955
+ I(this, "onDisposed", new U());
7956
7956
  I(this, "enabled", !0);
7957
- I(this, "relationsToProcess", [
7958
- b.IFCRELDEFINESBYPROPERTIES,
7959
- b.IFCRELDEFINESBYTYPE,
7960
- b.IFCRELASSOCIATESMATERIAL,
7961
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
7962
- b.IFCRELASSOCIATESCLASSIFICATION,
7963
- b.IFCRELASSIGNSTOGROUP
7957
+ /**
7958
+ * All the inverse attributes this component can processes.
7959
+ */
7960
+ I(this, "inverseAttributes", [
7961
+ "IsDecomposedBy",
7962
+ "Decomposes",
7963
+ "AssociatedTo",
7964
+ "HasAssociations",
7965
+ "ClassificationForObjects",
7966
+ "IsGroupedBy",
7967
+ "HasAssignments",
7968
+ "IsDefinedBy",
7969
+ "DefinesOcurrence",
7970
+ "IsTypedBy",
7971
+ "Types",
7972
+ "Defines",
7973
+ "ContainedInStructure",
7974
+ "ContainsElements"
7975
+ ]);
7976
+ I(this, "inverseAttributesToProcess", [
7977
+ "HasAssignments",
7978
+ "IsDecomposedBy",
7979
+ "IsDefinedBy",
7980
+ "IsTypedBy",
7981
+ "HasAssociations",
7982
+ "ContainedInStructure"
7964
7983
  ]);
7965
- I(this, "indexMap", {});
7966
- I(this, "_propertiesManager", null);
7967
- I(this, "onPropertiesManagerSet", new D());
7984
+ I(this, "_relToAttributesMap", /* @__PURE__ */ new Map());
7985
+ /**
7986
+ * Holds the relationship mappings for each model processed by the indexer.
7987
+ * The structure is a map where each key is a model's UUID, and the value is another map.
7988
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
7989
+ * representing a specific relation type, and the value is an array of expressIDs of entities
7990
+ * that are related through that relation type. This structure allows for efficient querying
7991
+ * of entity relationships within a model.
7992
+ */
7993
+ I(this, "relationMaps", {});
7968
7994
  I(this, "onFragmentsDisposed", (t) => {
7969
- delete this.indexMap[t.groupID];
7995
+ delete this.relationMaps[t.groupID];
7970
7996
  });
7971
- this.components.add(Ve.uuid, this), t.get(dt).onFragmentsDisposed.add(this.onFragmentsDisposed);
7972
- }
7973
- // private _entityUIPool: UIPool<TreeView>;
7974
- set propertiesManager(t) {
7975
- this._propertiesManager || (this._propertiesManager = t, t && (t.onElementToPset.add(async ({ model: e, psetID: i, elementID: o }) => {
7976
- this.indexMap[e.uuid] && this.setEntityIndex(e, o).add(i);
7977
- }), this.onPropertiesManagerSet.trigger(t)));
7978
- }
7979
- get propertiesManager() {
7980
- return this._propertiesManager;
7981
- }
7982
- async dispose() {
7983
- this.indexMap = {}, this.propertiesManager = null, this.onPropertiesManagerSet.reset(), this.components.get(dt).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
7997
+ this.components.add(Ge.uuid, this), t.get(dt).onFragmentsDisposed.add(this.onFragmentsDisposed), this.setRelMap();
7984
7998
  }
7985
- async getProperties(t, e) {
7986
- if (!t.hasProperties)
7987
- return null;
7988
- const i = t.getLocalProperties();
7989
- if (i === void 0)
7990
- return null;
7991
- const o = this.indexMap[t.uuid];
7992
- if (!o)
7993
- return null;
7994
- const n = o[e], r = parseInt(e, 10), a = await t.getProperties(r);
7995
- if (!a)
7996
- throw new Error("Properties not found!");
7997
- const l = this.cloneProperty(a);
7998
- if (!l)
7999
- throw new Error("Properties not found!");
8000
- const E = [l];
8001
- if (n)
8002
- for (const d of n) {
8003
- const h = await t.getProperties(d);
8004
- if (!h)
8005
- continue;
8006
- const u = this.cloneProperty(h);
8007
- u && (this.getPsetProperties(u, i), this.getNestedPsets(u, i), E.push(u));
8008
- }
8009
- return E;
8010
- }
8011
- getNestedPsets(t, e) {
8012
- if (t.HasPropertySets)
8013
- for (const i of t.HasPropertySets) {
8014
- const o = i.value;
8015
- i.value = this.cloneProperty(e[o]), this.getPsetProperties(i.value, e);
8016
- }
7999
+ getAttributeRels(t) {
8000
+ const e = [];
8001
+ for (const [i, o] of this._relToAttributesMap.entries()) {
8002
+ const { forRelating: n, forRelated: r } = o;
8003
+ (n === t || r === t) && e.push(i);
8004
+ }
8005
+ return e;
8017
8006
  }
8018
- getPsetProperties(t, e) {
8019
- if (t.HasProperties)
8020
- for (const i of t.HasProperties) {
8021
- const o = i.value, n = this.cloneProperty(e[o]);
8022
- i.value = { ...n };
8023
- }
8007
+ // TODO: Construct this based on the IFC EXPRESS long form schema?
8008
+ setRelMap() {
8009
+ this._relToAttributesMap.set(b.IFCRELAGGREGATES, {
8010
+ forRelating: "IsDecomposedBy",
8011
+ forRelated: "Decomposes"
8012
+ }), this._relToAttributesMap.set(b.IFCRELASSOCIATESMATERIAL, {
8013
+ forRelating: "AssociatedTo",
8014
+ forRelated: "HasAssociations"
8015
+ }), this._relToAttributesMap.set(b.IFCRELASSOCIATESCLASSIFICATION, {
8016
+ forRelating: "ClassificationForObjects",
8017
+ forRelated: "HasAssociations"
8018
+ }), this._relToAttributesMap.set(b.IFCRELASSIGNSTOGROUP, {
8019
+ forRelating: "IsGroupedBy",
8020
+ forRelated: "HasAssignments"
8021
+ }), this._relToAttributesMap.set(b.IFCRELDEFINESBYPROPERTIES, {
8022
+ forRelated: "IsDefinedBy",
8023
+ forRelating: "DefinesOcurrence"
8024
+ }), this._relToAttributesMap.set(b.IFCRELDEFINESBYTYPE, {
8025
+ forRelated: "IsTypedBy",
8026
+ forRelating: "Types"
8027
+ }), this._relToAttributesMap.set(b.IFCRELDEFINESBYTEMPLATE, {
8028
+ forRelated: "IsDefinedBy",
8029
+ forRelating: "Defines"
8030
+ }), this._relToAttributesMap.set(b.IFCRELCONTAINEDINSPATIALSTRUCTURE, {
8031
+ forRelated: "ContainedInStructure",
8032
+ forRelating: "ContainsElements"
8033
+ });
8024
8034
  }
8035
+ /**
8036
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
8037
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
8038
+ * and maps them in a structured way to facilitate quick access to related entities.
8039
+ *
8040
+ * The process involves querying the model for each relation type associated with the inverse attributes
8041
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
8042
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
8043
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
8044
+ * of entities that are related through that attribute.
8045
+ *
8046
+ * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
8047
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
8048
+ * representation of the relations indexed by entity expressIDs and relation types.
8049
+ * @throws An error if the model does not have properties loaded.
8050
+ */
8025
8051
  async process(t) {
8026
8052
  if (!t.hasProperties)
8027
8053
  throw new Error("FragmentsGroup properties not found");
8028
- this.indexMap[t.uuid] = {};
8029
- const e = [b.IFCPROPERTYSET, b.IFCELEMENTQUANTITY];
8030
- for (const i of this.relationsToProcess)
8031
- await Ft.getRelationMap(
8032
- t,
8033
- i,
8034
- // eslint-disable-next-line no-loop-func
8035
- async (o, n) => {
8036
- const r = await t.getProperties(o);
8037
- if (r) {
8038
- e.includes(r.type) || this.setEntityIndex(t, o);
8039
- for (const a of n)
8040
- this.setEntityIndex(t, a).add(o);
8054
+ this.relationMaps[t.uuid] = /* @__PURE__ */ new Map();
8055
+ const e = this.relationMaps[t.uuid];
8056
+ for (const i of this.inverseAttributesToProcess) {
8057
+ const o = this.getAttributeRels(i);
8058
+ for (const n of o)
8059
+ await Ft.getRelationMap(
8060
+ t,
8061
+ n,
8062
+ async (r, a) => {
8063
+ const c = this._relToAttributesMap.get(n);
8064
+ if (!c)
8065
+ return;
8066
+ const { forRelated: E, forRelating: d } = c;
8067
+ if (d && this.inverseAttributesToProcess.includes(d)) {
8068
+ const h = e.get(r) ?? /* @__PURE__ */ new Map(), u = this.inverseAttributes.indexOf(d);
8069
+ h.set(u, a), e.set(r, h);
8070
+ }
8071
+ if (E && this.inverseAttributesToProcess.includes(E))
8072
+ for (const h of a) {
8073
+ const u = e.get(h) ?? /* @__PURE__ */ new Map(), p = this.inverseAttributes.indexOf(E), R = u.get(p) ?? [];
8074
+ R.push(r), u.set(p, R), e.set(h, u);
8075
+ }
8041
8076
  }
8042
- }
8043
- );
8077
+ );
8078
+ }
8079
+ return e;
8044
8080
  }
8045
- setEntityIndex(t, e) {
8046
- return this.indexMap[t.uuid][e] || (this.indexMap[t.uuid][e] = /* @__PURE__ */ new Set()), this.indexMap[t.uuid][e];
8081
+ /**
8082
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
8083
+ * This method searches the indexed relation maps for the specified model and entity,
8084
+ * returning the IDs of related entities if a match is found.
8085
+ *
8086
+ * @param model The `FragmentsGroup` model containing the entity.
8087
+ * @param expressID The unique identifier of the entity within the model.
8088
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
8089
+ * @returns An array of express IDs representing the related entities, or `null` if no relations are found
8090
+ * or the specified relation name is not indexed.
8091
+ */
8092
+ getEntityRelations(t, e, i) {
8093
+ const o = this.relationMaps[t.uuid];
8094
+ if (!o)
8095
+ return null;
8096
+ const n = o.get(e), r = this.inverseAttributes.indexOf(i);
8097
+ if (!n || r === -1)
8098
+ return null;
8099
+ const a = n.get(r);
8100
+ return a || null;
8047
8101
  }
8048
- cloneProperty(t, e = {}) {
8049
- if (!t)
8050
- return e;
8051
- for (const i in t) {
8052
- const o = t[i], n = Array.isArray(o), r = typeof o == "object" && !n && o !== null;
8053
- if (n) {
8054
- e[i] = [];
8055
- const a = e[i];
8056
- this.clonePropertyArray(o, a);
8057
- } else if (r) {
8058
- e[i] = {};
8059
- const a = e[i];
8060
- this.cloneProperty(o, a);
8061
- } else
8062
- e[i] = o;
8102
+ /**
8103
+ * Serializes the relations of a specific model into a JSON string.
8104
+ * This method iterates through the relations indexed for the given model,
8105
+ * organizing them into a structured object where each key is an expressID of an entity,
8106
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
8107
+ * The resulting object is then serialized into a JSON string.
8108
+ *
8109
+ * @param model The `FragmentsGroup` model whose relations are to be serialized.
8110
+ * @returns A JSON string representing the serialized relations of the specified model.
8111
+ * If the model has no indexed relations, `null` is returned.
8112
+ */
8113
+ serializeModelRelations(t) {
8114
+ const e = this.relationMaps[t.uuid];
8115
+ if (!e)
8116
+ return null;
8117
+ const i = {};
8118
+ for (const [o, n] of e.entries()) {
8119
+ i[o] || (i[o] = {});
8120
+ for (const [r, a] of n.entries())
8121
+ i[o][r] = a;
8063
8122
  }
8064
- return e;
8123
+ return JSON.stringify(i);
8065
8124
  }
8066
- clonePropertyArray(t, e) {
8067
- for (const i of t) {
8068
- const o = Array.isArray(i), n = typeof i == "object" && !o && i !== null;
8069
- if (o) {
8070
- const r = [];
8071
- e.push(r), this.clonePropertyArray(i, r);
8072
- } else if (n) {
8073
- const r = {};
8074
- e.push(r), this.cloneProperty(i, r);
8075
- } else
8076
- e.push(i);
8125
+ /**
8126
+ * Serializes all relations of every model processed by the indexer into a JSON string.
8127
+ * This method iterates through each model's relations indexed in `relationMaps`, organizing them
8128
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
8129
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
8130
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
8131
+ *
8132
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
8133
+ * If no relations have been indexed, an empty object is returned as a JSON string.
8134
+ */
8135
+ serializeRelations() {
8136
+ const t = {};
8137
+ for (const e in this.relationMaps) {
8138
+ const i = this.relationMaps[e], o = {};
8139
+ for (const [n, r] of i.entries()) {
8140
+ o[n] || (o[n] = {});
8141
+ for (const [a, c] of r.entries())
8142
+ o[n][a] = c;
8143
+ }
8144
+ t[e] = o;
8077
8145
  }
8146
+ return JSON.stringify(t);
8147
+ }
8148
+ /**
8149
+ * Converts a JSON string representing relations between entities into a structured map.
8150
+ * This method parses the JSON string to reconstruct the relations map that indexes
8151
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
8152
+ * and the values are maps where each key is a relation type ID and its value is an array
8153
+ * of express IDs of entities related through that relation type.
8154
+ *
8155
+ * @param json The JSON string to be parsed into the relations map.
8156
+ * @returns A `Map` where the key is the express ID of an entity as a number, and the value
8157
+ * is another `Map`. This inner map's key is the relation type ID as a number, and its value
8158
+ * is an array of express IDs (as numbers) of entities related through that relation type.
8159
+ */
8160
+ getRelationsMapFromJSON(t) {
8161
+ const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
8162
+ for (const o in e) {
8163
+ const n = e[o], r = /* @__PURE__ */ new Map();
8164
+ for (const a in n)
8165
+ r.set(Number(a), n[a]);
8166
+ i.set(Number(o), r);
8167
+ }
8168
+ return i;
8169
+ }
8170
+ /**
8171
+ * Disposes the component, cleaning up resources and detaching event listeners.
8172
+ * This ensures that the component is properly cleaned up and does not leave behind any
8173
+ * references that could prevent garbage collection.
8174
+ */
8175
+ dispose() {
8176
+ this.relationMaps = {}, this.components.get(dt).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ge.uuid), this.onDisposed.reset();
8078
8177
  }
8079
8178
  };
8080
- I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
8081
- let pn = Ve;
8179
+ I(Ge, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
8180
+ let pn = Ge;
8082
8181
  class Br {
8083
8182
  constructor() {
8084
8183
  I(this, "factor", 1);
@@ -8150,11 +8249,11 @@ class wn {
8150
8249
  0,
8151
8250
  b.IFCRELCONTAINEDINSPATIALSTRUCTURE
8152
8251
  ), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, b.IFCSPACE);
8153
- for (let l = 0; l < i.size(); l++)
8154
- e.add(i.get(l));
8252
+ for (let c = 0; c < i.size(); c++)
8253
+ e.add(i.get(c));
8155
8254
  const o = s.GetLineIDsWithType(0, b.IFCRELAGGREGATES), n = o.size();
8156
- for (let l = 0; l < n; l++) {
8157
- const E = o.get(l), d = s.GetLine(0, E);
8255
+ for (let c = 0; c < n; c++) {
8256
+ const E = o.get(c), d = s.GetLine(0, E);
8158
8257
  if (!d || !d.RelatingObject || !d.RelatedObjects)
8159
8258
  continue;
8160
8259
  const h = d.RelatingObject.value, u = d.RelatedObjects;
@@ -8164,8 +8263,8 @@ class wn {
8164
8263
  }
8165
8264
  }
8166
8265
  const r = {}, a = t.size();
8167
- for (let l = 0; l < a; l++) {
8168
- const E = t.get(l), d = s.GetLine(0, E);
8266
+ for (let c = 0; c < a; c++) {
8267
+ const E = t.get(c), d = s.GetLine(0, E);
8169
8268
  if (!d || !d.RelatingStructure || !d.RelatedElements)
8170
8269
  continue;
8171
8270
  const h = d.RelatingStructure.value, u = d.RelatedElements;
@@ -8181,16 +8280,16 @@ class wn {
8181
8280
  this.itemsByFloor[R] = h;
8182
8281
  }
8183
8282
  }
8184
- for (const l in r) {
8185
- const E = this.itemsByFloor[l];
8283
+ for (const c in r) {
8284
+ const E = this.itemsByFloor[c];
8186
8285
  if (E !== void 0) {
8187
- const d = r[l];
8286
+ const d = r[c];
8188
8287
  for (const h of d)
8189
8288
  this.itemsByFloor[h] = E;
8190
8289
  }
8191
8290
  }
8192
- for (let l = 0; l < n; l++) {
8193
- const E = o.get(l), d = s.GetLine(0, E);
8291
+ for (let c = 0; c < n; c++) {
8292
+ const E = o.get(c), d = s.GetLine(0, E);
8194
8293
  if (!d || !d.RelatingObject || !d.RelatedObjects)
8195
8294
  continue;
8196
8295
  const h = d.RelatingObject.value, u = d.RelatedObjects;
@@ -8274,8 +8373,8 @@ class Dn {
8274
8373
  const { x: u, y: p, z: R } = r[h];
8275
8374
  a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = R || 0;
8276
8375
  }
8277
- const l = new O.BufferAttribute(a, 3), E = new O.EdgesGeometry();
8278
- E.setAttribute("position", l);
8376
+ const c = new O.BufferAttribute(a, 3), E = new O.EdgesGeometry();
8377
+ E.setAttribute("position", c);
8279
8378
  const d = new $t.CurveMesh(
8280
8379
  i,
8281
8380
  n,
@@ -8304,13 +8403,13 @@ class Un {
8304
8403
  return e;
8305
8404
  }
8306
8405
  }
8307
- const Ge = class Ge extends it {
8406
+ const Ve = class Ve extends it {
8308
8407
  constructor(t) {
8309
8408
  super(t);
8310
- I(this, "onIfcStartedLoading", new D());
8311
- I(this, "onSetup", new D());
8409
+ I(this, "onIfcStartedLoading", new U());
8410
+ I(this, "onSetup", new U());
8312
8411
  /** {@link Disposable.onDisposed} */
8313
- I(this, "onDisposed", new D());
8412
+ I(this, "onDisposed", new U());
8314
8413
  I(this, "settings", new gi());
8315
8414
  I(this, "enabled", !0);
8316
8415
  I(this, "webIfc", new b.IfcAPI());
@@ -8325,10 +8424,10 @@ const Ge = class Ge extends it {
8325
8424
  transparent: !0,
8326
8425
  opacity: 0.5
8327
8426
  }));
8328
- this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
8427
+ this.components.add(Ve.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
8329
8428
  }
8330
8429
  dispose() {
8331
- this.webIfc = null, this.onDisposed.trigger(Ge.uuid), this.onDisposed.reset();
8430
+ this.webIfc = null, this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
8332
8431
  }
8333
8432
  async setup(t) {
8334
8433
  this.settings = { ...this.settings, ...t }, this.settings.autoSetWasm && await this.autoSetWasm(), this.onSetup.trigger();
@@ -8361,9 +8460,9 @@ const Ge = class Ge extends it {
8361
8460
  for (const a of t) {
8362
8461
  if (!this.webIfc.IsIfcElement(a) && a !== b.IFCSPACE || this.settings.excludedCategories.has(a))
8363
8462
  continue;
8364
- const l = this.webIfc.GetLineIDsWithType(0, a), E = l.size();
8463
+ const c = this.webIfc.GetLineIDsWithType(0, a), E = c.size();
8365
8464
  for (let d = 0; d < E; d++) {
8366
- const h = l.get(d);
8465
+ const h = c.get(d);
8367
8466
  n.push(h);
8368
8467
  const u = this._spatialTree.itemsByFloor[h] || 0;
8369
8468
  e.data.set(h, [[], [u, a]]);
@@ -8373,15 +8472,15 @@ const Ge = class Ge extends it {
8373
8472
  this.getMesh(a, e);
8374
8473
  });
8375
8474
  for (const a of this._visitedFragments) {
8376
- const { index: l, fragment: E } = a[1];
8377
- e.keyFragments.set(l, E.id);
8475
+ const { index: c, fragment: E } = a[1];
8476
+ e.keyFragments.set(c, E.id);
8378
8477
  }
8379
8478
  for (const a of e.items) {
8380
- const l = this._fragmentInstances.get(a.id);
8381
- if (!l)
8479
+ const c = this._fragmentInstances.get(a.id);
8480
+ if (!c)
8382
8481
  throw new Error("Fragment not found!");
8383
8482
  const E = [];
8384
- for (const [d, h] of l)
8483
+ for (const [d, h] of c)
8385
8484
  E.push(h);
8386
8485
  a.add(E);
8387
8486
  }
@@ -8394,14 +8493,14 @@ const Ge = class Ge extends it {
8394
8493
  getMesh(t, e) {
8395
8494
  const i = t.geometries.size(), o = t.expressID;
8396
8495
  for (let n = 0; n < i; n++) {
8397
- const r = t.geometries.get(n), { x: a, y: l, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
8496
+ 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}`;
8398
8497
  if (!this._visitedFragments.has(p)) {
8399
8498
  const m = this.getGeometry(this.webIfc, u), g = h ? this._materialT : this._material, S = new $t.Fragment(m, g, 1);
8400
8499
  e.add(S.mesh), e.items.push(S);
8401
8500
  const _ = this._visitedFragments.size;
8402
8501
  this._visitedFragments.set(p, { index: _, fragment: S });
8403
8502
  }
8404
- const R = new O.Color().setRGB(a, l, E, "srgb"), A = new O.Matrix4();
8503
+ const R = new O.Color().setRGB(a, c, E, "srgb"), A = new O.Matrix4();
8405
8504
  A.fromArray(r.flatTransformation);
8406
8505
  const C = this._visitedFragments.get(p);
8407
8506
  if (C === void 0)
@@ -8434,8 +8533,8 @@ const Ge = class Ge extends it {
8434
8533
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
8435
8534
  for (let h = 0; h < n.length; h += 6)
8436
8535
  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];
8437
- const l = new O.BufferGeometry(), E = new O.BufferAttribute(r, 3), d = new O.BufferAttribute(a, 3);
8438
- return l.setAttribute("position", E), l.setAttribute("normal", d), l.setIndex(Array.from(o)), i.delete(), l;
8536
+ const c = new O.BufferGeometry(), E = new O.BufferAttribute(r, 3), d = new O.BufferAttribute(a, 3);
8537
+ return c.setAttribute("position", E), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
8439
8538
  }
8440
8539
  async autoSetWasm() {
8441
8540
  const t = await fetch(
@@ -8458,19 +8557,19 @@ const Ge = class Ge extends it {
8458
8557
  }
8459
8558
  }
8460
8559
  };
8461
- I(Ge, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
8462
- let Ii = Ge;
8560
+ I(Ve, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
8561
+ let Ii = Ve;
8463
8562
  const Yt = class Yt extends it {
8464
8563
  constructor(t) {
8465
8564
  super(t);
8466
8565
  /** {@link Disposable.onDisposed} */
8467
- I(this, "onDisposed", new D());
8468
- I(this, "onRequestFile", new D());
8566
+ I(this, "onDisposed", new U());
8567
+ I(this, "onRequestFile", new U());
8469
8568
  I(this, "ifcToExport", null);
8470
- I(this, "onElementToPset", new D());
8471
- I(this, "onPropToPset", new D());
8472
- I(this, "onPsetRemoved", new D());
8473
- I(this, "onDataChanged", new D());
8569
+ I(this, "onElementToPset", new U());
8570
+ I(this, "onPropToPset", new U());
8571
+ I(this, "onPsetRemoved", new U());
8572
+ I(this, "onDataChanged", new U());
8474
8573
  I(this, "wasm", {
8475
8574
  path: "/",
8476
8575
  absolute: !1
@@ -8521,11 +8620,11 @@ const Yt = class Yt extends it {
8521
8620
  }
8522
8621
  }
8523
8622
  async newPset(t, e, i) {
8524
- const o = Yt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(e), l = i ? new b[o].IfcText(i) : null, E = new b[o].IfcPropertySet(
8623
+ const o = Yt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(e), c = i ? new b[o].IfcText(i) : null, E = new b[o].IfcPropertySet(
8525
8624
  r,
8526
8625
  n,
8527
8626
  a,
8528
- l,
8627
+ c,
8529
8628
  []
8530
8629
  );
8531
8630
  E.expressID = this.increaseMaxID(t);
@@ -8553,13 +8652,13 @@ const Yt = class Yt extends it {
8553
8652
  }
8554
8653
  }
8555
8654
  async newSingleProperty(t, e, i, o) {
8556
- const n = Yt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o), l = new b[n].IfcPropertySingleValue(
8655
+ const n = Yt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o), c = new b[n].IfcPropertySingleValue(
8557
8656
  r,
8558
8657
  null,
8559
8658
  a,
8560
8659
  null
8561
8660
  );
8562
- return l.expressID = this.increaseMaxID(t), await this.setData(t, l), l;
8661
+ return c.expressID = this.increaseMaxID(t), await this.setData(t, c), c;
8563
8662
  }
8564
8663
  newSingleStringProperty(t, e, i, o) {
8565
8664
  return this.newSingleProperty(t, e, i, o);
@@ -8605,8 +8704,8 @@ const Yt = class Yt extends it {
8605
8704
  }
8606
8705
  async saveToIfc(t, e) {
8607
8706
  const i = this.components.get(Ii), o = i.webIfc, n = await i.readIfcFile(e), r = this._changeMap[t.uuid] ?? [];
8608
- for (const l of r) {
8609
- const E = await t.getProperties(l);
8707
+ for (const c of r) {
8708
+ const E = await t.getProperties(c);
8610
8709
  if (E)
8611
8710
  try {
8612
8711
  o.WriteLine(n, E);
@@ -8614,7 +8713,7 @@ const Yt = class Yt extends it {
8614
8713
  }
8615
8714
  else
8616
8715
  try {
8617
- o.DeleteLine(n, l);
8716
+ o.DeleteLine(n, c);
8618
8717
  } catch {
8619
8718
  }
8620
8719
  }
@@ -8637,15 +8736,15 @@ const Yt = class Yt extends it {
8637
8736
  const a = r.value;
8638
8737
  if (a === void 0 || a == null)
8639
8738
  throw new Error(`Attribute ${i} has a badly defined handle.`);
8640
- const l = new D();
8739
+ const c = new U();
8641
8740
  return Object.defineProperty(n[i], "value", {
8642
8741
  get() {
8643
8742
  return this._value;
8644
8743
  },
8645
8744
  async set(E) {
8646
- this._value = E, l.trigger(E);
8745
+ this._value = E, c.trigger(E);
8647
8746
  }
8648
- }), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = l, l;
8747
+ }), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = c, c;
8649
8748
  }
8650
8749
  };
8651
8750
  I(Yt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
@@ -8657,7 +8756,7 @@ const _s = class _s extends it {
8657
8756
  I(this, "enabled", !0);
8658
8757
  I(this, "_groupSystems", {});
8659
8758
  /** {@link Disposable.onDisposed} */
8660
- I(this, "onDisposed", new D());
8759
+ I(this, "onDisposed", new U());
8661
8760
  I(this, "onFragmentsDisposed", (t) => {
8662
8761
  const { groupID: e, fragmentIDs: i } = t;
8663
8762
  for (const o in this._groupSystems) {
@@ -8666,10 +8765,10 @@ const _s = class _s extends it {
8666
8765
  delete n[e], Object.values(n).length === 0 && delete this._groupSystems[o];
8667
8766
  else
8668
8767
  for (const a of r) {
8669
- const l = n[a];
8768
+ const c = n[a];
8670
8769
  for (const E of i)
8671
- delete l[E];
8672
- Object.values(l).length === 0 && delete n[a];
8770
+ delete c[E];
8771
+ Object.values(c).length === 0 && delete n[a];
8673
8772
  }
8674
8773
  }
8675
8774
  });
@@ -8695,8 +8794,8 @@ const _s = class _s extends it {
8695
8794
  const e = this.components.get(dt);
8696
8795
  if (!t) {
8697
8796
  const r = {};
8698
- for (const [a, l] of e.list)
8699
- r[a] = new Set(l.ids);
8797
+ for (const [a, c] of e.list)
8798
+ r[a] = new Set(c.ids);
8700
8799
  return r;
8701
8800
  }
8702
8801
  const i = Object.keys(t).length, o = {};
@@ -8706,8 +8805,8 @@ const _s = class _s extends it {
8706
8805
  console.warn(`Classification ${r} does not exist.`);
8707
8806
  continue;
8708
8807
  }
8709
- for (const l of a) {
8710
- const E = this._groupSystems[r][l];
8808
+ for (const c of a) {
8809
+ const E = this._groupSystems[r][c];
8711
8810
  if (E)
8712
8811
  for (const d in E) {
8713
8812
  o[d] || (o[d] = /* @__PURE__ */ new Map());
@@ -8721,10 +8820,10 @@ const _s = class _s extends it {
8721
8820
  const n = {};
8722
8821
  for (const r in o) {
8723
8822
  const a = o[r];
8724
- for (const [l, E] of a) {
8823
+ for (const [c, E] of a) {
8725
8824
  if (E === void 0)
8726
8825
  throw new Error("Malformed fragments map!");
8727
- E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(l));
8826
+ E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
8728
8827
  }
8729
8828
  }
8730
8829
  return n;
@@ -8736,8 +8835,8 @@ const _s = class _s extends it {
8736
8835
  const o = i[t];
8737
8836
  for (const [n, r] of e.data) {
8738
8837
  const a = r[0];
8739
- for (const l of a) {
8740
- const E = e.keyFragments.get(l);
8838
+ for (const c of a) {
8839
+ const E = e.keyFragments.get(c);
8741
8840
  E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
8742
8841
  }
8743
8842
  }
@@ -8752,14 +8851,14 @@ const _s = class _s extends it {
8752
8851
  continue;
8753
8852
  const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
8754
8853
  e[a] || (e[a] = {});
8755
- const l = e[a];
8854
+ const c = e[a];
8756
8855
  for (const [E, d] of t.data) {
8757
8856
  const h = d[0];
8758
8857
  for (const u of h) {
8759
8858
  const p = t.keyFragments.get(u);
8760
8859
  if (!p)
8761
8860
  throw new Error("Fragment ID not found!");
8762
- l[p] || (l[p] = /* @__PURE__ */ new Set()), l[p].add(r.expressID);
8861
+ c[p] || (c[p] = /* @__PURE__ */ new Set()), c[p].add(r.expressID);
8763
8862
  }
8764
8863
  }
8765
8864
  }
@@ -8803,8 +8902,8 @@ const _s = class _s extends it {
8803
8902
  for (const r of n[0]) {
8804
8903
  const a = t.keyFragments.get(r);
8805
8904
  if (a) {
8806
- const l = this._groupSystems[e];
8807
- l[i] || (l[i] = {}), l[i][a] || (l[i][a] = /* @__PURE__ */ new Set()), l[i][a].add(o);
8905
+ const c = this._groupSystems[e];
8906
+ c[i] || (c[i] = {}), c[i][a] || (c[i][a] = /* @__PURE__ */ new Set()), c[i][a].add(o);
8808
8907
  }
8809
8908
  }
8810
8909
  }
@@ -8818,7 +8917,7 @@ const ze = class ze extends it {
8818
8917
  I(this, "height", 10);
8819
8918
  I(this, "groupName", "storeys");
8820
8919
  /** {@link Disposable.onDisposed} */
8821
- I(this, "onDisposed", new D());
8920
+ I(this, "onDisposed", new U());
8822
8921
  I(this, "list", /* @__PURE__ */ new Set());
8823
8922
  t.add(ze.uuid, this);
8824
8923
  }
@@ -8835,14 +8934,14 @@ const ze = class ze extends it {
8835
8934
  const t = this.components.get(fi), e = this.components.get(dt), i = this.enabled ? 1 : -1;
8836
8935
  let o = 0;
8837
8936
  const r = t.get()[this.groupName], a = new O.Matrix4();
8838
- for (const l in r) {
8937
+ for (const c in r) {
8839
8938
  a.elements[13] = o * i * this.height;
8840
- for (const E in r[l]) {
8841
- const d = e.list.get(E), h = l + E, u = this.list.has(h);
8939
+ for (const E in r[c]) {
8940
+ const d = e.list.get(E), h = c + E, u = this.list.has(h);
8842
8941
  if (!d || this.enabled && u || !this.enabled && !u)
8843
8942
  continue;
8844
8943
  this.enabled ? this.list.add(h) : this.list.delete(h);
8845
- const p = r[l][E];
8944
+ const p = r[c][E];
8846
8945
  d.applyTransform(p, a);
8847
8946
  }
8848
8947
  o++;
@@ -8891,22 +8990,22 @@ class Yr extends gi {
8891
8990
  I(this, "minAssetsSize", 1e3);
8892
8991
  }
8893
8992
  }
8894
- class Vr extends gi {
8993
+ class Gr extends gi {
8895
8994
  constructor() {
8896
8995
  super(...arguments);
8897
8996
  I(this, "propertiesSize", 100);
8898
8997
  }
8899
8998
  }
8900
- class Gr extends it {
8999
+ class Vr extends it {
8901
9000
  constructor() {
8902
9001
  super(...arguments);
8903
- I(this, "onPropertiesStreamed", new D());
8904
- I(this, "onProgress", new D());
8905
- I(this, "onIndicesStreamed", new D());
9002
+ I(this, "onPropertiesStreamed", new U());
9003
+ I(this, "onProgress", new U());
9004
+ I(this, "onIndicesStreamed", new U());
8906
9005
  /** {@link Disposable.onDisposed} */
8907
- I(this, "onDisposed", new D());
9006
+ I(this, "onDisposed", new U());
8908
9007
  I(this, "enabled", !0);
8909
- I(this, "settings", new Vr());
9008
+ I(this, "settings", new Gr());
8910
9009
  I(this, "webIfc", new b.IfcAPI());
8911
9010
  }
8912
9011
  async dispose() {
@@ -8947,7 +9046,7 @@ class Gr extends it {
8947
9046
  e.add(E);
8948
9047
  let r = 0.01, a = 0;
8949
9048
  for (const E of e) {
8950
- if (a++, Ln.has(E))
9049
+ if (a++, Pn.has(E))
8951
9050
  continue;
8952
9051
  const d = n.has(E), h = this.webIfc.GetLineIDsWithType(0, E), u = h.size();
8953
9052
  let p = 0;
@@ -8981,10 +9080,10 @@ class Gr extends it {
8981
9080
  const R = a / e.size;
8982
9081
  R > r && (r += 0.01, r = Math.max(r, R), await this.onProgress.trigger(Math.round(r * 100) / 100));
8983
9082
  }
8984
- const l = [];
9083
+ const c = [];
8985
9084
  for (const [E, d] of o)
8986
- l.push([E, ...d]);
8987
- await this.onIndicesStreamed.trigger(l);
9085
+ c.push([E, ...d]);
9086
+ await this.onIndicesStreamed.trigger(c);
8988
9087
  }
8989
9088
  getIndices(t, e, i) {
8990
9089
  const o = t.RelatedObjects || t.RelatedElements;
@@ -9003,24 +9102,24 @@ class Gr extends it {
9003
9102
  for (const a of o) {
9004
9103
  if (a.value === void 0 || a.value === null)
9005
9104
  continue;
9006
- const l = a.value;
9007
- i.has(l) || i.set(l, /* @__PURE__ */ new Set()), i.get(l).add(r);
9105
+ const c = a.value;
9106
+ i.has(c) || i.set(c, /* @__PURE__ */ new Set()), i.get(c).add(r);
9008
9107
  }
9009
9108
  }
9010
9109
  cleanUp() {
9011
9110
  this.webIfc = null, this.webIfc = new b.IfcAPI();
9012
9111
  }
9013
9112
  }
9014
- I(Gr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
9015
- const Ps = class Ps extends it {
9113
+ I(Vr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
9114
+ const ys = class ys extends it {
9016
9115
  constructor(t) {
9017
9116
  super(t);
9018
- I(this, "onGeometryStreamed", new D());
9019
- I(this, "onAssetStreamed", new D());
9020
- I(this, "onProgress", new D());
9021
- I(this, "onIfcLoaded", new D());
9117
+ I(this, "onGeometryStreamed", new U());
9118
+ I(this, "onAssetStreamed", new U());
9119
+ I(this, "onProgress", new U());
9120
+ I(this, "onIfcLoaded", new U());
9022
9121
  /** {@link Disposable.onDisposed} */
9023
- I(this, "onDisposed", new D());
9122
+ I(this, "onDisposed", new U());
9024
9123
  I(this, "settings", new Yr());
9025
9124
  I(this, "enabled", !0);
9026
9125
  I(this, "webIfc", new b.IfcAPI());
@@ -9034,7 +9133,7 @@ const Ps = class Ps extends it {
9034
9133
  I(this, "_groupSerializer", new $t.Serializer());
9035
9134
  I(this, "_assets", []);
9036
9135
  I(this, "_meshesWithHoles", /* @__PURE__ */ new Set());
9037
- this.components.add(Ps.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
9136
+ this.components.add(ys.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
9038
9137
  }
9039
9138
  dispose() {
9040
9139
  this.onIfcLoaded.reset(), this.onGeometryStreamed.reset(), this.onAssetStreamed.reset(), this.webIfc = null, this.onDisposed.trigger(), this.onDisposed.reset();
@@ -9065,19 +9164,19 @@ const Ps = class Ps extends it {
9065
9164
  schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
9066
9165
  maxExpressID: this.webIfc.GetMaxExpressID(0)
9067
9166
  };
9068
- let l = 0, E = 0;
9167
+ let c = 0, E = 0;
9069
9168
  for (const T of i) {
9070
9169
  if (!this.webIfc.IsIfcElement(T) && T !== b.IFCSPACE || this.settings.excludedCategories.has(T))
9071
9170
  continue;
9072
9171
  const F = this.webIfc.GetLineIDsWithType(0, T), f = F.size();
9073
9172
  for (let m = 0; m < f; m++) {
9074
- l > t && (l = 0, E++, o.push([]));
9173
+ c > t && (c = 0, E++, o.push([]));
9075
9174
  const g = F.get(m);
9076
9175
  if (g !== 9056429)
9077
9176
  continue;
9078
9177
  o[E].push(g);
9079
9178
  const S = this._spatialTree.itemsByFloor[g] || 0;
9080
- n.data.set(g, [[], [S, T]]), l++;
9179
+ n.data.set(g, [[], [S, T]]), c++;
9081
9180
  }
9082
9181
  }
9083
9182
  this._spatialTree.cleanUp();
@@ -9109,7 +9208,7 @@ const Ps = class Ps extends it {
9109
9208
  getMesh(t, e, i) {
9110
9209
  const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
9111
9210
  for (let a = 0; a < o; a++) {
9112
- const l = e.geometries.get(a), E = l.geometryExpressID, d = l.color.w === 1 ? 1 : -1, h = E * d;
9211
+ const c = e.geometries.get(a), E = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, h = E * d;
9113
9212
  if (!this._visitedGeometries.has(h)) {
9114
9213
  this._visitedGeometries.has(E) || this.getGeometry(t, E);
9115
9214
  const m = this._visitedGeometries.size, g = O.MathUtils.generateUUID();
@@ -9122,7 +9221,7 @@ const Ps = class Ps extends it {
9122
9221
  if (!p)
9123
9222
  throw new Error("Data not found!");
9124
9223
  p[0].push(u.index);
9125
- const { x: R, y: A, z: C, w: T } = l.color, F = [R, A, C, T], f = l.flatTransformation;
9224
+ const { x: R, y: A, z: C, w: T } = c.color, F = [R, A, C, T], f = c.flatTransformation;
9126
9225
  r.geometries.push({ color: F, geometryID: E, transformation: f });
9127
9226
  }
9128
9227
  this._assets.push(r);
@@ -9137,7 +9236,7 @@ const Ps = class Ps extends it {
9137
9236
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
9138
9237
  for (let u = 0; u < n.length; u += 6)
9139
9238
  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];
9140
- const l = dr(r), E = new Float32Array(l.transformation.elements), d = [l.center.x, l.center.y, l.center.z];
9239
+ const c = dr(r), E = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
9141
9240
  let h = !1;
9142
9241
  for (let u = 0; u < r.length - 2; u += 3) {
9143
9242
  const p = r[u], R = r[u + 1], A = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
@@ -9164,8 +9263,8 @@ const Ps = class Ps extends it {
9164
9263
  this.onGeometryStreamed.trigger({ data: e, buffer: t }), e = null, t = null, this._geometries.clear(), this._geometryCount = 0;
9165
9264
  }
9166
9265
  };
9167
- I(Ps, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
9168
- let Rn = Ps;
9266
+ I(ys, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
9267
+ let Rn = ys;
9169
9268
  class zr {
9170
9269
  constructor(s) {
9171
9270
  /** {@link NavigationMode.enabled} */
@@ -9241,7 +9340,7 @@ class Wr {
9241
9340
  /**
9242
9341
  * Event that fires when the {@link CameraProjection} changes.
9243
9342
  */
9244
- I(this, "onChanged", new D());
9343
+ I(this, "onChanged", new U());
9245
9344
  I(this, "current", "Perspective");
9246
9345
  I(this, "camera");
9247
9346
  I(this, "_component");
@@ -9285,8 +9384,8 @@ class Wr {
9285
9384
  this._component.three.getWorldDirection(t);
9286
9385
  const e = new O.Vector3();
9287
9386
  this._component.controls.getTarget(e);
9288
- const o = e.clone().sub(this._component.three.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.three, l = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
9289
- return { width: l * r, height: l };
9387
+ const o = e.clone().sub(this._component.three.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.three, c = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
9388
+ return { width: c * r, height: c };
9290
9389
  }
9291
9390
  setupOrthoCamera(s, t) {
9292
9391
  this._component.controls.mouseButtons.wheel = ot.ACTION.ZOOM, this._component.controls.mouseButtons.middle = ot.ACTION.ZOOM;
@@ -9351,11 +9450,11 @@ class ta extends We {
9351
9450
  const p = new O.Box3().setFromObject(u);
9352
9451
  p.min.x < n.x && (n.x = p.min.x), p.min.y < n.y && (n.y = p.min.y), p.min.z < n.z && (n.z = p.min.z), p.max.x > r.x && (r.x = p.max.x), p.max.y > r.y && (r.y = p.max.y), p.max.z > r.z && (r.z = p.max.z);
9353
9452
  }
9354
- const a = new O.Box3(n, r), l = new O.Vector3();
9355
- a.getSize(l);
9453
+ const a = new O.Box3(n, r), c = new O.Vector3();
9454
+ a.getSize(c);
9356
9455
  const E = new O.Vector3();
9357
9456
  a.getCenter(E);
9358
- const d = Math.max(l.x, l.y, l.z) * e, h = new O.Sphere(E, d);
9457
+ const d = Math.max(c.x, c.y, c.z) * e, h = new O.Sphere(E, d);
9359
9458
  await this.controls.fitToSphere(h, !0);
9360
9459
  }
9361
9460
  /**
@@ -9408,19 +9507,19 @@ class ea {
9408
9507
  }
9409
9508
  }
9410
9509
  let a = 0;
9411
- const l = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
9510
+ const c = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
9412
9511
  for (const { index: d, edges: h } of r) {
9413
9512
  const u = /* @__PURE__ */ new Map();
9414
9513
  for (const { id: f } of h)
9415
- if (l.has(f)) {
9416
- const m = l.get(f);
9514
+ if (c.has(f)) {
9515
+ const m = c.get(f);
9417
9516
  u.set(f, m);
9418
9517
  }
9419
9518
  const p = h.map((f) => f.id);
9420
9519
  if (!u.size) {
9421
9520
  const f = a++;
9422
9521
  for (const { id: m } of h)
9423
- l.set(m, f);
9522
+ c.set(m, f);
9424
9523
  E.set(f, {
9425
9524
  edges: new Set(p),
9426
9525
  indices: /* @__PURE__ */ new Set([d])
@@ -9430,7 +9529,7 @@ class ea {
9430
9529
  let R = null;
9431
9530
  const A = /* @__PURE__ */ new Set(), C = new Set(p);
9432
9531
  for (const [f, m] of u) {
9433
- R === null ? R = m : m !== R && A.add(m), l.delete(f);
9532
+ R === null ? R = m : m !== R && A.add(m), c.delete(f);
9434
9533
  const { edges: g } = E.get(m);
9435
9534
  g.delete(f), C.delete(f);
9436
9535
  }
@@ -9439,16 +9538,16 @@ class ea {
9439
9538
  const T = E.get(R), { indices: F } = T;
9440
9539
  F.add(d);
9441
9540
  for (const f of C) {
9442
- l.set(f, R);
9541
+ c.set(f, R);
9443
9542
  const { edges: m } = T;
9444
9543
  m.add(f);
9445
9544
  }
9446
9545
  for (const f of A) {
9447
- const m = E.get(f), { edges: g, indices: S } = m, _ = E.get(R), { edges: N, indices: y } = _;
9546
+ const m = E.get(f), { edges: g, indices: S } = m, _ = E.get(R), { edges: N, indices: L } = _;
9448
9547
  for (const w of g)
9449
- N.add(w), l.set(w, R);
9548
+ N.add(w), c.set(w, R);
9450
9549
  for (const w of S)
9451
- y.add(w);
9550
+ L.add(w);
9452
9551
  E.delete(f);
9453
9552
  }
9454
9553
  }
@@ -9470,17 +9569,17 @@ class ea {
9470
9569
  static getFaceData(s, t, e) {
9471
9570
  const i = this.getVerticesAndNormal(e, s, t), { p1: o, p2: n, p3: r, faceNormal: a } = i;
9472
9571
  this.round(o), this.round(n), this.round(r), this.round(a);
9473
- const l = [
9572
+ const c = [
9474
9573
  { id: `${o.x}|${o.y}|${o.z}`, value: o },
9475
9574
  { id: `${n.x}|${n.y}|${n.z}`, value: n },
9476
9575
  { id: `${r.x}|${r.y}|${r.z}`, value: r }
9477
9576
  ];
9478
- l.sort((T, F) => T.id < F.id ? -1 : T.id > F.id ? 1 : 0);
9577
+ c.sort((T, F) => T.id < F.id ? -1 : T.id > F.id ? 1 : 0);
9479
9578
  const [
9480
9579
  { id: E, value: d },
9481
9580
  { id: h, value: u },
9482
9581
  { id: p, value: R }
9483
- ] = l, A = [
9582
+ ] = c, A = [
9484
9583
  {
9485
9584
  id: `${E}|${h}`,
9486
9585
  distance: d.distanceTo(u),
@@ -9502,7 +9601,7 @@ class ea {
9502
9601
  static getVerticesAndNormal(s, t, e) {
9503
9602
  if (!s.geometry.index)
9504
9603
  throw new Error("Geometry must be indexed!");
9505
- const i = s.geometry.index.array, o = s.geometry.attributes.position.array, n = s.geometry.attributes.normal.array, r = i[t * 3] * 3, a = i[t * 3 + 1] * 3, l = i[t * 3 + 2] * 3, E = new O.Vector3(o[r], o[r + 1], o[r + 2]), d = new O.Vector3(o[a], o[a + 1], o[a + 2]), h = new O.Vector3(o[l], o[l + 1], o[l + 2]), u = new O.Vector3(n[r], n[r + 1], n[r + 2]), p = new O.Vector3(n[a], n[a + 1], n[a + 2]), R = new O.Vector3(n[l], n[l + 1], n[l + 2]), A = (u.x + p.x + R.x) / 3, C = (u.y + p.y + R.y) / 3, T = (u.z + p.z + R.z) / 3, F = new O.Vector3(A, C, T);
9604
+ const i = s.geometry.index.array, o = s.geometry.attributes.position.array, n = s.geometry.attributes.normal.array, r = i[t * 3] * 3, a = i[t * 3 + 1] * 3, c = i[t * 3 + 2] * 3, E = new O.Vector3(o[r], o[r + 1], o[r + 2]), d = new O.Vector3(o[a], o[a + 1], o[a + 2]), h = new O.Vector3(o[c], o[c + 1], o[c + 2]), u = new O.Vector3(n[r], n[r + 1], n[r + 2]), p = new O.Vector3(n[a], n[a + 1], n[a + 2]), R = new O.Vector3(n[c], n[c + 1], n[c + 2]), A = (u.x + p.x + R.x) / 3, C = (u.y + p.y + R.y) / 3, T = (u.z + p.z + R.z) / 3, F = new O.Vector3(A, C, T);
9506
9605
  if (!F.x && !F.y && !F.z && console.log("hey"), e !== void 0 && s instanceof O.InstancedMesh) {
9507
9606
  const f = new O.Matrix4();
9508
9607
  s.getMatrixAt(e, f);
@@ -9528,7 +9627,7 @@ export {
9528
9627
  Ur as CullerRenderer,
9529
9628
  ui as Cullers,
9530
9629
  zt as Disposer,
9531
- D as Event,
9630
+ U as Event,
9532
9631
  zr as FirstPersonMode,
9533
9632
  fn as FragmentBoundingBox,
9534
9633
  fi as FragmentClassifier,
@@ -9537,16 +9636,16 @@ export {
9537
9636
  Ii as FragmentIfcLoader,
9538
9637
  Rn as FragmentIfcStreamConverter,
9539
9638
  dt as FragmentManager,
9540
- Gr as FragmentPropsStreamConverter,
9639
+ Vr as FragmentPropsStreamConverter,
9541
9640
  Fr as Grids,
9542
9641
  Kr as IfcCategories,
9543
9642
  Mn as IfcCategoryMap,
9544
9643
  vr as IfcElements,
9545
9644
  br as IfcJsonExporter,
9546
9645
  Jr as IfcPropertiesFinder,
9547
- pn as IfcPropertiesIndexer,
9548
9646
  Cn as IfcPropertiesManager,
9549
9647
  Ft as IfcPropertiesUtils,
9648
+ pn as IfcRelationsIndexer,
9550
9649
  Yr as IfcStreamingSettings,
9551
9650
  In as Materials,
9552
9651
  qi as MaterialsUtils,
@@ -9556,7 +9655,7 @@ export {
9556
9655
  ta as OrthoPerspectiveCamera,
9557
9656
  kr as PlanMode,
9558
9657
  Wr as ProjectionManager,
9559
- Vr as PropertiesStreamingSettings,
9658
+ Gr as PropertiesStreamingSettings,
9560
9659
  ke as Raycasters,
9561
9660
  We as SimpleCamera,
9562
9661
  Fi as SimplePlane,