build-dxf 0.0.40 → 0.0.41

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,7 +1,7 @@
1
1
  import * as I from "three";
2
- import { EventDispatcher as Ot, Color as Ft, Matrix4 as bt, Vector3 as $, Quaternion as Gt, BufferAttribute as _, REVISION as Ut, CompressedTexture as nt, Source as zt, NoColorSpace as jt, MathUtils as ot, RGBAFormat as _t, ImageUtils as qt, DoubleSide as Yt, PropertyBinding as K, InterpolateDiscrete as kt, Scene as ft, SRGBColorSpace as Vt, NearestFilter as Xt, NearestMipmapNearestFilter as Wt, NearestMipmapLinearFilter as Ht, LinearFilter as Jt, LinearMipmapNearestFilter as $t, LinearMipmapLinearFilter as Kt, ClampToEdgeWrapping as Zt, RepeatWrapping as Qt, MirroredRepeatWrapping as te, InterpolateLinear as ee } from "three";
2
+ import { EventDispatcher as Ot, Color as Ft, Matrix4 as bt, Vector3 as K, Quaternion as Gt, BufferAttribute as _, REVISION as Ut, CompressedTexture as nt, Source as zt, NoColorSpace as jt, MathUtils as ot, RGBAFormat as _t, ImageUtils as qt, DoubleSide as Yt, PropertyBinding as Z, InterpolateDiscrete as kt, Scene as ft, SRGBColorSpace as Vt, NearestFilter as Xt, NearestMipmapNearestFilter as Wt, NearestMipmapLinearFilter as Ht, LinearFilter as Jt, LinearMipmapNearestFilter as $t, LinearMipmapLinearFilter as Kt, ClampToEdgeWrapping as Zt, RepeatWrapping as Qt, MirroredRepeatWrapping as te, InterpolateLinear as ee } from "three";
3
3
  import pt from "clipper-lib";
4
- import J from "dxf-writer";
4
+ import $ from "dxf-writer";
5
5
  import { OBJExporter as ne } from "three/examples/jsm/exporters/OBJExporter.js";
6
6
  function at() {
7
7
  return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(d) {
@@ -203,8 +203,8 @@ class N {
203
203
  for (let c = 0; c < 4; c++) {
204
204
  const l = o[c], h = o[(c + 1) % 4];
205
205
  for (let u = 0; u < 4; u++) {
206
- const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x), m = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), E = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
207
- if (y * x < 0 && m * E < 0 || y === 0 && Math.min(l.x, h.x) <= f.x && f.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= f.y && f.y <= Math.max(l.y, h.y) || x === 0 && Math.min(l.x, h.x) <= p.x && p.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= p.y && p.y <= Math.max(l.y, h.y) || m === 0 && Math.min(f.x, p.x) <= l.x && l.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= l.y && l.y <= Math.max(f.y, p.y) || E === 0 && Math.min(f.x, p.x) <= h.x && h.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= h.y && h.y <= Math.max(f.y, p.y))
206
+ const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x), m = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), L = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
207
+ if (y * x < 0 && m * L < 0 || y === 0 && Math.min(l.x, h.x) <= f.x && f.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= f.y && f.y <= Math.max(l.y, h.y) || x === 0 && Math.min(l.x, h.x) <= p.x && p.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= p.y && p.y <= Math.max(l.y, h.y) || m === 0 && Math.min(f.x, p.x) <= l.x && l.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= l.y && l.y <= Math.max(f.y, p.y) || L === 0 && Math.min(f.x, p.x) <= h.x && h.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= h.y && h.y <= Math.max(f.y, p.y))
208
208
  return !0;
209
209
  }
210
210
  }
@@ -778,7 +778,7 @@ class A {
778
778
  if (r.x === 0 && r.y === 0)
779
779
  throw new Error("投影目标线段的两个点不能重合");
780
780
  const o = (p) => {
781
- const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, E = (y.x * r.x + y.y * r.y) / x, w = s.x + E * r.x, g = s.y + E * r.y;
781
+ const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, L = (y.x * r.x + y.y * r.y) / x, w = s.x + L * r.x, g = s.y + L * r.y;
782
782
  return new M(w, g);
783
783
  };
784
784
  let a = o(e), c = o(n);
@@ -1501,7 +1501,7 @@ class F {
1501
1501
  })), t;
1502
1502
  }
1503
1503
  }
