build-dxf 0.0.33 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/build.js CHANGED
@@ -1,16 +1,16 @@
1
- import * as U from "three";
2
- import { EventDispatcher as Pe, Color as ve, Matrix4 as Ae, Vector3 as ee, Quaternion as Ne, BufferAttribute as H, REVISION as Ce, CompressedTexture as ie, Source as Be, NoColorSpace as Oe, MathUtils as ce, RGBAFormat as Fe, ImageUtils as Ue, DoubleSide as Ge, PropertyBinding as te, InterpolateDiscrete as _e, Scene as fe, SRGBColorSpace as ze, NearestFilter as qe, NearestMipmapNearestFilter as je, NearestMipmapLinearFilter as Ye, LinearFilter as Xe, LinearMipmapNearestFilter as ke, LinearMipmapLinearFilter as Ve, ClampToEdgeWrapping as We, RepeatWrapping as He, MirroredRepeatWrapping as Je, InterpolateLinear as Ke } from "three";
3
- import pe from "clipper-lib";
4
- import Q from "dxf-writer";
5
- import { OBJExporter as $e } from "three/examples/jsm/exporters/OBJExporter.js";
6
- function le() {
7
- return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(d) {
8
- var e = Math.random() * 16 | 0, t = d == "x" ? e : e & 3 | 8;
1
+ import * as z from "three";
2
+ import { EventDispatcher as Ge, Color as ze, Matrix4 as ve, Vector3 as ce, Quaternion as _e, BufferAttribute as te, REVISION as qe, CompressedTexture as de, Source as je, NoColorSpace as Ye, MathUtils as ye, RGBAFormat as ke, ImageUtils as Xe, DoubleSide as Ve, PropertyBinding as le, InterpolateDiscrete as We, Scene as Se, SRGBColorSpace as He, NearestFilter as Je, NearestMipmapNearestFilter as Ke, NearestMipmapLinearFilter as $e, LinearFilter as Ze, LinearMipmapNearestFilter as Qe, LinearMipmapLinearFilter as et, ClampToEdgeWrapping as tt, RepeatWrapping as nt, MirroredRepeatWrapping as st, InterpolateLinear as it } from "three";
3
+ import Le from "clipper-lib";
4
+ import ae from "dxf-writer";
5
+ import { OBJExporter as rt } from "three/examples/jsm/exporters/OBJExporter.js";
6
+ function me() {
7
+ return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(f) {
8
+ var e = Math.random() * 16 | 0, t = f == "x" ? e : e & 3 | 8;
9
9
  return t.toString(16);
10
10
  });
11
11
  }
12
- class Ee extends Pe {
13
- uuid = le();
12
+ class Ne extends Ge {
13
+ uuid = me();
14
14
  addEventListener(e, t, n) {
15
15
  const { once: s = !1 } = n ?? {}, i = (o) => {
16
16
  t(o), s && r();
@@ -30,7 +30,7 @@ class Ee extends Pe {
30
30
  t && (t.forEach((n) => n()), this.eventRecordStack.delete(e));
31
31
  }
32
32
  }
33
- class J extends Ee {
33
+ class ne extends Ne {
34
34
  parent;
35
35
  destroyed = !1;
36
36
  constructor(...e) {
@@ -48,7 +48,7 @@ class J extends Ee {
48
48
  this.destroyed = !0;
49
49
  }
50
50
  }
51
- class Ze extends Ee {
51
+ class ot extends Ne {
52
52
  static EventType = {
53
53
  ADD_COMPONENT: "addComponent"
54
54
  };
@@ -71,7 +71,7 @@ class Ze extends Ee {
71
71
  * @param component
72
72
  */
73
73
  removeComponent(e) {
74
- if (e instanceof J) {
74
+ if (e instanceof ne) {
75
75
  const t = this.components.indexOf(e);
76
76
  t > -1 && (this.components.splice(t, 1), this.dispatchEvent({
77
77
  type: "removeComponent",
@@ -116,17 +116,17 @@ class Ze extends Ee {
116
116
  return t || null;
117
117
  }
118
118
  }
119
- class _ {
119
+ class j {
120
120
  minX = 0;
121
121
  maxX = 0;
122
122
  minY = 0;
123
123
  maxY = 0;
124
124
  get points() {
125
125
  return [
126
- new w(this.minX, this.minY),
127
- new w(this.maxX, this.minY),
128
- new w(this.maxX, this.maxY),
129
- new w(this.minX, this.maxY)
126
+ new g(this.minX, this.minY),
127
+ new g(this.maxX, this.minY),
128
+ new g(this.maxX, this.maxY),
129
+ new g(this.minX, this.maxY)
130
130
  ];
131
131
  }
132
132
  get width() {
@@ -136,7 +136,7 @@ class _ {
136
136
  return this.maxY - this.minY;
137
137
  }
138
138
  get center() {
139
- return new w(
139
+ return new g(
140
140
  this.minX + (this.maxX - this.minX) * 0.5,
141
141
  this.minY + (this.maxY - this.minY) * 0.5
142
142
  );
@@ -202,9 +202,9 @@ class _ {
202
202
  const o = this.points;
203
203
  for (let l = 0; l < 4; l++) {
204
204
  const c = o[l], h = o[(l + 1) % 4];
205
- for (let f = 0; f < 4; f++) {
206
- const u = t[f], p = t[(f + 1) % 4], y = (h.x - c.x) * (u.y - c.y) - (h.y - c.y) * (u.x - c.x), x = (h.x - c.x) * (p.y - c.y) - (h.y - c.y) * (p.x - c.x), S = (p.x - u.x) * (c.y - u.y) - (p.y - u.y) * (c.x - u.x), R = (p.x - u.x) * (h.y - u.y) - (p.y - u.y) * (h.x - u.x);
207
- if (y * x < 0 && S * R < 0 || y === 0 && Math.min(c.x, h.x) <= u.x && u.x <= Math.max(c.x, h.x) && Math.min(c.y, h.y) <= u.y && u.y <= Math.max(c.y, h.y) || x === 0 && Math.min(c.x, h.x) <= p.x && p.x <= Math.max(c.x, h.x) && Math.min(c.y, h.y) <= p.y && p.y <= Math.max(c.y, h.y) || S === 0 && Math.min(u.x, p.x) <= c.x && c.x <= Math.max(u.x, p.x) && Math.min(u.y, p.y) <= c.y && c.y <= Math.max(u.y, p.y) || R === 0 && Math.min(u.x, p.x) <= h.x && h.x <= Math.max(u.x, p.x) && Math.min(u.y, p.y) <= h.y && h.y <= Math.max(u.y, p.y))
205
+ for (let d = 0; d < 4; d++) {
206
+ const u = t[d], p = t[(d + 1) % 4], y = (h.x - c.x) * (u.y - c.y) - (h.y - c.y) * (u.x - c.x), x = (h.x - c.x) * (p.y - c.y) - (h.y - c.y) * (p.x - c.x), S = (p.x - u.x) * (c.y - u.y) - (p.y - u.y) * (c.x - u.x), T = (p.x - u.x) * (h.y - u.y) - (p.y - u.y) * (h.x - u.x);
207
+ if (y * x < 0 && S * T < 0 || y === 0 && Math.min(c.x, h.x) <= u.x && u.x <= Math.max(c.x, h.x) && Math.min(c.y, h.y) <= u.y && u.y <= Math.max(c.y, h.y) || x === 0 && Math.min(c.x, h.x) <= p.x && p.x <= Math.max(c.x, h.x) && Math.min(c.y, h.y) <= p.y && p.y <= Math.max(c.y, h.y) || S === 0 && Math.min(u.x, p.x) <= c.x && c.x <= Math.max(u.x, p.x) && Math.min(u.y, p.y) <= c.y && c.y <= Math.max(u.y, p.y) || T === 0 && Math.min(u.x, p.x) <= h.x && h.x <= Math.max(u.x, p.x) && Math.min(u.y, p.y) <= h.y && h.y <= Math.max(u.y, p.y))
208
208
  return !0;
209
209
  }
210
210
  }
@@ -216,9 +216,9 @@ class _ {
216
216
  const a = (l) => {
217
217
  let c = 0;
218
218
  for (let h = 0; h < 4; h++) {
219
- const f = t[h], u = t[(h + 1) % 4], p = (u.x - f.x) * (l.y - f.y) - (u.y - f.y) * (l.x - f.x);
219
+ const d = t[h], u = t[(h + 1) % 4], p = (u.x - d.x) * (l.y - d.y) - (u.y - d.y) * (l.x - d.x);
220
220
  if (p === 0) {
221
- const y = Math.abs(u.x - f.x) > 1e-10 ? u.x - f.x : u.y - f.y, x = y ? (l.x - f.x) / y : 0;
221
+ const y = Math.abs(u.x - d.x) > 1e-10 ? u.x - d.x : u.y - d.y, x = y ? (l.x - d.x) / y : 0;
222
222
  if (x >= 0 && x <= 1) return !0;
223
223
  } else {
224
224
  const y = p > 0 ? 1 : -1;
@@ -299,7 +299,7 @@ class _ {
299
299
  * @returns
300
300
  */
301
301
  clone() {
302
- return new _(this.minX, this.maxX, this.minY, this.maxY);
302
+ return new j(this.minX, this.maxX, this.minY, this.maxY);
303
303
  }
304
304
  /**
305
305
  *
@@ -310,7 +310,7 @@ class _ {
310
310
  const t = [], n = [];
311
311
  return e.forEach((s) => {
312
312
  t.push(s.x), n.push(s.y);
313
- }), new _(
313
+ }), new j(
314
314
  Math.min(...t),
315
315
  Math.max(...t),
316
316
  Math.min(...n),
@@ -328,7 +328,7 @@ class _ {
328
328
  s?.points?.forEach((i) => {
329
329
  t.push(i.x), n.push(i.y);
330
330
  });
331
- }), new _(
331
+ }), new j(
332
332
  Math.min(...t),
333
333
  Math.max(...t),
334
334
  Math.min(...n),
@@ -336,7 +336,7 @@ class _ {
336
336
  );
337
337
  }
338
338
  }
339
- class se {
339
+ class ue {
340
340
  points;
341
341
  get p0() {
342
342
  return this.points[0];
@@ -359,7 +359,7 @@ class se {
359
359
  path2D(e) {
360
360
  return this.points.flatMap((t, n) => {
361
361
  const s = this.points[(n + 1) % this.points.length];
362
- return e && e(new w(t.x, t.y), new w(s.x, s.y)), [t.x, t.y, s.x, s.y];
362
+ return e && e(new g(t.x, t.y), new g(s.x, s.y)), [t.x, t.y, s.x, s.y];
363
363
  });
364
364
  }
365
365
  createGeometry() {
@@ -394,8 +394,8 @@ class se {
394
394
  if (Math.max(p, y) >= 0 && Math.min(p, y) <= 1)
395
395
  return !0;
396
396
  } else {
397
- const f = ((o.x - t.x) * c - (o.y - t.y) * l) / h, u = ((o.x - t.x) * i - (o.y - t.y) * s) / h;
398
- if (f >= 0 && f <= 1 && u >= 0 && u <= 1)
397
+ const d = ((o.x - t.x) * c - (o.y - t.y) * l) / h, u = ((o.x - t.x) * i - (o.y - t.y) * s) / h;
398
+ if (d >= 0 && d <= 1 && u >= 0 && u <= 1)
399
399
  return !0;
400
400
  }
401
401
  }
@@ -477,7 +477,7 @@ class se {
477
477
  let e = 1 / 0, t = -1 / 0, n = 1 / 0, s = -1 / 0;
478
478
  return this.points.forEach((i) => {
479
479
  t = Math.max(i.x, t), e = Math.min(i.x, e), s = Math.max(i.x, s), n = Math.min(i.x, n);
480
- }), new _(e, t, n, s);
480
+ }), new j(e, t, n, s);
481
481
  }
482
482
  /**
483
483
  *
@@ -486,21 +486,21 @@ class se {
486
486
  * @returns
487
487
  */
488
488
  static fromByLineSegment(e, t = 0.1, n = !1, s = 0.5) {
489
- const i = e.points[0], r = e.points[1], o = r.normal(i), a = n ? r.direction(i).mutiplyScalar(t * s) : w.zero(), l = n ? i.direction(r).mutiplyScalar(t * s) : w.zero(), c = o.x * t * 0.5, h = o.y * t * 0.5;
490
- return new se([
491
- new w(i.x + c, i.y + h).add(l),
492
- new w(r.x + c, r.y + h).add(a),
493
- new w(r.x - c, r.y - h).add(a),
494
- new w(i.x - c, i.y - h).add(l)
489
+ const i = e.points[0], r = e.points[1], o = r.normal(i), a = n ? r.direction(i).mutiplyScalar(t * s) : g.zero(), l = n ? i.direction(r).mutiplyScalar(t * s) : g.zero(), c = o.x * t * 0.5, h = o.y * t * 0.5;
490
+ return new ue([
491
+ new g(i.x + c, i.y + h).add(l),
492
+ new g(r.x + c, r.y + h).add(a),
493
+ new g(r.x - c, r.y - h).add(a),
494
+ new g(i.x - c, i.y - h).add(l)
495
495
  ]);
496
496
  }
497
497
  }
498
- class B {
499
- points = [new w(), new w()];
498
+ class N {
499
+ points = [new g(), new g()];
500
500
  userData = {};
501
501
  // line: any
502
502
  get center() {
503
- return new w(
503
+ return new g(
504
504
  this.points[0].x + (this.points[1].x - this.points[0].x) * 0.5,
505
505
  this.points[0].y + (this.points[1].y - this.points[0].y) * 0.5
506
506
  );
@@ -511,7 +511,7 @@ class B {
511
511
  get end() {
512
512
  return this.points[1];
513
513
  }
514
- constructor(e = new w(), t = new w()) {
514
+ constructor(e = new g(), t = new g()) {
515
515
  this.points = [e, t];
516
516
  }
517
517
  set(e, t) {
@@ -597,15 +597,15 @@ class B {
597
597
  * @returns {Rectangle}
598
598
  */
599
599
  expandToRectangle(e = 0.1, t = "all") {
600
- const n = this.start, s = this.end, i = s.normal(n), r = t === "bothSides" ? w.zero() : s.direction(n).mutiplyScalar(e * 0.5), o = t === "bothSides" ? w.zero() : n.direction(s).mutiplyScalar(e * 0.5), a = i.x * e * 0.5, l = i.y * e * 0.5, c = [
600
+ const n = this.start, s = this.end, i = s.normal(n), r = t === "bothSides" ? g.zero() : s.direction(n).mutiplyScalar(e * 0.5), o = t === "bothSides" ? g.zero() : n.direction(s).mutiplyScalar(e * 0.5), a = i.x * e * 0.5, l = i.y * e * 0.5, c = [
601
601
  // 第一条线
602
- new w(n.x + a, n.y + l).add(o),
603
- new w(s.x + a, s.y + l).add(r),
602
+ new g(n.x + a, n.y + l).add(o),
603
+ new g(s.x + a, s.y + l).add(r),
604
604
  // 第二条线
605
- new w(n.x - a, n.y - l).add(o),
606
- new w(s.x - a, s.y - l).add(r)
605
+ new g(n.x - a, n.y - l).add(o),
606
+ new g(s.x - a, s.y - l).add(r)
607
607
  ];
608
- return new se([0, 1, 3, 2].map((h) => c[h]));
608
+ return new ue([0, 1, 3, 2].map((h) => c[h]));
609
609
  }
610
610
  /**
611
611
  * 计算线段的长度
@@ -642,24 +642,24 @@ class B {
642
642
  projectLineSegment(e) {
643
643
  if (e.points.length !== 2 || this.points.length !== 2)
644
644
  throw new Error("每条线段必须由两个点定义");
645
- const [t, n] = e.points, [s, i] = this.points, r = new w(i.x - s.x, i.y - s.y);
645
+ const [t, n] = e.points, [s, i] = this.points, r = new g(i.x - s.x, i.y - s.y);
646
646
  if (r.x === 0 && r.y === 0)
647
647
  throw new Error("投影目标线段的两个点不能重合");
648
648
  const o = (p) => {
649
- const y = new w(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, R = (y.x * r.x + y.y * r.y) / x, F = s.x + R * r.x, A = s.y + R * r.y;
650
- return new w(F, A);
649
+ const y = new g(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, T = (y.x * r.x + y.y * r.y) / x, G = s.x + T * r.x, E = s.y + T * r.y;
650
+ return new g(G, E);
651
651
  };
652
652
  let a = o(t), l = o(n);
653
653
  const c = (p) => {
654
- const y = new w(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y;
654
+ const y = new g(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y;
655
655
  return (y.x * r.x + y.y * r.y) / x;
656
656
  };
657
- let h = c(a), f = c(l);
657
+ let h = c(a), d = c(l);
658
658
  const u = (p) => {
659
659
  const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, S = s.y + y * r.y;
660
- return new w(x, S);
660
+ return new g(x, S);
661
661
  };
662
- return (h < 0 || h > 1) && (a = u(h)), (f < 0 || f > 1) && (l = u(f)), a.x === l.x && a.y === l.y ? new B(a, a) : new B(a, l);
662
+ return (h < 0 || h > 1) && (a = u(h)), (d < 0 || d > 1) && (l = u(d)), a.x === l.x && a.y === l.y ? new N(a, a) : new N(a, l);
663
663
  }
664
664
  /**
665
665
  * 计算一条线段在另一条直线上的投影
@@ -668,17 +668,17 @@ class B {
668
668
  * @returns 投影并裁剪后的线段
669
669
  */
670
670
  projectPoint(e, t = !0) {
671
- const [n, s] = this.points, i = new w(s.x - n.x, s.y - n.y);
671
+ const [n, s] = this.points, i = new g(s.x - n.x, s.y - n.y);
672
672
  if (i.x === 0 && i.y === 0)
673
673
  throw new Error("投影目标线段的两个点不能重合");
674
674
  let o = ((c) => {
675
- const h = new w(c.x - n.x, c.y - n.y), f = i.x * i.x + i.y * i.y, p = (h.x * i.x + h.y * i.y) / f, y = n.x + p * i.x, x = n.y + p * i.y;
676
- return new w(y, x);
675
+ const h = new g(c.x - n.x, c.y - n.y), d = i.x * i.x + i.y * i.y, p = (h.x * i.x + h.y * i.y) / d, y = n.x + p * i.x, x = n.y + p * i.y;
676
+ return new g(y, x);
677
677
  })(e);
678
678
  if (!t) return o;
679
679
  let l = ((c) => {
680
- const h = new w(c.x - n.x, c.y - n.y), f = i.x * i.x + i.y * i.y;
681
- return (h.x * i.x + h.y * i.y) / f;
680
+ const h = new g(c.x - n.x, c.y - n.y), d = i.x * i.x + i.y * i.y;
681
+ return (h.x * i.x + h.y * i.y) / d;
682
682
  })(o);
683
683
  return l < 0 || l > 1 ? null : o;
684
684
  }
@@ -696,8 +696,8 @@ class B {
696
696
  function a(u, p, y) {
697
697
  return Math.min(p.x, y.x) - 1e-10 <= u.x && u.x <= Math.max(p.x, y.x) + 1e-10 && Math.min(p.y, y.y) - 1e-10 <= u.y && u.y <= Math.max(p.y, y.y) + 1e-10;
698
698
  }
699
- const l = o(n, s, i), c = o(n, s, r), h = o(i, r, n), f = o(i, r, s);
700
- return !!(l * c < 0 && h * f < 0 || t && (Math.abs(l) < 1e-10 && a(i, n, s) || Math.abs(c) < 1e-10 && a(r, n, s) || Math.abs(h) < 1e-10 && a(n, i, r) || Math.abs(f) < 1e-10 && a(s, i, r)));
699
+ const l = o(n, s, i), c = o(n, s, r), h = o(i, r, n), d = o(i, r, s);
700
+ return !!(l * c < 0 && h * d < 0 || t && (Math.abs(l) < 1e-10 && a(i, n, s) || Math.abs(c) < 1e-10 && a(r, n, s) || Math.abs(h) < 1e-10 && a(n, i, r) || Math.abs(d) < 1e-10 && a(s, i, r)));
701
701
  }
702
702
  /**
703
703
  * 判断一个点是否在线段上(含端点)
@@ -718,7 +718,7 @@ class B {
718
718
  if (Math.abs(r) < 1e-10)
719
719
  return null;
720
720
  const o = ((t.x - s.x) * (s.y - i.y) - (t.y - s.y) * (s.x - i.x)) / r, a = t.x + o * (n.x - t.x), l = t.y + o * (n.y - t.y);
721
- return new w(a, l);
721
+ return new g(a, l);
722
722
  }
723
723
  /**
724
724
  * 获取两条线段夹角
@@ -758,6 +758,52 @@ class B {
758
758
  const n = this.includedAngle(e);
759
759
  return n < t || n > 180 - t;
760
760
  }
761
+ /** 判断点在当前线段的左边还是右边,或者线段上
762
+ * @param point
763
+ */
764
+ pointPosition(e) {
765
+ const t = this.start, n = this.end, s = (n.x - t.x) * (e.y - t.y) - (n.y - t.y) * (e.x - t.x);
766
+ return Math.abs(s) < 1e-10 ? "on" : s > 0 ? "left" : "right";
767
+ }
768
+ /**
769
+ * @returns
770
+ */
771
+ getRightDirection() {
772
+ return this.normal();
773
+ }
774
+ /**
775
+ *
776
+ * @returns
777
+ */
778
+ getLeftDirection() {
779
+ return this.normal().multiplyScalar(-1);
780
+ }
781
+ /** @param line 获取两条线段之间的最短距离
782
+ */
783
+ getMinLength(e) {
784
+ if (this.intersectLineSegment(e))
785
+ return 0;
786
+ const t = (n, s) => {
787
+ const i = s.start, r = s.end, o = r.x - i.x, a = r.y - i.y, l = o * o + a * a;
788
+ if (l < 1e-10)
789
+ return n.distance(i);
790
+ const c = ((n.x - i.x) * o + (n.y - i.y) * a) / l;
791
+ if (c < 0)
792
+ return n.distance(i);
793
+ if (c > 1)
794
+ return n.distance(r);
795
+ {
796
+ const h = i.x + c * o, d = i.y + c * a;
797
+ return n.distance(new g(h, d));
798
+ }
799
+ };
800
+ return Math.min(
801
+ t(this.start, e),
802
+ t(this.end, e),
803
+ t(e.start, this),
804
+ t(e.end, this)
805
+ );
806
+ }
761
807
  /**
762
808
  * 判断两条直线是否重合
763
809
  * @param line
@@ -767,8 +813,11 @@ class B {
767
813
  const t = this.start, n = this.end, s = e.start, i = e.end, r = (n.y - t.y) / (n.x - t.x), o = t.y - r * t.x, a = (i.y - s.y) / (i.x - s.x), l = s.y - a * s.x;
768
814
  return !isFinite(r) && !isFinite(a) ? t.x === s.x && n.x === s.x : Math.abs(r - a) < 1e-3 && Math.abs(o - l) < 1e-3;
769
815
  }
816
+ /** 克隆
817
+ * @returns
818
+ */
770
819
  clone() {
771
- const e = new B(
820
+ const e = new N(
772
821
  this.points[0].clone(),
773
822
  this.points[1].clone()
774
823
  );
@@ -788,7 +837,7 @@ class B {
788
837
  return s;
789
838
  }
790
839
  }
791
- class w {
840
+ class g {
792
841
  x;
793
842
  y;
794
843
  get X() {
@@ -905,7 +954,7 @@ class w {
905
954
  */
906
955
  normal(e) {
907
956
  const t = this.x - e.x, n = this.y - e.y, s = Math.sqrt(t * t + n * n), i = -n / s, r = t / s;
908
- return new w(i, r);
957
+ return new g(i, r);
909
958
  }
910
959
  /**
911
960
  * 获取由传入的点到该点的单位方向向量
@@ -915,17 +964,18 @@ class w {
915
964
  */
916
965
  direction(e) {
917
966
  const t = this.x - e.x, n = this.y - e.y, s = Math.sqrt(t * t + n * n);
918
- return s === 0 ? new w(0, 0) : new w(t / s, n / s);
967
+ return s === 0 ? new g(0, 0) : new g(t / s, n / s);
919
968
  }
920
969
  /** 展开为线
921
970
  * @param direction
922
971
  * @param length
923
972
  */
924
- expandAsLine(e, t) {
925
- return new B(
973
+ expandAsLine(e, t, n) {
974
+ const s = new N(
926
975
  this.clone(),
927
976
  this.clone().add(e.clone().multiplyScalar(t))
928
977
  );
978
+ return s.userData = n, s;
929
979
  }
930
980
  /**
931
981
  * 计算模长
@@ -983,7 +1033,7 @@ class w {
983
1033
  * @returns
984
1034
  */
985
1035
  clone() {
986
- return new w(this.x, this.y);
1036
+ return new g(this.x, this.y);
987
1037
  }
988
1038
  /**
989
1039
  * 克隆
@@ -1000,24 +1050,24 @@ class w {
1000
1050
  };
1001
1051
  }
1002
1052
  static from(e) {
1003
- return Array.isArray(e) ? new w(e[0], e[1]) : "x" in e && "y" in e ? new w(e.x, e.y) : "X" in e && "Y" in e ? new w(e.X, e.Y) : this.zero();
1053
+ return Array.isArray(e) ? new g(e[0], e[1]) : "x" in e && "y" in e ? new g(e.x, e.y) : "X" in e && "Y" in e ? new g(e.X, e.Y) : this.zero();
1004
1054
  }
1005
1055
  static zero() {
1006
- return new w(0, 0);
1056
+ return new g(0, 0);
1007
1057
  }
1008
1058
  }
1009
- async function K(d, e = !0) {
1059
+ async function se(f, e = !0) {
1010
1060
  if (typeof global < "u" && typeof require < "u")
1011
- return require(d);
1061
+ return require(f);
1012
1062
  {
1013
1063
  let t = await import(
1014
1064
  /* @vite-ignore */
1015
- d
1065
+ f
1016
1066
  );
1017
1067
  return e && (t = t.default), t;
1018
1068
  }
1019
1069
  }
1020
- class X {
1070
+ class Z {
1021
1071
  bounds;
1022
1072
  // 包围盒
1023
1073
  capacity;
@@ -1083,23 +1133,23 @@ class X {
1083
1133
  if (!this.isLeaf) return;
1084
1134
  this.isLeaf = !1, this.children = [];
1085
1135
  const e = (this.bounds.minX + this.bounds.maxX) / 2, t = (this.bounds.minY + this.bounds.maxY) / 2;
1086
- this.children[0] = new X(
1087
- new _(this.bounds.minX, e, this.bounds.minY, t),
1136
+ this.children[0] = new Z(
1137
+ new j(this.bounds.minX, e, this.bounds.minY, t),
1088
1138
  this.capacity,
1089
1139
  this.maxDepth,
1090
1140
  this.depth + 1
1091
- ), this.children[1] = new X(
1092
- new _(e, this.bounds.maxX, this.bounds.minY, t),
1141
+ ), this.children[1] = new Z(
1142
+ new j(e, this.bounds.maxX, this.bounds.minY, t),
1093
1143
  this.capacity,
1094
1144
  this.maxDepth,
1095
1145
  this.depth + 1
1096
- ), this.children[2] = new X(
1097
- new _(this.bounds.minX, e, t, this.bounds.maxY),
1146
+ ), this.children[2] = new Z(
1147
+ new j(this.bounds.minX, e, t, this.bounds.maxY),
1098
1148
  this.capacity,
1099
1149
  this.maxDepth,
1100
1150
  this.depth + 1
1101
- ), this.children[3] = new X(
1102
- new _(e, this.bounds.maxX, t, this.bounds.maxY),
1151
+ ), this.children[3] = new Z(
1152
+ new j(e, this.bounds.maxX, t, this.bounds.maxY),
1103
1153
  this.capacity,
1104
1154
  this.maxDepth,
1105
1155
  this.depth + 1
@@ -1128,7 +1178,7 @@ class X {
1128
1178
  * @returns 相交的节点数组
1129
1179
  */
1130
1180
  queryCircle(e, t) {
1131
- const n = [], s = new _(
1181
+ const n = [], s = new j(
1132
1182
  e.x - t,
1133
1183
  e.x + t,
1134
1184
  e.y - t,
@@ -1140,8 +1190,8 @@ class X {
1140
1190
  const [r, o] = i.line.points, a = o.x - r.x, l = o.y - r.y, c = a * a + l * l;
1141
1191
  let h = ((e.x - r.x) * a + (e.y - r.y) * l) / c;
1142
1192
  h = Math.max(0, Math.min(1, h));
1143
- const f = r.x + h * a, u = r.y + h * l;
1144
- e.distance(new w(f, u)) <= t && n.push(i);
1193
+ const d = r.x + h * a, u = r.y + h * l;
1194
+ e.distance(new g(d, u)) <= t && n.push(i);
1145
1195
  }
1146
1196
  if (!this.isLeaf)
1147
1197
  for (const i of this.children)
@@ -1209,7 +1259,7 @@ class X {
1209
1259
  })), e;
1210
1260
  }
1211
1261
  }
1212
- class he {
1262
+ class ge {
1213
1263
  map = /* @__PURE__ */ new Map();
1214
1264
  targetMap = /* @__PURE__ */ new Map();
1215
1265
  gridSize;
@@ -1263,7 +1313,7 @@ class he {
1263
1313
  */
1264
1314
  decodeGridId(e) {
1265
1315
  const [t, n] = e.split(".").map(Number);
1266
- return new w(t, n);
1316
+ return new g(t, n);
1267
1317
  }
1268
1318
  /**
1269
1319
  * 查询与矩形相交的点
@@ -1288,7 +1338,7 @@ class he {
1288
1338
  * @returns 相交的节点数组
1289
1339
  */
1290
1340
  queryCircle(e, t) {
1291
- const n = new _(e.x - t, e.x + t, e.y - t, e.y + t), s = Math.ceil(n.minX / this.gridSize), i = Math.ceil(n.maxX / this.gridSize), r = Math.ceil(n.minY / this.gridSize), o = Math.ceil(n.maxY / this.gridSize), a = [];
1341
+ const n = new j(e.x - t, e.x + t, e.y - t, e.y + t), s = Math.ceil(n.minX / this.gridSize), i = Math.ceil(n.maxX / this.gridSize), r = Math.ceil(n.minY / this.gridSize), o = Math.ceil(n.maxY / this.gridSize), a = [];
1292
1342
  for (let l = s; l <= i; l++)
1293
1343
  for (let c = r; c <= o; c++) {
1294
1344
  const h = `${l}.${c}`;
@@ -1338,7 +1388,7 @@ class he {
1338
1388
  return null;
1339
1389
  }
1340
1390
  }
1341
- const Qe = {
1391
+ const at = {
1342
1392
  Unitless: 1,
1343
1393
  // 无单位,1米 = 1(无单位)
1344
1394
  Inches: 39.37007874015748,
@@ -1382,27 +1432,27 @@ const Qe = {
1382
1432
  Parsecs: 3240779289666404e-32
1383
1433
  // 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
1384
1434
  };
1385
- function xe(d) {
1435
+ function Ee(f) {
1386
1436
  const e = [];
1387
- for (let t = 0; t < d.length; t++)
1388
- e.push(new B(
1389
- d[t].clone(),
1390
- d[(t + 1) % d.length].clone()
1437
+ for (let t = 0; t < f.length; t++)
1438
+ e.push(new N(
1439
+ f[t].clone(),
1440
+ f[(t + 1) % f.length].clone()
1391
1441
  ));
1392
1442
  return e;
1393
1443
  }
1394
- function ye(d) {
1395
- return d.flatMap((e, t) => (t === d.length - 1 && [...e.points, d[0].points[0]], [e.points[0]]));
1444
+ function De(f) {
1445
+ return f.flatMap((e, t) => (t === f.length - 1 && [...e.points, f[0].points[0]], [e.points[0]]));
1396
1446
  }
1397
- class V extends J {
1447
+ class $ extends ne {
1398
1448
  static name = "Dxf";
1399
1449
  shortLine = 0.04;
1400
1450
  width = 0.04;
1401
1451
  scale = 1;
1402
1452
  originalData = [];
1403
1453
  data = [];
1404
- originalBox = new _(0, 0, 0, 0);
1405
- box = new _(0, 0, 0, 0);
1454
+ originalBox = new j(0, 0, 0, 0);
1455
+ box = new j(0, 0, 0, 0);
1406
1456
  pointsGroups = [];
1407
1457
  wallsGroup = [];
1408
1458
  doors = [];
@@ -1427,7 +1477,6 @@ class V extends J {
1427
1477
  return this.lineSegments;
1428
1478
  }
1429
1479
  /**初始化
1430
- * @param data 点云数据
1431
1480
  * @param width 墙体宽度
1432
1481
  * @param scale 缩放比例
1433
1482
  */
@@ -1438,62 +1487,62 @@ class V extends J {
1438
1487
  * 预处理数据
1439
1488
  * @param data
1440
1489
  */
1441
- preprocessing(e, t = !1) {
1442
- const n = [];
1443
- let s = -1;
1444
- const i = [];
1445
- e.forEach(({ start: o, end: a, ...l }, c) => {
1446
- i.push(o.z ?? 0, a.z ?? 0);
1447
- const h = new B(
1448
- w.from(o),
1449
- w.from(a)
1490
+ preprocessing(e, t = !1, n) {
1491
+ let s = [], i = -1;
1492
+ const r = [];
1493
+ e.forEach(({ start: a, end: l, ...c }, h) => {
1494
+ r.push(a.z ?? 0, l.z ?? 0);
1495
+ const d = new N(
1496
+ g.from(a),
1497
+ g.from(l)
1450
1498
  );
1451
- h.userData = l, n.push(h), l.isVerticalReferenceLine && (s = c);
1452
- }), this.originalZAverage = i.reduce((o, a) => o + a, 0) / i.length, s === -1 && (s = B.maxLengthLineIndex(n, (o) => !o.userData.insetionArr?.length));
1453
- const r = n[s];
1454
- if (r.userData.isVerticalReferenceLine = !0, e[s].isVerticalReferenceLine = !0, t) {
1455
- let o = V.axisAlignmentCorrection.call(this, n, r);
1456
- return {
1457
- lineSegments: o,
1458
- data: this.lineDataToOriginalData(o)
1459
- };
1460
- }
1461
- return {
1462
- lineSegments: n,
1463
- data: e
1464
- };
1499
+ d.userData = c, s.push(d), c.isVerticalReferenceLine && (i = h);
1500
+ }), this.originalZAverage = r.reduce((a, l) => a + l, 0) / r.length, i === -1 && (i = N.maxLengthLineIndex(s, (a) => !a.userData.insetionArr?.length));
1501
+ const o = s[i];
1502
+ return o.userData.isVerticalReferenceLine = !0, e[i].isVerticalReferenceLine = !0, t && (s = $.axisAlignmentCorrection.call(this, s, o, n), e = this.lineDataToOriginalData(s)), this.dispatchEvent({
1503
+ type: "preprocessing",
1504
+ data: e,
1505
+ setData(a) {
1506
+ s = a.map(({ start: l, end: c, ...h }) => {
1507
+ const d = new N(g.from(l), g.from(c));
1508
+ return d.userData = h, d;
1509
+ }), e = a;
1510
+ }
1511
+ }), { lineSegments: s, data: e };
1465
1512
  }
1466
- /**
1467
- * 设置
1468
- * @param data
1469
- * @param width
1470
- * @param scale
1513
+ /** 设置
1514
+ * @param data 房屋结构数据,node环境可以为路径
1515
+ * @param width 墙体宽度
1516
+ * @param scale 缩放比例
1517
+ * @param axisAlignmentCorrection 需要执行轴对称垂直纠正
1518
+ * @param option
1519
+ * @returns
1471
1520
  */
1472
- async set(e, t = this.width, n = this.scale, s = !1) {
1521
+ async set(e, t = this.width, n = this.scale, s = !1, i) {
1473
1522
  if (typeof e == "string")
1474
1523
  if (typeof global < "u") {
1475
- const { default: a } = await import(
1524
+ const { default: l } = await import(
1476
1525
  /* @vite-ignore */
1477
1526
  "fs"
1478
- ), l = a.readFileSync(e), c = JSON.parse(l.toString("utf-8"));
1479
- return this.set(c, t, n, s);
1527
+ ), c = l.readFileSync(e), h = JSON.parse(c.toString("utf-8"));
1528
+ return this.set(h, t, n, s);
1480
1529
  } else
1481
1530
  throw new Error("非node环境不允许使用路径");
1482
1531
  this.scale = n, this.width = t;
1483
- const i = this.preprocessing(e, s);
1484
- e = i.data, this.lineSegments = i.lineSegments, this.originalData = e;
1485
- const r = [];
1486
- this.data = e.map(({ start: o, end: a, insetionArr: l, isDoor: c = !1 }, h) => {
1487
- r.push(o.z ?? 0, a.z ?? 0);
1488
- const f = this.lineSegments[h];
1532
+ const r = this.preprocessing(e, s, i);
1533
+ e = r.data, this.lineSegments = r.lineSegments, this.originalData = e;
1534
+ const o = [];
1535
+ this.data = e.map(({ start: a, end: l, insetionArr: c, isDoor: h = !1 }, d) => {
1536
+ o.push(a.z ?? 0, l.z ?? 0);
1537
+ const u = this.lineSegments[d];
1489
1538
  return [
1490
- f.points[0],
1491
- f.points[1],
1492
- (l ?? []).map((u) => u.index),
1493
- c,
1494
- h
1539
+ u.points[0],
1540
+ u.points[1],
1541
+ (c ?? []).map((p) => p.index),
1542
+ h,
1543
+ d
1495
1544
  ];
1496
- }), this.originalZAverage = r.reduce((o, a) => o + a, 0) / r.length, this.computedOriginalSize(e, this.originalBox), this.dispatchEvent({
1545
+ }), this.originalZAverage = o.reduce((a, l) => a + l, 0) / o.length, this.computedOriginalSize(e, this.originalBox), this.dispatchEvent({
1497
1546
  type: "setDta",
1498
1547
  originalData: this.originalData,
1499
1548
  data: this.data
@@ -1508,8 +1557,8 @@ class V extends J {
1508
1557
  */
1509
1558
  createGroups() {
1510
1559
  const e = [], t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), i = (r, o, a = -1) => {
1511
- const [l, c, h, f] = this.data[r];
1512
- if (t.add(r), f)
1560
+ const [l, c, h, d] = this.data[r];
1561
+ if (t.add(r), d)
1513
1562
  return s.has(r) || s.set(r, []), s.get(r)?.push(a), n.add(this.data[r]);
1514
1563
  o.push([l, c]), h.forEach((u) => {
1515
1564
  t.has(u) || i(u, o, r);
@@ -1604,7 +1653,7 @@ class V extends J {
1604
1653
  break;
1605
1654
  }
1606
1655
  }
1607
- const t = this.mergeSameDirectionLine(xe(e)), n = [t[0]];
1656
+ const t = this.mergeSameDirectionLine(Ee(e)), n = [t[0]];
1608
1657
  for (let s = 1; s < t.length; s++) {
1609
1658
  const i = t[s], r = t[(t.length + s - 1) % t.length];
1610
1659
  if (i.length() > this.width * 0.9) {
@@ -1619,7 +1668,7 @@ class V extends J {
1619
1668
  const a = t[s + 2];
1620
1669
  a && r.includedAngle(a) < 2 ? (s = s + 2, n.push(a)) : n.push(i);
1621
1670
  }
1622
- return n.length > 3 ? ye(this.mergeSameDirectionLine(n)) : [];
1671
+ return n.length > 3 ? De(this.mergeSameDirectionLine(n)) : [];
1623
1672
  }
1624
1673
  /**
1625
1674
  * 移除短线段
@@ -1627,7 +1676,7 @@ class V extends J {
1627
1676
  * @param path
1628
1677
  */
1629
1678
  removeShortLine(e, t = this.shortLine) {
1630
- const n = xe(e), s = [], i = Math.PI / 180;
1679
+ const n = Ee(e), s = [], i = Math.PI / 180;
1631
1680
  for (let r = 0; r < n.length; r++) {
1632
1681
  const o = n[r], a = o.length(), l = r;
1633
1682
  if (a > t || s.length === 0) {
@@ -1635,9 +1684,9 @@ class V extends J {
1635
1684
  continue;
1636
1685
  }
1637
1686
  let c = n[++r];
1638
- const h = s[s.length - 1], f = h.direction();
1687
+ const h = s[s.length - 1], d = h.direction();
1639
1688
  for (; r < n.length; ) {
1640
- const p = f.angleBetween(c.direction()) / i;
1689
+ const p = d.angleBetween(c.direction()) / i;
1641
1690
  if (c.length() <= t || p < 4 || p > 176)
1642
1691
  c = n[++r];
1643
1692
  else break;
@@ -1655,20 +1704,20 @@ class V extends J {
1655
1704
  } else
1656
1705
  r = l;
1657
1706
  }
1658
- return s.length > 3 ? ye(s) : [];
1707
+ return s.length > 3 ? De(s) : [];
1659
1708
  }
1660
1709
  /** 线偏移
1661
1710
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
1662
1711
  */
1663
- lineOffset(e = V.EndType.etOpenSquare, t = V.JoinType.jtMiter, n = 1e4) {
1664
- let s = new pe.Paths();
1665
- const i = new pe.ClipperOffset(20, 0.25);
1712
+ lineOffset(e = $.EndType.etOpenSquare, t = $.JoinType.jtMiter, n = 1e4) {
1713
+ let s = new Le.Paths();
1714
+ const i = new Le.ClipperOffset(20, 0.25);
1666
1715
  return this.pointsGroups.forEach((r) => {
1667
1716
  const o = this.lineTopology(r).map((a) => a.map((l) => l.clone().mutiplyScalar(n)));
1668
1717
  i.AddPaths(o, t, e);
1669
1718
  }), i.Execute(s, this.width / 2 * n), this.wallsGroup = s.map((r) => {
1670
- let o = r.map((a) => w.from(a).divisionScalar(n));
1671
- return o = this.lineSegmentStraightening(o), e == V.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
1719
+ let o = r.map((a) => g.from(a).divisionScalar(n));
1720
+ return o = this.lineSegmentStraightening(o), e == $.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
1672
1721
  }), this.dispatchEvent({
1673
1722
  type: "lineOffset",
1674
1723
  wallsGroup: this.wallsGroup
@@ -1703,31 +1752,13 @@ class V extends J {
1703
1752
  * 线段数据转为原始json数据
1704
1753
  */
1705
1754
  lineDataToOriginalData(e, t) {
1706
- return t || (t = new X(_.fromByLineSegment(...e)), e.forEach((n) => t?.insert({ line: n, userData: void 0 }))), e.map((n) => {
1707
- const s = n.userData, i = s.drawWindow, r = t.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index: e.indexOf(o.line) }));
1708
- return {
1709
- start: n.start.toJson(this.originalZAverage),
1710
- end: n.end.toJson(this.originalZAverage),
1711
- insetionArr: r,
1712
- isDoor: s.isDoor,
1713
- doorDirectConnection: s.isDoor,
1714
- length: n.length(),
1715
- isWindow: s.isWindow,
1716
- isVerticalReferenceLine: s.isVerticalReferenceLine,
1717
- wallWidth: n.userData.wallWidth,
1718
- drawWindow: i && i.map((o) => ({
1719
- p: { x: o.p.x, y: o.p.y, z: o.p.z },
1720
- width: o.width,
1721
- full: o.full
1722
- }))
1723
- };
1724
- });
1755
+ return $.lineDataToOriginalData(e, this.originalZAverage, t);
1725
1756
  }
1726
1757
  /**
1727
1758
  * 转为绘制数据
1728
1759
  */
1729
1760
  toDrawDataJson(e = "Millimeters") {
1730
- const t = Qe[e], n = {
1761
+ const t = at[e], n = {
1731
1762
  unit: e,
1732
1763
  line: [],
1733
1764
  arc: [],
@@ -1741,13 +1772,13 @@ class V extends J {
1741
1772
  function i(l, c) {
1742
1773
  n.line.push([l.x * t, l.y * t, c.x * t, c.y * t, s]);
1743
1774
  }
1744
- function r(l, c, h, f) {
1775
+ function r(l, c, h, d) {
1745
1776
  n.arc.push([
1746
1777
  l.x * t,
1747
1778
  l.y * t,
1748
1779
  c * t,
1749
1780
  h,
1750
- f,
1781
+ d,
1751
1782
  s
1752
1783
  ]);
1753
1784
  }
@@ -1760,7 +1791,7 @@ class V extends J {
1760
1791
  }
1761
1792
  this.wallsGroup.forEach((l) => {
1762
1793
  for (let c = 0; c < l.length; c++) {
1763
- const h = l[c], f = c === l.length - 1 ? 0 : c + 1, u = l[f];
1794
+ const h = l[c], d = c === l.length - 1 ? 0 : c + 1, u = l[d];
1764
1795
  i(h, u);
1765
1796
  }
1766
1797
  });
@@ -1771,29 +1802,29 @@ class V extends J {
1771
1802
  if (s = "cyan", c.length() < 1.2) {
1772
1803
  c.expansion(-o * 0.5);
1773
1804
  const h = l.normal();
1774
- let f = new B(
1805
+ let d = new N(
1775
1806
  c.start.clone(),
1776
1807
  c.start.clone().add(h.clone().multiplyScalar(c.length()))
1777
1808
  );
1778
- const u = f.clone().directionMove(f.normal(), c.length() * -0.5).expandToRectangle(c.length(), "bothSides");
1779
- for (let A = 0; A < a.length; A++)
1780
- if (a[A].intersectRectangle(u)) {
1781
- f = new B(
1809
+ const u = d.clone().directionMove(d.normal(), c.length() * -0.5).expandToRectangle(c.length(), "bothSides");
1810
+ for (let E = 0; E < a.length; E++)
1811
+ if (a[E].intersectRectangle(u)) {
1812
+ d = new N(
1782
1813
  c.start.clone(),
1783
1814
  c.start.clone().add(h.clone().multiplyScalar(-c.length()))
1784
1815
  );
1785
1816
  break;
1786
1817
  }
1787
- f.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((A, P) => i(A, P));
1788
- const p = c.length(), y = f.length(), x = (p ** 2 + y ** 2) / (2 * y), S = f.end.clone().add(f.direction().multiplyScalar(-x)), [R, F] = this.getArcAngleRange(S, c.end, f.end);
1789
- r(S, x, Math.min(R, F), Math.max(R, F)), a.push(u);
1818
+ d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((E, R) => i(E, R));
1819
+ const p = c.length(), y = d.length(), x = (p ** 2 + y ** 2) / (2 * y), S = d.end.clone().add(d.direction().multiplyScalar(-x)), [T, G] = this.getArcAngleRange(S, c.end, d.end);
1820
+ r(S, x, Math.min(T, G), Math.max(T, G)), a.push(u);
1790
1821
  } else
1791
- c.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, f) => i(h, f)), c.clone().directionMove(c.normal(), o * 0.5).directionMove(c.direction(), o * 0.5).expansion(-c.length() * 0.45, "end").forward(o * 0.5).expandToRectangle(o).path2D((h, f) => i(h, f)), c.clone().directionMove(c.normal(), -o * 0.5).directionMove(c.direction(), -o * 0.5).expansion(-c.length() * 0.45, "start").forward(-o * 0.5).expandToRectangle(o).path2D((h, f) => i(h, f));
1822
+ c.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, d) => i(h, d)), c.clone().directionMove(c.normal(), o * 0.5).directionMove(c.direction(), o * 0.5).expansion(-c.length() * 0.45, "end").forward(o * 0.5).expandToRectangle(o).path2D((h, d) => i(h, d)), c.clone().directionMove(c.normal(), -o * 0.5).directionMove(c.direction(), -o * 0.5).expansion(-c.length() * 0.45, "start").forward(-o * 0.5).expandToRectangle(o).path2D((h, d) => i(h, d));
1792
1823
  }), s = "yellow", this.lineSegments.forEach((l) => {
1793
1824
  if (!l.userData.isWindow) return !1;
1794
1825
  Array.isArray(l.userData.drawWindow) && l.userData.drawWindow.forEach((c) => {
1795
- const { p: h, width: f } = c, u = w.from(h), p = u.clone().add(l.direction().multiplyScalar(f * 0.5)), y = u.clone().add(l.direction().multiplyScalar(-f * 0.5)), x = new B(p, y);
1796
- i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((S, R) => i(S, R));
1826
+ const { p: h, width: d } = c, u = g.from(h), p = u.clone().add(l.direction().multiplyScalar(d * 0.5)), y = u.clone().add(l.direction().multiplyScalar(-d * 0.5)), x = new N(p, y);
1827
+ i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((S, T) => i(S, T));
1797
1828
  });
1798
1829
  }), n;
1799
1830
  }
@@ -1807,7 +1838,7 @@ class V extends J {
1807
1838
  if (typeof window < "u")
1808
1839
  i = document.createElement("canvas");
1809
1840
  else if (typeof global < "u") {
1810
- const { createCanvas: l } = await K("canvas");
1841
+ const { createCanvas: l } = await se("canvas");
1811
1842
  i = l();
1812
1843
  } else
1813
1844
  throw new Error("创建画布失败");
@@ -1818,12 +1849,12 @@ class V extends J {
1818
1849
  };
1819
1850
  i.width = s.width + r * 2, i.height = s.height + r * 2;
1820
1851
  const a = i.getContext("2d");
1821
- return n && (a.fillStyle = n, a.fillRect(0, 0, i.width, i.height)), a.translate(s.width * 0.5 + r, s.height * 0.5 + r), a.scale(1, -1), s.line.forEach(([l, c, h, f, u]) => {
1822
- a.strokeStyle = o[u], a.beginPath(), a.moveTo(l, c), a.lineTo(h, f), a.closePath(), a.stroke();
1823
- }), s.arc.forEach(([l, c, h, f, u, p]) => {
1824
- a.strokeStyle = o[p], a.beginPath(), a.arc(l, c, h, f * (Math.PI / 180), u * (Math.PI / 180)), a.stroke();
1852
+ return n && (a.fillStyle = n, a.fillRect(0, 0, i.width, i.height)), a.translate(s.width * 0.5 + r, s.height * 0.5 + r), a.scale(1, -1), s.line.forEach(([l, c, h, d, u]) => {
1853
+ a.strokeStyle = o[u], a.beginPath(), a.moveTo(l, c), a.lineTo(h, d), a.closePath(), a.stroke();
1854
+ }), s.arc.forEach(([l, c, h, d, u, p]) => {
1855
+ a.strokeStyle = o[p], a.beginPath(), a.arc(l, c, h, d * (Math.PI / 180), u * (Math.PI / 180)), a.stroke();
1825
1856
  }), a.beginPath(), s.dimensionLine.forEach((l) => {
1826
- let [c, h, f, u] = l;
1857
+ let [c, h, d, u] = l;
1827
1858
  const p = Math.min(h, u), y = Math.max(h, u), x = (i.width * 0.5 - 0.4 * s.scale) * (c < 0 ? -1 : 1), S = (y - p) * 0.45;
1828
1859
  a.fillStyle = "#fff", a.font = `${0.15 * s.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.save(), a.translate(x, p + (y - p) * 0.5), a.scale(1, -1), a.fillText((y - p).toFixed(2) + "cm", 0, 0), a.restore(), a.moveTo(x - 0.1 * s.scale, p), a.lineTo(x + 0.1 * s.scale, p), a.moveTo(x, p), a.lineTo(x, S + p), a.moveTo(x, y), a.lineTo(x, y - S), a.moveTo(x - 0.1 * s.scale, y), a.lineTo(x + 0.1 * s.scale, y);
1829
1860
  }), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in i ? new Promise((l) => {
@@ -1836,8 +1867,8 @@ class V extends J {
1836
1867
  * 将点json结构转换为Dxf string
1837
1868
  */
1838
1869
  toDxfString(e = "Millimeters") {
1839
- const t = new Q();
1840
- t.setUnits(e), t.addLayer("cyan", Q.ACI.CYAN, "DOTTED"), t.addLayer("yellow", Q.ACI.YELLOW, "DOTTED"), t.addLayer("white", Q.ACI.WHITE, "DOTTED");
1870
+ const t = new ae();
1871
+ t.setUnits(e), t.addLayer("cyan", ae.ACI.CYAN, "DOTTED"), t.addLayer("yellow", ae.ACI.YELLOW, "DOTTED"), t.addLayer("white", ae.ACI.WHITE, "DOTTED");
1841
1872
  const n = this.toDrawDataJson();
1842
1873
  return n.line.forEach((s) => {
1843
1874
  let [i, r, o, a, l] = s;
@@ -1863,7 +1894,7 @@ class V extends J {
1863
1894
  if (typeof window < "u") {
1864
1895
  const n = new Blob([t], { type: "application/json" }), s = document.createElement("a");
1865
1896
  s.href = URL.createObjectURL(n), s.download = e, s.click();
1866
- } else typeof global < "u" && (await K("fs", !1)).writeFileSync(e, t);
1897
+ } else typeof global < "u" && (await se("fs", !1)).writeFileSync(e, t);
1867
1898
  }
1868
1899
  /**
1869
1900
  * 下载
@@ -1873,7 +1904,7 @@ class V extends J {
1873
1904
  if (typeof window < "u") {
1874
1905
  const n = this.toDxfBlob(t), s = document.createElement("a");
1875
1906
  s.href = URL.createObjectURL(n), s.download = e + ".dxf", s.click();
1876
- } else typeof global < "u" && (await K("fs", !1)).writeFileSync(e, this.toDxfString(t));
1907
+ } else typeof global < "u" && (await se("fs", !1)).writeFileSync(e, this.toDxfString(t));
1877
1908
  }
1878
1909
  /**
1879
1910
  * 下载
@@ -1885,7 +1916,7 @@ class V extends J {
1885
1916
  if (typeof window < "u") {
1886
1917
  const i = document.createElement("a");
1887
1918
  i.href = URL.createObjectURL(s), i.download = e, i.click();
1888
- } else typeof global < "u" ? (await K("fs", !1)).writeFileSync(e, s) : console.error("图片下载失败");
1919
+ } else typeof global < "u" ? (await se("fs", !1)).writeFileSync(e, s) : console.error("图片下载失败");
1889
1920
  return !0;
1890
1921
  }
1891
1922
  /**
@@ -1893,10 +1924,34 @@ class V extends J {
1893
1924
  * @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
1894
1925
  * @returns
1895
1926
  */
1896
- computedOriginalSize(e, t = new _(0, 0, 0, 0)) {
1927
+ computedOriginalSize(e, t = new j(0, 0, 0, 0)) {
1897
1928
  const n = e.flatMap((l) => [l.start.x, l.end.x]), s = e.flatMap((l) => [l.start.y, l.end.y]), i = Math.min(...n), r = Math.min(...s), o = Math.max(...n), a = Math.max(...s);
1898
1929
  return t.set(i, r, o, a), t;
1899
1930
  }
1931
+ /**
1932
+ * 线段数据转为原始json数据
1933
+ */
1934
+ static lineDataToOriginalData(e, t = 0, n) {
1935
+ return n || (n = new Z(j.fromByLineSegment(...e)), e.forEach((s) => n?.insert({ line: s, userData: void 0 }))), e.map((s) => {
1936
+ const i = s.userData, r = i.drawWindow, o = n.queryLineSegment(s).filter((a) => a.line !== s && !a.userData?.isDoor).map((a) => ({ index: e.indexOf(a.line) }));
1937
+ return {
1938
+ start: s.start.toJson(t),
1939
+ end: s.end.toJson(t),
1940
+ insetionArr: o,
1941
+ isDoor: i.isDoor,
1942
+ doorDirectConnection: i.isDoor,
1943
+ length: s.length(),
1944
+ isWindow: i.isWindow,
1945
+ isVerticalReferenceLine: i.isVerticalReferenceLine,
1946
+ wallWidth: s.userData.wallWidth,
1947
+ drawWindow: r && r.map((a) => ({
1948
+ p: { x: a.p.x, y: a.p.y, z: a.p.z },
1949
+ width: a.width,
1950
+ full: a.full
1951
+ }))
1952
+ };
1953
+ });
1954
+ }
1900
1955
  /**
1901
1956
  * 创建数据
1902
1957
  * @param pointsGroups
@@ -1926,292 +1981,316 @@ class V extends J {
1926
1981
  * @param targettLine 轴线段
1927
1982
  * @returns
1928
1983
  */
1929
- static axisAlignmentCorrection(e, t) {
1930
- function n(M, L) {
1931
- const g = [];
1932
- for (let b = 0; b < M.length; b++) {
1933
- const m = M[b], E = /* @__PURE__ */ new Map();
1934
- m.userData.isDoor || m.points.forEach((T) => {
1935
- if (L.queryPoint(T).length > 1) return;
1936
- const I = L.queryCircle(T, 0.4).filter((D) => {
1937
- const v = D.userData;
1984
+ static axisAlignmentCorrection(e, t, n) {
1985
+ const { principalAxisThreshold: s = 0.3, crossAxistThreshold: i = 0.06, snapThreshold: r = 0.2 } = n ?? {};
1986
+ function o(D, b) {
1987
+ const L = [];
1988
+ for (let M = 0; M < D.length; M++) {
1989
+ const m = D[M], w = /* @__PURE__ */ new Map();
1990
+ m.userData.isDoor || m.points.forEach((I) => {
1991
+ if (b.queryPoint(I).length > 1) return;
1992
+ const A = b.queryCircle(I, 0.4).filter((F) => {
1993
+ const v = F.userData;
1938
1994
  if (v === m || !m.parallel(v, 25)) return !1;
1939
- if (L.queryPoint(D.point).length > 1) return;
1940
- const O = new B(T, D.point), q = new B(m.start === T ? m.end : m.start, v.start === D.point ? v.end : v.start);
1941
- if (!O.intersectLineSegment(q)) return !1;
1942
- const G = T.distance(D.point);
1943
- return G < 1e-3 ? !1 : (E.set(D.point, G), !0);
1944
- }).sort((D, v) => {
1945
- const O = E.get(D.point), q = E.get(v.point);
1946
- return O - q;
1995
+ if (b.queryPoint(F.point).length > 1) return;
1996
+ const _ = new N(I, F.point), q = new N(m.start === I ? m.end : m.start, v.start === F.point ? v.end : v.start);
1997
+ if (!_.intersectLineSegment(q)) return !1;
1998
+ const Y = I.distance(F.point);
1999
+ return Y < 1e-3 ? !1 : (w.set(F.point, Y), !0);
2000
+ }).sort((F, v) => {
2001
+ const _ = w.get(F.point), q = w.get(v.point);
2002
+ return _ - q;
1947
2003
  });
1948
- if (I.length === 0) return;
1949
- const N = I[0].userData;
1950
- g.push(new B(m.projectLineSegment(N).center, N.projectLineSegment(m).center));
2004
+ if (A.length === 0) return;
2005
+ const B = A[0].userData;
2006
+ L.push(new N(m.projectLineSegment(B).center, B.projectLineSegment(m).center));
1951
2007
  });
1952
2008
  }
1953
- return [...M, ...g];
2009
+ return [...D, ...L];
1954
2010
  }
1955
- function s(M) {
1956
- const L = new he(), g = new X(_.fromByLineSegment(...M)), b = [];
1957
- return M.forEach((m) => {
1958
- m.userData.isDoor ? b.push(m) : (m.points.forEach((E) => L.insert(E, m)), g.insert({ line: m, userData: void 0 }));
1959
- }), b.forEach((m) => {
1960
- const E = L.queryPoint(m.start), T = L.queryPoint(m.end);
1961
- E.length ? m.userData.startIntersection = E[0].userData : m.userData.startIntersection = g.queryPoint(m.start)[0]?.line, T.length ? m.userData.endIntersection = T[0].userData : m.userData.endIntersection = g.queryPoint(m.end)[0]?.line;
1962
- }), M = n(M, L), M;
2011
+ function a(D) {
2012
+ const b = new ge(), L = new Z(j.fromByLineSegment(...D)), M = [];
2013
+ return D.forEach((m) => {
2014
+ m.userData.isDoor ? M.push(m) : (m.points.forEach((w) => b.insert(w, m)), L.insert({ line: m, userData: void 0 }));
2015
+ }), M.forEach((m) => {
2016
+ const w = b.queryPoint(m.start), I = b.queryPoint(m.end);
2017
+ w.length ? m.userData.startIntersection = w[0].userData : m.userData.startIntersection = L.queryPoint(m.start)[0]?.line, I.length ? m.userData.endIntersection = I[0].userData : m.userData.endIntersection = L.queryPoint(m.end)[0]?.line;
2018
+ }), D = o(D, b), D;
1963
2019
  }
1964
- function i(M, L) {
1965
- const g = [M], b = [], m = [], E = [];
1966
- for (let T = 0; T < L.length; T++) {
1967
- const I = L[T];
1968
- if (M !== I)
1969
- if (I.userData.isWindow && E.push(I), I.parallel(M, 45)) {
1970
- const N = Math.atan2(I.end.y - I.start.y, I.end.x - I.start.x);
1971
- let v = Math.atan2(M.end.y - M.start.y, M.end.x - M.start.x) - N;
2020
+ function l(D) {
2021
+ const b = new Z(j.fromByLineSegment(...D));
2022
+ D.forEach((M) => {
2023
+ M.userData.isDoor || b.insert({ line: M, userData: void 0 });
2024
+ });
2025
+ const L = /* @__PURE__ */ new Map();
2026
+ for (let M = 0; M < D.length; M++) {
2027
+ const m = D[M];
2028
+ L.set(m, b.queryLineSegment(m).filter((w) => w.line !== m).map((w) => w.line));
2029
+ }
2030
+ return L;
2031
+ }
2032
+ function c(D, b) {
2033
+ const L = [D], M = [], m = [], w = [];
2034
+ for (let I = 0; I < b.length; I++) {
2035
+ const A = b[I];
2036
+ if (D !== A)
2037
+ if (A.userData.isWindow && w.push(A), A.parallel(D, 45)) {
2038
+ const B = Math.atan2(A.end.y - A.start.y, A.end.x - A.start.x);
2039
+ let v = Math.atan2(D.end.y - D.start.y, D.end.x - D.start.x) - B;
1972
2040
  for (; v > Math.PI; ) v -= 2 * Math.PI;
1973
2041
  for (; v < -Math.PI; ) v += 2 * Math.PI;
1974
- const O = I.center;
1975
- I.start.rotate(O, v), I.end.rotate(O, v), I.userData.isDoor ? m.push(I) : g.push(I);
2042
+ const _ = A.center;
2043
+ A.start.rotate(_, v), A.end.rotate(_, v), A.userData.isDoor ? m.push(A) : L.push(A);
1976
2044
  } else {
1977
- const N = Math.atan2(I.end.y - I.start.y, I.end.x - I.start.x), D = Math.atan2(M.end.y - M.start.y, M.end.x - M.start.x);
1978
- let v = D + Math.PI / 2 - N, O = D - Math.PI / 2 - N;
2045
+ const B = Math.atan2(A.end.y - A.start.y, A.end.x - A.start.x), F = Math.atan2(D.end.y - D.start.y, D.end.x - D.start.x);
2046
+ let v = F + Math.PI / 2 - B, _ = F - Math.PI / 2 - B;
1979
2047
  for (; v > Math.PI; ) v -= 2 * Math.PI;
1980
2048
  for (; v < -Math.PI; ) v += 2 * Math.PI;
1981
- for (; O > Math.PI; ) O -= 2 * Math.PI;
1982
- for (; O < -Math.PI; ) O += 2 * Math.PI;
1983
- const q = Math.abs(v) < Math.abs(O) ? v : O, G = I.center;
1984
- I.start.rotate(G, q), I.end.rotate(G, q), I.userData.isDoor ? m.push(I) : b.push(I);
2049
+ for (; _ > Math.PI; ) _ -= 2 * Math.PI;
2050
+ for (; _ < -Math.PI; ) _ += 2 * Math.PI;
2051
+ const q = Math.abs(v) < Math.abs(_) ? v : _, Y = A.center;
2052
+ A.start.rotate(Y, q), A.end.rotate(Y, q), A.userData.isDoor ? m.push(A) : M.push(A);
1985
2053
  }
1986
2054
  }
1987
- return { parallelLines: g, verticalLines: b, doorLines: m, windowLines: E };
2055
+ return { parallelLines: L, verticalLines: M, doorLines: m, windowLines: w };
1988
2056
  }
1989
- function r(M, L, g, b = 0.3, m = 0.1) {
1990
- const E = [];
1991
- M.forEach((N) => {
1992
- const D = g.projectPoint(N.start, !1);
1993
- D && (D.userData = N, E.push(D));
1994
- }), E.sort((N, D) => D.distance(g.start) - N.distance(g.start));
1995
- const T = [], I = [];
1996
- for (let N = 0; N < E.length; N++) {
1997
- const D = E[N];
1998
- if (N === 0) {
1999
- I.push(D);
2057
+ function h(D, b, L) {
2058
+ const M = [];
2059
+ D.forEach((I) => {
2060
+ const A = L.projectPoint(I.start, !1);
2061
+ A && (A.userData = I, M.push(A));
2062
+ }), M.sort((I, A) => A.distance(L.start) - I.distance(L.start));
2063
+ const m = [], w = [];
2064
+ for (let I = 0; I < M.length; I++) {
2065
+ const A = M[I];
2066
+ if (I === 0) {
2067
+ w.push(A);
2000
2068
  continue;
2001
2069
  }
2002
- E[N - 1].distance(D) < m || (T.push([...I]), I.length = 0), I.push(D), N === E.length - 1 && T.push(I);
2070
+ M[I - 1].distance(A) < i || (m.push([...w]), w.length = 0), w.push(A), I === M.length - 1 && m.push(w);
2003
2071
  }
2004
- return T.flatMap((N) => {
2005
- const D = N.flatMap((G) => {
2006
- const j = G.userData;
2007
- return j.points.map((k) => {
2008
- const z = L.projectPoint(k, !1);
2009
- return z.userData = j, z;
2072
+ return m.flatMap((I) => {
2073
+ const A = I.flatMap((_) => {
2074
+ const q = _.userData;
2075
+ return q.points.map((Y) => {
2076
+ const Q = b.projectPoint(Y, !1);
2077
+ return Q.userData = q, Q;
2010
2078
  });
2011
2079
  });
2012
- D.sort((G, j) => G.distance(L.start) - j.distance(L.start));
2013
- const v = /* @__PURE__ */ new Map(), O = [], q = [];
2014
- return D.forEach((G, j) => {
2015
- v.size === 0 && j > 0 && D[j - 1].distance(G) > b && (O.push([...q]), q.length = 0), v.set(G.userData, (v.get(G.userData) ?? 0) + 1);
2016
- for (const k of v.values()) if (k !== 2) return;
2017
- q.push(...v.keys()), v.clear();
2018
- }), O.push([...q]), O;
2080
+ A.sort((_, q) => _.distance(b.start) - q.distance(b.start));
2081
+ const B = /* @__PURE__ */ new Map(), F = [], v = [];
2082
+ return A.forEach((_, q) => {
2083
+ B.size === 0 && q > 0 && A[q - 1].distance(_) > s && (F.push([...v]), v.length = 0), B.set(_.userData, (B.get(_.userData) ?? 0) + 1);
2084
+ for (const Y of B.values()) if (Y !== 2) return;
2085
+ v.push(...B.keys()), B.clear();
2086
+ }), F.push([...v]), F;
2019
2087
  });
2020
2088
  }
2021
- function o(M, L = 0.1) {
2022
- return M.map((g) => {
2023
- if (g.length === 0) return;
2024
- if (g.length === 1) return g[0];
2025
- const b = [];
2026
- g.forEach((z) => {
2027
- b.push(z.start.clone(), z.end.clone());
2089
+ function d(D, b) {
2090
+ const L = /* @__PURE__ */ new Set();
2091
+ return D.forEach((M) => {
2092
+ for (let m = 1; m < M.length; m++) {
2093
+ const w = M[m], I = M[m - 1];
2094
+ [...b.get(w) ?? [], ...b.get(I) ?? []].forEach((B) => {
2095
+ (B.sameEndpointAsStart(w) && B.sameEndpointAsEnd(I) || B.sameEndpointAsStart(I) && B.sameEndpointAsEnd(w)) && L.add(B);
2096
+ });
2097
+ }
2098
+ }), D.map((M) => M.filter((m) => !L.has(m)));
2099
+ }
2100
+ function u(D, b = 0.1) {
2101
+ return D.map((L) => {
2102
+ if (L.length === 0) return;
2103
+ if (L.length === 1) return L[0];
2104
+ const M = [];
2105
+ L.forEach((K) => {
2106
+ M.push(K.start.clone(), K.end.clone());
2028
2107
  });
2029
- const m = g[0].direction().normalize();
2030
- let E = 1 / 0, T = -1 / 0, I = 0, N = 0;
2031
- b.forEach((z) => {
2032
- const $ = z.x * m.x + z.y * m.y;
2033
- E = Math.min(E, $), T = Math.max(T, $), I += z.x, N += z.y;
2108
+ const m = L[0].direction().normalize();
2109
+ let w = 1 / 0, I = -1 / 0, A = 0, B = 0;
2110
+ M.forEach((K) => {
2111
+ const re = K.x * m.x + K.y * m.y;
2112
+ w = Math.min(w, re), I = Math.max(I, re), A += K.x, B += K.y;
2034
2113
  });
2035
- const D = new w(I / b.length, N / b.length), v = D.x * m.x + D.y * m.y, O = new w(D.x + (E - v) * m.x, D.y + (E - v) * m.y), q = new w(D.x + (T - v) * m.x, D.y + (T - v) * m.y), G = new B(O, q), j = g[0].normal().normalize();
2036
- E = 1 / 0, T = -1 / 0, b.forEach((z) => {
2037
- const $ = z.x * j.x + z.y * j.y;
2038
- E = Math.min(E, $), T = Math.max(T, $);
2114
+ const F = new g(A / M.length, B / M.length), v = F.x * m.x + F.y * m.y, _ = new g(F.x + (w - v) * m.x, F.y + (w - v) * m.y), q = new g(F.x + (I - v) * m.x, F.y + (I - v) * m.y), Y = new N(_, q), Q = L[0].normal().normalize();
2115
+ w = 1 / 0, I = -1 / 0, M.forEach((K) => {
2116
+ const re = K.x * Q.x + K.y * Q.y;
2117
+ w = Math.min(w, re), I = Math.max(I, re);
2039
2118
  });
2040
- const k = T - E;
2041
- return k >= L && (G.userData.wallWidth = k), g.forEach((z) => z.userData.fittedLine = G), G;
2042
- }).filter((g) => !!g);
2119
+ const ie = I - w;
2120
+ return ie >= b && (Y.userData.wallWidth = ie), L.forEach((K) => K.userData.fittedLine = Y), Y;
2121
+ }).filter((L) => !!L);
2043
2122
  }
2044
- function a(M, L = 0.2) {
2045
- const g = new X(_.fromByLineSegment(...M)), b = /* @__PURE__ */ new Map();
2046
- M.forEach((E) => {
2047
- b.set(E, { line: E, userData: void 0 }), g.insert(b.get(E));
2123
+ function p(D) {
2124
+ const b = new Z(j.fromByLineSegment(...D)), L = /* @__PURE__ */ new Map();
2125
+ D.forEach((m) => {
2126
+ L.set(m, { line: m, userData: void 0 }), b.insert(L.get(m));
2048
2127
  });
2049
- const m = new B();
2050
- for (let E = 0; E < M.length; E++) {
2051
- const T = M[E];
2052
- if (T.userData.isAdsorbed) continue;
2053
- const I = T.direction().multiplyScalar(L), [N, D] = T.points.map((v) => {
2054
- m.set(v, v), m.start.add(I), m.end.add(I.multiplyScalar(-1));
2055
- const O = /* @__PURE__ */ new Map(), q = g.queryRect(m.expandToRectangle(0.1, "bothSides")).filter((G) => G.line !== T).map((G) => {
2056
- const j = G.line.getIntersection(m);
2057
- return O.set(G.line, j), G.line;
2058
- }).sort((G, j) => {
2059
- const k = O.get(G), z = O.get(j);
2060
- return k && z ? k.distance(v) - z.distance(v) : 0;
2128
+ const M = new N();
2129
+ for (let m = 0; m < D.length; m++) {
2130
+ const w = D[m];
2131
+ if (w.userData.isAdsorbed) continue;
2132
+ const I = w.direction().multiplyScalar(r), [A, B] = w.points.map((F) => {
2133
+ M.set(F, F), M.start.add(I), M.end.add(I.multiplyScalar(-1));
2134
+ const v = /* @__PURE__ */ new Map(), _ = b.queryRect(M.expandToRectangle(0.1, "bothSides")).filter((q) => q.line !== w).map((q) => {
2135
+ const Y = q.line.getIntersection(M);
2136
+ return v.set(q.line, Y), q.line;
2137
+ }).sort((q, Y) => {
2138
+ const Q = v.get(q), ie = v.get(Y);
2139
+ return Q && ie ? Q.distance(F) - ie.distance(F) : 0;
2061
2140
  });
2062
- return q.length ? O.get(q[0]) : void 0;
2141
+ return _.length ? v.get(_[0]) : void 0;
2063
2142
  });
2064
- if (N && D) {
2065
- if (N.equal(D)) {
2066
- const v = T.start.distance(N), O = T.end.distance(D);
2067
- v < O ? T.directionMove(T.start.direction(T.end), v) : T.directionMove(T.end.direction(T.start), O);
2143
+ if (A && B) {
2144
+ if (A.equal(B)) {
2145
+ const F = w.start.distance(A), v = w.end.distance(B);
2146
+ F < v ? w.directionMove(w.start.direction(w.end), F) : w.directionMove(w.end.direction(w.start), v);
2068
2147
  } else
2069
- T.start.copy(N), T.end.copy(D);
2070
- T.userData.isAdsorbed = !0;
2071
- } else N ? T.start.copy(N) : D && T.end.copy(D);
2072
- g.remove(b.get(T)), g.insert(b.get(T));
2148
+ w.start.copy(A), w.end.copy(B);
2149
+ w.userData.isAdsorbed = !0;
2150
+ } else A ? w.start.copy(A) : B && w.end.copy(B);
2151
+ b.remove(L.get(w)), b.insert(L.get(w));
2073
2152
  }
2074
- return M.filter((E) => E.length() > 1e-3);
2153
+ return D.filter((m) => m.length() > 1e-3);
2075
2154
  }
2076
- function l(M) {
2077
- for (let L = 0; L < M.length; L++) {
2078
- const g = M[L], b = g.userData.fittedLine;
2079
- if (b) {
2080
- const m = g.direction();
2081
- b.userData.isWindow = !0, b.userData.drawWindow = b.userData.drawWindow ?? [], g.userData.drawWindow?.forEach((E) => {
2082
- const T = w.from(E.p), I = b.projectPoint(
2083
- T.clone().add(m.clone().multiplyScalar(E.width * 0.5))
2084
- ), N = b.projectPoint(
2085
- T.clone().add(m.clone().multiplyScalar(E.width * -0.5))
2086
- ), D = new B(I, N), v = D.center;
2087
- b.userData.drawWindow?.push({
2088
- p: new U.Vector3(v?.x ?? 0, v?.y ?? 0, E.p.z),
2089
- width: D.length(),
2090
- full: E.full
2155
+ function y(D) {
2156
+ for (let b = 0; b < D.length; b++) {
2157
+ const L = D[b], M = L.userData.fittedLine;
2158
+ if (M) {
2159
+ const m = L.direction();
2160
+ M.userData.isWindow = !0, M.userData.drawWindow = M.userData.drawWindow ?? [], L.userData.drawWindow?.forEach((w) => {
2161
+ const I = g.from(w.p), A = M.projectPoint(
2162
+ I.clone().add(m.clone().multiplyScalar(w.width * 0.5))
2163
+ ), B = M.projectPoint(
2164
+ I.clone().add(m.clone().multiplyScalar(w.width * -0.5))
2165
+ ), F = new N(A, B), v = F.center;
2166
+ M.userData.drawWindow?.push({
2167
+ p: new z.Vector3(v?.x ?? 0, v?.y ?? 0, w.p.z),
2168
+ width: F.length(),
2169
+ full: w.full
2091
2170
  });
2092
2171
  });
2093
2172
  }
2094
2173
  }
2095
2174
  }
2096
- function c(M) {
2097
- for (let L = 0; L < M.length; L++) {
2098
- const g = M[L];
2099
- let { endIntersection: b, startIntersection: m } = g.userData;
2100
- if (!(!b || !m)) {
2101
- if (m.userData.fittedLine && (m = m.userData.fittedLine), b.userData.fittedLine && (b = b.userData.fittedLine), g.isParallel(m))
2102
- g.start.distance(m.start) < g.start.distance(m.end) ? g.start.copy(m.start) : g.start.copy(m.end);
2175
+ function x(D) {
2176
+ for (let b = 0; b < D.length; b++) {
2177
+ const L = D[b];
2178
+ let { endIntersection: M, startIntersection: m } = L.userData;
2179
+ if (!(!M || !m)) {
2180
+ if (m.userData.fittedLine && (m = m.userData.fittedLine), M.userData.fittedLine && (M = M.userData.fittedLine), L.isParallel(m))
2181
+ L.start.distance(m.start) < L.start.distance(m.end) ? L.start.copy(m.start) : L.start.copy(m.end);
2103
2182
  else {
2104
- const E = m.projectPoint(g.start);
2105
- E && g.start.copy(E);
2183
+ const w = m.projectPoint(L.start);
2184
+ w && L.start.copy(w);
2106
2185
  }
2107
- if (g.isParallel(b))
2108
- g.end.distance(b.start) < g.end.distance(b.end) ? g.end.copy(b.start) : g.end.copy(b.end);
2186
+ if (L.isParallel(M))
2187
+ L.end.distance(M.start) < L.end.distance(M.end) ? L.end.copy(M.start) : L.end.copy(M.end);
2109
2188
  else {
2110
- const E = b.projectPoint(g.end);
2111
- E && g.end.copy(E);
2189
+ const w = M.projectPoint(L.end);
2190
+ w && L.end.copy(w);
2112
2191
  }
2113
2192
  }
2114
2193
  }
2115
- return M;
2194
+ return D;
2116
2195
  }
2117
- function h(M) {
2118
- const L = new X(_.fromByLineSegment(...M));
2119
- return M.forEach((g) => L.insert({ line: g, userData: void 0 })), M.flatMap((g) => {
2120
- const b = L.queryLineSegment(g, !0).map((m) => {
2121
- if (m.line === g) return;
2122
- const E = m.line.getIntersection(g);
2123
- if (!(!E || g.start.equal(E) || g.end.equal(E)))
2124
- return E;
2196
+ function S(D) {
2197
+ const b = new Z(j.fromByLineSegment(...D));
2198
+ return D.forEach((L) => b.insert({ line: L, userData: void 0 })), D.flatMap((L) => {
2199
+ const M = b.queryLineSegment(L, !0).map((m) => {
2200
+ if (m.line === L) return;
2201
+ const w = m.line.getIntersection(L);
2202
+ if (!(!w || L.start.equal(w) || L.end.equal(w)))
2203
+ return w;
2125
2204
  }).filter((m) => !!m);
2126
- if (b.length) {
2127
- const m = g.clone();
2128
- b.sort((T, I) => m.start.distance(T) - m.start.distance(I));
2129
- const E = b.map((T) => {
2130
- const I = m.clone();
2131
- return I.set(m.start.clone(), T), m.start.copy(T), m.userData.isWindow && (I.userData.isWindow = !0, I.userData.drawWindow = m.userData.drawWindow?.filter((N) => I.isPointOnSegment(w.from(N.p))) ?? []), I;
2205
+ if (M.length) {
2206
+ const m = L.clone();
2207
+ M.sort((I, A) => m.start.distance(I) - m.start.distance(A));
2208
+ const w = M.map((I) => {
2209
+ const A = m.clone();
2210
+ return A.set(m.start.clone(), I), m.start.copy(I), m.userData.isWindow && (A.userData.isWindow = !0, A.userData.drawWindow = m.userData.drawWindow?.filter((B) => A.isPointOnSegment(g.from(B.p))) ?? []), A;
2132
2211
  });
2133
- return m.userData.drawWindow = m.userData.drawWindow?.filter((T) => m.isPointOnSegment(w.from(T.p))) ?? [], [...E, m];
2212
+ return m.userData.drawWindow = m.userData.drawWindow?.filter((I) => m.isPointOnSegment(g.from(I.p))) ?? [], [...w, m];
2134
2213
  }
2135
- return g;
2136
- }).filter((g) => g.length() > 0.03);
2214
+ return L;
2215
+ }).filter((L) => L.length() > 0.03);
2137
2216
  }
2138
- e = s(e.map((M) => M.clone()));
2139
- const { parallelLines: f, verticalLines: u, doorLines: p, windowLines: y } = i(t, e), x = t.normal(), S = t.center, R = t.direction(), F = new B(
2140
- S.clone().add(x.clone().multiplyScalar(-1e3)),
2141
- S.clone().add(x.clone().multiplyScalar(1e3))
2142
- ), A = new B(
2143
- S.clone().add(R.clone().multiplyScalar(-1e3)),
2144
- S.clone().add(R.clone().multiplyScalar(1e3))
2217
+ e = a(e.map((D) => D.clone()));
2218
+ const T = l(e), { parallelLines: G, verticalLines: E, doorLines: R, windowLines: U } = c(t, e), P = t.normal(), O = t.center, X = t.direction(), k = new N(
2219
+ O.clone().add(P.clone().multiplyScalar(-1e3)),
2220
+ O.clone().add(P.clone().multiplyScalar(1e3))
2221
+ ), W = new N(
2222
+ O.clone().add(X.clone().multiplyScalar(-1e3)),
2223
+ O.clone().add(X.clone().multiplyScalar(1e3))
2145
2224
  );
2146
- let P = o([
2147
- ...r.call(this, f, A, F),
2148
- ...r.call(this, u, F, A)
2149
- ]);
2150
- return P = a.call(this, P), P = a.call(this, P), l(y), c(p), P = h.call(this, P), P.push(...p), P;
2225
+ let J = [
2226
+ ...h.call(this, G, W, k),
2227
+ ...h.call(this, E, k, W)
2228
+ ];
2229
+ J = d(J, T);
2230
+ let V = u(J);
2231
+ return V = p.call(this, V), V = p.call(this, V), y(U), x(R), V = S.call(this, V), V.push(...R), V;
2151
2232
  }
2152
2233
  /**
2153
2234
  * @param lines
2154
- * @param trajectoryPositions
2235
+ * @param trajectoryPoints
2155
2236
  * @returns
2156
2237
  */
2157
- static excessLineSegments(e, t) {
2158
- const n = new X(_.fromByLineSegment(...e));
2159
- return e.forEach((s) => n.insert({ line: s, userData: void 0 })), e = e.filter((s) => {
2160
- const i = s.center;
2161
- for (const r of t) {
2162
- const o = new B(i, r);
2163
- if (!n.queryLineSegment(o).filter((l) => l.line !== s).length) return !1;
2164
- }
2165
- return !0;
2166
- }), e.filter((s) => {
2167
- const i = n.queryLineSegment(s).filter((r) => r.line !== s);
2168
- for (let r = 0; r < i.length; r++) {
2169
- const o = i[r];
2170
- if (e.indexOf(o.line) === -1) return !1;
2238
+ static findExteriorWall(e, t, n = 0.4) {
2239
+ const s = new Z(j.fromByLineSegment(...e));
2240
+ return e.forEach((i) => s.insert({ line: i, userData: void 0 })), e = e.filter((i) => {
2241
+ const r = i.center, o = /* @__PURE__ */ new Set();
2242
+ for (const a of t) {
2243
+ if (o.size === 2) break;
2244
+ const l = new N(r, a);
2245
+ if (!s.queryLineSegment(l).filter((h) => {
2246
+ if (h.line === i) return !1;
2247
+ if (h.line.isParallel(i)) {
2248
+ if (i.getMinLength(h.line) < n) return !1;
2249
+ } else if (h.line.sameEndpoint(i) && h.line.length() < n) return !1;
2250
+ return !0;
2251
+ }).length) {
2252
+ const h = i.pointPosition(a);
2253
+ h !== "on" && o.add(h);
2254
+ }
2171
2255
  }
2172
- return !0;
2173
- });
2256
+ if (i.userData.expandDirect = [...o][0], o.size < 2) return !0;
2257
+ }), e;
2174
2258
  }
2175
2259
  /** 边线外扩
2176
2260
  * @param lines
2177
- * @param trajectory
2178
- */
2179
- static boundaryExtension(e, t) {
2180
- const s = this.parent?.findComponentByName("Renderer"), i = V.excessLineSegments(e, t);
2181
- e = e.filter((o) => i.indexOf(o) === -1);
2182
- const r = new X(_.fromByLineSegment(...e));
2183
- e.forEach((o) => o.userData.isDoor || r.insert({ line: o, userData: void 0 }));
2184
- for (let o = 0; o < e.length; o++) {
2185
- if (e[o].userData.isDoor) continue;
2186
- const a = e[o], l = a.direction(), c = a.normal(), h = a.center, f = 20;
2187
- if ([
2188
- h.expandAsLine(c, f),
2189
- h.expandAsLine(c, -f),
2190
- a.start.expandAsLine(l, -f),
2191
- a.start.expandAsLine(c, f),
2192
- a.start.expandAsLine(c, -f),
2193
- a.end.expandAsLine(l, f),
2194
- a.end.expandAsLine(c, f),
2195
- a.end.expandAsLine(c, -f)
2196
- ].filter((y) => (y.directionMove(y.direction(), 1e-3), r.queryLineSegment(y, !1).filter((x) => x.line !== a).length === 0)).length) {
2197
- const y = s.createLineSegments([a], 0, { color: 16711680 });
2198
- y.position.z = 1e-3;
2261
+ * @param trajectoryPoints
2262
+ */
2263
+ static boundaryExtension(e, t, n = 0.1) {
2264
+ const s = Object.keys(t).map((c) => g.from(t[c])), i = [];
2265
+ let r = e.map(({ start: c, end: h, ...d }) => {
2266
+ const u = new N(g.from(c), g.from(h));
2267
+ return u.userData = d, i.push(c.z ?? 0, h.z ?? 0), u;
2268
+ });
2269
+ const o = i.reduce((c, h) => c + h, 0) / i.length, a = $.findExteriorWall(r, s), l = a.filter((c) => c.userData.expandDirect);
2270
+ return r = r.filter((c) => !(a.includes(c) && !c.userData.expandDirect)), l.forEach((c) => {
2271
+ const h = c.userData.expandDirect;
2272
+ if (h === "left") {
2273
+ const d = c.getLeftDirection();
2274
+ c.directionMove(d, n * 0.5);
2275
+ } else if (h === "right") {
2276
+ const d = c.getRightDirection();
2277
+ c.directionMove(d, n * 0.5);
2199
2278
  }
2200
- }
2201
- return e;
2279
+ }), $.lineDataToOriginalData(r, o);
2202
2280
  }
2281
+ boundaryExtension = $.boundaryExtension;
2203
2282
  }
2204
- function ue(d) {
2205
- if (d === null || typeof d != "object") return d;
2206
- if (d instanceof Date) return new Date(d.getTime());
2207
- if (Array.isArray(d)) return d.map(ue);
2283
+ function we(f) {
2284
+ if (f === null || typeof f != "object") return f;
2285
+ if (f instanceof Date) return new Date(f.getTime());
2286
+ if (Array.isArray(f)) return f.map(we);
2208
2287
  const e = {};
2209
- for (const t in d)
2210
- Object.prototype.hasOwnProperty.call(d, t) && (e[t] = ue(d[t]));
2288
+ for (const t in f)
2289
+ Object.prototype.hasOwnProperty.call(f, t) && (e[t] = we(f[t]));
2211
2290
  return e;
2212
2291
  }
2213
- const W = new B();
2214
- class et extends V {
2292
+ const ee = new N();
2293
+ class ct extends $ {
2215
2294
  static name = "AngleCorrectionDxf";
2216
2295
  angle = 0;
2217
2296
  onAddFromParent(e) {
@@ -2222,27 +2301,27 @@ class et extends V {
2222
2301
  let s = 0, i = null;
2223
2302
  for (let l = 0; l < t.originalData.length; l++) {
2224
2303
  const c = t.originalData[l];
2225
- if (W.start.copy(c.start), W.end.copy(c.end), c.isVerticalReferenceLine) {
2226
- const [h, f] = c.start.y < c.end.y ? [W.start, W.end] : [W.end, W.start];
2227
- s = -new B(h, f).direction().angleBetween(new w(0, 1), "angle", "360"), i = null;
2304
+ if (ee.start.copy(c.start), ee.end.copy(c.end), c.isVerticalReferenceLine) {
2305
+ const [h, d] = c.start.y < c.end.y ? [ee.start, ee.end] : [ee.end, ee.start];
2306
+ s = -new N(h, d).direction().angleBetween(new g(0, 1), "angle", "360"), i = null;
2228
2307
  break;
2229
2308
  }
2230
- (!i || W.length() > i.length()) && (i = W.clone(), i.userData.index = l);
2309
+ (!i || ee.length() > i.length()) && (i = ee.clone(), i.userData.index = l);
2231
2310
  }
2232
2311
  if (i) {
2233
2312
  t.originalData[i.userData.index].isVerticalReferenceLine = !0;
2234
2313
  const [l, c] = i.start.y < i.end.y ? [i.start, i.end] : [i.end, i.start];
2235
- s = -new B(l, c).direction().angleBetween(new w(0, 1), "angle", "360");
2314
+ s = -new N(l, c).direction().angleBetween(new g(0, 1), "angle", "360");
2236
2315
  }
2237
- const r = t.originalBox.center, o = w.zero(), a = t.originalData.map((l) => {
2238
- const c = o.copy(l.start).division(r).rotate(w.zero(), s * (Math.PI / 180)).toJson(l.start.z), h = o.copy(l.end).division(r).rotate(w.zero(), s * (Math.PI / 180)).toJson(l.end.z), f = Object.assign(ue(l), { start: c, end: h });
2239
- return f.drawWindow && f.drawWindow.forEach((u) => {
2240
- u.p = o.copy(u.p).division(r).rotate(w.zero(), s * (Math.PI / 180)).toJson(u.p.z);
2241
- }), f;
2316
+ const r = t.originalBox.center, o = g.zero(), a = t.originalData.map((l) => {
2317
+ const c = o.copy(l.start).division(r).rotate(g.zero(), s * (Math.PI / 180)).toJson(l.start.z), h = o.copy(l.end).division(r).rotate(g.zero(), s * (Math.PI / 180)).toJson(l.end.z), d = Object.assign(we(l), { start: c, end: h });
2318
+ return d.drawWindow && d.drawWindow.forEach((u) => {
2319
+ u.p = o.copy(u.p).division(r).rotate(g.zero(), s * (Math.PI / 180)).toJson(u.p.z);
2320
+ }), d;
2242
2321
  });
2243
2322
  n.appendLineSegmentList.forEach((l) => {
2244
2323
  const c = l.clone();
2245
- c.start.division(r).rotate(w.zero(), s * (Math.PI / 180)), c.end.division(r).rotate(w.zero(), s * (Math.PI / 180)), a.push({
2324
+ c.start.division(r).rotate(g.zero(), s * (Math.PI / 180)), c.end.division(r).rotate(g.zero(), s * (Math.PI / 180)), a.push({
2246
2325
  start: c.start.toJson(t.originalZAverage),
2247
2326
  end: c.end.toJson(t.originalZAverage),
2248
2327
  insetionArr: [],
@@ -2250,13 +2329,13 @@ class et extends V {
2250
2329
  });
2251
2330
  }), await this.set(a, t.width, t.scale), this.lineOffset(), this.doorLineSegment = t.doorLineSegment.map((l) => {
2252
2331
  const c = l.clone();
2253
- return c.start.division(r).rotate(w.zero(), s * (Math.PI / 180)), c.end.division(r).rotate(w.zero(), s * (Math.PI / 180)), c;
2332
+ return c.start.division(r).rotate(g.zero(), s * (Math.PI / 180)), c.end.division(r).rotate(g.zero(), s * (Math.PI / 180)), c;
2254
2333
  }), this.angle = s, this.dispatchEvent({
2255
2334
  type: "updateData"
2256
2335
  });
2257
2336
  }
2258
2337
  }
2259
- class Te extends J {
2338
+ class Ce extends ne {
2260
2339
  static name = "Variable";
2261
2340
  originalLineVisible = !0;
2262
2341
  dxfVisible = !0;
@@ -2283,13 +2362,13 @@ class Te extends J {
2283
2362
  if (e in this) return this[e];
2284
2363
  }
2285
2364
  }
2286
- class tt {
2365
+ class lt {
2287
2366
  // 所有可查找的点位
2288
2367
  possibleDoorPoints = [];
2289
2368
  doorPoint = [];
2290
2369
  dxf;
2291
2370
  // 包含所有点的虚拟网格
2292
- pointVirtualGrid = new he();
2371
+ pointVirtualGrid = new ge();
2293
2372
  // 只包含可查找点的虚拟网格
2294
2373
  findPointVirtualGrid;
2295
2374
  quadtree;
@@ -2302,7 +2381,7 @@ class tt {
2302
2381
  lineAnalysis;
2303
2382
  continueFind = !0;
2304
2383
  constructor(e) {
2305
- if (this.lineAnalysis = e, this.dxf = e.Dxf, this.findPointVirtualGrid = new he(), this.quadtree = e.quadtree, this.resultList = e.resultList, this.lineSegments = e.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
2384
+ if (this.lineAnalysis = e, this.dxf = e.Dxf, this.findPointVirtualGrid = new ge(), this.quadtree = e.quadtree, this.resultList = e.resultList, this.lineSegments = e.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
2306
2385
  this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
2307
2386
  }), this.doorPoint = this.getDoorPoint(), !this.continueFind) return;
2308
2387
  const t = this.searchDoubleLinePoint();
@@ -2332,15 +2411,15 @@ class tt {
2332
2411
  );
2333
2412
  const a = [];
2334
2413
  return o.forEach((l) => {
2335
- const c = new B(l?.start, l?.end), h = c.length();
2414
+ const c = new N(l?.start, l?.end), h = c.length();
2336
2415
  if (h < n) return;
2337
- const f = c.normal(), u = c.direction(), p = (h - r.width * 2) / 2;
2416
+ const d = c.normal(), u = c.direction(), p = (h - r.width * 2) / 2;
2338
2417
  for (let y = 0; y < 3; y++) {
2339
- const x = c.start.clone().add(u.clone().multiplyScalar(r.width + p * y)), S = new B(
2418
+ const x = c.start.clone().add(u.clone().multiplyScalar(r.width + p * y)), S = new N(
2340
2419
  x,
2341
- x.clone().add(f.clone().multiplyScalar(1))
2420
+ x.clone().add(d.clone().multiplyScalar(1))
2342
2421
  );
2343
- if (S.directionMove(f, -0.5), this.quadtree.queryLineSegment(S).length) return;
2422
+ if (S.directionMove(d, -0.5), this.quadtree.queryLineSegment(S).length) return;
2344
2423
  }
2345
2424
  a.push(c);
2346
2425
  }), a;
@@ -2360,7 +2439,7 @@ class tt {
2360
2439
  return this.lineSegments.forEach((t) => {
2361
2440
  t.points.forEach((n, s) => {
2362
2441
  for (let r = 0; r < this._pointsExcludeRule.length; r++) if (this._pointsExcludeRule[r](t, n, s)) return;
2363
- this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== t).length === 0 && e.push({ line: t, point: n, uuid: le() });
2442
+ this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== t).length === 0 && e.push({ line: t, point: n, uuid: me() });
2364
2443
  });
2365
2444
  }), e;
2366
2445
  }
@@ -2372,21 +2451,21 @@ class tt {
2372
2451
  return t.doors.forEach((s) => {
2373
2452
  const i = t.lineSegments[s[4]], r = t.originalData[s[4]];
2374
2453
  if (r.drawDoorData) {
2375
- const o = w.from(r.drawDoorData.start), a = w.from(r.drawDoorData.n), l = n.queryPoint(o).filter((c) => {
2454
+ const o = g.from(r.drawDoorData.start), a = g.from(r.drawDoorData.n), l = n.queryPoint(o).filter((c) => {
2376
2455
  if (c.userData === i) return !1;
2377
- const h = c.userData, f = h.direction();
2378
- h.start.equal(o) && f.multiplyScalar(-1);
2379
- const u = a.angleBetween(f, "angle");
2456
+ const h = c.userData, d = h.direction();
2457
+ h.start.equal(o) && d.multiplyScalar(-1);
2458
+ const u = a.angleBetween(d, "angle");
2380
2459
  return u > 80 || u < 10;
2381
2460
  });
2382
2461
  l.length && e.push({
2383
2462
  line: l[0].userData,
2384
2463
  point: o,
2385
- uuid: le()
2464
+ uuid: me()
2386
2465
  });
2387
2466
  } else if (r.doorDirectConnection) {
2388
2467
  this.continueFind = !1;
2389
- const o = new B(w.from(r.start), w.from(r.end));
2468
+ const o = new N(g.from(r.start), g.from(r.end));
2390
2469
  o.userData = {
2391
2470
  doorDirectConnection: !0,
2392
2471
  isDoor: !0
@@ -2416,83 +2495,83 @@ class tt {
2416
2495
  */
2417
2496
  searchNearby(e, t = [], n = this.doorSearchDistance, s = this.doorSearchNearAngle) {
2418
2497
  const i = this.findPointVirtualGrid, r = this.quadtree;
2419
- function o({ point: x, line: S }, R, F) {
2420
- const A = S.direction();
2421
- S.start === x && A.multiplyScalar(-1);
2422
- const P = i.queryCircle(x, n).filter((L) => L.userData !== S).sort((L, g) => L.point.distance(x) - g.point.distance(x)), M = [];
2423
- for (let L = 0; L < P.length; L++) {
2424
- const g = t.findIndex((N) => N.point === P[L].point), b = e[R].uuid, m = t[g].uuid;
2425
- if (F.has(`${b}.${m}`)) continue;
2426
- F.add(`${b}.${m}`), F.add(`${m}.${b}`);
2427
- const E = P[L].point, T = new B(x.clone(), E.clone());
2428
- if (T.direction().angleBetween(A, "angle") < s) {
2429
- const N = e[g].line.direction();
2430
- P[L].userData.start.equal(P[L].point) && N.multiplyScalar(-1), T.direction().multiplyScalar(-1).angleBetween(N, "angle") < s && (r.queryLineSegment(T).length || M.push({
2431
- findData: P[L],
2432
- findUuid: m,
2433
- doorLine: T,
2434
- doorUuid: b
2498
+ function o({ point: x, line: S }, T, G) {
2499
+ const E = S.direction();
2500
+ S.start === x && E.multiplyScalar(-1);
2501
+ const R = i.queryCircle(x, n).filter((P) => P.userData !== S).sort((P, O) => P.point.distance(x) - O.point.distance(x)), U = [];
2502
+ for (let P = 0; P < R.length; P++) {
2503
+ const O = t.findIndex((D) => D.point === R[P].point), X = e[T].uuid, k = t[O].uuid;
2504
+ if (G.has(`${X}.${k}`)) continue;
2505
+ G.add(`${X}.${k}`), G.add(`${k}.${X}`);
2506
+ const W = R[P].point, J = new N(x.clone(), W.clone());
2507
+ if (J.direction().angleBetween(E, "angle") < s) {
2508
+ const D = e[O].line.direction();
2509
+ R[P].userData.start.equal(R[P].point) && D.multiplyScalar(-1), J.direction().multiplyScalar(-1).angleBetween(D, "angle") < s && (r.queryLineSegment(J).length || U.push({
2510
+ findData: R[P],
2511
+ findUuid: k,
2512
+ doorLine: J,
2513
+ doorUuid: X
2435
2514
  }));
2436
2515
  }
2437
2516
  }
2438
- return M;
2517
+ return U;
2439
2518
  }
2440
- function a(x, S, R, F, A) {
2441
- F.add(x);
2442
- const P = [];
2443
- A && P.push(A);
2444
- for (let M = 0; M < R.length; M++) {
2445
- const L = R[M];
2446
- if (S.has(L.findUuid)) {
2447
- const g = S.get(L.findUuid);
2448
- a(L.findUuid, S, g, F, L) && P.push(L);
2449
- } else P.push(L);
2519
+ function a(x, S, T, G, E) {
2520
+ G.add(x);
2521
+ const R = [];
2522
+ E && R.push(E);
2523
+ for (let U = 0; U < T.length; U++) {
2524
+ const P = T[U];
2525
+ if (S.has(P.findUuid)) {
2526
+ const O = S.get(P.findUuid);
2527
+ a(P.findUuid, S, O, G, P) && R.push(P);
2528
+ } else R.push(P);
2450
2529
  }
2451
- return P.sort((M, L) => M.doorLine.length() - L.doorLine.length()), A && P[0] === A ? (R.splice(0), !0) : (R.splice(1), !1);
2530
+ return R.sort((U, P) => U.doorLine.length() - P.doorLine.length()), E && R[0] === E ? (T.splice(0), !0) : (T.splice(1), !1);
2452
2531
  }
2453
2532
  const l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
2454
2533
  e.map((x, S) => {
2455
- const R = o(x, S, l);
2456
- R.length && c.set(x.uuid, R);
2534
+ const T = o(x, S, l);
2535
+ T.length && c.set(x.uuid, T);
2457
2536
  }), l.clear();
2458
2537
  const h = /* @__PURE__ */ new Map();
2459
2538
  c.forEach((x, S) => {
2460
2539
  if (!l.has(S) && x.length && a(S, c, x, l), x.length) {
2461
- const R = x[0];
2462
- h.has(R.doorUuid) || h.set(R.doorUuid, []), h.get(R.doorUuid)?.push(R), h.has(R.findUuid) || h.set(R.findUuid, []), h.get(R.findUuid)?.push(R);
2540
+ const T = x[0];
2541
+ h.has(T.doorUuid) || h.set(T.doorUuid, []), h.get(T.doorUuid)?.push(T), h.has(T.findUuid) || h.set(T.findUuid, []), h.get(T.findUuid)?.push(T);
2463
2542
  }
2464
2543
  });
2465
- const f = /* @__PURE__ */ new Set();
2544
+ const d = /* @__PURE__ */ new Set();
2466
2545
  h.forEach((x) => {
2467
2546
  if (x.length > 1) {
2468
- x.sort((S, R) => S.doorLine.length() - R.doorLine.length());
2469
- for (let S = 1; S < x.length; S++) f.add(x[S]);
2547
+ x.sort((S, T) => S.doorLine.length() - T.doorLine.length());
2548
+ for (let S = 1; S < x.length; S++) d.add(x[S]);
2470
2549
  }
2471
2550
  });
2472
2551
  const u = [], p = [];
2473
2552
  c.forEach((x) => {
2474
2553
  if (x.length) {
2475
2554
  const S = x[0];
2476
- f.has(S) || (u.push(S), p.push(S.doorUuid, S.findUuid));
2555
+ d.has(S) || (u.push(S), p.push(S.doorUuid, S.findUuid));
2477
2556
  }
2478
2557
  });
2479
2558
  const y = [];
2480
2559
  return u.forEach((x) => {
2481
- const S = e.findIndex((g) => g.uuid === x.doorUuid), R = t.findIndex((g) => g.uuid === x.findUuid), F = e[S].point.clone(), A = t[R].point.clone(), P = this.findLongLineSegment(e[S].line), M = this.findLongLineSegment(t[R].line), L = P.projectPoint(A);
2482
- if (L) {
2483
- F.copy(L);
2484
- const g = new B(F, A), b = M.includedAngle(g);
2485
- (b < 10 || b > 170 || Math.abs(90 - b) < 10) && y.push({
2486
- start: F,
2487
- end: A
2560
+ const S = e.findIndex((O) => O.uuid === x.doorUuid), T = t.findIndex((O) => O.uuid === x.findUuid), G = e[S].point.clone(), E = t[T].point.clone(), R = this.findLongLineSegment(e[S].line), U = this.findLongLineSegment(t[T].line), P = R.projectPoint(E);
2561
+ if (P) {
2562
+ G.copy(P);
2563
+ const O = new N(G, E), X = U.includedAngle(O);
2564
+ (X < 10 || X > 170 || Math.abs(90 - X) < 10) && y.push({
2565
+ start: G,
2566
+ end: E
2488
2567
  });
2489
2568
  } else {
2490
- const g = M.projectPoint(F);
2491
- g && A.copy(g);
2492
- const b = new B(F, A), m = P.includedAngle(b);
2493
- (m < 10 || m > 170 || Math.abs(90 - m) < 10) && y.push({
2494
- start: F,
2495
- end: A
2569
+ const O = U.projectPoint(G);
2570
+ O && E.copy(O);
2571
+ const X = new N(G, E), k = R.includedAngle(X);
2572
+ (k < 10 || k > 170 || Math.abs(90 - k) < 10) && y.push({
2573
+ start: G,
2574
+ end: E
2496
2575
  });
2497
2576
  }
2498
2577
  }), t.splice(
@@ -2513,7 +2592,7 @@ class tt {
2513
2592
  searchAlongDirection({ point: e, line: t }, n = this.doorSearchDistance) {
2514
2593
  const s = this.quadtree, i = t.direction();
2515
2594
  t.start === e && i.multiplyScalar(-1);
2516
- const r = e.clone().add(i.clone().multiplyScalar(n)), o = new B(e.clone(), r), a = s.queryLineSegment(o).map((l) => ({
2595
+ const r = e.clone().add(i.clone().multiplyScalar(n)), o = new N(e.clone(), r), a = s.queryLineSegment(o).map((l) => ({
2517
2596
  point: l.line.getIntersection(o),
2518
2597
  line: l.line
2519
2598
  })).filter((l) => l.point).sort((l, c) => e.distance(l.point) - e.distance(c.point));
@@ -2532,22 +2611,22 @@ class tt {
2532
2611
  searchAlongNormalDirection({ point: e, line: t }, n = this.doorSearchDistance) {
2533
2612
  const s = this.pointVirtualGrid, i = this.quadtree, r = t.direction(), o = t.start.normal(t.end), a = t.start.clone();
2534
2613
  t.start === e && r.multiplyScalar(-1), t.start === e && a.copy(t.end);
2535
- const l = s.queryPoint(a).filter((f) => f.userData !== t);
2536
- for (let f = 0; f < l.length; f++) {
2537
- const u = l[f], p = u.userData, y = p.direction();
2614
+ const l = s.queryPoint(a).filter((d) => d.userData !== t);
2615
+ for (let d = 0; d < l.length; d++) {
2616
+ const u = l[d], p = u.userData, y = p.direction();
2538
2617
  if (p.start === u.point && r.multiplyScalar(-1), y.angleBetween(o) / (Math.PI / 180) > 90) {
2539
2618
  o.multiplyScalar(-1);
2540
2619
  break;
2541
2620
  }
2542
2621
  }
2543
- const c = new B(e.clone(), e.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(c).map((f) => ({
2544
- point: f.line.getIntersection(c),
2545
- line: f.line
2546
- })).filter((f) => f.point).sort((f, u) => e.distance(f.point) - e.distance(u.point));
2622
+ const c = new N(e.clone(), e.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(c).map((d) => ({
2623
+ point: d.line.getIntersection(c),
2624
+ line: d.line
2625
+ })).filter((d) => d.point).sort((d, u) => e.distance(d.point) - e.distance(u.point));
2547
2626
  if (h.length) {
2548
- const f = h[0];
2549
- if (Math.abs(90 - f.line.direction().angleBetween(o, "angle")) < 5)
2550
- return f;
2627
+ const d = h[0];
2628
+ if (Math.abs(90 - d.line.direction().angleBetween(o, "angle")) < 5)
2629
+ return d;
2551
2630
  }
2552
2631
  }
2553
2632
  /**
@@ -2574,12 +2653,12 @@ class tt {
2574
2653
  return t;
2575
2654
  }
2576
2655
  }
2577
- class nt extends J {
2656
+ class ht extends ne {
2578
2657
  static name = "LineAnalysis";
2579
2658
  Dxf = null;
2580
2659
  Variable = null;
2581
2660
  lineSegmentList = [];
2582
- container = new U.Group();
2661
+ container = new z.Group();
2583
2662
  // 误差角度
2584
2663
  errorAngle = 4;
2585
2664
  width = 0.4;
@@ -2588,7 +2667,7 @@ class nt extends J {
2588
2667
  * @param parent
2589
2668
  */
2590
2669
  onAddFromParent(e) {
2591
- this.Dxf = e.findComponentByType(V), this.Variable = this.parent?.findComponentByType(Te), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
2670
+ this.Dxf = e.findComponentByType($), this.Variable = this.parent?.findComponentByType(Ce), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
2592
2671
  }
2593
2672
  /**
2594
2673
  *
@@ -2602,11 +2681,11 @@ class nt extends J {
2602
2681
  return {
2603
2682
  points: [
2604
2683
  // 第一条线
2605
- new w(e.x + o, e.y + a).add(r),
2606
- new w(t.x + o, t.y + a).add(i),
2684
+ new g(e.x + o, e.y + a).add(r),
2685
+ new g(t.x + o, t.y + a).add(i),
2607
2686
  // 第二条线
2608
- new w(e.x - o, e.y - a).add(r),
2609
- new w(t.x - o, t.y - a).add(i)
2687
+ new g(e.x - o, e.y - a).add(r),
2688
+ new g(t.x - o, t.y - a).add(i)
2610
2689
  ],
2611
2690
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
2612
2691
  rectIndices: [0, 1, 3, 2, 0]
@@ -2620,7 +2699,7 @@ class nt extends J {
2620
2699
  */
2621
2700
  addData(e, t) {
2622
2701
  const n = this.Dxf;
2623
- n.data.push([e.clone(), t.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new B(e.clone(), t.clone()));
2702
+ n.data.push([e.clone(), t.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new N(e.clone(), t.clone()));
2624
2703
  }
2625
2704
  /** 结果分析创建矩形
2626
2705
  * @param result
@@ -2628,14 +2707,14 @@ class nt extends J {
2628
2707
  createRectangle(e) {
2629
2708
  const t = this.Dxf, n = e.project, s = e.project2;
2630
2709
  n.includedAngle(s) > 135 && (s.points = [s.points[1], s.points[0]]), this.addData(n.points[0], s.points[0]), this.addData(n.points[1], s.points[1]);
2631
- const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / t.width), a = i / o, l = r / o, c = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]), f = n.points[0].clone(), u = n.points[1].clone(), p = u.direction(f);
2710
+ const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / t.width), a = i / o, l = r / o, c = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]), d = n.points[0].clone(), u = n.points[1].clone(), p = u.direction(d);
2632
2711
  p.multiplyScalar(t.width * 0.5);
2633
- const y = f.clone().add(p), x = u.clone().add(p.multiplyScalar(-1)), S = f.direction(u), R = y.direction(x);
2634
- if (!(S.x > 0 && R.x < 0 || S.x < 0 && R.x > 0 || S.y > 0 && R.y < 0 || S.y < 0 && R.y > 0)) {
2635
- f.set(y.x, y.y), u.set(x.x, x.y);
2636
- for (let F = 1; F < o; F++) {
2637
- const A = c.clone().multiplyScalar(a * F), P = h.clone().multiplyScalar(l * F), M = f.clone().add(A), L = u.clone().add(P);
2638
- this.addData(M, L);
2712
+ const y = d.clone().add(p), x = u.clone().add(p.multiplyScalar(-1)), S = d.direction(u), T = y.direction(x);
2713
+ if (!(S.x > 0 && T.x < 0 || S.x < 0 && T.x > 0 || S.y > 0 && T.y < 0 || S.y < 0 && T.y > 0)) {
2714
+ d.set(y.x, y.y), u.set(x.x, x.y);
2715
+ for (let G = 1; G < o; G++) {
2716
+ const E = c.clone().multiplyScalar(a * G), R = h.clone().multiplyScalar(l * G), U = d.clone().add(E), P = u.clone().add(R);
2717
+ this.addData(U, P);
2639
2718
  }
2640
2719
  }
2641
2720
  }
@@ -2645,7 +2724,7 @@ class nt extends J {
2645
2724
  */
2646
2725
  buildQuadtree() {
2647
2726
  const e = this.Dxf, t = [];
2648
- this.quadtree = new X(e.originalBox, 2), e.lineSegments.forEach((n) => {
2727
+ this.quadtree = new Z(e.originalBox, 2), e.lineSegments.forEach((n) => {
2649
2728
  n.userData?.isDoor || (this.quadtree?.insert({
2650
2729
  line: n,
2651
2730
  userData: t.length
@@ -2662,7 +2741,7 @@ class nt extends J {
2662
2741
  this.buildQuadtree();
2663
2742
  const e = this.quadtree, t = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
2664
2743
  t.forEach((i, r) => {
2665
- const o = t[r], a = se.fromByLineSegment(o, this.width * 2, !1, -0.01);
2744
+ const o = t[r], a = ue.fromByLineSegment(o, this.width * 2, !1, -0.01);
2666
2745
  e.queryRect(a).map((c) => c.userData).filter((c) => c !== r).forEach((c) => {
2667
2746
  try {
2668
2747
  if (n.has(`${r}-${c}`) || n.has(`${c}-${r}`)) return;
@@ -2706,12 +2785,12 @@ class nt extends J {
2706
2785
  doors = [];
2707
2786
  DoorsAnalysis;
2708
2787
  doorsAnalysis() {
2709
- this.DoorsAnalysis = new tt(this), this.dispatchEvent({
2788
+ this.DoorsAnalysis = new lt(this), this.dispatchEvent({
2710
2789
  type: "analysisCompleted"
2711
2790
  });
2712
2791
  }
2713
2792
  }
2714
- class st extends J {
2793
+ class ut extends ne {
2715
2794
  static name = "ThreeVJia";
2716
2795
  lineSegments = [];
2717
2796
  onAddFromParent() {
@@ -2723,28 +2802,28 @@ class st extends J {
2723
2802
  const n = this.parent?.findComponentByName("AngleCorrectionDxf"), s = /* @__PURE__ */ new Map();
2724
2803
  let i = [...t.lineSegments], r = [], o = [];
2725
2804
  e.resultList.forEach((c) => {
2726
- const h = s.get(c.target) ?? [], f = s.get(c.source) ?? [], u = c.project.clone(), p = c.project2.clone();
2727
- u.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...u.points), f.push(...p.points), s.set(c.target, h), s.set(c.source, f);
2728
- const y = new B(u.start, p.start), x = new B(u.end, p.end), S = new B(y.center, x.center);
2805
+ const h = s.get(c.target) ?? [], d = s.get(c.source) ?? [], u = c.project.clone(), p = c.project2.clone();
2806
+ u.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...u.points), d.push(...p.points), s.set(c.target, h), s.set(c.source, d);
2807
+ const y = new N(u.start, p.start), x = new N(u.end, p.end), S = new N(y.center, x.center);
2729
2808
  S.userData.wallWidth = Math.max(y.length(), x.length()), r.push(S);
2730
2809
  });
2731
2810
  const a = [];
2732
2811
  i = i.filter((c) => {
2733
2812
  if (o.indexOf(c) > -1) return !1;
2734
2813
  if (s.has(c)) {
2735
- const h = s.get(c), f = c.clone();
2814
+ const h = s.get(c), d = c.clone();
2736
2815
  if (h) {
2737
2816
  for (let p = 0; p < h.length; p += 2) {
2738
2817
  const y = h[p], x = h[p + 1];
2739
- y.userData.length = y.distance(f.start), x.userData.length = x.distance(f.start), y.userData.type = "start", x.userData.type = "end", f.start.distance(y) > f.start.distance(x) && (h[p] = x, h[p + 1] = y, y.userData.type = "end", x.userData.type = "start");
2818
+ y.userData.length = y.distance(d.start), x.userData.length = x.distance(d.start), y.userData.type = "start", x.userData.type = "end", d.start.distance(y) > d.start.distance(x) && (h[p] = x, h[p + 1] = y, y.userData.type = "end", x.userData.type = "start");
2740
2819
  }
2741
2820
  h.sort((p, y) => p.userData.length - y.userData.length);
2742
2821
  const u = [];
2743
2822
  for (let p = 0; p < h.length; p++) {
2744
2823
  const y = h[p];
2745
- y.userData.type === "start" ? (u.length === 0 && (a.push(new B(f.start.clone(), y.clone())), f.start.copy(y)), u.push("start")) : (u.pop(), u.length === 0 && f.start.copy(y));
2824
+ y.userData.type === "start" ? (u.length === 0 && (a.push(new N(d.start.clone(), y.clone())), d.start.copy(y)), u.push("start")) : (u.pop(), u.length === 0 && d.start.copy(y));
2746
2825
  }
2747
- a.push(f);
2826
+ a.push(d);
2748
2827
  }
2749
2828
  return !1;
2750
2829
  }
@@ -2800,7 +2879,7 @@ class st extends J {
2800
2879
  };
2801
2880
  if (s.userData.isWindow)
2802
2881
  return s.userData.drawWindow.map((i) => {
2803
- const r = w.from(i.p), o = r.clone().add(
2882
+ const r = g.from(i.p), o = r.clone().add(
2804
2883
  s.direction().multiplyScalar(i.width * 0.5)
2805
2884
  ), a = r.clone().add(
2806
2885
  s.direction().multiplyScalar(-i.width * 0.5)
@@ -2833,10 +2912,10 @@ class st extends J {
2833
2912
  if (typeof window < "u") {
2834
2913
  const t = new Blob([JSON.stringify(this.toJson())]), n = document.createElement("a");
2835
2914
  n.href = URL.createObjectURL(t), n.download = e, n.click();
2836
- } else typeof global < "u" && (await K("fs", !1)).writeFileSync(e, JSON.stringify(this.toJson()));
2915
+ } else typeof global < "u" && (await se("fs", !1)).writeFileSync(e, JSON.stringify(this.toJson()));
2837
2916
  }
2838
2917
  }
2839
- class it extends Ze {
2918
+ class dt extends ot {
2840
2919
  Dxf;
2841
2920
  AngleCorrectionDxf;
2842
2921
  Variable;
@@ -2847,7 +2926,7 @@ class it extends Ze {
2847
2926
  * @param scale 原始数据缩放比例
2848
2927
  */
2849
2928
  constructor(e = 0.1, t = 1) {
2850
- super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = e, this.Dxf = new V(this.wallWidth, t), this.AngleCorrectionDxf = new et(), this.Variable = new Te(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new nt()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new st());
2929
+ super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = e, this.Dxf = new $(this.wallWidth, t), this.AngleCorrectionDxf = new ct(), this.Variable = new Ce(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new ht()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new ut());
2851
2930
  }
2852
2931
  usePlugin(e) {
2853
2932
  return typeof e == "function" && e.call(this, this), this;
@@ -2860,7 +2939,7 @@ class it extends Ze {
2860
2939
  });
2861
2940
  }
2862
2941
  }
2863
- const me = {
2942
+ const Ae = {
2864
2943
  POSITION: [
2865
2944
  "byte",
2866
2945
  "byte normalized",
@@ -2888,36 +2967,36 @@ const me = {
2888
2967
  "unsigned short"
2889
2968
  ]
2890
2969
  };
2891
- class ne {
2970
+ class he {
2892
2971
  constructor() {
2893
2972
  this.textureUtils = null, this.pluginCallbacks = [], this.register(function(e) {
2894
- return new xt(e);
2973
+ return new Et(e);
2974
+ }), this.register(function(e) {
2975
+ return new Dt(e);
2895
2976
  }), this.register(function(e) {
2896
- return new yt(e);
2977
+ return new It(e);
2897
2978
  }), this.register(function(e) {
2898
- return new Mt(e);
2979
+ return new Rt(e);
2899
2980
  }), this.register(function(e) {
2900
- return new Lt(e);
2981
+ return new Pt(e);
2901
2982
  }), this.register(function(e) {
2902
- return new St(e);
2983
+ return new vt(e);
2903
2984
  }), this.register(function(e) {
2904
2985
  return new At(e);
2905
2986
  }), this.register(function(e) {
2906
- return new mt(e);
2907
- }), this.register(function(e) {
2908
- return new gt(e);
2987
+ return new Tt(e);
2909
2988
  }), this.register(function(e) {
2910
- return new wt(e);
2989
+ return new bt(e);
2911
2990
  }), this.register(function(e) {
2912
- return new Et(e);
2991
+ return new Nt(e);
2913
2992
  }), this.register(function(e) {
2914
- return new Tt(e);
2993
+ return new Ct(e);
2915
2994
  }), this.register(function(e) {
2916
- return new Dt(e);
2995
+ return new Bt(e);
2917
2996
  }), this.register(function(e) {
2918
- return new bt(e);
2997
+ return new Ot(e);
2919
2998
  }), this.register(function(e) {
2920
- return new It(e);
2999
+ return new Ft(e);
2921
3000
  });
2922
3001
  }
2923
3002
  register(e) {
@@ -2930,7 +3009,7 @@ class ne {
2930
3009
  return this.textureUtils = e, this;
2931
3010
  }
2932
3011
  parse(e, t, n, s) {
2933
- const i = new pt(), r = [];
3012
+ const i = new Lt(), r = [];
2934
3013
  for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
2935
3014
  r.push(this.pluginCallbacks[o](i));
2936
3015
  i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(e, t, s).catch(n);
@@ -2966,78 +3045,78 @@ const C = {
2966
3045
  CLAMP_TO_EDGE: 33071,
2967
3046
  MIRRORED_REPEAT: 33648,
2968
3047
  REPEAT: 10497
2969
- }, re = "KHR_mesh_quantization", Y = {};
2970
- Y[qe] = C.NEAREST;
2971
- Y[je] = C.NEAREST_MIPMAP_NEAREST;
2972
- Y[Ye] = C.NEAREST_MIPMAP_LINEAR;
2973
- Y[Xe] = C.LINEAR;
2974
- Y[ke] = C.LINEAR_MIPMAP_NEAREST;
2975
- Y[Ve] = C.LINEAR_MIPMAP_LINEAR;
2976
- Y[We] = C.CLAMP_TO_EDGE;
2977
- Y[He] = C.REPEAT;
2978
- Y[Je] = C.MIRRORED_REPEAT;
2979
- const ge = {
3048
+ }, fe = "KHR_mesh_quantization", H = {};
3049
+ H[Je] = C.NEAREST;
3050
+ H[Ke] = C.NEAREST_MIPMAP_NEAREST;
3051
+ H[$e] = C.NEAREST_MIPMAP_LINEAR;
3052
+ H[Ze] = C.LINEAR;
3053
+ H[Qe] = C.LINEAR_MIPMAP_NEAREST;
3054
+ H[et] = C.LINEAR_MIPMAP_LINEAR;
3055
+ H[tt] = C.CLAMP_TO_EDGE;
3056
+ H[nt] = C.REPEAT;
3057
+ H[st] = C.MIRRORED_REPEAT;
3058
+ const Te = {
2980
3059
  scale: "scale",
2981
3060
  position: "translation",
2982
3061
  quaternion: "rotation",
2983
3062
  morphTargetInfluences: "weights"
2984
- }, rt = new ve(), we = 12, ot = 1179937895, at = 2, Me = 8, ct = 1313821514, lt = 5130562;
2985
- function Z(d, e) {
2986
- return d.length === e.length && d.every(function(t, n) {
3063
+ }, ft = new ze(), be = 12, pt = 1179937895, xt = 2, Ie = 8, yt = 1313821514, mt = 5130562;
3064
+ function oe(f, e) {
3065
+ return f.length === e.length && f.every(function(t, n) {
2987
3066
  return t === e[n];
2988
3067
  });
2989
3068
  }
2990
- function ht(d) {
2991
- return new TextEncoder().encode(d).buffer;
3069
+ function gt(f) {
3070
+ return new TextEncoder().encode(f).buffer;
2992
3071
  }
2993
- function ut(d) {
2994
- return Z(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3072
+ function wt(f) {
3073
+ return oe(f.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
2995
3074
  }
2996
- function dt(d, e, t) {
3075
+ function Mt(f, e, t) {
2997
3076
  const n = {
2998
- min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
2999
- max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
3077
+ min: new Array(f.itemSize).fill(Number.POSITIVE_INFINITY),
3078
+ max: new Array(f.itemSize).fill(Number.NEGATIVE_INFINITY)
3000
3079
  };
3001
3080
  for (let s = e; s < e + t; s++)
3002
- for (let i = 0; i < d.itemSize; i++) {
3081
+ for (let i = 0; i < f.itemSize; i++) {
3003
3082
  let r;
3004
- d.itemSize > 4 ? r = d.array[s * d.itemSize + i] : (i === 0 ? r = d.getX(s) : i === 1 ? r = d.getY(s) : i === 2 ? r = d.getZ(s) : i === 3 && (r = d.getW(s)), d.normalized === !0 && (r = ce.normalize(r, d.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3083
+ f.itemSize > 4 ? r = f.array[s * f.itemSize + i] : (i === 0 ? r = f.getX(s) : i === 1 ? r = f.getY(s) : i === 2 ? r = f.getZ(s) : i === 3 && (r = f.getW(s)), f.normalized === !0 && (r = ye.normalize(r, f.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3005
3084
  }
3006
3085
  return n;
3007
3086
  }
3008
- function De(d) {
3009
- return Math.ceil(d / 4) * 4;
3087
+ function Be(f) {
3088
+ return Math.ceil(f / 4) * 4;
3010
3089
  }
3011
- function oe(d, e = 0) {
3012
- const t = De(d.byteLength);
3013
- if (t !== d.byteLength) {
3090
+ function pe(f, e = 0) {
3091
+ const t = Be(f.byteLength);
3092
+ if (t !== f.byteLength) {
3014
3093
  const n = new Uint8Array(t);
3015
- if (n.set(new Uint8Array(d)), e !== 0)
3016
- for (let s = d.byteLength; s < t; s++)
3094
+ if (n.set(new Uint8Array(f)), e !== 0)
3095
+ for (let s = f.byteLength; s < t; s++)
3017
3096
  n[s] = e;
3018
3097
  return n.buffer;
3019
3098
  }
3020
- return d;
3099
+ return f;
3021
3100
  }
3022
- function Le() {
3101
+ function Re() {
3023
3102
  return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
3024
3103
  }
3025
- function ft(d, e) {
3026
- if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
3104
+ function St(f, e) {
3105
+ if (typeof OffscreenCanvas < "u" && f instanceof OffscreenCanvas) {
3027
3106
  let t;
3028
- return e === "image/jpeg" ? t = 0.92 : e === "image/webp" && (t = 0.8), d.convertToBlob({
3107
+ return e === "image/jpeg" ? t = 0.92 : e === "image/webp" && (t = 0.8), f.convertToBlob({
3029
3108
  type: e,
3030
3109
  quality: t
3031
3110
  });
3032
3111
  } else
3033
- return new Promise((t) => d.toBlob(t, e));
3112
+ return new Promise((t) => f.toBlob(t, e));
3034
3113
  }
3035
- class pt {
3114
+ class Lt {
3036
3115
  constructor() {
3037
3116
  this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
3038
3117
  asset: {
3039
3118
  version: "2.0",
3040
- generator: "THREE.GLTFExporter r" + Ce
3119
+ generator: "THREE.GLTFExporter r" + qe
3041
3120
  }
3042
3121
  }, this.cache = {
3043
3122
  meshes: /* @__PURE__ */ new Map(),
@@ -3074,27 +3153,27 @@ class pt {
3074
3153
  const s = this, i = s.buffers, r = s.json;
3075
3154
  n = s.options;
3076
3155
  const o = s.extensionsUsed, a = s.extensionsRequired, l = new Blob(i, { type: "application/octet-stream" }), c = Object.keys(o), h = Object.keys(a);
3077
- c.length > 0 && (r.extensionsUsed = c), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = l.size), n.binary === !0 ? ae(l).then(function(f) {
3078
- const u = oe(f), p = new DataView(new ArrayBuffer(Me));
3079
- p.setUint32(0, u.byteLength, !0), p.setUint32(4, lt, !0);
3080
- const y = oe(ht(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Me));
3081
- x.setUint32(0, y.byteLength, !0), x.setUint32(4, ct, !0);
3082
- const S = new ArrayBuffer(we), R = new DataView(S);
3083
- R.setUint32(0, ot, !0), R.setUint32(4, at, !0);
3084
- const F = we + x.byteLength + y.byteLength + p.byteLength + u.byteLength;
3085
- R.setUint32(8, F, !0);
3086
- const A = new Blob([
3156
+ c.length > 0 && (r.extensionsUsed = c), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = l.size), n.binary === !0 ? xe(l).then(function(d) {
3157
+ const u = pe(d), p = new DataView(new ArrayBuffer(Ie));
3158
+ p.setUint32(0, u.byteLength, !0), p.setUint32(4, mt, !0);
3159
+ const y = pe(gt(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Ie));
3160
+ x.setUint32(0, y.byteLength, !0), x.setUint32(4, yt, !0);
3161
+ const S = new ArrayBuffer(be), T = new DataView(S);
3162
+ T.setUint32(0, pt, !0), T.setUint32(4, xt, !0);
3163
+ const G = be + x.byteLength + y.byteLength + p.byteLength + u.byteLength;
3164
+ T.setUint32(8, G, !0);
3165
+ const E = new Blob([
3087
3166
  S,
3088
3167
  x,
3089
3168
  y,
3090
3169
  p,
3091
3170
  u
3092
3171
  ], { type: "application/octet-stream" });
3093
- ae(A).then((P) => {
3094
- t(P);
3172
+ xe(E).then((R) => {
3173
+ t(R);
3095
3174
  });
3096
- }) : r.buffers && r.buffers.length > 0 ? Rt(l).then((f) => {
3097
- r.buffers[0].uri = f, t(r);
3175
+ }) : r.buffers && r.buffers.length > 0 ? Ut(l).then((d) => {
3176
+ r.buffers[0].uri = d, t(r);
3098
3177
  }) : t(r);
3099
3178
  }
3100
3179
  /**
@@ -3141,7 +3220,7 @@ class pt {
3141
3220
  */
3142
3221
  isNormalizedNormalAttribute(e) {
3143
3222
  if (this.cache.attributesNormalized.has(e)) return !1;
3144
- const n = new ee();
3223
+ const n = new ce();
3145
3224
  for (let s = 0, i = e.count; s < i; s++)
3146
3225
  if (Math.abs(n.fromBufferAttribute(e, s).length() - 1) > 5e-4) return !1;
3147
3226
  return !0;
@@ -3156,7 +3235,7 @@ class pt {
3156
3235
  createNormalizedNormalAttribute(e) {
3157
3236
  const t = this.cache;
3158
3237
  if (t.attributesNormalized.has(e)) return t.attributesNormalized.get(e);
3159
- const n = e.clone(), s = new ee();
3238
+ const n = e.clone(), s = new ce();
3160
3239
  for (let i = 0, r = n.count; i < r; i++)
3161
3240
  s.fromBufferAttribute(n, i), s.x === 0 && s.y === 0 && s.z === 0 ? s.setX(1) : s.normalize(), n.setXYZ(i, s.x, s.y, s.z);
3162
3241
  return t.attributesNormalized.set(e, n), n;
@@ -3176,14 +3255,14 @@ class pt {
3176
3255
  async buildMetalRoughTextureAsync(e, t) {
3177
3256
  if (e === t) return e;
3178
3257
  function n(u) {
3179
- return u.colorSpace === ze ? function(y) {
3258
+ return u.colorSpace === He ? function(y) {
3180
3259
  return y < 0.04045 ? y * 0.0773993808 : Math.pow(y * 0.9478672986 + 0.0521327014, 2.4);
3181
3260
  } : function(y) {
3182
3261
  return y;
3183
3262
  };
3184
3263
  }
3185
- e instanceof ie && (e = await this.decompressTextureAsync(e)), t instanceof ie && (t = await this.decompressTextureAsync(t));
3186
- const s = e ? e.image : null, i = t ? t.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a = Le();
3264
+ e instanceof de && (e = await this.decompressTextureAsync(e)), t instanceof de && (t = await this.decompressTextureAsync(t));
3265
+ const s = e ? e.image : null, i = t ? t.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a = Re();
3187
3266
  a.width = r, a.height = o;
3188
3267
  const l = a.getContext("2d", {
3189
3268
  willReadFrequently: !0
@@ -3203,8 +3282,8 @@ class pt {
3203
3282
  c.data[y] = u(p[y] / 256) * 256;
3204
3283
  }
3205
3284
  l.putImageData(c, 0, 0);
3206
- const f = (e || t).clone();
3207
- return f.source = new Be(a), f.colorSpace = Oe, f.channel = (e || t).channel, e && t && e.channel !== t.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), f;
3285
+ const d = (e || t).clone();
3286
+ return d.source = new je(a), d.colorSpace = Ye, d.channel = (e || t).channel, e && t && e.channel !== t.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), d;
3208
3287
  }
3209
3288
  async decompressTextureAsync(e, t = 1 / 0) {
3210
3289
  if (this.textureUtils === null)
@@ -3247,21 +3326,21 @@ class pt {
3247
3326
  }
3248
3327
  let a = e.itemSize * o;
3249
3328
  i === C.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
3250
- const l = De(s * a), c = new DataView(new ArrayBuffer(l));
3329
+ const l = Be(s * a), c = new DataView(new ArrayBuffer(l));
3251
3330
  let h = 0;
3252
3331
  for (let p = n; p < n + s; p++) {
3253
3332
  for (let y = 0; y < e.itemSize; y++) {
3254
3333
  let x;
3255
- e.itemSize > 4 ? x = e.array[p * e.itemSize + y] : (y === 0 ? x = e.getX(p) : y === 1 ? x = e.getY(p) : y === 2 ? x = e.getZ(p) : y === 3 && (x = e.getW(p)), e.normalized === !0 && (x = ce.normalize(x, e.array))), t === C.FLOAT ? c.setFloat32(h, x, !0) : t === C.INT ? c.setInt32(h, x, !0) : t === C.UNSIGNED_INT ? c.setUint32(h, x, !0) : t === C.SHORT ? c.setInt16(h, x, !0) : t === C.UNSIGNED_SHORT ? c.setUint16(h, x, !0) : t === C.BYTE ? c.setInt8(h, x) : t === C.UNSIGNED_BYTE && c.setUint8(h, x), h += o;
3334
+ e.itemSize > 4 ? x = e.array[p * e.itemSize + y] : (y === 0 ? x = e.getX(p) : y === 1 ? x = e.getY(p) : y === 2 ? x = e.getZ(p) : y === 3 && (x = e.getW(p)), e.normalized === !0 && (x = ye.normalize(x, e.array))), t === C.FLOAT ? c.setFloat32(h, x, !0) : t === C.INT ? c.setInt32(h, x, !0) : t === C.UNSIGNED_INT ? c.setUint32(h, x, !0) : t === C.SHORT ? c.setInt16(h, x, !0) : t === C.UNSIGNED_SHORT ? c.setUint16(h, x, !0) : t === C.BYTE ? c.setInt8(h, x) : t === C.UNSIGNED_BYTE && c.setUint8(h, x), h += o;
3256
3335
  }
3257
3336
  h % a !== 0 && (h += a - h % a);
3258
3337
  }
3259
- const f = {
3338
+ const d = {
3260
3339
  buffer: this.processBuffer(c.buffer),
3261
3340
  byteOffset: this.byteOffset,
3262
3341
  byteLength: l
3263
3342
  };
3264
- return i !== void 0 && (f.target = i), i === C.ARRAY_BUFFER && (f.byteStride = a), this.byteOffset += l, r.bufferViews.push(f), {
3343
+ return i !== void 0 && (d.target = i), i === C.ARRAY_BUFFER && (d.byteStride = a), this.byteOffset += l, r.bufferViews.push(d), {
3265
3344
  id: r.bufferViews.length - 1,
3266
3345
  byteLength: 0
3267
3346
  };
@@ -3274,8 +3353,8 @@ class pt {
3274
3353
  processBufferViewImage(e) {
3275
3354
  const t = this, n = t.json;
3276
3355
  return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
3277
- ae(e).then((i) => {
3278
- const r = oe(i), o = {
3356
+ xe(e).then((i) => {
3357
+ const r = pe(i), o = {
3279
3358
  buffer: t.processBuffer(r),
3280
3359
  byteOffset: t.byteOffset,
3281
3360
  byteLength: r.byteLength
@@ -3319,7 +3398,7 @@ class pt {
3319
3398
  else
3320
3399
  throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + e.array.constructor.name);
3321
3400
  if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = e.count), s === 0) return null;
3322
- const a = dt(e, n, s);
3401
+ const a = Mt(e, n, s);
3323
3402
  let l;
3324
3403
  t !== void 0 && (l = e === t.index ? C.ELEMENT_ARRAY_BUFFER : C.ARRAY_BUFFER);
3325
3404
  const c = this.processBufferView(e, o, n, s, l), h = {
@@ -3348,13 +3427,13 @@ class pt {
3348
3427
  const c = r.images.get(e), h = s + ":flipY/" + n.toString();
3349
3428
  if (c[h] !== void 0) return c[h];
3350
3429
  o.images || (o.images = []);
3351
- const f = { mimeType: s }, u = Le();
3430
+ const d = { mimeType: s }, u = Re();
3352
3431
  u.width = Math.min(e.width, a.maxTextureSize), u.height = Math.min(e.height, a.maxTextureSize);
3353
3432
  const p = u.getContext("2d", {
3354
3433
  willReadFrequently: !0
3355
3434
  });
3356
3435
  if (n === !0 && (p.translate(0, u.height), p.scale(1, -1)), e.data !== void 0) {
3357
- t !== Fe && console.error("GLTFExporter: Only RGBAFormat is supported.", t), (e.width > a.maxTextureSize || e.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", e);
3436
+ t !== ke && console.error("GLTFExporter: Only RGBAFormat is supported.", t), (e.width > a.maxTextureSize || e.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", e);
3358
3437
  const x = new Uint8ClampedArray(e.height * e.width * 4);
3359
3438
  for (let S = 0; S < x.length; S += 4)
3360
3439
  x[S + 0] = e.data[S + 0], x[S + 1] = e.data[S + 1], x[S + 2] = e.data[S + 2], x[S + 3] = e.data[S + 3];
@@ -3364,11 +3443,11 @@ class pt {
3364
3443
  else
3365
3444
  throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
3366
3445
  a.binary === !0 ? l.push(
3367
- ft(u, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3368
- f.bufferView = x;
3446
+ St(u, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3447
+ d.bufferView = x;
3369
3448
  })
3370
- ) : f.uri = Ue.getDataURL(u, s);
3371
- const y = o.images.push(f) - 1;
3449
+ ) : d.uri = Xe.getDataURL(u, s);
3450
+ const y = o.images.push(d) - 1;
3372
3451
  return c[h] = y, y;
3373
3452
  } else
3374
3453
  throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");
@@ -3382,10 +3461,10 @@ class pt {
3382
3461
  const t = this.json;
3383
3462
  t.samplers || (t.samplers = []);
3384
3463
  const n = {
3385
- magFilter: Y[e.magFilter],
3386
- minFilter: Y[e.minFilter],
3387
- wrapS: Y[e.wrapS],
3388
- wrapT: Y[e.wrapT]
3464
+ magFilter: H[e.magFilter],
3465
+ minFilter: H[e.minFilter],
3466
+ wrapS: H[e.wrapS],
3467
+ wrapT: H[e.wrapT]
3389
3468
  };
3390
3469
  return t.samplers.push(n) - 1;
3391
3470
  }
@@ -3397,7 +3476,7 @@ class pt {
3397
3476
  async processTextureAsync(e) {
3398
3477
  const n = this.options, s = this.cache, i = this.json;
3399
3478
  if (s.textures.has(e)) return s.textures.get(e);
3400
- i.textures || (i.textures = []), e instanceof ie && (e = await this.decompressTextureAsync(e, n.maxTextureSize));
3479
+ i.textures || (i.textures = []), e instanceof de && (e = await this.decompressTextureAsync(e, n.maxTextureSize));
3401
3480
  let r = e.userData.mimeType;
3402
3481
  r === "image/webp" && (r = "image/png");
3403
3482
  const o = {
@@ -3424,7 +3503,7 @@ class pt {
3424
3503
  const s = { pbrMetallicRoughness: {} };
3425
3504
  e.isMeshStandardMaterial !== !0 && e.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
3426
3505
  const i = e.color.toArray().concat([e.opacity]);
3427
- if (Z(i, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = i), e.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = e.metalness, s.pbrMetallicRoughness.roughnessFactor = e.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), e.metalnessMap || e.roughnessMap) {
3506
+ if (oe(i, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = i), e.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = e.metalness, s.pbrMetallicRoughness.roughnessFactor = e.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), e.metalnessMap || e.roughnessMap) {
3428
3507
  const o = await this.buildMetalRoughTextureAsync(e.metalnessMap, e.roughnessMap), a = {
3429
3508
  index: await this.processTextureAsync(o),
3430
3509
  texCoord: o.channel
@@ -3462,7 +3541,7 @@ class pt {
3462
3541
  };
3463
3542
  e.aoMapIntensity !== 1 && (o.strength = e.aoMapIntensity), this.applyTextureTransform(o, e.aoMap), s.occlusionTexture = o;
3464
3543
  }
3465
- e.transparent ? s.alphaMode = "BLEND" : e.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = e.alphaTest), e.side === Ge && (s.doubleSided = !0), e.name !== "" && (s.name = e.name), this.serializeUserData(e, s), await this._invokeAllAsync(async function(o) {
3544
+ e.transparent ? s.alphaMode = "BLEND" : e.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = e.alphaTest), e.side === Ve && (s.doubleSided = !0), e.name !== "" && (s.name = e.name), this.serializeUserData(e, s), await this._invokeAllAsync(async function(o) {
3466
3545
  o.writeMaterialAsync && await o.writeMaterialAsync(e, s);
3467
3546
  });
3468
3547
  const r = n.materials.push(s) - 1;
@@ -3476,8 +3555,8 @@ class pt {
3476
3555
  async processMeshAsync(e) {
3477
3556
  const t = this.cache, n = this.json, s = [e.geometry.uuid];
3478
3557
  if (Array.isArray(e.material))
3479
- for (let A = 0, P = e.material.length; A < P; A++)
3480
- s.push(e.material[A].uuid);
3558
+ for (let E = 0, R = e.material.length; E < R; E++)
3559
+ s.push(e.material[E].uuid);
3481
3560
  else
3482
3561
  s.push(e.material.uuid);
3483
3562
  const i = s.join(":");
@@ -3485,7 +3564,7 @@ class pt {
3485
3564
  const r = e.geometry;
3486
3565
  let o;
3487
3566
  e.isLineSegments ? o = C.LINES : e.isLineLoop ? o = C.LINE_LOOP : e.isLine ? o = C.LINE_STRIP : e.isPoints ? o = C.POINTS : o = e.material.wireframe ? C.LINES : C.TRIANGLES;
3488
- const a = {}, l = {}, c = [], h = [], f = {
3567
+ const a = {}, l = {}, c = [], h = [], d = {
3489
3568
  uv: "TEXCOORD_0",
3490
3569
  uv1: "TEXCOORD_1",
3491
3570
  uv2: "TEXCOORD_2",
@@ -3496,76 +3575,76 @@ class pt {
3496
3575
  }, u = r.getAttribute("normal");
3497
3576
  u !== void 0 && !this.isNormalizedNormalAttribute(u) && (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), r.setAttribute("normal", this.createNormalizedNormalAttribute(u)));
3498
3577
  let p = null;
3499
- for (let A in r.attributes) {
3500
- if (A.slice(0, 5) === "morph") continue;
3501
- const P = r.attributes[A];
3502
- if (A = f[A] || A.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(A) || (A = "_" + A), t.attributes.has(this.getUID(P))) {
3503
- l[A] = t.attributes.get(this.getUID(P));
3578
+ for (let E in r.attributes) {
3579
+ if (E.slice(0, 5) === "morph") continue;
3580
+ const R = r.attributes[E];
3581
+ if (E = d[E] || E.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(E) || (E = "_" + E), t.attributes.has(this.getUID(R))) {
3582
+ l[E] = t.attributes.get(this.getUID(R));
3504
3583
  continue;
3505
3584
  }
3506
3585
  p = null;
3507
- const L = P.array;
3508
- A === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new H(new Uint16Array(L), P.itemSize, P.normalized)) : (L instanceof Uint32Array || L instanceof Int32Array) && !A.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${A}" converted to type FLOAT.`), p = ne.Utils.toFloat32BufferAttribute(P));
3509
- const g = this.processAccessor(p || P, r);
3510
- g !== null && (A.startsWith("_") || this.detectMeshQuantization(A, P), l[A] = g, t.attributes.set(this.getUID(P), g));
3586
+ const P = R.array;
3587
+ E === "JOINTS_0" && !(P instanceof Uint16Array) && !(P instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new te(new Uint16Array(P), R.itemSize, R.normalized)) : (P instanceof Uint32Array || P instanceof Int32Array) && !E.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${E}" converted to type FLOAT.`), p = he.Utils.toFloat32BufferAttribute(R));
3588
+ const O = this.processAccessor(p || R, r);
3589
+ O !== null && (E.startsWith("_") || this.detectMeshQuantization(E, R), l[E] = O, t.attributes.set(this.getUID(R), O));
3511
3590
  }
3512
3591
  if (u !== void 0 && r.setAttribute("normal", u), Object.keys(l).length === 0) return null;
3513
3592
  if (e.morphTargetInfluences !== void 0 && e.morphTargetInfluences.length > 0) {
3514
- const A = [], P = [], M = {};
3593
+ const E = [], R = [], U = {};
3515
3594
  if (e.morphTargetDictionary !== void 0)
3516
- for (const L in e.morphTargetDictionary)
3517
- M[e.morphTargetDictionary[L]] = L;
3518
- for (let L = 0; L < e.morphTargetInfluences.length; ++L) {
3519
- const g = {};
3520
- let b = !1;
3521
- for (const m in r.morphAttributes) {
3522
- if (m !== "position" && m !== "normal") {
3523
- b || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), b = !0);
3595
+ for (const P in e.morphTargetDictionary)
3596
+ U[e.morphTargetDictionary[P]] = P;
3597
+ for (let P = 0; P < e.morphTargetInfluences.length; ++P) {
3598
+ const O = {};
3599
+ let X = !1;
3600
+ for (const k in r.morphAttributes) {
3601
+ if (k !== "position" && k !== "normal") {
3602
+ X || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), X = !0);
3524
3603
  continue;
3525
3604
  }
3526
- const E = r.morphAttributes[m][L], T = m.toUpperCase(), I = r.attributes[m];
3527
- if (t.attributes.has(this.getUID(E, !0))) {
3528
- g[T] = t.attributes.get(this.getUID(E, !0));
3605
+ const W = r.morphAttributes[k][P], J = k.toUpperCase(), V = r.attributes[k];
3606
+ if (t.attributes.has(this.getUID(W, !0))) {
3607
+ O[J] = t.attributes.get(this.getUID(W, !0));
3529
3608
  continue;
3530
3609
  }
3531
- const N = E.clone();
3610
+ const D = W.clone();
3532
3611
  if (!r.morphTargetsRelative)
3533
- for (let D = 0, v = E.count; D < v; D++)
3534
- for (let O = 0; O < E.itemSize; O++)
3535
- O === 0 && N.setX(D, E.getX(D) - I.getX(D)), O === 1 && N.setY(D, E.getY(D) - I.getY(D)), O === 2 && N.setZ(D, E.getZ(D) - I.getZ(D)), O === 3 && N.setW(D, E.getW(D) - I.getW(D));
3536
- g[T] = this.processAccessor(N, r), t.attributes.set(this.getUID(I, !0), g[T]);
3612
+ for (let b = 0, L = W.count; b < L; b++)
3613
+ for (let M = 0; M < W.itemSize; M++)
3614
+ M === 0 && D.setX(b, W.getX(b) - V.getX(b)), M === 1 && D.setY(b, W.getY(b) - V.getY(b)), M === 2 && D.setZ(b, W.getZ(b) - V.getZ(b)), M === 3 && D.setW(b, W.getW(b) - V.getW(b));
3615
+ O[J] = this.processAccessor(D, r), t.attributes.set(this.getUID(V, !0), O[J]);
3537
3616
  }
3538
- h.push(g), A.push(e.morphTargetInfluences[L]), e.morphTargetDictionary !== void 0 && P.push(M[L]);
3617
+ h.push(O), E.push(e.morphTargetInfluences[P]), e.morphTargetDictionary !== void 0 && R.push(U[P]);
3539
3618
  }
3540
- a.weights = A, P.length > 0 && (a.extras = {}, a.extras.targetNames = P);
3619
+ a.weights = E, R.length > 0 && (a.extras = {}, a.extras.targetNames = R);
3541
3620
  }
3542
3621
  const y = Array.isArray(e.material);
3543
3622
  if (y && r.groups.length === 0) return null;
3544
3623
  let x = !1;
3545
3624
  if (y && r.index === null) {
3546
- const A = [];
3547
- for (let P = 0, M = r.attributes.position.count; P < M; P++)
3548
- A[P] = P;
3549
- r.setIndex(A), x = !0;
3625
+ const E = [];
3626
+ for (let R = 0, U = r.attributes.position.count; R < U; R++)
3627
+ E[R] = R;
3628
+ r.setIndex(E), x = !0;
3550
3629
  }
3551
- const S = y ? e.material : [e.material], R = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
3552
- for (let A = 0, P = R.length; A < P; A++) {
3553
- const M = {
3630
+ const S = y ? e.material : [e.material], T = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
3631
+ for (let E = 0, R = T.length; E < R; E++) {
3632
+ const U = {
3554
3633
  mode: o,
3555
3634
  attributes: l
3556
3635
  };
3557
- if (this.serializeUserData(r, M), h.length > 0 && (M.targets = h), r.index !== null) {
3558
- let g = this.getUID(r.index);
3559
- (R[A].start !== void 0 || R[A].count !== void 0) && (g += ":" + R[A].start + ":" + R[A].count), t.attributes.has(g) ? M.indices = t.attributes.get(g) : (M.indices = this.processAccessor(r.index, r, R[A].start, R[A].count), t.attributes.set(g, M.indices)), M.indices === null && delete M.indices;
3636
+ if (this.serializeUserData(r, U), h.length > 0 && (U.targets = h), r.index !== null) {
3637
+ let O = this.getUID(r.index);
3638
+ (T[E].start !== void 0 || T[E].count !== void 0) && (O += ":" + T[E].start + ":" + T[E].count), t.attributes.has(O) ? U.indices = t.attributes.get(O) : (U.indices = this.processAccessor(r.index, r, T[E].start, T[E].count), t.attributes.set(O, U.indices)), U.indices === null && delete U.indices;
3560
3639
  }
3561
- const L = await this.processMaterialAsync(S[R[A].materialIndex]);
3562
- L !== null && (M.material = L), c.push(M);
3640
+ const P = await this.processMaterialAsync(S[T[E].materialIndex]);
3641
+ P !== null && (U.material = P), c.push(U);
3563
3642
  }
3564
- x === !0 && r.setIndex(null), a.primitives = c, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(A) {
3565
- A.writeMesh && A.writeMesh(e, a);
3643
+ x === !0 && r.setIndex(null), a.primitives = c, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(E) {
3644
+ E.writeMesh && E.writeMesh(e, a);
3566
3645
  });
3567
- const F = n.meshes.push(a) - 1;
3568
- return t.meshes.set(i, F), F;
3646
+ const G = n.meshes.push(a) - 1;
3647
+ return t.meshes.set(i, G), G;
3569
3648
  }
3570
3649
  /**
3571
3650
  * If a vertex attribute with a
@@ -3579,7 +3658,7 @@ class pt {
3579
3658
  * @param {THREE.BufferAttribute} attribute
3580
3659
  */
3581
3660
  detectMeshQuantization(e, t) {
3582
- if (this.extensionsUsed[re]) return;
3661
+ if (this.extensionsUsed[fe]) return;
3583
3662
  let n;
3584
3663
  switch (t.array.constructor) {
3585
3664
  case Int8Array:
@@ -3599,7 +3678,7 @@ class pt {
3599
3678
  }
3600
3679
  t.normalized && (n += " normalized");
3601
3680
  const s = e.split("_", 1)[0];
3602
- me[s] && me[s].includes(n) && (this.extensionsUsed[re] = !0, this.extensionsRequired[re] = !0);
3681
+ Ae[s] && Ae[s].includes(n) && (this.extensionsUsed[fe] = !0, this.extensionsRequired[fe] = !0);
3603
3682
  }
3604
3683
  /**
3605
3684
  * Process camera
@@ -3619,7 +3698,7 @@ class pt {
3619
3698
  znear: e.near < 0 ? 0 : e.near
3620
3699
  } : s.perspective = {
3621
3700
  aspectRatio: e.aspect,
3622
- yfov: ce.degToRad(e.fov),
3701
+ yfov: ye.degToRad(e.fov),
3623
3702
  zfar: e.far <= 0 ? 1e-3 : e.far,
3624
3703
  znear: e.near < 0 ? 0 : e.near
3625
3704
  }, e.name !== "" && (s.name = e.type), t.cameras.push(s) - 1;
@@ -3636,28 +3715,28 @@ class pt {
3636
3715
  */
3637
3716
  processAnimation(e, t) {
3638
3717
  const n = this.json, s = this.nodeMap;
3639
- n.animations || (n.animations = []), e = ne.Utils.mergeMorphTargetTracks(e.clone(), t);
3718
+ n.animations || (n.animations = []), e = he.Utils.mergeMorphTargetTracks(e.clone(), t);
3640
3719
  const i = e.tracks, r = [], o = [];
3641
3720
  for (let l = 0; l < i.length; ++l) {
3642
- const c = i[l], h = te.parseTrackName(c.name);
3643
- let f = te.findNode(t, h.nodeName);
3644
- const u = ge[h.propertyName];
3645
- if (h.objectName === "bones" && (f.isSkinnedMesh === !0 ? f = f.skeleton.getBoneByName(h.objectIndex) : f = void 0), !f || !u) {
3721
+ const c = i[l], h = le.parseTrackName(c.name);
3722
+ let d = le.findNode(t, h.nodeName);
3723
+ const u = Te[h.propertyName];
3724
+ if (h.objectName === "bones" && (d.isSkinnedMesh === !0 ? d = d.skeleton.getBoneByName(h.objectIndex) : d = void 0), !d || !u) {
3646
3725
  console.warn('THREE.GLTFExporter: Could not export animation track "%s".', c.name);
3647
3726
  continue;
3648
3727
  }
3649
3728
  const p = 1;
3650
3729
  let y = c.values.length / c.times.length;
3651
- u === ge.morphTargetInfluences && (y /= f.morphTargetInfluences.length);
3730
+ u === Te.morphTargetInfluences && (y /= d.morphTargetInfluences.length);
3652
3731
  let x;
3653
- c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : c.getInterpolation() === _e ? x = "STEP" : x = "LINEAR", o.push({
3654
- input: this.processAccessor(new H(c.times, p)),
3655
- output: this.processAccessor(new H(c.values, y)),
3732
+ c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : c.getInterpolation() === We ? x = "STEP" : x = "LINEAR", o.push({
3733
+ input: this.processAccessor(new te(c.times, p)),
3734
+ output: this.processAccessor(new te(c.values, y)),
3656
3735
  interpolation: x
3657
3736
  }), r.push({
3658
3737
  sampler: o.length - 1,
3659
3738
  target: {
3660
- node: s.get(f),
3739
+ node: s.get(d),
3661
3740
  path: u
3662
3741
  }
3663
3742
  });
@@ -3678,11 +3757,11 @@ class pt {
3678
3757
  if (i === void 0) return null;
3679
3758
  const r = e.skeleton.bones[0];
3680
3759
  if (r === void 0) return null;
3681
- const o = [], a = new Float32Array(i.bones.length * 16), l = new Ae();
3760
+ const o = [], a = new Float32Array(i.bones.length * 16), l = new ve();
3682
3761
  for (let h = 0; h < i.bones.length; ++h)
3683
3762
  o.push(n.get(i.bones[h])), l.copy(i.boneInverses[h]), l.multiply(e.bindMatrix).toArray(a, h * 16);
3684
3763
  return t.skins === void 0 && (t.skins = []), t.skins.push({
3685
- inverseBindMatrices: this.processAccessor(new H(a, 16)),
3764
+ inverseBindMatrices: this.processAccessor(new te(a, 16)),
3686
3765
  joints: o,
3687
3766
  skeleton: n.get(r)
3688
3767
  }), s.skin = t.skins.length - 1;
@@ -3698,9 +3777,9 @@ class pt {
3698
3777
  const i = {};
3699
3778
  if (n.trs) {
3700
3779
  const o = e.quaternion.toArray(), a = e.position.toArray(), l = e.scale.toArray();
3701
- Z(o, [0, 0, 0, 1]) || (i.rotation = o), Z(a, [0, 0, 0]) || (i.translation = a), Z(l, [1, 1, 1]) || (i.scale = l);
3780
+ oe(o, [0, 0, 0, 1]) || (i.rotation = o), oe(a, [0, 0, 0]) || (i.translation = a), oe(l, [1, 1, 1]) || (i.scale = l);
3702
3781
  } else
3703
- e.matrixAutoUpdate && e.updateMatrix(), ut(e.matrix) === !1 && (i.matrix = e.matrix.elements);
3782
+ e.matrixAutoUpdate && e.updateMatrix(), wt(e.matrix) === !1 && (i.matrix = e.matrix.elements);
3704
3783
  if (e.name !== "" && (i.name = String(e.name)), this.serializeUserData(e, i), e.isMesh || e.isLine || e.isPoints) {
3705
3784
  const o = await this.processMeshAsync(e);
3706
3785
  o !== null && (i.mesh = o);
@@ -3746,7 +3825,7 @@ class pt {
3746
3825
  * @param {Array<THREE.Object3D>} objects List of objects to process
3747
3826
  */
3748
3827
  async processObjectsAsync(e) {
3749
- const t = new fe();
3828
+ const t = new Se();
3750
3829
  t.name = "AuxScene";
3751
3830
  for (let n = 0; n < e.length; n++)
3752
3831
  t.children.push(e[n]);
@@ -3762,7 +3841,7 @@ class pt {
3762
3841
  });
3763
3842
  const n = [];
3764
3843
  for (let s = 0; s < e.length; s++)
3765
- e[s] instanceof fe ? await this.processSceneAsync(e[s]) : n.push(e[s]);
3844
+ e[s] instanceof Se ? await this.processSceneAsync(e[s]) : n.push(e[s]);
3766
3845
  n.length > 0 && await this.processObjectsAsync(n);
3767
3846
  for (let s = 0; s < this.skins.length; ++s)
3768
3847
  this.processSkin(this.skins[s]);
@@ -3777,7 +3856,7 @@ class pt {
3777
3856
  await e(this.plugins[t]);
3778
3857
  }
3779
3858
  }
3780
- class xt {
3859
+ class Et {
3781
3860
  constructor(e) {
3782
3861
  this.writer = e, this.name = "KHR_lights_punctual";
3783
3862
  }
@@ -3793,7 +3872,7 @@ class xt {
3793
3872
  o.push(r), t.extensions = t.extensions || {}, t.extensions[this.name] = { light: o.length - 1 };
3794
3873
  }
3795
3874
  }
3796
- class yt {
3875
+ class Dt {
3797
3876
  constructor(e) {
3798
3877
  this.writer = e, this.name = "KHR_materials_unlit";
3799
3878
  }
@@ -3803,7 +3882,7 @@ class yt {
3803
3882
  t.extensions = t.extensions || {}, t.extensions[this.name] = {}, s[this.name] = !0, t.pbrMetallicRoughness.metallicFactor = 0, t.pbrMetallicRoughness.roughnessFactor = 0.9;
3804
3883
  }
3805
3884
  }
3806
- class mt {
3885
+ class At {
3807
3886
  constructor(e) {
3808
3887
  this.writer = e, this.name = "KHR_materials_clearcoat";
3809
3888
  }
@@ -3834,7 +3913,7 @@ class mt {
3834
3913
  t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3835
3914
  }
3836
3915
  }
3837
- class gt {
3916
+ class Tt {
3838
3917
  constructor(e) {
3839
3918
  this.writer = e, this.name = "KHR_materials_dispersion";
3840
3919
  }
@@ -3844,7 +3923,7 @@ class gt {
3844
3923
  i.dispersion = e.dispersion, t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3845
3924
  }
3846
3925
  }
3847
- class wt {
3926
+ class bt {
3848
3927
  constructor(e) {
3849
3928
  this.writer = e, this.name = "KHR_materials_iridescence";
3850
3929
  }
@@ -3868,7 +3947,7 @@ class wt {
3868
3947
  t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3869
3948
  }
3870
3949
  }
3871
- class Mt {
3950
+ class It {
3872
3951
  constructor(e) {
3873
3952
  this.writer = e, this.name = "KHR_materials_transmission";
3874
3953
  }
@@ -3885,7 +3964,7 @@ class Mt {
3885
3964
  t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3886
3965
  }
3887
3966
  }
3888
- class Lt {
3967
+ class Rt {
3889
3968
  constructor(e) {
3890
3969
  this.writer = e, this.name = "KHR_materials_volume";
3891
3970
  }
@@ -3902,7 +3981,7 @@ class Lt {
3902
3981
  e.attenuationDistance !== 1 / 0 && (i.attenuationDistance = e.attenuationDistance), i.attenuationColor = e.attenuationColor.toArray(), t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3903
3982
  }
3904
3983
  }
3905
- class St {
3984
+ class Pt {
3906
3985
  constructor(e) {
3907
3986
  this.writer = e, this.name = "KHR_materials_ior";
3908
3987
  }
@@ -3912,12 +3991,12 @@ class St {
3912
3991
  i.ior = e.ior, t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3913
3992
  }
3914
3993
  }
3915
- class At {
3994
+ class vt {
3916
3995
  constructor(e) {
3917
3996
  this.writer = e, this.name = "KHR_materials_specular";
3918
3997
  }
3919
3998
  async writeMaterialAsync(e, t) {
3920
- if (!e.isMeshPhysicalMaterial || e.specularIntensity === 1 && e.specularColor.equals(rt) && !e.specularIntensityMap && !e.specularColorMap) return;
3999
+ if (!e.isMeshPhysicalMaterial || e.specularIntensity === 1 && e.specularColor.equals(ft) && !e.specularIntensityMap && !e.specularColorMap) return;
3921
4000
  const n = this.writer, s = n.extensionsUsed, i = {};
3922
4001
  if (e.specularIntensityMap) {
3923
4002
  const r = {
@@ -3936,7 +4015,7 @@ class At {
3936
4015
  i.specularFactor = e.specularIntensity, i.specularColorFactor = e.specularColor.toArray(), t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3937
4016
  }
3938
4017
  }
3939
- class Et {
4018
+ class Nt {
3940
4019
  constructor(e) {
3941
4020
  this.writer = e, this.name = "KHR_materials_sheen";
3942
4021
  }
@@ -3960,7 +4039,7 @@ class Et {
3960
4039
  i.sheenRoughnessFactor = e.sheenRoughness, i.sheenColorFactor = e.sheenColor.toArray(), t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3961
4040
  }
3962
4041
  }
3963
- class Tt {
4042
+ class Ct {
3964
4043
  constructor(e) {
3965
4044
  this.writer = e, this.name = "KHR_materials_anisotropy";
3966
4045
  }
@@ -3974,7 +4053,7 @@ class Tt {
3974
4053
  i.anisotropyStrength = e.anisotropy, i.anisotropyRotation = e.anisotropyRotation, t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3975
4054
  }
3976
4055
  }
3977
- class Dt {
4056
+ class Bt {
3978
4057
  constructor(e) {
3979
4058
  this.writer = e, this.name = "KHR_materials_emissive_strength";
3980
4059
  }
@@ -3984,7 +4063,7 @@ class Dt {
3984
4063
  i.emissiveStrength = e.emissiveIntensity, t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
3985
4064
  }
3986
4065
  }
3987
- class bt {
4066
+ class Ot {
3988
4067
  constructor(e) {
3989
4068
  this.writer = e, this.name = "EXT_materials_bump";
3990
4069
  }
@@ -4001,54 +4080,54 @@ class bt {
4001
4080
  i.bumpFactor = e.bumpScale, t.extensions = t.extensions || {}, t.extensions[this.name] = i, s[this.name] = !0;
4002
4081
  }
4003
4082
  }
4004
- class It {
4083
+ class Ft {
4005
4084
  constructor(e) {
4006
4085
  this.writer = e, this.name = "EXT_mesh_gpu_instancing";
4007
4086
  }
4008
4087
  writeNode(e, t) {
4009
4088
  if (!e.isInstancedMesh) return;
4010
- const n = this.writer, s = e, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new Ae(), l = new ee(), c = new Ne(), h = new ee();
4089
+ const n = this.writer, s = e, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new ve(), l = new ce(), c = new _e(), h = new ce();
4011
4090
  for (let u = 0; u < s.count; u++)
4012
4091
  s.getMatrixAt(u, a), a.decompose(l, c, h), l.toArray(i, u * 3), c.toArray(r, u * 4), h.toArray(o, u * 3);
4013
- const f = {
4014
- TRANSLATION: n.processAccessor(new H(i, 3)),
4015
- ROTATION: n.processAccessor(new H(r, 4)),
4016
- SCALE: n.processAccessor(new H(o, 3))
4092
+ const d = {
4093
+ TRANSLATION: n.processAccessor(new te(i, 3)),
4094
+ ROTATION: n.processAccessor(new te(r, 4)),
4095
+ SCALE: n.processAccessor(new te(o, 3))
4017
4096
  };
4018
- s.instanceColor && (f._COLOR_0 = n.processAccessor(s.instanceColor)), t.extensions = t.extensions || {}, t.extensions[this.name] = { attributes: f }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
4097
+ s.instanceColor && (d._COLOR_0 = n.processAccessor(s.instanceColor)), t.extensions = t.extensions || {}, t.extensions[this.name] = { attributes: d }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
4019
4098
  }
4020
4099
  }
4021
- ne.Utils = {
4022
- insertKeyframe: function(d, e) {
4023
- const n = d.getValueSize(), s = new d.TimeBufferType(d.times.length + 1), i = new d.ValueBufferType(d.values.length + n), r = d.createInterpolant(new d.ValueBufferType(n));
4100
+ he.Utils = {
4101
+ insertKeyframe: function(f, e) {
4102
+ const n = f.getValueSize(), s = new f.TimeBufferType(f.times.length + 1), i = new f.ValueBufferType(f.values.length + n), r = f.createInterpolant(new f.ValueBufferType(n));
4024
4103
  let o;
4025
- if (d.times.length === 0) {
4104
+ if (f.times.length === 0) {
4026
4105
  s[0] = e;
4027
4106
  for (let a = 0; a < n; a++)
4028
4107
  i[a] = 0;
4029
4108
  o = 0;
4030
- } else if (e < d.times[0]) {
4031
- if (Math.abs(d.times[0] - e) < 1e-3) return 0;
4032
- s[0] = e, s.set(d.times, 1), i.set(r.evaluate(e), 0), i.set(d.values, n), o = 0;
4033
- } else if (e > d.times[d.times.length - 1]) {
4034
- if (Math.abs(d.times[d.times.length - 1] - e) < 1e-3)
4035
- return d.times.length - 1;
4036
- s[s.length - 1] = e, s.set(d.times, 0), i.set(d.values, 0), i.set(r.evaluate(e), d.values.length), o = s.length - 1;
4109
+ } else if (e < f.times[0]) {
4110
+ if (Math.abs(f.times[0] - e) < 1e-3) return 0;
4111
+ s[0] = e, s.set(f.times, 1), i.set(r.evaluate(e), 0), i.set(f.values, n), o = 0;
4112
+ } else if (e > f.times[f.times.length - 1]) {
4113
+ if (Math.abs(f.times[f.times.length - 1] - e) < 1e-3)
4114
+ return f.times.length - 1;
4115
+ s[s.length - 1] = e, s.set(f.times, 0), i.set(f.values, 0), i.set(r.evaluate(e), f.values.length), o = s.length - 1;
4037
4116
  } else
4038
- for (let a = 0; a < d.times.length; a++) {
4039
- if (Math.abs(d.times[a] - e) < 1e-3) return a;
4040
- if (d.times[a] < e && d.times[a + 1] > e) {
4041
- s.set(d.times.slice(0, a + 1), 0), s[a + 1] = e, s.set(d.times.slice(a + 1), a + 2), i.set(d.values.slice(0, (a + 1) * n), 0), i.set(r.evaluate(e), (a + 1) * n), i.set(d.values.slice((a + 1) * n), (a + 2) * n), o = a + 1;
4117
+ for (let a = 0; a < f.times.length; a++) {
4118
+ if (Math.abs(f.times[a] - e) < 1e-3) return a;
4119
+ if (f.times[a] < e && f.times[a + 1] > e) {
4120
+ s.set(f.times.slice(0, a + 1), 0), s[a + 1] = e, s.set(f.times.slice(a + 1), a + 2), i.set(f.values.slice(0, (a + 1) * n), 0), i.set(r.evaluate(e), (a + 1) * n), i.set(f.values.slice((a + 1) * n), (a + 2) * n), o = a + 1;
4042
4121
  break;
4043
4122
  }
4044
4123
  }
4045
- return d.times = s, d.values = i, o;
4124
+ return f.times = s, f.values = i, o;
4046
4125
  },
4047
- mergeMorphTargetTracks: function(d, e) {
4048
- const t = [], n = {}, s = d.tracks;
4126
+ mergeMorphTargetTracks: function(f, e) {
4127
+ const t = [], n = {}, s = f.tracks;
4049
4128
  for (let i = 0; i < s.length; ++i) {
4050
4129
  let r = s[i];
4051
- const o = te.parseTrackName(r.name), a = te.findNode(e, o.nodeName);
4130
+ const o = le.parseTrackName(r.name), a = le.findNode(e, o.nodeName);
4052
4131
  if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
4053
4132
  t.push(r);
4054
4133
  continue;
@@ -4056,7 +4135,7 @@ ne.Utils = {
4056
4135
  if (r.createInterpolant !== r.InterpolantFactoryMethodDiscrete && r.createInterpolant !== r.InterpolantFactoryMethodLinear) {
4057
4136
  if (r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
4058
4137
  throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
4059
- console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(Ke);
4138
+ console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(it);
4060
4139
  }
4061
4140
  const l = a.morphTargetInfluences.length, c = a.morphTargetDictionary[o.propertyIndex];
4062
4141
  if (c === void 0)
@@ -4070,77 +4149,77 @@ ne.Utils = {
4070
4149
  h.name = (o.nodeName || "") + ".morphTargetInfluences", h.values = u, n[a.uuid] = h, t.push(h);
4071
4150
  continue;
4072
4151
  }
4073
- const f = r.createInterpolant(new r.ValueBufferType(1));
4152
+ const d = r.createInterpolant(new r.ValueBufferType(1));
4074
4153
  h = n[a.uuid];
4075
4154
  for (let u = 0; u < h.times.length; u++)
4076
- h.values[u * l + c] = f.evaluate(h.times[u]);
4155
+ h.values[u * l + c] = d.evaluate(h.times[u]);
4077
4156
  for (let u = 0; u < r.times.length; u++) {
4078
4157
  const p = this.insertKeyframe(h, r.times[u]);
4079
4158
  h.values[p * l + c] = r.values[u];
4080
4159
  }
4081
4160
  }
4082
- return d.tracks = t, d;
4161
+ return f.tracks = t, f;
4083
4162
  },
4084
- toFloat32BufferAttribute: function(d) {
4085
- const e = new H(new Float32Array(d.count * d.itemSize), d.itemSize, !1);
4086
- if (!d.normalized && !d.isInterleavedBufferAttribute)
4087
- return e.array.set(d.array), e;
4088
- for (let t = 0, n = d.count; t < n; t++)
4089
- for (let s = 0; s < d.itemSize; s++)
4090
- e.setComponent(t, s, d.getComponent(t, s));
4163
+ toFloat32BufferAttribute: function(f) {
4164
+ const e = new te(new Float32Array(f.count * f.itemSize), f.itemSize, !1);
4165
+ if (!f.normalized && !f.isInterleavedBufferAttribute)
4166
+ return e.array.set(f.array), e;
4167
+ for (let t = 0, n = f.count; t < n; t++)
4168
+ for (let s = 0; s < f.itemSize; s++)
4169
+ e.setComponent(t, s, f.getComponent(t, s));
4091
4170
  return e;
4092
4171
  }
4093
4172
  };
4094
- async function Rt(d) {
4173
+ async function Ut(f) {
4095
4174
  if (typeof FileReader > "u") {
4096
- const e = await d.arrayBuffer(), n = Buffer.from(e).toString("base64");
4097
- return `data:${d.type};base64,${n}`;
4175
+ const e = await f.arrayBuffer(), n = Buffer.from(e).toString("base64");
4176
+ return `data:${f.type};base64,${n}`;
4098
4177
  } else
4099
4178
  return new Promise((e, t) => {
4100
4179
  const n = new FileReader();
4101
- n.onload = () => e(n.result), n.onerror = () => t(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(d);
4180
+ n.onload = () => e(n.result), n.onerror = () => t(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(f);
4102
4181
  });
4103
4182
  }
4104
- async function ae(d) {
4105
- if (typeof d.arrayBuffer == "function")
4106
- return await d.arrayBuffer();
4183
+ async function xe(f) {
4184
+ if (typeof f.arrayBuffer == "function")
4185
+ return await f.arrayBuffer();
4107
4186
  if (typeof FileReader < "u")
4108
4187
  return new Promise((e, t) => {
4109
4188
  const n = new FileReader();
4110
- n.onload = () => e(n.result), n.onerror = () => t(n.error), n.readAsArrayBuffer(d);
4189
+ n.onload = () => e(n.result), n.onerror = () => t(n.error), n.readAsArrayBuffer(f);
4111
4190
  });
4112
4191
  {
4113
- const e = Buffer.from(await d.text());
4192
+ const e = Buffer.from(await f.text());
4114
4193
  return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
4115
4194
  }
4116
4195
  }
4117
- const Pt = new $e(), vt = new ne();
4118
- function Nt(d, e, t = 0.1) {
4119
- const n = e.normal(d), s = e.direction(d).mutiplyScalar(t * 0.5), i = d.direction(e).mutiplyScalar(t * 0.5), r = n.x * t * 0.5, o = n.y * t * 0.5;
4196
+ const Gt = new rt(), zt = new he();
4197
+ function _t(f, e, t = 0.1) {
4198
+ const n = e.normal(f), s = e.direction(f).mutiplyScalar(t * 0.5), i = f.direction(e).mutiplyScalar(t * 0.5), r = n.x * t * 0.5, o = n.y * t * 0.5;
4120
4199
  return {
4121
4200
  points: [
4122
4201
  // 第一条线
4123
- new w(d.x + r, d.y + o).add(i),
4124
- new w(e.x + r, e.y + o).add(s),
4202
+ new g(f.x + r, f.y + o).add(i),
4203
+ new g(e.x + r, e.y + o).add(s),
4125
4204
  // 第二条线
4126
- new w(d.x - r, d.y - o).add(i),
4127
- new w(e.x - r, e.y - o).add(s)
4205
+ new g(f.x - r, f.y - o).add(i),
4206
+ new g(e.x - r, e.y - o).add(s)
4128
4207
  ],
4129
4208
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
4130
4209
  rectIndices: [0, 1, 3, 2, 0]
4131
4210
  };
4132
4211
  }
4133
- class be extends J {
4212
+ class Oe extends ne {
4134
4213
  static name = "WhiteModel";
4135
4214
  Dxf = null;
4136
4215
  Variable = null;
4137
4216
  // dxf数据白模
4138
- whiteModelGroup = new U.Group();
4217
+ whiteModelGroup = new z.Group();
4139
4218
  // dxf数据白模边缘线
4140
- whiteModelLineGroup = new U.Group();
4219
+ whiteModelLineGroup = new z.Group();
4141
4220
  // 原始数据白模
4142
- originalWhiteMode = new U.Group();
4143
- material = new U.MeshStandardMaterial({ color: 16777215, transparent: !0, opacity: 0.8, side: U.DoubleSide });
4221
+ originalWhiteMode = new z.Group();
4222
+ material = new z.MeshStandardMaterial({ color: 16777215, transparent: !0, opacity: 0.8, side: z.DoubleSide });
4144
4223
  onAddFromParent(e) {
4145
4224
  this.Dxf = e.findComponentByName("Dxf"), this.Variable = e.findComponentByName("Variable"), this.originalWhiteMode.visible = !1, this.Dxf?.addEventListener("lineOffset", () => {
4146
4225
  this.updateModel();
@@ -4150,17 +4229,17 @@ class be extends J {
4150
4229
  this.Variable?.set("whiteModelVisible", !1);
4151
4230
  const e = this.Dxf;
4152
4231
  this.originalWhiteMode.clear(), this.whiteModelGroup.clear(), this.whiteModelLineGroup.clear(), this.whiteModelGroup.add(this.whiteModelLineGroup), this.whiteModelGroup.position.z = e.originalZAverage, this.originalWhiteMode.position.z = e.originalZAverage, e.wallsGroup.forEach((n) => {
4153
- const s = new U.Shape();
4232
+ const s = new z.Shape();
4154
4233
  n.forEach((o, a) => a === 0 ? s.moveTo(o.x / e.scale, o.y / e.scale) : s.lineTo(o.x / e.scale, o.y / e.scale));
4155
- const i = new U.ExtrudeGeometry(s, {
4234
+ const i = new z.ExtrudeGeometry(s, {
4156
4235
  depth: 2.8,
4157
4236
  bevelSize: 0
4158
- }), r = new U.Mesh(i, this.material);
4237
+ }), r = new z.Mesh(i, this.material);
4159
4238
  this.whiteModelGroup.add(r), this.whiteModelLineGroup.add(
4160
- new U.LineSegments(new U.EdgesGeometry(i), new U.LineBasicMaterial({ color: 0 }))
4239
+ new z.LineSegments(new z.EdgesGeometry(i), new z.LineBasicMaterial({ color: 0 }))
4161
4240
  );
4162
4241
  }), e.originalData.map(({ start: n, end: s, insetionArr: i }) => {
4163
- const r = new w(n.x, n.y).mutiplyScalar(e.scale), o = new w(s.x, s.y).mutiplyScalar(e.scale), { points: a, indices: l, rectIndices: c } = Nt(r, o, e.width);
4242
+ const r = new g(n.x, n.y).mutiplyScalar(e.scale), o = new g(s.x, s.y).mutiplyScalar(e.scale), { points: a, indices: l, rectIndices: c } = _t(r, o, e.width);
4164
4243
  return {
4165
4244
  points: a,
4166
4245
  indices: l,
@@ -4168,17 +4247,17 @@ class be extends J {
4168
4247
  insetions: (i ?? []).map((h) => h.index)
4169
4248
  };
4170
4249
  }).forEach((n) => {
4171
- const s = new U.Shape();
4250
+ const s = new z.Shape();
4172
4251
  n.rectIndices.forEach((o, a) => {
4173
4252
  const l = n.points[o];
4174
4253
  a === 0 ? s.moveTo(l.x, l.y) : s.lineTo(l.x, l.y);
4175
4254
  });
4176
- const i = new U.ExtrudeGeometry(s, {
4255
+ const i = new z.ExtrudeGeometry(s, {
4177
4256
  depth: 2.8,
4178
4257
  bevelSize: 0
4179
4258
  });
4180
4259
  if (i.attributes.position.array.filter((o) => Number.isNaN(o)).length) return;
4181
- const r = new U.Mesh(i);
4260
+ const r = new z.Mesh(i);
4182
4261
  this.originalWhiteMode?.add(r);
4183
4262
  }), this.dispatchEvent({
4184
4263
  type: "updateModel",
@@ -4193,7 +4272,7 @@ class be extends J {
4193
4272
  toOBJ() {
4194
4273
  return new Promise((e) => {
4195
4274
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
4196
- e(Pt.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4275
+ e(Gt.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4197
4276
  }, 20);
4198
4277
  });
4199
4278
  }
@@ -4205,7 +4284,7 @@ class be extends J {
4205
4284
  toGltf(e = !0) {
4206
4285
  return new Promise((t) => {
4207
4286
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
4208
- vt.parse(this.whiteModelGroup.children, (n) => {
4287
+ zt.parse(this.whiteModelGroup.children, (n) => {
4209
4288
  t(n), this.material.opacity = 0.8, this.material.transparent = !0;
4210
4289
  }, () => {
4211
4290
  t(void 0);
@@ -4246,7 +4325,7 @@ class be extends J {
4246
4325
  n.href = URL.createObjectURL(t), n.download = e, n.click();
4247
4326
  } else if (typeof global < "u") {
4248
4327
  const t = await this.toOBJ();
4249
- t && (await K("fs", !1)).writeFileSync(e, t);
4328
+ t && (await se("fs", !1)).writeFileSync(e, t);
4250
4329
  }
4251
4330
  }
4252
4331
  /**
@@ -4262,11 +4341,11 @@ class be extends J {
4262
4341
  s.href = URL.createObjectURL(n), s.download = e, s.click();
4263
4342
  } else if (typeof global < "u") {
4264
4343
  const n = await this.toGltf(t);
4265
- n && (await K("fs", !1)).writeFileSync(e, t ? Buffer.from(n) : JSON.stringify(n));
4344
+ n && (await se("fs", !1)).writeFileSync(e, t ? Buffer.from(n) : JSON.stringify(n));
4266
4345
  }
4267
4346
  }
4268
4347
  }
4269
- class Ie extends J {
4348
+ class Fe extends ne {
4270
4349
  static name = "DetailsPoint";
4271
4350
  Dxf = null;
4272
4351
  WhiteModel = null;
@@ -4317,17 +4396,17 @@ class Ie extends J {
4317
4396
  this._timer = null;
4318
4397
  const e = this.parent?.findComponentByName("WhiteModel");
4319
4398
  this.raylines.length = 0, this.desPoints.length = 0, this.data.forEach((t) => {
4320
- const n = new U.Vector3(
4399
+ const n = new z.Vector3(
4321
4400
  t.position.x,
4322
4401
  t.position.y,
4323
4402
  t.position.z
4324
- ), s = new U.Vector3(
4403
+ ), s = new z.Vector3(
4325
4404
  t.direction.x,
4326
4405
  t.direction.y,
4327
4406
  t.direction.z
4328
4407
  ), i = 100;
4329
4408
  this.racasterHelper(n, s, i), s.z = 0;
4330
- const o = new U.Raycaster(n, s, 0, i).intersectObject(e.originalWhiteMode);
4409
+ const o = new z.Raycaster(n, s, 0, i).intersectObject(e.originalWhiteMode);
4331
4410
  if (o.length) {
4332
4411
  const { point: a } = o[0];
4333
4412
  this.desPoints.push({
@@ -4343,61 +4422,61 @@ class Ie extends J {
4343
4422
  }, 50);
4344
4423
  }
4345
4424
  }
4346
- class Re extends J {
4425
+ class Ue extends ne {
4347
4426
  static name = "DxfLineModel";
4348
- dxfLineModel = new U.LineSegments();
4349
- dxfDoorsLineModel = new U.LineSegments();
4350
- dxfModelGroup = new U.Group();
4427
+ dxfLineModel = new z.LineSegments();
4428
+ dxfDoorsLineModel = new z.LineSegments();
4429
+ dxfModelGroup = new z.Group();
4351
4430
  onAddFromParent(e) {
4352
4431
  const t = e.findComponentByName("Dxf");
4353
- this.dxfModelGroup.add(this.dxfLineModel), this.dxfModelGroup.add(this.dxfDoorsLineModel), this.dxfDoorsLineModel.material = new U.LineBasicMaterial({ color: 16776960, vertexColors: !0 }), t?.addEventListener("lineOffset", () => this.updateMode());
4432
+ this.dxfModelGroup.add(this.dxfLineModel), this.dxfModelGroup.add(this.dxfDoorsLineModel), this.dxfDoorsLineModel.material = new z.LineBasicMaterial({ color: 16776960, vertexColors: !0 }), t?.addEventListener("lineOffset", () => this.updateMode());
4354
4433
  }
4355
4434
  updateMode() {
4356
4435
  const e = this.parent?.findComponentByName("Dxf");
4357
4436
  this.dxfLineModel.clear();
4358
4437
  const t = e.to3DArray(1 / e.scale, 0);
4359
- this.dxfLineModel.geometry = new U.BufferGeometry().setAttribute("position", new U.BufferAttribute(t, 3, !0));
4438
+ this.dxfLineModel.geometry = new z.BufferGeometry().setAttribute("position", new z.BufferAttribute(t, 3, !0));
4360
4439
  const n = new Float32Array(
4361
4440
  e.doorLineSegment.flatMap(({ start: i, end: r }) => [i.x, i.y, 0, r.x, r.y, 0])
4362
4441
  ).map((i) => i / e.scale), s = new Float32Array(e.doorLineSegment.flatMap(() => [1, 0, 0, 0, 1, 0]));
4363
- this.dxfDoorsLineModel.geometry = new U.BufferGeometry().setAttribute("position", new U.BufferAttribute(n, 3, !0)).setAttribute("color", new U.BufferAttribute(s, 3)), this.dxfModelGroup.position.z = e.originalZAverage, this.dispatchEvent({
4442
+ this.dxfDoorsLineModel.geometry = new z.BufferGeometry().setAttribute("position", new z.BufferAttribute(n, 3, !0)).setAttribute("color", new z.BufferAttribute(s, 3)), this.dxfModelGroup.position.z = e.originalZAverage, this.dispatchEvent({
4364
4443
  type: "modelUpdate",
4365
4444
  model: this.dxfModelGroup
4366
4445
  });
4367
4446
  }
4368
4447
  }
4369
- const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4448
+ const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4370
4449
  __proto__: null,
4371
- DetailsPoint: Ie,
4372
- DxfLineModel: Re,
4373
- WhiteModel: be
4450
+ DetailsPoint: Fe,
4451
+ DxfLineModel: Ue,
4452
+ WhiteModel: Oe
4374
4453
  }, Symbol.toStringTag, { value: "Module" }));
4375
- function Se(d, e = {}) {
4454
+ function Pe(f, e = {}) {
4376
4455
  const {
4377
4456
  detailsPoint: t = !0,
4378
4457
  whiteModel: n = !0,
4379
4458
  dxfLineModel: s = !0
4380
4459
  } = e;
4381
- s && d.addComponent(new Re()), n && d.addComponent(new be()), t && d.addComponent(new Ie());
4460
+ s && f.addComponent(new Ue()), n && f.addComponent(new Oe()), t && f.addComponent(new Fe());
4382
4461
  }
4383
- const Bt = Object.assign(Se, {
4384
- create(d = {}) {
4385
- return (e) => Se(e, d);
4462
+ const jt = Object.assign(Pe, {
4463
+ create(f = {}) {
4464
+ return (e) => Pe(e, f);
4386
4465
  }
4387
- }), Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4466
+ }), Yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4388
4467
  __proto__: null,
4389
- ModelDataPlugin: Bt,
4390
- components: Ct
4468
+ ModelDataPlugin: jt,
4469
+ components: qt
4391
4470
  }, Symbol.toStringTag, { value: "Module" }));
4392
- function Ft() {
4471
+ function kt() {
4393
4472
  return import("./index2.js");
4394
4473
  }
4395
- function Ut() {
4474
+ function Xt() {
4396
4475
  return import("./index3.js");
4397
4476
  }
4398
- let de = null;
4399
- async function Yt(d, e, t = !1, n) {
4400
- const s = await Promise.resolve().then(() => Ot), i = await Ft(), r = await Ut(), o = new it().usePlugin(s.ModelDataPlugin.create({
4477
+ let Me = null;
4478
+ async function $t(f, e, t = !1, n) {
4479
+ const s = await Promise.resolve().then(() => Yt), i = await kt(), r = await Xt(), o = new dt().usePlugin(s.ModelDataPlugin.create({
4401
4480
  detailsPoint: !1,
4402
4481
  whiteModel: !0
4403
4482
  })).usePlugin(i.RenderPlugin.create({
@@ -4407,13 +4486,13 @@ async function Yt(d, e, t = !1, n) {
4407
4486
  orbitControls: t,
4408
4487
  camera: e
4409
4488
  })).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
4410
- return a && d.appendChild(a.domElement), de = o, {
4489
+ return a && f.appendChild(a.domElement), Me = o, {
4411
4490
  dxfSystem: o,
4412
- getFileAll: () => Gt(o)
4491
+ getFileAll: () => Vt(o)
4413
4492
  };
4414
4493
  }
4415
- async function Gt(d = de) {
4416
- const e = d.findComponentByName("WhiteModel"), t = new File([await d.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([d.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([d.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await e.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await e.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await e.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(d.Dxf.originalData)], "json.json", { type: "application/json" });
4494
+ async function Vt(f = Me) {
4495
+ const e = f.findComponentByName("WhiteModel"), t = new File([await f.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([f.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([f.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await e.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await e.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await e.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(f.Dxf.originalData)], "json.json", { type: "application/json" });
4417
4496
  return {
4418
4497
  dxf: n,
4419
4498
  obj: i,
@@ -4424,27 +4503,27 @@ async function Gt(d = de) {
4424
4503
  correctionDxf: s
4425
4504
  };
4426
4505
  }
4427
- function Xt() {
4428
- return de;
4506
+ function Zt() {
4507
+ return Me;
4429
4508
  }
4430
4509
  export {
4431
- _ as B,
4432
- J as C,
4433
- it as D,
4434
- Ee as E,
4435
- B as L,
4436
- Bt as M,
4437
- w as P,
4438
- X as Q,
4439
- st as T,
4440
- Te as V,
4441
- be as W,
4442
- Ie as a,
4443
- he as b,
4444
- V as c,
4445
- Yt as d,
4446
- Xt as e,
4447
- Gt as g,
4448
- Ct as i,
4449
- le as u
4510
+ j as B,
4511
+ ne as C,
4512
+ dt as D,
4513
+ Ne as E,
4514
+ N as L,
4515
+ jt as M,
4516
+ g as P,
4517
+ Z as Q,
4518
+ ut as T,
4519
+ Ce as V,
4520
+ Oe as W,
4521
+ Fe as a,
4522
+ ge as b,
4523
+ $ as c,
4524
+ $t as d,
4525
+ Zt as e,
4526
+ Vt as g,
4527
+ qt as i,
4528
+ me as u
4450
4529
  };