build-dxf 0.0.20-24 → 0.0.20-25

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
@@ -4,19 +4,19 @@ import F from "clipper-lib";
4
4
  import R from "dxf-writer";
5
5
  import { OBJExporter as et } from "three/examples/jsm/exporters/OBJExporter.js";
6
6
  import { GLTFExporter as nt } from "three/examples/jsm/exporters/GLTFExporter.js";
7
- function z() {
7
+ function N() {
8
8
  return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(y) {
9
9
  var t = Math.random() * 16 | 0, e = y == "x" ? t : t & 3 | 8;
10
10
  return e.toString(16);
11
11
  });
12
12
  }
13
13
  class $ extends tt {
14
- uuid = z();
14
+ uuid = N();
15
15
  addEventListener(t, e, n) {
16
- const { once: i = !1 } = n ?? {}, o = (r) => {
17
- e(r), i && s();
18
- }, s = () => this.removeEventListener(t, o);
19
- return super.addEventListener(t, o), s;
16
+ const { once: i = !1 } = n ?? {}, s = (r) => {
17
+ e(r), i && o();
18
+ }, o = () => this.removeEventListener(t, s);
19
+ return super.addEventListener(t, s), o;
20
20
  }
21
21
  eventRecordStack = /* @__PURE__ */ new Map();
22
22
  addEventRecord(t, ...e) {
@@ -117,7 +117,7 @@ class it extends $ {
117
117
  return e || null;
118
118
  }
119
119
  }
120
- class p {
120
+ class f {
121
121
  x;
122
122
  y;
123
123
  get X() {
@@ -207,7 +207,7 @@ class p {
207
207
  * @param angle 旋转角度,单位为弧度
208
208
  */
209
209
  rotate(t, e) {
210
- const n = this.x - t.x, i = this.y - t.y, o = Math.cos(e), s = Math.sin(e), r = n * o - i * s, c = n * s + i * o;
210
+ const n = this.x - t.x, i = this.y - t.y, s = Math.cos(e), o = Math.sin(e), r = n * s - i * o, c = n * o + i * s;
211
211
  return this.x = r + t.x, this.y = c + t.y, this;
212
212
  }
213
213
  /**
@@ -233,8 +233,8 @@ class p {
233
233
  * @returns
234
234
  */
235
235
  normal(t) {
236
- const e = this.x - t.x, n = this.y - t.y, i = Math.sqrt(e * e + n * n), o = -n / i, s = e / i;
237
- return new p(o, s);
236
+ const e = this.x - t.x, n = this.y - t.y, i = Math.sqrt(e * e + n * n), s = -n / i, o = e / i;
237
+ return new f(s, o);
238
238
  }
239
239
  /**
240
240
  * 获取由传入的点到该点的单位方向向量
@@ -244,7 +244,7 @@ class p {
244
244
  */
245
245
  direction(t) {
246
246
  const e = this.x - t.x, n = this.y - t.y, i = Math.sqrt(e * e + n * n);
247
- return i === 0 ? new p(0, 0) : new p(e / i, n / i);
247
+ return i === 0 ? new f(0, 0) : new f(e / i, n / i);
248
248
  }
249
249
  /**
250
250
  * 计算模长
@@ -277,9 +277,9 @@ class p {
277
277
  * @returns
278
278
  */
279
279
  angleBetween(t, e = "radian", n = "180") {
280
- const i = this.dot(t), o = this.magnitude(), s = t.magnitude();
281
- if (o === 0 || s === 0) return 0;
282
- const r = i / (o * s), c = Math.max(-1, Math.min(1, r));
280
+ const i = this.dot(t), s = this.magnitude(), o = t.magnitude();
281
+ if (s === 0 || o === 0) return 0;
282
+ const r = i / (s * o), c = Math.max(-1, Math.min(1, r));
283
283
  return e === "radian" ? Math.acos(c) : e === "cos" ? c : n === "180" || this.cross(t) < 0 ? Math.acos(c) / (Math.PI / 180) : 360 - Math.acos(c) / (Math.PI / 180);
284
284
  }
285
285
  /** 获取向量长度
@@ -302,7 +302,7 @@ class p {
302
302
  * @returns
303
303
  */
304
304
  clone() {
305
- return new p(this.x, this.y);
305
+ return new f(this.x, this.y);
306
306
  }
307
307
  /**
308
308
  * 克隆
@@ -319,10 +319,10 @@ class p {
319
319
  };
320
320
  }
321
321
  static from(t) {
322
- return Array.isArray(t) ? new p(t[0], t[1]) : "x" in t && "y" in t ? new p(t.x, t.y) : "X" in t && "Y" in t ? new p(t.X, t.Y) : this.zero();
322
+ return Array.isArray(t) ? new f(t[0], t[1]) : "x" in t && "y" in t ? new f(t.x, t.y) : "X" in t && "Y" in t ? new f(t.X, t.Y) : this.zero();
323
323
  }
324
324
  static zero() {
325
- return new p(0, 0);
325
+ return new f(0, 0);
326
326
  }
327
327
  }
328
328
  class v {
@@ -332,10 +332,10 @@ class v {
332
332
  maxY = 0;
333
333
  get points() {
334
334
  return [
335
- new p(this.minX, this.minY),
336
- new p(this.maxX, this.minY),
337
- new p(this.maxX, this.maxY),
338
- new p(this.minX, this.maxY)
335
+ new f(this.minX, this.minY),
336
+ new f(this.maxX, this.minY),
337
+ new f(this.maxX, this.maxY),
338
+ new f(this.minX, this.maxY)
339
339
  ];
340
340
  }
341
341
  get width() {
@@ -345,7 +345,7 @@ class v {
345
345
  return this.maxY - this.minY;
346
346
  }
347
347
  get center() {
348
- return new p(
348
+ return new f(
349
349
  this.minX + (this.maxX - this.minX) * 0.5,
350
350
  this.minY + (this.maxY - this.minY) * 0.5
351
351
  );
@@ -360,9 +360,9 @@ class v {
360
360
  */
361
361
  getPaths3D(t = 0) {
362
362
  const e = this.points, n = [];
363
- return e.forEach((i, o) => {
364
- const s = e[(o + 1) % e.length];
365
- n.push(i.x, i.y, t), n.push(s.x, s.y, t);
363
+ return e.forEach((i, s) => {
364
+ const o = e[(s + 1) % e.length];
365
+ n.push(i.x, i.y, t), n.push(o.x, o.y, t);
366
366
  }), n;
367
367
  }
368
368
  /**
@@ -371,21 +371,21 @@ class v {
371
371
  * @param line
372
372
  */
373
373
  intersectLineSegment(t) {
374
- const e = t.points[0], n = t.points[1], i = n.x - e.x, o = n.y - e.y;
375
- if (i === 0 && o === 0)
374
+ const e = t.points[0], n = t.points[1], i = n.x - e.x, s = n.y - e.y;
375
+ if (i === 0 && s === 0)
376
376
  return this.minX <= e.x && e.x <= this.maxX && this.minY <= e.y && e.y <= this.maxY;
377
- let s = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
377
+ let o = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
378
378
  if (i !== 0) {
379
379
  const c = (this.minX - e.x) / i, a = (this.maxX - e.x) / i;
380
- s = Math.max(s, Math.min(c, a)), r = Math.min(r, Math.max(c, a));
380
+ o = Math.max(o, Math.min(c, a)), r = Math.min(r, Math.max(c, a));
381
381
  } else if (e.x < this.minX || e.x > this.maxX)
382
382
  return !1;
383
- if (o !== 0) {
384
- const c = (this.minY - e.y) / o, a = (this.maxY - e.y) / o;
385
- s = Math.max(s, Math.min(c, a)), r = Math.min(r, Math.max(c, a));
383
+ if (s !== 0) {
384
+ const c = (this.minY - e.y) / s, a = (this.maxY - e.y) / s;
385
+ o = Math.max(o, Math.min(c, a)), r = Math.min(r, Math.max(c, a));
386
386
  } else if (e.y < this.minY || e.y > this.maxY)
387
387
  return !1;
388
- return s <= r && s <= 1 && r >= 0;
388
+ return o <= r && o <= 1 && r >= 0;
389
389
  }
390
390
  /**
391
391
  * 判断线段是在包围盒内
@@ -400,37 +400,37 @@ class v {
400
400
  * @param rectangle
401
401
  */
402
402
  intersectRectangle(t) {
403
- const e = (s) => this.minX <= s.x && s.x <= this.maxX && this.minY <= s.y && s.y <= this.maxY, n = (s) => {
403
+ const e = (o) => this.minX <= o.x && o.x <= this.maxX && this.minY <= o.y && o.y <= this.maxY, n = (o) => {
404
404
  let r = 0;
405
405
  for (let c = 0; c < 4; c++) {
406
- const a = t.points[c], h = t.points[(c + 1) % 4], l = { x: h.x - a.x, y: h.y - a.y }, d = { x: s.x - a.x, y: s.y - a.y }, f = l.x * d.y - l.y * d.x;
407
- if (f === 0) {
408
- const m = l.x !== 0 ? (s.x - a.x) / l.x : (s.y - a.y) / l.y;
406
+ const a = t.points[c], h = t.points[(c + 1) % 4], l = { x: h.x - a.x, y: h.y - a.y }, d = { x: o.x - a.x, y: o.y - a.y }, p = l.x * d.y - l.y * d.x;
407
+ if (p === 0) {
408
+ const m = l.x !== 0 ? (o.x - a.x) / l.x : (o.y - a.y) / l.y;
409
409
  if (m >= 0 && m <= 1) return !0;
410
410
  } else {
411
- const m = f > 0 ? 1 : -1;
411
+ const m = p > 0 ? 1 : -1;
412
412
  if (r === 0 && (r = m), r !== m) return !1;
413
413
  }
414
414
  }
415
415
  return !0;
416
- }, i = (s, r, c, a) => {
416
+ }, i = (o, r, c, a) => {
417
417
  const h = (u, x, w) => {
418
418
  const S = (x.y - u.y) * (w.x - x.x) - (x.x - u.x) * (w.y - x.y);
419
419
  return S === 0 ? 0 : S > 0 ? 1 : 2;
420
- }, l = (u, x, w) => Math.min(u.x, w.x) <= x.x && x.x <= Math.max(u.x, w.x) && Math.min(u.y, w.y) <= x.y && x.y <= Math.max(u.y, w.y), d = h(s, r, c), f = h(s, r, a), m = h(c, a, s), g = h(c, a, r);
421
- return !!(d !== f && m !== g || d === 0 && l(s, c, r) || f === 0 && l(s, a, r) || m === 0 && l(c, s, a) || g === 0 && l(c, r, a));
422
- }, o = this.points;
423
- for (let s = 0; s < 4; s++) {
424
- const r = o[s], c = o[(s + 1) % 4];
420
+ }, l = (u, x, w) => Math.min(u.x, w.x) <= x.x && x.x <= Math.max(u.x, w.x) && Math.min(u.y, w.y) <= x.y && x.y <= Math.max(u.y, w.y), d = h(o, r, c), p = h(o, r, a), m = h(c, a, o), g = h(c, a, r);
421
+ return !!(d !== p && m !== g || d === 0 && l(o, c, r) || p === 0 && l(o, a, r) || m === 0 && l(c, o, a) || g === 0 && l(c, r, a));
422
+ }, s = this.points;
423
+ for (let o = 0; o < 4; o++) {
424
+ const r = s[o], c = s[(o + 1) % 4];
425
425
  for (let a = 0; a < 4; a++) {
426
426
  const h = t.points[a], l = t.points[(a + 1) % 4];
427
427
  if (i(r, c, h, l)) return !0;
428
428
  }
429
429
  }
430
- for (let s of t.points)
431
- if (e(s)) return !0;
432
- for (let s of o)
433
- if (n(s)) return !0;
430
+ for (let o of t.points)
431
+ if (e(o)) return !0;
432
+ for (let o of s)
433
+ if (n(o)) return !0;
434
434
  return !1;
435
435
  }
436
436
  /**
@@ -481,8 +481,8 @@ class v {
481
481
  * @returns
482
482
  */
483
483
  scaleSize(t, e, n = "min") {
484
- const i = t / this.width, o = e / this.height;
485
- return Math[n](i, o);
484
+ const i = t / this.width, s = e / this.height;
485
+ return Math[n](i, s);
486
486
  }
487
487
  /**
488
488
  *
@@ -519,16 +519,16 @@ class v {
519
519
  );
520
520
  }
521
521
  }
522
- function O(y) {
522
+ function z(y) {
523
523
  if (y === null || typeof y != "object") return y;
524
524
  if (y instanceof Date) return new Date(y.getTime());
525
- if (Array.isArray(y)) return y.map(O);
525
+ if (Array.isArray(y)) return y.map(z);
526
526
  const t = {};
527
527
  for (const e in y)
528
- Object.prototype.hasOwnProperty.call(y, e) && (t[e] = O(y[e]));
528
+ Object.prototype.hasOwnProperty.call(y, e) && (t[e] = z(y[e]));
529
529
  return t;
530
530
  }
531
- class N {
531
+ class O {
532
532
  points;
533
533
  get p0() {
534
534
  return this.points[0];
@@ -551,7 +551,7 @@ class N {
551
551
  path2D(t) {
552
552
  return this.points.flatMap((e, n) => {
553
553
  const i = this.points[(n + 1) % this.points.length];
554
- return t && t(new p(e.x, e.y), new p(i.x, i.y)), [e.x, e.y, i.x, i.y];
554
+ return t && t(new f(e.x, e.y), new f(i.x, i.y)), [e.x, e.y, i.x, i.y];
555
555
  });
556
556
  }
557
557
  createGeometry() {
@@ -577,16 +577,16 @@ class N {
577
577
  intersectLineSegment(t) {
578
578
  if (t.points.length !== 2)
579
579
  throw new Error("LineSegment must have exactly 2 points");
580
- const [e, n] = t.points, i = (o, s, r, c) => {
580
+ const [e, n] = t.points, i = (s, o, r, c) => {
581
581
  const a = (g, u, x) => {
582
582
  const w = (u.y - g.y) * (x.x - u.x) - (u.x - g.x) * (x.y - u.y);
583
583
  return w === 0 ? 0 : w > 0 ? 1 : 2;
584
- }, h = (g, u, x) => Math.min(g.x, x.x) <= u.x && u.x <= Math.max(g.x, x.x) && Math.min(g.y, x.y) <= u.y && u.y <= Math.max(g.y, x.y), l = a(o, s, r), d = a(o, s, c), f = a(r, c, o), m = a(r, c, s);
585
- return !!(l !== d && f !== m || l === 0 && h(o, r, s) || d === 0 && h(o, c, s) || f === 0 && h(r, o, c) || m === 0 && h(r, s, c));
584
+ }, h = (g, u, x) => Math.min(g.x, x.x) <= u.x && u.x <= Math.max(g.x, x.x) && Math.min(g.y, x.y) <= u.y && u.y <= Math.max(g.y, x.y), l = a(s, o, r), d = a(s, o, c), p = a(r, c, s), m = a(r, c, o);
585
+ return !!(l !== d && p !== m || l === 0 && h(s, r, o) || d === 0 && h(s, c, o) || p === 0 && h(r, s, c) || m === 0 && h(r, o, c));
586
586
  };
587
- for (let o = 0; o < 4; o++) {
588
- const s = this.points[o], r = this.points[(o + 1) % 4];
589
- if (i(e, n, s, r))
587
+ for (let s = 0; s < 4; s++) {
588
+ const o = this.points[s], r = this.points[(s + 1) % 4];
589
+ if (i(e, n, o, r))
590
590
  return !0;
591
591
  }
592
592
  return !!this.containsLineSegment(t);
@@ -601,10 +601,10 @@ class N {
601
601
  throw new Error("LineSegment must have exactly 2 points");
602
602
  const e = (n) => {
603
603
  let i = 0;
604
- for (let o = 0; o < 4; o++) {
605
- const s = this.points[o], r = this.points[(o + 1) % 4], c = { x: r.x - s.x, y: r.y - s.y }, a = { x: n.x - s.x, y: n.y - s.y }, h = c.x * a.y - c.y * a.x;
604
+ for (let s = 0; s < 4; s++) {
605
+ const o = this.points[s], r = this.points[(s + 1) % 4], c = { x: r.x - o.x, y: r.y - o.y }, a = { x: n.x - o.x, y: n.y - o.y }, h = c.x * a.y - c.y * a.x;
606
606
  if (h === 0) {
607
- const l = c.x !== 0 ? (n.x - s.x) / c.x : (n.y - s.y) / c.y;
607
+ const l = c.x !== 0 ? (n.x - o.x) / c.x : (n.y - o.y) / c.y;
608
608
  if (l >= 0 && l <= 1) return !0;
609
609
  } else {
610
610
  const l = h > 0 ? 1 : -1;
@@ -623,24 +623,24 @@ class N {
623
623
  */
624
624
  intersectRectangle(t) {
625
625
  const e = [];
626
- for (let o = 0; o < 4; o++) {
627
- const s = this.points[o], r = this.points[(o + 1) % 4];
628
- e.push(s.normal(r));
626
+ for (let s = 0; s < 4; s++) {
627
+ const o = this.points[s], r = this.points[(s + 1) % 4];
628
+ e.push(o.normal(r));
629
629
  }
630
- for (let o = 0; o < 4; o++) {
631
- const s = t.points[o], r = t.points[(o + 1) % 4];
632
- e.push(s.normal(r));
630
+ for (let s = 0; s < 4; s++) {
631
+ const o = t.points[s], r = t.points[(s + 1) % 4];
632
+ e.push(o.normal(r));
633
633
  }
634
- function n(o, s) {
635
- const r = o.points.map((c) => c.dot(s));
634
+ function n(s, o) {
635
+ const r = s.points.map((c) => c.dot(o));
636
636
  return [Math.min(...r), Math.max(...r)];
637
637
  }
638
- function i(o, s) {
639
- return o[0] < s[1] && s[0] < o[1];
638
+ function i(s, o) {
639
+ return s[0] < o[1] && o[0] < s[1];
640
640
  }
641
- for (const o of e) {
642
- const s = n(this, o), r = n(t, o);
643
- if (!i(s, r))
641
+ for (const s of e) {
642
+ const o = n(this, s), r = n(t, s);
643
+ if (!i(o, r))
644
644
  return !1;
645
645
  }
646
646
  return !0;
@@ -652,7 +652,7 @@ class N {
652
652
  containsPoint(t) {
653
653
  let e = 0, n = 0;
654
654
  for (let i = 0; i < 4; i++) {
655
- const o = this.points[i], s = this.points[(i + 1) % 4], r = (s.x - o.x) * (t.y - o.y) - (s.y - o.y) * (t.x - o.x);
655
+ const s = this.points[i], o = this.points[(i + 1) % 4], r = (o.x - s.x) * (t.y - s.y) - (o.y - s.y) * (t.x - s.x);
656
656
  if (r > 0) e++;
657
657
  else if (r < 0) n++;
658
658
  else return !1;
@@ -665,8 +665,8 @@ class N {
665
665
  */
666
666
  toBox() {
667
667
  let t = 1 / 0, e = -1 / 0, n = 1 / 0, i = -1 / 0;
668
- return this.points.forEach((o) => {
669
- e = Math.max(o.x, e), t = Math.min(o.x, t), i = Math.max(o.x, i), n = Math.min(o.x, n);
668
+ return this.points.forEach((s) => {
669
+ e = Math.max(s.x, e), t = Math.min(s.x, t), i = Math.max(s.x, i), n = Math.min(s.x, n);
670
670
  }), new v(t, e, n, i);
671
671
  }
672
672
  /**
@@ -676,21 +676,21 @@ class N {
676
676
  * @returns
677
677
  */
678
678
  static fromByLineSegment(t, e = 0.1, n = !1, i = 0.5) {
679
- const o = t.points[0], s = t.points[1], r = s.normal(o), c = n ? s.direction(o).mutiplyScalar(e * i) : p.zero(), a = n ? o.direction(s).mutiplyScalar(e * i) : p.zero(), h = r.x * e * 0.5, l = r.y * e * 0.5;
680
- return new N([
681
- new p(o.x + h, o.y + l).add(a),
682
- new p(s.x + h, s.y + l).add(c),
683
- new p(s.x - h, s.y - l).add(c),
684
- new p(o.x - h, o.y - l).add(a)
679
+ const s = t.points[0], o = t.points[1], r = o.normal(s), c = n ? o.direction(s).mutiplyScalar(e * i) : f.zero(), a = n ? s.direction(o).mutiplyScalar(e * i) : f.zero(), h = r.x * e * 0.5, l = r.y * e * 0.5;
680
+ return new O([
681
+ new f(s.x + h, s.y + l).add(a),
682
+ new f(o.x + h, o.y + l).add(c),
683
+ new f(o.x - h, o.y - l).add(c),
684
+ new f(s.x - h, s.y - l).add(a)
685
685
  ]);
686
686
  }
687
687
  }
688
- class L {
689
- points = [new p(), new p()];
688
+ class b {
689
+ points = [new f(), new f()];
690
690
  userData = {};
691
691
  line;
692
692
  get center() {
693
- return new p(
693
+ return new f(
694
694
  this.points[0].x + (this.points[1].x - this.points[0].x) * 0.5,
695
695
  this.points[0].y + (this.points[1].y - this.points[0].y) * 0.5
696
696
  );
@@ -701,7 +701,7 @@ class L {
701
701
  get end() {
702
702
  return this.points[1];
703
703
  }
704
- constructor(t = new p(), e = new p()) {
704
+ constructor(t = new f(), e = new f()) {
705
705
  this.points = [t, e];
706
706
  }
707
707
  set(t, e) {
@@ -770,15 +770,15 @@ class L {
770
770
  * @returns {Rectangle}
771
771
  */
772
772
  expandToRectangle(t = 0.1, e = "all") {
773
- const n = this.start, i = this.end, o = i.normal(n), s = e === "bothSides" ? p.zero() : i.direction(n).mutiplyScalar(t * 0.5), r = e === "bothSides" ? p.zero() : n.direction(i).mutiplyScalar(t * 0.5), c = o.x * t * 0.5, a = o.y * t * 0.5, h = [
773
+ const n = this.start, i = this.end, s = i.normal(n), o = e === "bothSides" ? f.zero() : i.direction(n).mutiplyScalar(t * 0.5), r = e === "bothSides" ? f.zero() : n.direction(i).mutiplyScalar(t * 0.5), c = s.x * t * 0.5, a = s.y * t * 0.5, h = [
774
774
  // 第一条线
775
- new p(n.x + c, n.y + a).add(r),
776
- new p(i.x + c, i.y + a).add(s),
775
+ new f(n.x + c, n.y + a).add(r),
776
+ new f(i.x + c, i.y + a).add(o),
777
777
  // 第二条线
778
- new p(n.x - c, n.y - a).add(r),
779
- new p(i.x - c, i.y - a).add(s)
778
+ new f(n.x - c, n.y - a).add(r),
779
+ new f(i.x - c, i.y - a).add(o)
780
780
  ];
781
- return new N([0, 1, 3, 2].map((l) => h[l]));
781
+ return new O([0, 1, 3, 2].map((l) => h[l]));
782
782
  }
783
783
  /**
784
784
  * 计算线段的长度
@@ -815,24 +815,24 @@ class L {
815
815
  projectLineSegment(t) {
816
816
  if (t.points.length !== 2 || this.points.length !== 2)
817
817
  throw new Error("每条线段必须由两个点定义");
818
- const [e, n] = t.points, [i, o] = this.points, s = new p(o.x - i.x, o.y - i.y);
819
- if (s.x === 0 && s.y === 0)
818
+ const [e, n] = t.points, [i, s] = this.points, o = new f(s.x - i.x, s.y - i.y);
819
+ if (o.x === 0 && o.y === 0)
820
820
  throw new Error("投影目标线段的两个点不能重合");
821
821
  const r = (m) => {
822
- const g = new p(m.x - i.x, m.y - i.y), u = s.x * s.x + s.y * s.y, w = (g.x * s.x + g.y * s.y) / u, S = i.x + w * s.x, b = i.y + w * s.y;
823
- return new p(S, b);
822
+ const g = new f(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y, w = (g.x * o.x + g.y * o.y) / u, S = i.x + w * o.x, L = i.y + w * o.y;
823
+ return new f(S, L);
824
824
  };
825
825
  let c = r(e), a = r(n);
826
826
  const h = (m) => {
827
- const g = new p(m.x - i.x, m.y - i.y), u = s.x * s.x + s.y * s.y;
828
- return (g.x * s.x + g.y * s.y) / u;
827
+ const g = new f(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y;
828
+ return (g.x * o.x + g.y * o.y) / u;
829
829
  };
830
830
  let l = h(c), d = h(a);
831
- const f = (m) => {
832
- const g = Math.max(0, Math.min(1, m)), u = i.x + g * s.x, x = i.y + g * s.y;
833
- return new p(u, x);
831
+ const p = (m) => {
832
+ const g = Math.max(0, Math.min(1, m)), u = i.x + g * o.x, x = i.y + g * o.y;
833
+ return new f(u, x);
834
834
  };
835
- return (l < 0 || l > 1) && (c = f(l)), (d < 0 || d > 1) && (a = f(d)), c.x === a.x && c.y === a.y ? new L(c, c) : new L(c, a);
835
+ return (l < 0 || l > 1) && (c = p(l)), (d < 0 || d > 1) && (a = p(d)), c.x === a.x && c.y === a.y ? new b(c, c) : new b(c, a);
836
836
  }
837
837
  /**
838
838
  * 计算一条线段在另一条直线上的投影
@@ -841,17 +841,17 @@ class L {
841
841
  * @returns 投影并裁剪后的线段
842
842
  */
843
843
  projectPoint(t, e = !0) {
844
- const [n, i] = this.points, o = new p(i.x - n.x, i.y - n.y);
845
- if (o.x === 0 && o.y === 0)
844
+ const [n, i] = this.points, s = new f(i.x - n.x, i.y - n.y);
845
+ if (s.x === 0 && s.y === 0)
846
846
  throw new Error("投影目标线段的两个点不能重合");
847
847
  let r = ((h) => {
848
- const l = new p(h.x - n.x, h.y - n.y), d = o.x * o.x + o.y * o.y, m = (l.x * o.x + l.y * o.y) / d, g = n.x + m * o.x, u = n.y + m * o.y;
849
- return new p(g, u);
848
+ const l = new f(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y, m = (l.x * s.x + l.y * s.y) / d, g = n.x + m * s.x, u = n.y + m * s.y;
849
+ return new f(g, u);
850
850
  })(t);
851
851
  if (!e) return r;
852
852
  let a = ((h) => {
853
- const l = new p(h.x - n.x, h.y - n.y), d = o.x * o.x + o.y * o.y;
854
- return (l.x * o.x + l.y * o.y) / d;
853
+ const l = new f(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y;
854
+ return (l.x * s.x + l.y * s.y) / d;
855
855
  })(r);
856
856
  return a < 0 || a > 1 ? null : r;
857
857
  }
@@ -860,15 +860,15 @@ class L {
860
860
  * @param line
861
861
  */
862
862
  intersectLineSegment(t) {
863
- const e = this.start, n = this.end, i = t.start, o = t.end;
864
- function s(d, f, m) {
865
- return (f.x - d.x) * (m.y - d.y) - (f.y - d.y) * (m.x - d.x);
863
+ const e = this.start, n = this.end, i = t.start, s = t.end;
864
+ function o(d, p, m) {
865
+ return (p.x - d.x) * (m.y - d.y) - (p.y - d.y) * (m.x - d.x);
866
866
  }
867
- function r(d, f, m) {
868
- return Math.min(f.x, m.x) - 1e-10 <= d.x && d.x <= Math.max(f.x, m.x) + 1e-10 && Math.min(f.y, m.y) - 1e-10 <= d.y && d.y <= Math.max(f.y, m.y) + 1e-10;
867
+ function r(d, p, m) {
868
+ return Math.min(p.x, m.x) - 1e-10 <= d.x && d.x <= Math.max(p.x, m.x) + 1e-10 && Math.min(p.y, m.y) - 1e-10 <= d.y && d.y <= Math.max(p.y, m.y) + 1e-10;
869
869
  }
870
- const c = s(e, n, i), a = s(e, n, o), h = s(i, o, e), l = s(i, o, n);
871
- return !!(c * a < 0 && h * l < 0 || Math.abs(c) < 1e-10 && r(i, e, n) || Math.abs(a) < 1e-10 && r(o, e, n) || Math.abs(h) < 1e-10 && r(e, i, o) || Math.abs(l) < 1e-10 && r(n, i, o));
870
+ const c = o(e, n, i), a = o(e, n, s), h = o(i, s, e), l = o(i, s, n);
871
+ return !!(c * a < 0 && h * l < 0 || Math.abs(c) < 1e-10 && r(i, e, n) || Math.abs(a) < 1e-10 && r(s, e, n) || Math.abs(h) < 1e-10 && r(e, i, s) || Math.abs(l) < 1e-10 && r(n, i, s));
872
872
  }
873
873
  /**
874
874
  * 获取交点
@@ -876,11 +876,11 @@ class L {
876
876
  * @returns
877
877
  */
878
878
  getIntersection(t) {
879
- const e = this.start, n = this.end, i = t.start, o = t.end, s = (e.x - n.x) * (i.y - o.y) - (e.y - n.y) * (i.x - o.x);
880
- if (Math.abs(s) < 1e-10)
879
+ const e = this.start, n = this.end, i = t.start, s = t.end, o = (e.x - n.x) * (i.y - s.y) - (e.y - n.y) * (i.x - s.x);
880
+ if (Math.abs(o) < 1e-10)
881
881
  return null;
882
- const r = ((e.x - i.x) * (i.y - o.y) - (e.y - i.y) * (i.x - o.x)) / s, c = e.x + r * (n.x - e.x), a = e.y + r * (n.y - e.y);
883
- return new p(c, a);
882
+ const r = ((e.x - i.x) * (i.y - s.y) - (e.y - i.y) * (i.x - s.x)) / o, c = e.x + r * (n.x - e.x), a = e.y + r * (n.y - e.y);
883
+ return new f(c, a);
884
884
  }
885
885
  /**
886
886
  * 获取两条线段夹角
@@ -918,15 +918,15 @@ class L {
918
918
  * @returns
919
919
  */
920
920
  areLinesCoincident(t) {
921
- const e = this.start, n = this.end, i = t.start, o = t.end, s = (n.y - e.y) / (n.x - e.x), r = e.y - s * e.x, c = (o.y - i.y) / (o.x - i.x), a = i.y - c * i.x;
922
- return !isFinite(s) && !isFinite(c) ? e.x === i.x && n.x === i.x : Math.abs(s - c) < 1e-3 && Math.abs(r - a) < 1e-3;
921
+ const e = this.start, n = this.end, i = t.start, s = t.end, o = (n.y - e.y) / (n.x - e.x), r = e.y - o * e.x, c = (s.y - i.y) / (s.x - i.x), a = i.y - c * i.x;
922
+ return !isFinite(o) && !isFinite(c) ? e.x === i.x && n.x === i.x : Math.abs(o - c) < 1e-3 && Math.abs(r - a) < 1e-3;
923
923
  }
924
924
  clone() {
925
- const t = new L(
925
+ const t = new b(
926
926
  this.points[0].clone(),
927
927
  this.points[1].clone()
928
928
  );
929
- return t.userData = O(this.userData), t;
929
+ return t.userData = { ...this.userData }, t;
930
930
  }
931
931
  }
932
932
  async function G(y, t = !0) {
@@ -987,7 +987,7 @@ const st = {
987
987
  function k(y) {
988
988
  const t = [];
989
989
  for (let e = 0; e < y.length; e++)
990
- t.push(new L(
990
+ t.push(new b(
991
991
  y[e].clone(),
992
992
  y[(e + 1) % y.length].clone()
993
993
  ));
@@ -1045,20 +1045,20 @@ class X extends j {
1045
1045
  async set(t, e = this.width, n = this.scale) {
1046
1046
  if (typeof t == "string")
1047
1047
  if (typeof global < "u") {
1048
- const { default: s } = await import(
1048
+ const { default: o } = await import(
1049
1049
  /* @vite-ignore */
1050
1050
  "fs"
1051
- ), r = s.readFileSync(t), c = JSON.parse(r.toString("utf-8"));
1051
+ ), r = o.readFileSync(t), c = JSON.parse(r.toString("utf-8"));
1052
1052
  return this.set(c, e, n);
1053
1053
  } else
1054
1054
  throw new Error("非node环境不允许使用路径");
1055
1055
  this.scale = n, this.width = e, this.originalData = t, this.lineSegments.length = 0;
1056
1056
  const i = [];
1057
- this.data = t.map(({ start: o, end: s, insetionArr: r, isDoor: c = !1, ...a }, h) => {
1058
- i.push(o.z ?? 0, s.z ?? 0);
1059
- const l = new L(
1060
- p.from(o).mutiplyScalar(n),
1061
- p.from(s).mutiplyScalar(n)
1057
+ this.data = t.map(({ start: s, end: o, insetionArr: r, isDoor: c = !1, ...a }, h) => {
1058
+ i.push(s.z ?? 0, o.z ?? 0);
1059
+ const l = new b(
1060
+ f.from(s).mutiplyScalar(n),
1061
+ f.from(o).mutiplyScalar(n)
1062
1062
  );
1063
1063
  return l.userData = { isDoor: c, ...a }, this.lineSegments.push(l), [
1064
1064
  l.points[0],
@@ -1067,7 +1067,7 @@ class X extends j {
1067
1067
  c,
1068
1068
  h
1069
1069
  ];
1070
- }), this.originalZAverage = i.reduce((o, s) => o + s, 0) / i.length, this.computedOriginalSize(t, this.originalBox), this.dispatchEvent({
1070
+ }), this.originalZAverage = i.reduce((s, o) => s + o, 0) / i.length, this.computedOriginalSize(t, this.originalBox), this.dispatchEvent({
1071
1071
  type: "setDta",
1072
1072
  originalData: this.originalData,
1073
1073
  data: this.data
@@ -1081,18 +1081,18 @@ class X extends j {
1081
1081
  * @returns
1082
1082
  */
1083
1083
  createGroups() {
1084
- const t = [], e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), o = (s, r, c = -1) => {
1085
- const [a, h, l, d] = this.data[s];
1086
- if (e.add(s), d)
1087
- return i.has(s) || i.set(s, []), i.get(s)?.push(c), n.add(this.data[s]);
1088
- r.push([a, h]), l.forEach((f) => {
1089
- e.has(f) || o(f, r, s);
1084
+ const t = [], e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), s = (o, r, c = -1) => {
1085
+ const [a, h, l, d] = this.data[o];
1086
+ if (e.add(o), d)
1087
+ return i.has(o) || i.set(o, []), i.get(o)?.push(c), n.add(this.data[o]);
1088
+ r.push([a, h]), l.forEach((p) => {
1089
+ e.has(p) || s(p, r, o);
1090
1090
  });
1091
1091
  };
1092
- return this.data.forEach((s, r) => {
1092
+ return this.data.forEach((o, r) => {
1093
1093
  if (!e.has(r)) {
1094
1094
  const c = [];
1095
- o(r, c), t.push(c);
1095
+ s(r, c), t.push(c);
1096
1096
  }
1097
1097
  }), this.doors = [...n], this.pointsGroups = t, t;
1098
1098
  }
@@ -1102,8 +1102,8 @@ class X extends j {
1102
1102
  * @returns
1103
1103
  */
1104
1104
  computedSize() {
1105
- const t = this.pointsGroups.flatMap((r) => r.flatMap((c) => [c[0].x, c[1].x])), e = this.pointsGroups.flatMap((r) => r.flatMap((c) => [c[0].y, c[1].y])), n = Math.min(...t), i = Math.min(...e), o = Math.max(...t), s = Math.max(...e);
1106
- return this.box.set(n, i, o, s), this.box;
1105
+ const t = this.pointsGroups.flatMap((r) => r.flatMap((c) => [c[0].x, c[1].x])), e = this.pointsGroups.flatMap((r) => r.flatMap((c) => [c[0].y, c[1].y])), n = Math.min(...t), i = Math.min(...e), s = Math.max(...t), o = Math.max(...e);
1106
+ return this.box.set(n, i, s, o), this.box;
1107
1107
  }
1108
1108
  /** 线路拓扑
1109
1109
  * @description 处理线路拓扑,使线路有序链接,形成长路径
@@ -1111,20 +1111,20 @@ class X extends j {
1111
1111
  */
1112
1112
  lineTopology(t) {
1113
1113
  const e = [];
1114
- function n(o, s) {
1115
- const [r, c] = t[o];
1116
- e[o] = !0, s.push(c);
1114
+ function n(s, o) {
1115
+ const [r, c] = t[s];
1116
+ e[s] = !0, o.push(c);
1117
1117
  for (let a = 0; a < t.length; a++) {
1118
1118
  const [h, l] = t[a];
1119
1119
  if (!e[a] && Math.abs(c.x - h.x) < 1e-6 && Math.abs(c.y - h.y) < 1e-6)
1120
- return n(a, s);
1120
+ return n(a, o);
1121
1121
  }
1122
1122
  }
1123
1123
  const i = [];
1124
- for (let o = 0; o < t.length; o++)
1125
- if (!e[o]) {
1126
- const s = [t[o][0]];
1127
- n(o, s), i.push(s);
1124
+ for (let s = 0; s < t.length; s++)
1125
+ if (!e[s]) {
1126
+ const o = [t[s][0]];
1127
+ n(s, o), i.push(o);
1128
1128
  }
1129
1129
  return i;
1130
1130
  }
@@ -1139,8 +1139,8 @@ class X extends j {
1139
1139
  }
1140
1140
  const n = [t[0]];
1141
1141
  for (let i = 1; i < t.length; i++) {
1142
- const o = t[i], s = t[i - 1];
1143
- s.includedAngle(o) < e ? s.end.copy(o.end) : n.push(o);
1142
+ const s = t[i], o = t[i - 1];
1143
+ o.includedAngle(s) < e ? o.end.copy(s.end) : n.push(s);
1144
1144
  }
1145
1145
  return n;
1146
1146
  }
@@ -1151,17 +1151,17 @@ class X extends j {
1151
1151
  if (t.length < 3) return t;
1152
1152
  const e = [t[0]];
1153
1153
  for (let n = 1; n < t.length; n++) {
1154
- const i = t[n - 1], o = t[n];
1155
- if (i.distance(o) < this.width * 0.5) {
1154
+ const i = t[n - 1], s = t[n];
1155
+ if (i.distance(s) < this.width * 0.5) {
1156
1156
  let r = 0;
1157
1157
  for (let c = n + 1; c < t.length; c++) {
1158
1158
  const a = t[c - 1], h = t[c];
1159
1159
  if (a.distance(h) < this.width * 0.8) r++;
1160
1160
  else break;
1161
1161
  }
1162
- r === 0 && n + r === t.length - 1 || n == 1 && r === 1 || (r === 3 ? (e.push(t[n + 1]), n += r) : r === 5 ? (e.push(t[n + 2]), n += r) : e.push(o));
1162
+ r === 0 && n + r === t.length - 1 || n == 1 && r === 1 || (r === 3 ? (e.push(t[n + 1]), n += r) : r === 5 ? (e.push(t[n + 2]), n += r) : e.push(s));
1163
1163
  } else
1164
- e.push(o);
1164
+ e.push(s);
1165
1165
  }
1166
1166
  return e;
1167
1167
  }
@@ -1172,26 +1172,26 @@ class X extends j {
1172
1172
  */
1173
1173
  lineSegmentStraightening(t) {
1174
1174
  for (let i = 0; i < t.length; i++) {
1175
- const o = t[i], s = t[(i + 1) % t.length];
1176
- if (o.distance(s) > this.shortLine) {
1175
+ const s = t[i], o = t[(i + 1) % t.length];
1176
+ if (s.distance(o) > this.shortLine) {
1177
1177
  t.push(...t.slice(0, i + 1)), t.splice(0, i + 1);
1178
1178
  break;
1179
1179
  }
1180
1180
  }
1181
1181
  const e = this.mergeSameDirectionLine(k(t)), n = [e[0]];
1182
1182
  for (let i = 1; i < e.length; i++) {
1183
- const o = e[i], s = e[(e.length + i - 1) % e.length];
1184
- if (o.length() > this.width * 0.9) {
1185
- n.push(o);
1183
+ const s = e[i], o = e[(e.length + i - 1) % e.length];
1184
+ if (s.length() > this.width * 0.9) {
1185
+ n.push(s);
1186
1186
  continue;
1187
1187
  }
1188
1188
  const r = e[i + 1];
1189
1189
  if (r && r.length() > this.width * 0.9) {
1190
- n.push(o), n.push(r), i = i + 1;
1190
+ n.push(s), n.push(r), i = i + 1;
1191
1191
  continue;
1192
1192
  }
1193
1193
  const c = e[i + 2];
1194
- c && s.includedAngle(c) < 2 ? (i = i + 2, n.push(c)) : n.push(o);
1194
+ c && o.includedAngle(c) < 2 ? (i = i + 2, n.push(c)) : n.push(s);
1195
1195
  }
1196
1196
  return n.length > 3 ? J(this.mergeSameDirectionLine(n)) : [];
1197
1197
  }
@@ -1201,24 +1201,24 @@ class X extends j {
1201
1201
  * @param path
1202
1202
  */
1203
1203
  removeShortLine(t, e = this.shortLine) {
1204
- const n = k(t), i = [], o = Math.PI / 180;
1205
- for (let s = 0; s < n.length; s++) {
1206
- const r = n[s], c = r.length(), a = s;
1204
+ const n = k(t), i = [], s = Math.PI / 180;
1205
+ for (let o = 0; o < n.length; o++) {
1206
+ const r = n[o], c = r.length(), a = o;
1207
1207
  if (c > e || i.length === 0) {
1208
1208
  i.push(r);
1209
1209
  continue;
1210
1210
  }
1211
- let h = n[++s];
1211
+ let h = n[++o];
1212
1212
  const l = i[i.length - 1], d = l.direction();
1213
- for (; s < n.length; ) {
1214
- const m = d.angleBetween(h.direction()) / o;
1213
+ for (; o < n.length; ) {
1214
+ const m = d.angleBetween(h.direction()) / s;
1215
1215
  if (h.length() <= e || m < 4 || m > 176)
1216
- h = n[++s];
1216
+ h = n[++o];
1217
1217
  else break;
1218
1218
  }
1219
1219
  if (!h) continue;
1220
- const f = n[s - 1];
1221
- if (l.length() > f.length()) {
1220
+ const p = n[o - 1];
1221
+ if (l.length() > p.length()) {
1222
1222
  const m = l.getIntersection(h);
1223
1223
  if (m) {
1224
1224
  const g = l.points[1].clone(), u = h.points[0].clone();
@@ -1227,7 +1227,7 @@ class X extends j {
1227
1227
  l.points[1].copy(h.points[0]);
1228
1228
  i.push(h);
1229
1229
  } else
1230
- s = a;
1230
+ o = a;
1231
1231
  }
1232
1232
  return i.length > 3 ? J(i) : [];
1233
1233
  }
@@ -1236,12 +1236,12 @@ class X extends j {
1236
1236
  */
1237
1237
  lineOffset(t = X.EndType.etOpenSquare, e = X.JoinType.jtMiter, n = 1e4) {
1238
1238
  let i = new F.Paths();
1239
- const o = new F.ClipperOffset(20, 0.25);
1240
- return this.pointsGroups.forEach((s) => {
1241
- const r = this.lineTopology(s).map((c) => c.map((a) => a.clone().mutiplyScalar(n)));
1242
- o.AddPaths(r, e, t);
1243
- }), o.Execute(i, this.width / 2 * n), this.wallsGroup = i.map((s) => {
1244
- let r = s.map((c) => p.from(c).divisionScalar(n));
1239
+ const s = new F.ClipperOffset(20, 0.25);
1240
+ return this.pointsGroups.forEach((o) => {
1241
+ const r = this.lineTopology(o).map((c) => c.map((a) => a.clone().mutiplyScalar(n)));
1242
+ s.AddPaths(r, e, t);
1243
+ }), s.Execute(i, this.width / 2 * n), this.wallsGroup = i.map((o) => {
1244
+ let r = o.map((c) => f.from(c).divisionScalar(n));
1245
1245
  return r = this.lineSegmentStraightening(r), t == X.EndType.etOpenSquare && (r = this.squareRemoveBurr(r)), r = this.removeShortLine(r), r;
1246
1246
  }), this.dispatchEvent({
1247
1247
  type: "lineOffset",
@@ -1254,9 +1254,9 @@ class X extends j {
1254
1254
  to3DArray(t, e = this.originalZAverage) {
1255
1255
  const n = [];
1256
1256
  return this.wallsGroup.forEach((i) => {
1257
- for (let o = 0; o < i.length; o++) {
1258
- const s = i[o], r = o === i.length - 1 ? 0 : o + 1, c = i[r];
1259
- n.push(s.X * t, s.Y * t, e, c.X * t, c.Y * t, e);
1257
+ for (let s = 0; s < i.length; s++) {
1258
+ const o = i[s], r = s === i.length - 1 ? 0 : s + 1, c = i[r];
1259
+ n.push(o.X * t, o.Y * t, e, c.X * t, c.Y * t, e);
1260
1260
  }
1261
1261
  }), new Float32Array(n);
1262
1262
  }
@@ -1267,8 +1267,8 @@ class X extends j {
1267
1267
  * @returns
1268
1268
  */
1269
1269
  getArcAngleRange(t, e, n) {
1270
- const i = e.x - t.x, o = e.y - t.y, s = n.x - t.x, r = n.y - t.y;
1271
- let c = Math.atan2(o, i), a = Math.atan2(r, s);
1270
+ const i = e.x - t.x, s = e.y - t.y, o = n.x - t.x, r = n.y - t.y;
1271
+ let c = Math.atan2(s, i), a = Math.atan2(r, o);
1272
1272
  c = c < 0 ? c + 2 * Math.PI : c, a = a < 0 ? a + 2 * Math.PI : a;
1273
1273
  let h, l;
1274
1274
  return Math.abs(a - c) <= Math.PI ? (h = Math.min(c, a), l = Math.max(c, a)) : (h = Math.max(c, a), l = Math.min(c, a) + 2 * Math.PI), [h / (Math.PI / 180), l / (Math.PI / 180)];
@@ -1288,10 +1288,10 @@ class X extends j {
1288
1288
  scale: e
1289
1289
  };
1290
1290
  let i = "white";
1291
- function o(a, h) {
1291
+ function s(a, h) {
1292
1292
  n.line.push([a.X * e, a.Y * e, h.X * e, h.Y * e, i]);
1293
1293
  }
1294
- function s(a, h, l, d) {
1294
+ function o(a, h, l, d) {
1295
1295
  n.arc.push([
1296
1296
  a.x * e,
1297
1297
  a.y * e,
@@ -1310,8 +1310,8 @@ class X extends j {
1310
1310
  }
1311
1311
  this.wallsGroup.forEach((a) => {
1312
1312
  for (let h = 0; h < a.length; h++) {
1313
- const l = a[h], d = h === a.length - 1 ? 0 : h + 1, f = a[d];
1314
- o(l, f);
1313
+ const l = a[h], d = h === a.length - 1 ? 0 : h + 1, p = a[d];
1314
+ s(l, p);
1315
1315
  }
1316
1316
  });
1317
1317
  const r = this.width * 0.2, c = [];
@@ -1321,29 +1321,29 @@ class X extends j {
1321
1321
  if (i = "cyan", h.length() < 1.2) {
1322
1322
  h.expansion(-r * 0.5);
1323
1323
  const l = a.normal();
1324
- let d = new L(
1324
+ let d = new b(
1325
1325
  h.start.clone(),
1326
1326
  h.start.clone().add(l.clone().multiplyScalar(h.length()))
1327
1327
  );
1328
- const f = d.clone().directionMove(d.normal(), h.length() * -0.5).expandToRectangle(h.length(), "bothSides");
1329
- for (let b = 0; b < c.length; b++)
1330
- if (c[b].intersectRectangle(f)) {
1331
- d = new L(
1328
+ const p = d.clone().directionMove(d.normal(), h.length() * -0.5).expandToRectangle(h.length(), "bothSides");
1329
+ for (let L = 0; L < c.length; L++)
1330
+ if (c[L].intersectRectangle(p)) {
1331
+ d = new b(
1332
1332
  h.start.clone(),
1333
1333
  h.start.clone().add(l.clone().multiplyScalar(-h.length()))
1334
1334
  );
1335
1335
  break;
1336
1336
  }
1337
- d.expansion(-r * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((b, P) => o(b, P));
1337
+ d.expansion(-r * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((L, P) => s(L, P));
1338
1338
  const m = h.length(), g = d.length(), u = (m ** 2 + g ** 2) / (2 * g), x = d.end.clone().add(d.direction().multiplyScalar(-u)), [w, S] = this.getArcAngleRange(x, h.end, d.end);
1339
- s(x, u, Math.min(w, S), Math.max(w, S)), c.push(f);
1339
+ o(x, u, Math.min(w, S), Math.max(w, S)), c.push(p);
1340
1340
  } else
1341
- h.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((l, d) => o(l, d)), h.clone().directionMove(h.normal(), r * 0.5).directionMove(h.direction(), r * 0.5).expansion(-h.length() * 0.45, "end").forward(r * 0.5).expandToRectangle(r).path2D((l, d) => o(l, d)), h.clone().directionMove(h.normal(), -r * 0.5).directionMove(h.direction(), -r * 0.5).expansion(-h.length() * 0.45, "start").forward(-r * 0.5).expandToRectangle(r).path2D((l, d) => o(l, d));
1341
+ h.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((l, d) => s(l, d)), h.clone().directionMove(h.normal(), r * 0.5).directionMove(h.direction(), r * 0.5).expansion(-h.length() * 0.45, "end").forward(r * 0.5).expandToRectangle(r).path2D((l, d) => s(l, d)), h.clone().directionMove(h.normal(), -r * 0.5).directionMove(h.direction(), -r * 0.5).expansion(-h.length() * 0.45, "start").forward(-r * 0.5).expandToRectangle(r).path2D((l, d) => s(l, d));
1342
1342
  }), i = "yellow", this.lineSegments.forEach((a) => {
1343
1343
  if (!a.userData.isWindow) return !1;
1344
1344
  Array.isArray(a.userData.drawWindow) && a.userData.drawWindow.forEach((h) => {
1345
- const { p: l, width: d } = h, f = p.from(l), m = f.clone().add(a.direction().multiplyScalar(d * 0.5)), g = f.clone().add(a.direction().multiplyScalar(-d * 0.5)), u = new L(m, g);
1346
- o(u.start, u.end), u.expandToRectangle(this.width, "bothSides").path2D((x, w) => o(x, w));
1345
+ const { p: l, width: d } = h, p = f.from(l), m = p.clone().add(a.direction().multiplyScalar(d * 0.5)), g = p.clone().add(a.direction().multiplyScalar(-d * 0.5)), u = new b(m, g);
1346
+ s(u.start, u.end), u.expandToRectangle(this.width, "bothSides").path2D((x, w) => s(x, w));
1347
1347
  });
1348
1348
  }), n;
1349
1349
  }
@@ -1351,36 +1351,36 @@ class X extends j {
1351
1351
  *
1352
1352
  * @param type
1353
1353
  */
1354
- async toDxfImageBlob(t = "Centimeters", e = "image/jpeg") {
1355
- const n = this.toDrawDataJson(t);
1356
- let i;
1354
+ async toDxfImageBlob(t = "Centimeters", e = "image/jpeg", n = "#000") {
1355
+ const i = this.toDrawDataJson(t);
1356
+ let s;
1357
1357
  if (typeof window < "u")
1358
- i = document.createElement("canvas");
1358
+ s = document.createElement("canvas");
1359
1359
  else if (typeof global < "u") {
1360
- const { createCanvas: c } = await G("canvas");
1361
- i = c();
1360
+ const { createCanvas: a } = await G("canvas");
1361
+ s = a();
1362
1362
  } else
1363
1363
  throw new Error("创建画布失败");
1364
- const o = 2 * n.scale, s = {
1364
+ const o = 2 * i.scale, r = {
1365
1365
  cyan: "cyan",
1366
1366
  yellow: "yellow",
1367
1367
  white: "white"
1368
1368
  };
1369
- i.width = n.width + o * 2, i.height = n.height + o * 2;
1370
- const r = i.getContext("2d");
1371
- return r.fillRect(0, 0, i.width, i.height), r.translate(n.width * 0.5 + o, n.height * 0.5 + o), n.line.forEach(([c, a, h, l, d]) => {
1372
- r.strokeStyle = s[d], r.beginPath(), r.moveTo(c, a), r.lineTo(h, l), r.closePath(), r.stroke();
1373
- }), n.arc.forEach(([c, a, h, l, d, f]) => {
1374
- r.strokeStyle = s[f], r.beginPath(), r.arc(c, a, h, l * (Math.PI / 180), d * (Math.PI / 180)), r.stroke();
1375
- }), r.beginPath(), n.dimensionLine.forEach((c) => {
1376
- let [a, h, l, d] = c;
1377
- const f = Math.min(h, d), m = Math.max(h, d), g = (i.width * 0.5 - 0.4 * n.scale) * (a < 0 ? -1 : 1), u = (m - f) * 0.45;
1378
- r.fillStyle = "#fff", r.font = `${0.15 * n.scale}px Arial`, r.textAlign = "center", r.textBaseline = "middle", r.fillText((m - f).toFixed(2) + "cm", g, f + (m - f) * 0.5), r.moveTo(g - 0.1 * n.scale, f), r.lineTo(g + 0.1 * n.scale, f), r.moveTo(g, f), r.lineTo(g, u + f), r.moveTo(g, m), r.lineTo(g, m - u), r.moveTo(g - 0.1 * n.scale, m), r.lineTo(g + 0.1 * n.scale, m);
1379
- }), r.closePath(), r.strokeStyle = "#fff", r.stroke(), "toBlob" in i ? new Promise((c) => {
1380
- i.toBlob((a) => {
1381
- c(a);
1369
+ s.width = i.width + o * 2, s.height = i.height + o * 2;
1370
+ const c = s.getContext("2d");
1371
+ return n && (c.fillStyle = n, c.fillRect(0, 0, s.width, s.height)), c.translate(i.width * 0.5 + o, i.height * 0.5 + o), i.line.forEach(([a, h, l, d, p]) => {
1372
+ c.strokeStyle = r[p], c.beginPath(), c.moveTo(a, h), c.lineTo(l, d), c.closePath(), c.stroke();
1373
+ }), i.arc.forEach(([a, h, l, d, p, m]) => {
1374
+ c.strokeStyle = r[m], c.beginPath(), c.arc(a, h, l, d * (Math.PI / 180), p * (Math.PI / 180)), c.stroke();
1375
+ }), c.beginPath(), i.dimensionLine.forEach((a) => {
1376
+ let [h, l, d, p] = a;
1377
+ const m = Math.min(l, p), g = Math.max(l, p), u = (s.width * 0.5 - 0.4 * i.scale) * (h < 0 ? -1 : 1), x = (g - m) * 0.45;
1378
+ c.fillStyle = "#fff", c.font = `${0.15 * i.scale}px Arial`, c.textAlign = "center", c.textBaseline = "middle", c.fillText((g - m).toFixed(2) + "cm", u, m + (g - m) * 0.5), c.moveTo(u - 0.1 * i.scale, m), c.lineTo(u + 0.1 * i.scale, m), c.moveTo(u, m), c.lineTo(u, x + m), c.moveTo(u, g), c.lineTo(u, g - x), c.moveTo(u - 0.1 * i.scale, g), c.lineTo(u + 0.1 * i.scale, g);
1379
+ }), c.closePath(), c.strokeStyle = "#fff", c.stroke(), "toBlob" in s ? new Promise((a) => {
1380
+ s.toBlob((h) => {
1381
+ a(h);
1382
1382
  }, e, 1);
1383
- }) : i.toBuffer(e, { quality: 1 });
1383
+ }) : s.toBuffer(e, { quality: 1 });
1384
1384
  }
1385
1385
  /**
1386
1386
  * 将点json结构转换为Dxf string
@@ -1390,11 +1390,11 @@ class X extends j {
1390
1390
  e.setUnits(t), e.addLayer("cyan", R.ACI.CYAN, "DOTTED"), e.addLayer("yellow", R.ACI.YELLOW, "DOTTED"), e.addLayer("white", R.ACI.WHITE, "DOTTED");
1391
1391
  const n = this.toDrawDataJson();
1392
1392
  return n.line.forEach((i) => {
1393
- let [o, s, r, c, a] = i;
1394
- e.setActiveLayer(a), e.drawLine(o, s, r, c);
1393
+ let [s, o, r, c, a] = i;
1394
+ e.setActiveLayer(a), e.drawLine(s, o, r, c);
1395
1395
  }), n.arc.forEach((i) => {
1396
- const [o, s, r, c, a, h] = i;
1397
- e.setActiveLayer(h), e.drawArc(o, s, r, c, a);
1396
+ const [s, o, r, c, a, h] = i;
1397
+ e.setActiveLayer(h), e.drawArc(s, o, r, c, a);
1398
1398
  }), e.toDxfString();
1399
1399
  }
1400
1400
  /**
@@ -1422,8 +1422,8 @@ class X extends j {
1422
1422
  const i = await this.toDxfImageBlob(e, n);
1423
1423
  if (!i) return !1;
1424
1424
  if (typeof window < "u") {
1425
- const o = document.createElement("a");
1426
- o.href = URL.createObjectURL(i), o.download = t, o.click();
1425
+ const s = document.createElement("a");
1426
+ s.href = URL.createObjectURL(i), s.download = t, s.click();
1427
1427
  } else typeof global < "u" ? (await G("fs", !1)).writeFileSync(t, i) : console.error("图片下载失败");
1428
1428
  return !0;
1429
1429
  }
@@ -1433,8 +1433,8 @@ class X extends j {
1433
1433
  * @returns
1434
1434
  */
1435
1435
  computedOriginalSize(t, e = new v(0, 0, 0, 0)) {
1436
- const n = t.flatMap((a) => [a.start.x, a.end.x]), i = t.flatMap((a) => [a.start.y, a.end.y]), o = Math.min(...n), s = Math.min(...i), r = Math.max(...n), c = Math.max(...i);
1437
- return e.set(o, s, r, c), e;
1436
+ const n = t.flatMap((a) => [a.start.x, a.end.x]), i = t.flatMap((a) => [a.start.y, a.end.y]), s = Math.min(...n), o = Math.min(...i), r = Math.max(...n), c = Math.max(...i);
1437
+ return e.set(s, o, r, c), e;
1438
1438
  }
1439
1439
  /**
1440
1440
  * 创建数据
@@ -1443,9 +1443,9 @@ class X extends j {
1443
1443
  */
1444
1444
  static createData(t, e = !0) {
1445
1445
  let n = 0;
1446
- return t.flatMap((o) => {
1447
- const s = o.map((r, c) => {
1448
- const a = c === o.length - 1 ? 0 : c + 1, h = o[a];
1446
+ return t.flatMap((s) => {
1447
+ const o = s.map((r, c) => {
1448
+ const a = c === s.length - 1 ? 0 : c + 1, h = s[a];
1449
1449
  return {
1450
1450
  start: { x: r.x, y: r.y },
1451
1451
  end: { x: h.x, y: h.y },
@@ -1456,51 +1456,52 @@ class X extends j {
1456
1456
  ]
1457
1457
  };
1458
1458
  });
1459
- return n += o.length, e || (s.pop(), s[s.length - 1].insetionArr.length = 0, n--), s;
1459
+ return n += s.length, e || (o.pop(), o[o.length - 1].insetionArr.length = 0, n--), o;
1460
1460
  });
1461
1461
  }
1462
1462
  }
1463
- const I = new L();
1463
+ const I = new b();
1464
1464
  class ot extends X {
1465
1465
  static name = "AngleCorrectionDxf";
1466
1466
  onAddFromParent(t) {
1467
- const e = t.findComponentByName("Dxf"), n = t.findComponentByName("LineAnalysis");
1468
- n.addEventListener("analysisCompleted", async () => {
1469
- let i = 0, o = null;
1470
- for (let a = 0; a < e.originalData.length; a++) {
1471
- const h = e.originalData[a];
1472
- if (I.start.copy(h.start), I.end.copy(h.end), h.isVerticalReferenceLine) {
1473
- const [l, d] = h.start.y < h.end.y ? [I.start, I.end] : [I.end, I.start];
1474
- i = -new L(l, d).direction().angleBetween(new p(0, 1), "angle", "360"), o = null;
1475
- break;
1476
- }
1477
- (!o || I.length() > o.length()) && (o = I.clone(), o.userData.index = a);
1478
- }
1479
- if (o) {
1480
- e.originalData[o.userData.index].isVerticalReferenceLine = !0;
1481
- const [a, h] = o.start.y < o.end.y ? [o.start, o.end] : [o.end, o.start];
1482
- i = -new L(a, h).direction().angleBetween(new p(0, 1), "angle", "360");
1467
+ t.findComponentByName("LineAnalysis").addEventListener("analysisCompleted", async () => this.update());
1468
+ }
1469
+ async update() {
1470
+ const t = this.parent, e = t.findComponentByName("Dxf"), n = t.findComponentByName("LineAnalysis");
1471
+ let i = 0, s = null;
1472
+ for (let a = 0; a < e.originalData.length; a++) {
1473
+ const h = e.originalData[a];
1474
+ if (I.start.copy(h.start), I.end.copy(h.end), h.isVerticalReferenceLine) {
1475
+ const [l, d] = h.start.y < h.end.y ? [I.start, I.end] : [I.end, I.start];
1476
+ i = -new b(l, d).direction().angleBetween(new f(0, 1), "angle", "360"), s = null;
1477
+ break;
1483
1478
  }
1484
- const s = e.originalBox.center, r = p.zero(), c = e.originalData.map((a) => {
1485
- const h = r.copy(a.start).division(s).rotate(p.zero(), i * (Math.PI / 180)).toJson(a.start.z), l = r.copy(a.end).division(s).rotate(p.zero(), i * (Math.PI / 180)).toJson(a.end.z), d = Object.assign(O(a), { start: h, end: l });
1486
- return d.drawWindow && d.drawWindow.forEach((f) => {
1487
- f.p = r.copy(f.p).division(s).rotate(p.zero(), i * (Math.PI / 180)).toJson(f.p.z), f.p.y = -f.p.y;
1488
- }), d;
1489
- });
1490
- n.appendLineSegmentList.forEach((a) => {
1491
- const h = a.clone();
1492
- h.start.division(s).rotate(p.zero(), i * (Math.PI / 180)), h.end.division(s).rotate(p.zero(), i * (Math.PI / 180)), c.push({
1493
- start: h.start.toJson(e.originalZAverage),
1494
- end: h.end.toJson(e.originalZAverage),
1495
- insetionArr: [],
1496
- length: h.length()
1497
- });
1498
- }), c.forEach((a) => {
1499
- a.start.y = -a.start.y, a.end.y = -a.end.y;
1500
- }), await this.set(c, e.width, e.scale), this.lineOffset(), this.doorLineSegment = e.doorLineSegment.map((a) => {
1501
- const h = a.clone();
1502
- return h.start.division(s).rotate(p.zero(), i * (Math.PI / 180)), h.end.division(s).rotate(p.zero(), i * (Math.PI / 180)), h.start.y = -h.start.y, h.end.y = -h.end.y, h;
1479
+ (!s || I.length() > s.length()) && (s = I.clone(), s.userData.index = a);
1480
+ }
1481
+ if (s) {
1482
+ e.originalData[s.userData.index].isVerticalReferenceLine = !0;
1483
+ const [a, h] = s.start.y < s.end.y ? [s.start, s.end] : [s.end, s.start];
1484
+ i = -new b(a, h).direction().angleBetween(new f(0, 1), "angle", "360");
1485
+ }
1486
+ const o = e.originalBox.center, r = f.zero(), c = e.originalData.map((a) => {
1487
+ const h = r.copy(a.start).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(a.start.z), l = r.copy(a.end).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(a.end.z), d = Object.assign(z(a), { start: h, end: l });
1488
+ return d.drawWindow && d.drawWindow.forEach((p) => {
1489
+ p.p = r.copy(p.p).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(p.p.z), p.p.y = -p.p.y;
1490
+ }), d;
1491
+ });
1492
+ n.appendLineSegmentList.forEach((a) => {
1493
+ const h = a.clone();
1494
+ h.start.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(f.zero(), i * (Math.PI / 180)), c.push({
1495
+ start: h.start.toJson(e.originalZAverage),
1496
+ end: h.end.toJson(e.originalZAverage),
1497
+ insetionArr: [],
1498
+ length: h.length()
1503
1499
  });
1500
+ }), c.forEach((a) => {
1501
+ a.start.y = -a.start.y, a.end.y = -a.end.y;
1502
+ }), await this.set(c, e.width, e.scale), this.lineOffset(), this.doorLineSegment = e.doorLineSegment.map((a) => {
1503
+ const h = a.clone();
1504
+ return h.start.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.start.y = -h.start.y, h.end.y = -h.end.y, h;
1504
1505
  });
1505
1506
  }
1506
1507
  }
@@ -1586,9 +1587,9 @@ class q {
1586
1587
  * @returns 象限索引(0:西北,1:东北,2:西南,3:东南)或-1(跨多个象限)
1587
1588
  */
1588
1589
  getQuadrant(t) {
1589
- const e = this.children[0].bounds.intersectLineSegment(t), n = this.children[1].bounds.intersectLineSegment(t), i = this.children[2].bounds.intersectLineSegment(t), o = this.children[3].bounds.intersectLineSegment(t);
1590
- let s = 0, r = -1;
1591
- return e && (s++, r = 0), n && (s++, r = 1), i && (s++, r = 2), o && (s++, r = 3), s === 1 ? r : -1;
1590
+ const e = this.children[0].bounds.intersectLineSegment(t), n = this.children[1].bounds.intersectLineSegment(t), i = this.children[2].bounds.intersectLineSegment(t), s = this.children[3].bounds.intersectLineSegment(t);
1591
+ let o = 0, r = -1;
1592
+ return e && (o++, r = 0), n && (o++, r = 1), i && (o++, r = 2), s && (o++, r = 3), o === 1 ? r : -1;
1592
1593
  }
1593
1594
  /**
1594
1595
  * 细分当前节点为四个子节点
@@ -1650,16 +1651,16 @@ class q {
1650
1651
  );
1651
1652
  if (!this.bounds.intersectBox(i))
1652
1653
  return n;
1653
- for (const o of this.nodes) {
1654
- const [s, r] = o.line.points, c = r.x - s.x, a = r.y - s.y, h = c * c + a * a;
1655
- let l = ((t.x - s.x) * c + (t.y - s.y) * a) / h;
1654
+ for (const s of this.nodes) {
1655
+ const [o, r] = s.line.points, c = r.x - o.x, a = r.y - o.y, h = c * c + a * a;
1656
+ let l = ((t.x - o.x) * c + (t.y - o.y) * a) / h;
1656
1657
  l = Math.max(0, Math.min(1, l));
1657
- const d = s.x + l * c, f = s.y + l * a;
1658
- t.distance(new p(d, f)) <= e && n.push(o);
1658
+ const d = o.x + l * c, p = o.y + l * a;
1659
+ t.distance(new f(d, p)) <= e && n.push(s);
1659
1660
  }
1660
1661
  if (!this.isLeaf)
1661
- for (const o of this.children)
1662
- n.push(...o.queryCircle(t, e));
1662
+ for (const s of this.children)
1663
+ n.push(...s.queryCircle(t, e));
1663
1664
  return n;
1664
1665
  }
1665
1666
  /**
@@ -1701,8 +1702,8 @@ class q {
1701
1702
  * @returns
1702
1703
  */
1703
1704
  boundsToArray(t = [], e, n = !0) {
1704
- return !this.isLeaf && n && this.children?.forEach((i) => i.boundsToArray(t, e)), t.push(...this.bounds.points.flatMap((i, o, s) => {
1705
- const r = s[(o + 1) % s.length];
1705
+ return !this.isLeaf && n && this.children?.forEach((i) => i.boundsToArray(t, e)), t.push(...this.bounds.points.flatMap((i, s, o) => {
1706
+ const r = o[(s + 1) % o.length];
1706
1707
  return e?.push(...this.color), e?.push(...this.color), [i.x, i.y, 0, r.x, r.y, 0];
1707
1708
  })), t;
1708
1709
  }
@@ -1723,8 +1724,8 @@ class U {
1723
1724
  throw new Error("无效的点坐标");
1724
1725
  const n = this.getGridId(t);
1725
1726
  this.map.has(n) || this.map.set(n, /* @__PURE__ */ new Set());
1726
- const i = this.map.get(n), o = { point: t, userData: e };
1727
- i.add(o), t.userData.pointVirtualGrid = { set: i, target: o };
1727
+ const i = this.map.get(n), s = { point: t, userData: e };
1728
+ i.add(s), t.userData.pointVirtualGrid = { set: i, target: s };
1728
1729
  }
1729
1730
  /**
1730
1731
  * 批量加入
@@ -1757,7 +1758,7 @@ class U {
1757
1758
  */
1758
1759
  decodeGridId(t) {
1759
1760
  const [e, n] = t.split(".").map(Number);
1760
- return new p(e, n);
1761
+ return new f(e, n);
1761
1762
  }
1762
1763
  /**
1763
1764
  * 查询与矩形相交的点
@@ -1765,9 +1766,9 @@ class U {
1765
1766
  * @returns 相交的节点数组
1766
1767
  */
1767
1768
  queryRect(t) {
1768
- const e = t.toBox(), n = Math.ceil(e.minX / this.gridSize), i = Math.ceil(e.maxX / this.gridSize), o = Math.ceil(e.minY / this.gridSize), s = Math.ceil(e.maxY / this.gridSize);
1769
+ const e = t.toBox(), n = Math.ceil(e.minX / this.gridSize), i = Math.ceil(e.maxX / this.gridSize), s = Math.ceil(e.minY / this.gridSize), o = Math.ceil(e.maxY / this.gridSize);
1769
1770
  for (let r = n; r <= i; r++)
1770
- for (let c = o; c <= s; c++) {
1771
+ for (let c = s; c <= o; c++) {
1771
1772
  const a = `${r}.${c}`;
1772
1773
  if (!this.map.has(a)) continue;
1773
1774
  this.map.get(a)?.forEach((l) => {
@@ -1782,13 +1783,13 @@ class U {
1782
1783
  * @returns 相交的节点数组
1783
1784
  */
1784
1785
  queryCircle(t, e) {
1785
- const n = new v(t.x - e, t.x + e, t.y - e, t.y + e), i = Math.ceil(n.minX / this.gridSize), o = Math.ceil(n.maxX / this.gridSize), s = Math.ceil(n.minY / this.gridSize), r = Math.ceil(n.maxY / this.gridSize), c = [];
1786
- for (let a = i; a <= o; a++)
1787
- for (let h = s; h <= r; h++) {
1786
+ const n = new v(t.x - e, t.x + e, t.y - e, t.y + e), i = Math.ceil(n.minX / this.gridSize), s = Math.ceil(n.maxX / this.gridSize), o = Math.ceil(n.minY / this.gridSize), r = Math.ceil(n.maxY / this.gridSize), c = [];
1787
+ for (let a = i; a <= s; a++)
1788
+ for (let h = o; h <= r; h++) {
1788
1789
  const l = `${a}.${h}`;
1789
1790
  if (!this.map.has(l)) continue;
1790
- this.map.get(l)?.forEach((f) => {
1791
- t.distance(f.point) <= e && c.push(f);
1791
+ this.map.get(l)?.forEach((p) => {
1792
+ t.distance(p.point) <= e && c.push(p);
1792
1793
  });
1793
1794
  }
1794
1795
  return c;
@@ -1799,16 +1800,16 @@ class U {
1799
1800
  * @returns 相交的节点数组
1800
1801
  */
1801
1802
  queryBox(t) {
1802
- const e = Math.ceil(t.minX / this.gridSize), n = Math.ceil(t.maxX / this.gridSize), i = Math.ceil(t.minY / this.gridSize), o = Math.ceil(t.maxY / this.gridSize), s = [];
1803
+ const e = Math.ceil(t.minX / this.gridSize), n = Math.ceil(t.maxX / this.gridSize), i = Math.ceil(t.minY / this.gridSize), s = Math.ceil(t.maxY / this.gridSize), o = [];
1803
1804
  for (let r = e; r <= n; r++)
1804
- for (let c = i; c <= o; c++) {
1805
+ for (let c = i; c <= s; c++) {
1805
1806
  const a = `${r}.${c}`;
1806
1807
  if (!this.map.has(a)) continue;
1807
1808
  this.map.get(a)?.forEach((l) => {
1808
- t.containsPoint(l.point) && s.push(l);
1809
+ t.containsPoint(l.point) && o.push(l);
1809
1810
  });
1810
1811
  }
1811
- return s;
1812
+ return o;
1812
1813
  }
1813
1814
  /**
1814
1815
  * 查找相同点
@@ -1816,8 +1817,8 @@ class U {
1816
1817
  */
1817
1818
  queryPoint(t) {
1818
1819
  const e = this.getGridId(t), n = [];
1819
- return this.map.has(e) && this.map.get(e)?.forEach((o) => {
1820
- t.equal(o.point) && n.push(o);
1820
+ return this.map.has(e) && this.map.get(e)?.forEach((s) => {
1821
+ t.equal(s.point) && n.push(s);
1821
1822
  }), n;
1822
1823
  }
1823
1824
  }
@@ -1844,16 +1845,16 @@ class rt {
1844
1845
  this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
1845
1846
  }), this.doorPoint = this.getDoorPoint(), !this.continueFind) return;
1846
1847
  const e = this.searchDoubleLinePoint();
1847
- this.addPointsExcludeRule((n, i, o) => {
1848
- const s = this.lineSegments.indexOf(n), r = e.get(s);
1849
- return typeof r == "number" ? r === -1 || r === o : !1;
1850
- }), this.addPointsExcludeRule((n, i) => !!this.doorPoint.find((o) => o.point.equal(i))), this.possibleDoorPoints = this.getPossiblePoints(), this.possibleDoorPoints.forEach((n) => this.findPointVirtualGrid.insert(n.point, n.line)), this.handle();
1848
+ this.addPointsExcludeRule((n, i, s) => {
1849
+ const o = this.lineSegments.indexOf(n), r = e.get(o);
1850
+ return typeof r == "number" ? r === -1 || r === s : !1;
1851
+ }), this.addPointsExcludeRule((n, i) => !!this.doorPoint.find((s) => s.point.equal(i))), this.possibleDoorPoints = this.getPossiblePoints(), this.possibleDoorPoints.forEach((n) => this.findPointVirtualGrid.insert(n.point, n.line)), this.handle();
1851
1852
  }
1852
1853
  handle() {
1853
1854
  this.dxf.doorLineSegment.push(...this.search(this.doorPoint, this.possibleDoorPoints, 0.5)), this.doorPoint.length < 2 && this.dxf.doorLineSegment.push(...this.search(this.possibleDoorPoints, this.possibleDoorPoints, 0.6));
1854
1855
  }
1855
- search(t, e = [], n = 0.6, i = this.doorSearchDistance, o = this.doorSearchNearAngle) {
1856
- const s = this.dxf, r = this.searchNearby(t, e, i, o);
1856
+ search(t, e = [], n = 0.6, i = this.doorSearchDistance, s = this.doorSearchNearAngle) {
1857
+ const o = this.dxf, r = this.searchNearby(t, e, i, s);
1857
1858
  r.push(
1858
1859
  ...t.map((a) => {
1859
1860
  const h = this.searchAlongDirection(a, i);
@@ -1870,11 +1871,11 @@ class rt {
1870
1871
  );
1871
1872
  const c = [];
1872
1873
  return r.forEach((a) => {
1873
- const h = new L(a?.start, a?.end), l = h.length();
1874
+ const h = new b(a?.start, a?.end), l = h.length();
1874
1875
  if (l < n) return;
1875
- const d = h.normal(), f = h.direction(), m = (l - s.width * 2) / 2;
1876
+ const d = h.normal(), p = h.direction(), m = (l - o.width * 2) / 2;
1876
1877
  for (let g = 0; g < 3; g++) {
1877
- const u = h.start.clone().add(f.clone().multiplyScalar(s.width + m * g)), x = new L(
1878
+ const u = h.start.clone().add(p.clone().multiplyScalar(o.width + m * g)), x = new b(
1878
1879
  u,
1879
1880
  u.clone().add(d.clone().multiplyScalar(1))
1880
1881
  );
@@ -1897,8 +1898,8 @@ class rt {
1897
1898
  const t = [];
1898
1899
  return this.lineSegments.forEach((e) => {
1899
1900
  e.points.forEach((n, i) => {
1900
- for (let s = 0; s < this._pointsExcludeRule.length; s++) if (this._pointsExcludeRule[s](e, n, i)) return;
1901
- this.pointVirtualGrid.queryPoint(n).filter((s) => s.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: z() });
1901
+ for (let o = 0; o < this._pointsExcludeRule.length; o++) if (this._pointsExcludeRule[o](e, n, i)) return;
1902
+ this.pointVirtualGrid.queryPoint(n).filter((o) => o.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: N() });
1902
1903
  });
1903
1904
  }), t;
1904
1905
  }
@@ -1908,23 +1909,23 @@ class rt {
1908
1909
  getDoorPoint() {
1909
1910
  const t = [], e = this.dxf, n = this.pointVirtualGrid;
1910
1911
  return e.doors.forEach((i) => {
1911
- const o = e.lineSegments[i[4]], s = e.originalData[i[4]];
1912
- if (s.drawDoorData) {
1913
- const r = p.from(s.drawDoorData.start), c = p.from(s.drawDoorData.n), a = n.queryPoint(r).filter((h) => {
1914
- if (h.userData === o) return !1;
1912
+ const s = e.lineSegments[i[4]], o = e.originalData[i[4]];
1913
+ if (o.drawDoorData) {
1914
+ const r = f.from(o.drawDoorData.start), c = f.from(o.drawDoorData.n), a = n.queryPoint(r).filter((h) => {
1915
+ if (h.userData === s) return !1;
1915
1916
  const l = h.userData, d = l.direction();
1916
1917
  l.start.equal(r) && d.multiplyScalar(-1);
1917
- const f = c.angleBetween(d, "angle");
1918
- return f > 80 || f < 10;
1918
+ const p = c.angleBetween(d, "angle");
1919
+ return p > 80 || p < 10;
1919
1920
  });
1920
1921
  a.length && t.push({
1921
1922
  line: a[0].userData,
1922
1923
  point: r,
1923
- uuid: z()
1924
+ uuid: N()
1924
1925
  });
1925
- } else if (s.doorDirectConnection) {
1926
+ } else if (o.doorDirectConnection) {
1926
1927
  this.continueFind = !1;
1927
- const r = new L(p.from(s.start), p.from(s.end));
1928
+ const r = new b(f.from(o.start), f.from(o.end));
1928
1929
  r.userData = {
1929
1930
  doorDirectConnection: !0,
1930
1931
  isDoor: !0
@@ -1940,7 +1941,7 @@ class rt {
1940
1941
  searchDoubleLinePoint() {
1941
1942
  const t = /* @__PURE__ */ new Map();
1942
1943
  return this.resultList.flatMap((e) => {
1943
- const n = this.lineSegments[e.sourceIndex], i = this.lineSegments[e.targetIndex], o = i.projectPoint(n.start), s = i.projectPoint(n.end), r = n.projectPoint(i.start), c = n.projectPoint(i.end), a = o && s ? -1 : o ? 0 : s ? 1 : -1, h = r && c ? -1 : r ? 0 : c ? 1 : -1;
1944
+ const n = this.lineSegments[e.sourceIndex], i = this.lineSegments[e.targetIndex], s = i.projectPoint(n.start), o = i.projectPoint(n.end), r = n.projectPoint(i.start), c = n.projectPoint(i.end), a = s && o ? -1 : s ? 0 : o ? 1 : -1, h = r && c ? -1 : r ? 0 : c ? 1 : -1;
1944
1945
  t.has(e.sourceIndex) ? t.get(e.sourceIndex) != a && t.set(e.sourceIndex, -1) : t.set(e.sourceIndex, a), t.has(e.targetIndex) ? t.get(e.targetIndex) != h && t.set(e.targetIndex, -1) : t.set(e.targetIndex, h);
1945
1946
  }), t;
1946
1947
  }
@@ -1953,19 +1954,19 @@ class rt {
1953
1954
  * @returns
1954
1955
  */
1955
1956
  searchNearby(t, e = [], n = this.doorSearchDistance, i = this.doorSearchNearAngle) {
1956
- const o = this.findPointVirtualGrid, s = this.quadtree;
1957
+ const s = this.findPointVirtualGrid, o = this.quadtree;
1957
1958
  function r({ point: u, line: x }, w, S) {
1958
- const b = x.direction();
1959
- x.start === u && b.multiplyScalar(-1);
1960
- const P = o.queryCircle(u, n).filter((D) => D.userData !== x).sort((D, E) => D.point.distance(u) - E.point.distance(u)), A = [];
1959
+ const L = x.direction();
1960
+ x.start === u && L.multiplyScalar(-1);
1961
+ const P = s.queryCircle(u, n).filter((D) => D.userData !== x).sort((D, E) => D.point.distance(u) - E.point.distance(u)), A = [];
1961
1962
  for (let D = 0; D < P.length; D++) {
1962
1963
  const E = e.findIndex((T) => T.point === P[D].point), B = t[w].uuid, Y = e[E].uuid;
1963
1964
  if (S.has(`${B}.${Y}`)) continue;
1964
1965
  S.add(`${B}.${Y}`), S.add(`${Y}.${B}`);
1965
- const Q = P[D].point, C = new L(u.clone(), Q.clone());
1966
- if (C.direction().angleBetween(b, "angle") < i) {
1966
+ const Q = P[D].point, C = new b(u.clone(), Q.clone());
1967
+ if (C.direction().angleBetween(L, "angle") < i) {
1967
1968
  const T = t[E].line.direction();
1968
- P[D].userData.start.equal(P[D].point) && T.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(T, "angle") < i && (s.queryLineSegment(C).length || A.push({
1969
+ P[D].userData.start.equal(P[D].point) && T.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(T, "angle") < i && (o.queryLineSegment(C).length || A.push({
1969
1970
  findData: P[D],
1970
1971
  findUuid: Y,
1971
1972
  doorLine: C,
@@ -1975,10 +1976,10 @@ class rt {
1975
1976
  }
1976
1977
  return A;
1977
1978
  }
1978
- function c(u, x, w, S, b) {
1979
+ function c(u, x, w, S, L) {
1979
1980
  S.add(u);
1980
1981
  const P = [];
1981
- b && P.push(b);
1982
+ L && P.push(L);
1982
1983
  for (let A = 0; A < w.length; A++) {
1983
1984
  const D = w[A];
1984
1985
  if (x.has(D.findUuid)) {
@@ -1986,7 +1987,7 @@ class rt {
1986
1987
  c(D.findUuid, x, E, S, D) && P.push(D);
1987
1988
  } else P.push(D);
1988
1989
  }
1989
- return P.sort((A, D) => A.doorLine.length() - D.doorLine.length()), b && P[0] === b ? (w.splice(0), !0) : (w.splice(1), !1);
1990
+ return P.sort((A, D) => A.doorLine.length() - D.doorLine.length()), L && P[0] === L ? (w.splice(0), !0) : (w.splice(1), !1);
1990
1991
  }
1991
1992
  const a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
1992
1993
  t.map((u, x) => {
@@ -2007,30 +2008,30 @@ class rt {
2007
2008
  for (let x = 1; x < u.length; x++) d.add(u[x]);
2008
2009
  }
2009
2010
  });
2010
- const f = [], m = [];
2011
+ const p = [], m = [];
2011
2012
  h.forEach((u) => {
2012
2013
  if (u.length) {
2013
2014
  const x = u[0];
2014
- d.has(x) || (f.push(x), m.push(x.doorUuid, x.findUuid));
2015
+ d.has(x) || (p.push(x), m.push(x.doorUuid, x.findUuid));
2015
2016
  }
2016
2017
  });
2017
2018
  const g = [];
2018
- return f.forEach((u) => {
2019
- const x = t.findIndex((E) => E.uuid === u.doorUuid), w = e.findIndex((E) => E.uuid === u.findUuid), S = t[x].point.clone(), b = e[w].point.clone(), P = this.findLongLineSegment(t[x].line), A = this.findLongLineSegment(e[w].line), D = P.projectPoint(b);
2019
+ return p.forEach((u) => {
2020
+ const x = t.findIndex((E) => E.uuid === u.doorUuid), w = e.findIndex((E) => E.uuid === u.findUuid), S = t[x].point.clone(), L = e[w].point.clone(), P = this.findLongLineSegment(t[x].line), A = this.findLongLineSegment(e[w].line), D = P.projectPoint(L);
2020
2021
  if (D) {
2021
2022
  S.copy(D);
2022
- const E = new L(S, b), B = A.includedAngle(E);
2023
+ const E = new b(S, L), B = A.includedAngle(E);
2023
2024
  (B < 10 || B > 170 || Math.abs(90 - B) < 10) && g.push({
2024
2025
  start: S,
2025
- end: b
2026
+ end: L
2026
2027
  });
2027
2028
  } else {
2028
2029
  const E = A.projectPoint(S);
2029
- E && b.copy(E);
2030
- const B = new L(S, b), Y = P.includedAngle(B);
2030
+ E && L.copy(E);
2031
+ const B = new b(S, L), Y = P.includedAngle(B);
2031
2032
  (Y < 10 || Y > 170 || Math.abs(90 - Y) < 10) && g.push({
2032
2033
  start: S,
2033
- end: b
2034
+ end: L
2034
2035
  });
2035
2036
  }
2036
2037
  }), e.splice(
@@ -2049,15 +2050,15 @@ class rt {
2049
2050
  * @returns
2050
2051
  */
2051
2052
  searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
2052
- const i = this.quadtree, o = e.direction();
2053
- e.start === t && o.multiplyScalar(-1);
2054
- const s = t.clone().add(o.clone().multiplyScalar(n)), r = new L(t.clone(), s), c = i.queryLineSegment(r).map((a) => ({
2053
+ const i = this.quadtree, s = e.direction();
2054
+ e.start === t && s.multiplyScalar(-1);
2055
+ const o = t.clone().add(s.clone().multiplyScalar(n)), r = new b(t.clone(), o), c = i.queryLineSegment(r).map((a) => ({
2055
2056
  point: a.line.getIntersection(r),
2056
2057
  line: a.line
2057
2058
  })).filter((a) => a.point).sort((a, h) => t.distance(a.point) - t.distance(h.point));
2058
2059
  if (c.length) {
2059
2060
  const a = c[0];
2060
- if (Math.abs(90 - a.line.direction().angleBetween(o, "angle")) < 5)
2061
+ if (Math.abs(90 - a.line.direction().angleBetween(s, "angle")) < 5)
2061
2062
  return a;
2062
2063
  }
2063
2064
  }
@@ -2068,20 +2069,20 @@ class rt {
2068
2069
  * @returns
2069
2070
  */
2070
2071
  searchAlongNormalDirection({ point: t, line: e }, n = this.doorSearchDistance) {
2071
- const i = this.pointVirtualGrid, o = this.quadtree, s = e.direction(), r = e.start.normal(e.end), c = e.start.clone();
2072
- e.start === t && s.multiplyScalar(-1), e.start === t && c.copy(e.end);
2072
+ const i = this.pointVirtualGrid, s = this.quadtree, o = e.direction(), r = e.start.normal(e.end), c = e.start.clone();
2073
+ e.start === t && o.multiplyScalar(-1), e.start === t && c.copy(e.end);
2073
2074
  const a = i.queryPoint(c).filter((d) => d.userData !== e);
2074
2075
  for (let d = 0; d < a.length; d++) {
2075
- const f = a[d], m = f.userData, g = m.direction();
2076
- if (m.start === f.point && s.multiplyScalar(-1), g.angleBetween(r) / (Math.PI / 180) > 90) {
2076
+ const p = a[d], m = p.userData, g = m.direction();
2077
+ if (m.start === p.point && o.multiplyScalar(-1), g.angleBetween(r) / (Math.PI / 180) > 90) {
2077
2078
  r.multiplyScalar(-1);
2078
2079
  break;
2079
2080
  }
2080
2081
  }
2081
- const h = new L(t.clone(), t.clone().add(r.multiplyScalar(n))), l = o.queryLineSegment(h).map((d) => ({
2082
+ const h = new b(t.clone(), t.clone().add(r.multiplyScalar(n))), l = s.queryLineSegment(h).map((d) => ({
2082
2083
  point: d.line.getIntersection(h),
2083
2084
  line: d.line
2084
- })).filter((d) => d.point).sort((d, f) => t.distance(d.point) - t.distance(f.point));
2085
+ })).filter((d) => d.point).sort((d, p) => t.distance(d.point) - t.distance(p.point));
2085
2086
  if (l.length) {
2086
2087
  const d = l[0];
2087
2088
  if (Math.abs(90 - d.line.direction().angleBetween(r, "angle")) < 5)
@@ -2095,17 +2096,17 @@ class rt {
2095
2096
  */
2096
2097
  findLongLineSegment(t) {
2097
2098
  const e = t.clone(), n = this.pointVirtualGrid.queryPoint(t.start), i = this.pointVirtualGrid.queryPoint(t.end);
2098
- for (let o = 0; o < n.length; o++) {
2099
- const { userData: s } = n[o];
2100
- if (s !== t && s && s.directionEqual(t)) {
2101
- s.start.equal(t.start) ? e.start.copy(s.end) : e.start.copy(s.start);
2099
+ for (let s = 0; s < n.length; s++) {
2100
+ const { userData: o } = n[s];
2101
+ if (o !== t && o && o.directionEqual(t)) {
2102
+ o.start.equal(t.start) ? e.start.copy(o.end) : e.start.copy(o.start);
2102
2103
  break;
2103
2104
  }
2104
2105
  }
2105
- for (let o = 0; o < i.length; o++) {
2106
- const { userData: s } = i[o];
2107
- if (s !== t && s && s.directionEqual(t)) {
2108
- s.end.equal(t.end) ? e.end.copy(s.start) : e.end.copy(s.end);
2106
+ for (let s = 0; s < i.length; s++) {
2107
+ const { userData: o } = i[s];
2108
+ if (o !== t && o && o.directionEqual(t)) {
2109
+ o.end.equal(t.end) ? e.end.copy(o.start) : e.end.copy(o.end);
2109
2110
  break;
2110
2111
  }
2111
2112
  }
@@ -2136,15 +2137,15 @@ class at extends j {
2136
2137
  * @returns
2137
2138
  */
2138
2139
  expandLineSegment(t, e, n = 0.1) {
2139
- const i = e.normal(t), o = e.direction(t).mutiplyScalar(n * 0.5), s = t.direction(e).mutiplyScalar(n * 0.5), r = i.x * n * 0.5, c = i.y * n * 0.5;
2140
+ const i = e.normal(t), s = e.direction(t).mutiplyScalar(n * 0.5), o = t.direction(e).mutiplyScalar(n * 0.5), r = i.x * n * 0.5, c = i.y * n * 0.5;
2140
2141
  return {
2141
2142
  points: [
2142
2143
  // 第一条线
2143
- new p(t.x + r, t.y + c).add(s),
2144
- new p(e.x + r, e.y + c).add(o),
2144
+ new f(t.x + r, t.y + c).add(o),
2145
+ new f(e.x + r, e.y + c).add(s),
2145
2146
  // 第二条线
2146
- new p(t.x - r, t.y - c).add(s),
2147
- new p(e.x - r, e.y - c).add(o)
2147
+ new f(t.x - r, t.y - c).add(o),
2148
+ new f(e.x - r, e.y - c).add(s)
2148
2149
  ],
2149
2150
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
2150
2151
  rectIndices: [0, 1, 3, 2, 0]
@@ -2158,7 +2159,7 @@ class at extends j {
2158
2159
  */
2159
2160
  addData(t, e) {
2160
2161
  const n = this.Dxf;
2161
- n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new L(t.clone(), e.clone()));
2162
+ n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new b(t.clone(), e.clone()));
2162
2163
  }
2163
2164
  /** 结果分析创建矩形
2164
2165
  * @param result
@@ -2166,13 +2167,13 @@ class at extends j {
2166
2167
  createRectangle(t) {
2167
2168
  const e = this.Dxf, n = t.project, i = t.project2;
2168
2169
  n.includedAngle(i) > 135 && (i.points = [i.points[1], i.points[0]]), this.addData(n.points[0], i.points[0]), this.addData(n.points[1], i.points[1]);
2169
- const o = n.points[0].distance(i.points[0]), s = n.points[1].distance(i.points[1]), r = Math.ceil(Math.max(o, s) / e.width), c = o / r, a = s / r, h = i.points[0].direction(n.points[0]), l = i.points[1].direction(n.points[1]), d = n.points[0].clone(), f = n.points[1].clone(), m = f.direction(d);
2170
+ const s = n.points[0].distance(i.points[0]), o = n.points[1].distance(i.points[1]), r = Math.ceil(Math.max(s, o) / e.width), c = s / r, a = o / r, h = i.points[0].direction(n.points[0]), l = i.points[1].direction(n.points[1]), d = n.points[0].clone(), p = n.points[1].clone(), m = p.direction(d);
2170
2171
  m.multiplyScalar(e.width * 0.5);
2171
- const g = d.clone().add(m), u = f.clone().add(m.multiplyScalar(-1)), x = d.direction(f), w = g.direction(u);
2172
+ const g = d.clone().add(m), u = p.clone().add(m.multiplyScalar(-1)), x = d.direction(p), w = g.direction(u);
2172
2173
  if (!(x.x > 0 && w.x < 0 || x.x < 0 && w.x > 0 || x.y > 0 && w.y < 0 || x.y < 0 && w.y > 0)) {
2173
- d.set(g.x, g.y), f.set(u.x, u.y);
2174
+ d.set(g.x, g.y), p.set(u.x, u.y);
2174
2175
  for (let S = 1; S < r; S++) {
2175
- const b = h.clone().multiplyScalar(c * S), P = l.clone().multiplyScalar(a * S), A = d.clone().add(b), D = f.clone().add(P);
2176
+ const L = h.clone().multiplyScalar(c * S), P = l.clone().multiplyScalar(a * S), A = d.clone().add(L), D = p.clone().add(P);
2176
2177
  this.addData(A, D);
2177
2178
  }
2178
2179
  }
@@ -2199,13 +2200,13 @@ class at extends j {
2199
2200
  lineAnalysis() {
2200
2201
  this.buildQuadtree();
2201
2202
  const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), i = [];
2202
- e.forEach((o, s) => {
2203
- const r = e[s], c = N.fromByLineSegment(r, this.width * 2, !1, -0.01);
2204
- t.queryRect(c).map((h) => h.userData).filter((h) => h !== s).forEach((h) => {
2203
+ e.forEach((s, o) => {
2204
+ const r = e[o], c = O.fromByLineSegment(r, this.width * 2, !1, -0.01);
2205
+ t.queryRect(c).map((h) => h.userData).filter((h) => h !== o).forEach((h) => {
2205
2206
  try {
2206
- if (n.has(`${s}-${h}`) || n.has(`${h}-${s}`)) return;
2207
- const l = this.projectionAnalysis(h, s, r, e);
2208
- l && i.push(l), n.add(`${s}-${h}`);
2207
+ if (n.has(`${o}-${h}`) || n.has(`${h}-${o}`)) return;
2208
+ const l = this.projectionAnalysis(h, o, r, e);
2209
+ l && i.push(l), n.add(`${o}-${h}`);
2209
2210
  } catch {
2210
2211
  }
2211
2212
  });
@@ -2218,12 +2219,12 @@ class at extends j {
2218
2219
  * @returns
2219
2220
  */
2220
2221
  projectionAnalysis(t, e, n, i) {
2221
- const o = i[t], s = n.direction(), r = o.direction(), c = s.angleBetween(r) / (Math.PI / 180);
2222
+ const s = i[t], o = n.direction(), r = s.direction(), c = o.angleBetween(r) / (Math.PI / 180);
2222
2223
  if (c < this.errorAngle || c > 180 - this.errorAngle) {
2223
2224
  let a;
2224
- const h = o.projectLineSegment(n), l = n.projectLineSegment(o);
2225
+ const h = s.projectLineSegment(n), l = n.projectLineSegment(s);
2225
2226
  return h.getLength() > l.getLength() ? a = {
2226
- target: o,
2227
+ target: s,
2227
2228
  targetIndex: t,
2228
2229
  source: n,
2229
2230
  sourceIndex: e,
@@ -2232,7 +2233,7 @@ class at extends j {
2232
2233
  } : a = {
2233
2234
  target: n,
2234
2235
  targetIndex: e,
2235
- source: o,
2236
+ source: s,
2236
2237
  sourceIndex: t,
2237
2238
  project: l,
2238
2239
  project2: h
@@ -2274,15 +2275,15 @@ class ct extends it {
2274
2275
  }
2275
2276
  const ht = new et(), lt = new nt();
2276
2277
  function dt(y, t, e = 0.1) {
2277
- const n = t.normal(y), i = t.direction(y).mutiplyScalar(e * 0.5), o = y.direction(t).mutiplyScalar(e * 0.5), s = n.x * e * 0.5, r = n.y * e * 0.5;
2278
+ const n = t.normal(y), i = t.direction(y).mutiplyScalar(e * 0.5), s = y.direction(t).mutiplyScalar(e * 0.5), o = n.x * e * 0.5, r = n.y * e * 0.5;
2278
2279
  return {
2279
2280
  points: [
2280
2281
  // 第一条线
2281
- new p(y.x + s, y.y + r).add(o),
2282
- new p(t.x + s, t.y + r).add(i),
2282
+ new f(y.x + o, y.y + r).add(s),
2283
+ new f(t.x + o, t.y + r).add(i),
2283
2284
  // 第二条线
2284
- new p(y.x - s, y.y - r).add(o),
2285
- new p(t.x - s, t.y - r).add(i)
2285
+ new f(y.x - o, y.y - r).add(s),
2286
+ new f(t.x - o, t.y - r).add(i)
2286
2287
  ],
2287
2288
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
2288
2289
  rectIndices: [0, 1, 3, 2, 0]
@@ -2310,20 +2311,20 @@ class H extends j {
2310
2311
  this.originalWhiteMode.clear(), this.whiteModelGroup.clear(), this.whiteModelLineGroup.clear(), this.whiteModelGroup.add(this.whiteModelLineGroup), this.whiteModelGroup.position.z = t.originalZAverage, this.originalWhiteMode.position.z = t.originalZAverage, t.wallsGroup.forEach((n) => {
2311
2312
  const i = new M.Shape();
2312
2313
  n.forEach((r, c) => c === 0 ? i.moveTo(r.x / t.scale, r.y / t.scale) : i.lineTo(r.x / t.scale, r.y / t.scale));
2313
- const o = new M.ExtrudeGeometry(i, {
2314
+ const s = new M.ExtrudeGeometry(i, {
2314
2315
  depth: 2.8,
2315
2316
  bevelSize: 0
2316
- }), s = new M.Mesh(o, this.material);
2317
- this.whiteModelGroup.add(s), this.whiteModelLineGroup.add(
2318
- new M.LineSegments(new M.EdgesGeometry(o), new M.LineBasicMaterial({ color: 0 }))
2317
+ }), o = new M.Mesh(s, this.material);
2318
+ this.whiteModelGroup.add(o), this.whiteModelLineGroup.add(
2319
+ new M.LineSegments(new M.EdgesGeometry(s), new M.LineBasicMaterial({ color: 0 }))
2319
2320
  );
2320
- }), t.originalData.map(({ start: n, end: i, insetionArr: o }) => {
2321
- const s = new p(n.x, n.y).mutiplyScalar(t.scale), r = new p(i.x, i.y).mutiplyScalar(t.scale), { points: c, indices: a, rectIndices: h } = dt(s, r, t.width);
2321
+ }), t.originalData.map(({ start: n, end: i, insetionArr: s }) => {
2322
+ const o = new f(n.x, n.y).mutiplyScalar(t.scale), r = new f(i.x, i.y).mutiplyScalar(t.scale), { points: c, indices: a, rectIndices: h } = dt(o, r, t.width);
2322
2323
  return {
2323
2324
  points: c,
2324
2325
  indices: a,
2325
2326
  rectIndices: h,
2326
- insetions: (o ?? []).map((l) => l.index)
2327
+ insetions: (s ?? []).map((l) => l.index)
2327
2328
  };
2328
2329
  }).forEach((n) => {
2329
2330
  const i = new M.Shape();
@@ -2331,13 +2332,13 @@ class H extends j {
2331
2332
  const a = n.points[r];
2332
2333
  c === 0 ? i.moveTo(a.x, a.y) : i.lineTo(a.x, a.y);
2333
2334
  });
2334
- const o = new M.ExtrudeGeometry(i, {
2335
+ const s = new M.ExtrudeGeometry(i, {
2335
2336
  depth: 2.8,
2336
2337
  bevelSize: 0
2337
2338
  });
2338
- if (o.attributes.position.array.filter((r) => Number.isNaN(r)).length) return;
2339
- const s = new M.Mesh(o);
2340
- this.originalWhiteMode?.add(s);
2339
+ if (s.attributes.position.array.filter((r) => Number.isNaN(r)).length) return;
2340
+ const o = new M.Mesh(s);
2341
+ this.originalWhiteMode?.add(o);
2341
2342
  }), this.dispatchEvent({
2342
2343
  type: "updateModel",
2343
2344
  originalWhiteMode: this.originalWhiteMode,
@@ -2373,12 +2374,12 @@ class H extends j {
2373
2374
  });
2374
2375
  else if (typeof global != "function")
2375
2376
  try {
2376
- const n = await G("obj2gltf", !0), i = await G("fs", !1), o = await this.toOBJ();
2377
- i.writeFileSync(this.uuid, o);
2378
- const s = await n(this.uuid, {
2377
+ const n = await G("obj2gltf", !0), i = await G("fs", !1), s = await this.toOBJ();
2378
+ i.writeFileSync(this.uuid, s);
2379
+ const o = await n(this.uuid, {
2379
2380
  binary: t
2380
2381
  });
2381
- i.unlinkSync(this.uuid), e(t ? s : JSON.stringify(s));
2382
+ i.unlinkSync(this.uuid), e(t ? o : JSON.stringify(o));
2382
2383
  } catch (n) {
2383
2384
  e(void 0), console.log(n);
2384
2385
  }
@@ -2459,8 +2460,8 @@ class Z extends j {
2459
2460
  const { default: n } = await import(
2460
2461
  /* @vite-ignore */
2461
2462
  "fs"
2462
- ), i = n.readFileSync(t), o = JSON.parse(i.toString("utf-8"));
2463
- this.set(o);
2463
+ ), i = n.readFileSync(t), s = JSON.parse(i.toString("utf-8"));
2464
+ this.set(s);
2464
2465
  return;
2465
2466
  } else
2466
2467
  throw new Error("非node环境不允许使用路径");
@@ -2495,9 +2496,9 @@ class Z extends j {
2495
2496
  e.direction.x,
2496
2497
  e.direction.y,
2497
2498
  e.direction.z
2498
- ), o = 100;
2499
- this.racasterHelper(n, i, o), i.z = 0;
2500
- const r = new M.Raycaster(n, i, 0, o).intersectObject(t.originalWhiteMode);
2499
+ ), s = 100;
2500
+ this.racasterHelper(n, i, s), i.z = 0;
2501
+ const r = new M.Raycaster(n, i, 0, s).intersectObject(t.originalWhiteMode);
2501
2502
  if (r.length) {
2502
2503
  const { point: c } = r[0];
2503
2504
  this.desPoints.push({
@@ -2528,8 +2529,8 @@ class K extends j {
2528
2529
  const e = t.to3DArray(1 / t.scale, 0);
2529
2530
  this.dxfLineModel.geometry = new M.BufferGeometry().setAttribute("position", new M.BufferAttribute(e, 3, !0));
2530
2531
  const n = new Float32Array(
2531
- t.doorLineSegment.flatMap(({ start: o, end: s }) => [o.x, o.y, 0, s.x, s.y, 0])
2532
- ).map((o) => o / t.scale), i = new Float32Array(t.doorLineSegment.flatMap(() => [1, 0, 0, 0, 1, 0]));
2532
+ t.doorLineSegment.flatMap(({ start: s, end: o }) => [s.x, s.y, 0, o.x, o.y, 0])
2533
+ ).map((s) => s / t.scale), i = new Float32Array(t.doorLineSegment.flatMap(() => [1, 0, 0, 0, 1, 0]));
2533
2534
  this.dxfDoorsLineModel.geometry = new M.BufferGeometry().setAttribute("position", new M.BufferAttribute(n, 3, !0)).setAttribute("color", new M.BufferAttribute(i, 3)), this.dxfModelGroup.position.z = t.originalZAverage, this.dispatchEvent({
2534
2535
  type: "modelUpdate",
2535
2536
  model: this.dxfModelGroup
@@ -2567,28 +2568,28 @@ function xt() {
2567
2568
  }
2568
2569
  let V = null;
2569
2570
  async function Et(y, t, e = !1, n) {
2570
- const i = await Promise.resolve().then(() => pt), o = await mt(), s = await xt(), r = new ct().usePlugin(i.ModelDataPlugin.create({
2571
+ const i = await Promise.resolve().then(() => pt), s = await mt(), o = await xt(), r = new ct().usePlugin(i.ModelDataPlugin.create({
2571
2572
  detailsPoint: !1,
2572
2573
  whiteModel: !0
2573
- })).usePlugin(o.RenderPlugin.create({
2574
+ })).usePlugin(s.RenderPlugin.create({
2574
2575
  originalLine: !1,
2575
2576
  modelData: !1,
2576
2577
  detailsPoint: !1,
2577
2578
  orbitControls: e,
2578
2579
  camera: t
2579
- })).usePlugin(s.Editor.create({ viewPermission: n })), c = r.findComponentByType(o.components.DomContainer);
2580
+ })).usePlugin(o.Editor.create({ viewPermission: n })), c = r.findComponentByType(s.components.DomContainer);
2580
2581
  return c && y.appendChild(c.domElement), V = r, {
2581
2582
  dxfSystem: r,
2582
2583
  getFileAll: () => yt(r)
2583
2584
  };
2584
2585
  }
2585
2586
  async function yt(y = V) {
2586
- const t = y.findComponentByName("WhiteModel"), e = new File([await y.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([y.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), s = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), r = new File([JSON.stringify(y.Dxf.originalData)], "json.json", { type: "application/json" });
2587
+ const t = y.findComponentByName("WhiteModel"), e = new File([await y.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([y.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), s = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), r = new File([JSON.stringify(y.Dxf.originalData)], "json.json", { type: "application/json" });
2587
2588
  return {
2588
2589
  dxf: n,
2589
2590
  obj: i,
2590
- glb: o,
2591
- gltf: s,
2591
+ glb: s,
2592
+ gltf: o,
2592
2593
  json: r,
2593
2594
  jpg: e
2594
2595
  };
@@ -2601,9 +2602,9 @@ export {
2601
2602
  j as C,
2602
2603
  ct as D,
2603
2604
  $ as E,
2604
- L,
2605
+ b as L,
2605
2606
  ft as M,
2606
- p as P,
2607
+ f as P,
2607
2608
  q as Q,
2608
2609
  _ as V,
2609
2610
  H as W,