1504
- function Z(d, t = 0, e) {
1504
+ function J(d, t = 0, e) {
1505
1505
  return e || (e = new F(N.fromByLineSegment(...d)), d.forEach((n) => e?.insert({ line: n, userData: void 0 }))), d.map((n) => {
1506
1506
  const s = n.userData, i = s.drawWindow, r = e.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index: d.indexOf(o.line) }));
1507
1507
  return {
@@ -1608,8 +1608,8 @@ function oe(d, t, e, n = 15) {
1608
1608
  for (; y < -Math.PI; ) y += 2 * Math.PI;
1609
1609
  for (; x > Math.PI; ) x -= 2 * Math.PI;
1610
1610
  for (; x < -Math.PI; ) x += 2 * Math.PI;
1611
- const m = Math.abs(y) < Math.abs(x) ? y : x, E = u.center;
1612
- return u.start.rotate(E, m), u.end.rotate(E, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
1611
+ const m = Math.abs(y) < Math.abs(x) ? y : x, L = u.center;
1612
+ return u.start.rotate(L, m), u.end.rotate(L, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
1613
1613
  }
1614
1614
  function l(u, f, p = !1) {
1615
1615
  if (p) return l(u === "parallel" ? "vertical" : "parallel", f);
@@ -1626,13 +1626,13 @@ function oe(d, t, e, n = 15) {
1626
1626
  y && y.size > 1 ? h.push(() => {
1627
1627
  const x = [...y.values()].map(
1628
1628
  (w) => w.map((g) => s.includes(g.line) ? "parallel" : i.includes(g.line) ? "vertical" : null).filter((g) => !!g)
1629
- ).map((w) => [...new Set(w)]), m = x[0], E = x[1];
1630
- if (m.length === 1 && E.length === 1) {
1631
- if (m[0] === E[0]) return l(m[0], f, !0);
1629
+ ).map((w) => [...new Set(w)]), m = x[0], L = x[1];
1630
+ if (m.length === 1 && L.length === 1) {
1631
+ if (m[0] === L[0]) return l(m[0], f, !0);
1632
1632
  if (m.length === 1) {
1633
- if (E.includes(m[0])) return l(m[0], f, !0);
1634
- if (E.length === 1 && m.includes(E[0]))
1635
- return l(E[0], f, !0);
1633
+ if (L.includes(m[0])) return l(m[0], f, !0);
1634
+ if (L.length === 1 && m.includes(L[0]))
1635
+ return l(L[0], f, !0);
1636
1636
  }
1637
1637
  }
1638
1638
  c(f);
@@ -1685,11 +1685,11 @@ function xt(d, t, e, n) {
1685
1685
  }), o.sort((u, f) => f.distance(e.start) - u.distance(e.start));
1686
1686
  const a = o.map((u) => {
1687
1687
  const f = u.userData, p = i.get(f), y = r.get(f), x = new A(p, y), m = [];
1688
- for (let E = 0; E < o.length; E++) {
1689
- const w = o[E];
1688
+ for (let L = 0; L < o.length; L++) {
1689
+ const w = o[L];
1690
1690
  if (u !== w && u.distance(w) < n) {
1691
1691
  const g = w.userData, S = i.get(g), D = r.get(g);
1692
- (x.isPointOnSegment(S) || x.isPointOnSegment(D)) && m.push(E);
1692
+ (x.isPointOnSegment(S) || x.isPointOnSegment(D)) && m.push(L);
1693
1693
  }
1694
1694
  }
1695
1695
  return m;
@@ -1715,14 +1715,14 @@ function xt(d, t, e, n) {
1715
1715
  y.sort((w, g) => g.distance(e.start) - w.distance(e.start));
1716
1716
  const x = y[0], m = y[y.length - 1];
1717
1717
  if (x.distance(m) > n) {
1718
- const w = [...p].sort((C, U) => U.length() - C.length()), g = w[0], S = w[1], D = s.get(g), L = s.get(S), b = g.length(), R = S.length(), P = g.projectLineSegment(S), B = P.length();
1719
- if (D.distance(L) || R / b > 0.5 && B / R < 0.5) {
1718
+ const w = [...p].sort((C, U) => U.length() - C.length()), g = w[0], S = w[1], D = s.get(g), E = s.get(S), b = g.length(), R = S.length(), P = g.projectLineSegment(S), B = P.length();
1719
+ if (D.distance(E) || R / b > 0.5 && B / R < 0.5) {
1720
1720
  const C = [g], U = [S];
1721
1721
  for (let O = 0; O < y.length; O++) {
1722
1722
  const v = y[O], V = v.userData;
1723
- if (v === D || v === L) continue;
1723
+ if (v === D || v === E) continue;
1724
1724
  const z = S.projectLineSegment(V), W = z.length();
1725
- L.distance(v) <= n && W / R > 0 ? U.push(V) : C.push(V);
1725
+ E.distance(v) <= n && W / R > 0 ? U.push(V) : C.push(V);
1726
1726
  }
1727
1727
  h.push(C, U);
1728
1728
  } else {
@@ -1946,7 +1946,23 @@ function xe(d) {
1946
1946
  n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
1947
1947
  }), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
1948
1948
  }
1949
- const ge = {
1949
+ function ge(d) {
1950
+ let t = [], e = -1;
1951
+ const n = [];
1952
+ return d.forEach(({ start: i, end: r, ...o }, a) => {
1953
+ n.push(i.z ?? 0, r.z ?? 0);
1954
+ const c = new A(
1955
+ M.from(i),
1956
+ M.from(r)
1957
+ );
1958
+ c.userData = o, t.push(c), o.isVerticalReferenceLine && (e = a);
1959
+ }), {
1960
+ originalZAverage: n.reduce((i, r) => i + r, 0) / n.length,
1961
+ lineSegments: t,
1962
+ verticalReferenceIndex: e
1963
+ };
1964
+ }
1965
+ const me = {
1950
1966
  Unitless: 1,
1951
1967
  // 无单位,1米 = 1(无单位)
1952
1968
  Inches: 39.37007874015748,
@@ -2015,6 +2031,7 @@ class k extends q {
2015
2031
  wallsGroup = [];
2016
2032
  doors = [];
2017
2033
  doorLineSegment = [];
2034
+ verticalReferenceLine;
2018
2035
  lineSegments = [];
2019
2036
  originalZAverage = 0;
2020
2037
  static EndType = {
@@ -2045,31 +2062,23 @@ class k extends q {
2045
2062
  * 预处理数据
2046
2063
  * @param data
2047
2064
  */
2048
- preprocessing(t, e = !1, n) {
2049
- let s = [], i = -1;
2050
- const r = [];
2051
- if (t.forEach(({ start: a, end: c, ...l }, h) => {
2052
- r.push(a.z ?? 0, c.z ?? 0);
2053
- const u = new A(
2054
- M.from(a),
2055
- M.from(c)
2056
- );
2057
- u.userData = l, s.push(u), l.isVerticalReferenceLine && (i = h);
2058
- }), this.originalZAverage = r.reduce((a, c) => a + c, 0) / r.length, i === -1) {
2059
- const a = xe(s);
2060
- i = s.indexOf(a);
2065
+ preprocessing(t) {
2066
+ let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = ge(t);
2067
+ if (this.originalZAverage = s, n === -1) {
2068
+ const r = xe(e);
2069
+ n = e.indexOf(r);
2061
2070
  }
2062
- const o = s[i];
2063
- return o.userData.isVerticalReferenceLine = !0, t[i].isVerticalReferenceLine = !0, e && (s = Pt.correction.call(this, s, o, n), t = Z(s)), this.dispatchEvent({
2071
+ const i = e[n];
2072
+ return i.userData.isVerticalReferenceLine = !0, t[n].isVerticalReferenceLine = !0, this.verticalReferenceLine = i, this.dispatchEvent({
2064
2073
  type: "preprocessing",
2065
2074
  data: t,
2066
- setData(a) {
2067
- s = a.map(({ start: c, end: l, ...h }) => {
2068
- const u = new A(M.from(c), M.from(l));
2069
- return u.userData = h, u;
2070
- }), t = a;
2075
+ setData(r) {
2076
+ e = r.map(({ start: o, end: a, ...c }) => {
2077
+ const l = new A(M.from(o), M.from(a));
2078
+ return l.userData = c, l;
2079
+ }), t = r;
2071
2080
  }
2072
- }), { lineSegments: s, data: t };
2081
+ }), { lineSegments: e, data: t };
2073
2082
  }
2074
2083
  /** 设置
2075
2084
  * @param data 房屋结构数据,node环境可以为路径
@@ -2079,34 +2088,34 @@ class k extends q {
2079
2088
  * @param option
2080
2089
  * @returns
2081
2090
  */
2082
- async set(t, e = this.width, n = this.scale, s = !1, i) {
2091
+ async set(t, e = this.width, n = this.scale) {
2083
2092
  if (typeof t == "string")
2084
2093
  if (typeof global < "u") {
2085
- const { default: a } = await import(
2094
+ const { default: r } = await import(
2086
2095
  /* @vite-ignore */
2087
2096
  "fs"
2088
- ), c = a.readFileSync(t), l = JSON.parse(c.toString("utf-8"));
2089
- return this.set(l, e, n, s);
2097
+ ), o = r.readFileSync(t), a = JSON.parse(o.toString("utf-8"));
2098
+ return this.set(a, e, n);
2090
2099
  } else
2091
2100
  throw new Error("非node环境不允许使用路径");
2092
2101
  if (this.scale = n, this.width = e, t.length === 0)
2093
2102
  this.lineSegments = [], this.originalData = t;
2094
2103
  else {
2095
- const o = this.preprocessing(t, s, i);
2096
- t = o.data, this.lineSegments = o.lineSegments, this.originalData = t;
2104
+ const i = this.preprocessing(t);
2105
+ t = i.data, this.lineSegments = i.lineSegments, this.originalData = t;
2097
2106
  }
2098
- const r = [];
2099
- this.data = t.map(({ start: o, end: a, insetionArr: c, isDoor: l = !1 }, h) => {
2100
- r.push(o.z ?? 0, a.z ?? 0);
2101
- const u = this.lineSegments[h];
2107
+ const s = [];
2108
+ this.data = t.map(({ start: i, end: r, insetionArr: o, isDoor: a = !1 }, c) => {
2109
+ s.push(i.z ?? 0, r.z ?? 0);
2110
+ const l = this.lineSegments[c];
2102
2111
  return [
2103
- u.points[0],
2104
- u.points[1],
2105
- (c ?? []).map((f) => f.index),
2106
- l,
2107
- h
2112
+ l.points[0],
2113
+ l.points[1],
2114
+ (o ?? []).map((h) => h.index),
2115
+ a,
2116
+ c
2108
2117
  ];
2109
- }), this.originalZAverage = r.reduce((o, a) => o + a, 0) / r.length, this.computedOriginalSize(t, this.originalBox), this.dispatchEvent({
2118
+ }), this.originalZAverage = s.reduce((i, r) => i + r, 0) / s.length, this.computedOriginalSize(t, this.originalBox), this.dispatchEvent({
2110
2119
  type: "setDta",
2111
2120
  originalData: this.originalData,
2112
2121
  data: this.data
@@ -2288,6 +2297,27 @@ class k extends q {
2288
2297
  wallsGroup: this.wallsGroup
2289
2298
  }), this.wallsGroup;
2290
2299
  }
2300
+ /** 垂直纠正
2301
+ * @param option
2302
+ */
2303
+ axisAlignCorr(t) {
2304
+ if (this.verticalReferenceLine) {
2305
+ this.doorLineSegment;
2306
+ const e = Pt.correction(this.getLineSegments(), this.verticalReferenceLine, t), n = J(e);
2307
+ this.set(n);
2308
+ } else
2309
+ throw new Error("未找到一条垂直纠正基准轴线");
2310
+ }
2311
+ /** 完整线段数据
2312
+ * @returns
2313
+ */
2314
+ getLineSegments(t = !1) {
2315
+ let e = this.lineSegments.filter((s) => !s.userData.isDoor), n = [...this.doorLineSegment];
2316
+ return t && (e = e.map((s) => s.clone()), n = n.map((s) => s.clone())), n.forEach((s) => Object.assign(s.userData, {
2317
+ isDoor: !0,
2318
+ doorDirectConnection: !0
2319
+ })), e.push(...n), e;
2320
+ }
2291
2321
  /**
2292
2322
  * 将点云结构转换为Float32Array
2293
2323
  */
@@ -2317,13 +2347,13 @@ class k extends q {
2317
2347
  * 线段数据转为原始json数据
2318
2348
  */
2319
2349
  lineDataToOriginalData(t, e) {
2320
- return Z(t, this.originalZAverage, e);
2350
+ return J(t, this.originalZAverage, e);
2321
2351
  }
2322
2352
  /**
2323
2353
  * 转为绘制数据
2324
2354
  */
2325
2355
  toDrawDataJson(t = "Millimeters") {
2326
- const e = ge[t], n = {
2356
+ const e = me[t], n = {
2327
2357
  unit: t,
2328
2358
  line: [],
2329
2359
  arc: [],
@@ -2381,15 +2411,15 @@ class k extends q {
2381
2411
  break;
2382
2412
  }
2383
2413
  u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((g, S) => i(g, S));
2384
- const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [E, w] = this.getArcAngleRange(m, l.end, u.end);
2385
- r(m, x, Math.min(E, w), Math.max(E, w)), a.push(f);
2414
+ const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [L, w] = this.getArcAngleRange(m, l.end, u.end);
2415
+ r(m, x, Math.min(L, w), Math.max(L, w)), a.push(f);
2386
2416
  } else
2387
2417
  l.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), o * 0.5).directionMove(l.direction(), o * 0.5).expansion(-l.length() * 0.45, "end").forward(o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), -o * 0.5).directionMove(l.direction(), -o * 0.5).expansion(-l.length() * 0.45, "start").forward(-o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u));
2388
2418
  }), s = "yellow", this.lineSegments.forEach((c) => {
2389
2419
  if (!c.userData.isWindow) return !1;
2390
2420
  Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
2391
2421
  const { p: h, width: u } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(u * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-u * 0.5)), x = new A(p, y);
2392
- i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, E) => i(m, E));
2422
+ i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, L) => i(m, L));
2393
2423
  });
2394
2424
  }), n;
2395
2425
  }
@@ -2432,8 +2462,8 @@ class k extends q {
2432
2462
  * 将点json结构转换为Dxf string
2433
2463
  */
2434
2464
  toDxfString(t = "Millimeters") {
2435
- const e = new J();
2436
- e.setUnits(t), e.addLayer("cyan", J.ACI.CYAN, "DOTTED"), e.addLayer("yellow", J.ACI.YELLOW, "DOTTED"), e.addLayer("white", J.ACI.WHITE, "DOTTED");
2465
+ const e = new $();
2466
+ e.setUnits(t), e.addLayer("cyan", $.ACI.CYAN, "DOTTED"), e.addLayer("yellow", $.ACI.YELLOW, "DOTTED"), e.addLayer("white", $.ACI.WHITE, "DOTTED");
2437
2467
  const n = this.toDrawDataJson();
2438
2468
  return n.line.forEach((s) => {
2439
2469
  let [i, r, o, a, c] = s;
@@ -2455,7 +2485,7 @@ class k extends q {
2455
2485
  * @param filename
2456
2486
  */
2457
2487
  async downloadOriginalData(t) {
2458
- const e = JSON.stringify(this.originalData, null, 2);
2488
+ const e = JSON.stringify(J(this.getLineSegments()), null, 2);
2459
2489
  if (typeof window < "u") {
2460
2490
  const n = new Blob([e], { type: "application/json" }), s = document.createElement("a");
2461
2491
  s.href = URL.createObjectURL(n), s.download = t, s.click();
@@ -2527,7 +2557,7 @@ function ct(d) {
2527
2557
  return t;
2528
2558
  }
2529
2559
  const j = new A();
2530
- class me extends k {
2560
+ class we extends k {
2531
2561
  static name = "AngleCorrectionDxf";
2532
2562
  angle = 0;
2533
2563
  onAddFromParent(t) {
@@ -2599,7 +2629,7 @@ class Rt extends q {
2599
2629
  if (t in this) return this[t];
2600
2630
  }
2601
2631
  }
2602
- class we {
2632
+ class Me {
2603
2633
  // 所有可查找的点位
2604
2634
  possibleDoorPoints = [];
2605
2635
  doorPoint = [];
@@ -2732,19 +2762,19 @@ class we {
2732
2762
  */
2733
2763
  searchNearby(t, e = [], n = this.doorSearchDistance, s = this.doorSearchNearAngle) {
2734
2764
  const i = this.findPointVirtualGrid, r = this.quadtree;
2735
- function o({ point: x, line: m }, E, w) {
2765
+ function o({ point: x, line: m }, L, w) {
2736
2766
  const g = m.direction();
2737
2767
  m.start === x && g.multiplyScalar(-1);
2738
- const S = i.queryCircle(x, n).filter((L) => L.userData !== m).sort((L, b) => L.point.distance(x) - b.point.distance(x)), D = [];
2739
- for (let L = 0; L < S.length; L++) {
2740
- const b = e.findIndex((O) => O.point === S[L].point), R = t[E].uuid, P = e[b].uuid;
2768
+ const S = i.queryCircle(x, n).filter((E) => E.userData !== m).sort((E, b) => E.point.distance(x) - b.point.distance(x)), D = [];
2769
+ for (let E = 0; E < S.length; E++) {
2770
+ const b = e.findIndex((O) => O.point === S[E].point), R = t[L].uuid, P = e[b].uuid;
2741
2771
  if (w.has(`${R}.${P}`)) continue;
2742
2772
  w.add(`${R}.${P}`), w.add(`${P}.${R}`);
2743
- const B = S[L].point, C = new A(x.clone(), B.clone());
2773
+ const B = S[E].point, C = new A(x.clone(), B.clone());
2744
2774
  if (C.direction().angleBetween(g, "angle") < s) {
2745
- const O = t[E].line.direction(), v = S[L].userData;
2746
- v.start.equal(S[L].point) && O.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(O, "angle") < s && (r.queryLineSegment(C).filter((W) => !(W.line.start.equal(x) || W.line.end.equal(x) || W.line === v)).length || D.push({
2747
- findData: S[L],
2775
+ const O = t[L].line.direction(), v = S[E].userData;
2776
+ v.start.equal(S[E].point) && O.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(O, "angle") < s && (r.queryLineSegment(C).filter((W) => !(W.line.start.equal(x) || W.line.end.equal(x) || W.line === v)).length || D.push({
2777
+ findData: S[E],
2748
2778
  findUuid: P,
2749
2779
  doorLine: C,
2750
2780
  doorUuid: R
@@ -2753,35 +2783,35 @@ class we {
2753
2783
  }
2754
2784
  return D;
2755
2785
  }
2756
- function a(x, m, E, w, g) {
2786
+ function a(x, m, L, w, g) {
2757
2787
  w.add(x);
2758
2788
  const S = [];
2759
2789
  g && S.push(g);
2760
- for (let D = 0; D < E.length; D++) {
2761
- const L = E[D];
2762
- if (m.has(L.findUuid)) {
2763
- const b = m.get(L.findUuid);
2764
- a(L.findUuid, m, b, w, L) && S.push(L);
2765
- } else S.push(L);
2790
+ for (let D = 0; D < L.length; D++) {
2791
+ const E = L[D];
2792
+ if (m.has(E.findUuid)) {
2793
+ const b = m.get(E.findUuid);
2794
+ a(E.findUuid, m, b, w, E) && S.push(E);
2795
+ } else S.push(E);
2766
2796
  }
2767
- return S.sort((D, L) => D.doorLine.length() - L.doorLine.length()), g && S[0] === g ? (E.splice(0), !0) : (E.splice(1), !1);
2797
+ return S.sort((D, E) => D.doorLine.length() - E.doorLine.length()), g && S[0] === g ? (L.splice(0), !0) : (L.splice(1), !1);
2768
2798
  }
2769
2799
  const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
2770
2800
  t.map((x, m) => {
2771
- const E = o(x, m, c);
2772
- E.length && l.set(x.uuid, E);
2801
+ const L = o(x, m, c);
2802
+ L.length && l.set(x.uuid, L);
2773
2803
  }), c.clear();
2774
2804
  const h = /* @__PURE__ */ new Map();
2775
2805
  l.forEach((x, m) => {
2776
2806
  if (!c.has(m) && x.length && a(m, l, x, c), x.length) {
2777
- const E = x[0];
2778
- h.has(E.doorUuid) || h.set(E.doorUuid, []), h.get(E.doorUuid)?.push(E), h.has(E.findUuid) || h.set(E.findUuid, []), h.get(E.findUuid)?.push(E);
2807
+ const L = x[0];
2808
+ h.has(L.doorUuid) || h.set(L.doorUuid, []), h.get(L.doorUuid)?.push(L), h.has(L.findUuid) || h.set(L.findUuid, []), h.get(L.findUuid)?.push(L);
2779
2809
  }
2780
2810
  });
2781
2811
  const u = /* @__PURE__ */ new Set();
2782
2812
  h.forEach((x) => {
2783
2813
  if (x.length > 1) {
2784
- x.sort((m, E) => m.doorLine.length() - E.doorLine.length());
2814
+ x.sort((m, L) => m.doorLine.length() - L.doorLine.length());
2785
2815
  for (let m = 1; m < x.length; m++) u.add(x[m]);
2786
2816
  }
2787
2817
  });
@@ -2794,9 +2824,9 @@ class we {
2794
2824
  });
2795
2825
  const y = [];
2796
2826
  return f.forEach((x) => {
2797
- const m = t.findIndex((b) => b.uuid === x.doorUuid), E = e.findIndex((b) => b.uuid === x.findUuid), w = t[m].point.clone(), g = e[E].point.clone(), S = this.findLongLineSegment(t[m].line), D = this.findLongLineSegment(e[E].line), L = S.projectPoint(g);
2798
- if (L) {
2799
- w.copy(L);
2827
+ const m = t.findIndex((b) => b.uuid === x.doorUuid), L = e.findIndex((b) => b.uuid === x.findUuid), w = t[m].point.clone(), g = e[L].point.clone(), S = this.findLongLineSegment(t[m].line), D = this.findLongLineSegment(e[L].line), E = S.projectPoint(g);
2828
+ if (E) {
2829
+ w.copy(E);
2800
2830
  const b = new A(w, g), R = D.includedAngle(b);
2801
2831
  (R < 10 || R > 170 || Math.abs(90 - R) < 10) && y.push({
2802
2832
  start: w,
@@ -2890,7 +2920,7 @@ class we {
2890
2920
  return e;
2891
2921
  }
2892
2922
  }
2893
- class Me extends q {
2923
+ class Se extends q {
2894
2924
  static name = "LineAnalysis";
2895
2925
  Dxf = null;
2896
2926
  Variable = null;
@@ -2946,12 +2976,12 @@ class Me extends q {
2946
2976
  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]);
2947
2977
  const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / e.width), a = i / o, c = r / o, l = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]), u = n.points[0].clone(), f = n.points[1].clone(), p = f.direction(u);
2948
2978
  p.multiplyScalar(e.width * 0.5);
2949
- const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), E = y.direction(x);
2950
- if (!(m.x > 0 && E.x < 0 || m.x < 0 && E.x > 0 || m.y > 0 && E.y < 0 || m.y < 0 && E.y > 0)) {
2979
+ const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), L = y.direction(x);
2980
+ if (!(m.x > 0 && L.x < 0 || m.x < 0 && L.x > 0 || m.y > 0 && L.y < 0 || m.y < 0 && L.y > 0)) {
2951
2981
  u.set(y.x, y.y), f.set(x.x, x.y);
2952
2982
  for (let w = 1; w < o; w++) {
2953
- const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), D = u.clone().add(g), L = f.clone().add(S);
2954
- this.addData(D, L);
2983
+ const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), D = u.clone().add(g), E = f.clone().add(S);
2984
+ this.addData(D, E);
2955
2985
  }
2956
2986
  }
2957
2987
  }
@@ -3022,12 +3052,12 @@ class Me extends q {
3022
3052
  doors = [];
3023
3053
  DoorsAnalysis;
3024
3054
  doorsAnalysis() {
3025
- this.DoorsAnalysis = new we(this), this.dispatchEvent({
3055
+ this.DoorsAnalysis = new Me(this), this.dispatchEvent({
3026
3056
  type: "analysisCompleted"
3027
3057
  });
3028
3058
  }
3029
3059
  }
3030
- class Se extends q {
3060
+ class Le extends q {
3031
3061
  static name = "ThreeVJia";
3032
3062
  lineSegments = [];
3033
3063
  onAddFromParent() {
@@ -3162,7 +3192,7 @@ class ht extends se {
3162
3192
  * @param scale 原始数据缩放比例
3163
3193
  */
3164
3194
  constructor(t = 0.1, e = 1) {
3165
- super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new me(), this.Variable = new Rt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Me()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Se()), ht.finalInstance = this;
3195
+ super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new we(), this.Variable = new Rt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Se()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Le()), ht.finalInstance = this;
3166
3196
  }
3167
3197
  usePlugin(t) {
3168
3198
  return typeof t == "function" && t.call(this, this), this;
@@ -3205,8 +3235,8 @@ class ut {
3205
3235
  return g.queryLineSegment(w).filter((S) => S.line !== w).map(({ line: S }) => {
3206
3236
  const D = { resultLine: S, type: "intersect", direction: "vertical", point: null, newLine: null };
3207
3237
  w.sameEndpoint(S) && (D.type = "endpoint"), w.parallel(S) && (D.direction = "parallel");
3208
- const L = w.getSameEndpoint(S);
3209
- if (L) D.point = L[1];
3238
+ const E = w.getSameEndpoint(S);
3239
+ if (E) D.point = E[1];
3210
3240
  else {
3211
3241
  const b = S.getIntersection(w);
3212
3242
  b && (D.point = S.start.equal(b) ? S.start : S.end);
@@ -3224,17 +3254,17 @@ class ut {
3224
3254
  w.directionMove(S, n * 0.5);
3225
3255
  }
3226
3256
  }
3227
- function r({ resultLine: w, type: g, direction: S, point: D }, L, b, R) {
3257
+ function r({ resultLine: w, type: g, direction: S, point: D }, E, b, R) {
3228
3258
  if (g === "intersect")
3229
- D && D.copy(L.projectPoint(D) ?? D);
3259
+ D && D.copy(E.projectPoint(D) ?? D);
3230
3260
  else if (S === "vertical") {
3231
3261
  if (D) {
3232
- const P = L.projectPoint(D, !1);
3233
- D.copy(P), L.isPointOnSegment(P) || (L.start.distance(P) < L.end.distance(P) ? R.push(new A(P.clone(), L.start.clone())) : R.push(new A(P.clone(), L.end.clone())));
3262
+ const P = E.projectPoint(D, !1);
3263
+ D.copy(P), E.isPointOnSegment(P) || (E.start.distance(P) < E.end.distance(P) ? R.push(new A(P.clone(), E.start.clone())) : R.push(new A(P.clone(), E.end.clone())));
3234
3264
  }
3235
3265
  } else if (!u.includes(w) && D) {
3236
- let P = L.projectPoint(D, !1), B;
3237
- if (L.start.distance(D) < L.end.distance(D) ? B = L.start : B = L.end, P) {
3266
+ let P = E.projectPoint(D, !1), B;
3267
+ if (E.start.distance(D) < E.end.distance(D) ? B = E.start : B = E.end, P) {
3238
3268
  R.push(new A(D.clone(), P.clone()));
3239
3269
  const C = new A(P.clone(), B.clone());
3240
3270
  C.length() && R.push(C);
@@ -3254,33 +3284,33 @@ class ut {
3254
3284
  o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(u, 0, { color: 65280 }).position.z = l + 1e-3;
3255
3285
  const y = A.groupBySamePointAndParallel(u), x = new F(N.fromByLineSegment(...c));
3256
3286
  c.forEach((w) => w.userData.isDoor || x.insert(w));
3257
- const m = y.map((w) => w.flatMap((g) => s(g, x))), E = [];
3287
+ const m = y.map((w) => w.flatMap((g) => s(g, x))), L = [];
3258
3288
  return y.flatMap((w, g) => (w.forEach((D) => (i(D), x.update(D))), m[g].filter((D) => {
3259
3289
  if (!u.includes(D.resultLine)) {
3260
- let L;
3290
+ let E;
3261
3291
  return Object.defineProperty(D, "newLine", {
3262
3292
  get() {
3263
- return L || (L = A.mergeLines(...w)), L;
3293
+ return E || (E = A.mergeLines(...w)), E;
3264
3294
  }
3265
3295
  }), !0;
3266
3296
  }
3267
- r(D, A.mergeLines(...w), x, E);
3297
+ r(D, A.mergeLines(...w), x, L);
3268
3298
  }))).reduce((w, g) => (w.has(g.resultLine) || w.set(g.resultLine, []), w.get(g.resultLine)?.push(g), w), /* @__PURE__ */ new Map()).forEach((w) => {
3269
3299
  w.reduce((g, S) => (g.has(S.point) || g.set(S.point, []), g.get(S.point)?.push(S), g), /* @__PURE__ */ new Map()).forEach((g) => {
3270
3300
  const S = /* @__PURE__ */ new Set();
3271
3301
  for (let D = 0; D < g.length; D++) {
3272
- const L = g[D];
3273
- S.has(L.point) || (r(L, L.newLine, x, E), S.add(L.point));
3302
+ const E = g[D];
3303
+ S.has(E.point) || (r(E, E.newLine, x, L), S.add(E.point));
3274
3304
  }
3275
3305
  });
3276
- }), c.push(...A.deduplication(E)), c.forEach((w) => w.userData.isWindow && Q(w)), c = lt(c), c = A.deduplication(c), Z(c, l);
3306
+ }), c.push(...A.deduplication(L)), c.forEach((w) => w.userData.isWindow && Q(w)), c = lt(c), c = A.deduplication(c), J(c, l);
3277
3307
  }
3278
3308
  }
3279
- const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3309
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3280
3310
  __proto__: null,
3281
3311
  AxisAlignCorr: Pt,
3282
3312
  BoundExt: ut,
3283
- lineDataToOriginalData: Z,
3313
+ lineDataToOriginalData: J,
3284
3314
  lineSegmentClipping: lt,
3285
3315
  recomputedWindow: Q
3286
3316
  }, Symbol.toStringTag, { value: "Module" })), St = {
@@ -3314,11 +3344,9 @@ const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3314
3344
  class tt {
3315
3345
  constructor() {
3316
3346
  this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
3317
- return new Ne(t);
3318
- }), this.register(function(t) {
3319
3347
  return new Ce(t);
3320
3348
  }), this.register(function(t) {
3321
- return new Ge(t);
3349
+ return new Be(t);
3322
3350
  }), this.register(function(t) {
3323
3351
  return new Ue(t);
3324
3352
  }), this.register(function(t) {
@@ -3326,13 +3354,13 @@ class tt {
3326
3354
  }), this.register(function(t) {
3327
3355
  return new je(t);
3328
3356
  }), this.register(function(t) {
3329
- return new Be(t);
3357
+ return new _e(t);
3330
3358
  }), this.register(function(t) {
3331
3359
  return new Oe(t);
3332
3360
  }), this.register(function(t) {
3333
3361
  return new Fe(t);
3334
3362
  }), this.register(function(t) {
3335
- return new _e(t);
3363
+ return new Ge(t);
3336
3364
  }), this.register(function(t) {
3337
3365
  return new qe(t);
3338
3366
  }), this.register(function(t) {
@@ -3341,6 +3369,8 @@ class tt {
3341
3369
  return new ke(t);
3342
3370
  }), this.register(function(t) {
3343
3371
  return new Ve(t);
3372
+ }), this.register(function(t) {
3373
+ return new Xe(t);
3344
3374
  });
3345
3375
  }
3346
3376
  register(t) {
@@ -3353,7 +3383,7 @@ class tt {
3353
3383
  return this.textureUtils = t, this;
3354
3384
  }
3355
3385
  parse(t, e, n, s) {
3356
- const i = new ve(), r = [];
3386
+ const i = new Ne(), r = [];
3357
3387
  for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
3358
3388
  r.push(this.pluginCallbacks[o](i));
3359
3389
  i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
@@ -3399,24 +3429,24 @@ G[Kt] = T.LINEAR_MIPMAP_LINEAR;
3399
3429
  G[Zt] = T.CLAMP_TO_EDGE;
3400
3430
  G[Qt] = T.REPEAT;
3401
3431
  G[te] = T.MIRRORED_REPEAT;
3402
- const Et = {
3432
+ const Lt = {
3403
3433
  scale: "scale",
3404
3434
  position: "translation",
3405
3435
  quaternion: "rotation",
3406
3436
  morphTargetInfluences: "weights"
3407
- }, Ee = new Ft(), Lt = 12, Le = 1179937895, De = 2, Dt = 8, Ae = 1313821514, Te = 5130562;
3437
+ }, Ee = new Ft(), Et = 12, De = 1179937895, Ae = 2, Dt = 8, Te = 1313821514, be = 5130562;
3408
3438
  function H(d, t) {
3409
3439
  return d.length === t.length && d.every(function(e, n) {
3410
3440
  return e === t[n];
3411
3441
  });
3412
3442
  }
3413
- function be(d) {
3443
+ function Ie(d) {
3414
3444
  return new TextEncoder().encode(d).buffer;
3415
3445
  }
3416
- function Ie(d) {
3446
+ function Pe(d) {
3417
3447
  return H(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3418
3448
  }
3419
- function Pe(d, t, e) {
3449
+ function Re(d, t, e) {
3420
3450
  const n = {
3421
3451
  min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
3422
3452
  max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
@@ -3445,7 +3475,7 @@ function it(d, t = 0) {
3445
3475
  function At() {
3446
3476
  return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
3447
3477
  }
3448
- function Re(d, t) {
3478
+ function ve(d, t) {
3449
3479
  if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
3450
3480
  let e;
3451
3481
  return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), d.convertToBlob({
@@ -3455,7 +3485,7 @@ function Re(d, t) {
3455
3485
  } else
3456
3486
  return new Promise((e) => d.toBlob(e, t));
3457
3487
  }
3458
- class ve {
3488
+ class Ne {
3459
3489
  constructor() {
3460
3490
  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 = {
3461
3491
  asset: {
@@ -3499,13 +3529,13 @@ class ve {
3499
3529
  const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
3500
3530
  l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ? rt(c).then(function(u) {
3501
3531
  const f = it(u), p = new DataView(new ArrayBuffer(Dt));
3502
- p.setUint32(0, f.byteLength, !0), p.setUint32(4, Te, !0);
3503
- const y = it(be(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Dt));
3504
- x.setUint32(0, y.byteLength, !0), x.setUint32(4, Ae, !0);
3505
- const m = new ArrayBuffer(Lt), E = new DataView(m);
3506
- E.setUint32(0, Le, !0), E.setUint32(4, De, !0);
3507
- const w = Lt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3508
- E.setUint32(8, w, !0);
3532
+ p.setUint32(0, f.byteLength, !0), p.setUint32(4, be, !0);
3533
+ const y = it(Ie(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Dt));
3534
+ x.setUint32(0, y.byteLength, !0), x.setUint32(4, Te, !0);
3535
+ const m = new ArrayBuffer(Et), L = new DataView(m);
3536
+ L.setUint32(0, De, !0), L.setUint32(4, Ae, !0);
3537
+ const w = Et + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3538
+ L.setUint32(8, w, !0);
3509
3539
  const g = new Blob([
3510
3540
  m,
3511
3541
  x,
@@ -3516,7 +3546,7 @@ class ve {
3516
3546
  rt(g).then((S) => {
3517
3547
  e(S);
3518
3548
  });
3519
- }) : r.buffers && r.buffers.length > 0 ? Xe(c).then((u) => {
3549
+ }) : r.buffers && r.buffers.length > 0 ? We(c).then((u) => {
3520
3550
  r.buffers[0].uri = u, e(r);
3521
3551
  }) : e(r);
3522
3552
  }
@@ -3564,7 +3594,7 @@ class ve {
3564
3594
  */
3565
3595
  isNormalizedNormalAttribute(t) {
3566
3596
  if (this.cache.attributesNormalized.has(t)) return !1;
3567
- const n = new $();
3597
+ const n = new K();
3568
3598
  for (let s = 0, i = t.count; s < i; s++)
3569
3599
  if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
3570
3600
  return !0;
@@ -3579,7 +3609,7 @@ class ve {
3579
3609
  createNormalizedNormalAttribute(t) {
3580
3610
  const e = this.cache;
3581
3611
  if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
3582
- const n = t.clone(), s = new $();
3612
+ const n = t.clone(), s = new K();
3583
3613
  for (let i = 0, r = n.count; i < r; i++)
3584
3614
  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);
3585
3615
  return e.attributesNormalized.set(t, n), n;
@@ -3742,7 +3772,7 @@ class ve {
3742
3772
  else
3743
3773
  throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
3744
3774
  if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
3745
- const a = Pe(t, n, s);
3775
+ const a = Re(t, n, s);
3746
3776
  let c;
3747
3777
  e !== void 0 && (c = t === e.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
3748
3778
  const l = this.processBufferView(t, o, n, s, c), h = {
@@ -3787,7 +3817,7 @@ class ve {
3787
3817
  else
3788
3818
  throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
3789
3819
  a.binary === !0 ? c.push(
3790
- Re(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3820
+ ve(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3791
3821
  u.bufferView = x;
3792
3822
  })
3793
3823
  ) : u.uri = qt.getDataURL(f, s);
@@ -3927,8 +3957,8 @@ class ve {
3927
3957
  continue;
3928
3958
  }
3929
3959
  p = null;
3930
- const L = S.array;
3931
- g === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(L), S.itemSize, S.normalized)) : (L instanceof Uint32Array || L instanceof Int32Array) && !g.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${g}" converted to type FLOAT.`), p = tt.Utils.toFloat32BufferAttribute(S));
3960
+ const E = S.array;
3961
+ g === "JOINTS_0" && !(E instanceof Uint16Array) && !(E instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(E), S.itemSize, S.normalized)) : (E instanceof Uint32Array || E instanceof Int32Array) && !g.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${g}" converted to type FLOAT.`), p = tt.Utils.toFloat32BufferAttribute(S));
3932
3962
  const b = this.processAccessor(p || S, r);
3933
3963
  b !== null && (g.startsWith("_") || this.detectMeshQuantization(g, S), c[g] = b, e.attributes.set(this.getUID(S), b));
3934
3964
  }
@@ -3936,9 +3966,9 @@ class ve {
3936
3966
  if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
3937
3967
  const g = [], S = [], D = {};
3938
3968
  if (t.morphTargetDictionary !== void 0)
3939
- for (const L in t.morphTargetDictionary)
3940
- D[t.morphTargetDictionary[L]] = L;
3941
- for (let L = 0; L < t.morphTargetInfluences.length; ++L) {
3969
+ for (const E in t.morphTargetDictionary)
3970
+ D[t.morphTargetDictionary[E]] = E;
3971
+ for (let E = 0; E < t.morphTargetInfluences.length; ++E) {
3942
3972
  const b = {};
3943
3973
  let R = !1;
3944
3974
  for (const P in r.morphAttributes) {
@@ -3946,7 +3976,7 @@ class ve {
3946
3976
  R || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), R = !0);
3947
3977
  continue;
3948
3978
  }
3949
- const B = r.morphAttributes[P][L], C = P.toUpperCase(), U = r.attributes[P];
3979
+ const B = r.morphAttributes[P][E], C = P.toUpperCase(), U = r.attributes[P];
3950
3980
  if (e.attributes.has(this.getUID(B, !0))) {
3951
3981
  b[C] = e.attributes.get(this.getUID(B, !0));
3952
3982
  continue;
@@ -3958,7 +3988,7 @@ class ve {
3958
3988
  z === 0 && O.setX(v, B.getX(v) - U.getX(v)), z === 1 && O.setY(v, B.getY(v) - U.getY(v)), z === 2 && O.setZ(v, B.getZ(v) - U.getZ(v)), z === 3 && O.setW(v, B.getW(v) - U.getW(v));
3959
3989
  b[C] = this.processAccessor(O, r), e.attributes.set(this.getUID(U, !0), b[C]);
3960
3990
  }
3961
- h.push(b), g.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(D[L]);
3991
+ h.push(b), g.push(t.morphTargetInfluences[E]), t.morphTargetDictionary !== void 0 && S.push(D[E]);
3962
3992
  }
3963
3993
  a.weights = g, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
3964
3994
  }
@@ -3971,18 +4001,18 @@ class ve {
3971
4001
  g[S] = S;
3972
4002
  r.setIndex(g), x = !0;
3973
4003
  }
3974
- const m = y ? t.material : [t.material], E = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
3975
- for (let g = 0, S = E.length; g < S; g++) {
4004
+ const m = y ? t.material : [t.material], L = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
4005
+ for (let g = 0, S = L.length; g < S; g++) {
3976
4006
  const D = {
3977
4007
  mode: o,
3978
4008
  attributes: c
3979
4009
  };
3980
4010
  if (this.serializeUserData(r, D), h.length > 0 && (D.targets = h), r.index !== null) {
3981
4011
  let b = this.getUID(r.index);
3982
- (E[g].start !== void 0 || E[g].count !== void 0) && (b += ":" + E[g].start + ":" + E[g].count), e.attributes.has(b) ? D.indices = e.attributes.get(b) : (D.indices = this.processAccessor(r.index, r, E[g].start, E[g].count), e.attributes.set(b, D.indices)), D.indices === null && delete D.indices;
4012
+ (L[g].start !== void 0 || L[g].count !== void 0) && (b += ":" + L[g].start + ":" + L[g].count), e.attributes.has(b) ? D.indices = e.attributes.get(b) : (D.indices = this.processAccessor(r.index, r, L[g].start, L[g].count), e.attributes.set(b, D.indices)), D.indices === null && delete D.indices;
3983
4013
  }
3984
- const L = await this.processMaterialAsync(m[E[g].materialIndex]);
3985
- L !== null && (D.material = L), l.push(D);
4014
+ const E = await this.processMaterialAsync(m[L[g].materialIndex]);
4015
+ E !== null && (D.material = E), l.push(D);
3986
4016
  }
3987
4017
  x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(g) {
3988
4018
  g.writeMesh && g.writeMesh(t, a);
@@ -4062,16 +4092,16 @@ class ve {
4062
4092
  n.animations || (n.animations = []), t = tt.Utils.mergeMorphTargetTracks(t.clone(), e);
4063
4093
  const i = t.tracks, r = [], o = [];
4064
4094
  for (let c = 0; c < i.length; ++c) {
4065
- const l = i[c], h = K.parseTrackName(l.name);
4066
- let u = K.findNode(e, h.nodeName);
4067
- const f = Et[h.propertyName];
4095
+ const l = i[c], h = Z.parseTrackName(l.name);
4096
+ let u = Z.findNode(e, h.nodeName);
4097
+ const f = Lt[h.propertyName];
4068
4098
  if (h.objectName === "bones" && (u.isSkinnedMesh === !0 ? u = u.skeleton.getBoneByName(h.objectIndex) : u = void 0), !u || !f) {
4069
4099
  console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
4070
4100
  continue;
4071
4101
  }
4072
4102
  const p = 1;
4073
4103
  let y = l.values.length / l.times.length;
4074
- f === Et.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
4104
+ f === Lt.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
4075
4105
  let x;
4076
4106
  l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === kt ? x = "STEP" : x = "LINEAR", o.push({
4077
4107
  input: this.processAccessor(new _(l.times, p)),
@@ -4123,7 +4153,7 @@ class ve {
4123
4153
  const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
4124
4154
  H(o, [0, 0, 0, 1]) || (i.rotation = o), H(a, [0, 0, 0]) || (i.translation = a), H(c, [1, 1, 1]) || (i.scale = c);
4125
4155
  } else
4126
- t.matrixAutoUpdate && t.updateMatrix(), Ie(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4156
+ t.matrixAutoUpdate && t.updateMatrix(), Pe(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4127
4157
  if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
4128
4158
  const o = await this.processMeshAsync(t);
4129
4159
  o !== null && (i.mesh = o);
@@ -4200,7 +4230,7 @@ class ve {
4200
4230
  await t(this.plugins[e]);
4201
4231
  }
4202
4232
  }
4203
- class Ne {
4233
+ class Ce {
4204
4234
  constructor(t) {
4205
4235
  this.writer = t, this.name = "KHR_lights_punctual";
4206
4236
  }
@@ -4216,7 +4246,7 @@ class Ne {
4216
4246
  o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
4217
4247
  }
4218
4248
  }
4219
- class Ce {
4249
+ class Be {
4220
4250
  constructor(t) {
4221
4251
  this.writer = t, this.name = "KHR_materials_unlit";
4222
4252
  }
@@ -4226,7 +4256,7 @@ class Ce {
4226
4256
  e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
4227
4257
  }
4228
4258
  }
4229
- class Be {
4259
+ class Oe {
4230
4260
  constructor(t) {
4231
4261
  this.writer = t, this.name = "KHR_materials_clearcoat";
4232
4262
  }
@@ -4257,7 +4287,7 @@ class Be {
4257
4287
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4258
4288
  }
4259
4289
  }
4260
- class Oe {
4290
+ class Fe {
4261
4291
  constructor(t) {
4262
4292
  this.writer = t, this.name = "KHR_materials_dispersion";
4263
4293
  }
@@ -4267,7 +4297,7 @@ class Oe {
4267
4297
  i.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4268
4298
  }
4269
4299
  }
4270
- class Fe {
4300
+ class Ge {
4271
4301
  constructor(t) {
4272
4302
  this.writer = t, this.name = "KHR_materials_iridescence";
4273
4303
  }
@@ -4291,7 +4321,7 @@ class Fe {
4291
4321
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4292
4322
  }
4293
4323
  }
4294
- class Ge {
4324
+ class Ue {
4295
4325
  constructor(t) {
4296
4326
  this.writer = t, this.name = "KHR_materials_transmission";
4297
4327
  }
@@ -4308,7 +4338,7 @@ class Ge {
4308
4338
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4309
4339
  }
4310
4340
  }
4311
- class Ue {
4341
+ class ze {
4312
4342
  constructor(t) {
4313
4343
  this.writer = t, this.name = "KHR_materials_volume";
4314
4344
  }
@@ -4325,7 +4355,7 @@ class Ue {
4325
4355
  t.attenuationDistance !== 1 / 0 && (i.attenuationDistance = t.attenuationDistance), i.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4326
4356
  }
4327
4357
  }
4328
- class ze {
4358
+ class je {
4329
4359
  constructor(t) {
4330
4360
  this.writer = t, this.name = "KHR_materials_ior";
4331
4361
  }
@@ -4335,7 +4365,7 @@ class ze {
4335
4365
  i.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4336
4366
  }
4337
4367
  }
4338
- class je {
4368
+ class _e {
4339
4369
  constructor(t) {
4340
4370
  this.writer = t, this.name = "KHR_materials_specular";
4341
4371
  }
@@ -4359,7 +4389,7 @@ class je {
4359
4389
  i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4360
4390
  }
4361
4391
  }
4362
- class _e {
4392
+ class qe {
4363
4393
  constructor(t) {
4364
4394
  this.writer = t, this.name = "KHR_materials_sheen";
4365
4395
  }
@@ -4383,7 +4413,7 @@ class _e {
4383
4413
  i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4384
4414
  }
4385
4415
  }
4386
- class qe {
4416
+ class Ye {
4387
4417
  constructor(t) {
4388
4418
  this.writer = t, this.name = "KHR_materials_anisotropy";
4389
4419
  }
@@ -4397,7 +4427,7 @@ class qe {
4397
4427
  i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4398
4428
  }
4399
4429
  }
4400
- class Ye {
4430
+ class ke {
4401
4431
  constructor(t) {
4402
4432
  this.writer = t, this.name = "KHR_materials_emissive_strength";
4403
4433
  }
@@ -4407,7 +4437,7 @@ class Ye {
4407
4437
  i.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4408
4438
  }
4409
4439
  }
4410
- class ke {
4440
+ class Ve {
4411
4441
  constructor(t) {
4412
4442
  this.writer = t, this.name = "EXT_materials_bump";
4413
4443
  }
@@ -4424,13 +4454,13 @@ class ke {
4424
4454
  i.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4425
4455
  }
4426
4456
  }
4427
- class Ve {
4457
+ class Xe {
4428
4458
  constructor(t) {
4429
4459
  this.writer = t, this.name = "EXT_mesh_gpu_instancing";
4430
4460
  }
4431
4461
  writeNode(t, e) {
4432
4462
  if (!t.isInstancedMesh) return;
4433
- const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new bt(), c = new $(), l = new Gt(), h = new $();
4463
+ const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new bt(), c = new K(), l = new Gt(), h = new K();
4434
4464
  for (let f = 0; f < s.count; f++)
4435
4465
  s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
4436
4466
  const u = {
@@ -4471,7 +4501,7 @@ tt.Utils = {
4471
4501
  const e = [], n = {}, s = d.tracks;
4472
4502
  for (let i = 0; i < s.length; ++i) {
4473
4503
  let r = s[i];
4474
- const o = K.parseTrackName(r.name), a = K.findNode(t, o.nodeName);
4504
+ const o = Z.parseTrackName(r.name), a = Z.findNode(t, o.nodeName);
4475
4505
  if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
4476
4506
  e.push(r);
4477
4507
  continue;
@@ -4514,7 +4544,7 @@ tt.Utils = {
4514
4544
  return t;
4515
4545
  }
4516
4546
  };
4517
- async function Xe(d) {
4547
+ async function We(d) {
4518
4548
  if (typeof FileReader > "u") {
4519
4549
  const t = await d.arrayBuffer(), n = Buffer.from(t).toString("base64");
4520
4550
  return `data:${d.type};base64,${n}`;
@@ -4537,8 +4567,8 @@ async function rt(d) {
4537
4567
  return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
4538
4568
  }
4539
4569
  }
4540
- const We = new ne(), He = new tt();
4541
- function Je(d, t, e = 0.1) {
4570
+ const He = new ne(), Je = new tt();
4571
+ function $e(d, t, e = 0.1) {
4542
4572
  const n = t.normal(d), s = t.direction(d).mutiplyScalar(e * 0.5), i = d.direction(t).mutiplyScalar(e * 0.5), r = n.x * e * 0.5, o = n.y * e * 0.5;
4543
4573
  return {
4544
4574
  points: [
@@ -4583,7 +4613,7 @@ class Nt extends q {
4583
4613
  new I.LineSegments(new I.EdgesGeometry(i), new I.LineBasicMaterial({ color: 0 }))
4584
4614
  );
4585
4615
  }), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
4586
- const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = Je(r, o, t.width);
4616
+ const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = $e(r, o, t.width);
4587
4617
  return {
4588
4618
  points: a,
4589
4619
  indices: c,
@@ -4616,7 +4646,7 @@ class Nt extends q {
4616
4646
  toOBJ() {
4617
4647
  return new Promise((t) => {
4618
4648
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
4619
- t(We.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4649
+ t(He.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4620
4650
  }, 20);
4621
4651
  });
4622
4652
  }
@@ -4628,7 +4658,7 @@ class Nt extends q {
4628
4658
  toGltf(t = !0) {
4629
4659
  return new Promise((e) => {
4630
4660
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
4631
- He.parse(this.whiteModelGroup.children, (n) => {
4661
+ Je.parse(this.whiteModelGroup.children, (n) => {
4632
4662
  e(n), this.material.opacity = 0.8, this.material.transparent = !0;
4633
4663
  }, () => {
4634
4664
  e(void 0);
@@ -4789,7 +4819,7 @@ class Bt extends q {
4789
4819
  });
4790
4820
  }
4791
4821
  }
4792
- const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4822
+ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4793
4823
  __proto__: null,
4794
4824
  DetailsPoint: Ct,
4795
4825
  DxfLineModel: Bt,
@@ -4803,24 +4833,24 @@ function Tt(d, t = {}) {
4803
4833
  } = t;
4804
4834
  s && d.addComponent(new Bt()), n && d.addComponent(new Nt()), e && d.addComponent(new Ct());
4805
4835
  }
4806
- const Ke = Object.assign(Tt, {
4836
+ const Ze = Object.assign(Tt, {
4807
4837
  create(d = {}) {
4808
4838
  return (t) => Tt(t, d);
4809
4839
  }
4810
- }), Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4840
+ }), Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4811
4841
  __proto__: null,
4812
- ModelDataPlugin: Ke,
4813
- components: $e
4842
+ ModelDataPlugin: Ze,
4843
+ components: Ke
4814
4844
  }, Symbol.toStringTag, { value: "Module" }));
4815
- function Qe() {
4845
+ function tn() {
4816
4846
  return import("./index2.js");
4817
4847
  }
4818
- function tn() {
4848
+ function en() {
4819
4849
  return import("./index3.js");
4820
4850
  }
4821
4851
  let dt = null;
4822
- async function cn(d, t, e = !1, n) {
4823
- const s = await Promise.resolve().then(() => Ze), i = await Qe(), r = await tn(), o = new ht().usePlugin(s.ModelDataPlugin.create({
4852
+ async function ln(d, t, e = !1, n) {
4853
+ const s = await Promise.resolve().then(() => Qe), i = await tn(), r = await en(), o = new ht().usePlugin(s.ModelDataPlugin.create({
4824
4854
  detailsPoint: !1,
4825
4855
  whiteModel: !0
4826
4856
  })).usePlugin(i.RenderPlugin.create({
@@ -4832,10 +4862,10 @@ async function cn(d, t, e = !1, n) {
4832
4862
  })).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
4833
4863
  return a && d.appendChild(a.domElement), dt = o, {
4834
4864
  dxfSystem: o,
4835
- getFileAll: () => en(o)
4865
+ getFileAll: () => nn(o)
4836
4866
  };
4837
4867
  }
4838
- async function en(d = dt) {
4868
+ async function nn(d = dt) {
4839
4869
  const t = d.findComponentByName("WhiteModel"), e = 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 t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(d.Dxf.originalData)], "json.json", { type: "application/json" });
4840
4870
  return {
4841
4871
  dxf: n,
@@ -4847,7 +4877,7 @@ async function en(d = dt) {
4847
4877
  correctionDxf: s
4848
4878
  };
4849
4879
  }
4850
- function ln() {
4880
+ function hn() {
4851
4881
  return dt;
4852
4882
  }
4853
4883
  export {
@@ -4857,20 +4887,20 @@ export {
4857
4887
  ht as D,
4858
4888
  It as E,
4859
4889
  A as L,
4860
- Ke as M,
4890
+ Ze as M,
4861
4891
  M as P,
4862
4892
  F as Q,
4863
- Se as T,
4893
+ Le as T,
4864
4894
  Rt as V,
4865
4895
  Nt as W,
4866
4896
  Ct as a,
4867
4897
  X as b,
4868
- cn as c,
4869
- ln as d,
4898
+ ln as c,
4899
+ hn as d,
4870
4900
  k as e,
4871
- an as f,
4872
- en as g,
4873
- $e as i,
4901
+ cn as f,
4902
+ nn as g,
4903
+ Ke as i,
4874
4904
  Q as r,
4875
4905
  at as u
4876
4906
  };