@maqiuyao/dxf-viewer 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ import { OBJExporter as ml } from "three/examples/jsm/exporters/OBJExporter.js";
12
12
  import { STLExporter as gl } from "three/examples/jsm/exporters/STLExporter.js";
13
13
  import { extrudePolylines as yl } from "poly-extrude";
14
14
  import xl from "i18next";
15
- import { mergeGeometries as Ee } from "three/examples/jsm/utils/BufferGeometryUtils.js";
15
+ import { mergeGeometries as Oe } from "three/examples/jsm/utils/BufferGeometryUtils.js";
16
16
  import { Earcut as bl } from "three/src/extras/Earcut.js";
17
17
  import wl from "2d-polygon-self-intersections";
18
18
  import { SimplifyModifier as vl } from "three/examples/jsm/modifiers/SimplifyModifier.js";
@@ -104,7 +104,7 @@ function ws(c, t, e, i, s, n, r) {
104
104
  object: c
105
105
  }), !0);
106
106
  }
107
- const w0 = p.Line, bo = 0, Ql = 1, ec = 2, Dr = 2, Sn = 1.25, Lr = 1, Oe = 32, xe = Oe / 4, wo = 65535, en = Math.pow(2, -24), Mr = /* @__PURE__ */ Symbol("SKIP_GENERATION"), vo = {
107
+ const w0 = p.Line, bo = 0, Ql = 1, ec = 2, Dr = 2, Sn = 1.25, Lr = 1, _e = 32, xe = _e / 4, wo = 65535, en = Math.pow(2, -24), Mr = /* @__PURE__ */ Symbol("SKIP_GENERATION"), vo = {
108
108
  strategy: bo,
109
109
  maxDepth: 40,
110
110
  targetLeafSize: 10,
@@ -150,10 +150,10 @@ function Wi(c) {
150
150
  function he(c, t) {
151
151
  return t[c + 15] === wo;
152
152
  }
153
- function Te(c, t) {
153
+ function Ce(c, t) {
154
154
  return t[c + 6];
155
155
  }
156
- function _e(c, t) {
156
+ function Pe(c, t) {
157
157
  return t[c + 14];
158
158
  }
159
159
  function be(c) {
@@ -170,8 +170,8 @@ function En(c, t, e, i, s) {
170
170
  let n = 1 / 0, r = 1 / 0, a = 1 / 0, o = -1 / 0, l = -1 / 0, h = -1 / 0, d = 1 / 0, u = 1 / 0, f = 1 / 0, m = -1 / 0, b = -1 / 0, y = -1 / 0;
171
171
  const C = c.offset || 0;
172
172
  for (let w = (t - C) * 6, x = (t + e - C) * 6; w < x; w += 6) {
173
- const E = c[w + 0], M = c[w + 1], O = E - M, S = E + M;
174
- O < n && (n = O), S > o && (o = S), E < d && (d = E), E > m && (m = E);
173
+ const S = c[w + 0], M = c[w + 1], O = S - M, E = S + M;
174
+ O < n && (n = O), E > o && (o = E), S < d && (d = S), S > m && (m = S);
175
175
  const v = c[w + 2], T = c[w + 3], _ = v - T, A = v + T;
176
176
  _ < r && (r = _), A > l && (l = A), v < u && (u = v), v > b && (b = v);
177
177
  const I = c[w + 4], B = c[w + 5], k = I - B, D = I + B;
@@ -206,61 +206,61 @@ function ic(c, t, e, i, s, n) {
206
206
  const O = w[x];
207
207
  O.candidate = e[M + 2 * f], O.count = 0;
208
208
  const {
209
- bounds: S,
209
+ bounds: E,
210
210
  leftCacheBounds: v,
211
211
  rightCacheBounds: T
212
212
  } = O;
213
213
  for (let _ = 0; _ < 3; _++)
214
- T[_] = 1 / 0, T[_ + 3] = -1 / 0, v[_] = 1 / 0, v[_ + 3] = -1 / 0, S[_] = 1 / 0, S[_ + 3] = -1 / 0;
215
- vs(M, e, S);
214
+ T[_] = 1 / 0, T[_ + 3] = -1 / 0, v[_] = 1 / 0, v[_ + 3] = -1 / 0, E[_] = 1 / 0, E[_ + 3] = -1 / 0;
215
+ vs(M, e, E);
216
216
  }
217
217
  w.sort(tc);
218
- let E = s;
219
- for (let M = 0; M < E; M++) {
218
+ let S = s;
219
+ for (let M = 0; M < S; M++) {
220
220
  const O = w[M];
221
- for (; M + 1 < E && w[M + 1].candidate === O.candidate; )
222
- w.splice(M + 1, 1), E--;
221
+ for (; M + 1 < S && w[M + 1].candidate === O.candidate; )
222
+ w.splice(M + 1, 1), S--;
223
223
  }
224
224
  for (let M = d; M < u; M += 6) {
225
225
  const O = e[M + 2 * f];
226
- for (let S = 0; S < E; S++) {
227
- const v = w[S];
226
+ for (let E = 0; E < S; E++) {
227
+ const v = w[E];
228
228
  O >= v.candidate ? vs(M, e, v.rightCacheBounds) : (vs(M, e, v.leftCacheBounds), v.count++);
229
229
  }
230
230
  }
231
- for (let M = 0; M < E; M++) {
232
- const O = w[M], S = O.count, v = s - O.count, T = O.leftCacheBounds, _ = O.rightCacheBounds;
231
+ for (let M = 0; M < S; M++) {
232
+ const O = w[M], E = O.count, v = s - O.count, T = O.leftCacheBounds, _ = O.rightCacheBounds;
233
233
  let A = 0;
234
- S !== 0 && (A = Wi(T) / o);
234
+ E !== 0 && (A = Wi(T) / o);
235
235
  let I = 0;
236
236
  v !== 0 && (I = Wi(_) / o);
237
- const B = Lr + Sn * (A * S + I * v);
237
+ const B = Lr + Sn * (A * E + I * v);
238
238
  B < l && (r = f, l = B, a = O.candidate);
239
239
  }
240
240
  } else {
241
- for (let E = 0; E < vt; E++) {
242
- const M = It[E];
243
- M.count = 0, M.candidate = m + C + E * C;
241
+ for (let S = 0; S < vt; S++) {
242
+ const M = It[S];
243
+ M.count = 0, M.candidate = m + C + S * C;
244
244
  const O = M.bounds;
245
- for (let S = 0; S < 3; S++)
246
- O[S] = 1 / 0, O[S + 3] = -1 / 0;
245
+ for (let E = 0; E < 3; E++)
246
+ O[E] = 1 / 0, O[E + 3] = -1 / 0;
247
247
  }
248
- for (let E = d; E < u; E += 6) {
249
- let S = ~~((e[E + 2 * f] - m) / C);
250
- S >= vt && (S = vt - 1);
251
- const v = It[S];
252
- v.count++, vs(E, e, v.bounds);
248
+ for (let S = d; S < u; S += 6) {
249
+ let E = ~~((e[S + 2 * f] - m) / C);
250
+ E >= vt && (E = vt - 1);
251
+ const v = It[E];
252
+ v.count++, vs(S, e, v.bounds);
253
253
  }
254
254
  const w = It[vt - 1];
255
255
  Rr(w.bounds, w.rightCacheBounds);
256
- for (let E = vt - 2; E >= 0; E--) {
257
- const M = It[E], O = It[E + 1];
256
+ for (let S = vt - 2; S >= 0; S--) {
257
+ const M = It[S], O = It[S + 1];
258
258
  Fr(M.bounds, O.rightCacheBounds, M.rightCacheBounds);
259
259
  }
260
260
  let x = 0;
261
- for (let E = 0; E < vt - 1; E++) {
262
- const M = It[E], O = M.count, S = M.bounds, T = It[E + 1].rightCacheBounds;
263
- O !== 0 && (x === 0 ? Rr(S, Ms) : Fr(S, Ms, Ms)), x += O;
261
+ for (let S = 0; S < vt - 1; S++) {
262
+ const M = It[S], O = M.count, E = M.bounds, T = It[S + 1].rightCacheBounds;
263
+ O !== 0 && (x === 0 ? Rr(E, Ms) : Fr(E, Ms, Ms)), x += O;
264
264
  let _ = 0, A = 0;
265
265
  x !== 0 && (_ = Wi(Ms) / o);
266
266
  const I = s - x;
@@ -321,11 +321,11 @@ function dr(c, t) {
321
321
  for (let r = 0; r < 6; r++)
322
322
  Mo[e + r] = n[r];
323
323
  if (s)
324
- return t.buffer ? (To.set(new Uint8Array(t.buffer), c), c + t.buffer.byteLength) : (tn[e + 6] = t.offset, cr[i + 14] = t.count, cr[i + 15] = wo, c + Oe);
324
+ return t.buffer ? (To.set(new Uint8Array(t.buffer), c), c + t.buffer.byteLength) : (tn[e + 6] = t.offset, cr[i + 14] = t.count, cr[i + 15] = wo, c + _e);
325
325
  {
326
- const { left: r, right: a, splitAxis: o } = t, l = c + Oe;
326
+ const { left: r, right: a, splitAxis: o } = t, l = c + _e;
327
327
  let h = dr(l, r);
328
- const d = c / Oe, f = h / Oe - d;
328
+ const d = c / _e, f = h / _e - d;
329
329
  if (f > rc)
330
330
  throw new Error("MeshBVH: Cannot store relative child node offset greater than 32 bits.");
331
331
  return tn[e + 6] = f, tn[e + 7] = o, dr(h, a);
@@ -346,23 +346,23 @@ function oc(c, t, e, i, s, n) {
346
346
  function C(x) {
347
347
  d && d((x - n.offset) / n.count);
348
348
  }
349
- function w(x, E, M, O = null, S = 0) {
350
- !b && S >= r && (b = !0, a && console.warn(`BVH: Max depth of ${r} reached when generating BVH. Consider increasing maxDepth.`));
349
+ function w(x, S, M, O = null, E = 0) {
350
+ !b && E >= r && (b = !0, a && console.warn(`BVH: Max depth of ${r} reached when generating BVH. Consider increasing maxDepth.`));
351
351
  const v = M > l;
352
- if (M <= o && !v || S >= r)
353
- return C(E + M), x.offset = E, x.count = M, x;
354
- const T = ic(x.boundingData, O, t, E, M, h);
355
- let _ = T.axis === -1 ? -1 : nc(u, f, t, E, M, T);
356
- if (T.axis === -1 || _ === E || _ === E + M) {
352
+ if (M <= o && !v || E >= r)
353
+ return C(S + M), x.offset = S, x.count = M, x;
354
+ const T = ic(x.boundingData, O, t, S, M, h);
355
+ let _ = T.axis === -1 ? -1 : nc(u, f, t, S, M, T);
356
+ if (T.axis === -1 || _ === S || _ === S + M) {
357
357
  if (!v)
358
- return C(E + M), x.offset = E, x.count = M, x;
359
- T.axis = Math.max(0, lr(x.boundingData)), _ = E + Math.max(1, Math.floor(M / 2));
358
+ return C(S + M), x.offset = S, x.count = M, x;
359
+ T.axis = Math.max(0, lr(x.boundingData)), _ = S + Math.max(1, Math.floor(M / 2));
360
360
  }
361
361
  x.splitAxis = T.axis;
362
- const A = new On(), I = E, B = _ - E;
363
- x.left = A, En(t, I, B, A.boundingData, m), w(A, I, B, m, S + 1);
362
+ const A = new On(), I = S, B = _ - S;
363
+ x.left = A, En(t, I, B, A.boundingData, m), w(A, I, B, m, E + 1);
364
364
  const k = new On(), D = _, R = M - B;
365
- return x.right = k, En(t, D, R, k.boundingData, m), w(k, D, R, m, S + 1), x;
365
+ return x.right = k, En(t, D, R, k.boundingData, m), w(k, D, R, m, E + 1), x;
366
366
  }
367
367
  }
368
368
  function lc(c, t) {
@@ -371,7 +371,7 @@ function lc(c, t) {
371
371
  count: n.offset + n.count - s.offset
372
372
  }, a = new Float32Array(6 * r.count);
373
373
  a.offset = r.offset, c.computePrimitiveBounds(r.offset, r.count, a), c._roots = i.map((o) => {
374
- const l = oc(c, a, o.offset, o.count, t, r), h = hr(l), d = new e(Oe * h);
374
+ const l = oc(c, a, o.offset, o.count, t, r), h = hr(l), d = new e(_e * h);
375
375
  return ac(0, l, d), d;
376
376
  });
377
377
  }
@@ -413,7 +413,7 @@ function ur(c, t, e, i, s = null, n = 0, r = 0) {
413
413
  const { float32Array: a, uint16Array: o, uint32Array: l } = ne;
414
414
  let h = c * 2;
415
415
  if (he(h, o)) {
416
- const u = Te(c, l), f = _e(h, o);
416
+ const u = Ce(c, l), f = Pe(h, o);
417
417
  return le(c, a, Ut), i(u, f, !1, r, n + c / xe, Ut);
418
418
  } else {
419
419
  let _ = function(I) {
@@ -421,13 +421,13 @@ function ur(c, t, e, i, s = null, n = 0, r = 0) {
421
421
  let D = I * 2;
422
422
  for (; !he(D, B); )
423
423
  I = be(I), D = I * 2;
424
- return Te(I, k);
424
+ return Ce(I, k);
425
425
  }, A = function(I) {
426
426
  const { uint16Array: B, uint32Array: k } = ne;
427
427
  let D = I * 2;
428
428
  for (; !he(D, B); )
429
429
  I = we(I, k), D = I * 2;
430
- return Te(I, k) + _e(D, B);
430
+ return Ce(I, k) + Pe(D, B);
431
431
  };
432
432
  const u = be(c), f = we(c, l);
433
433
  let m = u, b = f, y, C, w, x;
@@ -437,7 +437,7 @@ function ur(c, t, e, i, s = null, n = 0, r = 0) {
437
437
  y = C, C = I, w = x;
438
438
  }
439
439
  w || (w = Ut, le(m, a, w));
440
- const E = he(m * 2, o), M = e(w, E, y, r + 1, n + m / xe);
440
+ const S = he(m * 2, o), M = e(w, S, y, r + 1, n + m / xe);
441
441
  let O;
442
442
  if (M === Dr) {
443
443
  const I = _(m), k = A(m) - I;
@@ -454,7 +454,7 @@ function ur(c, t, e, i, s = null, n = 0, r = 0) {
454
454
  );
455
455
  if (O) return !0;
456
456
  x = ki, le(b, a, x);
457
- const S = he(b * 2, o), v = e(x, S, C, r + 1, n + b / xe);
457
+ const E = he(b * 2, o), v = e(x, E, C, r + 1, n + b / xe);
458
458
  let T;
459
459
  if (v === Dr) {
460
460
  const I = _(b), k = A(b) - I;
@@ -496,9 +496,9 @@ function dc(c, t, e, i) {
496
496
  0,
497
497
  0,
498
498
  u
499
- ), ln.clearBuffer(), o += n[f].byteLength / Oe, !r); f++)
499
+ ), ln.clearBuffer(), o += n[f].byteLength / _e, !r); f++)
500
500
  ;
501
- if (Lt.releasePrimitive(u), ls.clearBuffer(), a += s[h].byteLength / Oe, r)
501
+ if (Lt.releasePrimitive(u), ls.clearBuffer(), a += s[h].byteLength / _e, r)
502
502
  break;
503
503
  }
504
504
  return An = !1, r;
@@ -506,23 +506,23 @@ function dc(c, t, e, i) {
506
506
  function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
507
507
  let d, u;
508
508
  h ? (d = ln, u = ls) : (d = ls, u = ln);
509
- const f = d.float32Array, m = d.uint32Array, b = d.uint16Array, y = u.float32Array, C = u.uint32Array, w = u.uint16Array, x = c * 2, E = t * 2, M = he(x, b), O = he(E, w);
510
- let S = !1;
509
+ const f = d.float32Array, m = d.uint32Array, b = d.uint16Array, y = u.float32Array, C = u.uint32Array, w = u.uint16Array, x = c * 2, S = t * 2, M = he(x, b), O = he(S, w);
510
+ let E = !1;
511
511
  if (O && M)
512
- h ? S = s(
513
- Te(t, C),
514
- _e(t * 2, w),
515
- Te(c, m),
516
- _e(c * 2, b),
512
+ h ? E = s(
513
+ Ce(t, C),
514
+ Pe(t * 2, w),
515
+ Ce(c, m),
516
+ Pe(c * 2, b),
517
517
  o,
518
518
  r + t / xe,
519
519
  a,
520
520
  n + c / xe
521
- ) : S = s(
522
- Te(c, m),
523
- _e(c * 2, b),
524
- Te(t, C),
525
- _e(t * 2, w),
521
+ ) : E = s(
522
+ Ce(c, m),
523
+ Pe(c * 2, b),
524
+ Ce(t, C),
525
+ Pe(t * 2, w),
526
526
  a,
527
527
  n + c / xe,
528
528
  o,
@@ -534,7 +534,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
534
534
  const T = be(c), _ = we(c, m);
535
535
  le(T, f, ui), le(_, f, fi);
536
536
  const A = v.intersectsBox(ui), I = v.intersectsBox(fi);
537
- S = A && st(
537
+ E = A && st(
538
538
  t,
539
539
  T,
540
540
  i,
@@ -564,7 +564,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
564
564
  le(v, y, _n), le(T, y, Pn);
565
565
  const _ = l.intersectsBox(_n), A = l.intersectsBox(Pn);
566
566
  if (_ && A)
567
- S = st(
567
+ E = st(
568
568
  c,
569
569
  v,
570
570
  e,
@@ -591,7 +591,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
591
591
  );
592
592
  else if (_)
593
593
  if (M)
594
- S = st(
594
+ E = st(
595
595
  c,
596
596
  v,
597
597
  e,
@@ -610,7 +610,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
610
610
  const B = be(c), k = we(c, m);
611
611
  le(B, f, ui), le(k, f, fi);
612
612
  const D = I.intersectsBox(ui), R = I.intersectsBox(fi);
613
- S = D && st(
613
+ E = D && st(
614
614
  v,
615
615
  B,
616
616
  i,
@@ -638,7 +638,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
638
638
  }
639
639
  else if (A)
640
640
  if (M)
641
- S = st(
641
+ E = st(
642
642
  c,
643
643
  T,
644
644
  e,
@@ -657,7 +657,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
657
657
  const B = be(c), k = we(c, m);
658
658
  le(B, f, ui), le(k, f, fi);
659
659
  const D = I.intersectsBox(ui), R = I.intersectsBox(fi);
660
- S = D && st(
660
+ E = D && st(
661
661
  T,
662
662
  B,
663
663
  i,
@@ -684,7 +684,7 @@ function st(c, t, e, i, s, n = 0, r = 0, a = 0, o = 0, l = null, h = !1) {
684
684
  ), Lt.releasePrimitive(I);
685
685
  }
686
686
  }
687
- return S;
687
+ return E;
688
688
  }
689
689
  const In = new class {
690
690
  constructor() {
@@ -699,12 +699,12 @@ const In = new class {
699
699
  let r = n * 2;
700
700
  for (; !he(r, e); )
701
701
  n = be(n), r = n * 2;
702
- return Te(n, t);
702
+ return Ce(n, t);
703
703
  }, this.getRangeEnd = (n) => {
704
704
  let r = n * 2;
705
705
  for (; !he(r, e); )
706
706
  n = we(n, t), r = n * 2;
707
- return Te(n, t) + _e(r, e);
707
+ return Ce(n, t) + Pe(r, e);
708
708
  };
709
709
  const s = (n, r, a) => {
710
710
  const o = r * 2, l = he(o, e);
@@ -789,7 +789,7 @@ class uc {
789
789
  else {
790
790
  const i = this._roots;
791
791
  for (let s = 0; s < i.length; s++) {
792
- const n = i[s], r = new Uint32Array(n), a = new Uint16Array(n), o = n.byteLength / Oe;
792
+ const n = i[s], r = new Uint32Array(n), a = new Uint16Array(n), o = n.byteLength / _e;
793
793
  for (let l = 0; l < o; l++) {
794
794
  const h = xe * l, d = 2 * h;
795
795
  he(d, a) && (r[h + 6] += t);
@@ -817,11 +817,11 @@ class uc {
817
817
  refit() {
818
818
  const t = this._roots;
819
819
  for (let e = 0, i = t.length; e < i; e++) {
820
- const s = t[e], n = new Uint32Array(s), r = new Uint16Array(s), a = new Float32Array(s), o = s.byteLength / Oe;
820
+ const s = t[e], n = new Uint32Array(s), r = new Uint16Array(s), a = new Float32Array(s), o = s.byteLength / _e;
821
821
  for (let l = o - 1; l >= 0; l--) {
822
822
  const h = l * xe, d = h * 2;
823
823
  if (he(d, r)) {
824
- const f = Te(h, n), m = _e(d, r);
824
+ const f = Ce(h, n), m = Pe(d, r);
825
825
  this.writePrimitiveRangeBounds(f, m, pi, 0), a.set(pi, h);
826
826
  } else {
827
827
  const f = be(h), m = we(h, n);
@@ -877,7 +877,7 @@ class uc {
877
877
  const f = h[d];
878
878
  if (o = hc(this, d, i, s, e, l), o)
879
879
  break;
880
- l += f.byteLength / Oe;
880
+ l += f.byteLength / _e;
881
881
  }
882
882
  return o;
883
883
  }
@@ -1144,87 +1144,87 @@ lt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
1144
1144
  })();
1145
1145
  lt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
1146
1146
  const c = /* @__PURE__ */ new lt(), t = /* @__PURE__ */ new Pt(), e = /* @__PURE__ */ new Pt(), i = /* @__PURE__ */ new G(), s = /* @__PURE__ */ new G(), n = /* @__PURE__ */ new G(), r = /* @__PURE__ */ new G(), a = /* @__PURE__ */ new _t(), o = /* @__PURE__ */ new _t(), l = /* @__PURE__ */ new G(), h = /* @__PURE__ */ new jt(), d = /* @__PURE__ */ new jt();
1147
- function u(x, E, M, O) {
1148
- const S = i;
1149
- !x.isDegenerateIntoPoint && !x.isDegenerateIntoSegment ? S.copy(x.plane.normal) : S.copy(E.plane.normal);
1147
+ function u(x, S, M, O) {
1148
+ const E = i;
1149
+ !x.isDegenerateIntoPoint && !x.isDegenerateIntoSegment ? E.copy(x.plane.normal) : E.copy(S.plane.normal);
1150
1150
  const v = x.satBounds, T = x.satAxes;
1151
1151
  for (let I = 1; I < 4; I++) {
1152
1152
  const B = v[I], k = T[I];
1153
- if (t.setFromPoints(k, E.points), B.isSeparated(t) || (r.copy(S).cross(k), t.setFromPoints(r, x.points), e.setFromPoints(r, E.points), t.isSeparated(e))) return !1;
1153
+ if (t.setFromPoints(k, S.points), B.isSeparated(t) || (r.copy(E).cross(k), t.setFromPoints(r, x.points), e.setFromPoints(r, S.points), t.isSeparated(e))) return !1;
1154
1154
  }
1155
- const _ = E.satBounds, A = E.satAxes;
1155
+ const _ = S.satBounds, A = S.satAxes;
1156
1156
  for (let I = 1; I < 4; I++) {
1157
1157
  const B = _[I], k = A[I];
1158
- if (t.setFromPoints(k, x.points), B.isSeparated(t) || (r.crossVectors(S, k), t.setFromPoints(r, x.points), e.setFromPoints(r, E.points), t.isSeparated(e))) return !1;
1158
+ if (t.setFromPoints(k, x.points), B.isSeparated(t) || (r.crossVectors(E, k), t.setFromPoints(r, x.points), e.setFromPoints(r, S.points), t.isSeparated(e))) return !1;
1159
1159
  }
1160
1160
  return M && (O || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), M.start.set(0, 0, 0), M.end.set(0, 0, 0)), !0;
1161
1161
  }
1162
- function f(x, E, M, O, S, v, T, _, A, I, B) {
1162
+ function f(x, S, M, O, E, v, T, _, A, I, B) {
1163
1163
  let k = T / (T - _);
1164
- I.x = O + (S - O) * k, B.start.subVectors(E, x).multiplyScalar(k).add(x), k = T / (T - A), I.y = O + (v - O) * k, B.end.subVectors(M, x).multiplyScalar(k).add(x);
1164
+ I.x = O + (E - O) * k, B.start.subVectors(S, x).multiplyScalar(k).add(x), k = T / (T - A), I.y = O + (v - O) * k, B.end.subVectors(M, x).multiplyScalar(k).add(x);
1165
1165
  }
1166
- function m(x, E, M, O, S, v, T, _, A, I, B) {
1167
- if (S > 0)
1168
- f(x.c, x.a, x.b, O, E, M, A, T, _, I, B);
1166
+ function m(x, S, M, O, E, v, T, _, A, I, B) {
1167
+ if (E > 0)
1168
+ f(x.c, x.a, x.b, O, S, M, A, T, _, I, B);
1169
1169
  else if (v > 0)
1170
- f(x.b, x.a, x.c, M, E, O, _, T, A, I, B);
1170
+ f(x.b, x.a, x.c, M, S, O, _, T, A, I, B);
1171
1171
  else if (_ * A > 0 || T != 0)
1172
- f(x.a, x.b, x.c, E, M, O, T, _, A, I, B);
1172
+ f(x.a, x.b, x.c, S, M, O, T, _, A, I, B);
1173
1173
  else if (_ != 0)
1174
- f(x.b, x.a, x.c, M, E, O, _, T, A, I, B);
1174
+ f(x.b, x.a, x.c, M, S, O, _, T, A, I, B);
1175
1175
  else if (A != 0)
1176
- f(x.c, x.a, x.b, O, E, M, A, T, _, I, B);
1176
+ f(x.c, x.a, x.b, O, S, M, A, T, _, I, B);
1177
1177
  else
1178
1178
  return !0;
1179
1179
  return !1;
1180
1180
  }
1181
- function b(x, E, M, O) {
1182
- const S = E.degenerateSegment, v = x.plane.distanceToPoint(S.start), T = x.plane.distanceToPoint(S.end);
1183
- return Ye(v) ? Ye(T) ? u(x, E, M, O) : (M && (M.start.copy(S.start), M.end.copy(S.start)), x.containsPoint(S.start)) : Ye(T) ? (M && (M.start.copy(S.end), M.end.copy(S.end)), x.containsPoint(S.end)) : x.plane.intersectLine(S, i) != null ? (M && (M.start.copy(i), M.end.copy(i)), x.containsPoint(i)) : !1;
1181
+ function b(x, S, M, O) {
1182
+ const E = S.degenerateSegment, v = x.plane.distanceToPoint(E.start), T = x.plane.distanceToPoint(E.end);
1183
+ return Ye(v) ? Ye(T) ? u(x, S, M, O) : (M && (M.start.copy(E.start), M.end.copy(E.start)), x.containsPoint(E.start)) : Ye(T) ? (M && (M.start.copy(E.end), M.end.copy(E.end)), x.containsPoint(E.end)) : x.plane.intersectLine(E, i) != null ? (M && (M.start.copy(i), M.end.copy(i)), x.containsPoint(i)) : !1;
1184
1184
  }
1185
- function y(x, E, M) {
1186
- const O = E.a;
1185
+ function y(x, S, M) {
1186
+ const O = S.a;
1187
1187
  return Ye(x.plane.distanceToPoint(O)) && x.containsPoint(O) ? (M && (M.start.copy(O), M.end.copy(O)), !0) : !1;
1188
1188
  }
1189
- function C(x, E, M) {
1190
- const O = x.degenerateSegment, S = E.a;
1191
- return O.closestPointToPoint(S, !0, i), S.distanceToSquared(i) < Ur ? (M && (M.start.copy(S), M.end.copy(S)), !0) : !1;
1189
+ function C(x, S, M) {
1190
+ const O = x.degenerateSegment, E = S.a;
1191
+ return O.closestPointToPoint(E, !0, i), E.distanceToSquared(i) < Ur ? (M && (M.start.copy(E), M.end.copy(E)), !0) : !1;
1192
1192
  }
1193
- function w(x, E, M, O) {
1193
+ function w(x, S, M, O) {
1194
1194
  if (x.isDegenerateIntoSegment)
1195
- if (E.isDegenerateIntoSegment) {
1196
- const S = x.degenerateSegment, v = E.degenerateSegment, T = s, _ = n;
1197
- S.delta(T), v.delta(_);
1198
- const A = i.subVectors(v.start, S.start), I = T.x * _.y - T.y * _.x;
1195
+ if (S.isDegenerateIntoSegment) {
1196
+ const E = x.degenerateSegment, v = S.degenerateSegment, T = s, _ = n;
1197
+ E.delta(T), v.delta(_);
1198
+ const A = i.subVectors(v.start, E.start), I = T.x * _.y - T.y * _.x;
1199
1199
  if (Ye(I))
1200
1200
  return !1;
1201
1201
  const B = (A.x * _.y - A.y * _.x) / I, k = -(T.x * A.y - T.y * A.x) / I;
1202
1202
  if (B < 0 || B > 1 || k < 0 || k > 1)
1203
1203
  return !1;
1204
- const D = S.start.z + T.z * B, R = v.start.z + _.z * k;
1205
- return Ye(D - R) ? (M && (M.start.copy(S.start).addScaledVector(T, B), M.end.copy(S.start).addScaledVector(T, B)), !0) : !1;
1206
- } else return E.isDegenerateIntoPoint ? C(x, E, M) : b(E, x, M, O);
1204
+ const D = E.start.z + T.z * B, R = v.start.z + _.z * k;
1205
+ return Ye(D - R) ? (M && (M.start.copy(E.start).addScaledVector(T, B), M.end.copy(E.start).addScaledVector(T, B)), !0) : !1;
1206
+ } else return S.isDegenerateIntoPoint ? C(x, S, M) : b(S, x, M, O);
1207
1207
  else {
1208
1208
  if (x.isDegenerateIntoPoint)
1209
- return E.isDegenerateIntoPoint ? E.a.distanceToSquared(x.a) < Ur ? (M && (M.start.copy(x.a), M.end.copy(x.a)), !0) : !1 : E.isDegenerateIntoSegment ? C(E, x, M) : y(E, x, M);
1210
- if (E.isDegenerateIntoPoint)
1211
- return y(x, E, M);
1212
- if (E.isDegenerateIntoSegment)
1213
- return b(x, E, M, O);
1214
- }
1215
- }
1216
- return function(E, M = null, O = !1) {
1217
- this.needsUpdate && this.update(), E.isExtendedTriangle ? E.needsUpdate && E.update() : (c.copy(E), c.update(), E = c);
1218
- const S = w(this, E, M, O);
1219
- if (S !== void 0)
1220
- return S;
1221
- const v = this.plane, T = E.plane;
1209
+ return S.isDegenerateIntoPoint ? S.a.distanceToSquared(x.a) < Ur ? (M && (M.start.copy(x.a), M.end.copy(x.a)), !0) : !1 : S.isDegenerateIntoSegment ? C(S, x, M) : y(S, x, M);
1210
+ if (S.isDegenerateIntoPoint)
1211
+ return y(x, S, M);
1212
+ if (S.isDegenerateIntoSegment)
1213
+ return b(x, S, M, O);
1214
+ }
1215
+ }
1216
+ return function(S, M = null, O = !1) {
1217
+ this.needsUpdate && this.update(), S.isExtendedTriangle ? S.needsUpdate && S.update() : (c.copy(S), c.update(), S = c);
1218
+ const E = w(this, S, M, O);
1219
+ if (E !== void 0)
1220
+ return E;
1221
+ const v = this.plane, T = S.plane;
1222
1222
  let _ = T.distanceToPoint(this.a), A = T.distanceToPoint(this.b), I = T.distanceToPoint(this.c);
1223
1223
  Ye(_) && (_ = 0), Ye(A) && (A = 0), Ye(I) && (I = 0);
1224
1224
  const B = _ * A, k = _ * I;
1225
1225
  if (B > 0 && k > 0)
1226
1226
  return !1;
1227
- let D = v.distanceToPoint(E.a), R = v.distanceToPoint(E.b), ie = v.distanceToPoint(E.c);
1227
+ let D = v.distanceToPoint(S.a), R = v.distanceToPoint(S.b), ie = v.distanceToPoint(S.c);
1228
1228
  Ye(D) && (D = 0), Ye(R) && (R = 0), Ye(ie) && (ie = 0);
1229
1229
  const se = D * R, ze = D * ie;
1230
1230
  if (se > 0 && ze > 0)
@@ -1234,11 +1234,11 @@ lt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
1234
1234
  let ve = 0, Ni = Math.abs(ct.x);
1235
1235
  const Qe = Math.abs(ct.y);
1236
1236
  Qe > Ni && (Ni = Qe, ve = 1), Math.abs(ct.z) > Ni && (ve = 2);
1237
- const Ae = Mc[ve], At = this.a[Ae], Hi = this.b[Ae], Ht = this.c[Ae], Gt = E.a[Ae], Wt = E.b[Ae], qt = E.c[Ae];
1237
+ const Ie = Mc[ve], At = this.a[Ie], Hi = this.b[Ie], Ht = this.c[Ie], Gt = S.a[Ie], Wt = S.b[Ie], qt = S.c[Ie];
1238
1238
  if (m(this, At, Hi, Ht, B, k, _, A, I, h, a))
1239
- return u(this, E, M, O);
1240
- if (m(E, Gt, Wt, qt, se, ze, D, R, ie, d, o))
1241
- return u(this, E, M, O);
1239
+ return u(this, S, M, O);
1240
+ if (m(S, Gt, Wt, qt, se, ze, D, R, ie, d, o))
1241
+ return u(this, S, M, O);
1242
1242
  if (h.y < h.x) {
1243
1243
  const Mn = h.y;
1244
1244
  h.y = h.x, h.x = Mn, l.copy(a.start), a.start.copy(a.end), a.end.copy(l);
@@ -1385,9 +1385,9 @@ Re.prototype.distanceToBox = /* @__PURE__ */ (function() {
1385
1385
  for (let y = 0; y < 3; y++)
1386
1386
  for (let C = 0; C <= 1; C++)
1387
1387
  for (let w = 0; w <= 1; w++) {
1388
- const x = (y + 1) % 3, E = (y + 2) % 3, M = C << x | w << E, O = 1 << y | C << x | w << E, S = f[M], v = f[O];
1389
- t[b].set(S, v);
1390
- const _ = c[y], A = c[x], I = c[E], B = e[b], k = B.start, D = B.end;
1388
+ const x = (y + 1) % 3, S = (y + 2) % 3, M = C << x | w << S, O = 1 << y | C << x | w << S, E = f[M], v = f[O];
1389
+ t[b].set(E, v);
1390
+ const _ = c[y], A = c[x], I = c[S], B = e[b], k = B.start, D = B.end;
1391
1391
  k[_] = d[_], k[A] = C ? d[A] : u[A], k[I] = w ? d[I] : u[A], D[_] = u[_], D[A] = C ? d[A] : u[A], D[I] = w ? d[I] : u[A], b++;
1392
1392
  }
1393
1393
  for (let y = 0; y <= 1; y++)
@@ -1403,9 +1403,9 @@ Re.prototype.distanceToBox = /* @__PURE__ */ (function() {
1403
1403
  for (let w = 0; w < 12; w++) {
1404
1404
  const x = e[w];
1405
1405
  Er(C, x, i, s);
1406
- const E = i.distanceToSquared(s);
1407
- if (E < m && (m = E, o && o.copy(i), l && l.copy(s), E < h))
1408
- return Math.sqrt(E);
1406
+ const S = i.distanceToSquared(s);
1407
+ if (S < m && (m = S, o && o.copy(i), l && l.copy(s), S < h))
1408
+ return Math.sqrt(S);
1409
1409
  }
1410
1410
  }
1411
1411
  return Math.sqrt(m);
@@ -1489,9 +1489,9 @@ function yn(c, t, e, i, s, n, r) {
1489
1489
  if (Array.isArray(t)) {
1490
1490
  const C = i * 3;
1491
1491
  for (let w = 0, x = u.length; w < x; w++) {
1492
- const { start: E, count: M, materialIndex: O } = u[w];
1493
- if (C >= E && C < E + M) {
1494
- const S = Wr(t[O]), v = Gr(e, f, m, b, y, o, l, h, S, n, r);
1492
+ const { start: S, count: M, materialIndex: O } = u[w];
1493
+ if (C >= S && C < S + M) {
1494
+ const E = Wr(t[O]), v = Gr(e, f, m, b, y, o, l, h, E, n, r);
1495
1495
  if (v)
1496
1496
  if (v.faceIndex = i, v.face.materialIndex = O, s)
1497
1497
  s.push(v);
@@ -1547,30 +1547,30 @@ function Ac(c, t = null) {
1547
1547
  function d(u, f, m = !1) {
1548
1548
  const b = u * 2;
1549
1549
  if (he(b, a)) {
1550
- const y = Te(u, r), C = _e(b, a);
1551
- let w = 1 / 0, x = 1 / 0, E = 1 / 0, M = -1 / 0, O = -1 / 0, S = -1 / 0;
1550
+ const y = Ce(u, r), C = Pe(b, a);
1551
+ let w = 1 / 0, x = 1 / 0, S = 1 / 0, M = -1 / 0, O = -1 / 0, E = -1 / 0;
1552
1552
  for (let v = 3 * y, T = 3 * (y + C); v < T; v++) {
1553
1553
  let _ = i[v];
1554
1554
  const A = s.getX(_), I = s.getY(_), B = s.getZ(_);
1555
- A < w && (w = A), A > M && (M = A), I < x && (x = I), I > O && (O = I), B < E && (E = B), B > S && (S = B);
1555
+ A < w && (w = A), A > M && (M = A), I < x && (x = I), I > O && (O = I), B < S && (S = B), B > E && (E = B);
1556
1556
  }
1557
- return o[u + 0] !== w || o[u + 1] !== x || o[u + 2] !== E || o[u + 3] !== M || o[u + 4] !== O || o[u + 5] !== S ? (o[u + 0] = w, o[u + 1] = x, o[u + 2] = E, o[u + 3] = M, o[u + 4] = O, o[u + 5] = S, !0) : !1;
1557
+ return o[u + 0] !== w || o[u + 1] !== x || o[u + 2] !== S || o[u + 3] !== M || o[u + 4] !== O || o[u + 5] !== E ? (o[u + 0] = w, o[u + 1] = x, o[u + 2] = S, o[u + 3] = M, o[u + 4] = O, o[u + 5] = E, !0) : !1;
1558
1558
  } else {
1559
1559
  const y = be(u), C = we(u, r);
1560
- let w = m, x = !1, E = !1;
1560
+ let w = m, x = !1, S = !1;
1561
1561
  if (t) {
1562
1562
  if (!w) {
1563
- const _ = y / xe + f / Oe, A = C / xe + f / Oe;
1564
- x = t.has(_), E = t.has(A), w = !x && !E;
1563
+ const _ = y / xe + f / _e, A = C / xe + f / _e;
1564
+ x = t.has(_), S = t.has(A), w = !x && !S;
1565
1565
  }
1566
1566
  } else
1567
- x = !0, E = !0;
1568
- const M = w || x, O = w || E;
1569
- let S = !1;
1570
- M && (S = d(y, f, w));
1567
+ x = !0, S = !0;
1568
+ const M = w || x, O = w || S;
1569
+ let E = !1;
1570
+ M && (E = d(y, f, w));
1571
1571
  let v = !1;
1572
1572
  O && (v = d(C, f, w));
1573
- const T = S || v;
1573
+ const T = E || v;
1574
1574
  if (T)
1575
1575
  for (let _ = 0; _ < 3; _++) {
1576
1576
  const A = y + _, I = C + _, B = o[A], k = o[A + 3], D = o[I], R = o[I + 3];
@@ -1583,8 +1583,8 @@ function Ac(c, t = null) {
1583
1583
  function Nt(c, t, e, i, s) {
1584
1584
  let n, r, a, o, l, h;
1585
1585
  const d = 1 / e.direction.x, u = 1 / e.direction.y, f = 1 / e.direction.z, m = e.origin.x, b = e.origin.y, y = e.origin.z;
1586
- let C = t[c], w = t[c + 3], x = t[c + 1], E = t[c + 3 + 1], M = t[c + 2], O = t[c + 3 + 2];
1587
- return d >= 0 ? (n = (C - m) * d, r = (w - m) * d) : (n = (w - m) * d, r = (C - m) * d), u >= 0 ? (a = (x - b) * u, o = (E - b) * u) : (a = (E - b) * u, o = (x - b) * u), n > o || a > r || ((a > n || isNaN(n)) && (n = a), (o < r || isNaN(r)) && (r = o), f >= 0 ? (l = (M - y) * f, h = (O - y) * f) : (l = (O - y) * f, h = (M - y) * f), n > h || l > r) ? !1 : ((l > n || n !== n) && (n = l), (h < r || r !== r) && (r = h), n <= s && r >= i);
1586
+ let C = t[c], w = t[c + 3], x = t[c + 1], S = t[c + 3 + 1], M = t[c + 2], O = t[c + 3 + 2];
1587
+ return d >= 0 ? (n = (C - m) * d, r = (w - m) * d) : (n = (w - m) * d, r = (C - m) * d), u >= 0 ? (a = (x - b) * u, o = (S - b) * u) : (a = (S - b) * u, o = (x - b) * u), n > o || a > r || ((a > n || isNaN(n)) && (n = a), (o < r || isNaN(r)) && (r = o), f >= 0 ? (l = (M - y) * f, h = (O - y) * f) : (l = (O - y) * f, h = (M - y) * f), n > h || l > r) ? !1 : ((l > n || n !== n) && (n = l), (h < r || r !== r) && (r = h), n <= s && r >= i);
1588
1588
  }
1589
1589
  function Ic(c, t, e, i, s, n, r, a) {
1590
1590
  const { geometry: o, _indirectBuffer: l } = c;
@@ -1617,7 +1617,7 @@ function Dc(c, t, e, i, s, n, r) {
1617
1617
  function fr(c, t, e, i, s, n, r) {
1618
1618
  const { float32Array: a, uint16Array: o, uint32Array: l } = ne, h = c * 2;
1619
1619
  if (he(h, o)) {
1620
- const u = Te(c, l), f = _e(h, o);
1620
+ const u = Ce(c, l), f = Pe(h, o);
1621
1621
  Oc(t, e, i, u, f, s, n, r);
1622
1622
  } else {
1623
1623
  const u = be(c);
@@ -1636,7 +1636,7 @@ function pr(c, t, e, i, s, n) {
1636
1636
  const { float32Array: r, uint16Array: a, uint32Array: o } = ne;
1637
1637
  let l = c * 2;
1638
1638
  if (he(l, a)) {
1639
- const d = Te(c, o), u = _e(l, a);
1639
+ const d = Ce(c, o), u = Pe(l, a);
1640
1640
  return _c(t, e, i, d, u, s, n);
1641
1641
  } else {
1642
1642
  const d = Tr(c, o), u = Lc[d], m = i.direction[u] >= 0;
@@ -1651,8 +1651,8 @@ function pr(c, t, e, i, s, n) {
1651
1651
  ))
1652
1652
  return w;
1653
1653
  }
1654
- const E = Nt(y, r, i, s, n) ? pr(y, t, e, i, s, n) : null;
1655
- return w && E ? w.distance <= E.distance ? w : E : w || E || null;
1654
+ const S = Nt(y, r, i, s, n) ? pr(y, t, e, i, s, n) : null;
1655
+ return w && S ? w.distance <= S.distance ? w : S : w || S || null;
1656
1656
  }
1657
1657
  }
1658
1658
  const _s = /* @__PURE__ */ new De(), mi = /* @__PURE__ */ new lt(), gi = /* @__PURE__ */ new lt(), Xi = /* @__PURE__ */ new ot(), qr = /* @__PURE__ */ new Re(), Ps = /* @__PURE__ */ new Re();
@@ -1665,13 +1665,13 @@ function mr(c, t, e, i, s = null) {
1665
1665
  const { float32Array: n, uint16Array: r, uint32Array: a } = ne;
1666
1666
  let o = c * 2;
1667
1667
  if (s === null && (e.boundingBox || e.computeBoundingBox(), qr.set(e.boundingBox.min, e.boundingBox.max, i), s = qr), he(o, r)) {
1668
- const h = t.geometry, d = h.index, u = h.attributes.position, f = e.index, m = e.attributes.position, b = Te(c, a), y = _e(o, r);
1668
+ const h = t.geometry, d = h.index, u = h.attributes.position, f = e.index, m = e.attributes.position, b = Ce(c, a), y = Pe(o, r);
1669
1669
  if (Xi.copy(i).invert(), e.boundsTree)
1670
1670
  return le(c, n, Ps), Ps.matrix.copy(Xi), Ps.needsUpdate = !0, e.boundsTree.shapecast({
1671
1671
  intersectsBounds: (w) => Ps.intersectsBox(w),
1672
1672
  intersectsTriangle: (w) => {
1673
1673
  w.a.applyMatrix4(i), w.b.applyMatrix4(i), w.c.applyMatrix4(i), w.needsUpdate = !0;
1674
- for (let x = b * 3, E = (y + b) * 3; x < E; x += 3)
1674
+ for (let x = b * 3, S = (y + b) * 3; x < S; x += 3)
1675
1675
  if (fe(gi, x, d, u), gi.needsUpdate = !0, w.intersectsTriangle(gi))
1676
1676
  return !0;
1677
1677
  return !1;
@@ -1681,8 +1681,8 @@ function mr(c, t, e, i, s = null) {
1681
1681
  const C = gn(e);
1682
1682
  for (let w = b * 3, x = (y + b) * 3; w < x; w += 3) {
1683
1683
  fe(mi, w, d, u), mi.a.applyMatrix4(Xi), mi.b.applyMatrix4(Xi), mi.c.applyMatrix4(Xi), mi.needsUpdate = !0;
1684
- for (let E = 0, M = C * 3; E < M; E += 3)
1685
- if (fe(gi, E, f, m), gi.needsUpdate = !0, mi.intersectsTriangle(gi))
1684
+ for (let S = 0, M = C * 3; S < M; S += 3)
1685
+ if (fe(gi, S, f, m), gi.needsUpdate = !0, mi.intersectsTriangle(gi))
1686
1686
  return !0;
1687
1687
  }
1688
1688
  }
@@ -1697,11 +1697,11 @@ function Nc(c, t, e, i = {}, s = {}, n = 0, r = 1 / 0) {
1697
1697
  const a = c.geometry, o = a.attributes.position, l = a.index, h = t.attributes.position, d = t.index, u = $e.getPrimitive(), f = $e.getPrimitive();
1698
1698
  let m = zc, b = Vc, y = null, C = null;
1699
1699
  s && (y = Uc, C = jc);
1700
- let w = 1 / 0, x = null, E = null;
1700
+ let w = 1 / 0, x = null, S = null;
1701
1701
  return As.copy(e).invert(), Zi.matrix.copy(As), c.shapecast(
1702
1702
  {
1703
1703
  boundsTraverseOrder: (M) => kn.distanceToBox(M),
1704
- intersectsBounds: (M, O, S) => S < w && S < r ? (O && (Zi.min.copy(M.min), Zi.max.copy(M.max), Zi.needsUpdate = !0), !0) : !1,
1704
+ intersectsBounds: (M, O, E) => E < w && E < r ? (O && (Zi.min.copy(M.min), Zi.max.copy(M.max), Zi.needsUpdate = !0), !0) : !1,
1705
1705
  intersectsRange: (M, O) => {
1706
1706
  if (t.boundsTree)
1707
1707
  return t.boundsTree.shapecast({
@@ -1713,27 +1713,27 @@ function Nc(c, t, e, i = {}, s = {}, n = 0, r = 1 / 0) {
1713
1713
  for (let I = M, B = M + O; I < B; I++) {
1714
1714
  fe(u, 3 * I, l, o), u.needsUpdate = !0;
1715
1715
  const k = u.distanceToTriangle(f, m, y);
1716
- if (k < w && (b.copy(m), C && C.copy(y), w = k, x = I, E = _), k < n)
1716
+ if (k < w && (b.copy(m), C && C.copy(y), w = k, x = I, S = _), k < n)
1717
1717
  return !0;
1718
1718
  }
1719
1719
  }
1720
1720
  }
1721
1721
  });
1722
1722
  {
1723
- const S = gn(t);
1724
- for (let v = 0, T = S; v < T; v++) {
1723
+ const E = gn(t);
1724
+ for (let v = 0, T = E; v < T; v++) {
1725
1725
  fe(f, 3 * v, d, h), f.a.applyMatrix4(e), f.b.applyMatrix4(e), f.c.applyMatrix4(e), f.needsUpdate = !0;
1726
1726
  for (let _ = M, A = M + O; _ < A; _++) {
1727
1727
  fe(u, 3 * _, l, o), u.needsUpdate = !0;
1728
1728
  const I = u.distanceToTriangle(f, m, y);
1729
- if (I < w && (b.copy(m), C && C.copy(y), w = I, x = _, E = v), I < n)
1729
+ if (I < w && (b.copy(m), C && C.copy(y), w = I, x = _, S = v), I < n)
1730
1730
  return !0;
1731
1731
  }
1732
1732
  }
1733
1733
  }
1734
1734
  }
1735
1735
  }
1736
- ), $e.releasePrimitive(u), $e.releasePrimitive(f), w === 1 / 0 ? null : (i.point ? i.point.copy(b) : i.point = b.clone(), i.distance = w, i.faceIndex = x, s && (s.point ? s.point.copy(C) : s.point = C.clone(), s.point.applyMatrix4(As), b.applyMatrix4(As), s.distance = b.sub(s.point).length(), s.faceIndex = E), i);
1736
+ ), $e.releasePrimitive(u), $e.releasePrimitive(f), w === 1 / 0 ? null : (i.point ? i.point.copy(b) : i.point = b.clone(), i.distance = w, i.faceIndex = x, s && (s.point ? s.point.copy(C) : s.point = C.clone(), s.point.applyMatrix4(As), b.applyMatrix4(As), s.distance = b.sub(s.point).length(), s.faceIndex = S), i);
1737
1737
  }
1738
1738
  function Hc(c, t = null) {
1739
1739
  t && Array.isArray(t) && (t = new Set(t));
@@ -1745,34 +1745,34 @@ function Hc(c, t = null) {
1745
1745
  function d(u, f, m = !1) {
1746
1746
  const b = u * 2;
1747
1747
  if (he(b, a)) {
1748
- const y = Te(u, r), C = _e(b, a);
1749
- let w = 1 / 0, x = 1 / 0, E = 1 / 0, M = -1 / 0, O = -1 / 0, S = -1 / 0;
1748
+ const y = Ce(u, r), C = Pe(b, a);
1749
+ let w = 1 / 0, x = 1 / 0, S = 1 / 0, M = -1 / 0, O = -1 / 0, E = -1 / 0;
1750
1750
  for (let v = y, T = y + C; v < T; v++) {
1751
1751
  const _ = 3 * c.resolveTriangleIndex(v);
1752
1752
  for (let A = 0; A < 3; A++) {
1753
1753
  let I = _ + A;
1754
1754
  I = i ? i[I] : I;
1755
1755
  const B = s.getX(I), k = s.getY(I), D = s.getZ(I);
1756
- B < w && (w = B), B > M && (M = B), k < x && (x = k), k > O && (O = k), D < E && (E = D), D > S && (S = D);
1756
+ B < w && (w = B), B > M && (M = B), k < x && (x = k), k > O && (O = k), D < S && (S = D), D > E && (E = D);
1757
1757
  }
1758
1758
  }
1759
- return o[u + 0] !== w || o[u + 1] !== x || o[u + 2] !== E || o[u + 3] !== M || o[u + 4] !== O || o[u + 5] !== S ? (o[u + 0] = w, o[u + 1] = x, o[u + 2] = E, o[u + 3] = M, o[u + 4] = O, o[u + 5] = S, !0) : !1;
1759
+ return o[u + 0] !== w || o[u + 1] !== x || o[u + 2] !== S || o[u + 3] !== M || o[u + 4] !== O || o[u + 5] !== E ? (o[u + 0] = w, o[u + 1] = x, o[u + 2] = S, o[u + 3] = M, o[u + 4] = O, o[u + 5] = E, !0) : !1;
1760
1760
  } else {
1761
1761
  const y = be(u), C = we(u, r);
1762
- let w = m, x = !1, E = !1;
1762
+ let w = m, x = !1, S = !1;
1763
1763
  if (t) {
1764
1764
  if (!w) {
1765
- const _ = y / xe + f / Oe, A = C / xe + f / Oe;
1766
- x = t.has(_), E = t.has(A), w = !x && !E;
1765
+ const _ = y / xe + f / _e, A = C / xe + f / _e;
1766
+ x = t.has(_), S = t.has(A), w = !x && !S;
1767
1767
  }
1768
1768
  } else
1769
- x = !0, E = !0;
1770
- const M = w || x, O = w || E;
1771
- let S = !1;
1772
- M && (S = d(y, f, w));
1769
+ x = !0, S = !0;
1770
+ const M = w || x, O = w || S;
1771
+ let E = !1;
1772
+ M && (E = d(y, f, w));
1773
1773
  let v = !1;
1774
1774
  O && (v = d(C, f, w));
1775
- const T = S || v;
1775
+ const T = E || v;
1776
1776
  if (T)
1777
1777
  for (let _ = 0; _ < 3; _++) {
1778
1778
  const A = y + _, I = C + _, B = o[A], k = o[A + 3], D = o[I], R = o[I + 3];
@@ -1788,7 +1788,7 @@ function Gc(c, t, e, i, s, n, r) {
1788
1788
  function gr(c, t, e, i, s, n, r) {
1789
1789
  const { float32Array: a, uint16Array: o, uint32Array: l } = ne, h = c * 2;
1790
1790
  if (he(h, o)) {
1791
- const u = Te(c, l), f = _e(h, o);
1791
+ const u = Ce(c, l), f = Pe(h, o);
1792
1792
  Ic(t, e, i, u, f, s, n, r);
1793
1793
  } else {
1794
1794
  const u = be(c);
@@ -1807,7 +1807,7 @@ function yr(c, t, e, i, s, n) {
1807
1807
  const { float32Array: r, uint16Array: a, uint32Array: o } = ne;
1808
1808
  let l = c * 2;
1809
1809
  if (he(l, a)) {
1810
- const d = Te(c, o), u = _e(l, a);
1810
+ const d = Ce(c, o), u = Pe(l, a);
1811
1811
  return Bc(t, e, i, d, u, s, n);
1812
1812
  } else {
1813
1813
  const d = Tr(c, o), u = Wc[d], m = i.direction[u] >= 0;
@@ -1822,8 +1822,8 @@ function yr(c, t, e, i, s, n) {
1822
1822
  ))
1823
1823
  return w;
1824
1824
  }
1825
- const E = Nt(y, r, i, s, n) ? yr(y, t, e, i, s, n) : null;
1826
- return w && E ? w.distance <= E.distance ? w : E : w || E || null;
1825
+ const S = Nt(y, r, i, s, n) ? yr(y, t, e, i, s, n) : null;
1826
+ return w && S ? w.distance <= S.distance ? w : S : w || S || null;
1827
1827
  }
1828
1828
  }
1829
1829
  const Is = /* @__PURE__ */ new De(), yi = /* @__PURE__ */ new lt(), xi = /* @__PURE__ */ new lt(), Ki = /* @__PURE__ */ new ot(), Yr = /* @__PURE__ */ new Re(), Bs = /* @__PURE__ */ new Re();
@@ -1836,13 +1836,13 @@ function xr(c, t, e, i, s = null) {
1836
1836
  const { float32Array: n, uint16Array: r, uint32Array: a } = ne;
1837
1837
  let o = c * 2;
1838
1838
  if (s === null && (e.boundingBox || e.computeBoundingBox(), Yr.set(e.boundingBox.min, e.boundingBox.max, i), s = Yr), he(o, r)) {
1839
- const h = t.geometry, d = h.index, u = h.attributes.position, f = e.index, m = e.attributes.position, b = Te(c, a), y = _e(o, r);
1839
+ const h = t.geometry, d = h.index, u = h.attributes.position, f = e.index, m = e.attributes.position, b = Ce(c, a), y = Pe(o, r);
1840
1840
  if (Ki.copy(i).invert(), e.boundsTree)
1841
1841
  return le(c, n, Bs), Bs.matrix.copy(Ki), Bs.needsUpdate = !0, e.boundsTree.shapecast({
1842
1842
  intersectsBounds: (w) => Bs.intersectsBox(w),
1843
1843
  intersectsTriangle: (w) => {
1844
1844
  w.a.applyMatrix4(i), w.b.applyMatrix4(i), w.c.applyMatrix4(i), w.needsUpdate = !0;
1845
- for (let x = b, E = y + b; x < E; x++)
1845
+ for (let x = b, S = y + b; x < S; x++)
1846
1846
  if (fe(xi, 3 * t.resolveTriangleIndex(x), d, u), xi.needsUpdate = !0, w.intersectsTriangle(xi))
1847
1847
  return !0;
1848
1848
  return !1;
@@ -1851,8 +1851,8 @@ function xr(c, t, e, i, s = null) {
1851
1851
  {
1852
1852
  const C = gn(e);
1853
1853
  for (let w = b, x = y + b; w < x; w++) {
1854
- const E = t.resolveTriangleIndex(w);
1855
- fe(yi, 3 * E, d, u), yi.a.applyMatrix4(Ki), yi.b.applyMatrix4(Ki), yi.c.applyMatrix4(Ki), yi.needsUpdate = !0;
1854
+ const S = t.resolveTriangleIndex(w);
1855
+ fe(yi, 3 * S, d, u), yi.a.applyMatrix4(Ki), yi.b.applyMatrix4(Ki), yi.c.applyMatrix4(Ki), yi.needsUpdate = !0;
1856
1856
  for (let M = 0, O = C * 3; M < O; M += 3)
1857
1857
  if (fe(xi, M, f, m), xi.needsUpdate = !0, yi.intersectsTriangle(xi))
1858
1858
  return !0;
@@ -1869,47 +1869,47 @@ function Jc(c, t, e, i = {}, s = {}, n = 0, r = 1 / 0) {
1869
1869
  const a = c.geometry, o = a.attributes.position, l = a.index, h = t.attributes.position, d = t.index, u = $e.getPrimitive(), f = $e.getPrimitive();
1870
1870
  let m = Xc, b = Zc, y = null, C = null;
1871
1871
  s && (y = Kc, C = $c);
1872
- let w = 1 / 0, x = null, E = null;
1872
+ let w = 1 / 0, x = null, S = null;
1873
1873
  return ks.copy(e).invert(), $i.matrix.copy(ks), c.shapecast(
1874
1874
  {
1875
1875
  boundsTraverseOrder: (M) => Dn.distanceToBox(M),
1876
- intersectsBounds: (M, O, S) => S < w && S < r ? (O && ($i.min.copy(M.min), $i.max.copy(M.max), $i.needsUpdate = !0), !0) : !1,
1876
+ intersectsBounds: (M, O, E) => E < w && E < r ? (O && ($i.min.copy(M.min), $i.max.copy(M.max), $i.needsUpdate = !0), !0) : !1,
1877
1877
  intersectsRange: (M, O) => {
1878
1878
  if (t.boundsTree) {
1879
- const S = t.boundsTree;
1880
- return S.shapecast({
1879
+ const E = t.boundsTree;
1880
+ return E.shapecast({
1881
1881
  boundsTraverseOrder: (v) => $i.distanceToBox(v),
1882
1882
  intersectsBounds: (v, T, _) => _ < w && _ < r,
1883
1883
  intersectsRange: (v, T) => {
1884
1884
  for (let _ = v, A = v + T; _ < A; _++) {
1885
- const I = S.resolveTriangleIndex(_);
1885
+ const I = E.resolveTriangleIndex(_);
1886
1886
  fe(f, 3 * I, d, h), f.a.applyMatrix4(e), f.b.applyMatrix4(e), f.c.applyMatrix4(e), f.needsUpdate = !0;
1887
1887
  for (let B = M, k = M + O; B < k; B++) {
1888
1888
  const D = c.resolveTriangleIndex(B);
1889
1889
  fe(u, 3 * D, l, o), u.needsUpdate = !0;
1890
1890
  const R = u.distanceToTriangle(f, m, y);
1891
- if (R < w && (b.copy(m), C && C.copy(y), w = R, x = B, E = _), R < n)
1891
+ if (R < w && (b.copy(m), C && C.copy(y), w = R, x = B, S = _), R < n)
1892
1892
  return !0;
1893
1893
  }
1894
1894
  }
1895
1895
  }
1896
1896
  });
1897
1897
  } else {
1898
- const S = gn(t);
1899
- for (let v = 0, T = S; v < T; v++) {
1898
+ const E = gn(t);
1899
+ for (let v = 0, T = E; v < T; v++) {
1900
1900
  fe(f, 3 * v, d, h), f.a.applyMatrix4(e), f.b.applyMatrix4(e), f.c.applyMatrix4(e), f.needsUpdate = !0;
1901
1901
  for (let _ = M, A = M + O; _ < A; _++) {
1902
1902
  const I = c.resolveTriangleIndex(_);
1903
1903
  fe(u, 3 * I, l, o), u.needsUpdate = !0;
1904
1904
  const B = u.distanceToTriangle(f, m, y);
1905
- if (B < w && (b.copy(m), C && C.copy(y), w = B, x = _, E = v), B < n)
1905
+ if (B < w && (b.copy(m), C && C.copy(y), w = B, x = _, S = v), B < n)
1906
1906
  return !0;
1907
1907
  }
1908
1908
  }
1909
1909
  }
1910
1910
  }
1911
1911
  }
1912
- ), $e.releasePrimitive(u), $e.releasePrimitive(f), w === 1 / 0 ? null : (i.point ? i.point.copy(b) : i.point = b.clone(), i.distance = w, i.faceIndex = x, s && (s.point ? s.point.copy(C) : s.point = C.clone(), s.point.applyMatrix4(ks), b.applyMatrix4(ks), s.distance = b.sub(s.point).length(), s.faceIndex = E), i);
1912
+ ), $e.releasePrimitive(u), $e.releasePrimitive(f), w === 1 / 0 ? null : (i.point ? i.point.copy(b) : i.point = b.clone(), i.distance = w, i.faceIndex = x, s && (s.point ? s.point.copy(C) : s.point = C.clone(), s.point.applyMatrix4(ks), b.applyMatrix4(ks), s.distance = b.sub(s.point).length(), s.faceIndex = S), i);
1913
1913
  }
1914
1914
  function Xr(c, t, e) {
1915
1915
  return c === null ? null : (c.point.applyMatrix4(t.matrixWorld), c.distance = c.point.distanceTo(e.ray.origin), c.object = t, c);
@@ -1980,7 +1980,7 @@ class ms extends bc {
1980
1980
  function o(l) {
1981
1981
  for (let h = 0; h < l.length; h++) {
1982
1982
  const d = l[h], u = new Uint32Array(d), f = new Uint16Array(d);
1983
- for (let m = 0, b = d.byteLength / Oe; m < b; m++) {
1983
+ for (let m = 0, b = d.byteLength / _e; m < b; m++) {
1984
1984
  const y = xe * m, C = 2 * y;
1985
1985
  he(C, f) || (u[y + 6] = u[y + 6] / xe - m);
1986
1986
  }
@@ -2048,14 +2048,14 @@ class ms extends bc {
2048
2048
  const u = ["getX", "getY", "getZ"], f = i.offset;
2049
2049
  for (let m = t, b = t + e; m < b; m++) {
2050
2050
  const C = (n ? n[m] : m) * 3, w = (m - f) * 6;
2051
- let x = C + 0, E = C + 1, M = C + 2;
2052
- a && (x = a[x], E = a[E], M = a[M]), o || (x = x * d + h, E = E * d + h, M = M * d + h);
2051
+ let x = C + 0, S = C + 1, M = C + 2;
2052
+ a && (x = a[x], S = a[S], M = a[M]), o || (x = x * d + h, S = S * d + h, M = M * d + h);
2053
2053
  for (let O = 0; O < 3; O++) {
2054
- let S, v, T;
2055
- o ? (S = r[u[O]](x), v = r[u[O]](E), T = r[u[O]](M)) : (S = l[x + O], v = l[E + O], T = l[M + O]);
2056
- let _ = S;
2054
+ let E, v, T;
2055
+ o ? (E = r[u[O]](x), v = r[u[O]](S), T = r[u[O]](M)) : (E = l[x + O], v = l[S + O], T = l[M + O]);
2056
+ let _ = E;
2057
2057
  v < _ && (_ = v), T < _ && (_ = T);
2058
- let A = S;
2058
+ let A = E;
2059
2059
  v > A && (A = v), T > A && (A = T);
2060
2060
  const I = (A - _) / 2, B = O * 2;
2061
2061
  i[w + B + 0] = _ + I, i[w + B + 1] = I + (Math.abs(_) + I) * en;
@@ -2228,19 +2228,19 @@ class ms extends bc {
2228
2228
  if (n) {
2229
2229
  if (!(t instanceof ms))
2230
2230
  throw new Error('MeshBVH: "intersectsTriangles" callback can only be used with another MeshBVH.');
2231
- const m = (b, y, C, w, x, E, M, O) => {
2232
- for (let S = C, v = C + w; S < v; S++) {
2233
- f(S), h.a.applyMatrix4(e), h.b.applyMatrix4(e), h.c.applyMatrix4(e), h.needsUpdate = !0;
2231
+ const m = (b, y, C, w, x, S, M, O) => {
2232
+ for (let E = C, v = C + w; E < v; E++) {
2233
+ f(E), h.a.applyMatrix4(e), h.b.applyMatrix4(e), h.c.applyMatrix4(e), h.needsUpdate = !0;
2234
2234
  for (let T = b, _ = b + y; T < _; T++)
2235
- if (l(T), r.needsUpdate = !0, n(r, h, T, S, x, E, M, O))
2235
+ if (l(T), r.needsUpdate = !0, n(r, h, T, E, x, S, M, O))
2236
2236
  return !0;
2237
2237
  }
2238
2238
  return !1;
2239
2239
  };
2240
2240
  if (s) {
2241
2241
  const b = s;
2242
- s = function(y, C, w, x, E, M, O, S) {
2243
- return b(y, C, w, x, E, M, O, S) ? !0 : m(y, C, w, x, E, M, O, S);
2242
+ s = function(y, C, w, x, S, M, O, E) {
2243
+ return b(y, C, w, x, S, M, O, E) ? !0 : m(y, C, w, x, S, M, O, E);
2244
2244
  };
2245
2245
  } else
2246
2246
  s = m;
@@ -2355,7 +2355,7 @@ const _i = {
2355
2355
  LineLoop: go.prototype.raycast,
2356
2356
  Points: xo.prototype.raycast,
2357
2357
  BatchedMesh: ll.prototype.raycast
2358
- }, Ce = /* @__PURE__ */ new mn(), Rs = [];
2358
+ }, Se = /* @__PURE__ */ new mn(), Rs = [];
2359
2359
  function Qc(c, t) {
2360
2360
  if (this.isBatchedMesh)
2361
2361
  eh.call(this, c, t);
@@ -2384,26 +2384,26 @@ function Qc(c, t) {
2384
2384
  function eh(c, t) {
2385
2385
  if (this.boundsTrees) {
2386
2386
  const e = this.boundsTrees, i = this._drawInfo || this._instanceInfo, s = this._drawRanges || this._geometryInfo, n = this.matrixWorld;
2387
- Ce.material = this.material, Ce.geometry = this.geometry;
2388
- const r = Ce.geometry.boundsTree, a = Ce.geometry.drawRange;
2389
- Ce.geometry.boundingSphere === null && (Ce.geometry.boundingSphere = new ol());
2387
+ Se.material = this.material, Se.geometry = this.geometry;
2388
+ const r = Se.geometry.boundsTree, a = Se.geometry.drawRange;
2389
+ Se.geometry.boundingSphere === null && (Se.geometry.boundingSphere = new ol());
2390
2390
  for (let o = 0, l = i.length; o < l; o++) {
2391
2391
  if (!this.getVisibleAt(o))
2392
2392
  continue;
2393
2393
  const h = i[o].geometryIndex;
2394
- if (Ce.geometry.boundsTree = e[h], this.getMatrixAt(o, Ce.matrixWorld).premultiply(n), !Ce.geometry.boundsTree) {
2395
- this.getBoundingBoxAt(h, Ce.geometry.boundingBox), this.getBoundingSphereAt(h, Ce.geometry.boundingSphere);
2394
+ if (Se.geometry.boundsTree = e[h], this.getMatrixAt(o, Se.matrixWorld).premultiply(n), !Se.geometry.boundsTree) {
2395
+ this.getBoundingBoxAt(h, Se.geometry.boundingBox), this.getBoundingSphereAt(h, Se.geometry.boundingSphere);
2396
2396
  const d = s[h];
2397
- Ce.geometry.setDrawRange(d.start, d.count);
2397
+ Se.geometry.setDrawRange(d.start, d.count);
2398
2398
  }
2399
- Ce.raycast(c, Rs);
2399
+ Se.raycast(c, Rs);
2400
2400
  for (let d = 0, u = Rs.length; d < u; d++) {
2401
2401
  const f = Rs[d];
2402
2402
  f.object = this, f.batchId = o, t.push(f);
2403
2403
  }
2404
2404
  Rs.length = 0;
2405
2405
  }
2406
- Ce.geometry.boundsTree = r, Ce.geometry.drawRange = a, Ce.material = null, Ce.geometry = null;
2406
+ Se.geometry.boundsTree = r, Se.geometry.drawRange = a, Se.material = null, Se.geometry = null;
2407
2407
  } else
2408
2408
  _i.BatchedMesh.call(this, c, t);
2409
2409
  }
@@ -3417,7 +3417,7 @@ class gs {
3417
3417
  return e = Math.min(t, 255), e / 255;
3418
3418
  }
3419
3419
  }
3420
- class Pe {
3420
+ class Ae {
3421
3421
  /**
3422
3422
  * Gets screen coordinate by pointer event.
3423
3423
  */
@@ -3453,7 +3453,7 @@ class Pe {
3453
3453
  * Converts screen to world coordinate.
3454
3454
  */
3455
3455
  static screen2World(t, e, i) {
3456
- const s = Pe.screen2Ndc(t, e, i);
3456
+ const s = Ae.screen2Ndc(t, e, i);
3457
3457
  return new p.Vector3(s.x, s.y, 1).unproject(e);
3458
3458
  }
3459
3459
  /**
@@ -3476,7 +3476,7 @@ class Pe {
3476
3476
  static world2NormalizedScreen(t, e, i) {
3477
3477
  const s = new p.Vector3(), n = t instanceof p.Vector2 ? 0 : t.z;
3478
3478
  s.set(t.x, t.y, n);
3479
- const r = Pe.world2Screen(s, e, i);
3479
+ const r = Ae.world2Screen(s, e, i);
3480
3480
  return r.x /= i.clientWidth, r.y /= i.clientHeight, r;
3481
3481
  }
3482
3482
  }
@@ -3556,13 +3556,13 @@ class Sh {
3556
3556
  for (let u = 0, f = e.length; u < f; u += 3) {
3557
3557
  const m = u / 3;
3558
3558
  for (let b = 0; b < 3; b++) {
3559
- const y = r[u + b], C = r[u + (b + 1) % 3], w = Math.min(y, C), x = Math.max(y, C), E = w + "," + x;
3560
- h[E] === void 0 ? h[E] = {
3559
+ const y = r[u + b], C = r[u + (b + 1) % 3], w = Math.min(y, C), x = Math.max(y, C), S = w + "," + x;
3560
+ h[S] === void 0 ? h[S] = {
3561
3561
  index1: w,
3562
3562
  index2: x,
3563
3563
  face1: m,
3564
3564
  face2: void 0
3565
- } : h[E].face2 = m;
3565
+ } : h[S].face2 = m;
3566
3566
  }
3567
3567
  }
3568
3568
  for (const u in h) {
@@ -3661,10 +3661,10 @@ class Sh {
3661
3661
  C.splice(x, 1), x = 0;
3662
3662
  } else break;
3663
3663
  }
3664
- const E = /* @__PURE__ */ new Set();
3664
+ const S = /* @__PURE__ */ new Set();
3665
3665
  for (let T = 0; T < y.length; T++)
3666
3666
  y[T].forEach((A) => {
3667
- E.has(A) ? P.warn("[Edge] " + A + " is already in positionIndexSet!") : E.add(A);
3667
+ S.has(A) ? P.warn("[Edge] " + A + " is already in positionIndexSet!") : S.add(A);
3668
3668
  });
3669
3669
  const M = (T, _) => {
3670
3670
  let A = !1;
@@ -3682,7 +3682,7 @@ class Sh {
3682
3682
  }, O = (T, _, A) => {
3683
3683
  const I = [];
3684
3684
  return I.push(M(T, _)), I.push(M(_, A)), I.push(M(A, T)), I.filter((B) => B === !0).length >= 2;
3685
- }, S = (T, _) => {
3685
+ }, E = (T, _) => {
3686
3686
  if (!u[T]) return P.warn("[Edge] " + T + " position isn't used!"), !0;
3687
3687
  const A = u[T];
3688
3688
  for (const B of A) {
@@ -3710,7 +3710,7 @@ class Sh {
3710
3710
  for (; I >= 0; ) {
3711
3711
  A = _[I];
3712
3712
  let B = d[A].inited ? d[A].barycentricIndex + 1 : 0;
3713
- for (; B < h && !S(A, Vn[B]); B++)
3713
+ for (; B < h && !E(A, Vn[B]); B++)
3714
3714
  ;
3715
3715
  if (B < h)
3716
3716
  if (d[A].inited = !0, d[A].barycentricIndex = B, d[A].point.copy(Vn[B]), I == _.length - 1) {
@@ -4294,7 +4294,7 @@ class N {
4294
4294
  static convertSimpleWidthLineToMeshGeometry(t, e) {
4295
4295
  let i, s = !1, n = !1, r = [], a = [], o, l, h = new p.Vector2(), d = new p.Vector2(), u = new p.Vector2(), f = new p.Vector2();
4296
4296
  const m = [], b = e / 2;
4297
- for (let x = 0, E = t.length - 1; x < E; x++)
4297
+ for (let x = 0, S = t.length - 1; x < S; x++)
4298
4298
  s = !x, n = x === t.length - 2, i = this.getOffsetPoint(t[x], t[x + 1], b), h = new p.Vector2(t[x].x + i.x, t[x].y + i.y), d = new p.Vector2(t[x + 1].x + i.x, t[x + 1].y + i.y), u = new p.Vector2(t[x].x - i.x, t[x].y - i.y), f = new p.Vector2(t[x + 1].x - i.x, t[x + 1].y - i.y), s || (o = this.getLineLineIntersectionPoint(
4299
4299
  r[0],
4300
4300
  r[1],
@@ -4394,7 +4394,7 @@ Je.init({
4394
4394
  }
4395
4395
  }
4396
4396
  });
4397
- class Me {
4397
+ class Te {
4398
4398
  /**
4399
4399
  * Compares two materials
4400
4400
  */
@@ -4951,7 +4951,7 @@ const Ih = new p.Vector3(0, 1, 0), Ze = class Ze {
4951
4951
  return e && i.traverse((s) => {
4952
4952
  if (s instanceof p.Mesh || s instanceof p.Line) {
4953
4953
  const n = s;
4954
- n.material = Me.cloneMaterial(n.material);
4954
+ n.material = Te.cloneMaterial(n.material);
4955
4955
  }
4956
4956
  }), i;
4957
4957
  }
@@ -5167,22 +5167,22 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5167
5167
  let f = [], m = 0, b = 0, y = 0;
5168
5168
  const C = [];
5169
5169
  if (d.forEach((x) => {
5170
- const E = t.children[x], M = E.geometry.clone();
5171
- if (M.applyMatrix4(E.matrix), N.tryConvertInterleavedBufferAttributes(M), M.userData.isLineSegments = E.isLineSegments === !0, f.push(M), e) {
5172
- const O = E.name, S = M.attributes?.position?.count, v = M.index?.count || 0, T = {
5170
+ const S = t.children[x], M = S.geometry.clone();
5171
+ if (M.applyMatrix4(S.matrix), N.tryConvertInterleavedBufferAttributes(M), M.userData.isLineSegments = S.isLineSegments === !0, f.push(M), e) {
5172
+ const O = S.name, E = M.attributes?.position?.count, v = M.index?.count || 0, T = {
5173
5173
  batchId: m,
5174
5174
  name: O,
5175
5175
  positionStart: b,
5176
- positionCount: S,
5176
+ positionCount: E,
5177
5177
  indexStart: y,
5178
5178
  indexCount: v
5179
5179
  };
5180
- Object.keys(E.userData).length !== 0 && (T.userData = E.userData), C.push(T), b += S, y += v, m++;
5180
+ Object.keys(S.userData).length !== 0 && (T.userData = S.userData), C.push(T), b += E, y += v, m++;
5181
5181
  }
5182
5182
  }), f.length === 0) return;
5183
5183
  let w;
5184
5184
  if (u.isMesh) {
5185
- const x = Ee(f);
5185
+ const x = Oe(f);
5186
5186
  if (!x) return;
5187
5187
  x.userData = {}, w = new p.Mesh(x, u.material), r.push(w);
5188
5188
  } else if (u.isLine) {
@@ -5190,7 +5190,7 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5190
5190
  if (!x) return;
5191
5191
  w = new p.LineSegments(x, u.material), a.push(w);
5192
5192
  } else if (u.isPoints) {
5193
- const x = Ee(f);
5193
+ const x = Oe(f);
5194
5194
  if (!x) return;
5195
5195
  x.userData = {}, w = new p.Points(x, u.material), o.push(w);
5196
5196
  }
@@ -5216,7 +5216,7 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5216
5216
  const a = Array.isArray(t), o = a ? t.length : t.children.length;
5217
5217
  if (e === i || e >= o || i >= o) return r;
5218
5218
  const l = a ? t[e] : t.children[e], h = a ? t[i] : t.children[i];
5219
- return this.areObjectsMergeable(l, h) && this.areGeometriesMergeable(l.geometry, h.geometry) && Me.materialsEquals(l.material, h.material) && (!s[i] && (s[i] = { indexes: [i] }, this.removeFromArray(n, i)), s[i].indexes.push(e), r = !0), r;
5219
+ return this.areObjectsMergeable(l, h) && this.areGeometriesMergeable(l.geometry, h.geometry) && Te.materialsEquals(l.material, h.material) && (!s[i] && (s[i] = { indexes: [i] }, this.removeFromArray(n, i)), s[i].indexes.push(e), r = !0), r;
5220
5220
  }
5221
5221
  /**
5222
5222
  * TODO: Filters XC etc.
@@ -5241,12 +5241,12 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5241
5241
  if (C.isInstancedMesh || !C.geometry || !(C.geometry instanceof p.BufferGeometry)) continue;
5242
5242
  let w = !1;
5243
5243
  const x = Object.values(o);
5244
- for (let E = x.length - 1; E >= 0; --E) {
5245
- const M = x[E].indexes[0];
5244
+ for (let S = x.length - 1; S >= 0; --S) {
5245
+ const M = x[S].indexes[0];
5246
5246
  if (w = this.tryHandleMergeableObjects(t, y, M, o, l), w) break;
5247
5247
  }
5248
- for (let E = l.length - 1; !w && E >= 0; --E) {
5249
- const M = l[E];
5248
+ for (let S = l.length - 1; !w && S >= 0; --S) {
5249
+ const M = l[S];
5250
5250
  if (w = this.tryHandleMergeableObjects(t, y, M, o, l), w) break;
5251
5251
  }
5252
5252
  !w && l.push(y);
@@ -5258,8 +5258,8 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5258
5258
  const C = y.indexes;
5259
5259
  if (C.length < 2) return;
5260
5260
  const w = t[C[0]];
5261
- let x = [], E = 0, M = 0, O = 0;
5262
- const S = [];
5261
+ let x = [], S = 0, M = 0, O = 0;
5262
+ const E = [];
5263
5263
  if (C.forEach((T) => {
5264
5264
  const _ = t[T], A = _.geometry.clone();
5265
5265
  if (w.material instanceof p.LineBasicMaterial && A.deleteAttribute("lineDistance"), this.applyMatrix(A, _, e), A.userData.isLineSegments = _.isLineSegments === !0, x.push(A), n) {
@@ -5267,7 +5267,7 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5267
5267
  let D;
5268
5268
  w.isLine && (!A.boundingSphere && A.computeBoundingSphere(), D = A.boundingSphere.clone());
5269
5269
  const R = {
5270
- batchId: E,
5270
+ batchId: S,
5271
5271
  name: I,
5272
5272
  positionStart: M,
5273
5273
  positionCount: B,
@@ -5275,24 +5275,24 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5275
5275
  indexCount: k,
5276
5276
  boundingSphere: D
5277
5277
  };
5278
- !_.parent.geometry && Object.keys(_.parent.userData).length !== 0 && (R.parentUserData = _.parent.userData), Object.keys(_.userData).length !== 0 && (R.userData = _.userData), S.push(R), M += B, O += k, E++;
5278
+ !_.parent.geometry && Object.keys(_.parent.userData).length !== 0 && (R.parentUserData = _.parent.userData), Object.keys(_.userData).length !== 0 && (R.userData = _.userData), E.push(R), M += B, O += k, S++;
5279
5279
  }
5280
5280
  }), x.length === 0) return;
5281
5281
  let v;
5282
5282
  if (w.isMesh) {
5283
- const T = Ee(x);
5283
+ const T = Oe(x);
5284
5284
  if (!T) return;
5285
5285
  T.userData = {}, v = new p.Mesh(T, w.material), h.push(v);
5286
5286
  } else if (w.isLine) {
5287
- const T = this.mergeLineGeometries(x, n, w.material instanceof p.LineDashedMaterial || w.material instanceof p.ShaderMaterial, S);
5287
+ const T = this.mergeLineGeometries(x, n, w.material instanceof p.LineDashedMaterial || w.material instanceof p.ShaderMaterial, E);
5288
5288
  if (!T) return;
5289
5289
  v = new p.LineSegments(T, w.material), d.push(v);
5290
5290
  } else if (w.isPoints) {
5291
- const T = Ee(x);
5291
+ const T = Oe(x);
5292
5292
  if (!T) return;
5293
5293
  T.userData = {}, v = new p.Points(T, w.material), u.push(v);
5294
5294
  }
5295
- v && (n ? v.userData.batches = S : (v.userData = w.userData, v.userData.batches = void 0), v.userData.layerName = w.userData.layerName, v.name = "[Merged] " + w.name, v.matrixAutoUpdate = bt, v.renderOrder = w.renderOrder, v.layers.mask = w.layers.mask, v.visible = w.visible, C.forEach((T) => f.push(T))), x.forEach((T) => {
5295
+ v && (n ? v.userData.batches = E : (v.userData = w.userData, v.userData.batches = void 0), v.userData.layerName = w.userData.layerName, v.name = "[Merged] " + w.name, v.matrixAutoUpdate = bt, v.renderOrder = w.renderOrder, v.layers.mask = w.layers.mask, v.visible = w.visible, C.forEach((T) => f.push(T))), x.forEach((T) => {
5296
5296
  T.dispose(), N.releaseGeometryManually(T);
5297
5297
  }), x = [];
5298
5298
  }), P.debug("[Merge] Ran deepMerge() in " + (Date.now() - a) / 1e3 + "s");
@@ -5327,7 +5327,7 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5327
5327
  if (i)
5328
5328
  n = us.mergeBufferGeometriesWithLinesToLineSegments(t, e, s);
5329
5329
  else {
5330
- if (n = Ee(t), !n) return;
5330
+ if (n = Oe(t), !n) return;
5331
5331
  n.userData = {};
5332
5332
  const r = [];
5333
5333
  let a = 0;
@@ -5392,8 +5392,8 @@ const Vs = new p.Matrix4(), Bh = new p.Matrix4(), us = class us {
5392
5392
  let y = 0;
5393
5393
  for (let C = 0; C < d.count; C++) {
5394
5394
  const w = C * m, x = C !== 0 && C !== d.count - 1 && !h;
5395
- for (let E = 0; E < m; E++)
5396
- b[y + E] = d.array[w + E], x && (b[y + m + E] = d.array[w + E]);
5395
+ for (let S = 0; S < m; S++)
5396
+ b[y + S] = d.array[w + S], x && (b[y + m + S] = d.array[w + S]);
5397
5397
  y += x ? 2 * m : m;
5398
5398
  }
5399
5399
  a.set(b, o), o += f * m;
@@ -14201,7 +14201,7 @@ class ci extends hi {
14201
14201
  return this.getBounds().getCenter(new p.Vector3());
14202
14202
  }
14203
14203
  transToScreenCoord(e, i) {
14204
- return this.ctx ? Pe.world2Screen(e, i, this.ctx.canvas) : new p.Vector2();
14204
+ return this.ctx ? Ae.world2Screen(e, i, this.ctx.canvas) : new p.Vector2();
14205
14205
  }
14206
14206
  /**
14207
14207
  *
@@ -14690,7 +14690,7 @@ function ji(c, t) {
14690
14690
  return !0;
14691
14691
  }
14692
14692
  const _o = "BYLAYER", hn = "BYBLOCK";
14693
- var Be = /* @__PURE__ */ ((c) => (c[c.Mesh = -1] = "Mesh", c[c.MeshWithPattern = 0] = "MeshWithPattern", c[c.LineWithWidth = 1] = "LineWithWidth", c[c.Line = 2] = "Line", c[c.LineWithPattern = 3] = "LineWithPattern", c[c.Point = 4] = "Point", c[c.Text = 5] = "Text", c))(Be || {});
14693
+ var Me = /* @__PURE__ */ ((c) => (c[c.Mesh = -1] = "Mesh", c[c.MeshWithPattern = 0] = "MeshWithPattern", c[c.LineWithWidth = 1] = "LineWithWidth", c[c.Line = 2] = "Line", c[c.LineWithPattern = 3] = "LineWithPattern", c[c.Point = 4] = "Point", c[c.InsertLine = 4.4] = "InsertLine", c[c.InsertSymbol = 4.6] = "InsertSymbol", c[c.Text = 5] = "Text", c))(Me || {});
14694
14694
  const sn = ["INSERT", "DIMENSION"];
14695
14695
  function Nh(c, t, e, i, s) {
14696
14696
  if (!t) return 0;
@@ -14748,7 +14748,7 @@ function Gh(c, t) {
14748
14748
  return e === i;
14749
14749
  }
14750
14750
  var We = /* @__PURE__ */ ((c) => (c.Added = "Added", c.Removed = "Removed", c.Modified = "Modified", c.NoChange = "NoChange", c))(We || {});
14751
- let Ie = 1;
14751
+ let Be = 1;
14752
14752
  const Mt = class Mt {
14753
14753
  constructor(t, e, i = {}) {
14754
14754
  g(this, "dxf1");
@@ -14818,7 +14818,7 @@ const Mt = class Mt {
14818
14818
  a.type === "Added" ? a.parentHandles.push(s) : a.type === "Removed" && a.parentHandles.push(i);
14819
14819
  else {
14820
14820
  const o = [...a.parentHandles, t.handle];
14821
- a.type === "Added" ? this.changes[Ie] = { id: Ie, ...a, parentHandles: o } : a.type === "Removed" && (this.changes[Ie] = { id: Ie, ...a, parentHandles: o }), Ie++;
14821
+ a.type === "Added" ? this.changes[Be] = { id: Be, ...a, parentHandles: o } : a.type === "Removed" && (this.changes[Be] = { id: Be, ...a, parentHandles: o }), Be++;
14822
14822
  }
14823
14823
  }), !i && !s && (this.isComparingBlock = !1), r;
14824
14824
  }
@@ -14869,11 +14869,11 @@ const Mt = class Mt {
14869
14869
  const s = U.getUpdateProgressFuncForLoop(t.length, i);
14870
14870
  for (let n = 0; n < t.length; n++) {
14871
14871
  const r = t[n].handle;
14872
- if (!e.has(r)) this.changes[Ie] = {
14873
- id: Ie,
14872
+ if (!e.has(r)) this.changes[Be] = {
14873
+ id: Be,
14874
14874
  type: "Removed",
14875
14875
  handle: r
14876
- }, Ie++;
14876
+ }, Be++;
14877
14877
  else {
14878
14878
  const a = t[n], o = e.get(r), l = {};
14879
14879
  if (this.entitiesEqual(a, o, void 0, void 0, l)) {
@@ -14889,11 +14889,11 @@ const Mt = class Mt {
14889
14889
  e.delete(r);
14890
14890
  continue;
14891
14891
  }
14892
- this.changes[Ie] = {
14893
- id: Ie,
14892
+ this.changes[Be] = {
14893
+ id: Be,
14894
14894
  type: "Modified",
14895
14895
  handle: r
14896
- }, this.enableDetailComparision && Object.keys(l).length > 0 && (this.changes[Ie].detailChanges = l), Ie++;
14896
+ }, this.enableDetailComparision && Object.keys(l).length > 0 && (this.changes[Be].detailChanges = l), Be++;
14897
14897
  }
14898
14898
  e.delete(r);
14899
14899
  }
@@ -14901,11 +14901,11 @@ const Mt = class Mt {
14901
14901
  }
14902
14902
  for (const n of e) {
14903
14903
  const r = n[0];
14904
- this.changes[Ie] = {
14905
- id: Ie,
14904
+ this.changes[Be] = {
14905
+ id: Be,
14906
14906
  type: "Added",
14907
14907
  handle: r
14908
- }, Ie++;
14908
+ }, Be++;
14909
14909
  }
14910
14910
  }
14911
14911
  bIgnoreChildEntitiesOriginalType(t) {
@@ -15515,21 +15515,21 @@ class Dt {
15515
15515
  let f = [], m = 0, b = 0, y = 0;
15516
15516
  const C = [];
15517
15517
  if (d.forEach((x) => {
15518
- const E = t.children[x], M = E.geometry?.clone();
15519
- if (M.applyMatrix4(E.matrix), M.userData.isLineSegments = E.type === H.LineSegment, f.push(M), e) {
15520
- const O = M.attributes?.position?.count, S = M.index?.count || 0;
15518
+ const S = t.children[x], M = S.geometry?.clone();
15519
+ if (M.applyMatrix4(S.matrix), M.userData.isLineSegments = S.type === H.LineSegment, f.push(M), e) {
15520
+ const O = M.attributes?.position?.count, E = M.index?.count || 0;
15521
15521
  C.push({
15522
15522
  batchId: m,
15523
15523
  positionStart: b,
15524
15524
  positionCount: O,
15525
15525
  indexStart: y,
15526
- indexCount: S
15527
- }), b += O, y += S, m++;
15526
+ indexCount: E
15527
+ }), b += O, y += E, m++;
15528
15528
  }
15529
15529
  }), f.length === 0) return;
15530
15530
  let w;
15531
15531
  if (u.type === H.Mesh) {
15532
- const x = Ee(f);
15532
+ const x = Oe(f);
15533
15533
  if (!x) return;
15534
15534
  x.userData = {}, w = new z(u.type), w.geometry = x, w.material = u.material, r.push(w);
15535
15535
  } else if (u.type === H.Line || u.type === H.LineSegment) {
@@ -15537,7 +15537,7 @@ class Dt {
15537
15537
  if (!x) return;
15538
15538
  w = new z(H.LineSegment), w.geometry = x, w.material = u.material, a.push(w);
15539
15539
  } else if (u.type === H.Point) {
15540
- const x = Ee(f);
15540
+ const x = Oe(f);
15541
15541
  if (!x) return;
15542
15542
  x.userData = {}, w = new z(u.type), w.geometry = x, w.material = u.material, o.push(w);
15543
15543
  }
@@ -15563,7 +15563,7 @@ class Dt {
15563
15563
  const a = Array.isArray(t), o = a ? t.length : t.children.length;
15564
15564
  if (e === i || e >= o || i >= o) return r;
15565
15565
  const l = a ? t[e] : t.children[e], h = a ? t[i] : t.children[i];
15566
- return this.areObjectsMergeable(l, h) && ye.areGeometriesMergeable(l.geometry, h.geometry) && Me.materialsEquals(l.material, h.material) && (!s[i] && (s[i] = {
15566
+ return this.areObjectsMergeable(l, h) && ye.areGeometriesMergeable(l.geometry, h.geometry) && Te.materialsEquals(l.material, h.material) && (!s[i] && (s[i] = {
15567
15567
  indexes: [i]
15568
15568
  }, this.removeFromArray(n, i)), s[i].indexes.push(e), r = !0), r;
15569
15569
  }
@@ -15603,12 +15603,12 @@ class Dt {
15603
15603
  if (!t[y].geometry || this.isFilteredByOtherFactors(t[y], e)) continue;
15604
15604
  let w = !1;
15605
15605
  const x = Object.values(o);
15606
- for (let E = x.length - 1; E >= 0; --E) {
15607
- const M = x[E].indexes[0];
15606
+ for (let S = x.length - 1; S >= 0; --S) {
15607
+ const M = x[S].indexes[0];
15608
15608
  if (w = this.tryHandleMergeableObjects(t, y, M, o, l), w) break;
15609
15609
  }
15610
- for (let E = l.length - 1; !w && E >= 0; --E) {
15611
- const M = l[E];
15610
+ for (let S = l.length - 1; !w && S >= 0; --S) {
15611
+ const M = l[S];
15612
15612
  if (w = this.tryHandleMergeableObjects(t, y, M, o, l), w) break;
15613
15613
  }
15614
15614
  !w && l.push(y);
@@ -15620,8 +15620,8 @@ class Dt {
15620
15620
  const C = y.indexes;
15621
15621
  if (C.length < 2) return;
15622
15622
  const w = t[C[0]];
15623
- let x = [], E = 0, M = 0, O = 0;
15624
- const S = [];
15623
+ let x = [], S = 0, M = 0, O = 0;
15624
+ const E = [];
15625
15625
  if (C.forEach((T) => {
15626
15626
  const _ = t[T], A = _.geometry?.clone();
15627
15627
  if (w.material instanceof p.LineBasicMaterial && A.deleteAttribute("lineDistance"), this.applyMatrix(A, _, e), A.userData.isLineSegments = _.type === H.LineSegment, x.push(A), n) {
@@ -15629,31 +15629,31 @@ class Dt {
15629
15629
  let k;
15630
15630
  (w.type === H.Line || w.type === H.LineSegment) && (!A.boundingSphere && A.computeBoundingSphere(), k = A.boundingSphere?.clone());
15631
15631
  const D = {
15632
- batchId: E,
15632
+ batchId: S,
15633
15633
  positionStart: M,
15634
15634
  positionCount: I,
15635
15635
  indexStart: O,
15636
15636
  indexCount: B,
15637
15637
  boundingSphere: k
15638
15638
  };
15639
- Object.keys(_.userData).length !== 0 && (D.userData = _.userData), S.push(D), M += I, O += B, E++;
15639
+ Object.keys(_.userData).length !== 0 && (D.userData = _.userData), E.push(D), M += I, O += B, S++;
15640
15640
  }
15641
15641
  }), x.length === 0) return;
15642
15642
  let v;
15643
15643
  if (w.type === H.Mesh) {
15644
- const T = Ee(x);
15644
+ const T = Oe(x);
15645
15645
  if (!T) return;
15646
15646
  T.userData = {}, v = new z(w.type), v.geometry = T, v.material = w.material, h.push(v);
15647
15647
  } else if (w.type === H.Line || w.type === H.LineSegment) {
15648
- const T = ye.mergeLineGeometries(x, n, w.material instanceof p.LineDashedMaterial || w.material instanceof p.ShaderMaterial, S);
15648
+ const T = ye.mergeLineGeometries(x, n, w.material instanceof p.LineDashedMaterial || w.material instanceof p.ShaderMaterial, E);
15649
15649
  if (!T) return;
15650
15650
  v = new z(H.LineSegment), v.geometry = T, v.material = w.material, d.push(v);
15651
15651
  } else if (w.type === H.Point) {
15652
- const T = Ee(x);
15652
+ const T = Oe(x);
15653
15653
  if (!T) return;
15654
15654
  T.userData = {}, v = new z(w.type), v.geometry = T, v.material = w.material, u.push(v);
15655
15655
  }
15656
- v && (n ? v.userData.batches = S : (v.userData = w.userData, v.userData.batches = void 0), v.userData.layerName = w.userData.layerName, v.name = "[Merged] " + w.name, v.renderOrder = w.renderOrder, v.layers.mask = w.layers.mask, C.forEach((T) => f.push(T))), x.forEach((T) => {
15656
+ v && (n ? v.userData.batches = E : (v.userData = w.userData, v.userData.batches = void 0), v.userData.layerName = w.userData.layerName, v.name = "[Merged] " + w.name, v.renderOrder = w.renderOrder, v.layers.mask = w.layers.mask, C.forEach((T) => f.push(T))), x.forEach((T) => {
15657
15657
  T.dispose(), N.releaseGeometryManually(T);
15658
15658
  }), x = [];
15659
15659
  }), P.debug("[Merge] Ran deepMerge() in " + (Date.now() - a) / 1e3 + "s");
@@ -19484,83 +19484,83 @@ class r1 {
19484
19484
  else if (n.value === "BLOCKS")
19485
19485
  P.trace("> BLOCKS"), e.blocks = o(), P.trace("<");
19486
19486
  else if (n.value === "ENTITIES")
19487
- P.trace("> ENTITIES"), e.entities = E(!1), P.trace("<");
19487
+ P.trace("> ENTITIES"), e.entities = S(!1), P.trace("<");
19488
19488
  else if (n.value === "OBJECTS")
19489
19489
  P.trace("> OBJECTS"), e.objects = M(), P.trace("<");
19490
19490
  else if (n.value === "EOF")
19491
19491
  P.trace("EOF");
19492
19492
  else {
19493
- const S = n.value;
19494
- s.unhandledSections[S] ? s.unhandledSections[S]++ : s.unhandledSections[S] = 1;
19493
+ const E = n.value;
19494
+ s.unhandledSections[E] ? s.unhandledSections[E]++ : s.unhandledSections[E] = 1;
19495
19495
  }
19496
19496
  } else
19497
19497
  n = t.next();
19498
19498
  s.unhandledSections = {}, s.unhandledEntities = {}, s.unhandledObjects = {}, s.unsupportedLineTypes = {};
19499
19499
  }
19500
19500
  function a() {
19501
- let S = null, v = null;
19501
+ let E = null, v = null;
19502
19502
  const T = {};
19503
19503
  for (n = t.next(); ; ) {
19504
19504
  if (He(n, 0, "ENDSEC")) {
19505
- S && (T[S] = v);
19505
+ E && (T[E] = v);
19506
19506
  break;
19507
19507
  } else
19508
- n.code === 9 ? (S && (T[S] = v), S = n.value) : n.code === 10 ? v = { x: n.value } : n.code === 20 ? v.y = n.value : n.code === 30 ? v.z = n.value : v = n.value;
19508
+ n.code === 9 ? (E && (T[E] = v), E = n.value) : n.code === 10 ? v = { x: n.value } : n.code === 20 ? v.y = n.value : n.code === 30 ? v.z = n.value : v = n.value;
19509
19509
  n = t.next();
19510
19510
  }
19511
19511
  return n = t.next(), T;
19512
19512
  }
19513
19513
  function o() {
19514
- const S = {};
19514
+ const E = {};
19515
19515
  for (n = t.next(); n.value !== "EOF" && !He(n, 0, "ENDSEC"); )
19516
19516
  if (He(n, 0, "BLOCK")) {
19517
19517
  P.trace("block {");
19518
19518
  const v = l();
19519
- P.trace("}"), O(v), v.name ? S[v.name] = v : console.error("[DxfParser] Block with handle '" + v.handle + "' is missing a name, ignored!");
19519
+ P.trace("}"), O(v), v.name ? E[v.name] = v : console.error("[DxfParser] Block with handle '" + v.handle + "' is missing a name, ignored!");
19520
19520
  } else
19521
19521
  wt(n), n = t.next();
19522
- return S;
19522
+ return E;
19523
19523
  }
19524
19524
  function l() {
19525
- const S = {};
19525
+ const E = {};
19526
19526
  for (n = t.next(); n.value !== "EOF"; ) {
19527
19527
  switch (n.code) {
19528
19528
  case 1:
19529
- S.xrefPath = n.value, n = t.next();
19529
+ E.xrefPath = n.value, n = t.next();
19530
19530
  break;
19531
19531
  case 2:
19532
- S.name = n.value, n = t.next();
19532
+ E.name = n.value, n = t.next();
19533
19533
  break;
19534
19534
  case 3:
19535
- S.name2 = n.value, n = t.next();
19535
+ E.name2 = n.value, n = t.next();
19536
19536
  break;
19537
19537
  case 4:
19538
- S.description = n.value, n = t.next();
19538
+ E.description = n.value, n = t.next();
19539
19539
  break;
19540
19540
  case 5:
19541
- S.handle = n.value, n = t.next();
19541
+ E.handle = n.value, n = t.next();
19542
19542
  break;
19543
19543
  case 8:
19544
- S.layer = n.value, n = t.next();
19544
+ E.layer = n.value, n = t.next();
19545
19545
  break;
19546
19546
  case 10:
19547
- S.position = Xe(t), n = t.lastReadGroup;
19547
+ E.position = Xe(t), n = t.lastReadGroup;
19548
19548
  break;
19549
19549
  case 67:
19550
- S.paperSpace = !!(n.value && n.value === 1), n = t.next();
19550
+ E.paperSpace = !!(n.value && n.value === 1), n = t.next();
19551
19551
  break;
19552
19552
  case 70:
19553
- S.blockType = n.value, n = t.next();
19553
+ E.blockType = n.value, n = t.next();
19554
19554
  break;
19555
19555
  case 100:
19556
19556
  n = t.next();
19557
19557
  break;
19558
19558
  case 330:
19559
- S.ownerHandle = n.value, n = t.next();
19559
+ E.ownerHandle = n.value, n = t.next();
19560
19560
  break;
19561
19561
  case 0:
19562
19562
  if (n.value === "ENDBLK") break;
19563
- S.entities = E(!0);
19563
+ E.entities = S(!0);
19564
19564
  break;
19565
19565
  default:
19566
19566
  wt(n), n = t.next();
@@ -19571,17 +19571,17 @@ class r1 {
19571
19571
  break;
19572
19572
  }
19573
19573
  }
19574
- return S;
19574
+ return E;
19575
19575
  }
19576
19576
  function h() {
19577
- const S = {};
19577
+ const E = {};
19578
19578
  for (n = t.next(); n.value !== "EOF" && !He(n, 0, "ENDSEC"); )
19579
- He(n, 0, "TABLE") ? (n = t.next(), x[n.value] ? (P.trace(n.value + " Table {"), S[x[n.value].tableName] = u(n), P.trace("}")) : P.trace("Unhandled Table " + n.value)) : n = t.next();
19580
- return n = t.next(), S;
19579
+ He(n, 0, "TABLE") ? (n = t.next(), x[n.value] ? (P.trace(n.value + " Table {"), E[x[n.value].tableName] = u(n), P.trace("}")) : P.trace("Unhandled Table " + n.value)) : n = t.next();
19580
+ return n = t.next(), E;
19581
19581
  }
19582
19582
  const d = "ENDTAB";
19583
- function u(S) {
19584
- const v = x[S.value], T = {};
19583
+ function u(E) {
19584
+ const v = x[E.value], T = {};
19585
19585
  let _ = 0;
19586
19586
  for (n = t.next(); !He(n, 0, d); )
19587
19587
  switch (n.code) {
@@ -19615,7 +19615,7 @@ class r1 {
19615
19615
  return n = t.next(), T;
19616
19616
  }
19617
19617
  function f() {
19618
- const S = [];
19618
+ const E = [];
19619
19619
  let v = {};
19620
19620
  for (P.trace("Viewport {"), n = t.next(); !He(n, 0, d); )
19621
19621
  switch (n.code) {
@@ -19700,16 +19700,16 @@ class r1 {
19700
19700
  v.ambientColor = n.value, n = t.next();
19701
19701
  break;
19702
19702
  case 0:
19703
- n.value === "VPORT" && (P.trace("}"), S.push(v), P.trace("Viewport {"), v = {}, n = t.next());
19703
+ n.value === "VPORT" && (P.trace("}"), E.push(v), P.trace("Viewport {"), v = {}, n = t.next());
19704
19704
  break;
19705
19705
  default:
19706
19706
  wt(n), n = t.next();
19707
19707
  break;
19708
19708
  }
19709
- return P.trace("}"), S.push(v), S;
19709
+ return P.trace("}"), E.push(v), E;
19710
19710
  }
19711
19711
  function m() {
19712
- const S = {};
19712
+ const E = {};
19713
19713
  let v = {}, T = 0, _ = "", A = !1;
19714
19714
  for (P.trace("LType {"), n = t.next(); !He(n, 0, "ENDTAB"); )
19715
19715
  switch (n.code) {
@@ -19751,16 +19751,16 @@ class r1 {
19751
19751
  n = t.next();
19752
19752
  break;
19753
19753
  case 0:
19754
- P.trace("}"), T > 0 && T !== v.pattern.length && console.warn("[DxfParser] lengths do not match on LTYPE pattern"), S[_] = v, v = {}, P.trace("LType {"), n = t.next();
19754
+ P.trace("}"), T > 0 && T !== v.pattern.length && console.warn("[DxfParser] lengths do not match on LTYPE pattern"), E[_] = v, v = {}, P.trace("LType {"), n = t.next();
19755
19755
  break;
19756
19756
  default:
19757
19757
  n = t.next();
19758
19758
  break;
19759
19759
  }
19760
- return P.trace("}"), S[_] = v, S;
19760
+ return P.trace("}"), E[_] = v, E;
19761
19761
  }
19762
19762
  function b() {
19763
- const S = {};
19763
+ const E = {};
19764
19764
  let v = {}, T;
19765
19765
  for (P.trace("Layer {"), n = t.next(); !He(n, 0, "ENDTAB"); )
19766
19766
  switch (n.code) {
@@ -19786,16 +19786,16 @@ class r1 {
19786
19786
  v.lineweight = n.value, n = t.next();
19787
19787
  break;
19788
19788
  case 0:
19789
- n.value === "LAYER" && (P.trace("}"), T && (S[T] = v), P.trace("Layer {"), v = {}, T = void 0, n = t.next());
19789
+ n.value === "LAYER" && (P.trace("}"), T && (E[T] = v), P.trace("Layer {"), v = {}, T = void 0, n = t.next());
19790
19790
  break;
19791
19791
  default:
19792
19792
  wt(n), n = t.next();
19793
19793
  break;
19794
19794
  }
19795
- return P.trace("}"), T && (S[T] = v), S;
19795
+ return P.trace("}"), T && (E[T] = v), E;
19796
19796
  }
19797
19797
  function y() {
19798
- const S = {};
19798
+ const E = {};
19799
19799
  let v = {}, T;
19800
19800
  for (P.trace("Style {"), n = t.next(); !He(n, 0, "ENDTAB"); )
19801
19801
  switch (n.code) {
@@ -19833,16 +19833,16 @@ class r1 {
19833
19833
  v.ownerHandle = n.value, n = t.next();
19834
19834
  break;
19835
19835
  case 0:
19836
- n.value === "STYLE" && (P.trace("}"), T && (S[T] = v), P.trace("Style {"), v = {}, T = void 0, n = t.next());
19836
+ n.value === "STYLE" && (P.trace("}"), T && (E[T] = v), P.trace("Style {"), v = {}, T = void 0, n = t.next());
19837
19837
  break;
19838
19838
  default:
19839
19839
  n = t.next();
19840
19840
  break;
19841
19841
  }
19842
- return P.trace("}"), T && (S[T] = v), S;
19842
+ return P.trace("}"), T && (E[T] = v), E;
19843
19843
  }
19844
19844
  function C() {
19845
- const S = {};
19845
+ const E = {};
19846
19846
  let v = {}, T;
19847
19847
  for (P.trace("DimStyle {"), n = t.next(); !He(n, 0, "ENDTAB"); )
19848
19848
  switch (n.code) {
@@ -19895,16 +19895,16 @@ class r1 {
19895
19895
  n = t.next();
19896
19896
  break;
19897
19897
  case 0:
19898
- n.value === "DIMSTYLE" && (P.trace("}"), T && (S[T] = v), P.trace("DimStyle {"), v = {}, T = void 0, n = t.next());
19898
+ n.value === "DIMSTYLE" && (P.trace("}"), T && (E[T] = v), P.trace("DimStyle {"), v = {}, T = void 0, n = t.next());
19899
19899
  break;
19900
19900
  default:
19901
19901
  n = t.next();
19902
19902
  break;
19903
19903
  }
19904
- return P.trace("}"), T && (S[T] = v), S;
19904
+ return P.trace("}"), T && (E[T] = v), E;
19905
19905
  }
19906
19906
  function w() {
19907
- const S = {};
19907
+ const E = {};
19908
19908
  let v = {}, T;
19909
19909
  for (P.trace("BlockRecord {"), n = t.next(); !He(n, 0, "ENDTAB"); )
19910
19910
  switch (n.code) {
@@ -19934,7 +19934,7 @@ class r1 {
19934
19934
  break;
19935
19935
  case 0:
19936
19936
  if (n.value === "BLOCK_RECORD") {
19937
- P.trace("}"), T && (S[T] = v);
19937
+ P.trace("}"), T && (E[T] = v);
19938
19938
  const A = v.layoutHandle;
19939
19939
  T && A && A.length > 0 && A !== "0" && (s._layoutBlocks[A] = v), P.trace("BlockRecord {"), v = {}, T = void 0, n = t.next();
19940
19940
  } else
@@ -19944,9 +19944,9 @@ class r1 {
19944
19944
  wt(n), n = t.next();
19945
19945
  break;
19946
19946
  }
19947
- P.trace("}"), T && (S[T] = v);
19947
+ P.trace("}"), T && (E[T] = v);
19948
19948
  const _ = v.layoutHandle;
19949
- return T && _ && _.length > 0 && _ !== "0" && (s._layoutBlocks[_] = v), S;
19949
+ return T && _ && _.length > 0 && _ !== "0" && (s._layoutBlocks[_] = v), E;
19950
19950
  }
19951
19951
  const x = {
19952
19952
  VPORT: {
@@ -19986,9 +19986,9 @@ class r1 {
19986
19986
  parseTableRecords: C
19987
19987
  }
19988
19988
  };
19989
- function E(S) {
19990
- const v = [], T = S ? "ENDBLK" : "ENDSEC";
19991
- for (S || (n = t.next()); ; )
19989
+ function S(E) {
19990
+ const v = [], T = E ? "ENDBLK" : "ENDSEC";
19991
+ for (E || (n = t.next()); ; )
19992
19992
  if (n.code === 0) {
19993
19993
  if (n.value === T) break;
19994
19994
  const _ = s._entityHandlers[n.value];
@@ -20006,7 +20006,7 @@ class r1 {
20006
20006
  return T === "ENDSEC" && (n = t.next()), v;
20007
20007
  }
20008
20008
  function M() {
20009
- const S = {}, v = "ENDSEC";
20009
+ const E = {}, v = "ENDSEC";
20010
20010
  for (n = t.next(); n.value !== "EOF"; )
20011
20011
  if (n.code === 0) {
20012
20012
  if (n.value === v) break;
@@ -20014,7 +20014,7 @@ class r1 {
20014
20014
  if (T != null) {
20015
20015
  P.trace(n.value + " {");
20016
20016
  const _ = T.parseObject(t, n), A = n.value;
20017
- n = t.lastReadGroup, P.trace("}"), O(_), S[A] || (S[A] = []), S[A].push(_);
20017
+ n = t.lastReadGroup, P.trace("}"), O(_), E[A] || (E[A] = []), E[A].push(_);
20018
20018
  } else {
20019
20019
  const _ = n.value;
20020
20020
  s.unhandledObjects[_] || (s.unhandledObjects[_] = 0), s.unhandledObjects[_]++, n = t.next();
@@ -20022,13 +20022,13 @@ class r1 {
20022
20022
  }
20023
20023
  } else
20024
20024
  n = t.next();
20025
- return n = t.next(), S.LAYOUT && (Object.keys(s._layoutBlocks).length !== S.LAYOUT.length && console.warn("[DxfParser] The number of layout and block associations does not match!"), S.LAYOUT.forEach((T) => {
20025
+ return n = t.next(), E.LAYOUT && (Object.keys(s._layoutBlocks).length !== E.LAYOUT.length && console.warn("[DxfParser] The number of layout and block associations does not match!"), E.LAYOUT.forEach((T) => {
20026
20026
  s._layoutBlocks[T.handle] && (T.associatedBlockName = s._layoutBlocks[T.handle].blockName);
20027
- }), S.LAYOUT.sort((T, _) => T.tabOrder - _.tabOrder)), S;
20027
+ }), E.LAYOUT.sort((T, _) => T.tabOrder - _.tabOrder)), E;
20028
20028
  }
20029
- function O(S) {
20030
- if (!S) throw new TypeError("entity cannot be undefined or null");
20031
- S.handle || (S.handle = (i++).toString());
20029
+ function O(E) {
20030
+ if (!E) throw new TypeError("entity cannot be undefined or null");
20031
+ E.handle || (E.handle = (i++).toString());
20032
20032
  }
20033
20033
  return r(), e;
20034
20034
  }
@@ -20666,25 +20666,25 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20666
20666
  const a = U.getUpdateProgressFuncForLoop(r, i);
20667
20667
  let o = {};
20668
20668
  const l = (x) => {
20669
- const E = x.userData.layerName;
20670
- let M = o[E];
20671
- !M && (M = [], o[E] = M), M.push(x);
20669
+ const S = x.userData.layerName;
20670
+ let M = o[S];
20671
+ !M && (M = [], o[S] = M), M.push(x);
20672
20672
  }, h = {}, d = {}, u = new z();
20673
20673
  for (let x = 0; x < r && !this.aborted; x++) {
20674
- const E = e.entities[x];
20675
- this.addViewport(E, h);
20676
- const M = this.loadEntity(E, e);
20674
+ const S = e.entities[x];
20675
+ this.addViewport(S, h);
20676
+ const M = this.loadEntity(S, e);
20677
20677
  if (!M && await a(x), !M) continue;
20678
- const O = this.getLayout(e, E), S = O.layoutName;
20679
- let v = u.children.find((T) => T.name === S);
20680
- if (!v && (v = new z(), v.name = S, v.userData.isLayoutLevelObject = !0, u.add(v)), M.traverse((T) => {
20681
- T.userData.isSnapObject && (!this.layoutsSnapObjectsMap[S] && (this.layoutsSnapObjectsMap[S] = []), this.layoutsSnapObjectsMap[S].push(T));
20678
+ const O = this.getLayout(e, S), E = O.layoutName;
20679
+ let v = u.children.find((T) => T.name === E);
20680
+ if (!v && (v = new z(), v.name = E, v.userData.isLayoutLevelObject = !0, u.add(v)), M.traverse((T) => {
20681
+ T.userData.isSnapObject && (!this.layoutsSnapObjectsMap[E] && (this.layoutsSnapObjectsMap[E] = []), this.layoutsSnapObjectsMap[E].push(T));
20682
20682
  }), this.enableMerge) {
20683
- Dt.merge(M, !1), !d[S] && (d[S] = {
20683
+ Dt.merge(M, !1), !d[E] && (d[E] = {
20684
20684
  object: v,
20685
20685
  layerObjects: {}
20686
20686
  });
20687
- const _ = d[S];
20687
+ const _ = d[E];
20688
20688
  if (M.geometry) {
20689
20689
  const A = M.userData.layerName;
20690
20690
  !_.layerObjects[A] && (_.layerObjects[A] = []), _.layerObjects[A].push(M), M.children.forEach((I) => {
@@ -20700,17 +20700,17 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20700
20700
  n++, await a(x);
20701
20701
  }
20702
20702
  e.objects.LAYOUT.forEach((x) => {
20703
- const E = x, M = E.layoutName;
20703
+ const S = x, M = S.layoutName;
20704
20704
  if (this.ignorePaperSpace && M !== j.MODEL_LAYOUT_NAME) return;
20705
- const O = E.associatedBlockName, S = e.blocks[O];
20706
- S && this.loadLayout(S, e, E, u, o, h);
20705
+ const O = S.associatedBlockName, E = e.blocks[O];
20706
+ E && this.loadLayout(E, e, S, u, o, h);
20707
20707
  }), P.debug("[Dxf] Drew entities in " + (Date.now() - s) / 1e3 + "s");
20708
20708
  for (const x in this.layoutsSnapObjectsMap) {
20709
- const E = u.children.find((S) => S.name === x), M = new z();
20710
- M.name = j.SNAP_GROUP_NAME, M.userData.isSnapGroup = !0, E.add(M);
20709
+ const S = u.children.find((E) => E.name === x), M = new z();
20710
+ M.name = j.SNAP_GROUP_NAME, M.userData.isSnapGroup = !0, S.add(M);
20711
20711
  const O = this.layoutsSnapObjectsMap[x];
20712
- for (let S = 0; S < O.length; S++) {
20713
- const v = O[S], T = v.userData.layerName;
20712
+ for (let E = 0; E < O.length; E++) {
20713
+ const v = O[E], T = v.userData.layerName;
20714
20714
  this.getLayerVisible(e, T) === !1 && v.layers.disable(qe), j.SHOW_SNAP_OBJECT && (v.layers.enableAll(), v.material instanceof p.PointsMaterial ? v.material = Da : v.material instanceof p.LineBasicMaterial ? v.material = La : v.material instanceof p.MeshBasicMaterial && (v.material = Ra));
20715
20715
  let _ = v;
20716
20716
  const A = de.identity();
@@ -20721,15 +20721,15 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20721
20721
  }
20722
20722
  if (this.enableMerge)
20723
20723
  for (const x in d) {
20724
- const E = d[x], M = E.object;
20725
- for (const O in E.layerObjects) {
20726
- const S = E.layerObjects[O], v = Dt.deepMerge(S, void 0, !1, !1, !0), T = v.added, _ = v.removed;
20727
- if (_.length !== S.length) {
20724
+ const S = d[x], M = S.object;
20725
+ for (const O in S.layerObjects) {
20726
+ const E = S.layerObjects[O], v = Dt.deepMerge(E, void 0, !1, !1, !0), T = v.added, _ = v.removed;
20727
+ if (_.length !== E.length) {
20728
20728
  let A = _;
20729
20729
  _.length >= 100 && (A = new Set(_));
20730
20730
  const I = (B) => Array.isArray(A) ? A.indexOf(B) >= 0 : A.has(B);
20731
- for (let B = 0, k = S.length; B < k; B++) {
20732
- const D = S[B];
20731
+ for (let B = 0, k = E.length; B < k; B++) {
20732
+ const D = E[B];
20733
20733
  !I(D) && (M.add(D), l(D));
20734
20734
  }
20735
20735
  }
@@ -20737,7 +20737,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20737
20737
  const I = T[A];
20738
20738
  M.add(I), l(I);
20739
20739
  }
20740
- E.layerObjects[O] = [];
20740
+ S.layerObjects[O] = [];
20741
20741
  }
20742
20742
  }
20743
20743
  this.printStatsInfo(), this.enableReleaseData && (this.releaseCachedData(), this.releaseDxfData(e)), this.enableMerge && j.mergeDxfObjects({
@@ -20749,26 +20749,26 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20749
20749
  u.clear(), o = {};
20750
20750
  const b = {};
20751
20751
  e.objects.LAYOUT.forEach((x) => {
20752
- const E = x;
20753
- b[E.layoutName] = E;
20752
+ const S = x;
20753
+ b[S.layoutName] = S;
20754
20754
  });
20755
20755
  const y = {}, C = (x) => {
20756
- const E = x.userData.layerName;
20757
- let M = y[E];
20758
- !M && (M = [], y[E] = M), M.push(x);
20756
+ const S = x.userData.layerName;
20757
+ let M = y[S];
20758
+ !M && (M = [], y[S] = M), M.push(x);
20759
20759
  };
20760
20760
  m.children.forEach((x) => {
20761
20761
  if (Q.setSharedVariablesOfObject(x), !x.userData.isLayoutLevelObject) return;
20762
- const E = x.name;
20762
+ const S = x.name;
20763
20763
  let M;
20764
- if (E !== j.MODEL_LAYOUT_NAME) {
20765
- const O = b[E];
20764
+ if (S !== j.MODEL_LAYOUT_NAME) {
20765
+ const O = b[S];
20766
20766
  !O.directAssociatedLeafObjectSet && (O.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), M = O.directAssociatedLeafObjectSet;
20767
20767
  }
20768
20768
  x.traverse((O) => {
20769
20769
  if (Q.setSharedVariablesOfObject(O), O.userData.isSnapGroup && (O.visible = j.SHOW_SNAP_OBJECT), O.geometry) {
20770
- const S = O.userData.layerName;
20771
- this.getLayerVisible(e, S) === !1 && (O.visible = !1, O.userData.layerVisible = !1), C(O), M && M.add(O);
20770
+ const E = O.userData.layerName;
20771
+ this.getLayerVisible(e, E) === !1 && (O.visible = !1, O.userData.layerVisible = !1), C(O), M && M.add(O);
20772
20772
  }
20773
20773
  });
20774
20774
  }), P.info("[Dxf] loadEntities() done in " + (Date.now() - s) / 1e3 + "s");
@@ -20779,27 +20779,27 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20779
20779
  layoutViewportsMap: h
20780
20780
  });
20781
20781
  if (j.LOADLLDATA) {
20782
- const x = m.children[0].children, E = [];
20782
+ const x = m.children[0].children, S = [];
20783
20783
  for (let M = 0; M < x.length; M++) {
20784
20784
  const O = x[M];
20785
20785
  if (O?.userData?.llbData) {
20786
- const S = new p.Box3().setFromObject(O);
20787
- S.getSize(new p.Vector3());
20788
- const v = S.getCenter(new p.Vector3());
20789
- E.push({ ...O, boundingBox: { max: S.max, min: S.min, center: v } });
20790
- } else if (O.children && O.children.some((S) => S.userData?.llbData))
20791
- for (let S = 0; S < O.children.length; S++) {
20792
- const v = O.children[S];
20786
+ const E = new p.Box3().setFromObject(O);
20787
+ E.getSize(new p.Vector3());
20788
+ const v = E.getCenter(new p.Vector3());
20789
+ S.push({ ...O, boundingBox: { max: E.max, min: E.min, center: v } });
20790
+ } else if (O.children && O.children.some((E) => E.userData?.llbData))
20791
+ for (let E = 0; E < O.children.length; E++) {
20792
+ const v = O.children[E];
20793
20793
  if (v.userData?.llbData) {
20794
20794
  v.updateWorldMatrix(!0, !0);
20795
20795
  const T = new p.Box3().setFromObject(v);
20796
20796
  T.getSize(new p.Vector3());
20797
20797
  const _ = T.getCenter(new p.Vector3());
20798
- E.push({ ...v, boundingBox: { max: T.max, min: T.min, center: _ } });
20798
+ S.push({ ...v, boundingBox: { max: T.max, min: T.min, center: _ } });
20799
20799
  }
20800
20800
  }
20801
20801
  }
20802
- w.llbMesh = E;
20802
+ w.llbMesh = S;
20803
20803
  }
20804
20804
  return Promise.resolve(w);
20805
20805
  }
@@ -20906,14 +20906,14 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20906
20906
  layersAndObjects: x
20907
20907
  /* 类型桥接:形参类型滞后,实际为 DxfObject[] */
20908
20908
  });
20909
- const E = m.convertToThreejsObject();
20909
+ const S = m.convertToThreejsObject();
20910
20910
  m.clear(), x = {};
20911
20911
  const M = {}, O = (v) => {
20912
20912
  const T = v.userData.layerName;
20913
20913
  let _ = M[T];
20914
20914
  !_ && (_ = [], M[T] = _), _.push(v);
20915
20915
  };
20916
- E.children.forEach((v) => {
20916
+ S.children.forEach((v) => {
20917
20917
  Q.setSharedVariablesOfObject(v), v.userData.isLayoutLevelObject && v.traverse((T) => {
20918
20918
  if (Q.setSharedVariablesOfObject(T), T.userData.isSnapGroup && (T.visible = j.SHOW_SNAP_OBJECT), T.geometry) {
20919
20919
  const _ = T.userData.layerName;
@@ -20921,8 +20921,8 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20921
20921
  }
20922
20922
  });
20923
20923
  });
20924
- const S = f;
20925
- S.threejsObject = E, S.layersAndThreejsObjects = M, S.layoutViewportsMap = {};
20924
+ const E = f;
20925
+ E.threejsObject = S, E.layersAndThreejsObjects = M, E.layoutViewportsMap = {};
20926
20926
  };
20927
20927
  let h = Date.now();
20928
20928
  this.compareContext = {
@@ -21038,11 +21038,36 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21038
21038
  }
21039
21039
  if (o) {
21040
21040
  const f = this.getLayerName(e, i, s);
21041
- o.userData.handle = e.handle, e.type !== "INSERT" && e.type !== "DIMENSION" && o.traverse((m) => {
21041
+ if (o.userData.handle = e.handle, e.type !== "INSERT" && e.type !== "DIMENSION" && o.traverse((m) => {
21042
21042
  m.geometry && (m.userData.layerName = f, m.userData.handle = e.handle, m.userData.dxfType = e.type, this.setMaterial(m, e, i, s));
21043
21043
  }), !l && (this.nonSnapableTypes.has(e.type) && o.traverse((m) => {
21044
21044
  m.layers.disable(qe);
21045
- }), this.enableRenderOrder && (this.entityHandlesWithRenderOrder[e.handle] ? o.renderOrder = parseInt(this.entityHandlesWithRenderOrder[e.handle], 16) + 0.1 : o.renderOrder = parseInt(e.handle, 16)));
21045
+ }), this.enableRenderOrder && (this.entityHandlesWithRenderOrder[e.handle] ? o.renderOrder = parseInt(this.entityHandlesWithRenderOrder[e.handle], 16) + 0.1 : o.renderOrder = parseInt(e.handle, 16))), e.type === "INSERT" && !s && !this.enableRenderOrder) {
21046
+ const m = e.block ? i.blocks[e.block]?.entities : void 0;
21047
+ let b = !0;
21048
+ if (m?.length)
21049
+ for (const w of m) {
21050
+ const x = w;
21051
+ if (x.type === "ATTDEF" || x.type === "SEQEND") continue;
21052
+ if (!(x.type === "LINE" || x.type === "SPLINE" || (x.type === "LWPOLYLINE" || x.type === "POLYLINE") && !x.shape)) {
21053
+ b = !1;
21054
+ break;
21055
+ }
21056
+ }
21057
+ else b = !1;
21058
+ const y = Math.min(parseInt(e.handle, 16) || 0, 3999), C = b ? Me.InsertLine + y * 1e-5 : Me.InsertSymbol + y * 1e-4;
21059
+ o.traverse((w) => {
21060
+ if (w.geometry && w.renderOrder < Me.Text && (w.renderOrder = C, b)) {
21061
+ const x = w.geometry.getAttribute("position");
21062
+ if (x) {
21063
+ let S = !1;
21064
+ for (let M = 0; M < x.count; M++)
21065
+ x.getZ(M) !== 0 && (x.setZ(M, 0), S = !0);
21066
+ S && (x.needsUpdate = !0, w.geometry.computeBoundingBox(), w.geometry.computeBoundingSphere());
21067
+ }
21068
+ }
21069
+ });
21070
+ }
21046
21071
  }
21047
21072
  const h = e.type, d = e.handle, u = sn.includes(h);
21048
21073
  if (!u) {
@@ -21069,14 +21094,14 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21069
21094
  const f = s;
21070
21095
  f?.xScale && f?.yScale && (u = Math.max(Math.abs(f.xScale), Math.abs(f.yScale)));
21071
21096
  const m = this.getDivision(n, r, Math.max(o, l) * u), b = d.getPoints(m), y = [], C = b.length;
21072
- for (let S = 0; S < C - 1; S++)
21073
- F.areVector2sEqual(b[S], b[S + 1], 1e-9) || y.push(b[S]);
21097
+ for (let E = 0; E < C - 1; E++)
21098
+ F.areVector2sEqual(b[E], b[E + 1], 1e-9) || y.push(b[E]);
21074
21099
  if (y.push(b[C - 1]), y.length < 2) return P.warn("[Dxf] Ellipse entity (handle '%s') contains less than 2 points, ignored!", e.handle), void 0;
21075
21100
  const w = new p.Vector3();
21076
21101
  let x = !1;
21077
21102
  this.enableRTC && (x = N.checkAndRebasePositionsOnRTC(y, w));
21078
- const E = new p.BufferGeometry().setFromPoints(y), M = new z(H.Line);
21079
- M.geometry = E, M.material = pe;
21103
+ const S = new p.BufferGeometry().setFromPoints(y), M = new z(H.Line);
21104
+ M.geometry = S, M.material = pe;
21080
21105
  const O = new z(H.Point);
21081
21106
  return O.geometry = Ba, O.material = js, O.matrix.setPosition(e.center.x, e.center.y, e.center.z), O.userData.isSnapObject = !0, O.userData.type = "CircleCenter", O.layers.set(qe), M.add(O), x && (this.setRTCUserData(M), M.matrix.setPosition(w.x, w.y, 0)), M.layers.enableAll(), M;
21082
21107
  }
@@ -21298,7 +21323,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21298
21323
  N.shouldRebasePositionOnRTC(K) && this.setRTCUserData(o), o.matrix.compose(K, me, tt);
21299
21324
  const x = e.position ? K.clone().sub(e.position) : K;
21300
21325
  et.makeTranslation(-x.x, -x.y, 0), de.makeRotationZ(w), o.matrix.multiply(et), o.matrix.multiply(de), o.matrix.multiply(et.invert()), o.userData || (o.userData = {});
21301
- const E = o.matrix.elements, M = E && E[12] || 0, O = E && E[13] || 0, S = E && E[14] || 0, v = new p.Box3();
21326
+ const S = o.matrix.elements, M = S && S[12] || 0, O = S && S[13] || 0, E = S && S[14] || 0, v = new p.Box3();
21302
21327
  z.getBox(o, v);
21303
21328
  const T = new p.Vector3();
21304
21329
  v.getCenter(T);
@@ -21307,7 +21332,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21307
21332
  position: {
21308
21333
  x: M,
21309
21334
  y: O,
21310
- z: S
21335
+ z: E
21311
21336
  },
21312
21337
  bbox: {
21313
21338
  min: {
@@ -21406,8 +21431,8 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21406
21431
  });
21407
21432
  let y = 0;
21408
21433
  if (e.rotation && (y = e.rotation * Math.PI / 180), e.directionVector) {
21409
- const w = e.directionVector, x = new p.Vector3(w.x, w.y, w.z), E = x.clone().cross(Ge), M = Ge.angleTo(x);
21410
- y = E.z > 0 ? -M : M;
21434
+ const w = e.directionVector, x = new p.Vector3(w.x, w.y, w.z), S = x.clone().cross(Ge), M = Ge.angleTo(x);
21435
+ y = S.z > 0 ? -M : M;
21411
21436
  }
21412
21437
  N.shouldRebasePositionOnRTC(K) && this.setRTCUserData(o), o.matrix.compose(K, me, tt);
21413
21438
  const C = e.position ? K.clone().sub(e.position) : K;
@@ -21426,11 +21451,11 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21426
21451
  let d = "Left";
21427
21452
  i.width && i.attachmentPoint && ([1, 4, 7].includes(i.attachmentPoint) ? d = "Left" : [2, 5, 8].includes(i.attachmentPoint) ? d = "Center" : [3, 6, 9].includes(i.attachmentPoint) && (d = "Right"));
21428
21453
  const u = i.width || 0, f = new z();
21429
- let m, b = s.fontFile, y = 1, C = 1, w = 256, x = h * 0.8, E = x + h;
21454
+ let m, b = s.fontFile, y = 1, C = 1, w = 256, x = h * 0.8, S = x + h;
21430
21455
  for (let M = 0; M < e.length; M++) {
21431
21456
  const O = e[M];
21432
21457
  if (typeof O == "string") {
21433
- const S = [], v = (A) => {
21458
+ const E = [], v = (A) => {
21434
21459
  let I;
21435
21460
  if (A.forEach((B, k) => {
21436
21461
  !B.boundingBox && B.computeBoundingBox(), k === 0 ? I = B.boundingBox : I.union(B.boundingBox);
@@ -21447,21 +21472,21 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21447
21472
  break;
21448
21473
  }
21449
21474
  }
21450
- S.push(...A);
21475
+ E.push(...A);
21451
21476
  };
21452
21477
  let T;
21453
21478
  for (let A = 0; A < O.length; A++) {
21454
21479
  const I = O[A];
21455
21480
  if (I === `
21456
21481
  `) {
21457
- a = 0, o -= E, l.length > 0 && v(l), l = [];
21482
+ a = 0, o -= S, l.length > 0 && v(l), l = [];
21458
21483
  continue;
21459
21484
  }
21460
- if (x = h * 0.8, E = x + h, T = this.font?.getCharShape(I, b, h), s.bigFontFile && !T && (T = this.font?.getCharShape(I, s.bigFontFile, h)), !T && (T = this.font?.getCharShape(I, "", h)), !T && (T = this.font?.getNotFoundTextShape(h)), !T) {
21485
+ if (x = h * 0.8, S = x + h, T = this.font?.getCharShape(I, b, h), s.bigFontFile && !T && (T = this.font?.getCharShape(I, s.bigFontFile, h)), !T && (T = this.font?.getCharShape(I, "", h)), !T && (T = this.font?.getNotFoundTextShape(h)), !T) {
21461
21486
  a += h + C * (h / 3.5);
21462
21487
  continue;
21463
21488
  }
21464
- a > (u || 1 / 0) && (l.length > 0 && v(l), a = 0, o -= E, l = []), T.translate(a, o, 0), T.scale(y, 1, 1), T.boundingBox || T.computeBoundingBox(), O.T && (C = O.T);
21489
+ a > (u || 1 / 0) && (l.length > 0 && v(l), a = 0, o -= S, l = []), T.translate(a, o, 0), T.scale(y, 1, 1), T.boundingBox || T.computeBoundingBox(), O.T && (C = O.T);
21465
21490
  const B = Nh(
21466
21491
  I,
21467
21492
  T,
@@ -21475,22 +21500,22 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21475
21500
  }
21476
21501
  l.length > 0 && (v(l), l = []);
21477
21502
  const _ = new z();
21478
- if (S.length > 0) {
21503
+ if (E.length > 0) {
21479
21504
  !m && (m = i.colorIndex), w !== void 0 && w !== 256 ? (i.color = zi(w), i.colorIndex = w) : i.colorIndex = m;
21480
- const A = this.getColor(i, n, r), I = S.filter((k) => k instanceof p.ExtrudeGeometry), B = S.filter((k) => !(k instanceof p.ExtrudeGeometry));
21505
+ const A = this.getColor(i, n, r), I = E.filter((k) => k instanceof p.ExtrudeGeometry), B = E.filter((k) => !(k instanceof p.ExtrudeGeometry));
21481
21506
  if (I.length > 0) {
21482
21507
  const k = new z(H.Mesh);
21483
- k.geometry = Ee(I), k.material = this.getMeshBasicMaterial(A), _.add(k);
21508
+ k.geometry = Oe(I), k.material = this.getMeshBasicMaterial(A), _.add(k);
21484
21509
  }
21485
21510
  if (B.length > 0) {
21486
21511
  const k = new z(H.LineSegment);
21487
- k.geometry = Ee(B), k.material = this.getLineBasicMaterial(A), _.add(k);
21512
+ k.geometry = Oe(B), k.material = this.getLineBasicMaterial(A), _.add(k);
21488
21513
  }
21489
21514
  }
21490
21515
  _.matrix.makeTranslation(0, -h, 0), f.add(_), y = 1, C = 1, w = 256;
21491
21516
  } else if (Array.isArray(O)) {
21492
- const S = this.getMTextGroup(O, i, s, n, r, a, o, l);
21493
- S && (f.add(S.object), a = S.hOffset, o = S.vOffset);
21517
+ const E = this.getMTextGroup(O, i, s, n, r, a, o, l);
21518
+ E && (f.add(E.object), a = E.hOffset, o = E.vOffset);
21494
21519
  } else typeof O == "object" && (O.f && (b = O.f, b && b.includes(".shx") && P.info("[Dxf] Doesn't support custom fonts: " + b)), O.C && (w = O.C), O.W && (O.W[1] === "x" ? y = O.W[0] * i.width : y = O.W[0]), O.H && (O.H[1] === "x" ? h = O.H[0] * i.height : h = O.H[0]), O.T && (C = O.T));
21495
21520
  }
21496
21521
  if (f.children.length !== 0)
@@ -21707,19 +21732,19 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21707
21732
  let C = pe;
21708
21733
  if (b && h(b)) {
21709
21734
  let w = function(O) {
21710
- const S = O.attributes.position, v = S.count, T = new Float32Array(v);
21735
+ const E = O.attributes.position, v = E.count, T = new Float32Array(v);
21711
21736
  for (let _ = 0; _ < v; _ += 2) {
21712
- const A = _ * 3, I = (_ + 1) * 3, B = S.array[I] - S.array[A], k = S.array[I + 1] - S.array[A + 1], D = S.array[I + 2] - S.array[A + 2], R = Math.sqrt(B * B + k * k + D * D);
21737
+ const A = _ * 3, I = (_ + 1) * 3, B = E.array[I] - E.array[A], k = E.array[I + 1] - E.array[A + 1], D = E.array[I + 2] - E.array[A + 2], R = Math.sqrt(B * B + k * k + D * D);
21713
21738
  T[_] = _ === 0 ? 0 : T[_ - 1], T[_ + 1] = T[_] + R;
21714
21739
  }
21715
21740
  O.setAttribute("lineDistance", new p.Float32BufferAttribute(T, 1));
21716
21741
  };
21717
- const x = b.pattern?.[0] || 0.5, E = b.pattern?.[1] || 0.5, M = 0.1;
21742
+ const x = b.pattern?.[0] || 0.5, S = b.pattern?.[1] || 0.5, M = 0.1;
21718
21743
  C = new p.LineDashedMaterial({
21719
21744
  color: pe.color,
21720
21745
  linewidth: pe.linewidth || 1,
21721
21746
  dashSize: x * M,
21722
- gapSize: E * M,
21747
+ gapSize: S * M,
21723
21748
  scale: M
21724
21749
  }), w(y);
21725
21750
  } else
@@ -21764,12 +21789,12 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21764
21789
  if (o?.outlines) {
21765
21790
  const b = o.outlines, y = [];
21766
21791
  b.forEach((x) => {
21767
- const E = new p.Shape();
21792
+ const S = new p.Shape();
21768
21793
  x.forEach((M, O) => {
21769
- O === 0 ? E.moveTo(M[0], M[1]) : E.lineTo(M[0], M[1]);
21770
- }), E.closePath(), y.push(new p.ShapeGeometry(E));
21794
+ O === 0 ? S.moveTo(M[0], M[1]) : S.lineTo(M[0], M[1]);
21795
+ }), S.closePath(), y.push(new p.ShapeGeometry(S));
21771
21796
  });
21772
- const C = Ee(y), w = new z(H.Mesh);
21797
+ const C = Oe(y), w = new z(H.Mesh);
21773
21798
  w.geometry = C, w.material = wi, w.layers.enableAll(), w.layers.disable(qe), a.add(w);
21774
21799
  }
21775
21800
  let l = !1;
@@ -21790,9 +21815,9 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21790
21815
  if (this.statsInfo.unsupportedPolylineCount++, b ? y = this.createTaperedPolylineGeometry(n) : y = N.convertWidthLineToMeshGeometry(d, u), !y)
21791
21816
  P.warn("[Dxf] Failed to convert line with width to mesh geometry: %s", e.handle);
21792
21817
  else {
21793
- const E = new z(H.Mesh);
21794
- E.geometry = y, E.material = wi, E.layers.enableAll(), E.layers.disable(qe), a.add(E);
21795
- const M = Q.createOutline(y, pe, E.matrix), O = new z(H.LineSegment);
21818
+ const S = new z(H.Mesh);
21819
+ S.geometry = y, S.material = wi, S.layers.enableAll(), S.layers.disable(qe), a.add(S);
21820
+ const M = Q.createOutline(y, pe, S.matrix), O = new z(H.LineSegment);
21796
21821
  O.geometry = M.geometry, O.material = M.material, O.matrix = M.matrix, O.layers.enableAll(), O.layers.disable(qe), a.add(O);
21797
21822
  }
21798
21823
  }
@@ -21812,9 +21837,9 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21812
21837
  for (let l = 0; l < e.length - 1; l++) {
21813
21838
  const h = e[l], d = e[l + 1], u = d.x - h.x, f = d.y - h.y, m = Math.hypot(u, f);
21814
21839
  if (m === 0) continue;
21815
- const b = -f / m, y = u / m, C = l === 0 ? h.startWidth : h.endWidth, w = d.startWidth, x = C / 2, E = w / 2;
21840
+ const b = -f / m, y = u / m, C = l === 0 ? h.startWidth : h.endWidth, w = d.startWidth, x = C / 2, S = w / 2;
21816
21841
  h.x + b * x, h.y + y * x, h.x - b * x, h.y - y * x;
21817
- const M = { x: d.x + b * E, y: d.y + y * E }, O = { x: d.x - b * E, y: d.y - y * E };
21842
+ const M = { x: d.x + b * S, y: d.y + y * S }, O = { x: d.x - b * S, y: d.y - y * S };
21818
21843
  n.push(M), r.push(O);
21819
21844
  }
21820
21845
  const a = n.length;
@@ -21866,32 +21891,32 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21866
21891
  default:
21867
21892
  return;
21868
21893
  }
21869
- d.traverse((E) => {
21870
- E.geometry && E.geometry.translate(y, C, 0);
21894
+ d.traverse((S) => {
21895
+ S.geometry && S.geometry.translate(y, C, 0);
21871
21896
  });
21872
21897
  let w = 0;
21873
21898
  if (e.contextData?.textRotation && (w = e.contextData.textRotation * Math.PI / 180), e.contextData?.textDirection) {
21874
- const E = e.contextData.textDirection, M = new p.Vector3(E.x, E.y, E.z), O = M.clone().cross(Ge), S = Ge.angleTo(M);
21875
- w += O.z > 0 ? -S : S;
21899
+ const S = e.contextData.textDirection, M = new p.Vector3(S.x, S.y, S.z), O = M.clone().cross(Ge), E = Ge.angleTo(M);
21900
+ w += O.z > 0 ? -E : E;
21876
21901
  }
21877
21902
  N.shouldRebasePositionOnRTC(K) && this.setRTCUserData(d), d.matrix.compose(K, me, tt), e.contextData?.textLocation ? V.set(e.contextData.textLocation.x, e.contextData.textLocation.y, 0) : V.set(0, 0, 0);
21878
21903
  const x = K.clone().sub(V);
21879
- et.makeTranslation(-x.x, -x.y, 0), de.makeRotationZ(w), d.matrix.multiply(et), d.matrix.multiply(de), d.matrix.multiply(et.invert()), d.renderOrder = Be.Text, a.add(d);
21904
+ et.makeTranslation(-x.x, -x.y, 0), de.makeRotationZ(w), d.matrix.multiply(et), d.matrix.multiply(de), d.matrix.multiply(et.invert()), d.renderOrder = Me.Text, a.add(d);
21880
21905
  }
21881
21906
  if (e.leaderLineType !== 0) {
21882
21907
  const u = [], f = e.contextData?.leaders[0];
21883
21908
  if (!f) return a;
21884
21909
  const m = f.lastLeaderLinePoint;
21885
21910
  if (e.enableDogLeg) {
21886
- const E = new p.Vector3(m.x, m.y, m.z), M = f.doglegLength, O = new p.Vector3(f.doglegVector.x, f.doglegVector.y, f.doglegVector.z), S = O.multiplyScalar(M), v = E.clone().add(S);
21887
- u.push(v, E);
21911
+ const S = new p.Vector3(m.x, m.y, m.z), M = f.doglegLength, O = new p.Vector3(f.doglegVector.x, f.doglegVector.y, f.doglegVector.z), E = O.multiplyScalar(M), v = S.clone().add(E);
21912
+ u.push(v, S);
21888
21913
  }
21889
21914
  const b = e.contextData?.leaders[0].leaderLines || [];
21890
- for (let E = 0; E < b.length; E++) {
21891
- const M = b[E].vertices[0], O = M.reverse().map((B) => new p.Vector3(B.x, B.y, B.z));
21892
- let S = new p.Vector3(m.x, m.y, m.z);
21915
+ for (let S = 0; S < b.length; S++) {
21916
+ const M = b[S].vertices[0], O = M.reverse().map((B) => new p.Vector3(B.x, B.y, B.z));
21917
+ let E = new p.Vector3(m.x, m.y, m.z);
21893
21918
  for (let B = 0; B < O.length; B++)
21894
- u.push(S, O[B]), S = O[B];
21919
+ u.push(E, O[B]), E = O[B];
21895
21920
  const v = V.subVectors(u[0], u[1]).length(), T = e.arrowHeadSize || n.DIMASZ || 2.5, _ = e.arrowHeadScale || n.DIMSCALE || 1, A = T * _;
21896
21921
  e.leaderLineType;
21897
21922
  let I = "";
@@ -21911,7 +21936,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21911
21936
  let C = !1;
21912
21937
  this.enableRTC && (C = N.checkAndRebasePositionsOnRTC(u, y));
21913
21938
  const w = new p.BufferGeometry().setFromPoints(u), x = new z(H.LineSegment);
21914
- x.geometry = w, x.material = pe, x.renderOrder = Be.Line, C && (this.setRTCUserData(x), x.matrix.setPosition(y.x, y.y, 0)), a.add(x);
21939
+ x.geometry = w, x.material = pe, x.renderOrder = Me.Line, C && (this.setRTCUserData(x), x.matrix.setPosition(y.x, y.y, 0)), a.add(x);
21915
21940
  } else return d?.traverse((u) => {
21916
21941
  u.layers.enableAll();
21917
21942
  }), d;
@@ -21947,10 +21972,10 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21947
21972
  if (w && w.entities) {
21948
21973
  r && (e.colorIndex = r.DIMCLRD || 256, e.color = zi(e.colorIndex));
21949
21974
  for (let x = 0; x < w.entities.length; x++) {
21950
- const E = this.loadEntity(w.entities[x], i, e);
21951
- if (E) {
21952
- const M = new p.Vector3(n[0].x, n[0].y, n[0].z), O = new p.Vector3(n[1].x, n[1].y, n[1].z), S = Math.atan2(M.y - O.y, M.x - O.x);
21953
- V.copy(M), K.setScalar(d), me.setFromAxisAngle(bi, S), E.matrix.compose(V, me, K), u.add(E);
21975
+ const S = this.loadEntity(w.entities[x], i, e);
21976
+ if (S) {
21977
+ const M = new p.Vector3(n[0].x, n[0].y, n[0].z), O = new p.Vector3(n[1].x, n[1].y, n[1].z), E = Math.atan2(M.y - O.y, M.x - O.x);
21978
+ V.copy(M), K.setScalar(d), me.setFromAxisAngle(bi, E), S.matrix.compose(V, me, K), u.add(S);
21954
21979
  }
21955
21980
  }
21956
21981
  } else this.loadDefaultLeadArrow(n[1], n[0], d / o / 2, n);
@@ -21960,7 +21985,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21960
21985
  let m = !1;
21961
21986
  this.enableRTC && (m = N.checkAndRebasePositionsOnRTC(n, f));
21962
21987
  const b = new p.BufferGeometry().setFromPoints(n), y = new z(H.Line);
21963
- return y.geometry = b, y.material = pe, y.renderOrder = Be.Line, m && (this.setRTCUserData(y), y.matrix.setPosition(f.x, f.y, 0)), u.children.length > 0 ? (u.add(y), Dt.merge(u, !1), u.traverse((C) => {
21988
+ return y.geometry = b, y.material = pe, y.renderOrder = Me.Line, m && (this.setRTCUserData(y), y.matrix.setPosition(f.x, f.y, 0)), u.children.length > 0 ? (u.add(y), Dt.merge(u, !1), u.traverse((C) => {
21964
21989
  C.layers.enableAll();
21965
21990
  }), u.children.length === 1 ? u.children[0] : u) : (y.layers.enableAll(), y);
21966
21991
  }
@@ -22115,12 +22140,12 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22115
22140
  for (let C = 0; C < o; C++) {
22116
22141
  const w = d[y][C];
22117
22142
  if (!w || w.mergedValue !== 0) continue;
22118
- let x = 1, E = 1;
22143
+ let x = 1, S = 1;
22119
22144
  for (; y + x < a && d[y + x][C] && d[y + x][C].mergedValue === 1; )
22120
22145
  x++;
22121
- for (; C + E < o && d[y][C + E] && d[y][C + E].mergedValue === 1; )
22122
- E++;
22123
- w.rowSpan = x, w.colSpan = E;
22146
+ for (; C + S < o && d[y][C + S] && d[y][C + S].mergedValue === 1; )
22147
+ S++;
22148
+ w.rowSpan = x, w.colSpan = S;
22124
22149
  }
22125
22150
  const f = [0];
22126
22151
  for (let y = 0; y < a; y++)
@@ -22133,14 +22158,14 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22133
22158
  let C = m[0], w = !1;
22134
22159
  for (let x = 0; x < o; x++) {
22135
22160
  y > 0 && d[y - 1][x], y < a && d[y][x];
22136
- let E = !0;
22161
+ let S = !0;
22137
22162
  if (y === 0 || y === a)
22138
- E = !0;
22163
+ S = !0;
22139
22164
  else {
22140
22165
  const M = this._getMergeOwner(d, y - 1, x, a, o), O = this._getMergeOwner(d, y, x, a, o);
22141
- E = M !== O;
22166
+ S = M !== O;
22142
22167
  }
22143
- E ? w || (w = !0, C = m[x]) : w && (b.push(new p.Vector3(C, f[y], 0), new p.Vector3(m[x], f[y], 0)), w = !1);
22168
+ S ? w || (w = !0, C = m[x]) : w && (b.push(new p.Vector3(C, f[y], 0), new p.Vector3(m[x], f[y], 0)), w = !1);
22144
22169
  }
22145
22170
  w && b.push(new p.Vector3(C, f[y], 0), new p.Vector3(m[o], f[y], 0));
22146
22171
  }
@@ -22148,14 +22173,14 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22148
22173
  let C = f[0], w = !1;
22149
22174
  for (let x = 0; x < a; x++) {
22150
22175
  y > 0 && d[x][y - 1], y < o && d[x][y];
22151
- let E = !0;
22176
+ let S = !0;
22152
22177
  if (y === 0 || y === o)
22153
- E = !0;
22178
+ S = !0;
22154
22179
  else {
22155
22180
  const M = this._getMergeOwner(d, x, y - 1, a, o), O = this._getMergeOwner(d, x, y, a, o);
22156
- E = M !== O;
22181
+ S = M !== O;
22157
22182
  }
22158
- E ? w || (w = !0, C = f[x]) : w && (b.push(new p.Vector3(m[y], C, 0), new p.Vector3(m[y], f[x], 0)), w = !1);
22183
+ S ? w || (w = !0, C = f[x]) : w && (b.push(new p.Vector3(m[y], C, 0), new p.Vector3(m[y], f[x], 0)), w = !1);
22159
22184
  }
22160
22185
  w && b.push(new p.Vector3(m[y], C, 0), new p.Vector3(m[y], f[a], 0));
22161
22186
  }
@@ -22167,7 +22192,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22167
22192
  for (let C = 0; C < o; C++) {
22168
22193
  const w = d[y][C];
22169
22194
  if (!w || w.mergedValue !== 0) continue;
22170
- const x = m[C], E = f[y];
22195
+ const x = m[C], S = f[y];
22171
22196
  let M = 0;
22172
22197
  for (let T = 0; T < (w.colSpan || 1); T++)
22173
22198
  M += h[C + T];
@@ -22175,8 +22200,8 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22175
22200
  for (let T = 0; T < (w.rowSpan || 1); T++)
22176
22201
  O += l[y + T];
22177
22202
  w.colorIndex = e.colorIndex, w.height = w.textHeight || 2.5;
22178
- const S = this.getTableTextOffset(w.attachmentPoint || 1, M, O);
22179
- V.set(x, E, 0), V.add(S), w.position = V.clone();
22203
+ const E = this.getTableTextOffset(w.attachmentPoint || 1, M, O);
22204
+ V.set(x, S, 0), V.add(E), w.position = V.clone();
22180
22205
  const v = this.loadMText(w, i, s);
22181
22206
  v && n.add(v);
22182
22207
  }
@@ -22272,8 +22297,8 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22272
22297
  e.center && (w.x = e.center.x, w.y = e.center.y);
22273
22298
  const x = new p.Vector3(e.center?.x, e.center?.y, e.center?.z).applyMatrix4(r.invert());
22274
22299
  w.x = x.x, w.y = x.y;
22275
- const E = w, M = new z(H.Point);
22276
- return M.geometry = Ba, M.material = js, M.userData.handle = e.handle, M.userData.isSnapObject = !0, M.userData.type = "CircleCenter", M.layers.set(qe), C.add(M), b ? (this.setRTCUserData(C), E.x += m.x, E.y += m.y) : N.shouldRebasePositionOnRTC(E) && this.setRTCUserData(C), C.matrix.setPosition(E), C.layers.enableAll(), C;
22300
+ const S = w, M = new z(H.Point);
22301
+ return M.geometry = Ba, M.material = js, M.userData.handle = e.handle, M.userData.isSnapObject = !0, M.userData.type = "CircleCenter", M.layers.set(qe), C.add(M), b ? (this.setRTCUserData(C), S.x += m.x, S.y += m.y) : N.shouldRebasePositionOnRTC(S) && this.setRTCUserData(C), C.matrix.setPosition(S), C.layers.enableAll(), C;
22277
22302
  }
22278
22303
  addTriangleFacingCamera(e, i, s, n) {
22279
22304
  const r = new p.Vector3(), a = new p.Vector3();
@@ -22341,7 +22366,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22341
22366
  ` && w.push(M);
22342
22367
  }
22343
22368
  const x = w.length;
22344
- let E = 0;
22369
+ let S = 0;
22345
22370
  for (let M = 0; M < e.length; M++) {
22346
22371
  const O = e[M];
22347
22372
  if (O === " ") {
@@ -22353,37 +22378,37 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22353
22378
  u = 0, f -= m * 0.5;
22354
22379
  continue;
22355
22380
  }
22356
- let S = this.font?.getCharShape?.(O, i?.fontFile, s);
22357
- if (!S && i?.bigFontFile && (S = this.font?.getCharShape?.(O, i.bigFontFile, s)), !S && this.font?.fileNames) {
22381
+ let E = this.font?.getCharShape?.(O, i?.fontFile, s);
22382
+ if (!E && i?.bigFontFile && (E = this.font?.getCharShape?.(O, i.bigFontFile, s)), !E && this.font?.fileNames) {
22358
22383
  const v = this.font.fileNames.filter((T) => T !== i?.fontFile);
22359
- for (let T = v.length - 1; T >= 0 && (i.fontFile = v[T], i.styleName = "Standard", S = this.font?.getCharShape?.(O, i.fontFile, s), !S); T--)
22384
+ for (let T = v.length - 1; T >= 0 && (i.fontFile = v[T], i.styleName = "Standard", E = this.font?.getCharShape?.(O, i.fontFile, s), !E); T--)
22360
22385
  ;
22361
22386
  }
22362
- if (S || (S = this.font?.getNotFoundTextShape?.(s)), !!S) {
22363
- if (S.translate(u, f, 0), u > o)
22387
+ if (E || (E = this.font?.getNotFoundTextShape?.(s)), !!E) {
22388
+ if (E.translate(u, f, 0), u > o)
22364
22389
  u = 0, f -= m;
22365
22390
  else {
22366
- !S.boundingBox && S.computeBoundingBox();
22367
- const v = S.boundingBox.getSize(V).x, T = O.charCodeAt(0), A = T >= 19968 && T <= 40959 || // CJK 统一汉字
22391
+ !E.boundingBox && E.computeBoundingBox();
22392
+ const v = E.boundingBox.getSize(V).x, T = O.charCodeAt(0), A = T >= 19968 && T <= 40959 || // CJK 统一汉字
22368
22393
  T >= 13312 && T <= 19903 || // 扩展 A
22369
22394
  T >= 63744 && T <= 64255 || // 兼容汉字
22370
22395
  T >= 12288 && T <= 12351 || // CJK 符号与标点(、。《》等)
22371
22396
  T >= 65280 && T <= 65519 || // 全角 ASCII 与标点
22372
22397
  [8216, 8217, 8220, 8221].includes(T) ? Math.max(v, s) : v + C;
22373
- E++, u += A + (E === x ? 0 : l);
22398
+ S++, u += A + (S === x ? 0 : l);
22374
22399
  }
22375
- d.push(S);
22400
+ d.push(E);
22376
22401
  }
22377
22402
  }
22378
22403
  if (d.length > 0) {
22379
- const M = d.filter((S) => S instanceof p.ExtrudeGeometry), O = d.filter((S) => !(S instanceof p.ExtrudeGeometry));
22404
+ const M = d.filter((E) => E instanceof p.ExtrudeGeometry), O = d.filter((E) => !(E instanceof p.ExtrudeGeometry));
22380
22405
  if (M.length > 0) {
22381
- const S = new z(H.Mesh);
22382
- S.geometry = Ee(M), S.material = wi, h.add(S);
22406
+ const E = new z(H.Mesh);
22407
+ E.geometry = Oe(M), E.material = wi, h.add(E);
22383
22408
  }
22384
22409
  if (O.length > 0) {
22385
- const S = new z(H.LineSegment);
22386
- S.geometry = Ee(O), S.material = pe, h.add(S);
22410
+ const E = new z(H.LineSegment);
22411
+ E.geometry = Oe(O), E.material = pe, h.add(E);
22387
22412
  }
22388
22413
  }
22389
22414
  return h;
@@ -22427,8 +22452,8 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22427
22452
  if (e.startPoint && e.endPoint) {
22428
22453
  const d = new p.Vector3(e.startPoint.x, e.startPoint.y, e.startPoint.z), u = new p.Vector3(e.endPoint.x, e.endPoint.y, e.endPoint.z), f = new p.Vector3().subVectors(d, u), m = f.length(), b = m / l, C = (e.text || "").length;
22429
22454
  if (C > 1) {
22430
- const E = (m - l) / (C - 1);
22431
- o.userData.letterSpacing = E;
22455
+ const S = (m - l) / (C - 1);
22456
+ o.userData.letterSpacing = S;
22432
22457
  } else
22433
22458
  b < 3 && o.scale.setX(b);
22434
22459
  const w = f.clone().cross(Ge), x = f.angleTo(Ge);
@@ -22778,52 +22803,52 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22778
22803
  const n = e;
22779
22804
  let r = [];
22780
22805
  function a(M, O) {
22781
- const { startPoint: S, endPoint: v } = M, { startPoint: T, endPoint: _ } = O, A = v.x - S.x, I = v.y - S.y, B = _.x - T.x, k = _.y - T.y, D = A * k - I * B;
22806
+ const { startPoint: E, endPoint: v } = M, { startPoint: T, endPoint: _ } = O, A = v.x - E.x, I = v.y - E.y, B = _.x - T.x, k = _.y - T.y, D = A * k - I * B;
22782
22807
  if (Math.abs(D) < 1e-10) return null;
22783
- const R = S.x - T.x, ie = S.y - T.y, se = (B * ie - k * R) / D, ze = (A * ie - I * R) / D;
22808
+ const R = E.x - T.x, ie = E.y - T.y, se = (B * ie - k * R) / D, ze = (A * ie - I * R) / D;
22784
22809
  return se >= 0 && se <= 1 && ze >= 0 && ze <= 1 ? {
22785
- x: S.x + se * A,
22786
- y: S.y + se * I
22810
+ x: E.x + se * A,
22811
+ y: E.y + se * I
22787
22812
  } : null;
22788
22813
  }
22789
22814
  function o(M) {
22790
- const { edges: O } = M, S = [], v = O.length;
22815
+ const { edges: O } = M, E = [], v = O.length;
22791
22816
  if ({ ...M }, v !== 4) return [M];
22792
22817
  for (let T = 0; T < v; T++)
22793
22818
  for (let _ = T + 2; _ < v; _++) {
22794
22819
  if (_ === T + 1 || T === 0 && _ === v - 1) continue;
22795
22820
  const A = a(O[T], O[_]);
22796
- A && S.push({
22821
+ A && E.push({
22797
22822
  edgeIndex1: T,
22798
22823
  edgeIndex2: _,
22799
22824
  point: { x: A.x, y: A.y }
22800
22825
  });
22801
22826
  }
22802
- if (S.length && S.length === 1) {
22827
+ if (E.length && E.length === 1) {
22803
22828
  const T = {
22804
22829
  pathTypeFlag: M.pathTypeFlag,
22805
22830
  edges: [
22806
- O[S[0].edgeIndex1 - 1],
22831
+ O[E[0].edgeIndex1 - 1],
22807
22832
  {
22808
22833
  startPoint: {
22809
- ...O[S[0].edgeIndex1].startPoint
22834
+ ...O[E[0].edgeIndex1].startPoint
22810
22835
  },
22811
22836
  endPoint: {
22812
- x: S[0].point.x,
22813
- y: S[0].point.y
22837
+ x: E[0].point.x,
22838
+ y: E[0].point.y
22814
22839
  },
22815
- type: O[S[0].edgeIndex1].type
22840
+ type: O[E[0].edgeIndex1].type
22816
22841
  },
22817
22842
  {
22818
22843
  startPoint: {
22819
- x: S[0].point.x,
22820
- y: S[0].point.y
22844
+ x: E[0].point.x,
22845
+ y: E[0].point.y
22821
22846
  },
22822
22847
  endPoint: {
22823
- x: O[S[0].edgeIndex2].startPoint.x,
22824
- y: O[S[0].edgeIndex2].startPoint.y
22848
+ x: O[E[0].edgeIndex2].startPoint.x,
22849
+ y: O[E[0].edgeIndex2].startPoint.y
22825
22850
  },
22826
- type: O[S[0].edgeIndex2].type
22851
+ type: O[E[0].edgeIndex2].type
22827
22852
  }
22828
22853
  ]
22829
22854
  }, _ = {
@@ -22831,22 +22856,22 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22831
22856
  edges: [
22832
22857
  {
22833
22858
  startPoint: {
22834
- x: S[0].point.x - 1e-5,
22835
- y: S[0].point.y - 1e-5
22859
+ x: E[0].point.x - 1e-5,
22860
+ y: E[0].point.y - 1e-5
22836
22861
  },
22837
22862
  endPoint: {
22838
- ...O[S[0].edgeIndex1].endPoint
22863
+ ...O[E[0].edgeIndex1].endPoint
22839
22864
  },
22840
- type: O[S[0].edgeIndex1].type
22865
+ type: O[E[0].edgeIndex1].type
22841
22866
  },
22842
- { ...O[S[0].edgeIndex2 - 1] },
22867
+ { ...O[E[0].edgeIndex2 - 1] },
22843
22868
  {
22844
- startPoint: O[S[0].edgeIndex2].startPoint,
22869
+ startPoint: O[E[0].edgeIndex2].startPoint,
22845
22870
  endPoint: {
22846
- x: S[0].point.x - 1e-5,
22847
- y: S[0].point.y - 1e-5
22871
+ x: E[0].point.x - 1e-5,
22872
+ y: E[0].point.y - 1e-5
22848
22873
  },
22849
- type: O[S[0].edgeIndex2].type
22874
+ type: O[E[0].edgeIndex2].type
22850
22875
  }
22851
22876
  ]
22852
22877
  };
@@ -22856,8 +22881,8 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22856
22881
  }
22857
22882
  if (n.boundaryPaths.length == 0) return;
22858
22883
  for (let M = 0; M < n.boundaryPaths.length; M++) {
22859
- const O = n.boundaryPaths[M], S = o(O);
22860
- r = [...r, ...S];
22884
+ const O = n.boundaryPaths[M], E = o(O);
22885
+ r = [...r, ...E];
22861
22886
  }
22862
22887
  if (n.boundaryPaths = r, !n.solidFill && !n.patternLines?.length) {
22863
22888
  P.warn("[Dxf] Hatch entity(handle: '" + n.handle + "') doesn't have solid fill, nor patternLines, ignored!");
@@ -22865,19 +22890,19 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22865
22890
  }
22866
22891
  const l = [], h = [], d = [], u = (M) => {
22867
22892
  const O = [];
22868
- let S = [];
22869
- S.push(...this.convertEdgeToPoints(M[0]));
22893
+ let E = [];
22894
+ E.push(...this.convertEdgeToPoints(M[0]));
22870
22895
  for (let v = 1; v < M.length; v++) {
22871
22896
  const T = this.convertEdgeToPoints(M[v]);
22872
- if (S.push(...T), S.length > 2) {
22897
+ if (E.push(...T), E.length > 2) {
22873
22898
  const _ = this.convertEdgeToPoints(M[v - 1]);
22874
- F.areVector2sEqual(_[_.length - 1], T[0]) ? F.areVector2sEqual(S[0], T[T.length - 1], 1e-5) && (O.push(S), S = []) : F.areVector2sEqual(_[0], T[T.length - 1]) ? F.areVector2sEqual(S[1], T[0], 1e-5) && (O.push(S), S = []) : S = [];
22899
+ F.areVector2sEqual(_[_.length - 1], T[0]) ? F.areVector2sEqual(E[0], T[T.length - 1], 1e-5) && (O.push(E), E = []) : F.areVector2sEqual(_[0], T[T.length - 1]) ? F.areVector2sEqual(E[1], T[0], 1e-5) && (O.push(E), E = []) : E = [];
22875
22900
  }
22876
22901
  }
22877
22902
  return O;
22878
22903
  };
22879
22904
  if (n.boundaryPaths.forEach((M, O) => {
22880
- let S = [];
22905
+ let E = [];
22881
22906
  if (this.IsfilteredByPathTypeFlag(M.pathTypeFlag)) {
22882
22907
  P.info("[Dxf] The %d path type flag is filtered at the %dth boundrayPath (hatch handle '%s')", M.pathTypeFlag, O, n.handle);
22883
22908
  return;
@@ -22897,17 +22922,17 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22897
22922
  P.warn("[Dxf] The %dth boundaryPath (hatch handle '%s') has less than 3 points, ignored!", O, n.handle);
22898
22923
  return;
22899
22924
  }
22900
- if (S.push(T), M.pathTypeFlag > Ao.MaxFlags && (!((A) => {
22925
+ if (E.push(T), M.pathTypeFlag > Ao.MaxFlags && (!((A) => {
22901
22926
  for (let I = 1; I < A.length; ++I) {
22902
22927
  const B = A[I - 1].endPoint, k = A[I].startPoint;
22903
22928
  if (!B || !k || !F.areVector2sEqual(B, k)) return !1;
22904
22929
  }
22905
22930
  return !0;
22906
- })(M.edges) || !n.associativity) && (S = u(v), S.length < 2)) {
22931
+ })(M.edges) || !n.associativity) && (E = u(v), E.length < 2)) {
22907
22932
  P.warn("[Dxf] The %dth boundaryPath (hatch handle '%s') has unknown path, ignored!", O, n.handle);
22908
22933
  return;
22909
22934
  }
22910
- S.forEach((_) => {
22935
+ E.forEach((_) => {
22911
22936
  !F.areVector2sEqual(_[0], _[_.length - 1]) && _.push(_[0]);
22912
22937
  const A = _.map((I) => new p.Vector2(U.roundNumber(I.x, 7), U.roundNumber(I.y, 7)));
22913
22938
  if (A?.length > 0) {
@@ -22931,13 +22956,13 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22931
22956
  const y = this.buildContainHierarchyTree(l, h, b), C = [];
22932
22957
  this.buildHatchGeometry(l, y, C);
22933
22958
  let w;
22934
- if (C.length > 0 && (w = Ee(C)), !w || !w.getIndex() || w.getIndex()?.count === 0) return P.warn("[Dxf] Failed to convert hatch boundaries!"), void 0;
22959
+ if (C.length > 0 && (w = Oe(C)), !w || !w.getIndex() || w.getIndex()?.count === 0) return P.warn("[Dxf] Failed to convert hatch boundaries!"), void 0;
22935
22960
  const x = new z(H.Mesh);
22936
22961
  x.geometry = w, x.material = wi, this.setHatchMaterial(x, n, i, f, s);
22937
- const E = x;
22938
- return m && (this.setRTCUserData(E), E.matrix.setPosition(f.x, f.y, 0)), E.traverse((M) => {
22962
+ const S = x;
22963
+ return m && (this.setRTCUserData(S), S.matrix.setPosition(f.x, f.y, 0)), S.traverse((M) => {
22939
22964
  M.layers.enableAll(), M.layers.disable(qe);
22940
- }), E;
22965
+ }), S;
22941
22966
  }
22942
22967
  loadOle2frame(e, i) {
22943
22968
  const {
@@ -22969,19 +22994,19 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22969
22994
  for (let w = 0; w < i.objects.XRECORD.length; w++) {
22970
22995
  const x = i.objects.XRECORD[w];
22971
22996
  if (x.handle === b) {
22972
- const E = x.binaryData, M = U.hexToBase64(E), O = "data:image/jpg;base64," + M, S = new p.TextureLoader(this.manager).load(O);
22973
- S.colorSpace = p.SRGBColorSpace;
22997
+ const S = x.binaryData, M = U.hexToBase64(S), O = "data:image/jpg;base64," + M, E = new p.TextureLoader(this.manager).load(O);
22998
+ E.colorSpace = p.SRGBColorSpace;
22974
22999
  const v = new p.MeshBasicMaterial({
22975
23000
  transparent: !0,
22976
- map: S
23001
+ map: E
22977
23002
  });
22978
23003
  this.meshTextureMaterials[b] = v, C = v;
22979
23004
  break;
22980
23005
  }
22981
23006
  }
22982
23007
  if (C) {
22983
- const w = new p.Box2().setFromPoints(o), x = w.getSize(ts), E = new p.PlaneGeometry(x.x, x.y), M = new z(H.Mesh);
22984
- M.geometry = E, M.material = C;
23008
+ const w = new p.Box2().setFromPoints(o), x = w.getSize(ts), S = new p.PlaneGeometry(x.x, x.y), M = new z(H.Mesh);
23009
+ M.geometry = S, M.material = C;
22985
23010
  const O = w.getCenter(ts);
22986
23011
  V.set(O.x, O.y, 0), h && (this.setRTCUserData(M), V.x += l.x, V.y += l.y), M.matrix.setPosition(V), M.layers.enableAll(), m.add(M);
22987
23012
  }
@@ -23123,7 +23148,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23123
23148
  const r = e;
23124
23149
  if (!r.geometry || (this.setRenderOrderByObjectType(e), i.type === "OLE2FRAME")) return;
23125
23150
  if (i.type === "MTEXT") {
23126
- e.renderOrder = Be.Text;
23151
+ e.renderOrder = Me.Text;
23127
23152
  return;
23128
23153
  }
23129
23154
  if (i.type === "HATCH") {
@@ -23133,12 +23158,12 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23133
23158
  if (i.type === "IMAGE") return;
23134
23159
  let a;
23135
23160
  const o = this.getColor(i, s, n);
23136
- if (i.type === "LWPOLYLINE" && (r.isMesh ? (a = this.getMeshBasicMaterial(o), e.renderOrder = Be.LineWithWidth) : e.userData.isOutline && (a = this.getLineBasicMaterial(o), e.renderOrder = Be.LineWithPattern), a)) {
23161
+ if (i.type === "LWPOLYLINE" && (r.isMesh ? (a = this.getMeshBasicMaterial(o), e.renderOrder = Me.LineWithWidth) : e.userData.isOutline && (a = this.getLineBasicMaterial(o), e.renderOrder = Me.LineWithPattern), a)) {
23137
23162
  r.material = a;
23138
23163
  return;
23139
23164
  }
23140
23165
  if (i.type === "SOLID") a = this.getMeshBasicMaterial(o);
23141
- else if (i.type === "TEXT" || i.type === "ATTDEF" || i.type === "ATTRIB") a = this.getLineBasicMaterial(o), e.renderOrder = Be.Text;
23166
+ else if (i.type === "TEXT" || i.type === "ATTDEF" || i.type === "ATTRIB") a = this.getLineBasicMaterial(o), e.renderOrder = Me.Text;
23142
23167
  else if (i.type === "LEADER" || i.type === "MULTILEADER" || i.type === "VIEWPORT") a = this.getLineBasicMaterial(o);
23143
23168
  else if (i.type === "POINT") a = this.getPointsMaterial(o);
23144
23169
  else {
@@ -23149,7 +23174,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23149
23174
  const l = s.tables?.lineType?.lineTypes, h = l && l[this.getLineType(i, s, n)];
23150
23175
  if (h && h.pattern && h.pattern.length !== 0) {
23151
23176
  const d = i.lineTypeScale || 1;
23152
- a = this.getLineShaderMaterial(h, o, d), e.renderOrder = Be.LineWithPattern;
23177
+ a = this.getLineShaderMaterial(h, o, d), e.renderOrder = Me.LineWithPattern;
23153
23178
  } else a = this.getLineBasicMaterial(o);
23154
23179
  }
23155
23180
  r.material = a;
@@ -23166,7 +23191,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23166
23191
  a.material = this.getLineBasicMaterial(o);
23167
23192
  return;
23168
23193
  }
23169
- let l = Be.Mesh, h;
23194
+ let l = Me.Mesh, h;
23170
23195
  if (i.solidFill) h = this.getMeshBasicMaterial(o);
23171
23196
  else {
23172
23197
  if (a.material instanceof p.ShaderMaterial) {
@@ -23174,9 +23199,9 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23174
23199
  const d = new p.Color(o);
23175
23200
  !a.material.uniforms.u_color.value.equals(d) && (h = a.material.clone(), j.updateMaterialUniforms(h), h.uniforms.u_color.value.set(o));
23176
23201
  } else h = this.getHatchShaderMaterial(i, o, n);
23177
- l = Be.MeshWithPattern;
23202
+ l = Me.MeshWithPattern;
23178
23203
  }
23179
- !h && (h = this.getMeshBasicMaterial(o), l = Be.Mesh), a.material = h, a.renderOrder = l;
23204
+ !h && (h = this.getMeshBasicMaterial(o), l = Me.Mesh), a.material = h, a.renderOrder = l;
23180
23205
  }
23181
23206
  /**
23182
23207
  * 说明:isMesh/isLine/isPoints 仅存在于 THREE.Object3D 上,DxfObject 运行期恒为 undefined
@@ -23185,7 +23210,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23185
23210
  setRenderOrderByObjectType(e) {
23186
23211
  const i = e;
23187
23212
  let s = 0;
23188
- i.isMesh ? s = Be.Mesh : i.isLine ? s = Be.Line : i.isPoints && (s = Be.Point), e.renderOrder = s;
23213
+ i.isMesh ? s = Me.Mesh : i.isLine ? s = Me.Line : i.isPoints && (s = Me.Point), e.renderOrder = s;
23189
23214
  }
23190
23215
  getPointsMaterial(e) {
23191
23216
  return !this.pointsMaterials[e] && (this.pointsMaterials[e] = new p.PointsMaterial({
@@ -23231,20 +23256,20 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23231
23256
  const T = f.dashPattern[v];
23232
23257
  T > 0 && (C = !1), w += Math.abs(T);
23233
23258
  }
23234
- const x = C ? a : r, E = [], M = [];
23259
+ const x = C ? a : r, S = [], M = [];
23235
23260
  let O = 0;
23236
23261
  M[0] = O;
23237
23262
  for (let v = 0; v < y; ++v)
23238
- E[v] = f.dashPattern[v], E[v] === 0 && (E[v] = x * w), O += Math.abs(E[v]), M[v + 1] = O;
23263
+ S[v] = f.dashPattern[v], S[v] === 0 && (S[v] = x * w), O += Math.abs(S[v]), M[v + 1] = O;
23239
23264
  for (let v = y; v < o; ++v)
23240
- E[v] = 0;
23265
+ S[v] = 0;
23241
23266
  for (let v = M.length; v < o + 1; ++v)
23242
23267
  M[v] = O;
23243
- const S = {
23268
+ const E = {
23244
23269
  origin: m,
23245
23270
  delta: b,
23246
23271
  angle: f.angle - e.patternAngle,
23247
- pattern: E,
23272
+ pattern: S,
23248
23273
  patternSum: M,
23249
23274
  patternLength: O
23250
23275
  };
@@ -23252,7 +23277,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23252
23277
  P.warn("[Dxf] There will be warning in fragment shader when number of uniforms exceeds 1024, so extra hatch line patterns are ignored here!");
23253
23278
  break;
23254
23279
  }
23255
- h.push(S);
23280
+ h.push(E);
23256
23281
  }
23257
23282
  const u = ed(h, e.patternAngle, j.CameraZoomUniform, new p.Color(i), this.overrideHatchPatternLineThickness);
23258
23283
  return u.defines = {
@@ -23377,9 +23402,9 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23377
23402
  regions: [o(e[y])],
23378
23403
  inverted: !1
23379
23404
  }), x = Yt.combine(b, w);
23380
- d = Yt.polygon(Yt.selectUnion(x)), d.regions.length > 0 ? d.regions.forEach((E) => {
23381
- if (E.length === 0) return;
23382
- const M = E.map((O) => new p.Vector2(O[0], O[1]));
23405
+ d = Yt.polygon(Yt.selectUnion(x)), d.regions.length > 0 ? d.regions.forEach((S) => {
23406
+ if (S.length === 0) return;
23407
+ const M = S.map((O) => new p.Vector2(O[0], O[1]));
23383
23408
  h.holes.push(new p.Path(M));
23384
23409
  }) : P.warn("[Dxf] mergedHoles.regions is empty");
23385
23410
  }
@@ -23664,7 +23689,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23664
23689
  }), m[x].children.push(y);
23665
23690
  }
23666
23691
  for (const y in m) {
23667
- const C = m[y], w = Dt.deepMerge(C.children, C.object, !1, !1, !0), x = w.added, E = w.removed;
23692
+ const C = m[y], w = Dt.deepMerge(C.children, C.object, !1, !1, !0), x = w.added, S = w.removed;
23668
23693
  !s[y] && (s[y] = {
23669
23694
  object: C.object,
23670
23695
  children: []
@@ -23672,26 +23697,26 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23672
23697
  object: C.object,
23673
23698
  children: []
23674
23699
  });
23675
- const M = E.length > r;
23700
+ const M = S.length > r;
23676
23701
  if (M) {
23677
23702
  const O = Date.now();
23678
- j.removeEmptyObjectsFromRemovingMarkedObjects2(E, C.object), o += Date.now() - O;
23679
- } else a += E.length;
23680
- if (E.length === C.children.length) !M && E.forEach((O) => {
23703
+ j.removeEmptyObjectsFromRemovingMarkedObjects2(S, C.object), o += Date.now() - O;
23704
+ } else a += S.length;
23705
+ if (S.length === C.children.length) !M && S.forEach((O) => {
23681
23706
  s[y].children.push(O);
23682
23707
  });
23683
23708
  else {
23684
- let O = E;
23685
- E.length >= 100 && (O = new Set(E));
23686
- const S = (v) => Array.isArray(O) ? O.indexOf(v) >= 0 : O.has(v);
23709
+ let O = S;
23710
+ S.length >= 100 && (O = new Set(S));
23711
+ const E = (v) => Array.isArray(O) ? O.indexOf(v) >= 0 : O.has(v);
23687
23712
  for (let v = 0; v < C.children.length; v++) {
23688
23713
  const T = C.children[v];
23689
- S(T) ? !M && s[y].children.push(T) : b.push(T);
23714
+ E(T) ? !M && s[y].children.push(T) : b.push(T);
23690
23715
  }
23691
23716
  }
23692
23717
  for (let O = 0; O < x.length; O++) {
23693
- const S = x[O];
23694
- b.push(S), n[y].children.push(S);
23718
+ const E = x[O];
23719
+ b.push(E), n[y].children.push(E);
23695
23720
  }
23696
23721
  a > r && l();
23697
23722
  }
@@ -23731,13 +23756,13 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23731
23756
  await s(++m / f * 100);
23732
23757
  continue;
23733
23758
  }
23734
- const w = Date.now(), x = {}, E = [];
23735
- for (const S of C) {
23736
- if (S.userData.isSnapObject) {
23737
- E.push(S);
23759
+ const w = Date.now(), x = {}, S = [];
23760
+ for (const E of C) {
23761
+ if (E.userData.isSnapObject) {
23762
+ S.push(E);
23738
23763
  continue;
23739
23764
  }
23740
- let v, T = S;
23765
+ let v, T = E;
23741
23766
  for (; T; ) {
23742
23767
  if (T.userData.isLayoutLevelObject) {
23743
23768
  v = T;
@@ -23750,21 +23775,21 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23750
23775
  !x[_] && (x[_] = {
23751
23776
  object: v,
23752
23777
  children: []
23753
- }), x[_].children.push(S);
23778
+ }), x[_].children.push(E);
23754
23779
  }
23755
23780
  const M = Object.keys(x).length;
23756
23781
  let O = 0;
23757
- for (const S in x) {
23782
+ for (const E in x) {
23758
23783
  let v;
23759
- if (S !== j.MODEL_LAYOUT_NAME) {
23760
- const k = n[S];
23784
+ if (E !== j.MODEL_LAYOUT_NAME) {
23785
+ const k = n[E];
23761
23786
  !k.directAssociatedLeafObjectSet && (k.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), v = k.directAssociatedLeafObjectSet;
23762
23787
  }
23763
- const T = x[S], _ = ye.deepMerge(T.children, T.object, !1, !1, !0), A = _.added, I = _.removed;
23764
- !a[S] && (a[S] = {
23788
+ const T = x[E], _ = ye.deepMerge(T.children, T.object, !1, !1, !0), A = _.added, I = _.removed;
23789
+ !a[E] && (a[E] = {
23765
23790
  object: T.object,
23766
23791
  children: []
23767
- }), !o[S] && (o[S] = {
23792
+ }), !o[E] && (o[E] = {
23768
23793
  object: T.object,
23769
23794
  children: []
23770
23795
  });
@@ -23774,7 +23799,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23774
23799
  j.removeEmptyObjectsFromRemovingMarkedObjects(I, T.object), d += Date.now() - k;
23775
23800
  } else h += I.length;
23776
23801
  if (I.length === T.children.length) !B && I.forEach((k) => {
23777
- a[S].children.push(k);
23802
+ a[E].children.push(k);
23778
23803
  });
23779
23804
  else {
23780
23805
  let k = I;
@@ -23782,25 +23807,25 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23782
23807
  const D = (R) => Array.isArray(k) ? k.indexOf(R) >= 0 : k.has(R);
23783
23808
  for (let R = 0; R < T.children.length; R++) {
23784
23809
  const ie = T.children[R];
23785
- D(ie) ? !B && a[S].children.push(ie) : (E.push(ie), v && v.add(ie));
23810
+ D(ie) ? !B && a[E].children.push(ie) : (S.push(ie), v && v.add(ie));
23786
23811
  }
23787
23812
  }
23788
23813
  for (let k = 0; k < A.length; k++) {
23789
23814
  const D = A[k];
23790
- Q.setSharedVariablesOfObject(D), E.push(D), o[S].children.push(D), v && v.add(D);
23815
+ Q.setSharedVariablesOfObject(D), S.push(D), o[E].children.push(D), v && v.add(D);
23791
23816
  }
23792
23817
  h > l && u(), await s((m + ++O / M) / f * 100);
23793
23818
  }
23794
- await s(++m / f * 100), e.layersAndThreejsObjects[y] = E, P.debug("[Dxf] Merged layer '" + y + "' in " + (Date.now() - w) / 1e3 + "s");
23819
+ await s(++m / f * 100), e.layersAndThreejsObjects[y] = S, P.debug("[Dxf] Merged layer '" + y + "' in " + (Date.now() - w) / 1e3 + "s");
23795
23820
  }
23796
23821
  h > 0 && u();
23797
23822
  for (const y in o) {
23798
23823
  const C = o[y], w = e.threejsObject.children.find((x) => x.name === y);
23799
23824
  if (w) {
23800
- const x = w.children.find((E) => E.name === j.SNAP_GROUP_NAME);
23825
+ const x = w.children.find((S) => S.name === j.SNAP_GROUP_NAME);
23801
23826
  if (x && y !== j.MODEL_LAYOUT_NAME) {
23802
- const E = n[y];
23803
- !E.directAssociatedLeafObjectSet && (E.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), x.children.forEach((M) => E.directAssociatedLeafObjectSet?.add(M));
23827
+ const S = n[y];
23828
+ !S.directAssociatedLeafObjectSet && (S.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), x.children.forEach((M) => S.directAssociatedLeafObjectSet?.add(M));
23804
23829
  }
23805
23830
  }
23806
23831
  !w && e.threejsObject.add(C.object), C.children.forEach((x) => {
@@ -24156,9 +24181,9 @@ class ys extends Or {
24156
24181
  n ? n.forEach((r) => {
24157
24182
  const a = r;
24158
24183
  if (a.material) {
24159
- !a.userData.originalMaterial && (a.userData.originalMaterial = Me.cloneMaterial(a.material));
24160
- const o = Me.cloneMaterial(a.material);
24161
- Me.setMaterialOpacity(o, i), X.updateMaterialUniforms(o), a.material = o;
24184
+ !a.userData.originalMaterial && (a.userData.originalMaterial = Te.cloneMaterial(a.material));
24185
+ const o = Te.cloneMaterial(a.material);
24186
+ Te.setMaterialOpacity(o, i), X.updateMaterialUniforms(o), a.material = o;
24162
24187
  }
24163
24188
  }) : P.info("[Viewer] No object found for layer '" + e + "'");
24164
24189
  }
@@ -24171,9 +24196,9 @@ class ys extends Or {
24171
24196
  n ? n.forEach((r) => {
24172
24197
  const a = r;
24173
24198
  if (a.material) {
24174
- !a.userData.originalMaterial && (a.userData.originalMaterial = Me.cloneMaterial(a.material));
24175
- const o = Me.cloneMaterial(a.material);
24176
- Me.setMaterialColor(o, new p.Color(i)), X.updateMaterialUniforms(o), a.material = o;
24199
+ !a.userData.originalMaterial && (a.userData.originalMaterial = Te.cloneMaterial(a.material));
24200
+ const o = Te.cloneMaterial(a.material);
24201
+ Te.setMaterialColor(o, new p.Color(i)), X.updateMaterialUniforms(o), a.material = o;
24177
24202
  }
24178
24203
  }) : P.info("[Viewer] No object found for layer '" + e + "'");
24179
24204
  }
@@ -24292,12 +24317,12 @@ class ys extends Or {
24292
24317
  }
24293
24318
  }), w.add(_);
24294
24319
  }), C && C.size === 0) return;
24295
- const E = s.getModelObject();
24320
+ const S = s.getModelObject();
24296
24321
  let M = s.getLayoutLevelObject(e);
24297
- !M && (M = new p.Group(), Q.setSharedVariablesOfObject(M), M.name = e, E?.add(M)), M.add(w), w.applyMatrix4(r.msToPsMatrix), w.updateMatrixWorld(!0);
24322
+ !M && (M = new p.Group(), Q.setSharedVariablesOfObject(M), M.name = e, S?.add(M)), M.add(w), w.applyMatrix4(r.msToPsMatrix), w.updateMatrixWorld(!0);
24298
24323
  let O = M.children.find((T) => T.name === X.SNAP_GROUP_NAME);
24299
24324
  !O && (O = new p.Group(), O.visible = X.SHOW_SNAP_OBJECT, O.name = X.SNAP_GROUP_NAME, M.add(O));
24300
- const S = s.getLayoutLevelObject(X.MODEL_LAYOUT_NAME), v = S?.children.find((T) => T.name === X.SNAP_GROUP_NAME);
24325
+ const E = s.getLayoutLevelObject(X.MODEL_LAYOUT_NAME), v = E?.children.find((T) => T.name === X.SNAP_GROUP_NAME);
24301
24326
  v && v.traverse((T) => {
24302
24327
  if (!T.geometry) return;
24303
24328
  const _ = T.userData.layerName;
@@ -24427,7 +24452,7 @@ class ys extends Or {
24427
24452
  */
24428
24453
  highlightObject(e) {
24429
24454
  if (!this.hasObject(e)) return;
24430
- const i = Me.clonedHighlightMaterials(e, {
24455
+ const i = Te.clonedHighlightMaterials(e, {
24431
24456
  depthTest: !1
24432
24457
  // 禁用深度测试,确保高亮层显示在最前面
24433
24458
  });
@@ -24582,14 +24607,14 @@ class Lo extends Or {
24582
24607
  const r = this.createInstanceMeshById(e, s, {
24583
24608
  depthTest: !1
24584
24609
  });
24585
- r.material.opacity = 0.7, Me.setMaterialColor(r.material, n), e.userData.instanceId = s, e.userData.clonedMesh = r, this.highlighUsage.add(r);
24610
+ r.material.opacity = 0.7, Te.setMaterialColor(r.material, n), e.userData.instanceId = s, e.userData.clonedMesh = r, this.highlighUsage.add(r);
24586
24611
  } else if (ye.isMergedMesh(e) && i) {
24587
24612
  const r = this.createBatchMeshById(e, i, {
24588
24613
  depthTest: !1
24589
24614
  });
24590
- r.material.opacity = 0.7, Me.setMaterialColor(r.material, n), e.userData.batchId = i, e.userData.clonedMesh = r, this.highlighUsage.add(r);
24615
+ r.material.opacity = 0.7, Te.setMaterialColor(r.material, n), e.userData.batchId = i, e.userData.clonedMesh = r, this.highlighUsage.add(r);
24591
24616
  } else {
24592
- const r = Me.clonedHighlightMaterials(e, {
24617
+ const r = Te.clonedHighlightMaterials(e, {
24593
24618
  depthTest: !1
24594
24619
  });
24595
24620
  r && (e.userData.originalMaterial = e.material, e.material = r);
@@ -24646,7 +24671,7 @@ class Lo extends Or {
24646
24671
  a += " batchId: " + i + ", object name: " + r?.name, r?.userData && (a += `
24647
24672
  userData: ` + JSON.stringify(r.userData)), r?.parentUserData && (a += `
24648
24673
  parentUserData: ` + JSON.stringify(r.parentUserData)), P.info(a);
24649
- const o = Me.cloneMaterial(e.material);
24674
+ const o = Te.cloneMaterial(e.material);
24650
24675
  o.opacity = s, o.transparent = s < 1, !n && (o.depthTest = n, o.depthWrite = n, o.side = p.DoubleSide);
24651
24676
  const l = ye.cloneGeometryForBatch(e, r), h = new p.Mesh(l, o);
24652
24677
  return h.applyMatrix4(e.matrixWorld), h.matrixWorldNeedsUpdate = !0, h.name = "Cloned mesh for highlighting", h.layers.enableAll(), h;
@@ -24654,7 +24679,7 @@ parentUserData: ` + JSON.stringify(r.parentUserData)), P.info(a);
24654
24679
  createInstanceMeshById(e, i, { opacity: s = 1, depthTest: n = !0 }) {
24655
24680
  const r = e, a = new p.Matrix4(), o = new p.Matrix4();
24656
24681
  o.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), r.getMatrixAt(i, a);
24657
- const l = Me.cloneMaterial(r.material);
24682
+ const l = Te.cloneMaterial(r.material);
24658
24683
  l.opacity = s, l.transparent = s < 1, !n && (l.depthTest = n, l.depthWrite = n, l.side = p.DoubleSide);
24659
24684
  const h = new p.Mesh(r.geometry.clone(), l);
24660
24685
  h.applyMatrix4(e.matrixWorld.multiply(a)), h.matrixWorldNeedsUpdate = !0, h.name = "Cloned mesh for highlighting", h.layers.enableAll();
@@ -26473,10 +26498,10 @@ class U1 extends El {
26473
26498
  w.instanceMatrix = new p.InstancedBufferAttribute(new Float32Array(l), 16);
26474
26499
  let x = n;
26475
26500
  x.length === 0 && (x = this.getVertexColorArray(f * 3, y?.color)), w.instanceColor = new p.InstancedBufferAttribute(x, 3);
26476
- const E = new p.InstancedMesh(m, this.materialManager?.pickMaterial, f);
26477
- return E.instanceMatrix = new p.InstancedBufferAttribute(new Float32Array(l), 16), {
26501
+ const S = new p.InstancedMesh(m, this.materialManager?.pickMaterial, f);
26502
+ return S.instanceMatrix = new p.InstancedBufferAttribute(new Float32Array(l), 16), {
26478
26503
  mesh: w,
26479
- pickMesh: E,
26504
+ pickMesh: S,
26480
26505
  userIds: h
26481
26506
  };
26482
26507
  }
@@ -26508,16 +26533,16 @@ class U1 extends El {
26508
26533
  )
26509
26534
  ), b && f.setIndex(b), f.applyMatrix4(C);
26510
26535
  } else {
26511
- const { indexStart: C, indexCount: w, positionStart: x, positionCount: E } = o.userData.batchTable.find(
26536
+ const { indexStart: C, indexCount: w, positionStart: x, positionCount: S } = o.userData.batchTable.find(
26512
26537
  (_) => _.userId === d
26513
26538
  ), M = m.itemSize, O = m.array.slice(
26514
26539
  x * M,
26515
- x * M + E * M
26516
- ), S = new p.Float32BufferAttribute(O, M);
26517
- f.setAttribute("position", S);
26540
+ x * M + S * M
26541
+ ), E = new p.Float32BufferAttribute(O, M);
26542
+ f.setAttribute("position", E);
26518
26543
  const v = y.array.slice(
26519
26544
  x,
26520
- x + E
26545
+ x + S
26521
26546
  ), T = new p.Int32BufferAttribute(v, 1);
26522
26547
  if (f.setAttribute("tileObjectId", T), b) {
26523
26548
  const _ = b.array.slice(C, C + w);
@@ -26530,7 +26555,7 @@ class U1 extends El {
26530
26555
  }
26531
26556
  }
26532
26557
  }
26533
- }), P.info("[BimTiles] getGeometryByUserIds took " + (Date.now() - i) / 1e3 + "s"), s.length > 1 ? Ee(s) : s[0];
26558
+ }), P.info("[BimTiles] getGeometryByUserIds took " + (Date.now() - i) / 1e3 + "s"), s.length > 1 ? Oe(s) : s[0];
26534
26559
  }
26535
26560
  parseTile(e, i, s) {
26536
26561
  this.onBeforeParseTile && this.onBeforeParseTile(i), i._loadIndex = i._loadIndex || 0, i._loadIndex++;
@@ -27182,14 +27207,14 @@ function Ya(c, t, e, i, s = 1 / 0, n, r) {
27182
27207
  i = Math.max(1e-4, i);
27183
27208
  const a = 2 / i, o = a * n, l = 1 / (1 + o + 0.48 * o * o + 0.235 * o * o * o);
27184
27209
  let h = t.x, d = t.y, u = t.z, f = c.x - h, m = c.y - d, b = c.z - u;
27185
- const y = h, C = d, w = u, x = s * i, E = x * x, M = f * f + m * m + b * b;
27186
- if (M > E) {
27210
+ const y = h, C = d, w = u, x = s * i, S = x * x, M = f * f + m * m + b * b;
27211
+ if (M > S) {
27187
27212
  const D = Math.sqrt(M);
27188
27213
  f = f / D * x, m = m / D * x, b = b / D * x;
27189
27214
  }
27190
27215
  h = c.x - f, d = c.y - m, u = c.z - b;
27191
- const O = (e.x + a * f) * n, S = (e.y + a * m) * n, v = (e.z + a * b) * n;
27192
- e.x = (e.x - a * O) * l, e.y = (e.y - a * S) * l, e.z = (e.z - a * v) * l, r.x = h + (f + O) * l, r.y = d + (m + S) * l, r.z = u + (b + v) * l;
27216
+ const O = (e.x + a * f) * n, E = (e.y + a * m) * n, v = (e.z + a * b) * n;
27217
+ e.x = (e.x - a * O) * l, e.y = (e.y - a * E) * l, e.z = (e.z - a * v) * l, r.x = h + (f + O) * l, r.y = d + (m + E) * l, r.z = u + (b + v) * l;
27193
27218
  const T = y - c.x, _ = C - c.y, A = w - c.z, I = r.x - y, B = r.y - C, k = r.z - w;
27194
27219
  return T * I + _ * B + A * k > 0 && (r.x = y, r.y = C, r.z = w, e.x = (r.x - y) / n, e.y = (r.y - C) / n, e.z = (r.z - w) / n), r;
27195
27220
  }
@@ -27450,23 +27475,23 @@ class $ extends W1 {
27450
27475
  right: 0,
27451
27476
  top: 0,
27452
27477
  bottom: 0
27453
- }, this._activePointers = [], this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new W.Vector3(), this._focalOffsetVelocity = new W.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (x, E, M) => {
27478
+ }, this._activePointers = [], this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new W.Vector3(), this._focalOffsetVelocity = new W.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (x, S, M) => {
27454
27479
  if (rt(this._camera)) {
27455
- const O = Y.copy(this._camera.position).sub(this._target), S = this._camera.getEffectiveFOV() * is, v = O.length() * Math.tan(S * 0.5), T = this.truckSpeed * x * v / this._elementRect.height, _ = this.truckSpeed * E * v / this._elementRect.height;
27480
+ const O = Y.copy(this._camera.position).sub(this._target), E = this._camera.getEffectiveFOV() * is, v = O.length() * Math.tan(E * 0.5), T = this.truckSpeed * x * v / this._elementRect.height, _ = this.truckSpeed * S * v / this._elementRect.height;
27456
27481
  this.verticalDragToForward ? (M ? this.setFocalOffset(this._focalOffsetEnd.x + T, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(T, 0, !0), this.forward(-_, !0)) : M ? this.setFocalOffset(this._focalOffsetEnd.x + T, this._focalOffsetEnd.y + _, this._focalOffsetEnd.z, !0) : this.truck(T, _, !0);
27457
27482
  } else if (Ue(this._camera)) {
27458
- const O = this._camera, S = this.truckSpeed * x * (O.right - O.left) / O.zoom / this._elementRect.width, v = this.truckSpeed * E * (O.top - O.bottom) / O.zoom / this._elementRect.height;
27459
- M ? this.setFocalOffset(this._focalOffsetEnd.x + S, this._focalOffsetEnd.y + v, this._focalOffsetEnd.z, !0) : this.truck(S, v, !0);
27483
+ const O = this._camera, E = this.truckSpeed * x * (O.right - O.left) / O.zoom / this._elementRect.width, v = this.truckSpeed * S * (O.top - O.bottom) / O.zoom / this._elementRect.height;
27484
+ M ? this.setFocalOffset(this._focalOffsetEnd.x + E, this._focalOffsetEnd.y + v, this._focalOffsetEnd.z, !0) : this.truck(E, v, !0);
27460
27485
  }
27461
- }, this._rotateInternal = (x, E) => {
27462
- const M = Mi * this.azimuthRotateSpeed * x / this._elementRect.height, O = Mi * this.polarRotateSpeed * E / this._elementRect.height;
27486
+ }, this._rotateInternal = (x, S) => {
27487
+ const M = Mi * this.azimuthRotateSpeed * x / this._elementRect.height, O = Mi * this.polarRotateSpeed * S / this._elementRect.height;
27463
27488
  this.rotate(M, O, !0);
27464
- }, this._dollyInternal = (x, E, M) => {
27465
- const O = Math.pow(0.95, -x * this.dollySpeed), S = this._sphericalEnd.radius * O, v = this._sphericalEnd.radius, T = v * (x >= 0 ? -1 : 1);
27466
- this.dollyTo(S), this.infinityDolly && (S < this.minDistance || this.maxDistance === this.minDistance) && (this._camera.getWorldDirection(Y), this._targetEnd.add(Y.normalize().multiplyScalar(T)), this._target.add(Y.normalize().multiplyScalar(T))), this.dollyToCursor && (this._dollyControlAmount += this._sphericalEnd.radius - v, this.infinityDolly && (S < this.minDistance || this.maxDistance === this.minDistance) && (this._dollyControlAmount -= T), this._dollyControlCoord.set(E, M));
27467
- }, this._zoomInternal = (x, E, M) => {
27468
- const O = Math.pow(0.95, x * this.dollySpeed), S = this._zoomEnd;
27469
- this.zoomTo(this._zoom * O), this.dollyToCursor && (this._dollyControlAmount += this._zoomEnd - S, this._dollyControlCoord.set(E, M));
27489
+ }, this._dollyInternal = (x, S, M) => {
27490
+ const O = Math.pow(0.95, -x * this.dollySpeed), E = this._sphericalEnd.radius * O, v = this._sphericalEnd.radius, T = v * (x >= 0 ? -1 : 1);
27491
+ this.dollyTo(E), this.infinityDolly && (E < this.minDistance || this.maxDistance === this.minDistance) && (this._camera.getWorldDirection(Y), this._targetEnd.add(Y.normalize().multiplyScalar(T)), this._target.add(Y.normalize().multiplyScalar(T))), this.dollyToCursor && (this._dollyControlAmount += this._sphericalEnd.radius - v, this.infinityDolly && (E < this.minDistance || this.maxDistance === this.minDistance) && (this._dollyControlAmount -= T), this._dollyControlCoord.set(S, M));
27492
+ }, this._zoomInternal = (x, S, M) => {
27493
+ const O = Math.pow(0.95, x * this.dollySpeed), E = this._zoomEnd;
27494
+ this.zoomTo(this._zoom * O), this.dollyToCursor && (this._dollyControlAmount += this._zoomEnd - E, this._dollyControlCoord.set(S, M));
27470
27495
  }, typeof W > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = e, this._yAxisUpSpace = new W.Quaternion().setFromUnitVectors(this._camera.up, Ys), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = L.NONE, this._target = new W.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new W.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new W.Spherical().setFromVector3(Y.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._nearPlaneCorners = [new W.Vector3(), new W.Vector3(), new W.Vector3(), new W.Vector3()], this._updateNearPlaneCorners(), this._boundary = new W.Box3(new W.Vector3(-1 / 0, -1 / 0, -1 / 0), new W.Vector3(1 / 0, 1 / 0, 1 / 0)), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlAmount = 0, this._dollyControlCoord = new W.Vector2(), this.mouseButtons = {
27471
27496
  left: L.ROTATE,
27472
27497
  middle: L.DOLLY,
@@ -27479,9 +27504,9 @@ class $ extends W1 {
27479
27504
  };
27480
27505
  const s = new W.Vector2(), n = new W.Vector2(), r = new W.Vector2(), a = (x) => {
27481
27506
  if (!this._enabled || !this._domElement) return;
27482
- const E = x.pointerType !== "mouse" ? null : (x.buttons & q.LEFT) === q.LEFT ? q.LEFT : (x.buttons & q.MIDDLE) === q.MIDDLE ? q.MIDDLE : (x.buttons & q.RIGHT) === q.RIGHT ? q.RIGHT : null;
27483
- if (E !== null) {
27484
- const O = this._findPointerByMouseButton(E);
27507
+ const S = x.pointerType !== "mouse" ? null : (x.buttons & q.LEFT) === q.LEFT ? q.LEFT : (x.buttons & q.MIDDLE) === q.MIDDLE ? q.MIDDLE : (x.buttons & q.RIGHT) === q.RIGHT ? q.RIGHT : null;
27508
+ if (S !== null) {
27509
+ const O = this._findPointerByMouseButton(S);
27485
27510
  O && this._activePointers.splice(this._activePointers.indexOf(O), 1);
27486
27511
  }
27487
27512
  const M = {
@@ -27490,14 +27515,14 @@ class $ extends W1 {
27490
27515
  clientY: x.clientY,
27491
27516
  deltaX: 0,
27492
27517
  deltaY: 0,
27493
- mouseButton: E
27518
+ mouseButton: S
27494
27519
  };
27495
27520
  this._activePointers.push(M), this._domElement.removeEventListener("pointermove", l), this._domElement.removeEventListener("pointerup", d), this._domElement.addEventListener("pointermove", l), this._domElement.addEventListener("pointerup", d), y(x);
27496
27521
  }, o = (x) => {
27497
27522
  if (!this._enabled || !this._domElement) return;
27498
- const E = (x.buttons & q.LEFT) === q.LEFT ? q.LEFT : (x.buttons & q.MIDDLE) === q.MIDDLE ? q.MIDDLE : (x.buttons & q.RIGHT) === q.RIGHT ? q.RIGHT : null;
27499
- if (E !== null) {
27500
- const O = this._findPointerByMouseButton(E);
27523
+ const S = (x.buttons & q.LEFT) === q.LEFT ? q.LEFT : (x.buttons & q.MIDDLE) === q.MIDDLE ? q.MIDDLE : (x.buttons & q.RIGHT) === q.RIGHT ? q.RIGHT : null;
27524
+ if (S !== null) {
27525
+ const O = this._findPointerByMouseButton(S);
27501
27526
  O && this._activePointers.splice(this._activePointers.indexOf(O), 1);
27502
27527
  }
27503
27528
  const M = {
@@ -27510,7 +27535,7 @@ class $ extends W1 {
27510
27535
  };
27511
27536
  this._activePointers.push(M), this._domElement.removeEventListener("mousemove", h), this._domElement.removeEventListener("mouseup", u), this._domElement.addEventListener("mousemove", h), this._domElement.addEventListener("mouseup", u), y(x);
27512
27537
  }, l = (x) => {
27513
- const E = x.pointerId, M = this._findPointerById(E);
27538
+ const S = x.pointerId, M = this._findPointerById(S);
27514
27539
  if (M) {
27515
27540
  if (M.clientX = x.clientX, M.clientY = x.clientY, M.deltaX = x.movementX, M.deltaY = x.movementY, x.pointerType === "touch")
27516
27541
  switch (this._activePointers.length) {
@@ -27529,10 +27554,10 @@ class $ extends W1 {
27529
27554
  C();
27530
27555
  }
27531
27556
  }, h = (x) => {
27532
- const E = this._findPointerById(0);
27533
- E && (E.clientX = x.clientX, E.clientY = x.clientY, E.deltaX = x.movementX, E.deltaY = x.movementY, this._state = 0, (x.buttons & q.LEFT) === q.LEFT && (this._state = this._state | this.mouseButtons.left), (x.buttons & q.MIDDLE) === q.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (x.buttons & q.RIGHT) === q.RIGHT && (this._state = this._state | this.mouseButtons.right), C());
27557
+ const S = this._findPointerById(0);
27558
+ S && (S.clientX = x.clientX, S.clientY = x.clientY, S.deltaX = x.movementX, S.deltaY = x.movementY, this._state = 0, (x.buttons & q.LEFT) === q.LEFT && (this._state = this._state | this.mouseButtons.left), (x.buttons & q.MIDDLE) === q.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (x.buttons & q.RIGHT) === q.RIGHT && (this._state = this._state | this.mouseButtons.right), C());
27534
27559
  }, d = (x) => {
27535
- const E = x.pointerId, M = this._findPointerById(E);
27560
+ const S = x.pointerId, M = this._findPointerById(S);
27536
27561
  if (M && this._activePointers.splice(this._activePointers.indexOf(M), 1), x.pointerType === "touch")
27537
27562
  switch (this._activePointers.length) {
27538
27563
  case 0:
@@ -27562,7 +27587,7 @@ class $ extends W1 {
27562
27587
  const v = performance.now();
27563
27588
  f - v < 1e3 && this._getClientRect(this._elementRect), f = v;
27564
27589
  }
27565
- const E = q1 ? -1 : -3, M = x.deltaMode === 1 ? x.deltaY / E : x.deltaY / (E * 10), O = this.dollyToCursor ? (x.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (x.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27590
+ const S = q1 ? -1 : -3, M = x.deltaMode === 1 ? x.deltaY / S : x.deltaY / (S * 10), O = this.dollyToCursor ? (x.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (x.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27566
27591
  switch (this.mouseButtons.wheel) {
27567
27592
  case L.ROTATE: {
27568
27593
  this._rotateInternal(x.deltaX, x.deltaY), this._isUserControllingRotate = !0;
@@ -27577,26 +27602,26 @@ class $ extends W1 {
27577
27602
  break;
27578
27603
  }
27579
27604
  case L.DOLLY: {
27580
- this._dollyInternal(-M, O, S), this._isUserControllingDolly = !0;
27605
+ this._dollyInternal(-M, O, E), this._isUserControllingDolly = !0;
27581
27606
  break;
27582
27607
  }
27583
27608
  case L.ZOOM: {
27584
- this._zoomInternal(-M, O, S), this._isUserControllingZoom = !0;
27609
+ this._zoomInternal(-M, O, E), this._isUserControllingZoom = !0;
27585
27610
  break;
27586
27611
  }
27587
27612
  }
27588
27613
  this.dispatchEvent({ type: "control" });
27589
27614
  }, b = (x) => {
27590
27615
  if (!(!this._domElement || !this._enabled) && this.mouseButtons.right === $.ACTION.NONE) {
27591
- const E = x instanceof PointerEvent ? x.pointerId : (x instanceof MouseEvent, 0), M = this._findPointerById(E);
27616
+ const S = x instanceof PointerEvent ? x.pointerId : (x instanceof MouseEvent, 0), M = this._findPointerById(S);
27592
27617
  M && this._activePointers.splice(this._activePointers.indexOf(M), 1), this._domElement.removeEventListener("pointermove", l), this._domElement.removeEventListener("pointerup", d), this._domElement.removeEventListener("mousemove", h), this._domElement.removeEventListener("mouseup", u);
27593
27618
  return;
27594
27619
  }
27595
27620
  }, y = (x) => {
27596
27621
  if (!this._enabled) return;
27597
27622
  if (Jn(this._activePointers, Ve), this._getClientRect(this._elementRect), s.copy(Ve), n.copy(Ve), this._activePointers.length >= 2) {
27598
- const M = Ve.x - this._activePointers[1].clientX, O = Ve.y - this._activePointers[1].clientY, S = Math.sqrt(M * M + O * O);
27599
- r.set(0, S);
27623
+ const M = Ve.x - this._activePointers[1].clientX, O = Ve.y - this._activePointers[1].clientY, E = Math.sqrt(M * M + O * O);
27624
+ r.set(0, E);
27600
27625
  const v = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, T = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
27601
27626
  n.set(v, T);
27602
27627
  }
@@ -27618,18 +27643,18 @@ class $ extends W1 {
27618
27643
  }, C = () => {
27619
27644
  if (!this._enabled) return;
27620
27645
  Jn(this._activePointers, Ve);
27621
- const x = Le.isBrowser ? this._domElement && document.pointerLockElement === this._domElement : !1, E = x ? -this._activePointers[0].deltaX : n.x - Ve.x, M = x ? -this._activePointers[0].deltaY : n.y - Ve.y;
27622
- if (n.copy(Ve), ((this._state & L.ROTATE) === L.ROTATE || (this._state & L.TOUCH_ROTATE) === L.TOUCH_ROTATE || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(E, M), this._isUserControllingRotate = !0), (this._state & L.DOLLY) === L.DOLLY || (this._state & L.ZOOM) === L.ZOOM) {
27623
- const O = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27624
- (this._state & L.DOLLY) === L.DOLLY ? (this._dollyInternal(M * qs, O, S), this._isUserControllingDolly = !0) : (this._zoomInternal(M * qs, O, S), this._isUserControllingZoom = !0);
27646
+ const x = Le.isBrowser ? this._domElement && document.pointerLockElement === this._domElement : !1, S = x ? -this._activePointers[0].deltaX : n.x - Ve.x, M = x ? -this._activePointers[0].deltaY : n.y - Ve.y;
27647
+ if (n.copy(Ve), ((this._state & L.ROTATE) === L.ROTATE || (this._state & L.TOUCH_ROTATE) === L.TOUCH_ROTATE || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(S, M), this._isUserControllingRotate = !0), (this._state & L.DOLLY) === L.DOLLY || (this._state & L.ZOOM) === L.ZOOM) {
27648
+ const O = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27649
+ (this._state & L.DOLLY) === L.DOLLY ? (this._dollyInternal(M * qs, O, E), this._isUserControllingDolly = !0) : (this._zoomInternal(M * qs, O, E), this._isUserControllingZoom = !0);
27625
27650
  }
27626
27651
  if ((this._state & L.TOUCH_DOLLY) === L.TOUCH_DOLLY || (this._state & L.TOUCH_ZOOM) === L.TOUCH_ZOOM || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) {
27627
- const O = Ve.x - this._activePointers[1].clientX, S = Ve.y - this._activePointers[1].clientY, v = Math.sqrt(O * O + S * S), T = r.y - v;
27652
+ const O = Ve.x - this._activePointers[1].clientX, E = Ve.y - this._activePointers[1].clientY, v = Math.sqrt(O * O + E * E), T = r.y - v;
27628
27653
  r.set(0, v);
27629
27654
  const _ = this.dollyToCursor ? (n.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, A = this.dollyToCursor ? (n.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27630
27655
  (this._state & L.TOUCH_DOLLY) === L.TOUCH_DOLLY || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(T * qs, _, A), this._isUserControllingDolly = !0) : (this._zoomInternal(T * qs, _, A), this._isUserControllingZoom = !0);
27631
27656
  }
27632
- ((this._state & L.TRUCK) === L.TRUCK || (this._state & L.TOUCH_TRUCK) === L.TOUCH_TRUCK || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK) && (this._truckInternal(E, M, !1), this._isUserControllingTruck = !0), ((this._state & L.OFFSET) === L.OFFSET || (this._state & L.TOUCH_OFFSET) === L.TOUCH_OFFSET || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET) && (this._truckInternal(E, M, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
27657
+ ((this._state & L.TRUCK) === L.TRUCK || (this._state & L.TOUCH_TRUCK) === L.TOUCH_TRUCK || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK) && (this._truckInternal(S, M, !1), this._isUserControllingTruck = !0), ((this._state & L.OFFSET) === L.OFFSET || (this._state & L.TOUCH_OFFSET) === L.TOUCH_OFFSET || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET) && (this._truckInternal(S, M, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
27633
27658
  }, w = () => {
27634
27659
  Jn(this._activePointers, Ve), n.copy(Ve), this._activePointers.length === 0 && this._domElement && (this._domElement.removeEventListener("pointermove", l), this._domElement.removeEventListener("mousemove", h), this._domElement.removeEventListener("pointerup", d), this._domElement.removeEventListener("mouseup", u), this.dispatchEvent({ type: "controlend" }));
27635
27660
  };
@@ -28037,7 +28062,7 @@ class $ extends W1 {
28037
28062
  const x = this.getDistanceToFitBox(C.x, C.y, C.z, s);
28038
28063
  l.push(this.moveTo(w.x, w.y, w.z, i)), l.push(this.dollyTo(x, i)), l.push(this.setFocalOffset(0, 0, 0, i));
28039
28064
  } else if (Ue(this._camera)) {
28040
- const x = this._camera, E = x.right - x.left, M = x.top - x.bottom, O = s ? Math.max(E / C.x, M / C.y) : Math.min(E / C.x, M / C.y);
28065
+ const x = this._camera, S = x.right - x.left, M = x.top - x.bottom, O = s ? Math.max(S / C.x, M / C.y) : Math.min(S / C.x, M / C.y);
28041
28066
  l.push(this.moveTo(w.x, w.y, w.z, i)), l.push(this.zoomTo(O, i)), l.push(this.setFocalOffset(0, 0, 0, i));
28042
28067
  }
28043
28068
  return Promise.all(l);
@@ -28101,14 +28126,14 @@ class $ extends W1 {
28101
28126
  it.setFromVector3(C.sub(y).applyQuaternion(this._yAxisUpSpace));
28102
28127
  const w = Ti.set(d, u, f), x = te.set(o, l, h);
28103
28128
  rs.setFromVector3(x.sub(w).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(y.lerp(w, m));
28104
- const E = rs.theta - it.theta, M = rs.phi - it.phi, O = rs.radius - it.radius;
28129
+ const S = rs.theta - it.theta, M = rs.phi - it.phi, O = rs.radius - it.radius;
28105
28130
  this._sphericalEnd.set(
28106
28131
  it.radius + O * m,
28107
28132
  it.phi + M * m,
28108
- it.theta + E * m
28133
+ it.theta + S * m
28109
28134
  ), this.normalizeRotations(), this._needsUpdate = !0, b || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
28110
- const S = !b || re(this._target.x, this._targetEnd.x, this.restThreshold) && re(this._target.y, this._targetEnd.y, this.restThreshold) && re(this._target.z, this._targetEnd.z, this.restThreshold) && re(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && re(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && re(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
28111
- return this._createOnRestPromise(S);
28135
+ const E = !b || re(this._target.x, this._targetEnd.x, this.restThreshold) && re(this._target.y, this._targetEnd.y, this.restThreshold) && re(this._target.z, this._targetEnd.z, this.restThreshold) && re(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && re(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && re(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
28136
+ return this._createOnRestPromise(E);
28112
28137
  }
28113
28138
  /**
28114
28139
  * Set angle and distance by given position.
@@ -28324,7 +28349,7 @@ class $ extends W1 {
28324
28349
  (u.near + u.far) / (u.near - u.far)
28325
28350
  ).unproject(u), m = te.set(0, 0, -1).applyQuaternion(u.quaternion), b = Ti.copy(f).add(m.multiplyScalar(-f.dot(u.up))), C = -(this._zoom - this._dollyControlAmount - this._zoomEnd) / this._zoom, w = Y.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).normalize().negate(), x = this._targetEnd.dot(w);
28326
28351
  this._targetEnd.lerp(b, C);
28327
- const E = this._targetEnd.dot(w), M = w.multiplyScalar(E - x);
28352
+ const S = this._targetEnd.dot(w), M = w.multiplyScalar(S - x);
28328
28353
  this._targetEnd.sub(M);
28329
28354
  }
28330
28355
  this._target.copy(this._targetEnd), this._boundary.clampPoint(this._targetEnd, this._targetEnd), this._dollyControlAmount = 0;
@@ -28643,7 +28668,7 @@ class K1 {
28643
28668
  const t = document.createElement("div");
28644
28669
  return t.className = "anchor", this.viewerContainer?.appendChild(t), this.cameraControls.addEventListener("control", () => {
28645
28670
  if (this.isOrbitPointVisible()) {
28646
- const e = this.getTarget(), i = Pe.world2Screen(e, this.activeCamera, this.viewerContainer);
28671
+ const e = this.getTarget(), i = Ae.world2Screen(e, this.activeCamera, this.viewerContainer);
28647
28672
  this.setAnchorPosition(i.x, i.y);
28648
28673
  }
28649
28674
  }), t;
@@ -29387,12 +29412,12 @@ const gt = class gt {
29387
29412
  const b = Math.PI / 4;
29388
29413
  let y = b * m, C = gt.CIRCLE_SPAN;
29389
29414
  u < 0 && (C = -C, y = -y);
29390
- const w = b * f, x = w + y, E = s.clone().sub(new p.Vector2(Math.cos(w) * d, Math.sin(w) * d));
29391
- if (s = E.clone().add(new p.Vector2(Math.cos(x) * d, Math.sin(x) * d)), o) {
29415
+ const w = b * f, x = w + y, S = s.clone().sub(new p.Vector2(Math.cos(w) * d, Math.sin(w) * d));
29416
+ if (s = S.clone().add(new p.Vector2(Math.cos(x) * d, Math.sin(x) * d)), o) {
29392
29417
  let M = w;
29393
29418
  const O = !0;
29394
29419
  for (; O && (M += C, !!Number.isFinite(M)); )
29395
- if (u >= 0 && M < x || u < 0 && M > x) r.push(E.clone().add(new p.Vector2(d * Math.cos(M), d * Math.sin(M))));
29420
+ if (u >= 0 && M < x || u < 0 && M > x) r.push(S.clone().add(new p.Vector2(d * Math.cos(M), d * Math.sin(M))));
29396
29421
  else break;
29397
29422
  r.push(s.clone());
29398
29423
  }
@@ -29404,13 +29429,13 @@ const gt = class gt {
29404
29429
  let w = y & 7;
29405
29430
  w == 0 && (w = 8), u != 0 && w--;
29406
29431
  const x = Math.PI / 4;
29407
- let E = x * w, M = gt.CIRCLE_SPAN, O = 1;
29408
- y < 0 && (M = -M, E = -E, O = -1);
29409
- let S = x * C, v = S + E;
29410
- S += x * d / 256 * O, v += x * u / 256 * O;
29411
- const T = s.clone().sub(new p.Vector2(b * Math.cos(S), b * Math.sin(S)));
29432
+ let S = x * w, M = gt.CIRCLE_SPAN, O = 1;
29433
+ y < 0 && (M = -M, S = -S, O = -1);
29434
+ let E = x * C, v = E + S;
29435
+ E += x * d / 256 * O, v += x * u / 256 * O;
29436
+ const T = s.clone().sub(new p.Vector2(b * Math.cos(E), b * Math.sin(E)));
29412
29437
  if (s = T.clone().add(new p.Vector2(b * Math.cos(v), b * Math.sin(v))), o) {
29413
- let _ = S;
29438
+ let _ = E;
29414
29439
  const A = !0;
29415
29440
  for (; A && (_ += M, !!Number.isFinite(_)); )
29416
29441
  if (y > 0 && _ < v || y < 0 && _ > v) r.push(T.clone().add(new p.Vector2(b * Math.cos(_), b * Math.sin(_))));
@@ -30731,14 +30756,14 @@ class U0 {
30731
30756
  const h = Object.values(i);
30732
30757
  for (let d = h.length - 1; d >= 0; --d) {
30733
30758
  const u = h[d].indexes[0], f = t.children[u];
30734
- if (this.geometryEquals(o.geometry, f.geometry) && Me.materialsEquals(o.material, f.material)) {
30759
+ if (this.geometryEquals(o.geometry, f.geometry) && Te.materialsEquals(o.material, f.material)) {
30735
30760
  !i[u] && (i[u] = { indexes: [u] }, this.removeFromArray(s, u)), i[u].indexes.push(a), l = !0;
30736
30761
  break;
30737
30762
  }
30738
30763
  }
30739
30764
  for (let d = s.length - 1; !l && d >= 0; --d) {
30740
30765
  const u = s[d], f = t.children[u];
30741
- if (this.geometryEquals(o.geometry, f.geometry) && Me.materialsEquals(o.material, f.material)) {
30766
+ if (this.geometryEquals(o.geometry, f.geometry) && Te.materialsEquals(o.material, f.material)) {
30742
30767
  !i[u] && (i[u] = { indexes: [u] }, this.removeFromArray(s, u)), i[u].indexes.push(a), l = !0;
30743
30768
  break;
30744
30769
  }
@@ -31580,7 +31605,7 @@ g(ge, "lineColor", "rgba(255, 119, 0, 1)"), g(ge, "FILL_COLOR_NONE", "rgba(0, 0,
31580
31605
  let ke = ge;
31581
31606
  xn._registerDrawableClass(ke);
31582
31607
  var cu = /* @__PURE__ */ ((c) => (c[c.None = 0] = "None", c[c.Vertex = 1] = "Vertex", c[c.MiddlePoint = 2] = "MiddlePoint", c[c.Edge = 4] = "Edge", c[c.Face = 8] = "Face", c[c.FootOfPerpendicular = 16] = "FootOfPerpendicular", c[c.Intersection = 32] = "Intersection", c[c.CircleCenter = 64] = "CircleCenter", c))(cu || {});
31583
- const hu = 1e-5, oe = new p.Vector3(), Se = new p.Vector3(), Vi = new p.Vector3(), hs = new p.Vector3(), ei = new p.Matrix4(), ds = new p.Line3();
31608
+ const hu = 1e-5, oe = new p.Vector3(), Ee = new p.Vector3(), Vi = new p.Vector3(), hs = new p.Vector3(), ei = new p.Matrix4(), ds = new p.Line3();
31584
31609
  function du(c, t) {
31585
31610
  let e = Number.MAX_VALUE, i = 0;
31586
31611
  for (let s = 0; s < c.vertices.length; s++) {
@@ -31620,13 +31645,13 @@ function uu(c) {
31620
31645
  let l = Number.MAX_VALUE, h = 0;
31621
31646
  for (let f = 0; f < o.length; f += 2) {
31622
31647
  const m = o[f], b = o[f + 1];
31623
- oe.set(a[m * 3], a[m * 3 + 1], a[m * 3 + 2]), oe.applyMatrix4(ei), Se.set(a[b * 3], a[b * 3 + 1], a[b * 3 + 2]), Se.applyMatrix4(ei), ds.set(oe, Se), ds.closestPointToPoint(c.point, !0, Vi);
31648
+ oe.set(a[m * 3], a[m * 3 + 1], a[m * 3 + 2]), oe.applyMatrix4(ei), Ee.set(a[b * 3], a[b * 3 + 1], a[b * 3 + 2]), Ee.applyMatrix4(ei), ds.set(oe, Ee), ds.closestPointToPoint(c.point, !0, Vi);
31624
31649
  const y = c.point.distanceTo(Vi);
31625
31650
  y < l && (h = f, l = y, hs.copy(Vi));
31626
31651
  }
31627
31652
  const d = o[h], u = o[h + 1];
31628
- return oe.set(a[d * 3], a[d * 3 + 1], a[d * 3 + 2]), oe.applyMatrix4(ei), Se.set(a[u * 3], a[u * 3 + 1], a[u * 3 + 2]), Se.applyMatrix4(ei), {
31629
- vertices: [oe.clone(), Se.clone()],
31653
+ return oe.set(a[d * 3], a[d * 3 + 1], a[d * 3 + 2]), oe.applyMatrix4(ei), Ee.set(a[u * 3], a[u * 3 + 1], a[u * 3 + 2]), Ee.applyMatrix4(ei), {
31654
+ vertices: [oe.clone(), Ee.clone()],
31630
31655
  vertex: hs.clone(),
31631
31656
  distance: l
31632
31657
  };
@@ -32004,17 +32029,17 @@ class N0 {
32004
32029
  let b = Math.max(0, f.start), y = Math.min(d.count, f.start + f.count);
32005
32030
  m && (b = Math.max(b, m.indexStart), y = Math.min(y, m.indexStart + m.indexCount));
32006
32031
  for (let C = b, w = y; C < w - 1; C += h) {
32007
- const x = d.getX(C), E = d.getX(C + 1);
32008
- oe.fromBufferAttribute(u, x), Se.fromBufferAttribute(u, E), oe.applyMatrix4(l.matrixWorld), Se.applyMatrix4(l.matrixWorld), !i && (oe.setZ(0), Se.setZ(0));
32009
- const M = this.getOsnapInfoFromSegment(t, oe, Se, s, n, r, a);
32032
+ const x = d.getX(C), S = d.getX(C + 1);
32033
+ oe.fromBufferAttribute(u, x), Ee.fromBufferAttribute(u, S), oe.applyMatrix4(l.matrixWorld), Ee.applyMatrix4(l.matrixWorld), !i && (oe.setZ(0), Ee.setZ(0));
32034
+ const M = this.getOsnapInfoFromSegment(t, oe, Ee, s, n, r, a);
32010
32035
  M && (r = this.osnapTypePriorities[M.type], o.push(M));
32011
32036
  }
32012
32037
  } else {
32013
32038
  let b = Math.max(0, f.start), y = Math.min(u.count, f.start + f.count);
32014
32039
  m && (b = Math.max(b, m.positionStart), y = Math.min(y, m.positionStart + m.positionCount));
32015
32040
  for (let C = b, w = y; C < w - 1; C += h) {
32016
- oe.fromBufferAttribute(u, C), Se.fromBufferAttribute(u, C + 1), oe.applyMatrix4(l.matrixWorld), Se.applyMatrix4(l.matrixWorld), !i && (oe.setZ(0), Se.setZ(0));
32017
- const x = this.getOsnapInfoFromSegment(t, oe, Se, s, n, r, a);
32041
+ oe.fromBufferAttribute(u, C), Ee.fromBufferAttribute(u, C + 1), oe.applyMatrix4(l.matrixWorld), Ee.applyMatrix4(l.matrixWorld), !i && (oe.setZ(0), Ee.setZ(0));
32042
+ const x = this.getOsnapInfoFromSegment(t, oe, Ee, s, n, r, a);
32018
32043
  x && (r = this.osnapTypePriorities[x.type], o.push(x));
32019
32044
  }
32020
32045
  }
@@ -32030,8 +32055,8 @@ class N0 {
32030
32055
  /* Vertex */
32031
32056
  ]) return;
32032
32057
  const r = e.object, a = r.geometry.getAttribute("position");
32033
- oe.fromBufferAttribute(a, e.index), oe.applyMatrix4(r.matrixWorld), Se.copy(t), !i && (oe.setZ(0), Se.setZ(0));
32034
- const o = Se.distanceTo(oe);
32058
+ oe.fromBufferAttribute(a, e.index), oe.applyMatrix4(r.matrixWorld), Ee.copy(t), !i && (oe.setZ(0), Ee.setZ(0));
32059
+ const o = Ee.distanceTo(oe);
32035
32060
  if (o > s) return;
32036
32061
  const l = {
32037
32062
  distance: o,
@@ -32115,7 +32140,7 @@ class H0 {
32115
32140
  if (s) {
32116
32141
  let n = s.getBounds();
32117
32142
  n = n.clone().expandByScalar(20 * this.viewer.getPixelSizeInWorldCoord());
32118
- const r = Pe.world2NormalizedScreen(n.min, this.camera, this.viewerContainer), a = Pe.world2NormalizedScreen(n.max, this.camera, this.viewerContainer), o = new p.Box2(
32143
+ const r = Ae.world2NormalizedScreen(n.min, this.camera, this.viewerContainer), a = Ae.world2NormalizedScreen(n.max, this.camera, this.viewerContainer), o = new p.Box2(
32119
32144
  new p.Vector2(Math.min(r.x, a.x), Math.min(r.y, a.y)),
32120
32145
  new p.Vector2(Math.max(r.x, a.x), Math.max(r.y, a.y))
32121
32146
  );
@@ -32620,7 +32645,7 @@ class yu extends hi {
32620
32645
  if (s.timestamp = i.timeStamp, Qs(i, "clientX"))
32621
32646
  if (s.altKey = i.altKey, s.ctrlKey = i.ctrlKey, s.shiftKey = i.shiftKey, s.clientX = i.clientX, s.clientY = i.clientY, s.button = i.button, Qs(i, "pointerId")) {
32622
32647
  s.pointerType = i.pointerType, s.buttons = i.buttons, s.pageX = i.pageX, s.pageY = i.pageY, s.pointerId = i.pointerId;
32623
- const n = Pe.getScreenCoordinateByEvent(i, this.element);
32648
+ const n = Ae.getScreenCoordinateByEvent(i, this.element);
32624
32649
  s.x = n.x, s.y = n.y, s.movementX = i.movementX, s.movementY = i.movementY;
32625
32650
  } else Qs(i, "deltaX") && (s.deltaMode = i.deltaMode, s.deltaX = i.deltaX, s.deltaY = i.deltaY);
32626
32651
  else Qs(i, "code") && (s.altKey = i.altKey, s.ctrlKey = i.ctrlKey, s.shiftKey = i.shiftKey, s.metaKey = i.metaKey, s.code = i.code);
@@ -32710,9 +32735,9 @@ class xu {
32710
32735
  * @param {* @param {Number} [radius=0] - 容差半径(像素),默认为 0 表示绝对精准的单点拾取}
32711
32736
  */
32712
32737
  pickObjects(t, e, i, s = 0) {
32713
- const n = Pe.screen2Ndc(t, this.camera, this.viewerContainer);
32738
+ const n = Ae.screen2Ndc(t, this.camera, this.viewerContainer);
32714
32739
  if (s > 0) {
32715
- const r = [], a = /* @__PURE__ */ new Map(), o = Pe.screen2Ndc(t, this.camera, this.viewerContainer), l = Pe.screen2Ndc(
32740
+ const r = [], a = /* @__PURE__ */ new Map(), o = Ae.screen2Ndc(t, this.camera, this.viewerContainer), l = Ae.screen2Ndc(
32716
32741
  { x: t.x + s, y: t.y },
32717
32742
  this.camera,
32718
32743
  this.viewerContainer
@@ -32720,14 +32745,14 @@ class xu {
32720
32745
  this.raycaster.params.Line.threshold = u, this.setLayerChannels(i);
32721
32746
  const m = 8;
32722
32747
  for (let y = 0; y < m; y++) {
32723
- const C = y / m * Math.PI * 2, w = Math.cos(C) * s, x = Math.sin(C) * s, E = {
32748
+ const C = y / m * Math.PI * 2, w = Math.cos(C) * s, x = Math.sin(C) * s, S = {
32724
32749
  x: t.x + w,
32725
32750
  y: t.y + x
32726
- }, M = Pe.screen2Ndc(E, this.camera, this.viewerContainer);
32751
+ }, M = Ae.screen2Ndc(S, this.camera, this.viewerContainer);
32727
32752
  this.raycaster.setFromCamera(M, this.camera), this.raycaster.layers.enableAll();
32728
32753
  const O = this.raycaster.intersectObjects(e, !0) || [];
32729
- for (const S of O)
32730
- S.object && !a.has(S.object.uuid) && (a.set(S.object.uuid, S), r.push(S));
32754
+ for (const E of O)
32755
+ E.object && !a.has(E.object.uuid) && (a.set(E.object.uuid, E), r.push(E));
32731
32756
  }
32732
32757
  this.raycaster.setFromCamera(o, this.camera);
32733
32758
  const b = this.raycaster.intersectObjects(e, !0) || [];
@@ -32736,8 +32761,8 @@ class xu {
32736
32761
  if (this.raycaster.params.Line.threshold = f, r.length > 1) {
32737
32762
  const y = this.raycaster.ray.origin.clone();
32738
32763
  r.sort((C, w) => {
32739
- const x = C.point || C.object.getWorldPosition(new p.Vector3()), E = w.point || w.object.getWorldPosition(new p.Vector3());
32740
- return x.distanceTo(y) - E.distanceTo(y);
32764
+ const x = C.point || C.object.getWorldPosition(new p.Vector3()), S = w.point || w.object.getWorldPosition(new p.Vector3());
32765
+ return x.distanceTo(y) - S.distanceTo(y);
32741
32766
  });
32742
32767
  }
32743
32768
  return r;
@@ -34008,7 +34033,7 @@ class $o extends Pr {
34008
34033
  * @internal
34009
34034
  */
34010
34035
  getHitResult(e) {
34011
- const i = this.viewerContainer, s = Pe.getScreenCoordinateByEvent(e, i), n = Pe.screen2Ndc(s, this.camera, i);
34036
+ const i = this.viewerContainer, s = Ae.getScreenCoordinateByEvent(e, i), n = Ae.screen2Ndc(s, this.camera, i);
34012
34037
  return this.getHitResultByNdcCoordinate(n);
34013
34038
  }
34014
34039
  /**
@@ -34122,8 +34147,8 @@ class $o extends Pr {
34122
34147
  y > l && n.setPixelRatio(y), this.cameraManager.update(0), this.dispatchEvent(ce.BeforeRender), n.render(this.scene, this.camera), this.dispatchEvent(ce.AfterRender);
34123
34148
  const C = n.domElement, w = this.overlayRender.getCanvas(), x = document.createElement("canvas");
34124
34149
  x.width = C.width, x.height = C.height;
34125
- const E = x.getContext("2d");
34126
- if (E.drawImage(C, 0, 0), w && w.width > 0 && w.height > 0 && E.drawImage(w, 0, 0, x.width, x.height), i) {
34150
+ const S = x.getContext("2d");
34151
+ if (S.drawImage(C, 0, 0), w && w.width > 0 && w.height > 0 && S.drawImage(w, 0, 0, x.width, x.height), i) {
34127
34152
  const O = new p.Color(1973806);
34128
34153
  this.scene.background instanceof p.Color ? O.copy(this.scene.background) : n.getClearColor(O), O.convertLinearToSRGB(), this.invertForPrint(x, Math.max(1, Math.round(y / 2)), {
34129
34154
  r: O.r * 255,
@@ -34137,7 +34162,7 @@ class $o extends Pr {
34137
34162
  O && (M = O);
34138
34163
  }
34139
34164
  this._printCaptureMode = !1;
34140
- for (const { object: O, visible: S } of u) O.visible = S;
34165
+ for (const { object: O, visible: E } of u) O.visible = E;
34141
34166
  return n.setPixelRatio(l), s.zoomTo(o), s.setLookAt(
34142
34167
  r.x,
34143
34168
  r.y,
@@ -34158,23 +34183,23 @@ class $o extends Pr {
34158
34183
  const n = e.getContext("2d", { willReadFrequently: !0 });
34159
34184
  if (!n) return;
34160
34185
  const r = e.width, a = e.height, o = n.getImageData(0, 0, r, a), l = o.data, h = r * a, d = 45, u = 0.72, f = new Float32Array(h);
34161
- for (let S = 0, v = 0; S < h; S++, v += 4) {
34186
+ for (let E = 0, v = 0; E < h; E++, v += 4) {
34162
34187
  const T = l[v], _ = l[v + 1], A = l[v + 2], I = T - s.r, B = _ - s.g, k = A - s.b;
34163
34188
  if (Math.sqrt(I * I + B * B + k * k) < d) {
34164
- l[v] = 255, l[v + 1] = 255, l[v + 2] = 255, f[S] = 255;
34189
+ l[v] = 255, l[v + 1] = 255, l[v + 2] = 255, f[E] = 255;
34165
34190
  continue;
34166
34191
  }
34167
34192
  const D = T / 255, R = _ / 255, ie = A / 255, se = Math.max(D, R, ie), ze = Math.min(D, R, ie), ct = (se + ze) / 2, ve = se - ze, Ni = ve === 0 ? 0 : ve / (1 - Math.abs(2 * ct - 1));
34168
34193
  let Qe = 0;
34169
34194
  ve !== 0 && (se === D ? Qe = (R - ie) / ve % 6 : se === R ? Qe = (ie - D) / ve + 2 : Qe = (D - R) / ve + 4, Qe /= 6, Qe < 0 && (Qe += 1));
34170
- const vn = Math.min(0.55, (1 - ct) * u), Ae = (1 - Math.abs(2 * vn - 1)) * Ni, At = Ae * (1 - Math.abs(Qe * 6 % 2 - 1)), Hi = vn - Ae / 2;
34195
+ const vn = Math.min(0.55, (1 - ct) * u), Ie = (1 - Math.abs(2 * vn - 1)) * Ni, At = Ie * (1 - Math.abs(Qe * 6 % 2 - 1)), Hi = vn - Ie / 2;
34171
34196
  let Ht = 0, Gt = 0, Wt = 0;
34172
34197
  const qt = Math.floor(Qe * 6) % 6;
34173
- qt === 0 ? (Ht = Ae, Gt = At) : qt === 1 ? (Ht = At, Gt = Ae) : qt === 2 ? (Gt = Ae, Wt = At) : qt === 3 ? (Gt = At, Wt = Ae) : qt === 4 ? (Ht = At, Wt = Ae) : (Ht = Ae, Wt = At), l[v] = (Ht + Hi) * 255, l[v + 1] = (Gt + Hi) * 255, l[v + 2] = (Wt + Hi) * 255, f[S] = 0.299 * l[v] + 0.587 * l[v + 1] + 0.114 * l[v + 2];
34198
+ qt === 0 ? (Ht = Ie, Gt = At) : qt === 1 ? (Ht = At, Gt = Ie) : qt === 2 ? (Gt = Ie, Wt = At) : qt === 3 ? (Gt = At, Wt = Ie) : qt === 4 ? (Ht = At, Wt = Ie) : (Ht = Ie, Wt = At), l[v] = (Ht + Hi) * 255, l[v + 1] = (Gt + Hi) * 255, l[v + 2] = (Wt + Hi) * 255, f[E] = 0.299 * l[v] + 0.587 * l[v + 1] + 0.114 * l[v + 2];
34174
34199
  }
34175
34200
  const m = Math.max(1, i), b = new Float32Array(h), y = new Uint8ClampedArray(h), C = new Uint8ClampedArray(h), w = new Uint8ClampedArray(h);
34176
- for (let S = 0; S < a; S++) {
34177
- const v = S * r;
34201
+ for (let E = 0; E < a; E++) {
34202
+ const v = E * r;
34178
34203
  for (let T = 0; T < r; T++) {
34179
34204
  let _ = 255, A = v + T;
34180
34205
  const I = Math.max(0, T - m), B = Math.min(r - 1, T + m);
@@ -34185,20 +34210,20 @@ class $o extends Pr {
34185
34210
  b[v + T] = _, y[v + T] = l[A * 4], C[v + T] = l[A * 4 + 1], w[v + T] = l[A * 4 + 2];
34186
34211
  }
34187
34212
  }
34188
- const x = new Float32Array(h), E = new Uint8ClampedArray(h), M = new Uint8ClampedArray(h), O = new Uint8ClampedArray(h);
34189
- for (let S = 0; S < r; S++)
34213
+ const x = new Float32Array(h), S = new Uint8ClampedArray(h), M = new Uint8ClampedArray(h), O = new Uint8ClampedArray(h);
34214
+ for (let E = 0; E < r; E++)
34190
34215
  for (let v = 0; v < a; v++) {
34191
- let T = 255, _ = v * r + S;
34216
+ let T = 255, _ = v * r + E;
34192
34217
  const A = Math.max(0, v - m), I = Math.min(a - 1, v + m);
34193
34218
  for (let k = A; k <= I; k++) {
34194
- const D = b[k * r + S];
34195
- D < T && (T = D, _ = k * r + S);
34219
+ const D = b[k * r + E];
34220
+ D < T && (T = D, _ = k * r + E);
34196
34221
  }
34197
- const B = v * r + S;
34198
- x[B] = T, E[B] = y[_], M[B] = C[_], O[B] = w[_];
34222
+ const B = v * r + E;
34223
+ x[B] = T, S[B] = y[_], M[B] = C[_], O[B] = w[_];
34199
34224
  }
34200
- for (let S = 0, v = 0; S < h; S++, v += 4)
34201
- f[S] > 250 && x[S] < 250 && (l[v] = E[S], l[v + 1] = M[S], l[v + 2] = O[S]);
34225
+ for (let E = 0, v = 0; E < h; E++, v += 4)
34226
+ f[E] > 250 && x[E] < 250 && (l[v] = S[E], l[v + 1] = M[E], l[v + 2] = O[E]);
34202
34227
  n.putImageData(o, 0, 0);
34203
34228
  }
34204
34229
  /**
@@ -34208,10 +34233,10 @@ class $o extends Pr {
34208
34233
  cropCanvasToBox(e, i) {
34209
34234
  const s = this.camera, n = s.zoom || 1, r = s.position.x, a = s.position.y, o = r + s.left / n, l = r + s.right / n, h = a + s.bottom / n, d = a + s.top / n, u = l - o, f = d - h;
34210
34235
  if (u <= 0 || f <= 0) return;
34211
- const m = (v) => (v - o) / u * e.width, b = (v) => (d - v) / f * e.height, y = Math.max(u, f) * 0.01, C = Math.max(0, Math.floor(m(i.min.x - y))), w = Math.min(e.width, Math.ceil(m(i.max.x + y))), x = Math.max(0, Math.floor(b(i.max.y + y))), E = Math.min(e.height, Math.ceil(b(i.min.y - y))), M = w - C, O = E - x;
34236
+ const m = (v) => (v - o) / u * e.width, b = (v) => (d - v) / f * e.height, y = Math.max(u, f) * 0.01, C = Math.max(0, Math.floor(m(i.min.x - y))), w = Math.min(e.width, Math.ceil(m(i.max.x + y))), x = Math.max(0, Math.floor(b(i.max.y + y))), S = Math.min(e.height, Math.ceil(b(i.min.y - y))), M = w - C, O = S - x;
34212
34237
  if (M < 16 || O < 16) return;
34213
- const S = document.createElement("canvas");
34214
- return S.width = M, S.height = O, S.getContext("2d").drawImage(e, C, x, M, O, 0, 0, M, O), S.toDataURL("image/png");
34238
+ const E = document.createElement("canvas");
34239
+ return E.width = M, E.height = O, E.getContext("2d").drawImage(e, C, x, M, O, 0, 0, M, O), E.toDataURL("image/png");
34215
34240
  }
34216
34241
  /**
34217
34242
  * Opens the browser print dialog with the image laid out on the selected paper size,
@@ -34234,15 +34259,15 @@ class $o extends Pr {
34234
34259
  b.style.cssText = `position:fixed;left:-20000px;top:0;border:0;visibility:hidden;width:${Math.ceil(f * y)}px;height:${Math.ceil(m * y)}px;`;
34235
34260
  const C = (v) => v.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), w = l ? "max-width:100%;max-height:100%;width:auto;height:auto;" : "width:100%;height:auto;", x = `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${C(d)}</title><style>@page{size:${r} ${a};margin:${h}mm;}html,body{margin:0;padding:0;background:#fff;}body{display:flex;align-items:center;justify-content:center;width:${f - 2 * h}mm;height:${m - 2 * h}mm;overflow:hidden;}img{display:block;${w}}</style></head><body><img src="${i}" alt="${C(d)}"></body></html>`;
34236
34261
  document.body.appendChild(b);
34237
- const E = () => {
34238
- b.contentWindow?.removeEventListener("afterprint", E), setTimeout(() => b.remove(), 100);
34262
+ const S = () => {
34263
+ b.contentWindow?.removeEventListener("afterprint", S), setTimeout(() => b.remove(), 100);
34239
34264
  }, M = b.contentDocument;
34240
34265
  M.open(), M.write(x), M.close();
34241
- const O = M.querySelector("img"), S = () => {
34266
+ const O = M.querySelector("img"), E = () => {
34242
34267
  const v = b.contentWindow;
34243
- v.addEventListener("afterprint", E), v.focus(), v.print(), setTimeout(E, 6e4);
34268
+ v.addEventListener("afterprint", S), v.focus(), v.print(), setTimeout(S, 6e4);
34244
34269
  };
34245
- O.complete ? S() : (O.onload = S, O.onerror = E);
34270
+ O.complete ? E() : (O.onload = E, O.onerror = S);
34246
34271
  }
34247
34272
  /**
34248
34273
  * @description {en} Gets dxf layers.
@@ -34515,16 +34540,16 @@ class Mu {
34515
34540
  }, f = (B) => u(B, 0, 15), m = (B) => u(B, 15, 30), b = (B) => u(B, 30, 60), y = (B) => u(B, 60, 95);
34516
34541
  U.printMemory("Before comparing"), this.loadingProgressBar?.addProgressItem(l), d(0);
34517
34542
  let C = Date.now();
34518
- const w = this.loader.parse(n, f), x = this.loader.parse(a, m), [E, M] = await Promise.allSettled([w, x]);
34519
- if (E.status === "rejected") return Promise.reject("[DxfCompareHelper] Failed to parse " + n);
34543
+ const w = this.loader.parse(n, f), x = this.loader.parse(a, m), [S, M] = await Promise.allSettled([w, x]);
34544
+ if (S.status === "rejected") return Promise.reject("[DxfCompareHelper] Failed to parse " + n);
34520
34545
  if (M.status === "rejected") return Promise.reject("[DxfCompareHelper] Failed to parse " + a);
34521
34546
  if (P.info("[DxfCompareHelper] loadFiles in " + (Date.now() - C) / 1e3 + "s"), this.loader.isAborted()) return Promise.reject("[DxfCompareHelper] compare loadFile aborted");
34522
- const O = E.value, S = M.value;
34547
+ const O = S.value, E = M.value;
34523
34548
  C = Date.now();
34524
- const v = await new yt(O, S, i).compare(b);
34549
+ const v = await new yt(O, E, i).compare(b);
34525
34550
  if (P.info("[DxfCompareHelper] Compared in " + (Date.now() - C) / 1e3 + "s"), P.debug("[DxfCompareHelper] Compared results:", v), this.loader.isAborted()) return Promise.reject("[DxfCompareHelper] compare change aborted");
34526
- U.printMemory("After getting the comparison results"), C = Date.now(), await this.loader.loadEntitiesForCompare(O, S, v, !0, y), U.printMemory("After Creating threejs objects based on comparison result"), this.fontManager?.releaseFontData(), this.changes = v, P.info("[DxfCompareHelper] Creates threejs objects based on comparison result in " + (Date.now() - C) / 1e3 + "s");
34527
- const T = O, _ = S;
34551
+ U.printMemory("After getting the comparison results"), C = Date.now(), await this.loader.loadEntitiesForCompare(O, E, v, !0, y), U.printMemory("After Creating threejs objects based on comparison result"), this.fontManager?.releaseFontData(), this.changes = v, P.info("[DxfCompareHelper] Creates threejs objects based on comparison result in " + (Date.now() - C) / 1e3 + "s");
34552
+ const T = O, _ = E;
34528
34553
  if (this.decreaseJobCount(), !Object.keys(v).length && P.info("[DxfCompareHelper] No change found"), T.threejsObject?.children.length === 0 && _.threejsObject?.children.length === 0) {
34529
34554
  const B = "[DxfCompareHelper] Nothing was loaded from " + n + " and " + a;
34530
34555
  return P.warn(B), Promise.reject(B);
@@ -34675,11 +34700,11 @@ class W0 extends Mu {
34675
34700
  }, b = (D) => m(D, 0, 15), y = (D) => m(D, 15, 30), C = (D) => m(D, 30, 60), w = (D) => m(D, 60, 95);
34676
34701
  U.printMemory("Before comparing"), this.loadingProgressBar?.addProgressItem(d), f(0);
34677
34702
  let x = Date.now();
34678
- const E = this.loader.parse(r, b), M = this.loader.parse(o, y), [O, S] = await Promise.allSettled([E, M]);
34703
+ const S = this.loader.parse(r, b), M = this.loader.parse(o, y), [O, E] = await Promise.allSettled([S, M]);
34679
34704
  if (O.status === "rejected") return Promise.reject("[DxfCompareHelper] Failed to parse " + r);
34680
- if (S.status === "rejected") return Promise.reject("[DxfCompareHelper] Failed to parse " + o);
34705
+ if (E.status === "rejected") return Promise.reject("[DxfCompareHelper] Failed to parse " + o);
34681
34706
  if (P.info("[DxfCompareHelper] loadFiles in " + (Date.now() - x) / 1e3 + "s"), this.loader.isAborted()) return Promise.reject("[DxfCompareHelper] compare loadFile aborted");
34682
- const v = O.value, T = S.value;
34707
+ const v = O.value, T = E.value;
34683
34708
  x = Date.now();
34684
34709
  const _ = await new yt(v, T, s).compare(C);
34685
34710
  if (P.info("[DxfCompareHelper] Compared in " + (Date.now() - x) / 1e3 + "s"), P.debug("Compared results:", _), this.loader.isAborted()) return Promise.reject("[DxfCompareHelper] compare change aborted");
@@ -35148,9 +35173,9 @@ class Y0 extends Pr {
35148
35173
  );
35149
35174
  };
35150
35175
  let h = !1;
35151
- const d = (x, E, M) => {
35176
+ const d = (x, S, M) => {
35152
35177
  let O = x.loaded * 100 / x.total;
35153
- O = O * (M - E) / 100 + E, O > M && (h || (P.warn("[Progress] Invalid ProgressEvent:", x), h = !0), O = M), this.progressBar?.updateProgress(a, o, O), i?.(
35178
+ O = O * (M - S) / 100 + S, O > M && (h || (P.warn("[Progress] Invalid ProgressEvent:", x), h = !0), O = M), this.progressBar?.updateProgress(a, o, O), i?.(
35154
35179
  new ProgressEvent("LoadProgress", {
35155
35180
  loaded: O,
35156
35181
  total: 100
@@ -36056,8 +36081,8 @@ class K0 {
36056
36081
  getIntersections(t) {
36057
36082
  if (!this.raycaster || !this.camera || !this.scene) return [];
36058
36083
  let e = new p.Vector2();
36059
- t && (e = Pe.getScreenCoordinateByEvent(t, this.containerOrCanvas));
36060
- const i = Pe.screen2Ndc(e, this.camera, this.containerOrCanvas);
36084
+ t && (e = Ae.getScreenCoordinateByEvent(t, this.containerOrCanvas));
36085
+ const i = Ae.screen2Ndc(e, this.camera, this.containerOrCanvas);
36061
36086
  this.raycaster.setFromCamera(i, this.camera);
36062
36087
  const s = [];
36063
36088
  return this.loadedModels.forEach((n) => {
@@ -36090,7 +36115,7 @@ class K0 {
36090
36115
  this.selectedObject = void 0;
36091
36116
  }
36092
36117
  if (!this.scene || !t) return;
36093
- const e = Me.clonedHighlightMaterials(t);
36118
+ const e = Te.clonedHighlightMaterials(t);
36094
36119
  e && (this.selectedObject = t, this.selectedObject.userData.originalMaterial = this.selectedObject.material, this.selectedObject.material = e);
36095
36120
  }
36096
36121
  /**
@@ -36259,7 +36284,7 @@ export {
36259
36284
  Ot as CompareDrawable,
36260
36285
  Ho as Container,
36261
36286
  xt as ControlsMode,
36262
- Pe as CoordinateUtils,
36287
+ Ae as CoordinateUtils,
36263
36288
  xh as DecimalPrecisionRange,
36264
36289
  zn as DefaultCameraFar,
36265
36290
  vh as DefaultCameraFov,
@@ -36276,7 +36301,7 @@ export {
36276
36301
  Ua as DxfCompareMarkupManager,
36277
36302
  X as DxfLoader,
36278
36303
  r1 as DxfParser,
36279
- Be as DxfRenderOrder,
36304
+ Me as DxfRenderOrder,
36280
36305
  Dt as DxfUtils,
36281
36306
  Sh as EdgeUtils,
36282
36307
  hi as Event,
@@ -36298,7 +36323,7 @@ export {
36298
36323
  w0 as Line,
36299
36324
  Qh as LinePatternShaders,
36300
36325
  oi as LoadingHelper,
36301
- Me as MaterialUtils,
36326
+ Te as MaterialUtils,
36302
36327
  F as MathUtils,
36303
36328
  bt as MatrixAutoUpdate,
36304
36329
  ye as MergeUtils,