rm-graphical-computing 1.0.62 → 1.0.63

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.
Files changed (3) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1273 -1239
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,54 +1,54 @@
1
- var jn = Object.defineProperty;
2
- var Un = (n, t, e) => t in n ? jn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var Ie = (n, t, e) => Un(n, typeof t != "symbol" ? t + "" : t, e);
1
+ var Qn = Object.defineProperty;
2
+ var Jn = (n, t, e) => t in n ? Qn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var Fe = (n, t, e) => Jn(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import * as y from "three";
5
- import { BufferGeometry as Zn, BufferAttribute as Kn, Plane as Qn, Vector3 as Mt, Matrix3 as Sn, MathUtils as ke, Box3 as Jn, Matrix4 as vn, Ray as to } from "three";
6
- function eo(n, t = !1) {
7
- const e = n[0].index !== null, o = new Set(Object.keys(n[0].attributes)), i = new Set(Object.keys(n[0].morphAttributes)), r = {}, s = {}, a = n[0].morphTargetsRelative, l = new Zn();
5
+ import { BufferGeometry as to, BufferAttribute as eo, Plane as no, Vector3 as zt, Matrix3 as Tn, MathUtils as Oe, Box3 as oo, Matrix4 as En, Ray as ro } from "three";
6
+ function io(n, t = !1) {
7
+ const e = n[0].index !== null, o = new Set(Object.keys(n[0].attributes)), i = new Set(Object.keys(n[0].morphAttributes)), r = {}, s = {}, a = n[0].morphTargetsRelative, l = new to();
8
8
  let c = 0;
9
9
  for (let h = 0; h < n.length; ++h) {
10
10
  const f = n[h];
11
11
  let u = 0;
12
12
  if (e !== (f.index !== null))
13
13
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
14
- for (const g in f.attributes) {
15
- if (!o.has(g))
16
- return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + g + '" attribute exists among all geometries, or in none of them.'), null;
17
- r[g] === void 0 && (r[g] = []), r[g].push(f.attributes[g]), u++;
14
+ for (const p in f.attributes) {
15
+ if (!o.has(p))
16
+ return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + p + '" attribute exists among all geometries, or in none of them.'), null;
17
+ r[p] === void 0 && (r[p] = []), r[p].push(f.attributes[p]), u++;
18
18
  }
19
19
  if (u !== o.size)
20
20
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". Make sure all geometries have the same number of attributes."), null;
21
21
  if (a !== f.morphTargetsRelative)
22
22
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
23
- for (const g in f.morphAttributes) {
24
- if (!i.has(g))
23
+ for (const p in f.morphAttributes) {
24
+ if (!i.has(p))
25
25
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphAttributes must be consistent throughout all geometries."), null;
26
- s[g] === void 0 && (s[g] = []), s[g].push(f.morphAttributes[g]);
26
+ s[p] === void 0 && (s[p] = []), s[p].push(f.morphAttributes[p]);
27
27
  }
28
28
  if (t) {
29
- let g;
29
+ let p;
30
30
  if (e)
31
- g = f.index.count;
31
+ p = f.index.count;
32
32
  else if (f.attributes.position !== void 0)
33
- g = f.attributes.position.count;
33
+ p = f.attributes.position.count;
34
34
  else
35
35
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". The geometry must have either an index or a position attribute"), null;
36
- l.addGroup(c, g, h), c += g;
36
+ l.addGroup(c, p, h), c += p;
37
37
  }
38
38
  }
39
39
  if (e) {
40
40
  let h = 0;
41
41
  const f = [];
42
42
  for (let u = 0; u < n.length; ++u) {
43
- const g = n[u].index;
44
- for (let w = 0; w < g.count; ++w)
45
- f.push(g.getX(w) + h);
43
+ const p = n[u].index;
44
+ for (let w = 0; w < p.count; ++w)
45
+ f.push(p.getX(w) + h);
46
46
  h += n[u].attributes.position.count;
47
47
  }
48
48
  l.setIndex(f);
49
49
  }
50
50
  for (const h in r) {
51
- const f = Ge(r[h]);
51
+ const f = Qe(r[h]);
52
52
  if (!f)
53
53
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " attribute."), null;
54
54
  l.setAttribute(h, f);
@@ -58,10 +58,10 @@ function eo(n, t = !1) {
58
58
  if (f === 0) break;
59
59
  l.morphAttributes = l.morphAttributes || {}, l.morphAttributes[h] = [];
60
60
  for (let u = 0; u < f; ++u) {
61
- const g = [];
61
+ const p = [];
62
62
  for (let x = 0; x < s[h].length; ++x)
63
- g.push(s[h][x][u]);
64
- const w = Ge(g);
63
+ p.push(s[h][x][u]);
64
+ const w = Qe(p);
65
65
  if (!w)
66
66
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " morphAttribute."), null;
67
67
  l.morphAttributes[h].push(w);
@@ -69,7 +69,7 @@ function eo(n, t = !1) {
69
69
  }
70
70
  return l;
71
71
  }
72
- function Ge(n) {
72
+ function Qe(n) {
73
73
  let t, e, o, i = -1, r = 0;
74
74
  for (let c = 0; c < n.length; ++c) {
75
75
  const h = n[c];
@@ -83,13 +83,13 @@ function Ge(n) {
83
83
  return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
84
84
  r += h.count * e;
85
85
  }
86
- const s = new t(r), a = new Kn(s, e, o);
86
+ const s = new t(r), a = new eo(s, e, o);
87
87
  let l = 0;
88
88
  for (let c = 0; c < n.length; ++c) {
89
89
  const h = n[c];
90
90
  if (h.isInterleavedBufferAttribute) {
91
91
  const f = l / e;
92
- for (let u = 0, g = h.count; u < g; u++)
92
+ for (let u = 0, p = h.count; u < p; u++)
93
93
  for (let w = 0; w < e; w++) {
94
94
  const x = h.getComponent(u, w);
95
95
  a.setComponent(u + f, w, x);
@@ -100,12 +100,12 @@ function Ge(n) {
100
100
  }
101
101
  return i !== void 0 && (a.gpuType = i), a;
102
102
  }
103
- const no = (n, t, e) => {
103
+ const so = (n, t, e) => {
104
104
  let o = new y.LineBasicMaterial({ color: "#0011ff" }), i = [];
105
105
  i.push(n), i.push(t);
106
106
  let r = new y.BufferGeometry();
107
107
  r.setFromPoints(i), r.rotateX(-Math.PI / 2), e.add(new y.Line(r, o));
108
- }, Kt = (n, t, e, o, i = 1e-8) => {
108
+ }, te = (n, t, e, o, i = 1e-8) => {
109
109
  const r = t.x - n.x, s = t.y - n.y, a = o.x - e.x, l = o.y - e.y, c = r * l - s * a;
110
110
  if (Math.abs(c) < i) return null;
111
111
  const h = ((e.x - n.x) * l - (e.y - n.y) * a) / c, f = ((e.x - n.x) * s - (e.y - n.y) * r) / c;
@@ -116,7 +116,7 @@ const no = (n, t, e) => {
116
116
  n.z
117
117
  )
118
118
  };
119
- }, oo = (n, t, e = {}) => {
119
+ }, ao = (n, t, e = {}) => {
120
120
  const {
121
121
  fontSize: o = 36,
122
122
  fontFamily: i = "sans-serif",
@@ -128,21 +128,21 @@ const no = (n, t, e) => {
128
128
  } = e, h = document.createElement("canvas").getContext("2d");
129
129
  h.font = `bold ${o}px ${i}`;
130
130
  const u = h.measureText(n).width;
131
- let g = Math.min(u + a * 2, l), w = o + a * 2;
131
+ let p = Math.min(u + a * 2, l), w = o + a * 2;
132
132
  const x = document.createElement("canvas");
133
- x.width = g, x.height = w;
133
+ x.width = p, x.height = w;
134
134
  const P = x.getContext("2d");
135
- P.fillStyle = r, P.fillRect(0, 0, g, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", u > l - a * 2 ? ro(P, n, g / 2, w / 2, l, o) : P.fillText(n, g / 2, w / 2);
135
+ P.fillStyle = r, P.fillRect(0, 0, p, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", u > l - a * 2 ? lo(P, n, p / 2, w / 2, l, o) : P.fillText(n, p / 2, w / 2);
136
136
  const M = new y.CanvasTexture(x), m = new y.SpriteMaterial({
137
137
  map: M,
138
138
  depthTest: !1,
139
139
  transparent: !0
140
140
  }), d = new y.Sprite(m);
141
141
  d.position.set(t.x, t.y, t.z);
142
- const p = 5e-3;
143
- return d.scale.set(g * p, w * p, 1), d;
142
+ const g = 5e-3;
143
+ return d.scale.set(p * g, w * g, 1), d;
144
144
  };
145
- function ro(n, t, e, o, i, r) {
145
+ function lo(n, t, e, o, i, r) {
146
146
  const s = t.split("");
147
147
  let a = "", l = r * 1.2, c = o;
148
148
  for (let h = 0; h < s.length; h++) {
@@ -151,7 +151,7 @@ function ro(n, t, e, o, i, r) {
151
151
  }
152
152
  n.fillText(a, e, c);
153
153
  }
154
- const te = (n, t, e = 0.01) => {
154
+ const oe = (n, t, e = 0.01) => {
155
155
  const o = Math.sqrt(n.x * n.x + n.y * n.y + n.z * n.z), i = Math.sqrt(t.x * t.x + t.y * t.y + t.z * t.z);
156
156
  if (o < 1e-10 || i < 1e-10)
157
157
  return { parallel: !1, sameDirection: null, angle: NaN };
@@ -164,7 +164,7 @@ const te = (n, t, e = 0.01) => {
164
164
  sameDirection: c ? a > 0 : null,
165
165
  angle: l
166
166
  };
167
- }, io = (n, t, e, o) => {
167
+ }, co = (n, t, e, o) => {
168
168
  const i = n;
169
169
  let r = [];
170
170
  if (o && o.length && (r = o.map((V) => V.clone())), !i || i.length < 4) return {};
@@ -174,49 +174,49 @@ const te = (n, t, e = 0.01) => {
174
174
  const v = V.dot(s), S = V.dot(a);
175
175
  v < c && (c = v), v > h && (h = v), S < f && (f = S), S > u && (u = S);
176
176
  }
177
- const g = i[0].dot(l), w = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(g)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(g)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(g)), M = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(g));
178
- let m = [w, x, P, M], d = te(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
177
+ const p = i[0].dot(l), w = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(p)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(p)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(p)), M = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(p));
178
+ let m = [w, x, P, M], d = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
179
179
  d && d.parallel && (m = [w, M, P, x]);
180
- let p = 0;
180
+ let g = 0;
181
181
  if (o.length > 0) {
182
182
  const V = new y.Vector3().subVectors(m[1], m[0]).normalize(), v = V.clone().negate(), S = new y.Vector3().subVectors(m[3], m[0]).normalize(), z = S.clone().negate();
183
- let D = m[0].distanceTo(m[1]), _ = m[0].distanceTo(m[3]), E = D / t, T = _ / e, A = 1e-3;
184
- for (let O = 0; O < E; O++) {
183
+ let D = m[0].distanceTo(m[1]), _ = m[0].distanceTo(m[3]), T = D / t, E = _ / e, A = 1e-3;
184
+ for (let O = 0; O < T; O++) {
185
185
  let I = m[0], B = 0;
186
- for (let L = 0; L < T; L++) {
187
- let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(S, e), R = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(R).multiplyScalar(0.25);
186
+ for (let R = 0; R < E; R++) {
187
+ let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
188
188
  for (let X = 0; X < r.length; X++)
189
189
  if (r[X].distanceTo(H) < A) {
190
190
  B++;
191
191
  break;
192
192
  }
193
- I = R;
193
+ I = L;
194
194
  }
195
- if (B >= T / 2)
195
+ if (B >= E / 2)
196
196
  break;
197
- p += B, m[0] = m[0].addScaledVector(V, t), m[3] = m[3].addScaledVector(V, t);
197
+ g += B, m[0] = m[0].addScaledVector(V, t), m[3] = m[3].addScaledVector(V, t);
198
198
  }
199
- D = m[0].distanceTo(m[1]), E = D / t;
200
- for (let O = 0; O < E; O++) {
199
+ D = m[0].distanceTo(m[1]), T = D / t;
200
+ for (let O = 0; O < T; O++) {
201
201
  let I = m[1], B = 0;
202
- for (let L = 0; L < T; L++) {
203
- let W = I.clone().addScaledVector(v, t), C = W.clone().addScaledVector(S, e), R = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(R).multiplyScalar(0.25);
202
+ for (let R = 0; R < E; R++) {
203
+ let W = I.clone().addScaledVector(v, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
204
204
  for (let X = 0; X < r.length; X++)
205
205
  if (r[X].distanceTo(H) < A) {
206
206
  B++;
207
207
  break;
208
208
  }
209
- I = R;
209
+ I = L;
210
210
  }
211
- if (B >= T / 2)
211
+ if (B >= E / 2)
212
212
  break;
213
- p += B, m[1] = m[1].addScaledVector(v, t), m[2] = m[2].addScaledVector(v, t);
213
+ g += B, m[1] = m[1].addScaledVector(v, t), m[2] = m[2].addScaledVector(v, t);
214
214
  }
215
- D = m[0].distanceTo(m[1]), E = D / t;
216
- for (let O = 0; O < T; O++) {
215
+ D = m[0].distanceTo(m[1]), T = D / t;
216
+ for (let O = 0; O < E; O++) {
217
217
  let I = m[3], B = 0;
218
- for (let L = 0; L < E; L++) {
219
- let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(z, e), R = I.clone().addScaledVector(z, e), H = new y.Vector3().add(I).add(W).add(C).add(R).multiplyScalar(0.25);
218
+ for (let R = 0; R < T; R++) {
219
+ let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(z, e), L = I.clone().addScaledVector(z, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
220
220
  for (let X = 0; X < r.length; X++)
221
221
  if (r[X].distanceTo(H) < A) {
222
222
  B++;
@@ -224,18 +224,18 @@ const te = (n, t, e = 0.01) => {
224
224
  }
225
225
  I = W;
226
226
  }
227
- if (B >= E / 2)
227
+ if (B >= T / 2)
228
228
  break;
229
- p += B, m[2] = m[2].addScaledVector(z, e), m[3] = m[3].addScaledVector(z, e);
229
+ g += B, m[2] = m[2].addScaledVector(z, e), m[3] = m[3].addScaledVector(z, e);
230
230
  }
231
231
  }
232
232
  const b = m[0].distanceTo(m[1]) * m[0].distanceTo(m[3]);
233
233
  return {
234
234
  facePoints: m,
235
235
  boxArea: b,
236
- totalInPlaneNum: p
236
+ totalInPlaneNum: g
237
237
  };
238
- }, ie = (n, t, e, o, i = y.MathUtils.degToRad(8)) => {
238
+ }, Jt = (n, t, e, o, i = y.MathUtils.degToRad(8)) => {
239
239
  const r = new y.Vector3(), s = new y.Vector3();
240
240
  r.subVectors(
241
241
  new y.Vector3(t.x, t.y, 0),
@@ -259,7 +259,7 @@ const te = (n, t, e = 0.01) => {
259
259
  vectors: { v1: r, v2: s }
260
260
  // 方向向量
261
261
  };
262
- }, ee = (n, t, e, o) => {
262
+ }, re = (n, t, e, o) => {
263
263
  const i = new y.Vector3().subVectors(t, n), r = new y.Vector3().subVectors(o, e), s = i.length(), a = r.length();
264
264
  if (s === 0 || a === 0)
265
265
  return { rate: NaN, angle: NaN, isPerpendicular: !1, isParallel: !1 };
@@ -277,7 +277,7 @@ const te = (n, t, e = 0.01) => {
277
277
  isParallel: f < 0.01
278
278
  // 是否平行
279
279
  };
280
- }, Qt = (n, t, e = !1) => new y.Vector3((n.x + t.x) / 2, (n.y + t.y) / 2, e ? 0 : (n.z + t.z) / 2), Jt = (n, t, e, o, i = {}) => {
280
+ }, ee = (n, t, e = !1) => new y.Vector3((n.x + t.x) / 2, (n.y + t.y) / 2, e ? 0 : (n.z + t.z) / 2), ne = (n, t, e, o, i = {}) => {
281
281
  const {
282
282
  parallelAngleMax: r = y.MathUtils.degToRad(10),
283
283
  collinearAngleMax: s = y.MathUtils.degToRad(7),
@@ -285,8 +285,8 @@ const te = (n, t, e = 0.01) => {
285
285
  overlapThreshold: l = 0.01
286
286
  // 投影重叠量大于此值才算 overlap
287
287
  } = i, c = new y.Vector3().subVectors(t, n), h = new y.Vector3().subVectors(o, e), f = c.clone().normalize(), u = h.clone().normalize();
288
- let g = y.MathUtils.clamp(f.dot(u), -1, 1);
289
- const w = Math.acos(Math.abs(g)), x = y.MathUtils.radToDeg(w);
288
+ let p = y.MathUtils.clamp(f.dot(u), -1, 1);
289
+ const w = Math.acos(Math.abs(p)), x = y.MathUtils.radToDeg(w);
290
290
  if (w > r)
291
291
  return {
292
292
  type: "not_parallel",
@@ -297,37 +297,37 @@ const te = (n, t, e = 0.01) => {
297
297
  overlap: null,
298
298
  closestDistance: null
299
299
  };
300
- g < 0 && u.negate();
301
- const P = new y.Vector3().addVectors(f, u).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), m = je(e, M, f), d = je(o, M, f), p = (m + d) / 2, b = Math.max(m, d), V = n.dot(P), v = t.dot(P), S = e.dot(P), z = o.dot(P), D = Math.min(V, v), _ = Math.max(V, v), E = Math.min(S, z), T = Math.max(S, z), A = _ - D, O = T - E, I = Math.min(A, O), B = Math.min(_, T) - Math.max(D, E), L = B < 0 ? -B : 0, W = B > 0 ? B : 0, C = I > 0 ? W / I : 0, R = so(
300
+ p < 0 && u.negate();
301
+ const P = new y.Vector3().addVectors(f, u).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), m = Je(e, M, f), d = Je(o, M, f), g = (m + d) / 2, b = Math.max(m, d), V = n.dot(P), v = t.dot(P), S = e.dot(P), z = o.dot(P), D = Math.min(V, v), _ = Math.max(V, v), T = Math.min(S, z), E = Math.max(S, z), A = _ - D, O = E - T, I = Math.min(A, O), B = Math.min(_, E) - Math.max(D, T), R = B < 0 ? -B : 0, W = B > 0 ? B : 0, C = I > 0 ? W / I : 0, L = uo(
302
302
  n,
303
303
  t,
304
304
  e,
305
305
  o
306
- ), H = w <= s && p < a;
306
+ ), H = w <= s && g < a;
307
307
  let X;
308
308
  return H ? X = C > 0.5 ? "collinear_overlap" : "collinear_gap" : w <= r && (X = "parallel_offset"), {
309
309
  type: X,
310
310
  angleDeg: x,
311
- avgPerpendicularDistance: p,
311
+ avgPerpendicularDistance: g,
312
312
  maxPerpendicularDistance: b,
313
- gap: L,
313
+ gap: R,
314
314
  overlap: W,
315
- closestDistance: R
315
+ closestDistance: L
316
316
  };
317
317
  };
318
- function je(n, t, e) {
318
+ function Je(n, t, e) {
319
319
  const o = new y.Vector3().subVectors(n, t), i = o.dot(e), r = e.clone().multiplyScalar(i);
320
320
  return new y.Vector3().subVectors(o, r).length();
321
321
  }
322
- function so(n, t, e, o) {
322
+ function uo(n, t, e, o) {
323
323
  const i = new y.Vector3().subVectors(t, n), r = new y.Vector3().subVectors(o, e), s = new y.Vector3().subVectors(e, n), a = i.dot(i), l = i.dot(r), c = r.dot(r), h = i.dot(s), f = r.dot(s), u = a * c - l * l;
324
- let g, w;
325
- u < 1e-10 ? (g = 0, w = c !== 0 ? f / c : 0) : (g = (l * f - c * h) / u, w = (a * f - l * h) / u), g = y.MathUtils.clamp(g, 0, 1), w = c !== 0 ? y.MathUtils.clamp((l * g + f) / c, 0, 1) : 0, g = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
326
- const x = n.clone().add(i.clone().multiplyScalar(g)), P = e.clone().add(r.clone().multiplyScalar(w));
324
+ let p, w;
325
+ u < 1e-10 ? (p = 0, w = c !== 0 ? f / c : 0) : (p = (l * f - c * h) / u, w = (a * f - l * h) / u), p = y.MathUtils.clamp(p, 0, 1), w = c !== 0 ? y.MathUtils.clamp((l * p + f) / c, 0, 1) : 0, p = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
326
+ const x = n.clone().add(i.clone().multiplyScalar(p)), P = e.clone().add(r.clone().multiplyScalar(w));
327
327
  return x.distanceTo(P);
328
328
  }
329
- const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), ao = (n) => {
330
- let t = new y.Vector3(n.start.x, n.start.y, n.start.z), e = new y.Vector3(n.end.x, n.end.y, n.end.z), o = t.distanceTo(e), i = n.rooftopPz - n.start.z, r = Ue(o, 100), s = Ue(i, 70), a = i / s, l = /* @__PURE__ */ new Map();
329
+ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), ho = (n) => {
330
+ let t = new y.Vector3(n.start.x, n.start.y, n.start.z), e = new y.Vector3(n.end.x, n.end.y, n.end.z), o = t.distanceTo(e), i = n.rooftopPz - n.start.z, r = tn(o, 100), s = tn(i, 70), a = i / s, l = /* @__PURE__ */ new Map();
331
331
  for (let x = 0; x < s; x++)
332
332
  l.set((x + 1) * a, { count: 0, minZ: 1 / 0, maxZ: -1 / 0 });
333
333
  let c = new y.Line3(t, e);
@@ -337,11 +337,11 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
337
337
  let m = c.closestPointToPoint(P, !0, f).distanceTo(P);
338
338
  const d = Math.floor(m / a);
339
339
  if (d < s) {
340
- const p = l.get((d + 1) * a);
341
- p.count++, P.z < p.minZ && (p.minZ = P.z), P.z > p.maxZ && (p.maxZ = P.z);
340
+ const g = l.get((d + 1) * a);
341
+ g.count++, P.z < g.minZ && (g.minZ = P.z), P.z > g.maxZ && (g.maxZ = P.z);
342
342
  }
343
343
  }
344
- let u, g, w = r / 2;
344
+ let u, p, w = r / 2;
345
345
  for (const [x, P] of l)
346
346
  if (P.count >= w) {
347
347
  u = P.minZ;
@@ -349,11 +349,11 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
349
349
  }
350
350
  for (const [x, P] of [...l.entries()].reverse())
351
351
  if (P.count >= w) {
352
- g = P.maxZ;
352
+ p = P.maxZ;
353
353
  break;
354
354
  }
355
- return { minZ: u, maxZ: g };
356
- }, Me = (n, t, e) => {
355
+ return { minZ: u, maxZ: p };
356
+ }, ze = (n, t, e) => {
357
357
  let o = new y.Plane();
358
358
  const i = new y.Vector3(n.x, n.y, n.z), r = new y.Vector3(t.x, t.y, t.z), s = new y.Vector3(t.x, t.y, t.z + 5);
359
359
  o.setFromCoplanarPoints(i, r, s);
@@ -364,14 +364,14 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
364
364
  });
365
365
  let c = new y.Vector3(), h = new y.Vector3();
366
366
  o.projectPoint(i, c), o.projectPoint(r, h);
367
- const f = new y.Line3(c, h), u = [], g = [], w = [];
367
+ const f = new y.Line3(c, h), u = [], p = [], w = [];
368
368
  let x = new y.Vector3();
369
369
  return a.forEach((P, M) => {
370
- f.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (u.push(e[M]), g.push(l[M])) : w.push(P);
371
- }), { newOriginalPoints: u, newProjectPoints: w, newOnLinePoints: g };
372
- }, lo = (n) => {
370
+ f.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (u.push(e[M]), p.push(l[M])) : w.push(P);
371
+ }), { newOriginalPoints: u, newProjectPoints: w, newOnLinePoints: p };
372
+ }, fo = (n) => {
373
373
  function t(e, o, i, r, s, a, l, c, h) {
374
- let f = new y.Line3(e, o), u = /* @__PURE__ */ new Map(), g = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
374
+ let f = new y.Line3(e, o), u = /* @__PURE__ */ new Map(), p = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
375
375
  for (; ; ) {
376
376
  let M = /* @__PURE__ */ new Map(), m = 0;
377
377
  for (let d = 0; d < h.checkResults.length; d++)
@@ -381,7 +381,7 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
381
381
  continue;
382
382
  let V = h.checkResults[d].allCenterPoints[b];
383
383
  V = new y.Vector3(V.x, V.y, V.z);
384
- let v = f.closestPointToPoint(V, !0, g), S = V.distanceTo(v);
384
+ let v = f.closestPointToPoint(V, !0, p), S = V.distanceTo(v);
385
385
  Math.abs(S - s) < 0.01 && (m++, M.has(d) ? M.get(d).removePtsIndex.push(b) : M.set(d, {
386
386
  index: d,
387
387
  removePtsIndex: [b]
@@ -396,17 +396,17 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
396
396
  break;
397
397
  } else {
398
398
  P++;
399
- for (const [d, p] of M)
400
- u.has(d) ? u.get(d).removePtsIndex.push(...p.removePtsIndex) : u.set(d, p);
399
+ for (const [d, g] of M)
400
+ u.has(d) ? u.get(d).removePtsIndex.push(...g.removePtsIndex) : u.set(d, g);
401
401
  M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r), f.set(e, o);
402
402
  }
403
403
  }
404
404
  if (u.size > 0 && P != l)
405
405
  for (const [M, m] of u) {
406
- let d = [], p = [];
406
+ let d = [], g = [];
407
407
  for (let b = 0; b < h.checkResults[M].allCenterPoints.length; b++)
408
- m.removePtsIndex.includes(b) || (d.push(h.checkResults[M].allCenterPoints[b]), p.push(h.checkResults[M].originalVertices[b]));
409
- h.checkResults[M].allCenterPoints = d, h.checkResults[M].originalVertices = p;
408
+ m.removePtsIndex.includes(b) || (d.push(h.checkResults[M].allCenterPoints[b]), g.push(h.checkResults[M].originalVertices[b]));
409
+ h.checkResults[M].allCenterPoints = d, h.checkResults[M].originalVertices = g;
410
410
  }
411
411
  }
412
412
  for (let e = 0; e < n.length; e++) {
@@ -418,26 +418,26 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
418
418
  continue;
419
419
  if (o.checkResults[0].originalVertices && o.checkResults[0].originalVertices.length > 0) {
420
420
  const S = o.checkResults[0].originalVertices[0];
421
- let [z, D, _, E] = S;
422
- z = new y.Vector3(z.x, z.y, z.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), E = new y.Vector3(E.x, E.y, E.z), i = z.distanceTo(D), r = z.distanceTo(E);
423
- let T = new y.Vector3().subVectors(z, D).normalize(), A = te(T, new y.Vector3(0, 0, 1));
421
+ let [z, D, _, T] = S;
422
+ z = new y.Vector3(z.x, z.y, z.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), T = new y.Vector3(T.x, T.y, T.z), i = z.distanceTo(D), r = z.distanceTo(T);
423
+ let E = new y.Vector3().subVectors(z, D).normalize(), A = oe(E, new y.Vector3(0, 0, 1));
424
424
  A && A.parallel && ([r, i] = [i, r]);
425
425
  }
426
426
  if (i < 0 || r < 0)
427
427
  continue;
428
428
  let s = new y.Vector3(o.start.x, o.start.y, o.start.z), a = new y.Vector3(o.end.x, o.end.y, o.end.z);
429
429
  const l = s.distanceTo(a), c = o.rooftopPz - o.start.z, h = Math.ceil(l / i), f = Math.ceil(c / r);
430
- let u = s.clone(), g = a.clone(), w = g.clone().add(new y.Vector3(0, 0, c)), x = u.clone().add(new y.Vector3(0, 0, c)), P = new y.Vector3().subVectors(g, u).normalize(), M = P.clone().negate();
430
+ let u = s.clone(), p = a.clone(), w = p.clone().add(new y.Vector3(0, 0, c)), x = u.clone().add(new y.Vector3(0, 0, c)), P = new y.Vector3().subVectors(p, u).normalize(), M = P.clone().negate();
431
431
  new y.Vector3().subVectors(w, u).normalize().clone().negate();
432
- let d = i / 2, p = l * c, b = i * r, V = p / b;
433
- t(u, x, P, i, d, f, h, V, o), t(g, w, M, i, d, f, h, V, o), o.start = u, o.end = g;
434
- const { newOriginalPoints: v } = Me(u, g, o.originalPoints);
432
+ let d = i / 2, g = l * c, b = i * r, V = g / b;
433
+ t(u, x, P, i, d, f, h, V, o), t(p, w, M, i, d, f, h, V, o), o.start = u, o.end = p;
434
+ const { newOriginalPoints: v } = ze(u, p, o.originalPoints);
435
435
  o.originalPoints = v;
436
436
  }
437
- }, jt = (n, t) => new y.Vector3(n.x, n.y, 0).distanceTo(new y.Vector3(t.x, t.y, 0)), co = (n, t, e = 1e-6) => {
437
+ }, Rt = (n, t) => new y.Vector3(n.x, n.y, 0).distanceTo(new y.Vector3(t.x, t.y, 0)), mo = (n, t, e = 1e-6) => {
438
438
  const o = new y.Vector3();
439
439
  return n.closestPointToPoint(t, !0, o), o.distanceTo(t) < e;
440
- }, Ze = (n) => {
440
+ }, Se = (n) => {
441
441
  let t = 0, e = [];
442
442
  for (let o = 0; o < n.length; o++)
443
443
  for (let i = o + 1; i < n.length; i++) {
@@ -445,10 +445,10 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
445
445
  r > t && (t = r, e = [n[o], n[i]]);
446
446
  }
447
447
  return e;
448
- }, Tt = (n, t, e = 0.03) => Math.abs(n.x - t.x) < e && Math.abs(n.y - t.y) < e && Math.abs(n.z - t.z) < e, uo = () => {
448
+ }, kt = (n, t, e = 0.03) => Math.abs(n.x - t.x) < e && Math.abs(n.y - t.y) < e && Math.abs(n.z - t.z) < e, go = () => {
449
449
  const n = Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0"), t = Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0"), e = Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0");
450
450
  return `#${n}${t}${e}`;
451
- }, ho = (n, t = 1e-3) => {
451
+ }, po = (n, t = 1e-3) => {
452
452
  const e = /* @__PURE__ */ new Map(), o = [];
453
453
  for (const i of n) {
454
454
  const r = Math.round(i.x / t), s = Math.round(i.y / t), a = Math.round(i.z / t), l = `${r},${s},${a}`;
@@ -456,12 +456,12 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
456
456
  }
457
457
  return o;
458
458
  };
459
- class fo {
459
+ class yo {
460
460
  // 空白区域聚类结果
461
461
  constructor() {
462
- Ie(this, "results");
462
+ Fe(this, "results");
463
463
  // 点分布分析结果
464
- Ie(this, "clusterResults");
464
+ Fe(this, "clusterResults");
465
465
  this.results = null;
466
466
  }
467
467
  /**
@@ -535,8 +535,8 @@ class fo {
535
535
  // 左上
536
536
  ]);
537
537
  c.setAttribute("position", new y.BufferAttribute(h, 3)), c.setAttribute("uv", new y.BufferAttribute(u, 2)), c.setIndex(f), c.computeVertexNormals();
538
- const g = new y.Mesh(c, r), w = new y.EdgesGeometry(c), x = new y.LineSegments(w, new y.LineBasicMaterial({ color: a }));
539
- return s.add(x), g;
538
+ const p = new y.Mesh(c, r), w = new y.EdgesGeometry(c), x = new y.LineSegments(w, new y.LineBasicMaterial({ color: a }));
539
+ return s.add(x), p;
540
540
  }
541
541
  /**
542
542
  * 将一面墙体按 rows×cols 细分成小格 Mesh,每格存入 wallGroup。
@@ -553,15 +553,15 @@ class fo {
553
553
  for (let m = 0; m < f.length; m++)
554
554
  if (!this.isValidVector3(f[m]))
555
555
  return console.error(`墙体基础点${m}无效:`, f[m]), s;
556
- const u = a.distanceTo(l), g = Math.abs(t.rooftopPz - t.start.z);
557
- if (u === 0 || g === 0)
556
+ const u = a.distanceTo(l), p = Math.abs(t.rooftopPz - t.start.z);
557
+ if (u === 0 || p === 0)
558
558
  return console.error("墙体宽度或高度为0"), console.log("line.rooftopPz", t.rooftopPz), console.log("bottomLeft", a), console.log("bottomRight", l), console.log(t.length), s;
559
- const w = u / o, x = g / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
559
+ const w = u / o, x = p / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
560
560
  for (let m = 0; m < e; m++)
561
561
  for (let d = 0; d < o; d++)
562
562
  try {
563
- const p = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar(m * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar(m * x)), V = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar((m + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar((m + 1) * x)), S = {
564
- points: [p, b, V, v],
563
+ const g = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar(m * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar(m * x)), V = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar((m + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar((m + 1) * x)), S = {
564
+ points: [g, b, V, v],
565
565
  userData: {}
566
566
  };
567
567
  S.userData = {
@@ -572,8 +572,8 @@ class fo {
572
572
  width: w,
573
573
  height: x
574
574
  }, s.push(S);
575
- } catch (p) {
576
- console.error(`创建墙体小平面(${m}, ${d})时出错:`, p);
575
+ } catch (g) {
576
+ console.error(`创建墙体小平面(${m}, ${d})时出错:`, g);
577
577
  }
578
578
  return s;
579
579
  }
@@ -873,23 +873,23 @@ class fo {
873
873
  }), this.results.totalSegments = r.length;
874
874
  for (const s of r) {
875
875
  if (s.vertices.length < 4) continue;
876
- const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [c, h, f, u] = s.vertices, g = new y.Vector3().subVectors(h, c).normalize(), w = new y.Vector3().subVectors(u, c).normalize(), x = c.distanceTo(h), P = c.distanceTo(u), M = new y.Plane();
876
+ const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [c, h, f, u] = s.vertices, p = new y.Vector3().subVectors(h, c).normalize(), w = new y.Vector3().subVectors(u, c).normalize(), x = c.distanceTo(h), P = c.distanceTo(u), M = new y.Plane();
877
877
  M.setFromCoplanarPoints(c, h, u);
878
878
  const m = x / 2, d = P / 2;
879
- for (let p = 0; p < e.length; p++)
879
+ for (let g = 0; g < e.length; g++)
880
880
  this.isPointInWallSegmentOptimized(
881
- e[p],
881
+ e[g],
882
882
  a,
883
883
  M,
884
884
  c,
885
- g,
885
+ p,
886
886
  w,
887
887
  x,
888
888
  P,
889
889
  m,
890
890
  d,
891
891
  o
892
- ) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(p));
892
+ ) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(g));
893
893
  }
894
894
  return r.forEach((s) => {
895
895
  const a = `row${s.userData.row}_col${s.userData.col}`, l = this.results.pointsInSegments.has(a) ? this.results.pointsInSegments.get(a).length : 0;
@@ -914,11 +914,11 @@ class fo {
914
914
  isPointInWallSegmentOptimized(t, e, o, i, r, s, a, l, c, h, f) {
915
915
  if (Math.abs(o.distanceToPoint(t)) > f)
916
916
  return !1;
917
- const g = new y.Vector3().subVectors(t, e), w = Math.abs(g.dot(r)), x = Math.abs(g.dot(s));
917
+ const p = new y.Vector3().subVectors(t, e), w = Math.abs(p.dot(r)), x = Math.abs(p.dot(s));
918
918
  if (w > c && x > h)
919
919
  return !1;
920
- const P = new y.Vector3().subVectors(t, i), M = P.dot(r), m = P.dot(s), d = M >= -f && M <= a + f, p = m >= -f && m <= l + f;
921
- return d && p;
920
+ const P = new y.Vector3().subVectors(t, i), M = P.dot(r), m = P.dot(s), d = M >= -f && M <= a + f, g = m >= -f && m <= l + f;
921
+ return d && g;
922
922
  }
923
923
  // 判断点是否在细分墙体平面内
924
924
  isPointInWallSegment(t, e, o, i = 0.1) {
@@ -937,7 +937,7 @@ class fo {
937
937
  return !1;
938
938
  const f = new y.Vector3().subVectors(s, r).normalize(), u = new y.Vector3().subVectors(l, r).normalize();
939
939
  new y.Vector3().crossVectors(f, u).normalize();
940
- const g = new y.Vector3().subVectors(e, r), w = g.dot(f), x = g.dot(u), P = r.distanceTo(s), M = r.distanceTo(l), m = w >= -i && w <= P + i, d = x >= -i && x <= M + i;
940
+ const p = new y.Vector3().subVectors(e, r), w = p.dot(f), x = p.dot(u), P = r.distanceTo(s), M = r.distanceTo(l), m = w >= -i && w <= P + i, d = x >= -i && x <= M + i;
941
941
  return m && d && o.distanceTo(e) < P / 2 && o.distanceTo(e) < M / 2;
942
942
  }
943
943
  // 优化顶点获取(添加缓存)
@@ -1020,9 +1020,9 @@ class fo {
1020
1020
  });
1021
1021
  }), t.forEach((u) => {
1022
1022
  if (u.userData && u.userData.type === "wallSegment") {
1023
- const g = `row${u.userData.row}_col${u.userData.col}`, w = r.has(g);
1023
+ const p = `row${u.userData.row}_col${u.userData.col}`, w = r.has(p);
1024
1024
  s.has(u.userData.row) || s.set(u.userData.row, /* @__PURE__ */ new Map()), s.get(u.userData.row).has(u.userData.col) || s.get(u.userData.row).set(u.userData.col, {
1025
- segmentKey: g,
1025
+ segmentKey: p,
1026
1026
  isEmpty: w,
1027
1027
  visited: !1
1028
1028
  });
@@ -1038,15 +1038,15 @@ class fo {
1038
1038
  [-1, 0]
1039
1039
  // 上
1040
1040
  ];
1041
- for (const [u, g] of r) {
1042
- const w = (f = s.get(g.row)) == null ? void 0 : f.get(g.col);
1041
+ for (const [u, p] of r) {
1042
+ const w = (f = s.get(p.row)) == null ? void 0 : f.get(p.col);
1043
1043
  if (w && !w.visited) {
1044
- const x = [], P = [[g.row, g.col]];
1044
+ const x = [], P = [[p.row, p.col]];
1045
1045
  for (w.visited = !0; P.length > 0; ) {
1046
1046
  const [M, m] = P.shift(), d = `row${M}_col${m}`;
1047
1047
  r.has(d) && x.push(r.get(d));
1048
- for (const [p, b] of l) {
1049
- const V = M + p, v = m + b;
1048
+ for (const [g, b] of l) {
1049
+ const V = M + g, v = m + b;
1050
1050
  if (s.has(V) && s.get(V).has(v)) {
1051
1051
  const S = s.get(V).get(v);
1052
1052
  !S.visited && S.isEmpty && (S.visited = !0, P.push([V, v]));
@@ -1058,7 +1058,7 @@ class fo {
1058
1058
  }
1059
1059
  const c = this.createClusterMaterials(a.length), h = [];
1060
1060
  return this.clusterResults = {
1061
- clusters: a.sort((u, g) => g.length - u.length),
1061
+ clusters: a.sort((u, p) => p.length - u.length),
1062
1062
  highlightedMeshes: h,
1063
1063
  clusterMaterials: c,
1064
1064
  totalClusters: a.length,
@@ -1083,10 +1083,10 @@ class fo {
1083
1083
  for (let x = e; x <= o; x++)
1084
1084
  t.has(x) && t.get(x).has(f) || (u = !1);
1085
1085
  u && s++;
1086
- const g = r;
1086
+ const p = r;
1087
1087
  let w = !0;
1088
1088
  for (let x = e; x <= o; x++)
1089
- t.has(x) && t.get(x).has(g) || (w = !1);
1089
+ t.has(x) && t.get(x).has(p) || (w = !1);
1090
1090
  return w && s++, s / 4;
1091
1091
  }
1092
1092
  // 计算聚类质量分数
@@ -1099,16 +1099,16 @@ class fo {
1099
1099
  var f, u;
1100
1100
  if (t.length === 0) return { width: 0, height: 0 };
1101
1101
  const e = [];
1102
- if (t.forEach((g) => {
1103
- g.vertices && g.vertices.length > 0 && e.push(...g.vertices);
1102
+ if (t.forEach((p) => {
1103
+ p.vertices && p.vertices.length > 0 && e.push(...p.vertices);
1104
1104
  }), e.length === 0) {
1105
- const g = [...new Set(t.map((x) => x.row))];
1105
+ const p = [...new Set(t.map((x) => x.row))];
1106
1106
  return {
1107
1107
  width: [...new Set(t.map((x) => x.col))].length * (((f = t[0].bounds) == null ? void 0 : f.width) || 1),
1108
- height: g.length * (((u = t[0].bounds) == null ? void 0 : u.height) || 1)
1108
+ height: p.length * (((u = t[0].bounds) == null ? void 0 : u.height) || 1)
1109
1109
  };
1110
1110
  }
1111
- const o = Math.min(...e.map((g) => g.x)), i = Math.max(...e.map((g) => g.x)), r = Math.min(...e.map((g) => g.y)), s = Math.max(...e.map((g) => g.y)), a = Math.min(...e.map((g) => g.z)), l = Math.max(...e.map((g) => g.z)), c = Math.abs(i - o), h = Math.max(Math.abs(s - r), Math.abs(l - a));
1111
+ const o = Math.min(...e.map((p) => p.x)), i = Math.max(...e.map((p) => p.x)), r = Math.min(...e.map((p) => p.y)), s = Math.max(...e.map((p) => p.y)), a = Math.min(...e.map((p) => p.z)), l = Math.max(...e.map((p) => p.z)), c = Math.abs(i - o), h = Math.max(Math.abs(s - r), Math.abs(l - a));
1112
1112
  return { width: c, height: h };
1113
1113
  }
1114
1114
  // 创建不同颜色的聚类材质
@@ -1211,28 +1211,28 @@ class fo {
1211
1211
  o.forEach((a, l) => {
1212
1212
  a.applyMatrix4(e[l].matrixWorld);
1213
1213
  });
1214
- const i = eo(o), r = e[0].material.clone(), s = new y.Mesh(i, r);
1214
+ const i = io(o), r = e[0].material.clone(), s = new y.Mesh(i, r);
1215
1215
  return s.name = "mergedWalls", s;
1216
1216
  } catch (o) {
1217
1217
  return console.error("合并网格时出错:", o), null;
1218
1218
  }
1219
1219
  }
1220
1220
  }
1221
- const mo = (n) => {
1221
+ const xo = (n) => {
1222
1222
  let t = {};
1223
1223
  const e = [], o = [], i = [];
1224
1224
  return n[0].width, n[0].height, n.forEach((r) => {
1225
1225
  o.push(...r.vertices), i.push(r.center), e.push(r.vertices);
1226
1226
  }), t.originalVertices = e, t.allCenterPoints = i, t;
1227
- }, go = (n) => {
1228
- const t = new Mt().copy(n.start).add(n.end).multiplyScalar(0.5), e = new Mt().subVectors(
1229
- new Mt(t.x, t.y, t.z + 1),
1227
+ }, wo = (n) => {
1228
+ const t = new zt().copy(n.start).add(n.end).multiplyScalar(0.5), e = new zt().subVectors(
1229
+ new zt(t.x, t.y, t.z + 1),
1230
1230
  t
1231
- ).normalize(), o = new Mt(n.direction.x, n.direction.y, 0);
1231
+ ).normalize(), o = new zt(n.direction.x, n.direction.y, 0);
1232
1232
  o.applyAxisAngle(e, Math.PI / 2);
1233
- const i = new Mt().copy(t).add(o.clone().multiplyScalar(n.length)), r = new Mt().copy(t).sub(o.clone().multiplyScalar(n.length));
1233
+ const i = new zt().copy(t).add(o.clone().multiplyScalar(n.length)), r = new zt().copy(t).sub(o.clone().multiplyScalar(n.length));
1234
1234
  return t.z = n.start.z, i.z = n.start.z, r.z = n.start.z, { start: i, end: r, center: t, direction: o };
1235
- }, si = (n, t, e = !0) => {
1235
+ }, ui = (n, t, e = !0) => {
1236
1236
  let o = [];
1237
1237
  if (!n)
1238
1238
  return [];
@@ -1242,74 +1242,74 @@ const mo = (n) => {
1242
1242
  let s = new y.Vector3(r.start.x, r.start.y, r.start.z);
1243
1243
  s.applyEuler(new y.Euler(-Math.PI / 2, 0, 0));
1244
1244
  let a = new y.Vector3(r.end.x, r.end.y, r.end.z);
1245
- if (a.applyEuler(new y.Euler(-Math.PI / 2, 0, 0)), t.add(oo(String(i), new y.Vector3((s.x + a.x) / 2, (s.y + a.y) / 2, (s.z + a.z) / 2))), (r.isBayWindow || r.isWindow) && e) continue;
1246
- const l = new Qn().setFromCoplanarPoints(new Mt(r.start.x, r.start.y, r.start.z), new Mt(r.end.x, r.end.y, r.end.z), new Mt(r.start.x, r.start.y, r.rooftopPz)), c = [];
1245
+ if (a.applyEuler(new y.Euler(-Math.PI / 2, 0, 0)), t.add(ao(String(i), new y.Vector3((s.x + a.x) / 2, (s.y + a.y) / 2, (s.z + a.z) / 2))), (r.isBayWindow || r.isWindow) && e) continue;
1246
+ const l = new no().setFromCoplanarPoints(new zt(r.start.x, r.start.y, r.start.z), new zt(r.end.x, r.end.y, r.end.z), new zt(r.start.x, r.start.y, r.rooftopPz)), c = [];
1247
1247
  r.originalPoints.forEach((v, S) => {
1248
- const z = new Mt();
1248
+ const z = new zt();
1249
1249
  l.projectPoint(v, z), c.push(z);
1250
1250
  });
1251
- const h = new Mt(r.start.x, r.start.y, r.start.z).distanceTo(new Mt(r.end.x, r.end.y, r.end.z)), f = Math.abs(r.rooftopPz - r.start.z), u = new y.MeshBasicMaterial({
1251
+ const h = new zt(r.start.x, r.start.y, r.start.z).distanceTo(new zt(r.end.x, r.end.y, r.end.z)), f = Math.abs(r.rooftopPz - r.start.z), u = new y.MeshBasicMaterial({
1252
1252
  color: "red",
1253
1253
  side: y.DoubleSide,
1254
1254
  wireframe: !1,
1255
1255
  transparent: !0,
1256
1256
  opacity: 0.5
1257
- }), g = new y.Group(), w = new fo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, f), M = w.createSubdividedWallPlane(r, P, x, u, g);
1257
+ }), p = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, f), M = w.createSubdividedWallPlane(r, P, x, u, p);
1258
1258
  w.analyzePointDistribution(M, c, 0.01);
1259
1259
  const m = new y.MeshBasicMaterial({
1260
1260
  color: "black",
1261
1261
  transparent: !0,
1262
1262
  opacity: 0.8,
1263
1263
  side: y.DoubleSide
1264
- }), d = w.highlightEmptySegments(M, m, g), p = [];
1264
+ }), d = w.highlightEmptySegments(M, m, p), g = [];
1265
1265
  for (const v of d.clusters) {
1266
- const S = mo(v);
1267
- S && p.push(S);
1266
+ const S = xo(v);
1267
+ S && g.push(S);
1268
1268
  }
1269
- const V = go(r).direction;
1270
- r.checkResults = p, r.verticalDirection = V, r.originaIndex = i, o.push(r);
1269
+ const V = wo(r).direction;
1270
+ r.checkResults = g, r.verticalDirection = V, r.originaIndex = i, o.push(r);
1271
1271
  }
1272
1272
  return o;
1273
- }, ai = (n, t) => {
1273
+ }, hi = (n, t) => {
1274
1274
  console.log("lines", n);
1275
1275
  for (let e = 0; e < n.length; e++) {
1276
1276
  const o = n[e], i = [];
1277
1277
  o.originalPoints.forEach((d) => {
1278
- let p = new y.Vector3(d.x, d.y, 0), b = !1;
1278
+ let g = new y.Vector3(d.x, d.y, 0), b = !1;
1279
1279
  for (let V = 0; V < i.length; V++)
1280
- if (Tt(p, i[V], 0.01)) {
1280
+ if (kt(g, i[V], 0.01)) {
1281
1281
  b = !0;
1282
1282
  break;
1283
1283
  }
1284
- b || i.push(p);
1284
+ b || i.push(g);
1285
1285
  });
1286
1286
  const r = Math.round(Math.max(5, Math.min(350, 20 * Math.sqrt(o.length)))), s = 1;
1287
1287
  let a = new y.Vector3(o.start.x, o.start.y, o.start.z), l = new y.Vector3(o.end.x, o.end.y, o.end.z), c = new y.Vector3().subVectors(l, a).normalize(), h = c.clone().cross(new y.Vector3(0, 0, 1)).normalize(), f = h.clone().negate(), u = [];
1288
- const g = [];
1288
+ const p = [];
1289
1289
  let w = o.length / r;
1290
1290
  console.log(w);
1291
1291
  for (let d = 0; d < r; d++) {
1292
- const p = [];
1293
- p.push(a.clone().addScaledVector(h, s)), p.push(p[0].clone().addScaledVector(c, w)), p.push(p[1].clone().addScaledVector(f, s * 2)), p.push(a.clone().addScaledVector(f, w));
1292
+ const g = [];
1293
+ g.push(a.clone().addScaledVector(h, s)), g.push(g[0].clone().addScaledVector(c, w)), g.push(g[1].clone().addScaledVector(f, s * 2)), g.push(a.clone().addScaledVector(f, w));
1294
1294
  let b = [];
1295
1295
  for (let V = 0; V < i.length; V++)
1296
- u.includes(V) || yo(i[V], p) && (u.push(V), b.push(i[V]));
1297
- b.length > 0 && g.push(xo(b)), a = a.addScaledVector(c, w);
1296
+ u.includes(V) || Po(i[V], g) && (u.push(V), b.push(i[V]));
1297
+ b.length > 0 && p.push(Mo(b)), a = a.addScaledVector(c, w);
1298
1298
  }
1299
1299
  const x = new Float32Array(i.length * 3);
1300
- i.forEach((d, p) => {
1301
- x[p * 3] = d.x, x[p * 3 + 1] = d.y, x[p * 3 + 2] = d.z;
1300
+ i.forEach((d, g) => {
1301
+ x[g * 3] = d.x, x[g * 3 + 1] = d.y, x[g * 3 + 2] = d.z;
1302
1302
  });
1303
1303
  const P = new y.BufferGeometry();
1304
- P.setAttribute("position", new y.BufferAttribute(x, 3)), P.rotateX(-Math.PI / 2), t.add(new y.Points(P, new y.PointsMaterial({ color: uo(), size: 0.02 })));
1305
- const [M, m] = Mo(g, {
1304
+ P.setAttribute("position", new y.BufferAttribute(x, 3)), P.rotateX(-Math.PI / 2), t.add(new y.Points(P, new y.PointsMaterial({ color: go(), size: 0.02 })));
1305
+ const [M, m] = vo(p, {
1306
1306
  plane: "xy",
1307
1307
  trimRatio: 0
1308
1308
  });
1309
- no(M, m, t);
1309
+ so(M, m, t);
1310
1310
  }
1311
1311
  };
1312
- function Ke(n, t = "xy") {
1312
+ function en(n, t = "xy") {
1313
1313
  if (t === "xy")
1314
1314
  return { x: n.x, y: n.y };
1315
1315
  if (t === "xz")
@@ -1318,23 +1318,23 @@ function Ke(n, t = "xy") {
1318
1318
  return { x: n.y, y: n.z };
1319
1319
  throw new Error(`Unsupported plane: ${t}`);
1320
1320
  }
1321
- function po(n, t, e) {
1321
+ function bo(n, t, e) {
1322
1322
  const o = t.x - n.x, i = t.y - n.y, r = e.x - n.x, s = e.y - n.y;
1323
1323
  return o * s - i * r;
1324
1324
  }
1325
- function yo(n, t, e = "xy") {
1325
+ function Po(n, t, e = "xy") {
1326
1326
  if (!t || t.length !== 4)
1327
1327
  throw new Error("rectPoints must contain 4 points");
1328
- const o = Ke(n, e), i = t.map((a) => Ke(a, e));
1328
+ const o = en(n, e), i = t.map((a) => en(a, e));
1329
1329
  let r = !1, s = !1;
1330
1330
  for (let a = 0; a < 4; a++) {
1331
- const l = i[a], c = i[(a + 1) % 4], h = po(l, c, o);
1331
+ const l = i[a], c = i[(a + 1) % 4], h = bo(l, c, o);
1332
1332
  if (h > 1e-9 && (r = !0), h < -1e-9 && (s = !0), r && s)
1333
1333
  return !1;
1334
1334
  }
1335
1335
  return !0;
1336
1336
  }
1337
- function xo(n) {
1337
+ function Mo(n) {
1338
1338
  if (!n || n.length === 0)
1339
1339
  return null;
1340
1340
  const t = new y.Vector3(0, 0, 0);
@@ -1342,11 +1342,11 @@ function xo(n) {
1342
1342
  Array.isArray(e) ? (t.x += e[0], t.y += e[1], t.z += e[2]) : (t.x += e.x, t.y += e.y, t.z += e.z);
1343
1343
  return t.divideScalar(n.length), t;
1344
1344
  }
1345
- function wo(n) {
1345
+ function zo(n) {
1346
1346
  return n instanceof y.Vector3 ? n.clone() : Array.isArray(n) ? new y.Vector3(n[0], n[1], n[2]) : new y.Vector3(n.x, n.y, n.z);
1347
1347
  }
1348
- function bo(n, t = "xy") {
1349
- const e = wo(n);
1348
+ function Vo(n, t = "xy") {
1349
+ const e = zo(n);
1350
1350
  if (t === "xy")
1351
1351
  return {
1352
1352
  x: e.x,
@@ -1367,7 +1367,7 @@ function bo(n, t = "xy") {
1367
1367
  };
1368
1368
  throw new Error(`Unsupported plane: ${t}`);
1369
1369
  }
1370
- function Qe(n, t, e, o = "xy") {
1370
+ function nn(n, t, e, o = "xy") {
1371
1371
  if (o === "xy")
1372
1372
  return new y.Vector3(n, t, e);
1373
1373
  if (o === "xz")
@@ -1376,7 +1376,7 @@ function Qe(n, t, e, o = "xy") {
1376
1376
  return new y.Vector3(e, n, t);
1377
1377
  throw new Error(`Unsupported plane: ${o}`);
1378
1378
  }
1379
- function Po(n, t, e) {
1379
+ function So(n, t, e) {
1380
1380
  if (Math.abs(t) < 1e-12)
1381
1381
  return n >= e ? { x: 1, y: 0 } : { x: 0, y: 1 };
1382
1382
  const i = n + e, r = n * e - t * t, s = Math.sqrt(Math.max(0, i * i * 0.25 - r)), a = i * 0.5 + s;
@@ -1387,7 +1387,7 @@ function Po(n, t, e) {
1387
1387
  y: c / h
1388
1388
  };
1389
1389
  }
1390
- function Mo(n, t = {}) {
1390
+ function vo(n, t = {}) {
1391
1391
  const {
1392
1392
  plane: e = "xy",
1393
1393
  // 0 表示完全取最远两端
@@ -1396,53 +1396,53 @@ function Mo(n, t = {}) {
1396
1396
  } = t;
1397
1397
  if (!n || n.length < 2)
1398
1398
  return null;
1399
- const i = n.map((B) => bo(B, e));
1399
+ const i = n.map((B) => Vo(B, e));
1400
1400
  let r = 0, s = 0, a = 0;
1401
1401
  for (const B of i)
1402
1402
  r += B.x, s += B.y, a += B.up;
1403
1403
  r /= i.length, s /= i.length, a /= i.length;
1404
1404
  let l = 0, c = 0, h = 0;
1405
1405
  for (const B of i) {
1406
- const L = B.x - r, W = B.y - s;
1407
- l += L * L, c += L * W, h += W * W;
1406
+ const R = B.x - r, W = B.y - s;
1407
+ l += R * R, c += R * W, h += W * W;
1408
1408
  }
1409
1409
  l /= i.length, c /= i.length, h /= i.length;
1410
- const f = Po(l, c, h), u = {
1410
+ const f = So(l, c, h), u = {
1411
1411
  x: -f.y,
1412
1412
  y: f.x
1413
- }, g = [];
1413
+ }, p = [];
1414
1414
  for (const B of i) {
1415
- const L = B.x - r, W = B.y - s, C = L * f.x + W * f.y, R = L * u.x + W * u.y;
1416
- g.push({
1415
+ const R = B.x - r, W = B.y - s, C = R * f.x + W * f.y, L = R * u.x + W * u.y;
1416
+ p.push({
1417
1417
  s: C,
1418
- t: R,
1418
+ t: L,
1419
1419
  up: B.up
1420
1420
  });
1421
1421
  }
1422
- g.sort((B, L) => B.s - L.s);
1423
- const w = g.length;
1422
+ p.sort((B, R) => B.s - R.s);
1423
+ const w = p.length;
1424
1424
  let x = Math.floor(w * o), P = Math.ceil(w * (1 - o)) - 1;
1425
1425
  x = Math.max(0, Math.min(w - 1, x)), P = Math.max(0, Math.min(w - 1, P));
1426
- const M = g[x], m = g[P], d = (() => {
1427
- const B = g.map((W) => W.t).sort((W, C) => W - C), L = Math.floor(B.length / 2);
1428
- return B.length % 2 === 0 ? (B[L - 1] + B[L]) * 0.5 : B[L];
1429
- })(), p = (() => {
1430
- const B = g.map((W) => W.up).sort((W, C) => W - C), L = Math.floor(B.length / 2);
1431
- return B.length % 2 === 0 ? (B[L - 1] + B[L]) * 0.5 : B[L];
1432
- })(), b = M.s, V = m.s, v = d, S = d, z = p, D = p, _ = r + f.x * b + u.x * v, E = s + f.y * b + u.y * v, T = r + f.x * V + u.x * S, A = s + f.y * V + u.y * S, O = Qe(_, E, z, e), I = Qe(T, A, D, e);
1426
+ const M = p[x], m = p[P], d = (() => {
1427
+ const B = p.map((W) => W.t).sort((W, C) => W - C), R = Math.floor(B.length / 2);
1428
+ return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1429
+ })(), g = (() => {
1430
+ const B = p.map((W) => W.up).sort((W, C) => W - C), R = Math.floor(B.length / 2);
1431
+ return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1432
+ })(), b = M.s, V = m.s, v = d, S = d, z = g, D = g, _ = r + f.x * b + u.x * v, T = s + f.y * b + u.y * v, E = r + f.x * V + u.x * S, A = s + f.y * V + u.y * S, O = nn(_, T, z, e), I = nn(E, A, D, e);
1433
1433
  return [O, I];
1434
1434
  }
1435
- const li = async (n, t, e, o, i) => {
1435
+ const fi = async (n, t, e, o, i) => {
1436
1436
  if (o && o.length > 0)
1437
1437
  for (let d = 0; d < o.length; d++) {
1438
- const p = o[d];
1439
- p.isLine2 = !0, n.push(p);
1438
+ const g = o[d];
1439
+ g.isLine2 = !0, n.push(g);
1440
1440
  }
1441
- if (lo(n), n.length <= 0 || t.length <= 0)
1441
+ if (fo(n), n.length <= 0 || t.length <= 0)
1442
1442
  return n;
1443
1443
  e || (e = []);
1444
1444
  for (const d of n) {
1445
- let p = [];
1445
+ let g = [];
1446
1446
  if (!(!d.checkResults || d.checkResults.length <= 0)) {
1447
1447
  for (let b = 0; b < d.checkResults.length; b++) {
1448
1448
  let D = function(A) {
@@ -1470,7 +1470,7 @@ const li = async (n, t, e, o, i) => {
1470
1470
  }
1471
1471
  }
1472
1472
  const _ = /* @__PURE__ */ new Map();
1473
- let E = -1, T = -1;
1473
+ let T = -1, E = -1;
1474
1474
  for (let A = 0; A < S; A++) {
1475
1475
  const O = D(A);
1476
1476
  _.has(O) || _.set(O, {
@@ -1483,54 +1483,54 @@ const li = async (n, t, e, o, i) => {
1483
1483
  centerPts: []
1484
1484
  });
1485
1485
  const I = _.get(O);
1486
- let [B, L, W, C] = v[A];
1487
- const R = new y.Vector3().add(B).add(L).add(W).add(C).multiplyScalar(0.25);
1488
- if (I.points.push(...v[A]), I.area += B.distanceTo(L) * B.distanceTo(C), I.originalVertices.push(v[A]), I.index = b, I.centerPts.push(R), E == -1 || T == -1) {
1489
- let H = new y.Vector3().subVectors(B, L).normalize();
1490
- T = B.distanceTo(C), E = B.distanceTo(L);
1491
- let X = te(H, new y.Vector3(0, 0, 1));
1492
- X && X.parallel && ([T, E] = [E, T]);
1486
+ let [B, R, W, C] = v[A];
1487
+ const L = new y.Vector3().add(B).add(R).add(W).add(C).multiplyScalar(0.25);
1488
+ if (I.points.push(...v[A]), I.area += B.distanceTo(R) * B.distanceTo(C), I.originalVertices.push(v[A]), I.index = b, I.centerPts.push(L), T == -1 || E == -1) {
1489
+ let H = new y.Vector3().subVectors(B, R).normalize();
1490
+ E = B.distanceTo(C), T = B.distanceTo(R);
1491
+ let X = oe(H, new y.Vector3(0, 0, 1));
1492
+ X && X.parallel && ([E, T] = [T, E]);
1493
1493
  }
1494
- I.gridWidth = E, I.gridHeight = T;
1494
+ I.gridWidth = T, I.gridHeight = E;
1495
1495
  }
1496
- p.push(..._.values());
1496
+ g.push(..._.values());
1497
1497
  }
1498
- d.mergeCheckRegion = p;
1498
+ d.mergeCheckRegion = g;
1499
1499
  }
1500
1500
  }
1501
1501
  let r = /* @__PURE__ */ new Map();
1502
1502
  for (const d of n) {
1503
1503
  if (d.length < 0.3) continue;
1504
- let p = d.rooftopPz - d.start.z, b = Math.floor(d.rooftopPz - d.start.z);
1504
+ let g = d.rooftopPz - d.start.z, b = Math.floor(d.rooftopPz - d.start.z);
1505
1505
  r.has(b) ? r.set(b, {
1506
1506
  num: r.get(b).num + 1,
1507
- totalHeight: r.get(b).totalHeight + p
1507
+ totalHeight: r.get(b).totalHeight + g
1508
1508
  }) : r.set(b, {
1509
1509
  num: 1,
1510
- totalHeight: p
1510
+ totalHeight: g
1511
1511
  });
1512
1512
  }
1513
1513
  let s = [...r.entries()].reduce(
1514
- (d, p) => p[1].num > d[1].num ? p : d
1514
+ (d, g) => g[1].num > d[1].num ? g : d
1515
1515
  );
1516
1516
  s[0], s[1].totalHeight / s[1].num;
1517
1517
  const a = [];
1518
1518
  for (let d = 0; d < e.length; d++) {
1519
- const p = e[d];
1520
- if (p.isFindBeam = !1, p.category == "door") {
1519
+ const g = e[d];
1520
+ if (g.isFindBeam = !1, g.category == "door") {
1521
1521
  let b = [];
1522
- p.coordinatesByArea.coordinates.forEach((D) => {
1522
+ g.coordinatesByArea.coordinates.forEach((D) => {
1523
1523
  b.push(new y.Vector3(D.x, D.y, D.z));
1524
1524
  }), b[0].equals(b[b.length - 1]) && b.pop();
1525
1525
  let V = b[0].distanceTo(b[1]), v = b[0].distanceTo(b[3]);
1526
1526
  v > V && ([V, v] = [v, V], b = [b[0], b[3], b[2], b[1]]);
1527
- let S = Qt(b[0], b[3], !0), z = Qt(b[1], b[2], !0);
1527
+ let S = ee(b[0], b[3], !0), z = ee(b[1], b[2], !0);
1528
1528
  a.push({
1529
1529
  doorStartPt: S,
1530
1530
  doorEndPt: z,
1531
1531
  boxPoints: b,
1532
- minZ: p.coordinatesByArea.heightData.minZ,
1533
- maxZ: p.coordinatesByArea.heightData.maxZ,
1532
+ minZ: g.coordinatesByArea.heightData.minZ,
1533
+ maxZ: g.coordinatesByArea.heightData.maxZ,
1534
1534
  index: d,
1535
1535
  isFind: !1,
1536
1536
  inWall: !1
@@ -1539,36 +1539,36 @@ const li = async (n, t, e, o, i) => {
1539
1539
  }
1540
1540
  }
1541
1541
  for (let d = 0; d < a.length; d++) {
1542
- const p = a[d];
1542
+ const g = a[d];
1543
1543
  for (let b = 0; b < n.length; b++) {
1544
1544
  if (n[b].length < 0.5) continue;
1545
1545
  let V = [];
1546
- const v = Qt(n[b].start, n[b].end, !0);
1547
- V.push(v), V.push(Qt(v, n[b].start, !0)), V.push(Qt(v, n[b].end, !0));
1546
+ const v = ee(n[b].start, n[b].end, !0);
1547
+ V.push(v), V.push(ee(v, n[b].start, !0)), V.push(ee(v, n[b].end, !0));
1548
1548
  let S = !1;
1549
- const z = p.boxPoints.length;
1549
+ const z = g.boxPoints.length;
1550
1550
  for (let D = 0; D < V.length; D++) {
1551
- const _ = V[D].x, E = V[D].y;
1552
- for (let T = 0, A = z - 1; T < z; A = T++) {
1553
- const O = p.boxPoints[T].x, I = p.boxPoints[T].y, B = p.boxPoints[A].x, L = p.boxPoints[A].y;
1554
- I > E != L > E && _ < (B - O) * (E - I) / (L - I) + O && (S = !S);
1551
+ const _ = V[D].x, T = V[D].y;
1552
+ for (let E = 0, A = z - 1; E < z; A = E++) {
1553
+ const O = g.boxPoints[E].x, I = g.boxPoints[E].y, B = g.boxPoints[A].x, R = g.boxPoints[A].y;
1554
+ I > T != R > T && _ < (B - O) * (T - I) / (R - I) + O && (S = !S);
1555
1555
  }
1556
1556
  if (S) break;
1557
1557
  }
1558
1558
  if (S) {
1559
- let D = new y.Vector3(n[b].start.x, n[b].start.y, 0), _ = new y.Vector3(n[b].end.x, n[b].end.y, 0), E = p.doorStartPt.distanceTo(p.doorEndPt), T = D.distanceTo(_), A = ie(p.doorStartPt, p.doorEndPt, D, _);
1560
- if (Math.abs(T - E) < 0.5 && A && A.angleDeg < 15) {
1561
- p.doorStartPt = new y.Vector3(n[b].start.x, n[b].start.y, 0), p.doorEndPt = new y.Vector3(n[b].end.x, n[b].end.y, 0);
1559
+ let D = new y.Vector3(n[b].start.x, n[b].start.y, 0), _ = new y.Vector3(n[b].end.x, n[b].end.y, 0), T = g.doorStartPt.distanceTo(g.doorEndPt), E = D.distanceTo(_), A = Jt(g.doorStartPt, g.doorEndPt, D, _);
1560
+ if (Math.abs(E - T) < 0.5 && A && A.angleDeg < 15) {
1561
+ g.doorStartPt = new y.Vector3(n[b].start.x, n[b].start.y, 0), g.doorEndPt = new y.Vector3(n[b].end.x, n[b].end.y, 0);
1562
1562
  break;
1563
- } else if (Math.abs(T - E) > 1.3 && A && A.angleDeg < 15) {
1564
- let O = Jt(p.doorStartPt, p.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = p.doorStartPt.distanceTo(D), B = p.doorStartPt.distanceTo(_), L = p.doorEndPt.distanceTo(D), W = p.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || L < 0.2 || W < 0.2;
1563
+ } else if (Math.abs(E - T) > 1.3 && A && A.angleDeg < 15) {
1564
+ let O = ne(g.doorStartPt, g.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = g.doorStartPt.distanceTo(D), B = g.doorStartPt.distanceTo(_), R = g.doorEndPt.distanceTo(D), W = g.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || R < 0.2 || W < 0.2;
1565
1565
  if (O && O.type == "collinear_overlap" && O.maxPerpendicularDistance < 0.1 && !C) {
1566
- p.inWall = !0;
1566
+ g.inWall = !0;
1567
1567
  break;
1568
1568
  } else {
1569
- let R = new y.Line3(D, _), H = R.closestPointToPoint(p.doorStartPt, !0, new y.Vector3()), X = R.closestPointToPoint(p.doorEndPt, !0, new y.Vector3()), nt = H.distanceTo(p.doorStartPt), U = X.distanceTo(p.doorEndPt);
1570
- if (nt < 0.1 || U < 0.1) {
1571
- p.inWall = !0;
1569
+ let L = new y.Line3(D, _), H = L.closestPointToPoint(g.doorStartPt, !0, new y.Vector3()), X = L.closestPointToPoint(g.doorEndPt, !0, new y.Vector3()), ot = H.distanceTo(g.doorStartPt), K = X.distanceTo(g.doorEndPt);
1570
+ if (ot < 0.1 || K < 0.1) {
1571
+ g.inWall = !0;
1572
1572
  break;
1573
1573
  }
1574
1574
  }
@@ -1579,413 +1579,447 @@ const li = async (n, t, e, o, i) => {
1579
1579
  }
1580
1580
  let l = 0, c = [], h = [], f = [];
1581
1581
  const u = [];
1582
- let g = 0.15;
1582
+ let p = 0.15;
1583
1583
  for (let d = 0; d < n.length; d++) {
1584
- const p = n[d];
1585
- if (p.noDetection || (p.doorAndBeamData = [], !p.mergeCheckRegion || p.mergeCheckRegion.length == 0))
1584
+ const g = n[d];
1585
+ if (g.noDetection || (g.doorAndBeamData = [], !g.mergeCheckRegion || g.mergeCheckRegion.length == 0))
1586
1586
  continue;
1587
- p.completePointAreaPercentage = -1;
1587
+ g.completePointAreaPercentage = -1;
1588
1588
  let b = new y.Box3();
1589
- b.setFromPoints(p.originalPoints);
1589
+ b.setFromPoints(g.originalPoints);
1590
1590
  let V = b.max.z;
1591
1591
  b.min.z;
1592
- const v = new y.Vector3(p.start.x, p.start.y, p.start.z), S = new y.Vector3(p.end.x, p.end.y, p.end.z);
1593
- let z = p.rooftopPz - p.start.z, D = 0;
1594
- for (const E of p.mergeCheckRegion) {
1595
- const { facePoints: T, boxArea: A, totalInPlaneNum: O } = io(
1596
- E.points,
1597
- E.gridWidth,
1598
- E.gridHeight,
1599
- E.centerPts
1592
+ const v = new y.Vector3(g.start.x, g.start.y, g.start.z), S = new y.Vector3(g.end.x, g.end.y, g.end.z);
1593
+ let z = g.rooftopPz - g.start.z, D = 0;
1594
+ for (const T of g.mergeCheckRegion) {
1595
+ const { facePoints: E, boxArea: A, totalInPlaneNum: O } = co(
1596
+ T.points,
1597
+ T.gridWidth,
1598
+ T.gridHeight,
1599
+ T.centerPts
1600
1600
  );
1601
- if (!T || T.length <= 0)
1601
+ if (!E || E.length <= 0)
1602
1602
  continue;
1603
- T[0].distanceTo(T[1]);
1604
- let I = T[0].distanceTo(T[3]);
1605
- const B = E.gridHeight * (I / E.gridHeight / 3 * 2) + E.gridHeight / 2;
1606
- let L = new y.Vector3(T[0].x, T[0].y, T[0].z + B), W = new y.Vector3(T[1].x, T[1].y, T[1].z + B);
1607
- const C = new y.Line3(L, W), R = [];
1603
+ E[0].distanceTo(E[1]);
1604
+ let I = E[0].distanceTo(E[3]);
1605
+ const B = T.gridHeight * (I / T.gridHeight / 3 * 2) + T.gridHeight / 2;
1606
+ let R = new y.Vector3(E[0].x, E[0].y, E[0].z + B), W = new y.Vector3(E[1].x, E[1].y, E[1].z + B);
1607
+ const C = new y.Line3(R, W), L = [];
1608
1608
  let H = new y.Vector3();
1609
- E.points.forEach((ot) => {
1610
- C.closestPointToPoint(ot, !0, H).distanceTo(ot) < E.gridHeight + 0.01 && R.push(ot);
1609
+ T.points.forEach((rt) => {
1610
+ C.closestPointToPoint(rt, !0, H).distanceTo(rt) < T.gridHeight + 0.01 && L.push(rt);
1611
1611
  });
1612
- let X = [], nt = [];
1612
+ let X = [], ot = [];
1613
1613
  for (; ; ) {
1614
- let ot = [];
1615
- for (let F = 0; F < R.length; F++)
1616
- nt.includes(F) || ot.length == 0 && (ot.push(R[F]), nt.push(F));
1617
- for (let F = 0; F < R.length; F++)
1618
- if (!nt.includes(F)) {
1619
- for (let Y = 0; Y < ot.length; Y++)
1620
- if (R[F].distanceTo(ot[Y]) < E.gridWidth + 0.01) {
1621
- ot.push(R[F]), nt.push(F), F = -1;
1614
+ let rt = [];
1615
+ for (let F = 0; F < L.length; F++)
1616
+ ot.includes(F) || rt.length == 0 && (rt.push(L[F]), ot.push(F));
1617
+ for (let F = 0; F < L.length; F++)
1618
+ if (!ot.includes(F)) {
1619
+ for (let Y = 0; Y < rt.length; Y++)
1620
+ if (L[F].distanceTo(rt[Y]) < T.gridWidth + 0.01) {
1621
+ rt.push(L[F]), ot.push(F), F = -1;
1622
1622
  break;
1623
1623
  }
1624
1624
  }
1625
- if (ot.length == 0)
1625
+ if (rt.length == 0)
1626
1626
  break;
1627
- X.push(ot);
1627
+ X.push(rt);
1628
1628
  }
1629
- const U = [];
1630
- for (let ot = 0; ot < X.length; ot++) {
1629
+ const K = [];
1630
+ for (let rt = 0; rt < X.length; rt++) {
1631
1631
  const F = {
1632
1632
  lineSt: new y.Vector3(),
1633
1633
  lineEd: new y.Vector3(),
1634
1634
  facePoints: []
1635
1635
  };
1636
- let Y = Ze(X[ot]);
1637
- Array.isArray(Y) && Y.length == 2 && (F.lineSt = Y[0], F.lineEd = Y[1], F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y, T[0].z)), F.facePoints.push(new y.Vector3(Y[1].x, Y[1].y, T[0].z)), F.facePoints.push(new y.Vector3(Y[1].x, Y[1].y, T[2].z)), F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y, T[2].z)), U.push(F));
1636
+ let Y = Se(X[rt]);
1637
+ Array.isArray(Y) && Y.length == 2 && (F.lineSt = Y[0], F.lineEd = Y[1], F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y, E[0].z)), F.facePoints.push(new y.Vector3(Y[1].x, Y[1].y, E[0].z)), F.facePoints.push(new y.Vector3(Y[1].x, Y[1].y, E[2].z)), F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y, E[2].z)), K.push(F));
1638
1638
  }
1639
- D += E.area;
1640
- let $ = 0;
1641
- if (O != 0 && ($ = E.gridHeight * E.gridWidth * O), (E.area - $) / A * 100 > 70 && U.length == 1 || U.length > 1)
1642
- for (let ot = 0; ot < U.length; ot++) {
1643
- const F = U[ot];
1644
- let Y = F.facePoints[0].distanceTo(F.facePoints[1]), Pt = F.facePoints[0].distanceTo(F.facePoints[3]), Gt = Y / p.length * 100, Ot = p.rooftopPz - F.facePoints[2].z;
1645
- if (Pt < 1.5 || V < F.facePoints[2].z || Ot > z / 3 * 2)
1639
+ D += T.area;
1640
+ let G = 0;
1641
+ if (O != 0 && (G = T.gridHeight * T.gridWidth * O), (T.area - G) / A * 100 > 70 && K.length == 1 || K.length > 1)
1642
+ for (let rt = 0; rt < K.length; rt++) {
1643
+ const F = K[rt];
1644
+ let Y = F.facePoints[0].distanceTo(F.facePoints[1]), Mt = F.facePoints[0].distanceTo(F.facePoints[3]), Zt = Y / g.length * 100, Nt = g.rooftopPz - F.facePoints[2].z;
1645
+ if (Mt < 1.5 || V < F.facePoints[2].z || Nt > z / 3 * 2)
1646
1646
  continue;
1647
- let Bt = !1, vt = !1, Dt = !1, It = [], Q = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), q = F.facePoints[0].clone(), G = F.facePoints[1].clone(), Lt = !1, _t = -1;
1648
- if (Math.abs(F.facePoints[0].z - p.start.z) < 0.25) {
1649
- if (Y > 0.17 && p.length > 0.5) {
1650
- let Wt = jt(v, q), K = jt(v, G), ct = jt(S, q), N = jt(S, G);
1651
- const wt = 0.1, zt = 10;
1652
- if (Wt < wt || K < wt) {
1653
- const { newOriginalPoints: $t } = Me(q, G, p.originalPoints), at = [];
1654
- if ($t.forEach((J) => {
1655
- J.z >= Q.z ? at.push(J) : J.z <= q.z;
1647
+ let Lt = !1, _t = !1, Tt = !1, Ft = [], tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), q = F.facePoints[0].clone(), j = F.facePoints[1].clone(), Wt = !1, Et = -1;
1648
+ if (Math.abs(F.facePoints[0].z - g.start.z) < 0.25) {
1649
+ if (Y > 0.17 && g.length > 0.5) {
1650
+ let qt = Rt(v, q), J = Rt(v, j), ct = Rt(S, q), N = Rt(S, j);
1651
+ const bt = 0.1, Vt = 10;
1652
+ if (qt < bt || J < bt) {
1653
+ const { newOriginalPoints: Ut } = ze(q, j, g.originalPoints), at = [];
1654
+ if (Ut.forEach((Q) => {
1655
+ Q.z >= tt.z ? at.push(Q) : Q.z <= q.z;
1656
1656
  }), at.length > 10) {
1657
- const J = new y.Vector3(p.start.x, p.start.y, 0), gt = new y.Vector3(p.end.x, p.end.y, 0), bt = new y.Vector3().subVectors(J, gt).normalize();
1658
- let Ht = new y.Vector3(), ht = 1 / 0, j = -1, k = !1, ft = !1;
1659
- for (let it = 0; it < n.length; it++) {
1660
- if (it == d) continue;
1661
- const st = new y.Vector3(n[it].start.x, n[it].start.y, 0), dt = new y.Vector3(n[it].end.x, n[it].end.y, 0), At = Kt(J, gt, st, dt);
1662
- let Vt = ee(J, gt, st, dt);
1663
- if (At != null) {
1664
- if (Vt && Vt.angle > 85) {
1665
- let Rt = At.point.distanceTo(J);
1666
- if (At.point.distanceTo(gt), Rt < 0.3) {
1667
- ft = !0, ht = 1 / 0, j = -1;
1657
+ const Q = new y.Vector3(g.start.x, g.start.y, 0), gt = new y.Vector3(g.end.x, g.end.y, 0), Pt = new y.Vector3().subVectors(Q, gt).normalize();
1658
+ let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
1659
+ for (let U = 0; U < n.length; U++) {
1660
+ if (U == d) continue;
1661
+ const it = new y.Vector3(n[U].start.x, n[U].start.y, 0), dt = new y.Vector3(n[U].end.x, n[U].end.y, 0), Ct = te(Q, gt, it, dt);
1662
+ let St = re(Q, gt, it, dt);
1663
+ if (Ct != null) {
1664
+ if (St && St.angle > 85) {
1665
+ let At = Ct.point.distanceTo(Q);
1666
+ if (Ct.point.distanceTo(gt), At < 0.3) {
1667
+ ft = !0, ht = 1 / 0, Z = -1;
1668
1668
  break;
1669
1669
  }
1670
1670
  }
1671
1671
  continue;
1672
1672
  }
1673
- if (Vt && Vt.angle > 85) {
1674
- const Z = new y.Line3(st, dt).closestPointToPoint(J, !0, Ht);
1675
- let pt = ie(J, gt, Z, J);
1673
+ if (St && St.angle > 85) {
1674
+ const $ = new y.Line3(it, dt).closestPointToPoint(Q, !0, Gt);
1675
+ let pt = Jt(Q, gt, $, Q);
1676
1676
  if (!pt || pt.direction != "same") continue;
1677
- const tt = J.clone().addScaledVector(bt, zt), rt = gt.clone().addScaledVector(bt.clone().negate(), zt);
1678
- let xt = new y.Vector3().subVectors(dt, st).normalize(), kt = st.clone().addScaledVector(xt.clone().negate(), 0.03), Nt = dt.clone().addScaledVector(xt, 0.03);
1679
- const Ft = Kt(tt, rt, kt, Nt);
1680
- if (Ft == null) continue;
1681
- let Ut = J.distanceTo(Ft.point);
1682
- Ut < ht && (ht = Ut, j = it);
1683
- } else if (Vt && Vt.angle < 5) {
1684
- const Rt = new y.Vector3(q.x, q.y, 0), Z = new y.Vector3(G.x, G.y, 0);
1685
- let pt = jt(Rt, st), tt = jt(Rt, dt), rt = jt(Z, st), xt = jt(Z, dt);
1686
- if (pt < 0.08 || tt < 0.08 || rt < 0.08 || xt < 0.08) {
1687
- k = !0, ht = 1 / 0, j = -1;
1677
+ const et = Q.clone().addScaledVector(Pt, Vt), st = gt.clone().addScaledVector(Pt.clone().negate(), Vt);
1678
+ let xt = new y.Vector3().subVectors(dt, it).normalize(), vt = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1679
+ const wt = te(et, st, vt, Bt);
1680
+ if (wt == null) continue;
1681
+ let Xt = Q.distanceTo(wt.point);
1682
+ Xt < ht && (ht = Xt, Z = U);
1683
+ } else if (St && St.angle < 5) {
1684
+ const At = new y.Vector3(q.x, q.y, 0), $ = new y.Vector3(j.x, j.y, 0);
1685
+ let pt = Rt(At, it), et = Rt(At, dt), st = Rt($, it), xt = Rt($, dt), vt = Jt(Q, gt, it, At), Bt = !1;
1686
+ for (let wt = 0; wt < n[U].checkResults.length; wt++) {
1687
+ let Xt = [];
1688
+ for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
1689
+ Xt.push(new y.Vector3(
1690
+ n[U].checkResults[wt].allCenterPoints[Kt].x,
1691
+ n[U].checkResults[wt].allCenterPoints[Kt].y,
1692
+ 0
1693
+ ));
1694
+ let Ht = Se(Xt);
1695
+ if (Ht.length == 2) {
1696
+ let Kt = Rt(At, Ht[0]), Ce = Rt(At, Ht[1]), Re = Rt($, Ht[0]), Le = Rt($, Ht[1]);
1697
+ if (Kt < 0.2 || Ce < 0.2 || Re < 0.2 || Le < 0.2) {
1698
+ Bt = !0;
1699
+ break;
1700
+ }
1701
+ }
1702
+ }
1703
+ if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1704
+ k = !0, ht = 1 / 0, Z = -1;
1688
1705
  break;
1689
1706
  }
1690
1707
  }
1691
1708
  }
1692
- if (ht != 1 / 0 && ht < 2 && p.length - Y > 0.2 && ht < Y * 3)
1693
- n[j].length > 0.25 && Y + ht > 0.5 && (Lt = !0, Wt < wt ? (lt = lt.addScaledVector(bt, ht), q = q.addScaledVector(bt, ht)) : (Q = Q.addScaledVector(bt, ht), G = G.addScaledVector(bt, ht)));
1709
+ if (ht != 1 / 0 && ht < 2 && (g.length - Y > 0.2 || g.length - Y < 0.02) && ht < Y * 3)
1710
+ n[Z].length > 0.25 && Y + ht > 0.5 && (Wt = !0, qt < bt ? (lt = lt.addScaledVector(Pt, ht), q = q.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
1694
1711
  else {
1695
- if (!k && !ft && p.length - Y > 0.1)
1712
+ if (!k && !ft && g.length - Y > 0.1)
1696
1713
  continue;
1697
- if (!k && !ft && p.length - Y < 0.1 && p.length < 1.8)
1714
+ if (!k && !ft && g.length - Y < 0.1 && g.length < 1.8)
1698
1715
  continue;
1699
1716
  }
1700
1717
  } else
1701
1718
  continue;
1702
1719
  }
1703
- if (ct < wt || N < wt) {
1704
- const { newOriginalPoints: $t } = Me(q, G, p.originalPoints), at = [];
1705
- if ($t.forEach((J) => {
1706
- J.z >= Q.z ? at.push(J) : J.z <= q.z;
1720
+ if (ct < bt || N < bt) {
1721
+ const { newOriginalPoints: Ut } = ze(q, j, g.originalPoints), at = [];
1722
+ if (Ut.forEach((Q) => {
1723
+ Q.z >= tt.z ? at.push(Q) : Q.z <= q.z;
1707
1724
  }), at.length > 10) {
1708
- const J = new y.Vector3(p.start.x, p.start.y, 0), gt = new y.Vector3(p.end.x, p.end.y, 0), bt = new y.Vector3().subVectors(gt, J).normalize();
1709
- let Ht = new y.Vector3(), ht = 1 / 0, j = -1, k = !1, ft = !1;
1710
- for (let it = 0; it < n.length; it++) {
1711
- if (it == d) continue;
1712
- const st = new y.Vector3(n[it].start.x, n[it].start.y, 0), dt = new y.Vector3(n[it].end.x, n[it].end.y, 0), At = Kt(J, gt, st, dt);
1713
- let Vt = ee(J, gt, st, dt);
1714
- if (At != null) {
1715
- if (Vt && Vt.angle > 85 && (At.point.distanceTo(J), At.point.distanceTo(gt) < 0.3)) {
1716
- ft = !0, ht = 1 / 0, j = -1;
1725
+ const Q = new y.Vector3(g.start.x, g.start.y, 0), gt = new y.Vector3(g.end.x, g.end.y, 0), Pt = new y.Vector3().subVectors(gt, Q).normalize();
1726
+ let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
1727
+ for (let U = 0; U < n.length; U++) {
1728
+ if (U == d) continue;
1729
+ const it = new y.Vector3(n[U].start.x, n[U].start.y, 0), dt = new y.Vector3(n[U].end.x, n[U].end.y, 0), Ct = te(Q, gt, it, dt);
1730
+ let St = re(Q, gt, it, dt);
1731
+ if (Ct != null) {
1732
+ if (St && St.angle > 85 && (Ct.point.distanceTo(Q), Ct.point.distanceTo(gt) < 0.3)) {
1733
+ ft = !0, ht = 1 / 0, Z = -1;
1717
1734
  break;
1718
1735
  }
1719
1736
  continue;
1720
1737
  }
1721
- if (Vt && Vt.angle > 85) {
1722
- const Z = new y.Line3(st, dt).closestPointToPoint(gt, !0, Ht);
1723
- let pt = ie(gt, J, Z, gt);
1738
+ if (St && St.angle > 85) {
1739
+ const $ = new y.Line3(it, dt).closestPointToPoint(gt, !0, Gt);
1740
+ let pt = Jt(gt, Q, $, gt);
1724
1741
  if (!pt || pt.direction != "same") continue;
1725
- const tt = J.clone().addScaledVector(bt.clone().negate(), zt), rt = gt.clone().addScaledVector(bt, zt);
1726
- let xt = new y.Vector3().subVectors(dt, st).normalize(), kt = st.clone().addScaledVector(xt.clone().negate(), 0.03), Nt = dt.clone().addScaledVector(xt, 0.03);
1727
- const Ft = Kt(tt, rt, kt, Nt);
1728
- if (Ft == null) continue;
1729
- let Ut = gt.distanceTo(Ft.point);
1730
- Ut < ht && (ht = Ut, j = it);
1731
- } else if (Vt && Vt.angle < 5) {
1732
- const Rt = new y.Vector3(q.x, q.y, 0), Z = new y.Vector3(G.x, G.y, 0);
1733
- let pt = jt(Rt, st), tt = jt(Rt, dt), rt = jt(Z, st), xt = jt(Z, dt);
1734
- if (pt < 0.08 || tt < 0.08 || rt < 0.08 || xt < 0.08) {
1735
- k = !0, ht = 1 / 0, j = -1;
1742
+ const et = Q.clone().addScaledVector(Pt.clone().negate(), Vt), st = gt.clone().addScaledVector(Pt, Vt);
1743
+ let xt = new y.Vector3().subVectors(dt, it).normalize(), vt = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1744
+ const wt = te(et, st, vt, Bt);
1745
+ if (wt == null) continue;
1746
+ let Xt = gt.distanceTo(wt.point);
1747
+ Xt < ht && (ht = Xt, Z = U);
1748
+ } else if (St && St.angle < 5) {
1749
+ const At = new y.Vector3(q.x, q.y, 0), $ = new y.Vector3(j.x, j.y, 0);
1750
+ let pt = Rt(At, it), et = Rt(At, dt), st = Rt($, it), xt = Rt($, dt), vt = Jt(gt, Q, it, At), Bt = !1;
1751
+ for (let wt = 0; wt < n[U].checkResults.length; wt++) {
1752
+ let Xt = [];
1753
+ for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
1754
+ Xt.push(new y.Vector3(
1755
+ n[U].checkResults[wt].allCenterPoints[Kt].x,
1756
+ n[U].checkResults[wt].allCenterPoints[Kt].y,
1757
+ 0
1758
+ ));
1759
+ let Ht = Se(Xt);
1760
+ if (Ht.length == 2) {
1761
+ let Kt = Rt(At, Ht[0]), Ce = Rt(At, Ht[1]), Re = Rt($, Ht[0]), Le = Rt($, Ht[1]);
1762
+ if (Kt < 0.2 || Ce < 0.2 || Re < 0.2 || Le < 0.2) {
1763
+ Bt = !0;
1764
+ break;
1765
+ }
1766
+ }
1767
+ }
1768
+ if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1769
+ k = !0, ht = 1 / 0, Z = -1;
1736
1770
  break;
1737
1771
  }
1738
1772
  }
1739
1773
  }
1740
- if (ht != 1 / 0 && ht < 2 && p.length - Y > 0.2 && ht < Y * 3)
1741
- n[j].length > 0.25 && Y + ht > 0.5 && (Lt = !0, ct < wt ? (lt = lt.addScaledVector(bt, ht), q = q.addScaledVector(bt, ht)) : (Q = Q.addScaledVector(bt, ht), G = G.addScaledVector(bt, ht)));
1774
+ if (ht != 1 / 0 && ht < 2 && (g.length - Y > 0.2 || g.length - Y < 0.02) && ht < Y * 3)
1775
+ n[Z].length > 0.25 && Y + ht > 0.5 && (Wt = !0, ct < bt ? (lt = lt.addScaledVector(Pt, ht), q = q.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
1742
1776
  else {
1743
- if (!k && !ft && p.length - Y > 0.1)
1777
+ if (!k && !ft && g.length - Y > 0.1)
1744
1778
  continue;
1745
- if (!k && !ft && p.length - Y < 0.1 && p.length < 1.8)
1779
+ if (!k && !ft && g.length - Y < 0.1 && g.length < 1.8)
1746
1780
  continue;
1747
1781
  }
1748
1782
  } else
1749
1783
  continue;
1750
1784
  }
1751
- Y = lt.distanceTo(Q);
1785
+ Y = lt.distanceTo(tt);
1752
1786
  }
1753
- if (Gt < 85 && Y > 0.3 || Y > 0.7 && Pt > z - z / 3) {
1754
- let Wt = !1;
1755
- for (let K = 0; K < t.length; K++) {
1756
- let ct = K + 1;
1787
+ if (Zt < 85 && Y > 0.3 || Y > 0.7 && Mt > z - z / 3) {
1788
+ let qt = !1;
1789
+ for (let J = 0; J < t.length; J++) {
1790
+ let ct = J + 1;
1757
1791
  if (ct >= t.length)
1758
1792
  continue;
1759
- let N = new y.Vector3(t[K].x, t[K].y, t[K].z), wt = new y.Vector3(t[ct].x, t[ct].y, t[ct].z);
1760
- if (Kt(
1793
+ let N = new y.Vector3(t[J].x, t[J].y, t[J].z), bt = new y.Vector3(t[ct].x, t[ct].y, t[ct].z);
1794
+ if (te(
1761
1795
  new y.Vector3(N.x, N.y, 0),
1762
- new y.Vector3(wt.x, wt.y, 0),
1796
+ new y.Vector3(bt.x, bt.y, 0),
1763
1797
  new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0),
1764
1798
  new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0),
1765
1799
  0.1
1766
1800
  ) != null) {
1767
- Wt = !0;
1801
+ qt = !0;
1768
1802
  break;
1769
1803
  }
1770
1804
  }
1771
- for (let K = 0; K < a.length; K++) {
1772
- let ct = new y.Vector3(a[K].doorStartPt.x, a[K].doorStartPt.y, 0), N = new y.Vector3(a[K].doorEndPt.x, a[K].doorEndPt.y, 0), wt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), zt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), $t = F.facePoints[2].z < a[K].maxZ || Math.abs(F.facePoints[2].z - a[K].maxZ) < 0.3;
1773
- if (Math.abs(F.facePoints[2].z - a[K].maxZ) > 0.2, $t) {
1774
- let at = Jt(ct.clone(), N.clone(), wt.clone(), zt.clone(), {
1805
+ for (let J = 0; J < a.length; J++) {
1806
+ let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), N = new y.Vector3(a[J].doorEndPt.x, a[J].doorEndPt.y, 0), bt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), Vt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), Ut = F.facePoints[2].z < a[J].maxZ || Math.abs(F.facePoints[2].z - a[J].maxZ) < 0.3;
1807
+ if (Math.abs(F.facePoints[2].z - a[J].maxZ) > 0.2, Ut) {
1808
+ let at = ne(ct.clone(), N.clone(), bt.clone(), Vt.clone(), {
1775
1809
  distanceThreshold: 2
1776
1810
  });
1777
1811
  if (at && at.type == "collinear_gap") {
1778
- let J = Qt(ct, N), gt = new y.Line3(new y.Vector3(p.start.x, p.start.y, 0), new y.Vector3(p.end.x, p.end.y, 0)), bt = new y.Vector3(), Ht = gt.closestPointToPoint(J, !0, bt);
1779
- if (J.distanceTo(Ht) < 0.15) {
1780
- let j = wt.distanceTo(ct), k = zt.distanceTo(ct);
1781
- if (j > 0.25 && k > 0.25) {
1782
- let st = wt.distanceTo(N), dt = zt.distanceTo(N);
1783
- if (st > 0.2 && dt > 0.2)
1812
+ let Q = ee(ct, N), gt = new y.Line3(new y.Vector3(g.start.x, g.start.y, 0), new y.Vector3(g.end.x, g.end.y, 0)), Pt = new y.Vector3(), Gt = gt.closestPointToPoint(Q, !0, Pt);
1813
+ if (Q.distanceTo(Gt) < 0.15) {
1814
+ let Z = bt.distanceTo(ct), k = Vt.distanceTo(ct);
1815
+ if (Z > 0.25 && k > 0.25) {
1816
+ let it = bt.distanceTo(N), dt = Vt.distanceTo(N);
1817
+ if (it > 0.2 && dt > 0.2)
1784
1818
  continue;
1785
1819
  }
1786
- vt = !0, Dt = !0, It.push(a[K].index), a[K].isFind = !0, _t = K, e[a[K].index].isFindBeam = !0;
1787
- let ft = new y.Vector3().subVectors(wt, zt).normalize(), it = ct.distanceTo(N) - at.overlap;
1788
- k < j && ft.negate(), j > k ? (Q = F.facePoints[2].clone().addScaledVector(ft, it), lt = F.facePoints[3].clone(), q = lt.clone(), G = Q.clone(), q.z = G.z = F.facePoints[0].z) : (Q = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(ft, it), q = lt.clone(), G = Q.clone(), q.z = G.z = F.facePoints[0].z);
1820
+ _t = !0, Tt = !0, Ft.push(a[J].index), a[J].isFind = !0, Et = J, e[a[J].index].isFindBeam = !0;
1821
+ let ft = new y.Vector3().subVectors(bt, Vt).normalize(), U = ct.distanceTo(N) - at.overlap;
1822
+ k < Z && ft.negate(), Z > k ? (tt = F.facePoints[2].clone().addScaledVector(ft, U), lt = F.facePoints[3].clone(), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z) : (tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(ft, U), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z);
1789
1823
  }
1790
1824
  } else if (at && at.type == "collinear_overlap" && at.maxPerpendicularDistance < 0.35) {
1791
- let J = wt.distanceTo(zt), gt = N.distanceTo(ct);
1792
- if (Math.abs(J - at.overlap) < 0.25 || Math.abs(gt - at.overlap) < 0.25) {
1793
- if (gt > J && Math.abs(gt - at.overlap) > 1) {
1794
- let bt = wt.distanceTo(ct), Ht = wt.distanceTo(N), ht = zt.distanceTo(ct), j = zt.distanceTo(N), k = bt < Ht ? bt : Ht, ft = ht < j ? ht : j, it = new y.Vector3().subVectors(wt, zt).normalize(), st = gt - at.overlap;
1795
- k < ft ? (it.negate(), Q = F.facePoints[2].clone().addScaledVector(it, st), lt = F.facePoints[3].clone(), q = lt.clone(), G = Q.clone(), q.z = G.z = F.facePoints[0].z) : (Q = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(it, st), q = lt.clone(), G = Q.clone(), q.z = G.z = F.facePoints[0].z);
1825
+ let Q = bt.distanceTo(Vt), gt = N.distanceTo(ct);
1826
+ if (Math.abs(Q - at.overlap) < 0.25 || Math.abs(gt - at.overlap) < 0.25) {
1827
+ if (gt > Q && Math.abs(gt - at.overlap) > 1) {
1828
+ let Pt = bt.distanceTo(ct), Gt = bt.distanceTo(N), ht = Vt.distanceTo(ct), Z = Vt.distanceTo(N), k = Pt < Gt ? Pt : Gt, ft = ht < Z ? ht : Z, U = new y.Vector3().subVectors(bt, Vt).normalize(), it = gt - at.overlap;
1829
+ k < ft ? (U.negate(), tt = F.facePoints[2].clone().addScaledVector(U, it), lt = F.facePoints[3].clone(), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z) : (tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(U, it), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z);
1796
1830
  }
1797
- vt = !0, Dt = !0, It.push(a[K].index), a[K].isFind = !0, e[a[K].index].isFindBeam = !0, _t = K;
1831
+ _t = !0, Tt = !0, Ft.push(a[J].index), a[J].isFind = !0, e[a[J].index].isFindBeam = !0, Et = J;
1798
1832
  }
1799
1833
  }
1800
1834
  }
1801
1835
  }
1802
- if (!Dt && Y < 1.5)
1803
- for (let K = 0; K < a.length; K++) {
1804
- if (a[K].inWall) continue;
1805
- let ct = new y.Vector3(a[K].doorStartPt.x, a[K].doorStartPt.y, 0), N = new y.Vector3(a[K].doorEndPt.x, a[K].doorEndPt.y, 0), wt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), zt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), $t = new y.Vector3().subVectors(ct, N).normalize(), at = new y.Vector3().subVectors(wt, zt).normalize(), J = 0.25, gt = ct.clone().addScaledVector($t, J), bt = N.clone().addScaledVector($t.clone().negate(), J), Ht = wt.clone().addScaledVector(at, J), ht = zt.clone().addScaledVector(at.clone().negate(), J), j = Kt(gt, bt, Ht, ht), k = !0, ft = ct.distanceTo(wt), it = ct.distanceTo(zt), st = N.distanceTo(wt), dt = N.distanceTo(zt);
1806
- (ft < g || it < g || st < g || dt < g || j) && k && (e[a[K].index].isFindBeam = !0, vt = !0, a[K].isFind = !0, _t = K);
1836
+ if (!Tt && Y < 1.5)
1837
+ for (let J = 0; J < a.length; J++) {
1838
+ if (a[J].inWall) continue;
1839
+ let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), N = new y.Vector3(a[J].doorEndPt.x, a[J].doorEndPt.y, 0), bt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), Vt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), Ut = new y.Vector3().subVectors(ct, N).normalize(), at = new y.Vector3().subVectors(bt, Vt).normalize(), Q = 0.25, gt = ct.clone().addScaledVector(Ut, Q), Pt = N.clone().addScaledVector(Ut.clone().negate(), Q), Gt = bt.clone().addScaledVector(at, Q), ht = Vt.clone().addScaledVector(at.clone().negate(), Q), Z = te(gt, Pt, Gt, ht), k = !0, ft = ct.distanceTo(bt), U = ct.distanceTo(Vt), it = N.distanceTo(bt), dt = N.distanceTo(Vt);
1840
+ (ft < p || U < p || it < p || dt < p || Z) && k && (e[a[J].index].isFindBeam = !0, _t = !0, a[J].isFind = !0, Et = J);
1807
1841
  }
1808
- (vt || Wt || Math.abs(Pt - z) > 0.1 && Pt > z / 2 && Y > 0.3) && (Bt = !0);
1842
+ (_t || qt || Math.abs(Mt - z) > 0.1 && Mt > z / 2 && Y > 0.3) && (Lt = !0);
1809
1843
  }
1810
1844
  }
1811
- if (Bt) {
1812
- let Wt = !1;
1813
- for (let j = 0; j < f.length; j++) {
1814
- let k = Jt(f[j].start, f[j].end, q, G);
1845
+ if (Lt) {
1846
+ let qt = !1;
1847
+ for (let Z = 0; Z < f.length; Z++) {
1848
+ let k = ne(f[Z].start, f[Z].end, q, j);
1815
1849
  if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < 0.01) {
1816
- Wt = !0;
1850
+ qt = !0;
1817
1851
  break;
1818
1852
  }
1819
1853
  }
1820
- if (Wt) {
1821
- _t != -1 && (e[a[_t].index].isFindBeam = !1, a[_t].isFind = !1);
1854
+ if (qt) {
1855
+ Et != -1 && (e[a[Et].index].isFindBeam = !1, a[Et].isFind = !1);
1822
1856
  continue;
1823
1857
  }
1824
1858
  f.push({
1825
1859
  start: q,
1826
- end: G
1860
+ end: j
1827
1861
  });
1828
1862
  {
1829
1863
  new y.PointsMaterial({ color: 65535, size: 0.01 });
1830
- let j = new y.Vector3().subVectors(q, G), k = new y.Vector3().subVectors(G, q), ft = 1 / 0, it = 1 / 0, st = q.clone(), dt = G.clone();
1831
- const At = [], Vt = [];
1832
- let Rt = new y.Line3(Q, lt), Z = new y.Vector3(), pt = 999999;
1833
- if (p.originalPoints.forEach((tt) => {
1834
- if (tt.z - q.z < Pt / 2 + 0.1 && tt.z - q.z > Pt / 2 - 0.1 && At.push(tt), tt.z > Q.z) {
1835
- let rt = Rt.closestPointToPoint(tt, !0, Z), xt = new y.Vector3().subVectors(rt, Q), kt = new y.Vector3().subVectors(rt, lt), Nt = te(j, kt), Ft = te(k, xt);
1836
- Nt && Nt.parallel && !Nt.sameDirection && Ft && Ft.parallel && !Ft.sameDirection && Vt.push(tt);
1864
+ let Z = new y.Vector3().subVectors(q, j), k = new y.Vector3().subVectors(j, q), ft = 1 / 0, U = 1 / 0, it = q.clone(), dt = j.clone();
1865
+ const Ct = [], St = [];
1866
+ let At = new y.Line3(tt, lt), $ = new y.Vector3(), pt = 999999;
1867
+ if (g.originalPoints.forEach((et) => {
1868
+ if (et.z - q.z < Mt / 2 + 0.1 && et.z - q.z > Mt / 2 - 0.1 && Ct.push(et), et.z > tt.z) {
1869
+ let st = At.closestPointToPoint(et, !0, $), xt = new y.Vector3().subVectors(st, tt), vt = new y.Vector3().subVectors(st, lt), Bt = oe(Z, vt), wt = oe(k, xt);
1870
+ Bt && Bt.parallel && !Bt.sameDirection && wt && wt.parallel && !wt.sameDirection && St.push(et);
1837
1871
  }
1838
- }), At.length > 0) {
1839
- const { newProjectPoints: tt } = Me(q, G, At);
1840
- for (const rt of tt)
1841
- rt.z = q.z;
1842
- tt.forEach((rt) => {
1843
- let xt = new y.Vector3(rt.x, rt.y, q.z), kt = new y.Vector3().subVectors(xt, G), Nt = new y.Vector3().subVectors(xt, q), Ft = te(j, Nt), Ut = te(k, kt);
1844
- if (Ft && Ft.parallel && Ft.sameDirection) {
1845
- let be = xt.distanceTo(q);
1846
- be < ft && (ft = be, st = xt);
1847
- } else if (Ut && Ut.parallel && Ut.sameDirection) {
1848
- let be = xt.distanceTo(G);
1849
- be < it && (it = be, dt = xt);
1872
+ }), Ct.length > 0) {
1873
+ const { newProjectPoints: et } = ze(q, j, Ct);
1874
+ for (const st of et)
1875
+ st.z = q.z;
1876
+ et.forEach((st) => {
1877
+ let xt = new y.Vector3(st.x, st.y, q.z), vt = new y.Vector3().subVectors(xt, j), Bt = new y.Vector3().subVectors(xt, q), wt = oe(Z, Bt), Xt = oe(k, vt);
1878
+ if (wt && wt.parallel && wt.sameDirection) {
1879
+ let Ht = xt.distanceTo(q);
1880
+ Ht < ft && (ft = Ht, it = xt);
1881
+ } else if (Xt && Xt.parallel && Xt.sameDirection) {
1882
+ let Ht = xt.distanceTo(j);
1883
+ Ht < U && (U = Ht, dt = xt);
1850
1884
  }
1851
1885
  });
1852
1886
  }
1853
- if (st.equals(q) || (q = st, lt = new y.Vector3(q.x, q.y, lt.z)), dt.equals(G) || (G = dt, Q = new y.Vector3(G.x, G.y, Q.z)), Vt.length > 10) {
1854
- const { newOnLinePoints: tt } = Me(lt, Q, Vt);
1855
- for (let rt = 0; rt < tt.length; rt++) {
1856
- let kt = Rt.closestPointToPoint(tt[rt], !0, Z).distanceTo(tt[rt]);
1857
- kt > 0.02 && pt > kt && (pt = kt);
1887
+ if (it.equals(q) || (q = it, lt = new y.Vector3(q.x, q.y, lt.z)), dt.equals(j) || (j = dt, tt = new y.Vector3(j.x, j.y, tt.z)), St.length > 10) {
1888
+ const { newOnLinePoints: et } = ze(lt, tt, St);
1889
+ for (let st = 0; st < et.length; st++) {
1890
+ let vt = At.closestPointToPoint(et[st], !0, $).distanceTo(et[st]);
1891
+ vt > 0.02 && pt > vt && (pt = vt);
1858
1892
  }
1859
- Q.z += pt, lt.z += pt, Pt += pt;
1893
+ tt.z += pt, lt.z += pt, Mt += pt;
1860
1894
  }
1861
1895
  }
1862
- let K = G.distanceTo(q);
1863
- if (K < 0.4 && !vt || K < 0.3 && vt)
1896
+ let J = j.distanceTo(q);
1897
+ if (J < 0.4 && !_t || J < 0.3 && _t)
1864
1898
  continue;
1865
- h.includes(d) || h.push(d), p.checkResults[E.index].isDoor = !0;
1899
+ h.includes(d) || h.push(d), g.checkResults[T.index].isDoor = !0;
1866
1900
  let ct = "", N = {
1867
1901
  id: l,
1868
- beamStart: Q,
1902
+ beamStart: tt,
1869
1903
  beamEnd: lt,
1870
- beamHeight: p.rooftopPz - Q.z,
1904
+ beamHeight: g.rooftopPz - tt.z,
1871
1905
  doorStart: q,
1872
- doorEnd: G,
1873
- doorHeight: Pt,
1906
+ doorEnd: j,
1907
+ doorHeight: Mt,
1874
1908
  nearId: -1,
1875
1909
  // type: isExtendBeam ? "extendBeam" : "doorBeam",
1876
1910
  type: ct,
1877
- isExtend: Lt,
1878
- isDoor: vt,
1879
- isPullOutDoor: Dt,
1880
- pcbDoorIndexs: It,
1911
+ isExtend: Wt,
1912
+ isDoor: _t,
1913
+ isPullOutDoor: Tt,
1914
+ pcbDoorIndexs: Ft,
1881
1915
  beamNearWallVec: new y.Vector3(0, 0, 0)
1882
- }, wt = !1, zt = new y.Vector3(), $t = new y.Vector3(), at = -1, J = -1, gt = -1;
1883
- for (let j = 0; j < c.length; j++) {
1884
- const k = n[c[j].linesIndex].doorAndBeamData[c[j].doorIndex];
1916
+ }, bt = !1, Vt = new y.Vector3(), Ut = new y.Vector3(), at = -1, Q = -1, gt = -1;
1917
+ for (let Z = 0; Z < c.length; Z++) {
1918
+ const k = n[c[Z].linesIndex].doorAndBeamData[c[Z].doorIndex];
1885
1919
  if (k.nearId != -1)
1886
1920
  continue;
1887
- let ft = ie(
1888
- Q.clone(),
1921
+ let ft = Jt(
1922
+ tt.clone(),
1889
1923
  lt.clone(),
1890
1924
  k.beamStart.clone(),
1891
1925
  k.beamEnd.clone()
1892
1926
  );
1893
1927
  if (ft && ft.isParallel) {
1894
- let it = Q.distanceTo(lt), st = k.beamStart.distanceTo(k.beamEnd), dt = new y.Line3(Q.clone(), lt.clone());
1928
+ let U = tt.distanceTo(lt), it = k.beamStart.distanceTo(k.beamEnd), dt = new y.Line3(tt.clone(), lt.clone());
1895
1929
  dt.start.z = 0, dt.end.z = 0;
1896
- let At = Qt(k.beamStart, k.beamEnd, !0);
1897
- st > it && (dt.start = new y.Vector3(k.beamStart.x, k.beamStart.y, 0), dt.end = new y.Vector3(k.beamEnd.x, k.beamEnd.y, 0), At = Qt(Q, lt, !0));
1898
- let Vt = new y.Vector3(), Rt = dt.closestPointToPoint(At, !0, Vt), Z = Rt.distanceTo(At), pt = new y.Vector3().subVectors(At, Rt).normalize(), tt = pt.clone().negate(), rt = At.clone().addScaledVector(tt, Z + 0.1), xt = Kt(dt.start, dt.end, At, rt), kt = !vt && !k.isDoor && (it > st * 2 || st > it * 2);
1899
- if (Z < 0.4 && xt != null && !kt) {
1930
+ let Ct = ee(k.beamStart, k.beamEnd, !0);
1931
+ it > U && (dt.start = new y.Vector3(k.beamStart.x, k.beamStart.y, 0), dt.end = new y.Vector3(k.beamEnd.x, k.beamEnd.y, 0), Ct = ee(tt, lt, !0));
1932
+ let St = new y.Vector3(), At = dt.closestPointToPoint(Ct, !0, St), $ = At.distanceTo(Ct), pt = new y.Vector3().subVectors(Ct, At).normalize(), et = pt.clone().negate(), st = Ct.clone().addScaledVector(et, $ + 0.1), xt = te(dt.start, dt.end, Ct, st), vt = !_t && !k.isDoor && (U > it * 2 || it > U * 2);
1933
+ if ($ < 0.4 && xt != null && !vt) {
1900
1934
  k.nearId = l, N.nearId = k.id;
1901
- let Nt = 0.8;
1935
+ let Bt = 0.8;
1902
1936
  (k.isDoor || N.isDoor) && (k.isDoor = !0, N.isDoor = !0);
1903
- const Ft = It.some((Ut) => k.pcbDoorIndexs.includes(Ut));
1904
- it < st ? it > Nt && !k.isPullOutDoor ? (k.beamStart = Q.clone().addScaledVector(tt, Z), k.beamEnd = lt.clone().addScaledVector(tt, Z), k.doorStart = q.clone().addScaledVector(tt, Z), k.doorEnd = G.clone().addScaledVector(tt, Z), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : !Dt || Dt && k.isPullOutDoor && Ft ? (N.beamStart = k.beamStart.clone().addScaledVector(pt, Z), N.beamEnd = k.beamEnd.clone().addScaledVector(pt, Z), N.doorStart = k.doorStart.clone().addScaledVector(pt, Z), N.doorEnd = k.doorEnd.clone().addScaledVector(pt, Z), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : (k.beamStart = Q.clone().addScaledVector(tt, Z), k.beamEnd = lt.clone().addScaledVector(tt, Z), k.doorStart = q.clone().addScaledVector(tt, Z), k.doorEnd = G.clone().addScaledVector(tt, Z), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : it > st && (st > Nt && !Dt ? (N.beamStart = k.beamStart.clone().addScaledVector(tt, Z), N.beamEnd = k.beamEnd.clone().addScaledVector(tt, Z), N.doorStart = k.doorStart.clone().addScaledVector(tt, Z), N.doorEnd = k.doorEnd.clone().addScaledVector(tt, Z), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : !k.isPullOutDoor || Dt && k.isPullOutDoor && Ft ? (k.beamStart = Q.clone().addScaledVector(pt, Z), k.beamEnd = lt.clone().addScaledVector(pt, Z), k.doorStart = q.clone().addScaledVector(pt, Z), k.doorEnd = G.clone().addScaledVector(pt, Z), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : (N.beamStart = k.beamStart.clone().addScaledVector(tt, Z), N.beamEnd = k.beamEnd.clone().addScaledVector(tt, Z), N.doorStart = k.doorStart.clone().addScaledVector(tt, Z), N.doorEnd = k.doorEnd.clone().addScaledVector(tt, Z), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight)), at = N.nearId, zt = k.beamStart.clone(), $t = k.beamEnd.clone(), wt = !0, J = c[j].linesIndex, gt = c[j].doorIndex;
1937
+ const wt = Ft.some((Xt) => k.pcbDoorIndexs.includes(Xt));
1938
+ U < it ? U > Bt && !k.isPullOutDoor ? (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : !Tt || Tt && k.isPullOutDoor && wt ? (N.beamStart = k.beamStart.clone().addScaledVector(pt, $), N.beamEnd = k.beamEnd.clone().addScaledVector(pt, $), N.doorStart = k.doorStart.clone().addScaledVector(pt, $), N.doorEnd = k.doorEnd.clone().addScaledVector(pt, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : U > it && (it > Bt && !Tt ? (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : !k.isPullOutDoor || Tt && k.isPullOutDoor && wt ? (k.beamStart = tt.clone().addScaledVector(pt, $), k.beamEnd = lt.clone().addScaledVector(pt, $), k.doorStart = q.clone().addScaledVector(pt, $), k.doorEnd = j.clone().addScaledVector(pt, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight)), at = N.nearId, Vt = k.beamStart.clone(), Ut = k.beamEnd.clone(), bt = !0, Q = c[Z].linesIndex, gt = c[Z].doorIndex;
1905
1939
  break;
1906
1940
  }
1907
1941
  }
1908
1942
  }
1909
- let bt = !1;
1910
- if (!wt) {
1911
- let j = new y.Line3(q.clone(), G.clone());
1943
+ let Pt = !1;
1944
+ if (!bt) {
1945
+ let Z = new y.Line3(q.clone(), j.clone());
1912
1946
  for (let k = 0; k < n.length; k++) {
1913
1947
  if (n[k].length < 0.5 || k == d) continue;
1914
- let ft = new y.Vector3(n[k].start.x, n[k].start.y, n[k].start.z), it = new y.Vector3(n[k].end.x, n[k].end.y, n[k].end.z), st = Jt(ft, it, q, G), dt = ie(ft, it, q, G);
1915
- const At = ao(n[k]);
1916
- if (st && st.maxPerpendicularDistance < 0.5) {
1948
+ let ft = new y.Vector3(n[k].start.x, n[k].start.y, n[k].start.z), U = new y.Vector3(n[k].end.x, n[k].end.y, n[k].end.z), it = ne(ft, U, q, j), dt = Jt(ft, U, q, j);
1949
+ const Ct = ho(n[k]);
1950
+ if (it && it.maxPerpendicularDistance < 0.5) {
1917
1951
  if (dt && dt.isParallel) {
1918
- let rt = new y.Line3(ft, it), xt = new y.Vector3(q.x, q.y, ft.z), kt = rt.closestPointToPoint(xt, !0, new y.Vector3()), Nt = ee(kt, xt, q, G);
1919
- Nt && Nt.angle > 85 && (N.beamNearWallVec = new y.Vector3().subVectors(kt, xt).normalize());
1952
+ let st = new y.Line3(ft, U), xt = new y.Vector3(q.x, q.y, ft.z), vt = st.closestPointToPoint(xt, !0, new y.Vector3()), Bt = re(vt, xt, q, j);
1953
+ Bt && Bt.angle > 85 && (N.beamNearWallVec = new y.Vector3().subVectors(vt, xt).normalize());
1920
1954
  }
1921
- const Vt = [];
1922
- n[k].originalPoints.forEach((rt) => {
1923
- rt.z > q.z + 0.2 && rt.z < q.z + Pt / 2 && Vt.push(new y.Vector3(rt.x, rt.y, q.z));
1955
+ const St = [];
1956
+ n[k].originalPoints.forEach((st) => {
1957
+ st.z > q.z + 0.2 && st.z < q.z + Mt / 2 && St.push(new y.Vector3(st.x, st.y, q.z));
1924
1958
  });
1925
- const Rt = new y.Vector3();
1926
- let Z = [], pt = [];
1927
- for (let rt = 0; rt < Vt.length; rt++) {
1928
- let xt = j.closestPointToPoint(Vt[rt], !0, Rt);
1929
- xt.distanceTo(Vt[rt]) < 0.15 && (Z.push(Vt[rt]), pt.push(xt.clone()));
1959
+ const At = new y.Vector3();
1960
+ let $ = [], pt = [];
1961
+ for (let st = 0; st < St.length; st++) {
1962
+ let xt = Z.closestPointToPoint(St[st], !0, At);
1963
+ xt.distanceTo(St[st]) < 0.15 && ($.push(St[st]), pt.push(xt.clone()));
1930
1964
  }
1931
- for (let rt = 0; rt < pt.length; rt++)
1932
- co(j, pt[rt]) && Z.push(pt[rt]);
1933
- if (Z = pt, Z = ho(Z), Z.length < 150) continue;
1934
- let tt = Ze(Z);
1935
- if (tt.length == 2) {
1936
- let rt = tt[0].distanceTo(tt[1]);
1937
- if (Math.abs(rt - j.distance()) < 0.3) {
1938
- let xt = new y.Line3(ft, it), kt = new y.Vector3(q.x, q.y, ft.z), Nt = xt.closestPointToPoint(kt, !0, new y.Vector3());
1939
- if (N.beamNearWallVec = new y.Vector3().subVectors(Nt, kt).normalize(), N.beamStart.z > At.maxZ - 0.03 && Y > 1)
1940
- bt = !0;
1941
- else if (Wt = !0, _t != -1 && (e[a[_t].index].isFindBeam = !1, a[_t].isFind = !1), J != -1 && gt != -1) {
1942
- const Ft = n[J].doorAndBeamData[gt];
1943
- Ft.nearId = -1;
1965
+ for (let st = 0; st < pt.length; st++)
1966
+ mo(Z, pt[st]) && $.push(pt[st]);
1967
+ if ($ = pt, $ = po($), $.length < 150) continue;
1968
+ let et = Se($);
1969
+ if (et.length == 2) {
1970
+ let st = et[0].distanceTo(et[1]);
1971
+ if (Math.abs(st - Z.distance()) < 0.3) {
1972
+ let xt = new y.Line3(ft, U), vt = new y.Vector3(q.x, q.y, ft.z), Bt = xt.closestPointToPoint(vt, !0, new y.Vector3());
1973
+ if (N.beamNearWallVec = new y.Vector3().subVectors(Bt, vt).normalize(), N.beamStart.z > Ct.maxZ - 0.03 && Y > 1)
1974
+ Pt = !0;
1975
+ else if (qt = !0, Et != -1 && (e[a[Et].index].isFindBeam = !1, a[Et].isFind = !1), Q != -1 && gt != -1) {
1976
+ const wt = n[Q].doorAndBeamData[gt];
1977
+ wt.nearId = -1;
1944
1978
  }
1945
1979
  break;
1946
1980
  }
1947
1981
  }
1948
- if (Wt)
1982
+ if (qt)
1949
1983
  break;
1950
- } else st && st.type == "collinear_overlap" && st.maxPerpendicularDistance > 0.3 && st.maxPerpendicularDistance < 0.7 && (bt = !0);
1984
+ } else it && it.type == "collinear_overlap" && it.maxPerpendicularDistance > 0.3 && it.maxPerpendicularDistance < 0.7 && (Pt = !0);
1951
1985
  }
1952
- if (Wt) {
1986
+ if (qt) {
1953
1987
  if (Y < 1.8)
1954
1988
  continue;
1955
- bt = !0;
1989
+ Pt = !0;
1956
1990
  }
1957
1991
  }
1958
- let Ht = !1;
1992
+ let Gt = !1;
1959
1993
  if (at != -1)
1960
- for (let j = 0; j < u.length && !(u[j].length == 1 && (u[j][0].id == l ? (u[j].push({ id: at, beamStart: zt, beamEnd: $t }), Ht = !0) : u[j][0].id == at && (u[j].push({ id: l, beamStart: Q, beamEnd: lt }), Ht = !0), Ht)); j++)
1994
+ for (let Z = 0; Z < u.length && !(u[Z].length == 1 && (u[Z][0].id == l ? (u[Z].push({ id: at, beamStart: Vt, beamEnd: Ut }), Gt = !0) : u[Z][0].id == at && (u[Z].push({ id: l, beamStart: tt, beamEnd: lt }), Gt = !0), Gt)); Z++)
1961
1995
  ;
1962
- Ht || u.push([{ id: l, beamStart: Q, beamEnd: lt }]);
1996
+ Gt || u.push([{ id: l, beamStart: tt, beamEnd: lt }]);
1963
1997
  const ht = N.doorStart.distanceTo(N.doorEnd);
1964
- if (vt ? ct = "door" : ht > 1.8 ? ct = "beam" : ct = bt && ht > 1 ? "beam" : "hole", N.type = ct, N.nearId != -1 && ct == "hole") {
1965
- let j = !1;
1998
+ if (_t ? ct = "door" : ht > 1.8 ? ct = "beam" : ct = Pt && ht > 1 ? "beam" : "hole", N.type = ct, N.nearId != -1 && ct == "hole") {
1999
+ let Z = !1;
1966
2000
  for (let k = 0; k < n.length; k++)
1967
2001
  if (n[k].doorAndBeamData) {
1968
2002
  for (let ft = 0; ft < n[k].doorAndBeamData.length; ft++)
1969
2003
  if (n[k].doorAndBeamData[ft].nearId == l && n[k].doorAndBeamData[ft].type == "beam") {
1970
- n[k].doorAndBeamData[ft].type = ct, j = !0;
2004
+ n[k].doorAndBeamData[ft].type = ct, Z = !0;
1971
2005
  break;
1972
2006
  }
1973
- if (j) break;
2007
+ if (Z) break;
1974
2008
  }
1975
2009
  }
1976
- if (p.doorAndBeamData.push(N), c.push({
2010
+ if (g.doorAndBeamData.push(N), c.push({
1977
2011
  linesIndex: d,
1978
- doorIndex: p.doorAndBeamData.length - 1
1979
- }), l++, Dt && Y < 2) break;
2012
+ doorIndex: g.doorAndBeamData.length - 1
2013
+ }), l++, Tt && Y < 2) break;
1980
2014
  }
1981
2015
  }
1982
2016
  }
1983
- let _ = p.length * (p.rooftopPz - p.start.z);
1984
- p.completePointAreaPercentage = D / _ * 100;
2017
+ let _ = g.length * (g.rooftopPz - g.start.z);
2018
+ g.completePointAreaPercentage = D / _ * 100;
1985
2019
  }
1986
2020
  if (h.length > 1)
1987
2021
  for (let d = 0; d < h.length; d++) {
1988
- let p = [];
2022
+ let g = [];
1989
2023
  for (let b = 0; b < n[h[d]].doorAndBeamData.length; b++) {
1990
2024
  let V = !1;
1991
2025
  if (n[h[d]].doorAndBeamData[b].type === "beam" && n[h[d]].doorAndBeamData[b].beamNearWallVec.x == 0 && n[h[d]].doorAndBeamData[b].beamNearWallVec.y == 0 && n[h[d]].doorAndBeamData[b].beamNearWallVec.z == 0 && n[h[d]].doorAndBeamData[b].nearId == -1 && (V = !0), !V) {
@@ -1995,65 +2029,65 @@ const li = async (n, t, e, o, i) => {
1995
2029
  for (let D = 0; D < h.length; D++)
1996
2030
  if (d != D)
1997
2031
  for (let _ = 0; _ < n[h[D]].doorAndBeamData.length; _++) {
1998
- let E = n[h[D]].doorAndBeamData[_].doorStart.clone(), T = n[h[D]].doorAndBeamData[_].doorEnd.clone();
1999
- E.z = T.z = 0, E.distanceTo(T);
2000
- let A = Jt(v, S, E, T);
2032
+ let T = n[h[D]].doorAndBeamData[_].doorStart.clone(), E = n[h[D]].doorAndBeamData[_].doorEnd.clone();
2033
+ T.z = E.z = 0, T.distanceTo(E);
2034
+ let A = ne(v, S, T, E);
2001
2035
  if (A.type == "collinear_overlap" && A.maxPerpendicularDistance < 0.2) {
2002
- let O = new y.Line3(E, T), I = Qt(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), L = I.distanceTo(B);
2003
- if (Math.abs(z - A.overlap) < 0.1 && L < 0.04) {
2036
+ let O = new y.Line3(T, E), I = ee(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), R = I.distanceTo(B);
2037
+ if (Math.abs(z - A.overlap) < 0.1 && R < 0.04) {
2004
2038
  n[h[D]].doorAndBeamData[_].nearId == n[h[d]].doorAndBeamData[b].id && (n[h[D]].doorAndBeamData[_].nearId = -1), V = !0;
2005
2039
  break;
2006
2040
  }
2007
2041
  }
2008
2042
  }
2009
2043
  }
2010
- V || p.push(n[h[d]].doorAndBeamData[b]);
2044
+ V || g.push(n[h[d]].doorAndBeamData[b]);
2011
2045
  }
2012
- p.length != n[h[d]].doorAndBeamData.length && (n[h[d]].doorAndBeamData = p);
2046
+ g.length != n[h[d]].doorAndBeamData.length && (n[h[d]].doorAndBeamData = g);
2013
2047
  }
2014
2048
  let w = 0.65, x = 2, P = [], M = [];
2015
2049
  for (let d = 0; d < a.length; d++) {
2016
2050
  if (a[d].isFind || a[d].inWall)
2017
2051
  continue;
2018
- let p = new y.Vector3(a[d].doorStartPt.x, a[d].doorStartPt.y, 0), b = new y.Vector3(a[d].doorEndPt.x, a[d].doorEndPt.y, 0), V = new y.Vector3().subVectors(p, b).normalize();
2052
+ let g = new y.Vector3(a[d].doorStartPt.x, a[d].doorStartPt.y, 0), b = new y.Vector3(a[d].doorEndPt.x, a[d].doorEndPt.y, 0), V = new y.Vector3().subVectors(g, b).normalize();
2019
2053
  for (let v = 0; v < n.length; v++) {
2020
2054
  if (n[v].length < 0.7 || n[v].completePointAreaPercentage > 60)
2021
2055
  continue;
2022
- let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), z = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, z).normalize(), _ = 0.3, E = p.clone().addScaledVector(V, _), T = b.clone().addScaledVector(V.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = z.clone().addScaledVector(D.clone().negate(), _);
2023
- Kt(E, T, A, O);
2024
- let I = ie(
2025
- E,
2056
+ let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), z = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, z).normalize(), _ = 0.3, T = g.clone().addScaledVector(V, _), E = b.clone().addScaledVector(V.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = z.clone().addScaledVector(D.clone().negate(), _);
2057
+ te(T, E, A, O);
2058
+ let I = Jt(
2026
2059
  T,
2060
+ E,
2027
2061
  A,
2028
2062
  O
2029
- ), B = p.distanceTo(S) > b.distanceTo(S) ? b : p, L = B.distanceTo(S), W = B.distanceTo(z);
2030
- if ((L < g || W < g) && I && !I.isParallel) {
2031
- let R = p.distanceTo(S), H = p.distanceTo(z), X = R < H ? S : z, nt = !1;
2032
- for (let U = 0; U < n.length; U++) {
2033
- if (U == v || P.includes(U) || n[U].length < 0.7)
2063
+ ), B = g.distanceTo(S) > b.distanceTo(S) ? b : g, R = B.distanceTo(S), W = B.distanceTo(z);
2064
+ if ((R < p || W < p) && I && !I.isParallel) {
2065
+ let L = g.distanceTo(S), H = g.distanceTo(z), X = L < H ? S : z, ot = !1;
2066
+ for (let K = 0; K < n.length; K++) {
2067
+ if (K == v || P.includes(K) || n[K].length < 0.7)
2034
2068
  continue;
2035
- let $ = new y.Vector3(n[U].start.x, n[U].start.y, 0), ut = new y.Vector3(n[U].end.x, n[U].end.y, 0), ot = new y.Vector3().subVectors($, ut).normalize(), F = ot.clone().negate(), Y = $.clone().addScaledVector(ot, 5), Pt = ut.clone().addScaledVector(F, 5), Gt = ee(S, z, $, ut), Ot = Jt(S, z, $, ut), Bt = Kt(S, z, Y, Pt), vt = !0;
2036
- if (Bt != null && (vt = Bt.point.distanceTo(S) < g || Bt.point.distanceTo(z) < g), (Gt && Gt.angle > 85 || Ot && Ot.type == "collinear_gap") && vt) {
2037
- let Dt = new y.Line3(S, z), It = new y.Vector3(), Q = Dt.closestPointToPoint($, !0, It), lt = Dt.closestPointToPoint(ut, !0, It), q = Q.distanceTo($), G = lt.distanceTo(ut), Lt, _t;
2038
- if (q > G && G > w)
2039
- Lt = ut, _t = lt;
2040
- else if (q < G && q > w)
2041
- Lt = $, _t = Q;
2069
+ let G = new y.Vector3(n[K].start.x, n[K].start.y, 0), ut = new y.Vector3(n[K].end.x, n[K].end.y, 0), rt = new y.Vector3().subVectors(G, ut).normalize(), F = rt.clone().negate(), Y = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(S, z, G, ut), Nt = ne(S, z, G, ut), Lt = te(S, z, Y, Mt), _t = !0;
2070
+ if (Lt != null && (_t = Lt.point.distanceTo(S) < p || Lt.point.distanceTo(z) < p), (Zt && Zt.angle > 85 || Nt && Nt.type == "collinear_gap") && _t) {
2071
+ let Tt = new y.Line3(S, z), Ft = new y.Vector3(), tt = Tt.closestPointToPoint(G, !0, Ft), lt = Tt.closestPointToPoint(ut, !0, Ft), q = tt.distanceTo(G), j = lt.distanceTo(ut), Wt, Et;
2072
+ if (q > j && j > w)
2073
+ Wt = ut, Et = lt;
2074
+ else if (q < j && q > w)
2075
+ Wt = G, Et = tt;
2042
2076
  else
2043
2077
  continue;
2044
- if (q = X.distanceTo($), G = X.distanceTo(ut), q > x && G > x)
2078
+ if (q = X.distanceTo(G), j = X.distanceTo(ut), q > x && j > x)
2045
2079
  continue;
2046
- let Wt = ie(Lt, _t, $, ut), K = ie(Lt, _t, E, T);
2047
- if (K && K.isParallel || !Wt || !Wt.isParallel)
2080
+ let qt = Jt(Wt, Et, G, ut), J = Jt(Wt, Et, T, E);
2081
+ if (J && J.isParallel || !qt || !qt.isParallel)
2048
2082
  continue;
2049
- let ct = Jt(p, b, Lt, _t);
2083
+ let ct = ne(g, b, Wt, Et);
2050
2084
  if (ct && ct.type == "collinear_overlap" && ct.maxPerpendicularDistance < 0.2)
2051
2085
  continue;
2052
- Lt.z = _t.z = n[U].start.z;
2086
+ Wt.z = Et.z = n[K].start.z;
2053
2087
  let N = !1;
2054
2088
  for (let at = 0; at < M.length; at++) {
2055
- let J = Jt(M[at].start, M[at].end, Lt, _t);
2056
- if (J && J.type == "collinear_overlap" && J.maxPerpendicularDistance < 0.2) {
2089
+ let Q = ne(M[at].start, M[at].end, Wt, Et);
2090
+ if (Q && Q.type == "collinear_overlap" && Q.maxPerpendicularDistance < 0.2) {
2057
2091
  N = !0;
2058
2092
  break;
2059
2093
  }
@@ -2062,8 +2096,8 @@ const li = async (n, t, e, o, i) => {
2062
2096
  continue;
2063
2097
  for (let at = 0; at < n.length; at++) {
2064
2098
  if (n[at].length < 0.5) continue;
2065
- let J = new y.Vector3(n[at].start.x, n[at].start.y, n[at].start.z), gt = new y.Vector3(n[at].end.x, n[at].end.y, n[at].end.z), bt = Jt(J, gt, Lt, _t);
2066
- if (bt && bt.type == "collinear_overlap" && bt.maxPerpendicularDistance < 0.1) {
2099
+ let Q = new y.Vector3(n[at].start.x, n[at].start.y, n[at].start.z), gt = new y.Vector3(n[at].end.x, n[at].end.y, n[at].end.z), Pt = ne(Q, gt, Wt, Et);
2100
+ if (Pt && Pt.type == "collinear_overlap" && Pt.maxPerpendicularDistance < 0.1) {
2067
2101
  N = !0;
2068
2102
  break;
2069
2103
  }
@@ -2071,27 +2105,27 @@ const li = async (n, t, e, o, i) => {
2071
2105
  if (N)
2072
2106
  continue;
2073
2107
  M.push({
2074
- start: Lt,
2075
- end: _t
2076
- }), P.push(U);
2077
- let wt = n[U].rooftopPz - n[U].start.z, zt = n[v].rooftopPz - n[v].start.z, $t = wt < zt ? wt : zt;
2078
- n[U].doorAndBeamData || (n[U].doorAndBeamData = []), n[U].doorAndBeamData.push({
2108
+ start: Wt,
2109
+ end: Et
2110
+ }), P.push(K);
2111
+ let bt = n[K].rooftopPz - n[K].start.z, Vt = n[v].rooftopPz - n[v].start.z, Ut = bt < Vt ? bt : Vt;
2112
+ n[K].doorAndBeamData || (n[K].doorAndBeamData = []), n[K].doorAndBeamData.push({
2079
2113
  id: l,
2080
- beamStart: Lt,
2081
- beamEnd: _t,
2082
- beamHeight: $t,
2083
- doorStart: Lt,
2084
- doorEnd: _t,
2085
- doorHeight: $t,
2114
+ beamStart: Wt,
2115
+ beamEnd: Et,
2116
+ beamHeight: Ut,
2117
+ doorStart: Wt,
2118
+ doorEnd: Et,
2119
+ doorHeight: Ut,
2086
2120
  nearId: -1,
2087
2121
  type: "onlyDoor",
2088
2122
  isDoor: !0,
2089
2123
  beamNearWallVec: new y.Vector3(0, 0, 0)
2090
- }), e[a[d].index].isFindBeam = !0, e[a[d].index].isFindOnlyDoor = !0, u.push([{ id: l, beamStart: Lt, beamEnd: _t }]), l++, nt = !0;
2124
+ }), e[a[d].index].isFindBeam = !0, e[a[d].index].isFindOnlyDoor = !0, u.push([{ id: l, beamStart: Wt, beamEnd: Et }]), l++, ot = !0;
2091
2125
  break;
2092
2126
  }
2093
2127
  }
2094
- if (nt) break;
2128
+ if (ot) break;
2095
2129
  }
2096
2130
  }
2097
2131
  }
@@ -2099,7 +2133,7 @@ const li = async (n, t, e, o, i) => {
2099
2133
  for (let d = 0; d < n.length; d++)
2100
2134
  n[d].isLine2 || m.push(n[d]), n[d].isLine2 && n[d].doorAndBeamData.length != 0 && m.push(n[d]);
2101
2135
  return n.length = 0, n.push(...m), { lines: n, beamGroup: u };
2102
- }, ci = (n, t) => {
2136
+ }, di = (n, t) => {
2103
2137
  if (!n || n.length <= 0) return;
2104
2138
  let e = {
2105
2139
  rectangles: [],
@@ -2120,43 +2154,43 @@ const li = async (n, t, e, o, i) => {
2120
2154
  let d = n[m].length;
2121
2155
  if (m == l || d < i || d > r)
2122
2156
  continue;
2123
- let p = new y.Vector3(n[m].start.x, n[m].start.y, n[m].start.z), b = new y.Vector3(n[m].end.x, n[m].end.y, n[m].end.z), V = ee(f, u, p, b);
2157
+ let g = new y.Vector3(n[m].start.x, n[m].start.y, n[m].start.z), b = new y.Vector3(n[m].end.x, n[m].end.y, n[m].end.z), V = re(f, u, g, b);
2124
2158
  if (!V || V.angle < 85)
2125
2159
  continue;
2126
- let v = Tt(p, f), S = Tt(p, u), z = Tt(b, f), D = Tt(b, u);
2160
+ let v = kt(g, f), S = kt(g, u), z = kt(b, f), D = kt(b, u);
2127
2161
  if (!(!v && !S && !z && !D)) {
2128
- v || S ? (x = p.clone(), P = b.clone()) : (x = b.clone(), P = p.clone()), M = new y.Vector3().subVectors(P, x).normalize(), M.clone().negate();
2162
+ v || S ? (x = g.clone(), P = b.clone()) : (x = b.clone(), P = g.clone()), M = new y.Vector3().subVectors(P, x).normalize(), M.clone().negate();
2129
2163
  for (let _ = 0; _ < n.length; _++) {
2130
- let E = n[_].length;
2131
- if (_ == l || _ == m || E < i || E > r)
2164
+ let T = n[_].length;
2165
+ if (_ == l || _ == m || T < i || T > r)
2132
2166
  continue;
2133
- let T = new y.Vector3(n[_].start.x, n[_].start.y, n[_].start.z), A = new y.Vector3(n[_].end.x, n[_].end.y, n[_].end.z), O = ee(p, b, T, A);
2167
+ let E = new y.Vector3(n[_].start.x, n[_].start.y, n[_].start.z), A = new y.Vector3(n[_].end.x, n[_].end.y, n[_].end.z), O = re(g, b, E, A);
2134
2168
  if (!O || O.angle < 85)
2135
2169
  continue;
2136
- let I = Tt(T, P), B = Tt(A, P);
2170
+ let I = kt(E, P), B = kt(A, P);
2137
2171
  if (!I && !B) continue;
2138
2172
  new y.Vector3();
2139
- let L = new y.Vector3(), W = new y.Vector3();
2140
- I ? (W = new y.Vector3().subVectors(A, T).normalize(), T.clone(), L = A.clone()) : (W = new y.Vector3().subVectors(T, A).normalize(), A.clone(), L = T.clone());
2141
- let C = te(w, W, 0.1);
2173
+ let R = new y.Vector3(), W = new y.Vector3();
2174
+ I ? (W = new y.Vector3().subVectors(A, E).normalize(), E.clone(), R = A.clone()) : (W = new y.Vector3().subVectors(E, A).normalize(), A.clone(), R = E.clone());
2175
+ let C = oe(w, W, 0.1);
2142
2176
  if (!(!C || !C.parallel || !C.sameDirection)) {
2143
- for (let R = 0; R < n.length; R++) {
2144
- let H = n[R].length;
2145
- if (R == l || R == m || R == _ || H < i || H > r)
2177
+ for (let L = 0; L < n.length; L++) {
2178
+ let H = n[L].length;
2179
+ if (L == l || L == m || L == _ || H < i || H > r)
2146
2180
  continue;
2147
- let X = new y.Vector3(n[R].start.x, n[R].start.y, n[R].start.z), nt = new y.Vector3(n[R].end.x, n[R].end.y, n[R].end.z), U = ee(X, nt, T, A);
2148
- if (!U || U.angle < 85)
2181
+ let X = new y.Vector3(n[L].start.x, n[L].start.y, n[L].start.z), ot = new y.Vector3(n[L].end.x, n[L].end.y, n[L].end.z), K = re(X, ot, E, A);
2182
+ if (!K || K.angle < 85)
2149
2183
  continue;
2150
- let $ = Tt(X, L), ut = Tt(nt, L);
2151
- if (!$ && !ut) continue;
2184
+ let G = kt(X, R), ut = kt(ot, R);
2185
+ if (!G && !ut) continue;
2152
2186
  new y.Vector3();
2153
- let ot = new y.Vector3();
2154
- $ ? (X.clone(), ot = nt.clone()) : (nt.clone(), ot = X.clone());
2155
- let F = Tt(ot, f), Y = Tt(ot, u);
2187
+ let rt = new y.Vector3();
2188
+ G ? (X.clone(), rt = ot.clone()) : (ot.clone(), rt = X.clone());
2189
+ let F = kt(rt, f), Y = kt(rt, u);
2156
2190
  if (!F && !Y) continue;
2157
- let Pt = c * d;
2158
- if (!(Pt < s || Pt > a)) {
2159
- h = [n[l].uuid, n[m].uuid, n[_].uuid, n[R].uuid];
2191
+ let Mt = c * d;
2192
+ if (!(Mt < s || Mt > a)) {
2193
+ h = [n[l].uuid, n[m].uuid, n[_].uuid, n[L].uuid];
2160
2194
  break;
2161
2195
  }
2162
2196
  }
@@ -2180,49 +2214,49 @@ const li = async (n, t, e, o, i) => {
2180
2214
  start: new y.Vector3(),
2181
2215
  end: new y.Vector3()
2182
2216
  }
2183
- }, f = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), u = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), g = !0, w = !0;
2217
+ }, f = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), u = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), p = !0, w = !0;
2184
2218
  for (let M = 0; M < n.length; M++) {
2185
2219
  if (M == l || n[M].length < i)
2186
2220
  continue;
2187
- let m = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), d = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), p = Tt(m, f), b = Tt(d, f), V = Tt(m, u), v = Tt(d, u);
2188
- if (p || b ? g = !1 : (V || v) && (w = !1), !g && !w) break;
2221
+ let m = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), d = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), g = kt(m, f), b = kt(d, f), V = kt(m, u), v = kt(d, u);
2222
+ if (g || b ? p = !1 : (V || v) && (w = !1), !p && !w) break;
2189
2223
  }
2190
- if (!g && !w) continue;
2224
+ if (!p && !w) continue;
2191
2225
  let x = new y.Vector3();
2192
- g || ([f, u] = [u, f]), x = new y.Vector3().subVectors(u, f).normalize();
2226
+ p || ([f, u] = [u, f]), x = new y.Vector3().subVectors(u, f).normalize();
2193
2227
  let P = x.clone().negate();
2194
2228
  for (let M = 0; M < n.length; M++) {
2195
2229
  let m = n[M].length;
2196
2230
  if (M == l || o.has(M) || m < i || m > r)
2197
2231
  continue;
2198
- let d = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), p = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), b = ee(f, u, d, p);
2232
+ let d = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), g = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), b = re(f, u, d, g);
2199
2233
  if (!b || b.angle < 85)
2200
2234
  continue;
2201
- let V = Tt(d, u), v = Tt(p, u);
2235
+ let V = kt(d, u), v = kt(g, u);
2202
2236
  if (!V && !v) continue;
2203
2237
  new y.Vector3();
2204
2238
  let S = new y.Vector3();
2205
- V ? (d.clone(), S = p.clone()) : (p.clone(), S = d.clone());
2239
+ V ? (d.clone(), S = g.clone()) : (g.clone(), S = d.clone());
2206
2240
  for (let z = 0; z < n.length; z++) {
2207
2241
  let D = n[z].length;
2208
2242
  if (z == l || z == M || o.has(z) || D < i || D > r)
2209
2243
  continue;
2210
- let _ = new y.Vector3(n[z].start.x, n[z].start.y, n[z].start.z), E = new y.Vector3(n[z].end.x, n[z].end.y, n[z].end.z), T = ee(d, p, _, E);
2211
- if (!T || T.angle < 85)
2244
+ let _ = new y.Vector3(n[z].start.x, n[z].start.y, n[z].start.z), T = new y.Vector3(n[z].end.x, n[z].end.y, n[z].end.z), E = re(d, g, _, T);
2245
+ if (!E || E.angle < 85)
2212
2246
  continue;
2213
- let A = Tt(_, S), O = Tt(E, S);
2247
+ let A = kt(_, S), O = kt(T, S);
2214
2248
  if (!A && !O) continue;
2215
2249
  let I = new y.Vector3(), B = new y.Vector3();
2216
- A ? (I = _.clone(), B = E.clone()) : (I = E.clone(), B = _.clone());
2217
- let L = new y.Vector3().subVectors(B, I).normalize(), W = te(P, L, 0.1);
2250
+ A ? (I = _.clone(), B = T.clone()) : (I = T.clone(), B = _.clone());
2251
+ let R = new y.Vector3().subVectors(B, I).normalize(), W = oe(P, R, 0.1);
2218
2252
  if (!W || !W.parallel || !W.sameDirection) continue;
2219
- let C = !0, R = !0;
2253
+ let C = !0, L = !0;
2220
2254
  for (let X = 0; X < n.length; X++) {
2221
2255
  if (X == z || n[X].length < i) continue;
2222
- let nt = new y.Vector3(n[X].start.x, n[X].start.y, n[X].start.z), U = new y.Vector3(n[X].end.x, n[X].end.y, n[X].end.z), $ = Tt(nt, _), ut = Tt(U, _), ot = Tt(nt, E), F = Tt(U, E);
2223
- if ($ || ut ? C = !1 : (ot || F) && (R = !1), !C && !R) break;
2256
+ let ot = new y.Vector3(n[X].start.x, n[X].start.y, n[X].start.z), K = new y.Vector3(n[X].end.x, n[X].end.y, n[X].end.z), G = kt(ot, _), ut = kt(K, _), rt = kt(ot, T), F = kt(K, T);
2257
+ if (G || ut ? C = !1 : (rt || F) && (L = !1), !C && !L) break;
2224
2258
  }
2225
- if (!C && !R) continue;
2259
+ if (!C && !L) continue;
2226
2260
  let H = c * m;
2227
2261
  if (!(H < s || H > a)) {
2228
2262
  h.indexs = [n[l].uuid, n[M].uuid, n[z].uuid], h.missingEdge.start = B, h.missingEdge.end = f;
@@ -2234,49 +2268,49 @@ const li = async (n, t, e, o, i) => {
2234
2268
  h.indexs.length == 3 && (h.indexs.forEach((M) => o.add(M)), e.threeEdgeRect.push(h));
2235
2269
  }
2236
2270
  return e;
2237
- }, re = 11102230246251565e-32, Xt = 134217729, zo = (3 + 8 * re) * re;
2238
- function Ce(n, t, e, o, i) {
2271
+ }, ae = 11102230246251565e-32, $t = 134217729, Do = (3 + 8 * ae) * ae;
2272
+ function We(n, t, e, o, i) {
2239
2273
  let r, s, a, l, c = t[0], h = o[0], f = 0, u = 0;
2240
2274
  h > c == h > -c ? (r = c, c = t[++f]) : (r = h, h = o[++u]);
2241
- let g = 0;
2275
+ let p = 0;
2242
2276
  if (f < n && u < e)
2243
- for (h > c == h > -c ? (s = c + r, a = r - (s - c), c = t[++f]) : (s = h + r, a = r - (s - h), h = o[++u]), r = s, a !== 0 && (i[g++] = a); f < n && u < e; )
2244
- h > c == h > -c ? (s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u]), r = s, a !== 0 && (i[g++] = a);
2277
+ for (h > c == h > -c ? (s = c + r, a = r - (s - c), c = t[++f]) : (s = h + r, a = r - (s - h), h = o[++u]), r = s, a !== 0 && (i[p++] = a); f < n && u < e; )
2278
+ h > c == h > -c ? (s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u]), r = s, a !== 0 && (i[p++] = a);
2245
2279
  for (; f < n; )
2246
- s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f], r = s, a !== 0 && (i[g++] = a);
2280
+ s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f], r = s, a !== 0 && (i[p++] = a);
2247
2281
  for (; u < e; )
2248
- s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u], r = s, a !== 0 && (i[g++] = a);
2249
- return (r !== 0 || g === 0) && (i[g++] = r), g;
2282
+ s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u], r = s, a !== 0 && (i[p++] = a);
2283
+ return (r !== 0 || p === 0) && (i[p++] = r), p;
2250
2284
  }
2251
- function Vo(n, t) {
2285
+ function _o(n, t) {
2252
2286
  let e = t[0];
2253
2287
  for (let o = 1; o < n; o++) e += t[o];
2254
2288
  return e;
2255
2289
  }
2256
- function ze(n) {
2290
+ function Ve(n) {
2257
2291
  return new Float64Array(n);
2258
2292
  }
2259
- const So = (3 + 16 * re) * re, vo = (2 + 12 * re) * re, Do = (9 + 64 * re) * re * re, fe = ze(4), Je = ze(8), tn = ze(12), en = ze(16), Yt = ze(4);
2260
- function _o(n, t, e, o, i, r, s) {
2261
- let a, l, c, h, f, u, g, w, x, P, M, m, d, p, b, V, v, S;
2262
- const z = n - i, D = e - i, _ = t - r, E = o - r;
2263
- p = z * E, u = Xt * z, g = u - (u - z), w = z - g, u = Xt * E, x = u - (u - E), P = E - x, b = w * P - (p - g * x - w * x - g * P), V = _ * D, u = Xt * _, g = u - (u - _), w = _ - g, u = Xt * D, x = u - (u - D), P = D - x, v = w * P - (V - g * x - w * x - g * P), M = b - v, f = b - M, fe[0] = b - (M + f) + (f - v), m = p + M, f = m - p, d = p - (m - f) + (M - f), M = d - V, f = d - M, fe[1] = d - (M + f) + (f - V), S = m + M, f = S - m, fe[2] = m - (S - f) + (M - f), fe[3] = S;
2264
- let T = Vo(4, fe), A = vo * s;
2265
- if (T >= A || -T >= A || (f = n - z, a = n - (z + f) + (f - i), f = e - D, c = e - (D + f) + (f - i), f = t - _, l = t - (_ + f) + (f - r), f = o - E, h = o - (E + f) + (f - r), a === 0 && l === 0 && c === 0 && h === 0) || (A = Do * s + zo * Math.abs(T), T += z * h + E * a - (_ * c + D * l), T >= A || -T >= A)) return T;
2266
- p = a * E, u = Xt * a, g = u - (u - a), w = a - g, u = Xt * E, x = u - (u - E), P = E - x, b = w * P - (p - g * x - w * x - g * P), V = l * D, u = Xt * l, g = u - (u - l), w = l - g, u = Xt * D, x = u - (u - D), P = D - x, v = w * P - (V - g * x - w * x - g * P), M = b - v, f = b - M, Yt[0] = b - (M + f) + (f - v), m = p + M, f = m - p, d = p - (m - f) + (M - f), M = d - V, f = d - M, Yt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, Yt[2] = m - (S - f) + (M - f), Yt[3] = S;
2267
- const O = Ce(4, fe, 4, Yt, Je);
2268
- p = z * h, u = Xt * z, g = u - (u - z), w = z - g, u = Xt * h, x = u - (u - h), P = h - x, b = w * P - (p - g * x - w * x - g * P), V = _ * c, u = Xt * _, g = u - (u - _), w = _ - g, u = Xt * c, x = u - (u - c), P = c - x, v = w * P - (V - g * x - w * x - g * P), M = b - v, f = b - M, Yt[0] = b - (M + f) + (f - v), m = p + M, f = m - p, d = p - (m - f) + (M - f), M = d - V, f = d - M, Yt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, Yt[2] = m - (S - f) + (M - f), Yt[3] = S;
2269
- const I = Ce(O, Je, 4, Yt, tn);
2270
- p = a * h, u = Xt * a, g = u - (u - a), w = a - g, u = Xt * h, x = u - (u - h), P = h - x, b = w * P - (p - g * x - w * x - g * P), V = l * c, u = Xt * l, g = u - (u - l), w = l - g, u = Xt * c, x = u - (u - c), P = c - x, v = w * P - (V - g * x - w * x - g * P), M = b - v, f = b - M, Yt[0] = b - (M + f) + (f - v), m = p + M, f = m - p, d = p - (m - f) + (M - f), M = d - V, f = d - M, Yt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, Yt[2] = m - (S - f) + (M - f), Yt[3] = S;
2271
- const B = Ce(I, tn, 4, Yt, en);
2272
- return en[B - 1];
2273
- }
2274
- function Ve(n, t, e, o, i, r) {
2293
+ const To = (3 + 16 * ae) * ae, Eo = (2 + 12 * ae) * ae, Ao = (9 + 64 * ae) * ae * ae, me = Ve(4), on = Ve(8), rn = Ve(12), sn = Ve(16), jt = Ve(4);
2294
+ function Bo(n, t, e, o, i, r, s) {
2295
+ let a, l, c, h, f, u, p, w, x, P, M, m, d, g, b, V, v, S;
2296
+ const z = n - i, D = e - i, _ = t - r, T = o - r;
2297
+ g = z * T, u = $t * z, p = u - (u - z), w = z - p, u = $t * T, x = u - (u - T), P = T - x, b = w * P - (g - p * x - w * x - p * P), V = _ * D, u = $t * _, p = u - (u - _), w = _ - p, u = $t * D, x = u - (u - D), P = D - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, me[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, me[1] = d - (M + f) + (f - V), S = m + M, f = S - m, me[2] = m - (S - f) + (M - f), me[3] = S;
2298
+ let E = _o(4, me), A = Eo * s;
2299
+ if (E >= A || -E >= A || (f = n - z, a = n - (z + f) + (f - i), f = e - D, c = e - (D + f) + (f - i), f = t - _, l = t - (_ + f) + (f - r), f = o - T, h = o - (T + f) + (f - r), a === 0 && l === 0 && c === 0 && h === 0) || (A = Ao * s + Do * Math.abs(E), E += z * h + T * a - (_ * c + D * l), E >= A || -E >= A)) return E;
2300
+ g = a * T, u = $t * a, p = u - (u - a), w = a - p, u = $t * T, x = u - (u - T), P = T - x, b = w * P - (g - p * x - w * x - p * P), V = l * D, u = $t * l, p = u - (u - l), w = l - p, u = $t * D, x = u - (u - D), P = D - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
2301
+ const O = We(4, me, 4, jt, on);
2302
+ g = z * h, u = $t * z, p = u - (u - z), w = z - p, u = $t * h, x = u - (u - h), P = h - x, b = w * P - (g - p * x - w * x - p * P), V = _ * c, u = $t * _, p = u - (u - _), w = _ - p, u = $t * c, x = u - (u - c), P = c - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
2303
+ const I = We(O, on, 4, jt, rn);
2304
+ g = a * h, u = $t * a, p = u - (u - a), w = a - p, u = $t * h, x = u - (u - h), P = h - x, b = w * P - (g - p * x - w * x - p * P), V = l * c, u = $t * l, p = u - (u - l), w = l - p, u = $t * c, x = u - (u - c), P = c - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
2305
+ const B = We(I, rn, 4, jt, sn);
2306
+ return sn[B - 1];
2307
+ }
2308
+ function ve(n, t, e, o, i, r) {
2275
2309
  const s = (t - r) * (e - i), a = (n - i) * (o - r), l = s - a, c = Math.abs(s + a);
2276
- return Math.abs(l) >= So * c ? l : -_o(n, t, e, o, i, r, c);
2310
+ return Math.abs(l) >= To * c ? l : -Bo(n, t, e, o, i, r, c);
2277
2311
  }
2278
- const nn = Math.pow(2, -52), Se = new Uint32Array(512);
2279
- class Te {
2312
+ const an = Math.pow(2, -52), De = new Uint32Array(512);
2313
+ class Be {
2280
2314
  /**
2281
2315
  * Constructs a delaunay triangulation object given an array of points (`[x, y]` by default).
2282
2316
  * `getX` and `getY` are optional functions of the form `(point) => value` for custom point formats.
@@ -2287,13 +2321,13 @@ class Te {
2287
2321
  * @param {(p: P) => number} [getY]
2288
2322
  */
2289
2323
  // @ts-expect-error TS2322
2290
- static from(t, e = Io, o = ko) {
2324
+ static from(t, e = Lo, o = Fo) {
2291
2325
  const i = t.length, r = new Float64Array(i * 2);
2292
2326
  for (let s = 0; s < i; s++) {
2293
2327
  const a = t[s];
2294
2328
  r[2 * s] = e(a), r[2 * s + 1] = o(a);
2295
2329
  }
2296
- return new Te(r);
2330
+ return new Be(r);
2297
2331
  }
2298
2332
  /**
2299
2333
  * Constructs a delaunay triangulation object given an array of point coordinates of the form:
@@ -2320,71 +2354,71 @@ class Te {
2320
2354
  D < a && (a = D), _ < l && (l = _), D > c && (c = D), _ > h && (h = _), this._ids[z] = z;
2321
2355
  }
2322
2356
  const f = (a + c) / 2, u = (l + h) / 2;
2323
- let g = 0, w = 0, x = 0;
2357
+ let p = 0, w = 0, x = 0;
2324
2358
  for (let z = 0, D = 1 / 0; z < s; z++) {
2325
- const _ = Le(f, u, t[2 * z], t[2 * z + 1]);
2326
- _ < D && (g = z, D = _);
2359
+ const _ = Ne(f, u, t[2 * z], t[2 * z + 1]);
2360
+ _ < D && (p = z, D = _);
2327
2361
  }
2328
- const P = t[2 * g], M = t[2 * g + 1];
2362
+ const P = t[2 * p], M = t[2 * p + 1];
2329
2363
  for (let z = 0, D = 1 / 0; z < s; z++) {
2330
- if (z === g) continue;
2331
- const _ = Le(P, M, t[2 * z], t[2 * z + 1]);
2364
+ if (z === p) continue;
2365
+ const _ = Ne(P, M, t[2 * z], t[2 * z + 1]);
2332
2366
  _ < D && _ > 0 && (w = z, D = _);
2333
2367
  }
2334
- let m = t[2 * w], d = t[2 * w + 1], p = 1 / 0;
2368
+ let m = t[2 * w], d = t[2 * w + 1], g = 1 / 0;
2335
2369
  for (let z = 0; z < s; z++) {
2336
- if (z === g || z === w) continue;
2337
- const D = Ao(P, M, m, d, t[2 * z], t[2 * z + 1]);
2338
- D < p && (x = z, p = D);
2370
+ if (z === p || z === w) continue;
2371
+ const D = Co(P, M, m, d, t[2 * z], t[2 * z + 1]);
2372
+ D < g && (x = z, g = D);
2339
2373
  }
2340
2374
  let b = t[2 * x], V = t[2 * x + 1];
2341
- if (p === 1 / 0) {
2375
+ if (g === 1 / 0) {
2342
2376
  for (let _ = 0; _ < s; _++)
2343
2377
  this._dists[_] = t[2 * _] - t[0] || t[2 * _ + 1] - t[1];
2344
- ge(this._ids, this._dists, 0, s - 1);
2378
+ ye(this._ids, this._dists, 0, s - 1);
2345
2379
  const z = new Uint32Array(s);
2346
2380
  let D = 0;
2347
- for (let _ = 0, E = -1 / 0; _ < s; _++) {
2348
- const T = this._ids[_], A = this._dists[T];
2349
- A > E && (z[D++] = T, E = A);
2381
+ for (let _ = 0, T = -1 / 0; _ < s; _++) {
2382
+ const E = this._ids[_], A = this._dists[E];
2383
+ A > T && (z[D++] = E, T = A);
2350
2384
  }
2351
2385
  this.hull = z.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
2352
2386
  return;
2353
2387
  }
2354
- if (Ve(P, M, m, d, b, V) < 0) {
2388
+ if (ve(P, M, m, d, b, V) < 0) {
2355
2389
  const z = w, D = m, _ = d;
2356
2390
  w = x, m = b, d = V, x = z, b = D, V = _;
2357
2391
  }
2358
- const v = Bo(P, M, m, d, b, V);
2392
+ const v = Ro(P, M, m, d, b, V);
2359
2393
  this._cx = v.x, this._cy = v.y;
2360
2394
  for (let z = 0; z < s; z++)
2361
- this._dists[z] = Le(t[2 * z], t[2 * z + 1], v.x, v.y);
2362
- ge(this._ids, this._dists, 0, s - 1), this._hullStart = g;
2395
+ this._dists[z] = Ne(t[2 * z], t[2 * z + 1], v.x, v.y);
2396
+ ye(this._ids, this._dists, 0, s - 1), this._hullStart = p;
2363
2397
  let S = 3;
2364
- o[g] = e[x] = w, o[w] = e[g] = x, o[x] = e[w] = g, i[g] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = g, r[this._hashKey(m, d)] = w, r[this._hashKey(b, V)] = x, this.trianglesLen = 0, this._addTriangle(g, w, x, -1, -1, -1);
2398
+ o[p] = e[x] = w, o[w] = e[p] = x, o[x] = e[w] = p, i[p] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = p, r[this._hashKey(m, d)] = w, r[this._hashKey(b, V)] = x, this.trianglesLen = 0, this._addTriangle(p, w, x, -1, -1, -1);
2365
2399
  for (let z = 0, D = 0, _ = 0; z < this._ids.length; z++) {
2366
- const E = this._ids[z], T = t[2 * E], A = t[2 * E + 1];
2367
- if (z > 0 && Math.abs(T - D) <= nn && Math.abs(A - _) <= nn || (D = T, _ = A, E === g || E === w || E === x)) continue;
2400
+ const T = this._ids[z], E = t[2 * T], A = t[2 * T + 1];
2401
+ if (z > 0 && Math.abs(E - D) <= an && Math.abs(A - _) <= an || (D = E, _ = A, T === p || T === w || T === x)) continue;
2368
2402
  let O = 0;
2369
- for (let C = 0, R = this._hashKey(T, A); C < this._hashSize && (O = r[(R + C) % this._hashSize], !(O !== -1 && O !== o[O])); C++)
2403
+ for (let C = 0, L = this._hashKey(E, A); C < this._hashSize && (O = r[(L + C) % this._hashSize], !(O !== -1 && O !== o[O])); C++)
2370
2404
  ;
2371
2405
  O = e[O];
2372
2406
  let I = O, B;
2373
- for (; B = o[I], Ve(T, A, t[2 * I], t[2 * I + 1], t[2 * B], t[2 * B + 1]) >= 0; )
2407
+ for (; B = o[I], ve(E, A, t[2 * I], t[2 * I + 1], t[2 * B], t[2 * B + 1]) >= 0; )
2374
2408
  if (I = B, I === O) {
2375
2409
  I = -1;
2376
2410
  break;
2377
2411
  }
2378
2412
  if (I === -1) continue;
2379
- let L = this._addTriangle(I, E, o[I], -1, -1, i[I]);
2380
- i[E] = this._legalize(L + 2), i[I] = L, S++;
2413
+ let R = this._addTriangle(I, T, o[I], -1, -1, i[I]);
2414
+ i[T] = this._legalize(R + 2), i[I] = R, S++;
2381
2415
  let W = o[I];
2382
- for (; B = o[W], Ve(T, A, t[2 * W], t[2 * W + 1], t[2 * B], t[2 * B + 1]) < 0; )
2383
- L = this._addTriangle(W, E, B, i[E], -1, i[W]), i[E] = this._legalize(L + 2), o[W] = W, S--, W = B;
2416
+ for (; B = o[W], ve(E, A, t[2 * W], t[2 * W + 1], t[2 * B], t[2 * B + 1]) < 0; )
2417
+ R = this._addTriangle(W, T, B, i[T], -1, i[W]), i[T] = this._legalize(R + 2), o[W] = W, S--, W = B;
2384
2418
  if (I === O)
2385
- for (; B = e[I], Ve(T, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
2386
- L = this._addTriangle(B, E, I, -1, i[I], i[B]), this._legalize(L + 2), i[B] = L, o[I] = I, S--, I = B;
2387
- this._hullStart = e[E] = I, o[I] = e[W] = E, o[E] = W, r[this._hashKey(T, A)] = E, r[this._hashKey(t[2 * I], t[2 * I + 1])] = I;
2419
+ for (; B = e[I], ve(E, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
2420
+ R = this._addTriangle(B, T, I, -1, i[I], i[B]), this._legalize(R + 2), i[B] = R, o[I] = I, S--, I = B;
2421
+ this._hullStart = e[T] = I, o[I] = e[W] = T, o[T] = W, r[this._hashKey(E, A)] = T, r[this._hashKey(t[2 * I], t[2 * I + 1])] = I;
2388
2422
  }
2389
2423
  this.hull = new Uint32Array(S);
2390
2424
  for (let z = 0, D = this._hullStart; z < S; z++)
@@ -2399,7 +2433,7 @@ class Te {
2399
2433
  * @private
2400
2434
  */
2401
2435
  _hashKey(t, e) {
2402
- return Math.floor(Eo(t - this._cx, e - this._cy) * this._hashSize) % this._hashSize;
2436
+ return Math.floor(Io(t - this._cx, e - this._cy) * this._hashSize) % this._hashSize;
2403
2437
  }
2404
2438
  /**
2405
2439
  * Flip an edge in a pair of triangles if it doesn't satisfy the Delaunay condition.
@@ -2414,15 +2448,15 @@ class Te {
2414
2448
  const a = o[t], l = t - t % 3;
2415
2449
  if (s = l + (t + 2) % 3, a === -1) {
2416
2450
  if (r === 0) break;
2417
- t = Se[--r];
2451
+ t = De[--r];
2418
2452
  continue;
2419
2453
  }
2420
- const c = a - a % 3, h = l + (t + 1) % 3, f = c + (a + 2) % 3, u = e[s], g = e[t], w = e[h], x = e[f];
2421
- if (To(
2454
+ const c = a - a % 3, h = l + (t + 1) % 3, f = c + (a + 2) % 3, u = e[s], p = e[t], w = e[h], x = e[f];
2455
+ if (ko(
2422
2456
  i[2 * u],
2423
2457
  i[2 * u + 1],
2424
- i[2 * g],
2425
- i[2 * g + 1],
2458
+ i[2 * p],
2459
+ i[2 * p + 1],
2426
2460
  i[2 * w],
2427
2461
  i[2 * w + 1],
2428
2462
  i[2 * x],
@@ -2442,10 +2476,10 @@ class Te {
2442
2476
  }
2443
2477
  this._link(t, M), this._link(a, o[s]), this._link(s, f);
2444
2478
  const m = c + (a + 1) % 3;
2445
- r < Se.length && (Se[r++] = m);
2479
+ r < De.length && (De[r++] = m);
2446
2480
  } else {
2447
2481
  if (r === 0) break;
2448
- t = Se[--r];
2482
+ t = De[--r];
2449
2483
  }
2450
2484
  }
2451
2485
  return s;
@@ -2475,27 +2509,27 @@ class Te {
2475
2509
  return this._triangles[a] = t, this._triangles[a + 1] = e, this._triangles[a + 2] = o, this._link(a, i), this._link(a + 1, r), this._link(a + 2, s), this.trianglesLen += 3, a;
2476
2510
  }
2477
2511
  }
2478
- function Eo(n, t) {
2512
+ function Io(n, t) {
2479
2513
  const e = n / (Math.abs(n) + Math.abs(t));
2480
2514
  return (t > 0 ? 3 - e : 1 + e) / 4;
2481
2515
  }
2482
- function Le(n, t, e, o) {
2516
+ function Ne(n, t, e, o) {
2483
2517
  const i = n - e, r = t - o;
2484
2518
  return i * i + r * r;
2485
2519
  }
2486
- function To(n, t, e, o, i, r, s, a) {
2487
- const l = n - s, c = t - a, h = e - s, f = o - a, u = i - s, g = r - a, w = l * l + c * c, x = h * h + f * f, P = u * u + g * g;
2488
- return l * (f * P - x * g) - c * (h * P - x * u) + w * (h * g - f * u) < 0;
2520
+ function ko(n, t, e, o, i, r, s, a) {
2521
+ const l = n - s, c = t - a, h = e - s, f = o - a, u = i - s, p = r - a, w = l * l + c * c, x = h * h + f * f, P = u * u + p * p;
2522
+ return l * (f * P - x * p) - c * (h * P - x * u) + w * (h * p - f * u) < 0;
2489
2523
  }
2490
- function Ao(n, t, e, o, i, r) {
2491
- const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), g = (c * h - a * f) * u, w = (s * f - l * h) * u;
2492
- return g * g + w * w;
2524
+ function Co(n, t, e, o, i, r) {
2525
+ const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), p = (c * h - a * f) * u, w = (s * f - l * h) * u;
2526
+ return p * p + w * w;
2493
2527
  }
2494
- function Bo(n, t, e, o, i, r) {
2495
- const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), g = n + (c * h - a * f) * u, w = t + (s * f - l * h) * u;
2496
- return { x: g, y: w };
2528
+ function Ro(n, t, e, o, i, r) {
2529
+ const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), p = n + (c * h - a * f) * u, w = t + (s * f - l * h) * u;
2530
+ return { x: p, y: w };
2497
2531
  }
2498
- function ge(n, t, e, o) {
2532
+ function ye(n, t, e, o) {
2499
2533
  if (o - e <= 20)
2500
2534
  for (let i = e + 1; i <= o; i++) {
2501
2535
  const r = n[i], s = t[r];
@@ -2506,7 +2540,7 @@ function ge(n, t, e, o) {
2506
2540
  else {
2507
2541
  const i = e + o >> 1;
2508
2542
  let r = e + 1, s = o;
2509
- Pe(n, i, r), t[n[e]] > t[n[o]] && Pe(n, e, o), t[n[r]] > t[n[o]] && Pe(n, r, o), t[n[e]] > t[n[r]] && Pe(n, e, r);
2543
+ Me(n, i, r), t[n[e]] > t[n[o]] && Me(n, e, o), t[n[r]] > t[n[o]] && Me(n, r, o), t[n[e]] > t[n[r]] && Me(n, e, r);
2510
2544
  const a = n[r], l = t[a];
2511
2545
  for (; ; ) {
2512
2546
  do
@@ -2516,23 +2550,23 @@ function ge(n, t, e, o) {
2516
2550
  s--;
2517
2551
  while (t[n[s]] > l);
2518
2552
  if (s < r) break;
2519
- Pe(n, r, s);
2553
+ Me(n, r, s);
2520
2554
  }
2521
- n[e + 1] = n[s], n[s] = a, o - r + 1 >= s - e ? (ge(n, t, r, o), ge(n, t, e, s - 1)) : (ge(n, t, e, s - 1), ge(n, t, r, o));
2555
+ n[e + 1] = n[s], n[s] = a, o - r + 1 >= s - e ? (ye(n, t, r, o), ye(n, t, e, s - 1)) : (ye(n, t, e, s - 1), ye(n, t, r, o));
2522
2556
  }
2523
2557
  }
2524
- function Pe(n, t, e) {
2558
+ function Me(n, t, e) {
2525
2559
  const o = n[t];
2526
2560
  n[t] = n[e], n[e] = o;
2527
2561
  }
2528
- function Io(n) {
2562
+ function Lo(n) {
2529
2563
  return n[0];
2530
2564
  }
2531
- function ko(n) {
2565
+ function Fo(n) {
2532
2566
  return n[1];
2533
2567
  }
2534
- const on = 1e-6;
2535
- class he {
2568
+ const ln = 1e-6;
2569
+ class de {
2536
2570
  constructor() {
2537
2571
  this._x0 = this._y0 = // start of current subpath
2538
2572
  this._x1 = this._y1 = null, this._ = "";
@@ -2550,7 +2584,7 @@ class he {
2550
2584
  t = +t, e = +e, o = +o;
2551
2585
  const i = t + o, r = e;
2552
2586
  if (o < 0) throw new Error("negative radius");
2553
- this._x1 === null ? this._ += `M${i},${r}` : (Math.abs(this._x1 - i) > on || Math.abs(this._y1 - r) > on) && (this._ += "L" + i + "," + r), o && (this._ += `A${o},${o},0,1,1,${t - o},${e}A${o},${o},0,1,1,${this._x1 = i},${this._y1 = r}`);
2587
+ this._x1 === null ? this._ += `M${i},${r}` : (Math.abs(this._x1 - i) > ln || Math.abs(this._y1 - r) > ln) && (this._ += "L" + i + "," + r), o && (this._ += `A${o},${o},0,1,1,${t - o},${e}A${o},${o},0,1,1,${this._x1 = i},${this._y1 = r}`);
2554
2588
  }
2555
2589
  rect(t, e, o, i) {
2556
2590
  this._ += `M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +e}h${+o}v${+i}h${-o}Z`;
@@ -2559,7 +2593,7 @@ class he {
2559
2593
  return this._ || null;
2560
2594
  }
2561
2595
  }
2562
- class qe {
2596
+ class Ge {
2563
2597
  constructor() {
2564
2598
  this._ = [];
2565
2599
  }
@@ -2576,7 +2610,7 @@ class qe {
2576
2610
  return this._.length ? this._ : null;
2577
2611
  }
2578
2612
  }
2579
- class Co {
2613
+ class Oo {
2580
2614
  constructor(t, [e, o, i, r] = [0, 0, 960, 500]) {
2581
2615
  if (!((i = +i) >= (e = +e)) || !((r = +r) >= (o = +o))) throw new Error("invalid bounds");
2582
2616
  this.delaunay = t, this._circumcenters = new Float64Array(t.points.length * 2), this.vectors = new Float64Array(t.points.length * 2), this.xmax = i, this.xmin = e, this.ymax = r, this.ymin = o, this._init();
@@ -2589,49 +2623,49 @@ class Co {
2589
2623
  let r, s;
2590
2624
  const a = this.circumcenters = this._circumcenters.subarray(0, o.length / 3 * 2);
2591
2625
  for (let x = 0, P = 0, M = o.length, m, d; x < M; x += 3, P += 2) {
2592
- const p = o[x] * 2, b = o[x + 1] * 2, V = o[x + 2] * 2, v = t[p], S = t[p + 1], z = t[b], D = t[b + 1], _ = t[V], E = t[V + 1], T = z - v, A = D - S, O = _ - v, I = E - S, B = (T * I - A * O) * 2;
2626
+ const g = o[x] * 2, b = o[x + 1] * 2, V = o[x + 2] * 2, v = t[g], S = t[g + 1], z = t[b], D = t[b + 1], _ = t[V], T = t[V + 1], E = z - v, A = D - S, O = _ - v, I = T - S, B = (E * I - A * O) * 2;
2593
2627
  if (Math.abs(B) < 1e-9) {
2594
2628
  if (r === void 0) {
2595
2629
  r = s = 0;
2596
2630
  for (const W of e) r += t[W * 2], s += t[W * 2 + 1];
2597
2631
  r /= e.length, s /= e.length;
2598
2632
  }
2599
- const L = 1e9 * Math.sign((r - v) * I - (s - S) * O);
2600
- m = (v + _) / 2 - L * I, d = (S + E) / 2 + L * O;
2633
+ const R = 1e9 * Math.sign((r - v) * I - (s - S) * O);
2634
+ m = (v + _) / 2 - R * I, d = (S + T) / 2 + R * O;
2601
2635
  } else {
2602
- const L = 1 / B, W = T * T + A * A, C = O * O + I * I;
2603
- m = v + (I * W - A * C) * L, d = S + (T * C - O * W) * L;
2636
+ const R = 1 / B, W = E * E + A * A, C = O * O + I * I;
2637
+ m = v + (I * W - A * C) * R, d = S + (E * C - O * W) * R;
2604
2638
  }
2605
2639
  a[P] = m, a[P + 1] = d;
2606
2640
  }
2607
- let l = e[e.length - 1], c, h = l * 4, f, u = t[2 * l], g, w = t[2 * l + 1];
2641
+ let l = e[e.length - 1], c, h = l * 4, f, u = t[2 * l], p, w = t[2 * l + 1];
2608
2642
  i.fill(0);
2609
2643
  for (let x = 0; x < e.length; ++x)
2610
- l = e[x], c = h, f = u, g = w, h = l * 4, u = t[2 * l], w = t[2 * l + 1], i[c + 2] = i[h] = g - w, i[c + 3] = i[h + 1] = u - f;
2644
+ l = e[x], c = h, f = u, p = w, h = l * 4, u = t[2 * l], w = t[2 * l + 1], i[c + 2] = i[h] = p - w, i[c + 3] = i[h + 1] = u - f;
2611
2645
  }
2612
2646
  render(t) {
2613
- const e = t == null ? t = new he() : void 0, { delaunay: { halfedges: o, inedges: i, hull: r }, circumcenters: s, vectors: a } = this;
2647
+ const e = t == null ? t = new de() : void 0, { delaunay: { halfedges: o, inedges: i, hull: r }, circumcenters: s, vectors: a } = this;
2614
2648
  if (r.length <= 1) return null;
2615
2649
  for (let h = 0, f = o.length; h < f; ++h) {
2616
2650
  const u = o[h];
2617
2651
  if (u < h) continue;
2618
- const g = Math.floor(h / 3) * 2, w = Math.floor(u / 3) * 2, x = s[g], P = s[g + 1], M = s[w], m = s[w + 1];
2652
+ const p = Math.floor(h / 3) * 2, w = Math.floor(u / 3) * 2, x = s[p], P = s[p + 1], M = s[w], m = s[w + 1];
2619
2653
  this._renderSegment(x, P, M, m, t);
2620
2654
  }
2621
2655
  let l, c = r[r.length - 1];
2622
2656
  for (let h = 0; h < r.length; ++h) {
2623
2657
  l = c, c = r[h];
2624
- const f = Math.floor(i[c] / 3) * 2, u = s[f], g = s[f + 1], w = l * 4, x = this._project(u, g, a[w + 2], a[w + 3]);
2625
- x && this._renderSegment(u, g, x[0], x[1], t);
2658
+ const f = Math.floor(i[c] / 3) * 2, u = s[f], p = s[f + 1], w = l * 4, x = this._project(u, p, a[w + 2], a[w + 3]);
2659
+ x && this._renderSegment(u, p, x[0], x[1], t);
2626
2660
  }
2627
2661
  return e && e.value();
2628
2662
  }
2629
2663
  renderBounds(t) {
2630
- const e = t == null ? t = new he() : void 0;
2664
+ const e = t == null ? t = new de() : void 0;
2631
2665
  return t.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), e && e.value();
2632
2666
  }
2633
2667
  renderCell(t, e) {
2634
- const o = e == null ? e = new he() : void 0, i = this._clip(t);
2668
+ const o = e == null ? e = new de() : void 0, i = this._clip(t);
2635
2669
  if (i === null || !i.length) return;
2636
2670
  e.moveTo(i[0], i[1]);
2637
2671
  let r = i.length;
@@ -2648,7 +2682,7 @@ class Co {
2648
2682
  }
2649
2683
  }
2650
2684
  cellPolygon(t) {
2651
- const e = new qe();
2685
+ const e = new Ge();
2652
2686
  return this.renderCell(t, e), e.value();
2653
2687
  }
2654
2688
  _renderSegment(t, e, o, i, r) {
@@ -2696,8 +2730,8 @@ class Co {
2696
2730
  _clipFinite(t, e) {
2697
2731
  const o = e.length;
2698
2732
  let i = null, r, s, a = e[o - 2], l = e[o - 1], c, h = this._regioncode(a, l), f, u = 0;
2699
- for (let g = 0; g < o; g += 2)
2700
- if (r = a, s = l, a = e[g], l = e[g + 1], c = h, h = this._regioncode(a, l), c === 0 && h === 0)
2733
+ for (let p = 0; p < o; p += 2)
2734
+ if (r = a, s = l, a = e[p], l = e[p + 1], c = h, h = this._regioncode(a, l), c === 0 && h === 0)
2701
2735
  f = u, u = 0, i ? i.push(a, l) : i = [a, l];
2702
2736
  else {
2703
2737
  let w, x, P, M, m;
@@ -2801,14 +2835,14 @@ class Co {
2801
2835
  return t;
2802
2836
  }
2803
2837
  }
2804
- const Lo = 2 * Math.PI, de = Math.pow;
2805
- function Ro(n) {
2838
+ const Wo = 2 * Math.PI, ge = Math.pow;
2839
+ function No(n) {
2806
2840
  return n[0];
2807
2841
  }
2808
- function Fo(n) {
2842
+ function qo(n) {
2809
2843
  return n[1];
2810
2844
  }
2811
- function Oo(n) {
2845
+ function Xo(n) {
2812
2846
  const { triangles: t, coords: e } = n;
2813
2847
  for (let o = 0; o < t.length; o += 3) {
2814
2848
  const i = 2 * t[o], r = 2 * t[o + 1], s = 2 * t[o + 2];
@@ -2816,29 +2850,29 @@ function Oo(n) {
2816
2850
  }
2817
2851
  return !0;
2818
2852
  }
2819
- function Wo(n, t, e) {
2853
+ function Ho(n, t, e) {
2820
2854
  return [n + Math.sin(n + t) * e, t + Math.cos(n - t) * e];
2821
2855
  }
2822
- class He {
2823
- static from(t, e = Ro, o = Fo, i) {
2824
- return new He("length" in t ? No(t, e, o, i) : Float64Array.from(qo(t, e, o, i)));
2856
+ class Ue {
2857
+ static from(t, e = No, o = qo, i) {
2858
+ return new Ue("length" in t ? Yo(t, e, o, i) : Float64Array.from($o(t, e, o, i)));
2825
2859
  }
2826
2860
  constructor(t) {
2827
- this._delaunator = new Te(t), this.inedges = new Int32Array(t.length / 2), this._hullIndex = new Int32Array(t.length / 2), this.points = this._delaunator.coords, this._init();
2861
+ this._delaunator = new Be(t), this.inedges = new Int32Array(t.length / 2), this._hullIndex = new Int32Array(t.length / 2), this.points = this._delaunator.coords, this._init();
2828
2862
  }
2829
2863
  update() {
2830
2864
  return this._delaunator.update(), this._init(), this;
2831
2865
  }
2832
2866
  _init() {
2833
2867
  const t = this._delaunator, e = this.points;
2834
- if (t.hull && t.hull.length > 2 && Oo(t)) {
2835
- this.collinear = Int32Array.from({ length: e.length / 2 }, (u, g) => g).sort((u, g) => e[2 * u] - e[2 * g] || e[2 * u + 1] - e[2 * g + 1]);
2868
+ if (t.hull && t.hull.length > 2 && Xo(t)) {
2869
+ this.collinear = Int32Array.from({ length: e.length / 2 }, (u, p) => p).sort((u, p) => e[2 * u] - e[2 * p] || e[2 * u + 1] - e[2 * p + 1]);
2836
2870
  const l = this.collinear[0], c = this.collinear[this.collinear.length - 1], h = [e[2 * l], e[2 * l + 1], e[2 * c], e[2 * c + 1]], f = 1e-8 * Math.hypot(h[3] - h[1], h[2] - h[0]);
2837
- for (let u = 0, g = e.length / 2; u < g; ++u) {
2838
- const w = Wo(e[2 * u], e[2 * u + 1], f);
2871
+ for (let u = 0, p = e.length / 2; u < p; ++u) {
2872
+ const w = Ho(e[2 * u], e[2 * u + 1], f);
2839
2873
  e[2 * u] = w[0], e[2 * u + 1] = w[1];
2840
2874
  }
2841
- this._delaunator = new Te(e);
2875
+ this._delaunator = new Be(e);
2842
2876
  } else
2843
2877
  delete this.collinear;
2844
2878
  const o = this.halfedges = this._delaunator.halfedges, i = this.hull = this._delaunator.hull, r = this.triangles = this._delaunator.triangles, s = this.inedges.fill(-1), a = this._hullIndex.fill(-1);
@@ -2851,7 +2885,7 @@ class He {
2851
2885
  i.length <= 2 && i.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = i[0], s[i[0]] = 1, i.length === 2 && (s[i[1]] = 0, this.triangles[1] = i[1], this.triangles[2] = i[1]));
2852
2886
  }
2853
2887
  voronoi(t) {
2854
- return new Co(this, t);
2888
+ return new Oo(this, t);
2855
2889
  }
2856
2890
  *neighbors(t) {
2857
2891
  const { inedges: e, hull: o, _hullIndex: i, halfedges: r, triangles: s, collinear: a } = this;
@@ -2882,23 +2916,23 @@ class He {
2882
2916
  _step(t, e, o) {
2883
2917
  const { inedges: i, hull: r, _hullIndex: s, halfedges: a, triangles: l, points: c } = this;
2884
2918
  if (i[t] === -1 || !c.length) return (t + 1) % (c.length >> 1);
2885
- let h = t, f = de(e - c[t * 2], 2) + de(o - c[t * 2 + 1], 2);
2919
+ let h = t, f = ge(e - c[t * 2], 2) + ge(o - c[t * 2 + 1], 2);
2886
2920
  const u = i[t];
2887
- let g = u;
2921
+ let p = u;
2888
2922
  do {
2889
- let w = l[g];
2890
- const x = de(e - c[w * 2], 2) + de(o - c[w * 2 + 1], 2);
2891
- if (x < f && (f = x, h = w), g = g % 3 === 2 ? g - 2 : g + 1, l[g] !== t) break;
2892
- if (g = a[g], g === -1) {
2893
- if (g = r[(s[t] + 1) % r.length], g !== w && de(e - c[g * 2], 2) + de(o - c[g * 2 + 1], 2) < f)
2894
- return g;
2923
+ let w = l[p];
2924
+ const x = ge(e - c[w * 2], 2) + ge(o - c[w * 2 + 1], 2);
2925
+ if (x < f && (f = x, h = w), p = p % 3 === 2 ? p - 2 : p + 1, l[p] !== t) break;
2926
+ if (p = a[p], p === -1) {
2927
+ if (p = r[(s[t] + 1) % r.length], p !== w && ge(e - c[p * 2], 2) + ge(o - c[p * 2 + 1], 2) < f)
2928
+ return p;
2895
2929
  break;
2896
2930
  }
2897
- } while (g !== u);
2931
+ } while (p !== u);
2898
2932
  return h;
2899
2933
  }
2900
2934
  render(t) {
2901
- const e = t == null ? t = new he() : void 0, { points: o, halfedges: i, triangles: r } = this;
2935
+ const e = t == null ? t = new de() : void 0, { points: o, halfedges: i, triangles: r } = this;
2902
2936
  for (let s = 0, a = i.length; s < a; ++s) {
2903
2937
  const l = i[s];
2904
2938
  if (l < s) continue;
@@ -2909,15 +2943,15 @@ class He {
2909
2943
  }
2910
2944
  renderPoints(t, e) {
2911
2945
  e === void 0 && (!t || typeof t.moveTo != "function") && (e = t, t = null), e = e == null ? 2 : +e;
2912
- const o = t == null ? t = new he() : void 0, { points: i } = this;
2946
+ const o = t == null ? t = new de() : void 0, { points: i } = this;
2913
2947
  for (let r = 0, s = i.length; r < s; r += 2) {
2914
2948
  const a = i[r], l = i[r + 1];
2915
- t.moveTo(a + e, l), t.arc(a, l, e, 0, Lo);
2949
+ t.moveTo(a + e, l), t.arc(a, l, e, 0, Wo);
2916
2950
  }
2917
2951
  return o && o.value();
2918
2952
  }
2919
2953
  renderHull(t) {
2920
- const e = t == null ? t = new he() : void 0, { hull: o, points: i } = this, r = o[0] * 2, s = o.length;
2954
+ const e = t == null ? t = new de() : void 0, { hull: o, points: i } = this, r = o[0] * 2, s = o.length;
2921
2955
  t.moveTo(i[r], i[r + 1]);
2922
2956
  for (let a = 1; a < s; ++a) {
2923
2957
  const l = 2 * o[a];
@@ -2926,11 +2960,11 @@ class He {
2926
2960
  return t.closePath(), e && e.value();
2927
2961
  }
2928
2962
  hullPolygon() {
2929
- const t = new qe();
2963
+ const t = new Ge();
2930
2964
  return this.renderHull(t), t.value();
2931
2965
  }
2932
2966
  renderTriangle(t, e) {
2933
- const o = e == null ? e = new he() : void 0, { points: i, triangles: r } = this, s = r[t *= 3] * 2, a = r[t + 1] * 2, l = r[t + 2] * 2;
2967
+ const o = e == null ? e = new de() : void 0, { points: i, triangles: r } = this, s = r[t *= 3] * 2, a = r[t + 1] * 2, l = r[t + 2] * 2;
2934
2968
  return e.moveTo(i[s], i[s + 1]), e.lineTo(i[a], i[a + 1]), e.lineTo(i[l], i[l + 1]), e.closePath(), o && o.value();
2935
2969
  }
2936
2970
  *trianglePolygons() {
@@ -2939,11 +2973,11 @@ class He {
2939
2973
  yield this.trianglePolygon(e);
2940
2974
  }
2941
2975
  trianglePolygon(t) {
2942
- const e = new qe();
2976
+ const e = new Ge();
2943
2977
  return this.renderTriangle(t, e), e.value();
2944
2978
  }
2945
2979
  }
2946
- function No(n, t, e, o) {
2980
+ function Yo(n, t, e, o) {
2947
2981
  const i = n.length, r = new Float64Array(i * 2);
2948
2982
  for (let s = 0; s < i; ++s) {
2949
2983
  const a = n[s];
@@ -2951,19 +2985,19 @@ function No(n, t, e, o) {
2951
2985
  }
2952
2986
  return r;
2953
2987
  }
2954
- function* qo(n, t, e, o) {
2988
+ function* $o(n, t, e, o) {
2955
2989
  let i = 0;
2956
2990
  for (const r of n)
2957
2991
  yield t.call(o, r, i, n), yield e.call(o, r, i, n), ++i;
2958
2992
  }
2959
- function Xo(n, t, e, o) {
2993
+ function Go(n, t, e, o) {
2960
2994
  return 1 + (n[t][0] === 0 || n[e][0] === 0 || n[o][0] === 0 ? 1 : 0);
2961
2995
  }
2962
- function Ho(n, t, e, o, i, r) {
2996
+ function jo(n, t, e, o, i, r) {
2963
2997
  const s = Math.hypot(e - i, o - r), a = Math.hypot(n - i, t - r), l = Math.hypot(n - e, t - o), c = Math.abs((e - n) * (r - t) - (i - n) * (o - t)) / 2;
2964
2998
  return c === 0 ? 1 / 0 : s * a * l / (4 * c);
2965
2999
  }
2966
- function rn(n) {
3000
+ function cn(n) {
2967
3001
  if (!n || n.length < 3) return [];
2968
3002
  const t = /* @__PURE__ */ new Set(), e = [];
2969
3003
  for (const w of n) {
@@ -2971,15 +3005,15 @@ function rn(n) {
2971
3005
  t.has(x) || (t.add(x), e.push(w));
2972
3006
  }
2973
3007
  if (e.length < 3) return [];
2974
- const o = new He(Float64Array.from(e.flat())), { triangles: i } = o;
3008
+ const o = new Ue(Float64Array.from(e.flat())), { triangles: i } = o;
2975
3009
  if (!i.length) return [];
2976
3010
  const r = /* @__PURE__ */ new Map(), s = (w, x) => w < x ? `${w}_${x}` : `${x}_${w}`;
2977
3011
  for (let w = 0; w < i.length; w += 3) {
2978
- const x = i[w], P = i[w + 1], M = i[w + 2], [m, d] = e[x], [p, b] = e[P], [V, v] = e[M], S = Ho(m, d, p, b, V, v), z = Xo(e, x, P, M);
3012
+ const x = i[w], P = i[w + 1], M = i[w + 2], [m, d] = e[x], [g, b] = e[P], [V, v] = e[M], S = jo(m, d, g, b, V, v), z = Go(e, x, P, M);
2979
3013
  if (S <= 1 / z)
2980
3014
  for (const [D, _] of [[x, P], [P, M], [M, x]]) {
2981
- const E = s(D, _);
2982
- r.set(E, (r.get(E) || 0) + 1);
3015
+ const T = s(D, _);
3016
+ r.set(T, (r.get(T) || 0) + 1);
2983
3017
  }
2984
3018
  }
2985
3019
  const a = [];
@@ -2989,32 +3023,32 @@ function rn(n) {
2989
3023
  for (const [w, x] of a)
2990
3024
  (l.get(w) || l.set(w, []).get(w)).push(x), (l.get(x) || l.set(x, []).get(x)).push(w);
2991
3025
  const c = a[0][0], h = [], f = /* @__PURE__ */ new Set();
2992
- let u = c, g = -1;
3026
+ let u = c, p = -1;
2993
3027
  do {
2994
3028
  h.push(e[u]), f.add(u);
2995
3029
  const w = l.get(u) || [];
2996
- let x = w.find((P) => P !== g && !f.has(P));
2997
- if (x === void 0 && (x = w.find((P) => P !== g)), x === void 0) break;
2998
- g = u, u = x;
3030
+ let x = w.find((P) => P !== p && !f.has(P));
3031
+ if (x === void 0 && (x = w.find((P) => P !== p)), x === void 0) break;
3032
+ p = u, u = x;
2999
3033
  } while (u !== c && h.length <= a.length + 1);
3000
3034
  return h;
3001
3035
  }
3002
3036
  const mt = {
3003
3037
  c: null,
3004
3038
  // center
3005
- u: [new Mt(), new Mt(), new Mt()],
3039
+ u: [new zt(), new zt(), new zt()],
3006
3040
  // basis vectors
3007
3041
  e: []
3008
3042
  // half width
3009
3043
  }, yt = {
3010
3044
  c: null,
3011
3045
  // center
3012
- u: [new Mt(), new Mt(), new Mt()],
3046
+ u: [new zt(), new zt(), new zt()],
3013
3047
  // basis vectors
3014
3048
  e: []
3015
3049
  // half width
3016
- }, Et = [[], [], []], et = [[], [], []], St = [], ae = new Mt(), le = new Mt(), ce = new Mt(), Ct = new Mt(), sn = new Mt(), an = new Mt(), Zt = new Sn(), ln = new Jn(), ve = new vn(), cn = new vn(), un = new to();
3017
- let Dn = class {
3050
+ }, It = [[], [], []], nt = [[], [], []], Dt = [], ce = new zt(), ue = new zt(), he = new zt(), Ot = new zt(), un = new zt(), hn = new zt(), Qt = new Tn(), fn = new oo(), _e = new En(), dn = new En(), mn = new ro();
3051
+ let An = class {
3018
3052
  /**
3019
3053
  * Constructs a new OBB.
3020
3054
  *
@@ -3022,7 +3056,7 @@ let Dn = class {
3022
3056
  * @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis.
3023
3057
  * @param {Matrix3} [rotation] - The rotation of the OBB.
3024
3058
  */
3025
- constructor(t = new Mt(), e = new Mt(), o = new Sn()) {
3059
+ constructor(t = new zt(), e = new zt(), o = new Tn()) {
3026
3060
  this.center = t, this.halfSize = e, this.rotation = o;
3027
3061
  }
3028
3062
  /**
@@ -3071,13 +3105,13 @@ let Dn = class {
3071
3105
  */
3072
3106
  clampPoint(t, e) {
3073
3107
  const o = this.halfSize;
3074
- Ct.subVectors(t, this.center), this.rotation.extractBasis(ae, le, ce), e.copy(this.center);
3075
- const i = ke.clamp(Ct.dot(ae), -o.x, o.x);
3076
- e.add(ae.multiplyScalar(i));
3077
- const r = ke.clamp(Ct.dot(le), -o.y, o.y);
3078
- e.add(le.multiplyScalar(r));
3079
- const s = ke.clamp(Ct.dot(ce), -o.z, o.z);
3080
- return e.add(ce.multiplyScalar(s)), e;
3108
+ Ot.subVectors(t, this.center), this.rotation.extractBasis(ce, ue, he), e.copy(this.center);
3109
+ const i = Oe.clamp(Ot.dot(ce), -o.x, o.x);
3110
+ e.add(ce.multiplyScalar(i));
3111
+ const r = Oe.clamp(Ot.dot(ue), -o.y, o.y);
3112
+ e.add(ue.multiplyScalar(r));
3113
+ const s = Oe.clamp(Ot.dot(he), -o.z, o.z);
3114
+ return e.add(he.multiplyScalar(s)), e;
3081
3115
  }
3082
3116
  /**
3083
3117
  * Returns `true` if the given point lies within this OBB.
@@ -3086,7 +3120,7 @@ let Dn = class {
3086
3120
  * @returns {boolean} - Whether the given point lies within this OBB or not.
3087
3121
  */
3088
3122
  containsPoint(t) {
3089
- return Ct.subVectors(t, this.center), this.rotation.extractBasis(ae, le, ce), Math.abs(Ct.dot(ae)) <= this.halfSize.x && Math.abs(Ct.dot(le)) <= this.halfSize.y && Math.abs(Ct.dot(ce)) <= this.halfSize.z;
3123
+ return Ot.subVectors(t, this.center), this.rotation.extractBasis(ce, ue, he), Math.abs(Ot.dot(ce)) <= this.halfSize.x && Math.abs(Ot.dot(ue)) <= this.halfSize.y && Math.abs(Ot.dot(he)) <= this.halfSize.z;
3090
3124
  }
3091
3125
  /**
3092
3126
  * Returns `true` if the given AABB intersects this OBB.
@@ -3095,7 +3129,7 @@ let Dn = class {
3095
3129
  * @returns {boolean} - Whether the given AABB intersects this OBB or not.
3096
3130
  */
3097
3131
  intersectsBox3(t) {
3098
- return this.intersectsOBB(Yo.fromBox3(t));
3132
+ return this.intersectsOBB(Uo.fromBox3(t));
3099
3133
  }
3100
3134
  /**
3101
3135
  * Returns `true` if the given bounding sphere intersects this OBB.
@@ -3104,7 +3138,7 @@ let Dn = class {
3104
3138
  * @returns {boolean} - Whether the given bounding sphere intersects this OBB or not.
3105
3139
  */
3106
3140
  intersectsSphere(t) {
3107
- return this.clampPoint(t.center, an), an.distanceToSquared(t.center) <= t.radius * t.radius;
3141
+ return this.clampPoint(t.center, hn), hn.distanceToSquared(t.center) <= t.radius * t.radius;
3108
3142
  }
3109
3143
  /**
3110
3144
  * Returns `true` if the given OBB intersects this OBB.
@@ -3117,17 +3151,17 @@ let Dn = class {
3117
3151
  mt.c = this.center, mt.e[0] = this.halfSize.x, mt.e[1] = this.halfSize.y, mt.e[2] = this.halfSize.z, this.rotation.extractBasis(mt.u[0], mt.u[1], mt.u[2]), yt.c = t.center, yt.e[0] = t.halfSize.x, yt.e[1] = t.halfSize.y, yt.e[2] = t.halfSize.z, t.rotation.extractBasis(yt.u[0], yt.u[1], yt.u[2]);
3118
3152
  for (let r = 0; r < 3; r++)
3119
3153
  for (let s = 0; s < 3; s++)
3120
- Et[r][s] = mt.u[r].dot(yt.u[s]);
3121
- Ct.subVectors(yt.c, mt.c), St[0] = Ct.dot(mt.u[0]), St[1] = Ct.dot(mt.u[1]), St[2] = Ct.dot(mt.u[2]);
3154
+ It[r][s] = mt.u[r].dot(yt.u[s]);
3155
+ Ot.subVectors(yt.c, mt.c), Dt[0] = Ot.dot(mt.u[0]), Dt[1] = Ot.dot(mt.u[1]), Dt[2] = Ot.dot(mt.u[2]);
3122
3156
  for (let r = 0; r < 3; r++)
3123
3157
  for (let s = 0; s < 3; s++)
3124
- et[r][s] = Math.abs(Et[r][s]) + e;
3158
+ nt[r][s] = Math.abs(It[r][s]) + e;
3125
3159
  let o, i;
3126
3160
  for (let r = 0; r < 3; r++)
3127
- if (o = mt.e[r], i = yt.e[0] * et[r][0] + yt.e[1] * et[r][1] + yt.e[2] * et[r][2], Math.abs(St[r]) > o + i) return !1;
3161
+ if (o = mt.e[r], i = yt.e[0] * nt[r][0] + yt.e[1] * nt[r][1] + yt.e[2] * nt[r][2], Math.abs(Dt[r]) > o + i) return !1;
3128
3162
  for (let r = 0; r < 3; r++)
3129
- if (o = mt.e[0] * et[0][r] + mt.e[1] * et[1][r] + mt.e[2] * et[2][r], i = yt.e[r], Math.abs(St[0] * Et[0][r] + St[1] * Et[1][r] + St[2] * Et[2][r]) > o + i) return !1;
3130
- return o = mt.e[1] * et[2][0] + mt.e[2] * et[1][0], i = yt.e[1] * et[0][2] + yt.e[2] * et[0][1], !(Math.abs(St[2] * Et[1][0] - St[1] * Et[2][0]) > o + i || (o = mt.e[1] * et[2][1] + mt.e[2] * et[1][1], i = yt.e[0] * et[0][2] + yt.e[2] * et[0][0], Math.abs(St[2] * Et[1][1] - St[1] * Et[2][1]) > o + i) || (o = mt.e[1] * et[2][2] + mt.e[2] * et[1][2], i = yt.e[0] * et[0][1] + yt.e[1] * et[0][0], Math.abs(St[2] * Et[1][2] - St[1] * Et[2][2]) > o + i) || (o = mt.e[0] * et[2][0] + mt.e[2] * et[0][0], i = yt.e[1] * et[1][2] + yt.e[2] * et[1][1], Math.abs(St[0] * Et[2][0] - St[2] * Et[0][0]) > o + i) || (o = mt.e[0] * et[2][1] + mt.e[2] * et[0][1], i = yt.e[0] * et[1][2] + yt.e[2] * et[1][0], Math.abs(St[0] * Et[2][1] - St[2] * Et[0][1]) > o + i) || (o = mt.e[0] * et[2][2] + mt.e[2] * et[0][2], i = yt.e[0] * et[1][1] + yt.e[1] * et[1][0], Math.abs(St[0] * Et[2][2] - St[2] * Et[0][2]) > o + i) || (o = mt.e[0] * et[1][0] + mt.e[1] * et[0][0], i = yt.e[1] * et[2][2] + yt.e[2] * et[2][1], Math.abs(St[1] * Et[0][0] - St[0] * Et[1][0]) > o + i) || (o = mt.e[0] * et[1][1] + mt.e[1] * et[0][1], i = yt.e[0] * et[2][2] + yt.e[2] * et[2][0], Math.abs(St[1] * Et[0][1] - St[0] * Et[1][1]) > o + i) || (o = mt.e[0] * et[1][2] + mt.e[1] * et[0][2], i = yt.e[0] * et[2][1] + yt.e[1] * et[2][0], Math.abs(St[1] * Et[0][2] - St[0] * Et[1][2]) > o + i));
3163
+ if (o = mt.e[0] * nt[0][r] + mt.e[1] * nt[1][r] + mt.e[2] * nt[2][r], i = yt.e[r], Math.abs(Dt[0] * It[0][r] + Dt[1] * It[1][r] + Dt[2] * It[2][r]) > o + i) return !1;
3164
+ return o = mt.e[1] * nt[2][0] + mt.e[2] * nt[1][0], i = yt.e[1] * nt[0][2] + yt.e[2] * nt[0][1], !(Math.abs(Dt[2] * It[1][0] - Dt[1] * It[2][0]) > o + i || (o = mt.e[1] * nt[2][1] + mt.e[2] * nt[1][1], i = yt.e[0] * nt[0][2] + yt.e[2] * nt[0][0], Math.abs(Dt[2] * It[1][1] - Dt[1] * It[2][1]) > o + i) || (o = mt.e[1] * nt[2][2] + mt.e[2] * nt[1][2], i = yt.e[0] * nt[0][1] + yt.e[1] * nt[0][0], Math.abs(Dt[2] * It[1][2] - Dt[1] * It[2][2]) > o + i) || (o = mt.e[0] * nt[2][0] + mt.e[2] * nt[0][0], i = yt.e[1] * nt[1][2] + yt.e[2] * nt[1][1], Math.abs(Dt[0] * It[2][0] - Dt[2] * It[0][0]) > o + i) || (o = mt.e[0] * nt[2][1] + mt.e[2] * nt[0][1], i = yt.e[0] * nt[1][2] + yt.e[2] * nt[1][0], Math.abs(Dt[0] * It[2][1] - Dt[2] * It[0][1]) > o + i) || (o = mt.e[0] * nt[2][2] + mt.e[2] * nt[0][2], i = yt.e[0] * nt[1][1] + yt.e[1] * nt[1][0], Math.abs(Dt[0] * It[2][2] - Dt[2] * It[0][2]) > o + i) || (o = mt.e[0] * nt[1][0] + mt.e[1] * nt[0][0], i = yt.e[1] * nt[2][2] + yt.e[2] * nt[2][1], Math.abs(Dt[1] * It[0][0] - Dt[0] * It[1][0]) > o + i) || (o = mt.e[0] * nt[1][1] + mt.e[1] * nt[0][1], i = yt.e[0] * nt[2][2] + yt.e[2] * nt[2][0], Math.abs(Dt[1] * It[0][1] - Dt[0] * It[1][1]) > o + i) || (o = mt.e[0] * nt[1][2] + mt.e[1] * nt[0][2], i = yt.e[0] * nt[2][1] + yt.e[1] * nt[2][0], Math.abs(Dt[1] * It[0][2] - Dt[0] * It[1][2]) > o + i));
3131
3165
  }
3132
3166
  /**
3133
3167
  * Returns `true` if the given plane intersects this OBB.
@@ -3136,8 +3170,8 @@ let Dn = class {
3136
3170
  * @returns {boolean} Whether the given plane intersects this OBB or not.
3137
3171
  */
3138
3172
  intersectsPlane(t) {
3139
- this.rotation.extractBasis(ae, le, ce);
3140
- const e = this.halfSize.x * Math.abs(t.normal.dot(ae)) + this.halfSize.y * Math.abs(t.normal.dot(le)) + this.halfSize.z * Math.abs(t.normal.dot(ce)), o = t.normal.dot(this.center) - t.constant;
3173
+ this.rotation.extractBasis(ce, ue, he);
3174
+ const e = this.halfSize.x * Math.abs(t.normal.dot(ce)) + this.halfSize.y * Math.abs(t.normal.dot(ue)) + this.halfSize.z * Math.abs(t.normal.dot(he)), o = t.normal.dot(this.center) - t.constant;
3141
3175
  return Math.abs(o) <= e;
3142
3176
  }
3143
3177
  /**
@@ -3149,7 +3183,7 @@ let Dn = class {
3149
3183
  * @return {?Vector3} The intersection point. If no intersection is detected, `null` is returned.
3150
3184
  */
3151
3185
  intersectRay(t, e) {
3152
- return this.getSize(sn), ln.setFromCenterAndSize(Ct.set(0, 0, 0), sn), ve.setFromMatrix3(this.rotation), ve.setPosition(this.center), cn.copy(ve).invert(), un.copy(t).applyMatrix4(cn), un.intersectBox(ln, e) ? e.applyMatrix4(ve) : null;
3186
+ return this.getSize(un), fn.setFromCenterAndSize(Ot.set(0, 0, 0), un), _e.setFromMatrix3(this.rotation), _e.setPosition(this.center), dn.copy(_e).invert(), mn.copy(t).applyMatrix4(dn), mn.intersectBox(fn, e) ? e.applyMatrix4(_e) : null;
3153
3187
  }
3154
3188
  /**
3155
3189
  * Returns `true` if the given ray intersects this OBB.
@@ -3158,7 +3192,7 @@ let Dn = class {
3158
3192
  * @returns {boolean} Whether the given ray intersects this OBB or not.
3159
3193
  */
3160
3194
  intersectsRay(t) {
3161
- return this.intersectRay(t, Ct) !== null;
3195
+ return this.intersectRay(t, Ot) !== null;
3162
3196
  }
3163
3197
  /**
3164
3198
  * Defines an OBB based on the given AABB.
@@ -3188,50 +3222,50 @@ let Dn = class {
3188
3222
  */
3189
3223
  applyMatrix4(t) {
3190
3224
  const e = t.elements;
3191
- let o = Ct.set(e[0], e[1], e[2]).length();
3192
- const i = Ct.set(e[4], e[5], e[6]).length(), r = Ct.set(e[8], e[9], e[10]).length();
3193
- t.determinant() < 0 && (o = -o), Zt.setFromMatrix4(t);
3225
+ let o = Ot.set(e[0], e[1], e[2]).length();
3226
+ const i = Ot.set(e[4], e[5], e[6]).length(), r = Ot.set(e[8], e[9], e[10]).length();
3227
+ t.determinant() < 0 && (o = -o), Qt.setFromMatrix4(t);
3194
3228
  const a = 1 / o, l = 1 / i, c = 1 / r;
3195
- return Zt.elements[0] *= a, Zt.elements[1] *= a, Zt.elements[2] *= a, Zt.elements[3] *= l, Zt.elements[4] *= l, Zt.elements[5] *= l, Zt.elements[6] *= c, Zt.elements[7] *= c, Zt.elements[8] *= c, this.rotation.multiply(Zt), this.halfSize.x *= o, this.halfSize.y *= i, this.halfSize.z *= r, Ct.setFromMatrixPosition(t), this.center.add(Ct), this;
3229
+ return Qt.elements[0] *= a, Qt.elements[1] *= a, Qt.elements[2] *= a, Qt.elements[3] *= l, Qt.elements[4] *= l, Qt.elements[5] *= l, Qt.elements[6] *= c, Qt.elements[7] *= c, Qt.elements[8] *= c, this.rotation.multiply(Qt), this.halfSize.x *= o, this.halfSize.y *= i, this.halfSize.z *= r, Ot.setFromMatrixPosition(t), this.center.add(Ot), this;
3196
3230
  }
3197
3231
  };
3198
- const Yo = new Dn();
3199
- var qt = 63710088e-1, _n = {
3200
- centimeters: qt * 100,
3201
- centimetres: qt * 100,
3232
+ const Uo = new An();
3233
+ var Yt = 63710088e-1, Bn = {
3234
+ centimeters: Yt * 100,
3235
+ centimetres: Yt * 100,
3202
3236
  degrees: 360 / (2 * Math.PI),
3203
- feet: qt * 3.28084,
3204
- inches: qt * 39.37,
3205
- kilometers: qt / 1e3,
3206
- kilometres: qt / 1e3,
3207
- meters: qt,
3208
- metres: qt,
3209
- miles: qt / 1609.344,
3210
- millimeters: qt * 1e3,
3211
- millimetres: qt * 1e3,
3212
- nauticalmiles: qt / 1852,
3237
+ feet: Yt * 3.28084,
3238
+ inches: Yt * 39.37,
3239
+ kilometers: Yt / 1e3,
3240
+ kilometres: Yt / 1e3,
3241
+ meters: Yt,
3242
+ metres: Yt,
3243
+ miles: Yt / 1609.344,
3244
+ millimeters: Yt * 1e3,
3245
+ millimetres: Yt * 1e3,
3246
+ nauticalmiles: Yt / 1852,
3213
3247
  radians: 1,
3214
- yards: qt * 1.0936
3248
+ yards: Yt * 1.0936
3215
3249
  };
3216
- function En(n, t, e = {}) {
3250
+ function In(n, t, e = {}) {
3217
3251
  const o = { type: "Feature" };
3218
3252
  return (e.id === 0 || e.id) && (o.id = e.id), e.bbox && (o.bbox = e.bbox), o.properties = t || {}, o.geometry = n, o;
3219
3253
  }
3220
- function Tn(n, t, e = {}) {
3254
+ function kn(n, t, e = {}) {
3221
3255
  if (!n)
3222
3256
  throw new Error("coordinates is required");
3223
3257
  if (!Array.isArray(n))
3224
3258
  throw new Error("coordinates must be an Array");
3225
3259
  if (n.length < 2)
3226
3260
  throw new Error("coordinates must be at least 2 numbers long");
3227
- if (!hn(n[0]) || !hn(n[1]))
3261
+ if (!gn(n[0]) || !gn(n[1]))
3228
3262
  throw new Error("coordinates must contain numbers");
3229
- return En({
3263
+ return In({
3230
3264
  type: "Point",
3231
3265
  coordinates: n
3232
3266
  }, t, e);
3233
3267
  }
3234
- function An(n, t, e = {}) {
3268
+ function Cn(n, t, e = {}) {
3235
3269
  for (const i of n) {
3236
3270
  if (i.length < 4)
3237
3271
  throw new Error(
@@ -3243,43 +3277,43 @@ function An(n, t, e = {}) {
3243
3277
  if (i[i.length - 1][r] !== i[0][r])
3244
3278
  throw new Error("First and last Position are not equivalent.");
3245
3279
  }
3246
- return En({
3280
+ return In({
3247
3281
  type: "Polygon",
3248
3282
  coordinates: n
3249
3283
  }, t, e);
3250
3284
  }
3251
- function $o(n, t = "kilometers") {
3252
- const e = _n[t];
3285
+ function Zo(n, t = "kilometers") {
3286
+ const e = Bn[t];
3253
3287
  if (!e)
3254
3288
  throw new Error(t + " units is invalid");
3255
3289
  return n * e;
3256
3290
  }
3257
- function Go(n, t = "kilometers") {
3258
- const e = _n[t];
3291
+ function Ko(n, t = "kilometers") {
3292
+ const e = Bn[t];
3259
3293
  if (!e)
3260
3294
  throw new Error(t + " units is invalid");
3261
3295
  return n / e;
3262
3296
  }
3263
- function Bn(n) {
3297
+ function Rn(n) {
3264
3298
  return n % (2 * Math.PI) * 180 / Math.PI;
3265
3299
  }
3266
- function ne(n) {
3300
+ function ie(n) {
3267
3301
  return n % 360 * Math.PI / 180;
3268
3302
  }
3269
- function In(n, t = "kilometers", e = "kilometers") {
3303
+ function Ln(n, t = "kilometers", e = "kilometers") {
3270
3304
  if (!(n >= 0))
3271
3305
  throw new Error("length must be a positive number");
3272
- return $o(Go(n, t), e);
3306
+ return Zo(Ko(n, t), e);
3273
3307
  }
3274
- function hn(n) {
3308
+ function gn(n) {
3275
3309
  return !isNaN(n) && n !== null && !Array.isArray(n);
3276
3310
  }
3277
- function jo(n) {
3311
+ function Qo(n) {
3278
3312
  return n !== null && typeof n == "object" && !Array.isArray(n);
3279
3313
  }
3280
- function we(n, t, e) {
3314
+ function Pe(n, t, e) {
3281
3315
  if (n !== null)
3282
- for (var o, i, r, s, a, l, c, h = 0, f = 0, u, g = n.type, w = g === "FeatureCollection", x = g === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
3316
+ for (var o, i, r, s, a, l, c, h = 0, f = 0, u, p = n.type, w = p === "FeatureCollection", x = p === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
3283
3317
  c = w ? (
3284
3318
  // @ts-expect-error: Known type conflict
3285
3319
  n.features[M].geometry
@@ -3288,7 +3322,7 @@ function we(n, t, e) {
3288
3322
  n.geometry
3289
3323
  ) : n, u = c ? c.type === "GeometryCollection" : !1, a = u ? c.geometries.length : 1;
3290
3324
  for (var m = 0; m < a; m++) {
3291
- var d = 0, p = 0;
3325
+ var d = 0, g = 0;
3292
3326
  if (s = u ? c.geometries[m] : c, s !== null) {
3293
3327
  l = s.coordinates;
3294
3328
  var b = s.type;
@@ -3303,7 +3337,7 @@ function we(n, t, e) {
3303
3337
  f,
3304
3338
  M,
3305
3339
  d,
3306
- p
3340
+ g
3307
3341
  ) === !1
3308
3342
  )
3309
3343
  return !1;
@@ -3319,7 +3353,7 @@ function we(n, t, e) {
3319
3353
  f,
3320
3354
  M,
3321
3355
  d,
3322
- p
3356
+ g
3323
3357
  ) === !1
3324
3358
  )
3325
3359
  return !1;
@@ -3338,19 +3372,19 @@ function we(n, t, e) {
3338
3372
  f,
3339
3373
  M,
3340
3374
  d,
3341
- p
3375
+ g
3342
3376
  ) === !1
3343
3377
  )
3344
3378
  return !1;
3345
3379
  f++;
3346
3380
  }
3347
- b === "MultiLineString" && d++, b === "Polygon" && p++;
3381
+ b === "MultiLineString" && d++, b === "Polygon" && g++;
3348
3382
  }
3349
3383
  b === "Polygon" && d++;
3350
3384
  break;
3351
3385
  case "MultiPolygon":
3352
3386
  for (o = 0; o < l.length; o++) {
3353
- for (p = 0, i = 0; i < l[o].length; i++) {
3387
+ for (g = 0, i = 0; i < l[o].length; i++) {
3354
3388
  for (r = 0; r < l[o][i].length - h; r++) {
3355
3389
  if (
3356
3390
  // @ts-expect-error: Known type conflict
@@ -3359,13 +3393,13 @@ function we(n, t, e) {
3359
3393
  f,
3360
3394
  M,
3361
3395
  d,
3362
- p
3396
+ g
3363
3397
  ) === !1
3364
3398
  )
3365
3399
  return !1;
3366
3400
  f++;
3367
3401
  }
3368
- p++;
3402
+ g++;
3369
3403
  }
3370
3404
  d++;
3371
3405
  }
@@ -3374,7 +3408,7 @@ function we(n, t, e) {
3374
3408
  for (o = 0; o < s.geometries.length; o++)
3375
3409
  if (
3376
3410
  // @ts-expect-error: Known type conflict
3377
- we(s.geometries[o], t, e) === !1
3411
+ Pe(s.geometries[o], t, e) === !1
3378
3412
  )
3379
3413
  return !1;
3380
3414
  break;
@@ -3385,34 +3419,34 @@ function we(n, t, e) {
3385
3419
  }
3386
3420
  }
3387
3421
  }
3388
- function Uo(n) {
3422
+ function Jo(n) {
3389
3423
  var t = [];
3390
- return we(n, function(e) {
3424
+ return Pe(n, function(e) {
3391
3425
  t.push(e);
3392
3426
  }), t;
3393
3427
  }
3394
- function Zo(n, t) {
3395
- var e, o, i, r, s, a, l, c, h, f, u = 0, g = n.type === "FeatureCollection", w = n.type === "Feature", x = g ? n.features.length : 1;
3428
+ function tr(n, t) {
3429
+ var e, o, i, r, s, a, l, c, h, f, u = 0, p = n.type === "FeatureCollection", w = n.type === "Feature", x = p ? n.features.length : 1;
3396
3430
  for (e = 0; e < x; e++) {
3397
- for (a = g ? (
3431
+ for (a = p ? (
3398
3432
  // @ts-expect-error: Known type conflict
3399
3433
  n.features[e].geometry
3400
3434
  ) : w ? (
3401
3435
  // @ts-expect-error: Known type conflict
3402
3436
  n.geometry
3403
- ) : n, c = g ? (
3437
+ ) : n, c = p ? (
3404
3438
  // @ts-expect-error: Known type conflict
3405
3439
  n.features[e].properties
3406
3440
  ) : w ? (
3407
3441
  // @ts-expect-error: Known type conflict
3408
3442
  n.properties
3409
- ) : {}, h = g ? (
3443
+ ) : {}, h = p ? (
3410
3444
  // @ts-expect-error: Known type conflict
3411
3445
  n.features[e].bbox
3412
3446
  ) : w ? (
3413
3447
  // @ts-expect-error: Known type conflict
3414
3448
  n.bbox
3415
- ) : void 0, f = g ? (
3449
+ ) : void 0, f = p ? (
3416
3450
  // @ts-expect-error: Known type conflict
3417
3451
  n.features[e].id
3418
3452
  ) : w ? (
@@ -3476,9 +3510,9 @@ function Zo(n, t) {
3476
3510
  u++;
3477
3511
  }
3478
3512
  }
3479
- function Ko(n, t, e) {
3513
+ function er(n, t, e) {
3480
3514
  var o = e;
3481
- return Zo(
3515
+ return tr(
3482
3516
  n,
3483
3517
  function(i, r, s, a, l) {
3484
3518
  r === 0 && e === void 0 ? o = i : o = t(
@@ -3493,11 +3527,11 @@ function Ko(n, t, e) {
3493
3527
  }
3494
3528
  ), o;
3495
3529
  }
3496
- var kn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3497
- function Qo(n) {
3530
+ var Fn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3531
+ function nr(n) {
3498
3532
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
3499
3533
  }
3500
- function Jo(n) {
3534
+ function or(n) {
3501
3535
  if (n.__esModule) return n;
3502
3536
  var t = n.default;
3503
3537
  if (typeof t == "function") {
@@ -3516,30 +3550,30 @@ function Jo(n) {
3516
3550
  });
3517
3551
  }), e;
3518
3552
  }
3519
- var Ye = { exports: {} }, Cn = { exports: {} };
3553
+ var Ze = { exports: {} }, On = { exports: {} };
3520
3554
  (function(n, t) {
3521
3555
  (function(e, o) {
3522
3556
  n.exports = o();
3523
- })(kn, function() {
3524
- function e(m, d, p, b, V) {
3525
- (function v(S, z, D, _, E) {
3557
+ })(Fn, function() {
3558
+ function e(m, d, g, b, V) {
3559
+ (function v(S, z, D, _, T) {
3526
3560
  for (; _ > D; ) {
3527
3561
  if (_ - D > 600) {
3528
- var T = _ - D + 1, A = z - D + 1, O = Math.log(T), I = 0.5 * Math.exp(2 * O / 3), B = 0.5 * Math.sqrt(O * I * (T - I) / T) * (A - T / 2 < 0 ? -1 : 1), L = Math.max(D, Math.floor(z - A * I / T + B)), W = Math.min(_, Math.floor(z + (T - A) * I / T + B));
3529
- v(S, z, L, W, E);
3562
+ var E = _ - D + 1, A = z - D + 1, O = Math.log(E), I = 0.5 * Math.exp(2 * O / 3), B = 0.5 * Math.sqrt(O * I * (E - I) / E) * (A - E / 2 < 0 ? -1 : 1), R = Math.max(D, Math.floor(z - A * I / E + B)), W = Math.min(_, Math.floor(z + (E - A) * I / E + B));
3563
+ v(S, z, R, W, T);
3530
3564
  }
3531
- var C = S[z], R = D, H = _;
3532
- for (o(S, D, z), E(S[_], C) > 0 && o(S, D, _); R < H; ) {
3533
- for (o(S, R, H), R++, H--; E(S[R], C) < 0; ) R++;
3534
- for (; E(S[H], C) > 0; ) H--;
3565
+ var C = S[z], L = D, H = _;
3566
+ for (o(S, D, z), T(S[_], C) > 0 && o(S, D, _); L < H; ) {
3567
+ for (o(S, L, H), L++, H--; T(S[L], C) < 0; ) L++;
3568
+ for (; T(S[H], C) > 0; ) H--;
3535
3569
  }
3536
- E(S[D], C) === 0 ? o(S, D, H) : o(S, ++H, _), H <= z && (D = H + 1), z <= H && (_ = H - 1);
3570
+ T(S[D], C) === 0 ? o(S, D, H) : o(S, ++H, _), H <= z && (D = H + 1), z <= H && (_ = H - 1);
3537
3571
  }
3538
- })(m, d, p || 0, b || m.length - 1, V || i);
3572
+ })(m, d, g || 0, b || m.length - 1, V || i);
3539
3573
  }
3540
- function o(m, d, p) {
3574
+ function o(m, d, g) {
3541
3575
  var b = m[d];
3542
- m[d] = m[p], m[p] = b;
3576
+ m[d] = m[g], m[g] = b;
3543
3577
  }
3544
3578
  function i(m, d) {
3545
3579
  return m < d ? -1 : m > d ? 1 : 0;
@@ -3547,17 +3581,17 @@ var Ye = { exports: {} }, Cn = { exports: {} };
3547
3581
  var r = function(m) {
3548
3582
  m === void 0 && (m = 9), this._maxEntries = Math.max(4, m), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
3549
3583
  };
3550
- function s(m, d, p) {
3551
- if (!p) return d.indexOf(m);
3552
- for (var b = 0; b < d.length; b++) if (p(m, d[b])) return b;
3584
+ function s(m, d, g) {
3585
+ if (!g) return d.indexOf(m);
3586
+ for (var b = 0; b < d.length; b++) if (g(m, d[b])) return b;
3553
3587
  return -1;
3554
3588
  }
3555
3589
  function a(m, d) {
3556
3590
  l(m, 0, m.children.length, d, m);
3557
3591
  }
3558
- function l(m, d, p, b, V) {
3592
+ function l(m, d, g, b, V) {
3559
3593
  V || (V = P(null)), V.minX = 1 / 0, V.minY = 1 / 0, V.maxX = -1 / 0, V.maxY = -1 / 0;
3560
- for (var v = d; v < p; v++) {
3594
+ for (var v = d; v < g; v++) {
3561
3595
  var S = m.children[v];
3562
3596
  c(V, m.leaf ? b(S) : S);
3563
3597
  }
@@ -3575,7 +3609,7 @@ var Ye = { exports: {} }, Cn = { exports: {} };
3575
3609
  function u(m) {
3576
3610
  return (m.maxX - m.minX) * (m.maxY - m.minY);
3577
3611
  }
3578
- function g(m) {
3612
+ function p(m) {
3579
3613
  return m.maxX - m.minX + (m.maxY - m.minY);
3580
3614
  }
3581
3615
  function w(m, d) {
@@ -3587,37 +3621,37 @@ var Ye = { exports: {} }, Cn = { exports: {} };
3587
3621
  function P(m) {
3588
3622
  return { children: m, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
3589
3623
  }
3590
- function M(m, d, p, b, V) {
3591
- for (var v = [d, p]; v.length; ) if (!((p = v.pop()) - (d = v.pop()) <= b)) {
3592
- var S = d + Math.ceil((p - d) / b / 2) * b;
3593
- e(m, S, d, p, V), v.push(d, S, S, p);
3624
+ function M(m, d, g, b, V) {
3625
+ for (var v = [d, g]; v.length; ) if (!((g = v.pop()) - (d = v.pop()) <= b)) {
3626
+ var S = d + Math.ceil((g - d) / b / 2) * b;
3627
+ e(m, S, d, g, V), v.push(d, S, S, g);
3594
3628
  }
3595
3629
  }
3596
3630
  return r.prototype.all = function() {
3597
3631
  return this._all(this.data, []);
3598
3632
  }, r.prototype.search = function(m) {
3599
- var d = this.data, p = [];
3600
- if (!x(m, d)) return p;
3633
+ var d = this.data, g = [];
3634
+ if (!x(m, d)) return g;
3601
3635
  for (var b = this.toBBox, V = []; d; ) {
3602
3636
  for (var v = 0; v < d.children.length; v++) {
3603
3637
  var S = d.children[v], z = d.leaf ? b(S) : S;
3604
- x(m, z) && (d.leaf ? p.push(S) : w(m, z) ? this._all(S, p) : V.push(S));
3638
+ x(m, z) && (d.leaf ? g.push(S) : w(m, z) ? this._all(S, g) : V.push(S));
3605
3639
  }
3606
3640
  d = V.pop();
3607
3641
  }
3608
- return p;
3642
+ return g;
3609
3643
  }, r.prototype.collides = function(m) {
3610
3644
  var d = this.data;
3611
3645
  if (!x(m, d)) return !1;
3612
- for (var p = []; d; ) {
3646
+ for (var g = []; d; ) {
3613
3647
  for (var b = 0; b < d.children.length; b++) {
3614
3648
  var V = d.children[b], v = d.leaf ? this.toBBox(V) : V;
3615
3649
  if (x(m, v)) {
3616
3650
  if (d.leaf || w(m, v)) return !0;
3617
- p.push(V);
3651
+ g.push(V);
3618
3652
  }
3619
3653
  }
3620
- d = p.pop();
3654
+ d = g.pop();
3621
3655
  }
3622
3656
  return !1;
3623
3657
  }, r.prototype.load = function(m) {
@@ -3626,16 +3660,16 @@ var Ye = { exports: {} }, Cn = { exports: {} };
3626
3660
  for (var d = 0; d < m.length; d++) this.insert(m[d]);
3627
3661
  return this;
3628
3662
  }
3629
- var p = this._build(m.slice(), 0, m.length - 1, 0);
3630
- if (this.data.children.length) if (this.data.height === p.height) this._splitRoot(this.data, p);
3663
+ var g = this._build(m.slice(), 0, m.length - 1, 0);
3664
+ if (this.data.children.length) if (this.data.height === g.height) this._splitRoot(this.data, g);
3631
3665
  else {
3632
- if (this.data.height < p.height) {
3666
+ if (this.data.height < g.height) {
3633
3667
  var b = this.data;
3634
- this.data = p, p = b;
3668
+ this.data = g, g = b;
3635
3669
  }
3636
- this._insert(p, this.data.height - p.height - 1, !0);
3670
+ this._insert(g, this.data.height - g.height - 1, !0);
3637
3671
  }
3638
- else this.data = p;
3672
+ else this.data = g;
3639
3673
  return this;
3640
3674
  }, r.prototype.insert = function(m) {
3641
3675
  return m && this._insert(m, this.data.height - 1), this;
@@ -3643,12 +3677,12 @@ var Ye = { exports: {} }, Cn = { exports: {} };
3643
3677
  return this.data = P([]), this;
3644
3678
  }, r.prototype.remove = function(m, d) {
3645
3679
  if (!m) return this;
3646
- for (var p, b, V, v = this.data, S = this.toBBox(m), z = [], D = []; v || z.length; ) {
3647
- if (v || (v = z.pop(), b = z[z.length - 1], p = D.pop(), V = !0), v.leaf) {
3680
+ for (var g, b, V, v = this.data, S = this.toBBox(m), z = [], D = []; v || z.length; ) {
3681
+ if (v || (v = z.pop(), b = z[z.length - 1], g = D.pop(), V = !0), v.leaf) {
3648
3682
  var _ = s(m, v.children, d);
3649
3683
  if (_ !== -1) return v.children.splice(_, 1), z.push(v), this._condense(z), this;
3650
3684
  }
3651
- V || v.leaf || !w(v, S) ? b ? (p++, v = b.children[p], V = !1) : v = null : (z.push(v), D.push(p), p = 0, b = v, v = v.children[0]);
3685
+ V || v.leaf || !w(v, S) ? b ? (g++, v = b.children[g], V = !1) : v = null : (z.push(v), D.push(g), g = 0, b = v, v = v.children[0]);
3652
3686
  }
3653
3687
  return this;
3654
3688
  }, r.prototype.toBBox = function(m) {
@@ -3662,74 +3696,74 @@ var Ye = { exports: {} }, Cn = { exports: {} };
3662
3696
  }, r.prototype.fromJSON = function(m) {
3663
3697
  return this.data = m, this;
3664
3698
  }, r.prototype._all = function(m, d) {
3665
- for (var p = []; m; ) m.leaf ? d.push.apply(d, m.children) : p.push.apply(p, m.children), m = p.pop();
3699
+ for (var g = []; m; ) m.leaf ? d.push.apply(d, m.children) : g.push.apply(g, m.children), m = g.pop();
3666
3700
  return d;
3667
- }, r.prototype._build = function(m, d, p, b) {
3668
- var V, v = p - d + 1, S = this._maxEntries;
3669
- if (v <= S) return a(V = P(m.slice(d, p + 1)), this.toBBox), V;
3701
+ }, r.prototype._build = function(m, d, g, b) {
3702
+ var V, v = g - d + 1, S = this._maxEntries;
3703
+ if (v <= S) return a(V = P(m.slice(d, g + 1)), this.toBBox), V;
3670
3704
  b || (b = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, b - 1))), (V = P([])).leaf = !1, V.height = b;
3671
3705
  var z = Math.ceil(v / S), D = z * Math.ceil(Math.sqrt(S));
3672
- M(m, d, p, D, this.compareMinX);
3673
- for (var _ = d; _ <= p; _ += D) {
3674
- var E = Math.min(_ + D - 1, p);
3675
- M(m, _, E, z, this.compareMinY);
3676
- for (var T = _; T <= E; T += z) {
3677
- var A = Math.min(T + z - 1, E);
3678
- V.children.push(this._build(m, T, A, b - 1));
3706
+ M(m, d, g, D, this.compareMinX);
3707
+ for (var _ = d; _ <= g; _ += D) {
3708
+ var T = Math.min(_ + D - 1, g);
3709
+ M(m, _, T, z, this.compareMinY);
3710
+ for (var E = _; E <= T; E += z) {
3711
+ var A = Math.min(E + z - 1, T);
3712
+ V.children.push(this._build(m, E, A, b - 1));
3679
3713
  }
3680
3714
  }
3681
3715
  return a(V, this.toBBox), V;
3682
- }, r.prototype._chooseSubtree = function(m, d, p, b) {
3683
- for (; b.push(d), !d.leaf && b.length - 1 !== p; ) {
3716
+ }, r.prototype._chooseSubtree = function(m, d, g, b) {
3717
+ for (; b.push(d), !d.leaf && b.length - 1 !== g; ) {
3684
3718
  for (var V = 1 / 0, v = 1 / 0, S = void 0, z = 0; z < d.children.length; z++) {
3685
- var D = d.children[z], _ = u(D), E = (T = m, A = D, (Math.max(A.maxX, T.maxX) - Math.min(A.minX, T.minX)) * (Math.max(A.maxY, T.maxY) - Math.min(A.minY, T.minY)) - _);
3686
- E < v ? (v = E, V = _ < V ? _ : V, S = D) : E === v && _ < V && (V = _, S = D);
3719
+ var D = d.children[z], _ = u(D), T = (E = m, A = D, (Math.max(A.maxX, E.maxX) - Math.min(A.minX, E.minX)) * (Math.max(A.maxY, E.maxY) - Math.min(A.minY, E.minY)) - _);
3720
+ T < v ? (v = T, V = _ < V ? _ : V, S = D) : T === v && _ < V && (V = _, S = D);
3687
3721
  }
3688
3722
  d = S || d.children[0];
3689
3723
  }
3690
- var T, A;
3724
+ var E, A;
3691
3725
  return d;
3692
- }, r.prototype._insert = function(m, d, p) {
3693
- var b = p ? m : this.toBBox(m), V = [], v = this._chooseSubtree(b, this.data, d, V);
3726
+ }, r.prototype._insert = function(m, d, g) {
3727
+ var b = g ? m : this.toBBox(m), V = [], v = this._chooseSubtree(b, this.data, d, V);
3694
3728
  for (v.children.push(m), c(v, b); d >= 0 && V[d].children.length > this._maxEntries; ) this._split(V, d), d--;
3695
3729
  this._adjustParentBBoxes(b, V, d);
3696
3730
  }, r.prototype._split = function(m, d) {
3697
- var p = m[d], b = p.children.length, V = this._minEntries;
3698
- this._chooseSplitAxis(p, V, b);
3699
- var v = this._chooseSplitIndex(p, V, b), S = P(p.children.splice(v, p.children.length - v));
3700
- S.height = p.height, S.leaf = p.leaf, a(p, this.toBBox), a(S, this.toBBox), d ? m[d - 1].children.push(S) : this._splitRoot(p, S);
3731
+ var g = m[d], b = g.children.length, V = this._minEntries;
3732
+ this._chooseSplitAxis(g, V, b);
3733
+ var v = this._chooseSplitIndex(g, V, b), S = P(g.children.splice(v, g.children.length - v));
3734
+ S.height = g.height, S.leaf = g.leaf, a(g, this.toBBox), a(S, this.toBBox), d ? m[d - 1].children.push(S) : this._splitRoot(g, S);
3701
3735
  }, r.prototype._splitRoot = function(m, d) {
3702
3736
  this.data = P([m, d]), this.data.height = m.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
3703
- }, r.prototype._chooseSplitIndex = function(m, d, p) {
3704
- for (var b, V, v, S, z, D, _, E = 1 / 0, T = 1 / 0, A = d; A <= p - d; A++) {
3705
- var O = l(m, 0, A, this.toBBox), I = l(m, A, p, this.toBBox), B = (V = O, v = I, S = void 0, z = void 0, D = void 0, _ = void 0, S = Math.max(V.minX, v.minX), z = Math.max(V.minY, v.minY), D = Math.min(V.maxX, v.maxX), _ = Math.min(V.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - z)), L = u(O) + u(I);
3706
- B < E ? (E = B, b = A, T = L < T ? L : T) : B === E && L < T && (T = L, b = A);
3737
+ }, r.prototype._chooseSplitIndex = function(m, d, g) {
3738
+ for (var b, V, v, S, z, D, _, T = 1 / 0, E = 1 / 0, A = d; A <= g - d; A++) {
3739
+ var O = l(m, 0, A, this.toBBox), I = l(m, A, g, this.toBBox), B = (V = O, v = I, S = void 0, z = void 0, D = void 0, _ = void 0, S = Math.max(V.minX, v.minX), z = Math.max(V.minY, v.minY), D = Math.min(V.maxX, v.maxX), _ = Math.min(V.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - z)), R = u(O) + u(I);
3740
+ B < T ? (T = B, b = A, E = R < E ? R : E) : B === T && R < E && (E = R, b = A);
3707
3741
  }
3708
- return b || p - d;
3709
- }, r.prototype._chooseSplitAxis = function(m, d, p) {
3742
+ return b || g - d;
3743
+ }, r.prototype._chooseSplitAxis = function(m, d, g) {
3710
3744
  var b = m.leaf ? this.compareMinX : h, V = m.leaf ? this.compareMinY : f;
3711
- this._allDistMargin(m, d, p, b) < this._allDistMargin(m, d, p, V) && m.children.sort(b);
3712
- }, r.prototype._allDistMargin = function(m, d, p, b) {
3745
+ this._allDistMargin(m, d, g, b) < this._allDistMargin(m, d, g, V) && m.children.sort(b);
3746
+ }, r.prototype._allDistMargin = function(m, d, g, b) {
3713
3747
  m.children.sort(b);
3714
- for (var V = this.toBBox, v = l(m, 0, d, V), S = l(m, p - d, p, V), z = g(v) + g(S), D = d; D < p - d; D++) {
3748
+ for (var V = this.toBBox, v = l(m, 0, d, V), S = l(m, g - d, g, V), z = p(v) + p(S), D = d; D < g - d; D++) {
3715
3749
  var _ = m.children[D];
3716
- c(v, m.leaf ? V(_) : _), z += g(v);
3750
+ c(v, m.leaf ? V(_) : _), z += p(v);
3717
3751
  }
3718
- for (var E = p - d - 1; E >= d; E--) {
3719
- var T = m.children[E];
3720
- c(S, m.leaf ? V(T) : T), z += g(S);
3752
+ for (var T = g - d - 1; T >= d; T--) {
3753
+ var E = m.children[T];
3754
+ c(S, m.leaf ? V(E) : E), z += p(S);
3721
3755
  }
3722
3756
  return z;
3723
- }, r.prototype._adjustParentBBoxes = function(m, d, p) {
3724
- for (var b = p; b >= 0; b--) c(d[b], m);
3757
+ }, r.prototype._adjustParentBBoxes = function(m, d, g) {
3758
+ for (var b = g; b >= 0; b--) c(d[b], m);
3725
3759
  }, r.prototype._condense = function(m) {
3726
- for (var d = m.length - 1, p = void 0; d >= 0; d--) m[d].children.length === 0 ? d > 0 ? (p = m[d - 1].children).splice(p.indexOf(m[d]), 1) : this.clear() : a(m[d], this.toBBox);
3760
+ for (var d = m.length - 1, g = void 0; d >= 0; d--) m[d].children.length === 0 ? d > 0 ? (g = m[d - 1].children).splice(g.indexOf(m[d]), 1) : this.clear() : a(m[d], this.toBBox);
3727
3761
  }, r;
3728
3762
  });
3729
- })(Cn);
3730
- var tr = Cn.exports;
3731
- class er {
3732
- constructor(t = [], e = nr) {
3763
+ })(On);
3764
+ var rr = On.exports;
3765
+ class ir {
3766
+ constructor(t = [], e = sr) {
3733
3767
  if (this.data = t, this.length = this.data.length, this.compare = e, this.length > 0)
3734
3768
  for (let o = (this.length >> 1) - 1; o >= 0; o--) this._down(o);
3735
3769
  }
@@ -3764,88 +3798,88 @@ class er {
3764
3798
  e[t] = r;
3765
3799
  }
3766
3800
  }
3767
- function nr(n, t) {
3801
+ function sr(n, t) {
3768
3802
  return n < t ? -1 : n > t ? 1 : 0;
3769
3803
  }
3770
- const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3804
+ const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3771
3805
  __proto__: null,
3772
- default: er
3773
- }, Symbol.toStringTag, { value: "Module" })), rr = /* @__PURE__ */ Jo(or);
3774
- var Be = { exports: {} }, ir = function(t, e, o, i) {
3806
+ default: ir
3807
+ }, Symbol.toStringTag, { value: "Module" })), lr = /* @__PURE__ */ or(ar);
3808
+ var ke = { exports: {} }, cr = function(t, e, o, i) {
3775
3809
  var r = t[0], s = t[1], a = !1;
3776
3810
  o === void 0 && (o = 0), i === void 0 && (i = e.length);
3777
3811
  for (var l = (i - o) / 2, c = 0, h = l - 1; c < l; h = c++) {
3778
- var f = e[o + c * 2 + 0], u = e[o + c * 2 + 1], g = e[o + h * 2 + 0], w = e[o + h * 2 + 1], x = u > s != w > s && r < (g - f) * (s - u) / (w - u) + f;
3812
+ var f = e[o + c * 2 + 0], u = e[o + c * 2 + 1], p = e[o + h * 2 + 0], w = e[o + h * 2 + 1], x = u > s != w > s && r < (p - f) * (s - u) / (w - u) + f;
3779
3813
  x && (a = !a);
3780
3814
  }
3781
3815
  return a;
3782
- }, sr = function(t, e, o, i) {
3816
+ }, ur = function(t, e, o, i) {
3783
3817
  var r = t[0], s = t[1], a = !1;
3784
3818
  o === void 0 && (o = 0), i === void 0 && (i = e.length);
3785
3819
  for (var l = i - o, c = 0, h = l - 1; c < l; h = c++) {
3786
- var f = e[c + o][0], u = e[c + o][1], g = e[h + o][0], w = e[h + o][1], x = u > s != w > s && r < (g - f) * (s - u) / (w - u) + f;
3820
+ var f = e[c + o][0], u = e[c + o][1], p = e[h + o][0], w = e[h + o][1], x = u > s != w > s && r < (p - f) * (s - u) / (w - u) + f;
3787
3821
  x && (a = !a);
3788
3822
  }
3789
3823
  return a;
3790
- }, Ln = ir, Rn = sr;
3791
- Be.exports = function(t, e, o, i) {
3792
- return e.length > 0 && Array.isArray(e[0]) ? Rn(t, e, o, i) : Ln(t, e, o, i);
3824
+ }, Wn = cr, Nn = ur;
3825
+ ke.exports = function(t, e, o, i) {
3826
+ return e.length > 0 && Array.isArray(e[0]) ? Nn(t, e, o, i) : Wn(t, e, o, i);
3793
3827
  };
3794
- Be.exports.nested = Rn;
3795
- Be.exports.flat = Ln;
3796
- var ar = Be.exports, Xe = { exports: {} };
3828
+ ke.exports.nested = Nn;
3829
+ ke.exports.flat = Wn;
3830
+ var hr = ke.exports, je = { exports: {} };
3797
3831
  (function(n, t) {
3798
3832
  (function(e, o) {
3799
3833
  o(t);
3800
- })(kn, function(e) {
3834
+ })(Fn, function(e) {
3801
3835
  const i = 33306690738754706e-32;
3802
3836
  function r(x, P, M, m, d) {
3803
- let p, b, V, v, S = P[0], z = m[0], D = 0, _ = 0;
3804
- z > S == z > -S ? (p = S, S = P[++D]) : (p = z, z = m[++_]);
3805
- let E = 0;
3806
- if (D < x && _ < M) for (z > S == z > -S ? (V = p - ((b = S + p) - S), S = P[++D]) : (V = p - ((b = z + p) - z), z = m[++_]), p = b, V !== 0 && (d[E++] = V); D < x && _ < M; ) z > S == z > -S ? (V = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D]) : (V = p - ((b = p + z) - (v = b - p)) + (z - v), z = m[++_]), p = b, V !== 0 && (d[E++] = V);
3807
- for (; D < x; ) V = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D], p = b, V !== 0 && (d[E++] = V);
3808
- for (; _ < M; ) V = p - ((b = p + z) - (v = b - p)) + (z - v), z = m[++_], p = b, V !== 0 && (d[E++] = V);
3809
- return p === 0 && E !== 0 || (d[E++] = p), E;
3837
+ let g, b, V, v, S = P[0], z = m[0], D = 0, _ = 0;
3838
+ z > S == z > -S ? (g = S, S = P[++D]) : (g = z, z = m[++_]);
3839
+ let T = 0;
3840
+ if (D < x && _ < M) for (z > S == z > -S ? (V = g - ((b = S + g) - S), S = P[++D]) : (V = g - ((b = z + g) - z), z = m[++_]), g = b, V !== 0 && (d[T++] = V); D < x && _ < M; ) z > S == z > -S ? (V = g - ((b = g + S) - (v = b - g)) + (S - v), S = P[++D]) : (V = g - ((b = g + z) - (v = b - g)) + (z - v), z = m[++_]), g = b, V !== 0 && (d[T++] = V);
3841
+ for (; D < x; ) V = g - ((b = g + S) - (v = b - g)) + (S - v), S = P[++D], g = b, V !== 0 && (d[T++] = V);
3842
+ for (; _ < M; ) V = g - ((b = g + z) - (v = b - g)) + (z - v), z = m[++_], g = b, V !== 0 && (d[T++] = V);
3843
+ return g === 0 && T !== 0 || (d[T++] = g), T;
3810
3844
  }
3811
3845
  function s(x) {
3812
3846
  return new Float64Array(x);
3813
3847
  }
3814
- const a = 33306690738754716e-32, l = 22204460492503146e-32, c = 11093356479670487e-47, h = s(4), f = s(8), u = s(12), g = s(16), w = s(4);
3815
- e.orient2d = function(x, P, M, m, d, p) {
3816
- const b = (P - p) * (M - d), V = (x - d) * (m - p), v = b - V;
3848
+ const a = 33306690738754716e-32, l = 22204460492503146e-32, c = 11093356479670487e-47, h = s(4), f = s(8), u = s(12), p = s(16), w = s(4);
3849
+ e.orient2d = function(x, P, M, m, d, g) {
3850
+ const b = (P - g) * (M - d), V = (x - d) * (m - g), v = b - V;
3817
3851
  if (b === 0 || V === 0 || b > 0 != V > 0) return v;
3818
3852
  const S = Math.abs(b + V);
3819
- return Math.abs(v) >= a * S ? v : -function(z, D, _, E, T, A, O) {
3820
- let I, B, L, W, C, R, H, X, nt, U, $, ut, ot, F, Y, Pt, Gt, Ot;
3821
- const Bt = z - T, vt = _ - T, Dt = D - A, It = E - A;
3822
- C = (Y = (X = Bt - (H = (R = 134217729 * Bt) - (R - Bt))) * (U = It - (nt = (R = 134217729 * It) - (R - It))) - ((F = Bt * It) - H * nt - X * nt - H * U)) - ($ = Y - (Gt = (X = Dt - (H = (R = 134217729 * Dt) - (R - Dt))) * (U = vt - (nt = (R = 134217729 * vt) - (R - vt))) - ((Pt = Dt * vt) - H * nt - X * nt - H * U))), h[0] = Y - ($ + C) + (C - Gt), C = (ot = F - ((ut = F + $) - (C = ut - F)) + ($ - C)) - ($ = ot - Pt), h[1] = ot - ($ + C) + (C - Pt), C = (Ot = ut + $) - ut, h[2] = ut - (Ot - C) + ($ - C), h[3] = Ot;
3823
- let Q = function(_t, Wt) {
3824
- let K = Wt[0];
3825
- for (let ct = 1; ct < _t; ct++) K += Wt[ct];
3826
- return K;
3853
+ return Math.abs(v) >= a * S ? v : -function(z, D, _, T, E, A, O) {
3854
+ let I, B, R, W, C, L, H, X, ot, K, G, ut, rt, F, Y, Mt, Zt, Nt;
3855
+ const Lt = z - E, _t = _ - E, Tt = D - A, Ft = T - A;
3856
+ C = (Y = (X = Lt - (H = (L = 134217729 * Lt) - (L - Lt))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = Lt * Ft) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = Tt - (H = (L = 134217729 * Tt) - (L - Tt))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = Tt * _t) - H * ot - X * ot - H * K))), h[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), h[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, h[2] = ut - (Nt - C) + (G - C), h[3] = Nt;
3857
+ let tt = function(Et, qt) {
3858
+ let J = qt[0];
3859
+ for (let ct = 1; ct < Et; ct++) J += qt[ct];
3860
+ return J;
3827
3861
  }(4, h), lt = l * O;
3828
- if (Q >= lt || -Q >= lt || (I = z - (Bt + (C = z - Bt)) + (C - T), L = _ - (vt + (C = _ - vt)) + (C - T), B = D - (Dt + (C = D - Dt)) + (C - A), W = E - (It + (C = E - It)) + (C - A), I === 0 && B === 0 && L === 0 && W === 0) || (lt = c * O + i * Math.abs(Q), (Q += Bt * W + It * I - (Dt * L + vt * B)) >= lt || -Q >= lt)) return Q;
3829
- C = (Y = (X = I - (H = (R = 134217729 * I) - (R - I))) * (U = It - (nt = (R = 134217729 * It) - (R - It))) - ((F = I * It) - H * nt - X * nt - H * U)) - ($ = Y - (Gt = (X = B - (H = (R = 134217729 * B) - (R - B))) * (U = vt - (nt = (R = 134217729 * vt) - (R - vt))) - ((Pt = B * vt) - H * nt - X * nt - H * U))), w[0] = Y - ($ + C) + (C - Gt), C = (ot = F - ((ut = F + $) - (C = ut - F)) + ($ - C)) - ($ = ot - Pt), w[1] = ot - ($ + C) + (C - Pt), C = (Ot = ut + $) - ut, w[2] = ut - (Ot - C) + ($ - C), w[3] = Ot;
3862
+ if (tt >= lt || -tt >= lt || (I = z - (Lt + (C = z - Lt)) + (C - E), R = _ - (_t + (C = _ - _t)) + (C - E), B = D - (Tt + (C = D - Tt)) + (C - A), W = T - (Ft + (C = T - Ft)) + (C - A), I === 0 && B === 0 && R === 0 && W === 0) || (lt = c * O + i * Math.abs(tt), (tt += Lt * W + Ft * I - (Tt * R + _t * B)) >= lt || -tt >= lt)) return tt;
3863
+ C = (Y = (X = I - (H = (L = 134217729 * I) - (L - I))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = I * Ft) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = B - (H = (L = 134217729 * B) - (L - B))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = B * _t) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
3830
3864
  const q = r(4, h, 4, w, f);
3831
- C = (Y = (X = Bt - (H = (R = 134217729 * Bt) - (R - Bt))) * (U = W - (nt = (R = 134217729 * W) - (R - W))) - ((F = Bt * W) - H * nt - X * nt - H * U)) - ($ = Y - (Gt = (X = Dt - (H = (R = 134217729 * Dt) - (R - Dt))) * (U = L - (nt = (R = 134217729 * L) - (R - L))) - ((Pt = Dt * L) - H * nt - X * nt - H * U))), w[0] = Y - ($ + C) + (C - Gt), C = (ot = F - ((ut = F + $) - (C = ut - F)) + ($ - C)) - ($ = ot - Pt), w[1] = ot - ($ + C) + (C - Pt), C = (Ot = ut + $) - ut, w[2] = ut - (Ot - C) + ($ - C), w[3] = Ot;
3832
- const G = r(q, f, 4, w, u);
3833
- C = (Y = (X = I - (H = (R = 134217729 * I) - (R - I))) * (U = W - (nt = (R = 134217729 * W) - (R - W))) - ((F = I * W) - H * nt - X * nt - H * U)) - ($ = Y - (Gt = (X = B - (H = (R = 134217729 * B) - (R - B))) * (U = L - (nt = (R = 134217729 * L) - (R - L))) - ((Pt = B * L) - H * nt - X * nt - H * U))), w[0] = Y - ($ + C) + (C - Gt), C = (ot = F - ((ut = F + $) - (C = ut - F)) + ($ - C)) - ($ = ot - Pt), w[1] = ot - ($ + C) + (C - Pt), C = (Ot = ut + $) - ut, w[2] = ut - (Ot - C) + ($ - C), w[3] = Ot;
3834
- const Lt = r(G, u, 4, w, g);
3835
- return g[Lt - 1];
3836
- }(x, P, M, m, d, p, S);
3837
- }, e.orient2dfast = function(x, P, M, m, d, p) {
3838
- return (P - p) * (M - d) - (x - d) * (m - p);
3865
+ C = (Y = (X = Lt - (H = (L = 134217729 * Lt) - (L - Lt))) * (K = W - (ot = (L = 134217729 * W) - (L - W))) - ((F = Lt * W) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = Tt - (H = (L = 134217729 * Tt) - (L - Tt))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = Tt * R) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
3866
+ const j = r(q, f, 4, w, u);
3867
+ C = (Y = (X = I - (H = (L = 134217729 * I) - (L - I))) * (K = W - (ot = (L = 134217729 * W) - (L - W))) - ((F = I * W) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = B - (H = (L = 134217729 * B) - (L - B))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = B * R) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
3868
+ const Wt = r(j, u, 4, w, p);
3869
+ return p[Wt - 1];
3870
+ }(x, P, M, m, d, g, S);
3871
+ }, e.orient2dfast = function(x, P, M, m, d, g) {
3872
+ return (P - g) * (M - d) - (x - d) * (m - g);
3839
3873
  }, Object.defineProperty(e, "__esModule", { value: !0 });
3840
3874
  });
3841
- })(Xe, Xe.exports);
3842
- var lr = Xe.exports, fn = tr, Ee = rr, cr = ar, ur = lr.orient2d;
3843
- Ee.default && (Ee = Ee.default);
3844
- Ye.exports = Fn;
3845
- Ye.exports.default = Fn;
3846
- function Fn(n, t, e) {
3875
+ })(je, je.exports);
3876
+ var fr = je.exports, pn = rr, Ae = lr, dr = hr, mr = fr.orient2d;
3877
+ Ae.default && (Ae = Ae.default);
3878
+ Ze.exports = qn;
3879
+ Ze.exports.default = qn;
3880
+ function qn(n, t, e) {
3847
3881
  t = Math.max(0, t === void 0 ? 2 : t), e = e || 0;
3848
- var o = gr(n), i = new fn(16);
3882
+ var o = wr(n), i = new pn(16);
3849
3883
  i.toBBox = function(m) {
3850
3884
  return {
3851
3885
  minX: m[0],
@@ -3860,15 +3894,15 @@ function Fn(n, t, e) {
3860
3894
  }, i.load(n);
3861
3895
  for (var r = [], s = 0, a; s < o.length; s++) {
3862
3896
  var l = o[s];
3863
- i.remove(l), a = gn(l, a), r.push(a);
3897
+ i.remove(l), a = wn(l, a), r.push(a);
3864
3898
  }
3865
- var c = new fn(16);
3866
- for (s = 0; s < r.length; s++) c.insert(Re(r[s]));
3899
+ var c = new pn(16);
3900
+ for (s = 0; s < r.length; s++) c.insert(qe(r[s]));
3867
3901
  for (var h = t * t, f = e * e; r.length; ) {
3868
- var u = r.shift(), g = u.p, w = u.next.p, x = Fe(g, w);
3902
+ var u = r.shift(), p = u.p, w = u.next.p, x = Xe(p, w);
3869
3903
  if (!(x < f)) {
3870
3904
  var P = x / h;
3871
- l = hr(i, u.prev.p, g, w, u.next.next.p, P, c), l && Math.min(Fe(l, g), Fe(l, w)) <= P && (r.push(u), r.push(gn(l, u)), i.remove(l), c.remove(u), c.insert(Re(u)), c.insert(Re(u.next)));
3905
+ l = gr(i, u.prev.p, p, w, u.next.next.p, P, c), l && Math.min(Xe(l, p), Xe(l, w)) <= P && (r.push(u), r.push(wn(l, u)), i.remove(l), c.remove(u), c.insert(qe(u)), c.insert(qe(u.next)));
3872
3906
  }
3873
3907
  }
3874
3908
  u = a;
@@ -3878,66 +3912,66 @@ function Fn(n, t, e) {
3878
3912
  while (u !== a);
3879
3913
  return M.push(u.p), M;
3880
3914
  }
3881
- function hr(n, t, e, o, i, r, s) {
3882
- for (var a = new Ee([], fr), l = n.data; l; ) {
3915
+ function gr(n, t, e, o, i, r, s) {
3916
+ for (var a = new Ae([], pr), l = n.data; l; ) {
3883
3917
  for (var c = 0; c < l.children.length; c++) {
3884
- var h = l.children[c], f = l.leaf ? Oe(h, e, o) : dr(e, o, h);
3918
+ var h = l.children[c], f = l.leaf ? He(h, e, o) : yr(e, o, h);
3885
3919
  f > r || a.push({
3886
3920
  node: h,
3887
3921
  dist: f
3888
3922
  });
3889
3923
  }
3890
3924
  for (; a.length && !a.peek().node.children; ) {
3891
- var u = a.pop(), g = u.node, w = Oe(g, t, e), x = Oe(g, o, i);
3892
- if (u.dist < w && u.dist < x && mn(e, g, s) && mn(o, g, s)) return g;
3925
+ var u = a.pop(), p = u.node, w = He(p, t, e), x = He(p, o, i);
3926
+ if (u.dist < w && u.dist < x && xn(e, p, s) && xn(o, p, s)) return p;
3893
3927
  }
3894
3928
  l = a.pop(), l && (l = l.node);
3895
3929
  }
3896
3930
  return null;
3897
3931
  }
3898
- function fr(n, t) {
3932
+ function pr(n, t) {
3899
3933
  return n.dist - t.dist;
3900
3934
  }
3901
- function dr(n, t, e) {
3902
- if (dn(n, e) || dn(t, e)) return 0;
3903
- var o = De(n[0], n[1], t[0], t[1], e.minX, e.minY, e.maxX, e.minY);
3935
+ function yr(n, t, e) {
3936
+ if (yn(n, e) || yn(t, e)) return 0;
3937
+ var o = Te(n[0], n[1], t[0], t[1], e.minX, e.minY, e.maxX, e.minY);
3904
3938
  if (o === 0) return 0;
3905
- var i = De(n[0], n[1], t[0], t[1], e.minX, e.minY, e.minX, e.maxY);
3939
+ var i = Te(n[0], n[1], t[0], t[1], e.minX, e.minY, e.minX, e.maxY);
3906
3940
  if (i === 0) return 0;
3907
- var r = De(n[0], n[1], t[0], t[1], e.maxX, e.minY, e.maxX, e.maxY);
3941
+ var r = Te(n[0], n[1], t[0], t[1], e.maxX, e.minY, e.maxX, e.maxY);
3908
3942
  if (r === 0) return 0;
3909
- var s = De(n[0], n[1], t[0], t[1], e.minX, e.maxY, e.maxX, e.maxY);
3943
+ var s = Te(n[0], n[1], t[0], t[1], e.minX, e.maxY, e.maxX, e.maxY);
3910
3944
  return s === 0 ? 0 : Math.min(o, i, r, s);
3911
3945
  }
3912
- function dn(n, t) {
3946
+ function yn(n, t) {
3913
3947
  return n[0] >= t.minX && n[0] <= t.maxX && n[1] >= t.minY && n[1] <= t.maxY;
3914
3948
  }
3915
- function mn(n, t, e) {
3949
+ function xn(n, t, e) {
3916
3950
  for (var o = Math.min(n[0], t[0]), i = Math.min(n[1], t[1]), r = Math.max(n[0], t[0]), s = Math.max(n[1], t[1]), a = e.search({ minX: o, minY: i, maxX: r, maxY: s }), l = 0; l < a.length; l++)
3917
- if (mr(a[l].p, a[l].next.p, n, t)) return !1;
3951
+ if (xr(a[l].p, a[l].next.p, n, t)) return !1;
3918
3952
  return !0;
3919
3953
  }
3920
- function pe(n, t, e) {
3921
- return ur(n[0], n[1], t[0], t[1], e[0], e[1]);
3954
+ function xe(n, t, e) {
3955
+ return mr(n[0], n[1], t[0], t[1], e[0], e[1]);
3922
3956
  }
3923
- function mr(n, t, e, o) {
3924
- return n !== o && t !== e && pe(n, t, e) > 0 != pe(n, t, o) > 0 && pe(e, o, n) > 0 != pe(e, o, t) > 0;
3957
+ function xr(n, t, e, o) {
3958
+ return n !== o && t !== e && xe(n, t, e) > 0 != xe(n, t, o) > 0 && xe(e, o, n) > 0 != xe(e, o, t) > 0;
3925
3959
  }
3926
- function Re(n) {
3960
+ function qe(n) {
3927
3961
  var t = n.p, e = n.next.p;
3928
3962
  return n.minX = Math.min(t[0], e[0]), n.minY = Math.min(t[1], e[1]), n.maxX = Math.max(t[0], e[0]), n.maxY = Math.max(t[1], e[1]), n;
3929
3963
  }
3930
- function gr(n) {
3964
+ function wr(n) {
3931
3965
  for (var t = n[0], e = n[0], o = n[0], i = n[0], r = 0; r < n.length; r++) {
3932
3966
  var s = n[r];
3933
3967
  s[0] < t[0] && (t = s), s[0] > o[0] && (o = s), s[1] < e[1] && (e = s), s[1] > i[1] && (i = s);
3934
3968
  }
3935
3969
  var a = [t, e, o, i], l = a.slice();
3936
3970
  for (r = 0; r < n.length; r++)
3937
- cr(n[r], a) || l.push(n[r]);
3938
- return yr(l);
3971
+ dr(n[r], a) || l.push(n[r]);
3972
+ return Pr(l);
3939
3973
  }
3940
- function gn(n, t) {
3974
+ function wn(n, t) {
3941
3975
  var e = {
3942
3976
  p: n,
3943
3977
  prev: null,
@@ -3949,11 +3983,11 @@ function gn(n, t) {
3949
3983
  };
3950
3984
  return t ? (e.next = t.next, e.prev = t, t.next.prev = e, t.next = e) : (e.prev = e, e.next = e), e;
3951
3985
  }
3952
- function Fe(n, t) {
3986
+ function Xe(n, t) {
3953
3987
  var e = n[0] - t[0], o = n[1] - t[1];
3954
3988
  return e * e + o * o;
3955
3989
  }
3956
- function Oe(n, t, e) {
3990
+ function He(n, t, e) {
3957
3991
  var o = t[0], i = t[1], r = e[0] - o, s = e[1] - i;
3958
3992
  if (r !== 0 || s !== 0) {
3959
3993
  var a = ((n[0] - o) * r + (n[1] - i) * s) / (r * r + s * s);
@@ -3961,52 +3995,52 @@ function Oe(n, t, e) {
3961
3995
  }
3962
3996
  return r = n[0] - o, s = n[1] - i, r * r + s * s;
3963
3997
  }
3964
- function De(n, t, e, o, i, r, s, a) {
3965
- var l = e - n, c = o - t, h = s - i, f = a - r, u = n - i, g = t - r, w = l * l + c * c, x = l * h + c * f, P = h * h + f * f, M = l * u + c * g, m = h * u + f * g, d = w * P - x * x, p, b, V, v, S = d, z = d;
3966
- d === 0 ? (b = 0, S = 1, v = m, z = P) : (b = x * m - P * M, v = w * m - x * M, b < 0 ? (b = 0, v = m, z = P) : b > S && (b = S, v = m + x, z = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > z && (v = z, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), p = b === 0 ? 0 : b / S, V = v === 0 ? 0 : v / z;
3967
- var D = (1 - p) * n + p * e, _ = (1 - p) * t + p * o, E = (1 - V) * i + V * s, T = (1 - V) * r + V * a, A = E - D, O = T - _;
3998
+ function Te(n, t, e, o, i, r, s, a) {
3999
+ var l = e - n, c = o - t, h = s - i, f = a - r, u = n - i, p = t - r, w = l * l + c * c, x = l * h + c * f, P = h * h + f * f, M = l * u + c * p, m = h * u + f * p, d = w * P - x * x, g, b, V, v, S = d, z = d;
4000
+ d === 0 ? (b = 0, S = 1, v = m, z = P) : (b = x * m - P * M, v = w * m - x * M, b < 0 ? (b = 0, v = m, z = P) : b > S && (b = S, v = m + x, z = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > z && (v = z, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), g = b === 0 ? 0 : b / S, V = v === 0 ? 0 : v / z;
4001
+ var D = (1 - g) * n + g * e, _ = (1 - g) * t + g * o, T = (1 - V) * i + V * s, E = (1 - V) * r + V * a, A = T - D, O = E - _;
3968
4002
  return A * A + O * O;
3969
4003
  }
3970
- function pr(n, t) {
4004
+ function br(n, t) {
3971
4005
  return n[0] === t[0] ? n[1] - t[1] : n[0] - t[0];
3972
4006
  }
3973
- function yr(n) {
3974
- n.sort(pr);
4007
+ function Pr(n) {
4008
+ n.sort(br);
3975
4009
  for (var t = [], e = 0; e < n.length; e++) {
3976
- for (; t.length >= 2 && pe(t[t.length - 2], t[t.length - 1], n[e]) <= 0; )
4010
+ for (; t.length >= 2 && xe(t[t.length - 2], t[t.length - 1], n[e]) <= 0; )
3977
4011
  t.pop();
3978
4012
  t.push(n[e]);
3979
4013
  }
3980
4014
  for (var o = [], i = n.length - 1; i >= 0; i--) {
3981
- for (; o.length >= 2 && pe(o[o.length - 2], o[o.length - 1], n[i]) <= 0; )
4015
+ for (; o.length >= 2 && xe(o[o.length - 2], o[o.length - 1], n[i]) <= 0; )
3982
4016
  o.pop();
3983
4017
  o.push(n[i]);
3984
4018
  }
3985
4019
  return o.pop(), t.pop(), t.concat(o);
3986
4020
  }
3987
- var xr = Ye.exports;
3988
- const wr = /* @__PURE__ */ Qo(xr);
3989
- function br(n, t = {}) {
4021
+ var Mr = Ze.exports;
4022
+ const zr = /* @__PURE__ */ nr(Mr);
4023
+ function Vr(n, t = {}) {
3990
4024
  t.concavity = t.concavity || 1 / 0;
3991
4025
  const e = [];
3992
- if (we(n, (i) => {
4026
+ if (Pe(n, (i) => {
3993
4027
  e.push([i[0], i[1]]);
3994
4028
  }), !e.length)
3995
4029
  return null;
3996
- const o = wr(e, t.concavity);
3997
- return o.length > 3 ? An([o]) : null;
4030
+ const o = zr(e, t.concavity);
4031
+ return o.length > 3 ? Cn([o]) : null;
3998
4032
  }
3999
- function On(n, t = {}) {
4033
+ function Xn(n, t = {}) {
4000
4034
  let e = 0, o = 0, i = 0;
4001
- return we(
4035
+ return Pe(
4002
4036
  n,
4003
4037
  function(r) {
4004
4038
  e += r[0], o += r[1], i++;
4005
4039
  },
4006
4040
  !0
4007
- ), Tn([e / i, o / i], t.properties);
4041
+ ), kn([e / i, o / i], t.properties);
4008
4042
  }
4009
- function oe(n) {
4043
+ function se(n) {
4010
4044
  if (!n)
4011
4045
  throw new Error("coord is required");
4012
4046
  if (!Array.isArray(n)) {
@@ -4019,7 +4053,7 @@ function oe(n) {
4019
4053
  return [...n];
4020
4054
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4021
4055
  }
4022
- function Pr(n) {
4056
+ function Sr(n) {
4023
4057
  if (Array.isArray(n))
4024
4058
  return n;
4025
4059
  if (n.type === "Feature") {
@@ -4031,27 +4065,27 @@ function Pr(n) {
4031
4065
  "coords must be GeoJSON Feature, Geometry Object or an Array"
4032
4066
  );
4033
4067
  }
4034
- function Mr(n, t, e = {}) {
4068
+ function vr(n, t, e = {}) {
4035
4069
  let o;
4036
- return e.final ? o = pn(oe(t), oe(n)) : o = pn(oe(n), oe(t)), o > 180 ? -(360 - o) : o;
4070
+ return e.final ? o = bn(se(t), se(n)) : o = bn(se(n), se(t)), o > 180 ? -(360 - o) : o;
4037
4071
  }
4038
- function pn(n, t) {
4039
- const e = ne(n[1]), o = ne(t[1]);
4040
- let i = ne(t[0] - n[0]);
4072
+ function bn(n, t) {
4073
+ const e = ie(n[1]), o = ie(t[1]);
4074
+ let i = ie(t[0] - n[0]);
4041
4075
  i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);
4042
4076
  const r = Math.log(
4043
4077
  Math.tan(o / 2 + Math.PI / 4) / Math.tan(e / 2 + Math.PI / 4)
4044
4078
  ), s = Math.atan2(i, r);
4045
- return (Bn(s) + 360) % 360;
4079
+ return (Rn(s) + 360) % 360;
4046
4080
  }
4047
- function zr(n, t, e = {}) {
4048
- const o = oe(n), i = oe(t);
4081
+ function Dr(n, t, e = {}) {
4082
+ const o = se(n), i = se(t);
4049
4083
  i[0] += i[0] - o[0] > 180 ? -360 : o[0] - i[0] > 180 ? 360 : 0;
4050
- const r = Vr(o, i);
4051
- return In(r, "meters", e.units);
4084
+ const r = _r(o, i);
4085
+ return Ln(r, "meters", e.units);
4052
4086
  }
4053
- function Vr(n, t, e) {
4054
- e = e === void 0 ? qt : Number(e);
4087
+ function _r(n, t, e) {
4088
+ e = e === void 0 ? Yt : Number(e);
4055
4089
  const o = e, i = n[1] * Math.PI / 180, r = t[1] * Math.PI / 180, s = r - i;
4056
4090
  let a = Math.abs(t[0] - n[0]) * Math.PI / 180;
4057
4091
  a > Math.PI && (a -= 2 * Math.PI);
@@ -4062,24 +4096,24 @@ function Vr(n, t, e) {
4062
4096
  s * s + c * c * a * a
4063
4097
  ) * o;
4064
4098
  }
4065
- function Sr(n, t, e, o = {}) {
4099
+ function Tr(n, t, e, o = {}) {
4066
4100
  const i = t < 0;
4067
- let r = In(
4101
+ let r = Ln(
4068
4102
  Math.abs(t),
4069
4103
  o.units,
4070
4104
  "meters"
4071
4105
  );
4072
4106
  i && (r = -Math.abs(r));
4073
- const s = oe(n), a = vr(
4107
+ const s = se(n), a = Er(
4074
4108
  s,
4075
4109
  r,
4076
4110
  e
4077
4111
  );
4078
- return a[0] += a[0] - s[0] > 180 ? -360 : s[0] - a[0] > 180 ? 360 : 0, Tn(a, o.properties);
4112
+ return a[0] += a[0] - s[0] > 180 ? -360 : s[0] - a[0] > 180 ? 360 : 0, kn(a, o.properties);
4079
4113
  }
4080
- function vr(n, t, e, o) {
4081
- o = o === void 0 ? qt : Number(o);
4082
- const i = t / o, r = n[0] * Math.PI / 180, s = ne(n[1]), a = ne(e), l = i * Math.cos(a);
4114
+ function Er(n, t, e, o) {
4115
+ o = o === void 0 ? Yt : Number(o);
4116
+ const i = t / o, r = n[0] * Math.PI / 180, s = ie(n[1]), a = ie(e), l = i * Math.cos(a);
4083
4117
  let c = s + l;
4084
4118
  Math.abs(c) > Math.PI / 2 && (c = c > 0 ? Math.PI - c : -Math.PI - c);
4085
4119
  const h = Math.log(
@@ -4090,14 +4124,14 @@ function vr(n, t, e, o) {
4090
4124
  c * 180 / Math.PI
4091
4125
  ];
4092
4126
  }
4093
- function Dr(n) {
4127
+ function Ar(n) {
4094
4128
  if (!n)
4095
4129
  throw new Error("geojson is required");
4096
4130
  switch (n.type) {
4097
4131
  case "Feature":
4098
- return Wn(n);
4132
+ return Hn(n);
4099
4133
  case "FeatureCollection":
4100
- return _r(n);
4134
+ return Br(n);
4101
4135
  case "Point":
4102
4136
  case "LineString":
4103
4137
  case "Polygon":
@@ -4105,12 +4139,12 @@ function Dr(n) {
4105
4139
  case "MultiLineString":
4106
4140
  case "MultiPolygon":
4107
4141
  case "GeometryCollection":
4108
- return $e(n);
4142
+ return Ke(n);
4109
4143
  default:
4110
4144
  throw new Error("unknown GeoJSON type");
4111
4145
  }
4112
4146
  }
4113
- function Wn(n) {
4147
+ function Hn(n) {
4114
4148
  const t = { type: "Feature" };
4115
4149
  return Object.keys(n).forEach((e) => {
4116
4150
  switch (e) {
@@ -4121,16 +4155,16 @@ function Wn(n) {
4121
4155
  default:
4122
4156
  t[e] = n[e];
4123
4157
  }
4124
- }), t.properties = Nn(n.properties), n.geometry == null ? t.geometry = null : t.geometry = $e(n.geometry), t;
4158
+ }), t.properties = Yn(n.properties), n.geometry == null ? t.geometry = null : t.geometry = Ke(n.geometry), t;
4125
4159
  }
4126
- function Nn(n) {
4160
+ function Yn(n) {
4127
4161
  const t = {};
4128
4162
  return n && Object.keys(n).forEach((e) => {
4129
4163
  const o = n[e];
4130
- typeof o == "object" ? o === null ? t[e] = null : Array.isArray(o) ? t[e] = o.map((i) => i) : t[e] = Nn(o) : t[e] = o;
4164
+ typeof o == "object" ? o === null ? t[e] = null : Array.isArray(o) ? t[e] = o.map((i) => i) : t[e] = Yn(o) : t[e] = o;
4131
4165
  }), t;
4132
4166
  }
4133
- function _r(n) {
4167
+ function Br(n) {
4134
4168
  const t = { type: "FeatureCollection" };
4135
4169
  return Object.keys(n).forEach((e) => {
4136
4170
  switch (e) {
@@ -4140,80 +4174,80 @@ function _r(n) {
4140
4174
  default:
4141
4175
  t[e] = n[e];
4142
4176
  }
4143
- }), t.features = n.features.map((e) => Wn(e)), t;
4177
+ }), t.features = n.features.map((e) => Hn(e)), t;
4144
4178
  }
4145
- function $e(n) {
4179
+ function Ke(n) {
4146
4180
  const t = { type: n.type };
4147
- return n.bbox && (t.bbox = n.bbox), n.type === "GeometryCollection" ? (t.geometries = n.geometries.map((e) => $e(e)), t) : (t.coordinates = qn(n.coordinates), t);
4181
+ return n.bbox && (t.bbox = n.bbox), n.type === "GeometryCollection" ? (t.geometries = n.geometries.map((e) => Ke(e)), t) : (t.coordinates = $n(n.coordinates), t);
4148
4182
  }
4149
- function qn(n) {
4183
+ function $n(n) {
4150
4184
  const t = n;
4151
- return typeof t[0] != "object" ? t.slice() : t.map((e) => qn(e));
4185
+ return typeof t[0] != "object" ? t.slice() : t.map((e) => $n(e));
4152
4186
  }
4153
- function yn(n, t, e) {
4154
- if (e = e || {}, !jo(e)) throw new Error("options is invalid");
4187
+ function Pn(n, t, e) {
4188
+ if (e = e || {}, !Qo(e)) throw new Error("options is invalid");
4155
4189
  const o = e.pivot, i = e.mutate;
4156
4190
  if (!n) throw new Error("geojson is required");
4157
4191
  if (t == null || isNaN(t))
4158
4192
  throw new Error("angle is required");
4159
4193
  if (t === 0) return n;
4160
- const r = o ?? On(n);
4161
- return (i === !1 || i === void 0) && (n = Dr(n)), we(n, function(s) {
4162
- const l = Mr(r, s) + t, c = zr(r, s), h = Pr(
4163
- Sr(r, c, l)
4194
+ const r = o ?? Xn(n);
4195
+ return (i === !1 || i === void 0) && (n = Ar(n)), Pe(n, function(s) {
4196
+ const l = vr(r, s) + t, c = Dr(r, s), h = Sr(
4197
+ Tr(r, c, l)
4164
4198
  );
4165
4199
  s[0] = h[0], s[1] = h[1];
4166
4200
  }), n;
4167
4201
  }
4168
- function Xn(n, t, e = {}) {
4202
+ function Gn(n, t, e = {}) {
4169
4203
  if (e.final === !0)
4170
- return Er(n, t);
4171
- const o = oe(n), i = oe(t), r = ne(o[0]), s = ne(i[0]), a = ne(o[1]), l = ne(i[1]), c = Math.sin(s - r) * Math.cos(l), h = Math.cos(a) * Math.sin(l) - Math.sin(a) * Math.cos(l) * Math.cos(s - r);
4172
- return Bn(Math.atan2(c, h));
4204
+ return Ir(n, t);
4205
+ const o = se(n), i = se(t), r = ie(o[0]), s = ie(i[0]), a = ie(o[1]), l = ie(i[1]), c = Math.sin(s - r) * Math.cos(l), h = Math.cos(a) * Math.sin(l) - Math.sin(a) * Math.cos(l) * Math.cos(s - r);
4206
+ return Rn(Math.atan2(c, h));
4173
4207
  }
4174
- function Er(n, t) {
4175
- let e = Xn(t, n);
4208
+ function Ir(n, t) {
4209
+ let e = Gn(t, n);
4176
4210
  return e = (e + 180) % 360, e;
4177
4211
  }
4178
- function Tr(n, t = {}) {
4212
+ function kr(n, t = {}) {
4179
4213
  if (n.bbox != null && t.recompute !== !0)
4180
4214
  return n.bbox;
4181
4215
  const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
4182
- return we(n, (o) => {
4216
+ return Pe(n, (o) => {
4183
4217
  e[0] > o[0] && (e[0] = o[0]), e[1] > o[1] && (e[1] = o[1]), e[2] < o[0] && (e[2] = o[0]), e[3] < o[1] && (e[3] = o[1]);
4184
4218
  }), e;
4185
4219
  }
4186
- function Ar(n, t = {}) {
4220
+ function Cr(n, t = {}) {
4187
4221
  const e = Number(n[0]), o = Number(n[1]), i = Number(n[2]), r = Number(n[3]);
4188
4222
  if (n.length === 6)
4189
4223
  throw new Error(
4190
4224
  "@turf/bbox-polygon does not support BBox with 6 positions"
4191
4225
  );
4192
4226
  const s = [e, o];
4193
- return An(
4227
+ return Cn(
4194
4228
  [[s, [i, o], [i, r], [e, r], s]],
4195
4229
  t.properties,
4196
4230
  { bbox: n, id: t.id }
4197
4231
  );
4198
4232
  }
4199
- function Br(n) {
4200
- return Ar(Tr(n));
4233
+ function Rr(n) {
4234
+ return Cr(kr(n));
4201
4235
  }
4202
- function Ir(n) {
4203
- return Ko(
4236
+ function Lr(n) {
4237
+ return er(
4204
4238
  n,
4205
- (t, e) => t + kr(e),
4239
+ (t, e) => t + Fr(e),
4206
4240
  0
4207
4241
  );
4208
4242
  }
4209
- function kr(n) {
4243
+ function Fr(n) {
4210
4244
  let t = 0, e;
4211
4245
  switch (n.type) {
4212
4246
  case "Polygon":
4213
- return xn(n.coordinates);
4247
+ return Mn(n.coordinates);
4214
4248
  case "MultiPolygon":
4215
4249
  for (e = 0; e < n.coordinates.length; e++)
4216
- t += xn(n.coordinates[e]);
4250
+ t += Mn(n.coordinates[e]);
4217
4251
  return t;
4218
4252
  case "Point":
4219
4253
  case "MultiPoint":
@@ -4223,69 +4257,69 @@ function kr(n) {
4223
4257
  }
4224
4258
  return 0;
4225
4259
  }
4226
- function xn(n) {
4260
+ function Mn(n) {
4227
4261
  let t = 0;
4228
4262
  if (n && n.length > 0) {
4229
- t += Math.abs(wn(n[0]));
4263
+ t += Math.abs(zn(n[0]));
4230
4264
  for (let e = 1; e < n.length; e++)
4231
- t -= Math.abs(wn(n[e]));
4265
+ t -= Math.abs(zn(n[e]));
4232
4266
  }
4233
4267
  return t;
4234
4268
  }
4235
- var Cr = qt * qt / 2, We = Math.PI / 180;
4236
- function wn(n) {
4269
+ var Or = Yt * Yt / 2, Ye = Math.PI / 180;
4270
+ function zn(n) {
4237
4271
  const t = n.length - 1;
4238
4272
  if (t <= 2) return 0;
4239
4273
  let e = 0, o = 0;
4240
4274
  for (; o < t; ) {
4241
- const i = n[o], r = n[o + 1 === t ? 0 : o + 1], s = n[o + 2 >= t ? (o + 2) % t : o + 2], a = i[0] * We, l = r[1] * We, c = s[0] * We;
4275
+ const i = n[o], r = n[o + 1 === t ? 0 : o + 1], s = n[o + 2 >= t ? (o + 2) % t : o + 2], a = i[0] * Ye, l = r[1] * Ye, c = s[0] * Ye;
4242
4276
  e += (c - a) * Math.sin(l), o++;
4243
4277
  }
4244
- return e * Cr;
4278
+ return e * Or;
4245
4279
  }
4246
- function Lr(n) {
4247
- const t = br(n);
4280
+ function Wr(n) {
4281
+ const t = Vr(n);
4248
4282
  if (!t)
4249
4283
  throw new Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
4250
- const e = On(t), o = Uo(t);
4284
+ const e = Xn(t), o = Jo(t);
4251
4285
  let i = Number.MAX_SAFE_INTEGER, r = null;
4252
4286
  for (let s = 0; s < o.length - 1; s++) {
4253
- let a = Xn(o[s], o[s + 1]), l = yn(t, -1 * a, {
4287
+ let a = Gn(o[s], o[s + 1]), l = Pn(t, -1 * a, {
4254
4288
  pivot: e
4255
- }), c = Br(l), h = Ir(c);
4256
- h < i && (i = h, r = yn(c, a, {
4289
+ }), c = Rr(l), h = Lr(c);
4290
+ h < i && (i = h, r = Pn(c, a, {
4257
4291
  pivot: e
4258
4292
  }));
4259
4293
  }
4260
4294
  return r;
4261
4295
  }
4262
- function bn(n, t) {
4296
+ function Vn(n, t) {
4263
4297
  const e = t[0] - n[0], o = t[1] - n[1];
4264
4298
  return Math.sqrt(e * e + o * o);
4265
4299
  }
4266
- function Rr(n) {
4300
+ function Nr(n) {
4267
4301
  let t = 1 / 0, e = -1 / 0, o = 1 / 0, i = -1 / 0;
4268
4302
  for (const [r, s] of n)
4269
4303
  r < t && (t = r), r > e && (e = r), s < o && (o = s), s > i && (i = s);
4270
4304
  return [(e + t) * 0.5, (i + o) * 0.5];
4271
4305
  }
4272
- class Ae extends Dn {
4306
+ class Ie extends An {
4273
4307
  getBoxMesh() {
4274
- se.identity(), se.setFromMatrix3(this.rotation), se.decompose(_e, ue, new y.Vector3());
4308
+ le.identity(), le.setFromMatrix3(this.rotation), le.decompose(Ee, fe, new y.Vector3());
4275
4309
  const t = this.halfSize.clone().multiplyScalar(2), e = new y.Mesh(new y.BoxGeometry(t.x, t.y, t.z));
4276
- return e.position.copy(this.center), e.rotation.setFromQuaternion(ue), e;
4310
+ return e.position.copy(this.center), e.rotation.setFromQuaternion(fe), e;
4277
4311
  }
4278
4312
  getBoxEdge(t = 16776960) {
4279
4313
  const e = this.getBoxMesh();
4280
- Or.setFromObject(e);
4314
+ Xr.setFromObject(e);
4281
4315
  const o = new y.EdgesGeometry(e.geometry.clone().applyMatrix4(e.matrixWorld));
4282
4316
  return new y.LineSegments(o, new y.LineBasicMaterial({ color: t, toneMapped: !1 }));
4283
4317
  }
4284
4318
  toJson() {
4285
- return se.identity(), se.setFromMatrix3(this.rotation), se.decompose(_e, ue, new y.Vector3()), {
4319
+ return le.identity(), le.setFromMatrix3(this.rotation), le.decompose(Ee, fe, new y.Vector3()), {
4286
4320
  size: this.halfSize.toArray(),
4287
4321
  center: this.center.toArray(),
4288
- quaternion: ue.toArray()
4322
+ quaternion: fe.toArray()
4289
4323
  };
4290
4324
  }
4291
4325
  /**
@@ -4295,11 +4329,11 @@ class Ae extends Dn {
4295
4329
  * @param obb
4296
4330
  * @returns
4297
4331
  */
4298
- static from(t, e, o, i = new Ae()) {
4299
- if (o instanceof y.Euler) ue.setFromEuler(o);
4300
- else if (o instanceof y.Quaternion) ue.copy(o);
4332
+ static from(t, e, o, i = new Ie()) {
4333
+ if (o instanceof y.Euler) fe.setFromEuler(o);
4334
+ else if (o instanceof y.Quaternion) fe.copy(o);
4301
4335
  else throw new Error("传入的旋转不是欧拉角或者四元数");
4302
- return se.compose(e, ue, Fr), i.center.copy(e), i.halfSize.copy(t.multiplyScalar(0.5)), i.rotation.setFromMatrix4(se), i;
4336
+ return le.compose(e, fe, qr), i.center.copy(e), i.halfSize.copy(t.multiplyScalar(0.5)), i.rotation.setFromMatrix4(le), i;
4303
4337
  }
4304
4338
  /** 通过2d路径创建
4305
4339
  * @param path
@@ -4308,22 +4342,22 @@ class Ae extends Dn {
4308
4342
  * @param obb_
4309
4343
  * @returns
4310
4344
  */
4311
- static fromByPath2D(t, e, o, i = new Ae()) {
4312
- const r = Lr({
4345
+ static fromByPath2D(t, e, o, i = new Ie()) {
4346
+ const r = Wr({
4313
4347
  type: "Polygon",
4314
- coordinates: [t.map((g) => [g.x, g.y])]
4348
+ coordinates: [t.map((p) => [p.x, p.y])]
4315
4349
  });
4316
4350
  if (!r) throw new Error("2d obb 获取失败");
4317
- const s = r.geometry.coordinates[0], a = bn(s[0], s[1]), l = bn(s[1], s[2]), c = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
4318
- _e.set(a, l, o), Pn.set(0, 0, c);
4319
- const [h, f] = Rr(s);
4320
- return e.x = h, e.y = f, this.from(_e, e, Pn, i);
4351
+ const s = r.geometry.coordinates[0], a = Vn(s[0], s[1]), l = Vn(s[1], s[2]), c = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
4352
+ Ee.set(a, l, o), Sn.set(0, 0, c);
4353
+ const [h, f] = Nr(s);
4354
+ return e.x = h, e.y = f, this.from(Ee, e, Sn, i);
4321
4355
  }
4322
4356
  }
4323
- const se = new y.Matrix4(), ue = new y.Quaternion(), Pn = new y.Euler(), Fr = new y.Vector3(1, 1, 1), _e = new y.Vector3(), Or = new y.Box3();
4324
- function Wr(n, t, e = 5e-3, o = 0.2) {
4357
+ const le = new y.Matrix4(), fe = new y.Quaternion(), Sn = new y.Euler(), qr = new y.Vector3(1, 1, 1), Ee = new y.Vector3(), Xr = new y.Box3();
4358
+ function Hr(n, t, e = 5e-3, o = 0.2) {
4325
4359
  if (!n.length || !t.length) return 0;
4326
- const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (f, u, g) => `${Math.floor(f / i)},${Math.floor(u / i)},${Math.floor(g / i)}`;
4360
+ const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (f, u, p) => `${Math.floor(f / i)},${Math.floor(u / i)},${Math.floor(p / i)}`;
4327
4361
  for (const f of t) {
4328
4362
  const u = a(f.x, f.y, f.z);
4329
4363
  s.has(u) || s.set(u, []), s.get(u).push(f);
@@ -4332,16 +4366,16 @@ function Wr(n, t, e = 5e-3, o = 0.2) {
4332
4366
  const c = Math.ceil(e / i) + 1, h = [];
4333
4367
  for (let f = -c; f <= c; f++)
4334
4368
  for (let u = -c; u <= c; u++)
4335
- for (let g = -c; g <= c; g++)
4336
- f * f + u * u + g * g <= c * c && h.push([f, u, g]);
4369
+ for (let p = -c; p <= c; p++)
4370
+ f * f + u * u + p * p <= c * c && h.push([f, u, p]);
4337
4371
  for (const f of n) {
4338
- const u = Math.floor(f.x / i), g = Math.floor(f.y / i), w = Math.floor(f.z / i);
4372
+ const u = Math.floor(f.x / i), p = Math.floor(f.y / i), w = Math.floor(f.z / i);
4339
4373
  let x = !1;
4340
4374
  for (const [P, M, m] of h) {
4341
- const d = `${u + P},${g + M},${w + m}`;
4375
+ const d = `${u + P},${p + M},${w + m}`;
4342
4376
  if (s.has(d)) {
4343
- for (const p of s.get(d))
4344
- if (f.distanceToSquared(p) < r) {
4377
+ for (const g of s.get(d))
4378
+ if (f.distanceToSquared(g) < r) {
4345
4379
  x = !0;
4346
4380
  break;
4347
4381
  }
@@ -4353,30 +4387,30 @@ function Wr(n, t, e = 5e-3, o = 0.2) {
4353
4387
  }
4354
4388
  return l / n.length;
4355
4389
  }
4356
- function me(n, t, e = 0.5) {
4390
+ function pe(n, t, e = 0.5) {
4357
4391
  let o = 0, i = 0;
4358
4392
  for (const r of n)
4359
4393
  if (t.containsPoint(r) && (o++, i = o / n.length, i > e))
4360
4394
  break;
4361
4395
  return i;
4362
4396
  }
4363
- function Ne(n, t, e, o) {
4397
+ function $e(n, t, e, o) {
4364
4398
  if (n.intersectsOBB(t))
4365
4399
  return !0;
4366
4400
  {
4367
- const r = ye(n, o), s = ye(t, e);
4401
+ const r = we(n, o), s = we(t, e);
4368
4402
  if (r || s)
4369
4403
  return !0;
4370
4404
  }
4371
4405
  return !1;
4372
4406
  }
4373
- function Mn(n, t) {
4407
+ function vn(n, t) {
4374
4408
  const e = new y.Vector3(), o = new y.Vector3();
4375
4409
  n.getSize(e), t.getSize(o);
4376
4410
  const i = e.x * e.y * e.z, r = o.x * o.y * o.z;
4377
4411
  return i > r ? 1 : i < r ? -1 : 0;
4378
4412
  }
4379
- function ye(n, t) {
4413
+ function we(n, t) {
4380
4414
  let e = !0;
4381
4415
  for (let o = 0; o < t.length; o++)
4382
4416
  if (!n.containsPoint(t[o])) {
@@ -4385,7 +4419,7 @@ function ye(n, t) {
4385
4419
  }
4386
4420
  return e;
4387
4421
  }
4388
- function zn(n) {
4422
+ function Dn(n) {
4389
4423
  if (n.length === 0)
4390
4424
  return { x: 0, y: 0, z: 0, h: 0 };
4391
4425
  let t = 0, e = 0, o = -1 / 0, i = 1 / 0;
@@ -4400,7 +4434,7 @@ function zn(n) {
4400
4434
  h: o - i
4401
4435
  };
4402
4436
  }
4403
- function Vn(n, t, e, o) {
4437
+ function _n(n, t, e, o) {
4404
4438
  const i = [];
4405
4439
  for (let s = 0; s < n.length; s++)
4406
4440
  i.push(new y.Vector3(
@@ -4410,10 +4444,10 @@ function Vn(n, t, e, o) {
4410
4444
  ));
4411
4445
  if (i.length == 0)
4412
4446
  return null;
4413
- const r = Ae.fromByPath2D(i, t, e);
4447
+ const r = Ie.fromByPath2D(i, t, e);
4414
4448
  return r.center.z = o, r;
4415
4449
  }
4416
- const hi = (n) => {
4450
+ const gi = (n) => {
4417
4451
  if (n.length == 0) return [];
4418
4452
  const t = [], e = /* @__PURE__ */ new Map();
4419
4453
  for (let r = 0; r < n.length; r++) {
@@ -4435,8 +4469,8 @@ const hi = (n) => {
4435
4469
  for (let m = 0; m < n[r].points.length; m++) {
4436
4470
  let d = n[r].points[m].z;
4437
4471
  if (d = Math.floor(d * 10) / 10, P.has(d)) {
4438
- const p = P.get(d);
4439
- p.num += 1, p.points.push(n[r].points[m]), P.set(d, p);
4472
+ const g = P.get(d);
4473
+ g.num += 1, g.points.push(n[r].points[m]), P.set(d, g);
4440
4474
  } else
4441
4475
  P.set(d, { num: 1, points: [n[r].points[m]] });
4442
4476
  }
@@ -4445,13 +4479,13 @@ const hi = (n) => {
4445
4479
  );
4446
4480
  s = [], s = M[1].points.map((m) => [m.x, m.y]), f = [], f = M[1].points.map((m) => new y.Vector3(m.x, m.y, m.z)), u = M[0];
4447
4481
  }
4448
- const g = zn(f), w = {
4482
+ const p = Dn(f), w = {
4449
4483
  points: f,
4450
- path: rn(s),
4451
- h: g.h,
4452
- minz: g.minz,
4453
- maxz: g.maxz,
4454
- center: { x: g.x, y: g.y, z: g.z },
4484
+ path: cn(s),
4485
+ h: p.h,
4486
+ minz: p.minz,
4487
+ maxz: p.maxz,
4488
+ center: { x: p.x, y: p.y, z: p.z },
4455
4489
  obj_id: n[r].obj_id,
4456
4490
  type: h,
4457
4491
  averagePz: n[r].averagePz,
@@ -4460,7 +4494,7 @@ const hi = (n) => {
4460
4494
  obj_id: a,
4461
4495
  positionArr: [n[r].position]
4462
4496
  };
4463
- if (w.obb = Vn(w.path, w.center, w.h, (w.maxz + w.minz) / 2), w.obb == null) continue;
4497
+ if (w.obb = _n(w.path, w.center, w.h, (w.maxz + w.minz) / 2), w.obb == null) continue;
4464
4498
  let x = -1;
4465
4499
  for (let P = 0; P < t.length; P++)
4466
4500
  if (t[P].type == h) {
@@ -4507,9 +4541,9 @@ const hi = (n) => {
4507
4541
  for (let P = 0; P < s[u].points.length; P++)
4508
4542
  (s[u].points[P].z > o && s[u].points[P].z - o > 0.1 || f.type == "floor") && f.points.push(s[u].points[P]);
4509
4543
  const w = f.points.map((P) => [P.x, P.y]);
4510
- f.path = rn(w);
4511
- const x = zn(f.points);
4512
- f.h = x.h, f.minz = x.minz, f.maxz = x.maxz, f.center = { x: x.x, y: x.y, z: x.z }, f.obb = Vn(f.path, f.center, f.h, (f.maxz + f.minz) / 2), f.positionArr.push(...s[u].positionArr), u = h;
4544
+ f.path = cn(w);
4545
+ const x = Dn(f.points);
4546
+ f.h = x.h, f.minz = x.minz, f.maxz = x.maxz, f.center = { x: x.x, y: x.y, z: x.z }, f.obb = _n(f.path, f.center, f.h, (f.maxz + f.minz) / 2), f.positionArr.push(...s[u].positionArr), u = h;
4513
4547
  }
4514
4548
  }
4515
4549
  f.path.length > s[h].path.length && (a.push(h), l.push(f));
@@ -4531,9 +4565,9 @@ const hi = (n) => {
4531
4565
  if (s === "window" || s === "door" || s === "tv" || s === "chair" || s === "cabinet" || s === "table") {
4532
4566
  const u = new y.Vector3();
4533
4567
  c.getSize(u);
4534
- const g = [u.x, u.y, u.z];
4568
+ const p = [u.x, u.y, u.z];
4535
4569
  let w = 0;
4536
- for (const x of g)
4570
+ for (const x of p)
4537
4571
  if (x < 0.2 && (w++, w === 2)) {
4538
4572
  a[l].isDel = !0;
4539
4573
  break;
@@ -4541,70 +4575,70 @@ const hi = (n) => {
4541
4575
  }
4542
4576
  if (!a[l].isDel)
4543
4577
  for (let u = r + 1; u < t.length; u++) {
4544
- const g = t[u].type;
4545
- if (g === "people" || g === "floor")
4578
+ const p = t[u].type;
4579
+ if (p === "people" || p === "floor")
4546
4580
  continue;
4547
4581
  const w = t[u].array;
4548
4582
  for (let x = 0; x < w.length; x++) {
4549
4583
  if (w[x].isDel) continue;
4550
4584
  const P = w[x].obb, M = w[x].minz;
4551
4585
  if (w[x].maxz, c.intersectsOBB(P)) {
4552
- me(w[x].points, c);
4553
- const m = me(a[l].points, P), d = Mn(c, P);
4586
+ pe(w[x].points, c);
4587
+ const m = pe(a[l].points, P), d = vn(c, P);
4554
4588
  if (m >= 0.3 && d == -1) {
4555
4589
  a[l].isDel = !0;
4556
4590
  break;
4557
4591
  }
4558
4592
  if (s !== "wall" && s !== "floor" && s !== "roof") {
4559
4593
  if (s === "window") {
4560
- if (g === "balcony railing" && ye(c, w[x].points)) {
4594
+ if (p === "balcony railing" && we(c, w[x].points)) {
4561
4595
  w[x].isDel = !0;
4562
4596
  continue;
4563
4597
  }
4564
- if (g === "balcony railing" && ye(P, a[l].points)) {
4598
+ if (p === "balcony railing" && we(P, a[l].points)) {
4565
4599
  a[l].isDel = !0;
4566
4600
  break;
4567
4601
  }
4568
- if (g === "balcony railing" && Ne(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - f) > 0.3)) {
4602
+ if (p === "balcony railing" && $e(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - f) > 0.3)) {
4569
4603
  w[x].isDel = !0;
4570
4604
  continue;
4571
4605
  }
4572
4606
  } else if (s === "balcony railing") {
4573
- if (g === "window" && ye(c, w[x].points)) {
4607
+ if (p === "window" && we(c, w[x].points)) {
4574
4608
  w[x].isDel = !0;
4575
4609
  continue;
4576
4610
  }
4577
- if (g === "window" && ye(P, a[l].points)) {
4611
+ if (p === "window" && we(P, a[l].points)) {
4578
4612
  a[l].isDel = !0;
4579
4613
  break;
4580
4614
  }
4581
- if (g === "window" && Ne(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - f) > 0.3)) {
4615
+ if (p === "window" && $e(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - f) > 0.3)) {
4582
4616
  a[l].isDel = !0;
4583
4617
  break;
4584
4618
  }
4585
4619
  }
4586
- let p = !1, b = [], V = [];
4620
+ let g = !1, b = [], V = [];
4587
4621
  const v = a[l].points, S = w[x].points;
4588
- if (v.length > S.length ? (p = !0, b = v, V = S) : (b = S, V = v), Wr(V, b, 0.03, 0.5) > 0.5)
4589
- if (p)
4622
+ if (v.length > S.length ? (g = !0, b = v, V = S) : (b = S, V = v), Hr(V, b, 0.03, 0.5) > 0.5)
4623
+ if (g)
4590
4624
  w[x].isDel = !0;
4591
4625
  else {
4592
4626
  a[l].isDel = !0;
4593
4627
  break;
4594
4628
  }
4595
- else if (Ne(c, P)) {
4596
- const D = Mn(c, P);
4629
+ else if ($e(c, P)) {
4630
+ const D = vn(c, P);
4597
4631
  if (D === 1 || D === 0) {
4598
- if (g === "switch") continue;
4599
- v.length > S.length ? me(V, c) >= 0.5 && (w[x].isDel = !0) : me(b, c) >= 0.5 && (w[x].isDel = !0);
4632
+ if (p === "switch") continue;
4633
+ v.length > S.length ? pe(V, c) >= 0.5 && (w[x].isDel = !0) : pe(b, c) >= 0.5 && (w[x].isDel = !0);
4600
4634
  } else {
4601
4635
  if (s === "switch") continue;
4602
4636
  if (v.length > S.length) {
4603
- if (me(b, P) >= 0.5) {
4637
+ if (pe(b, P) >= 0.5) {
4604
4638
  a[l].isDel = !0;
4605
4639
  break;
4606
4640
  }
4607
- } else if (me(V, P) >= 0.5) {
4641
+ } else if (pe(V, P) >= 0.5) {
4608
4642
  a[l].isDel = !0;
4609
4643
  break;
4610
4644
  }
@@ -4627,12 +4661,12 @@ const hi = (n) => {
4627
4661
  continue;
4628
4662
  }
4629
4663
  if (s === "window" || s === "door" || s === "tv") {
4630
- const g = Math.abs(c - u), w = Math.abs(h - u);
4631
- (s === "tv" && w < 1.6 || s !== "window" && g < 1.6) && (a[l].isDel = !0), s === "window" && g < 1 && (a[l].isDel = !0);
4664
+ const p = Math.abs(c - u), w = Math.abs(h - u);
4665
+ (s === "tv" && w < 1.6 || s !== "window" && p < 1.6) && (a[l].isDel = !0), s === "window" && p < 1 && (a[l].isDel = !0);
4632
4666
  }
4633
4667
  if (s === "chair") {
4634
- const g = new y.Vector3();
4635
- a[l].obb.getSize(g), (g.x < 0.1 || g.y < 0.1 || g.z < 0.2) && (a[l].isDel = !0);
4668
+ const p = new y.Vector3();
4669
+ a[l].obb.getSize(p), (p.x < 0.1 || p.y < 0.1 || p.z < 0.2) && (a[l].isDel = !0);
4636
4670
  }
4637
4671
  s === "balcony railing" && (Math.abs(c - h) < 0.4 && (a[l].isDel = !0), (h < u && Math.abs(h - u) > 1 || h > u && Math.abs(h - u) > 1) && (a[l].isDel = !0), c < u && (a[l].isDel = !0)), s === "people" && (Math.abs(c - h) < 1 && (a[l].isDel = !0), h > u && h - u > 0.3 && (a[l].isDel = !0), c < u && (a[l].isDel = !0)), s === "floor" && a[l].points.length < 500 && (a[l].isDel = !0);
4638
4672
  }
@@ -4656,11 +4690,11 @@ const hi = (n) => {
4656
4690
  }
4657
4691
  return i;
4658
4692
  };
4659
- function xe(n, t) {
4693
+ function be(n, t) {
4660
4694
  const e = n.x - t.x, o = n.y - t.y;
4661
4695
  return Math.sqrt(e * e + o * o);
4662
4696
  }
4663
- function Nr(n) {
4697
+ function Yr(n) {
4664
4698
  let t = 0, e = 0, o = 0;
4665
4699
  for (let i = 0; i < 4; i++) {
4666
4700
  const r = n[i], s = n[(i + 1) % 4], a = s.x - r.x, l = s.y - r.y, c = Math.sqrt(a * a + l * l);
@@ -4668,7 +4702,7 @@ function Nr(n) {
4668
4702
  }
4669
4703
  return { longSide: t, dirX: e, dirY: o };
4670
4704
  }
4671
- function Hn(n, t, e) {
4705
+ function jn(n, t, e) {
4672
4706
  const i = [];
4673
4707
  for (const r of n) {
4674
4708
  const s = (r.start.x + r.end.x) / 2, a = (r.start.y + r.end.y) / 2, l = s - t, c = a - e;
@@ -4681,41 +4715,41 @@ function Hn(n, t, e) {
4681
4715
  }
4682
4716
  return i.sort((r, s) => r - s), i[Math.floor(i.length / 2)];
4683
4717
  }
4684
- function Yn(n, t, e, o, i, r) {
4718
+ function Un(n, t, e, o, i, r) {
4685
4719
  const s = i - e, a = r - o, l = s * s + a * a;
4686
4720
  if (l < 1e-12)
4687
4721
  return { dist: Math.sqrt((n - e) ** 2 + (t - o) ** 2), t: 0 };
4688
- const c = n - e, h = t - o, f = (c * s + h * a) / l, u = e + f * s, g = o + f * a;
4689
- return { dist: Math.sqrt((n - u) ** 2 + (t - g) ** 2), t: f };
4722
+ const c = n - e, h = t - o, f = (c * s + h * a) / l, u = e + f * s, p = o + f * a;
4723
+ return { dist: Math.sqrt((n - u) ** 2 + (t - p) ** 2), t: f };
4690
4724
  }
4691
- function qr(n, t, e = 0.15) {
4725
+ function $r(n, t, e = 0.15) {
4692
4726
  let o = 0, i = 0;
4693
4727
  for (const s of t)
4694
- s !== n && ((xe(n.start, s.start) <= e || xe(n.start, s.end) <= e) && o++, (xe(n.end, s.start) <= e || xe(n.end, s.end) <= e) && i++);
4728
+ s !== n && ((be(n.start, s.start) <= e || be(n.start, s.end) <= e) && o++, (be(n.end, s.start) <= e || be(n.end, s.end) <= e) && i++);
4695
4729
  let r = 0;
4696
4730
  return o >= 1 && i >= 1 ? r = 5 : (o >= 1 || i >= 1) && (r = 2), { left: o, right: i, score: r };
4697
4731
  }
4698
- function Xr(n, t) {
4732
+ function Gr(n, t) {
4699
4733
  const e = [], { start: o, end: i } = n;
4700
4734
  for (const a of t) {
4701
- const { dist: l } = Yn(a.x, a.y, o.x, o.y, i.x, i.y);
4735
+ const { dist: l } = Un(a.x, a.y, o.x, o.y, i.x, i.y);
4702
4736
  e.push(l);
4703
4737
  }
4704
4738
  const r = e.reduce((a, l) => a + l, 0) / e.length, s = e.reduce((a, l) => a + (l - r) ** 2, 0) / e.length;
4705
4739
  return s < 0.01 ? 3 : s < 0.05 ? 2 : s < 0.1 ? 1 : 0;
4706
4740
  }
4707
- function Hr(n, t, e = 0.15) {
4741
+ function jr(n, t, e = 0.15) {
4708
4742
  const o = n.end.x - n.start.x, i = n.end.y - n.start.y, r = Math.sqrt(o * o + i * i);
4709
4743
  if (r < 1e-12) return 0;
4710
4744
  const s = -i / r, a = o / r, l = [[], []];
4711
4745
  for (let f = 0; f < 2; f++) {
4712
4746
  const u = f === 0 ? n.start : n.end;
4713
- for (const g of t) {
4714
- if (g === n) continue;
4715
- const w = xe(u, g.start), x = xe(u, g.end);
4747
+ for (const p of t) {
4748
+ if (p === n) continue;
4749
+ const w = be(u, p.start), x = be(u, p.end);
4716
4750
  let P = null;
4717
- if (w <= e ? P = g.end : x <= e && (P = g.start), !P) continue;
4718
- const M = g.end.x - g.start.x, m = g.end.y - g.start.y, d = Math.sqrt(M * M + m * m);
4751
+ if (w <= e ? P = p.end : x <= e && (P = p.start), !P) continue;
4752
+ const M = p.end.x - p.start.x, m = p.end.y - p.start.y, d = Math.sqrt(M * M + m * m);
4719
4753
  if (d < 1e-12 || Math.abs(o * M + i * m) / (r * d) >= 0.342) continue;
4720
4754
  const b = (P.x - u.x) * s + (P.y - u.y) * a;
4721
4755
  l[f].push(b > 0 ? 1 : -1);
@@ -4725,16 +4759,16 @@ function Hr(n, t, e = 0.15) {
4725
4759
  const c = [...l[0], ...l[1]];
4726
4760
  return c.every((f) => f === c[0]) ? 2 : 1;
4727
4761
  }
4728
- function Yr(n, t, e) {
4729
- const o = qr(n, e), i = Xr(n, t), r = Hr(n, e);
4762
+ function Ur(n, t, e) {
4763
+ const o = $r(n, e), i = Gr(n, t), r = jr(n, e);
4730
4764
  return { score: o.score * 3 + i * 2 + r * 2, details: { conn: o.score, variance: i, sameSide: r } };
4731
4765
  }
4732
- function $r(n) {
4766
+ function Zr(n) {
4733
4767
  const t = n.end.x - n.start.x, e = n.end.y - n.start.y;
4734
4768
  let o = Math.atan2(e, t) * (180 / Math.PI);
4735
4769
  return o < 0 && (o += 180), o;
4736
4770
  }
4737
- function Gr(n, t) {
4771
+ function Kr(n, t) {
4738
4772
  const e = [];
4739
4773
  for (const o of n) {
4740
4774
  let i = !1;
@@ -4749,7 +4783,7 @@ function Gr(n, t) {
4749
4783
  }
4750
4784
  return e;
4751
4785
  }
4752
- function jr(n, t = 0.05) {
4786
+ function Qr(n, t = 0.05) {
4753
4787
  const e = [];
4754
4788
  for (const o of n) {
4755
4789
  let i = !1;
@@ -4762,7 +4796,7 @@ function jr(n, t = 0.05) {
4762
4796
  }
4763
4797
  return e;
4764
4798
  }
4765
- function Ur(n, t, e, o, i) {
4799
+ function Jr(n, t, e, o, i) {
4766
4800
  const r = [];
4767
4801
  for (const a of n) {
4768
4802
  const l = a.seg, c = (l.start.x - t.start.x) * e + (l.start.y - t.start.y) * o, h = (l.end.x - t.start.x) * e + (l.end.y - t.start.y) * o;
@@ -4780,11 +4814,11 @@ function Ur(n, t, e, o, i) {
4780
4814
  }
4781
4815
  return s;
4782
4816
  }
4783
- function Zr(n, t, e, o, i, r, s) {
4817
+ function ti(n, t, e, o, i, r, s) {
4784
4818
  const a = e - t, l = { ...n };
4785
4819
  return l.start = { x: n.start.x + t * o, y: n.start.y + t * i, z: n.start.z }, l.end = { x: n.start.x + e * o, y: n.start.y + e * i, z: n.start.z }, l.length = a, l.direction = { x: o, y: i, z: 0 }, l.rooftopPz = r, l.buildRosource = s, l.isRebuild = !1, l.doorAndBeamData || (l.doorAndBeamData = []), l.insetionArr || (l.insetionArr = []), l;
4786
4820
  }
4787
- function Kr(n, t) {
4821
+ function ei(n, t) {
4788
4822
  let e = !0;
4789
4823
  for (; e; ) {
4790
4824
  e = !1;
@@ -4795,64 +4829,64 @@ function Kr(n, t) {
4795
4829
  continue;
4796
4830
  const a = Math.abs(r.end.x - s.start.x) < 1e-3 && Math.abs(r.end.y - s.start.y) < 1e-3, l = Math.abs(r.start.x - s.end.x) < 1e-3 && Math.abs(r.start.y - s.end.y) < 1e-3, c = Math.abs(r.end.x - s.end.x) < 1e-3 && Math.abs(r.end.y - s.end.y) < 1e-3, h = Math.abs(r.start.x - s.start.x) < 1e-3 && Math.abs(r.start.y - s.start.y) < 1e-3;
4797
4831
  if (!(a || l || c || h) || r.direction.x * s.direction.x + r.direction.y * s.direction.y < 0.98) continue;
4798
- let u = r.start, g = r.end;
4799
- a ? g = s.end : l ? u = s.start : c ? g = s.start : h && (u = s.end);
4800
- const w = Math.hypot(g.x - u.x, g.y - u.y), x = { ...r };
4801
- x.start = u, x.end = g, x.length = w, x.direction = { x: (g.x - u.x) / w, y: (g.y - u.y) / w, z: 0 }, x.rooftopPz = r.rooftopPz !== void 0 ? r.rooftopPz : s.rooftopPz, x.buildRosource = r.buildRosource || s.buildRosource, x.isRebuild = !1, x.doorAndBeamData || (x.doorAndBeamData = []), x.insetionArr || (x.insetionArr = []), n[o] = x, t[o] = [.../* @__PURE__ */ new Set([...t[o], ...t[i]])], n.splice(i, 1), t.splice(i, 1), i--, e = !0;
4832
+ let u = r.start, p = r.end;
4833
+ a ? p = s.end : l ? u = s.start : c ? p = s.start : h && (u = s.end);
4834
+ const w = Math.hypot(p.x - u.x, p.y - u.y), x = { ...r };
4835
+ x.start = u, x.end = p, x.length = w, x.direction = { x: (p.x - u.x) / w, y: (p.y - u.y) / w, z: 0 }, x.rooftopPz = r.rooftopPz !== void 0 ? r.rooftopPz : s.rooftopPz, x.buildRosource = r.buildRosource || s.buildRosource, x.isRebuild = !1, x.doorAndBeamData || (x.doorAndBeamData = []), x.insetionArr || (x.insetionArr = []), n[o] = x, t[o] = [.../* @__PURE__ */ new Set([...t[o], ...t[i]])], n.splice(i, 1), t.splice(i, 1), i--, e = !0;
4802
4836
  }
4803
4837
  }
4804
4838
  return { segments: n, sourceMap: t };
4805
4839
  }
4806
- function $n(n, t = 5, e = 0.05) {
4840
+ function Zn(n, t = 5, e = 0.05) {
4807
4841
  if (n.length <= 1)
4808
4842
  return { segments: n, sourceMap: n.map((l, c) => [c]) };
4809
- const o = n.map((l, c) => ({ seg: l, angle: $r(l), idx: c }));
4843
+ const o = n.map((l, c) => ({ seg: l, angle: Zr(l), idx: c }));
4810
4844
  o.sort((l, c) => l.angle - c.angle);
4811
- const i = Gr(o, t), r = [], s = [], a = [];
4845
+ const i = Kr(o, t), r = [], s = [], a = [];
4812
4846
  for (const l of i) {
4813
4847
  let c = l[0].seg;
4814
4848
  for (const M of l)
4815
4849
  M.seg.length > c.length && (c = M.seg);
4816
4850
  const h = c.end.x - c.start.x, f = c.end.y - c.start.y, u = Math.sqrt(h * h + f * f);
4817
4851
  if (u < 1e-12) continue;
4818
- const g = -f / u, w = h / u, x = l.map((M) => {
4852
+ const p = -f / u, w = h / u, x = l.map((M) => {
4819
4853
  const m = M.seg.start.x - c.start.x, d = M.seg.start.y - c.start.y;
4820
- return { seg: M.seg, offset: Math.abs(m * g + d * w), idx: M.idx };
4854
+ return { seg: M.seg, offset: Math.abs(m * p + d * w), idx: M.idx };
4821
4855
  });
4822
4856
  x.sort((M, m) => M.offset - m.offset);
4823
- const P = jr(x);
4857
+ const P = Qr(x);
4824
4858
  for (const M of P) {
4825
4859
  let m = M[0].seg;
4826
- for (const E of M)
4827
- E.seg.length > m.length && (m = E.seg);
4828
- const d = m.end.x - m.start.x, p = m.end.y - m.start.y, b = Math.sqrt(d * d + p * p);
4860
+ for (const T of M)
4861
+ T.seg.length > m.length && (m = T.seg);
4862
+ const d = m.end.x - m.start.x, g = m.end.y - m.start.y, b = Math.sqrt(d * d + g * g);
4829
4863
  if (b < 1e-12) continue;
4830
- const V = d / b, v = p / b, S = M.map((E) => E.seg.rooftopPz ?? 0), z = Math.max(...S), D = [...new Set(S.map((E) => E.toFixed(3)))];
4864
+ const V = d / b, v = g / b, S = M.map((T) => T.seg.rooftopPz ?? 0), z = Math.max(...S), D = [...new Set(S.map((T) => T.toFixed(3)))];
4831
4865
  if (D.length > 1) {
4832
- const E = M.map((T) => ({
4833
- idx: T.idx,
4834
- start: { x: T.seg.start.x, y: T.seg.start.y, z: T.seg.start.z },
4835
- end: { x: T.seg.end.x, y: T.seg.end.y, z: T.seg.end.z },
4836
- length: T.seg.length,
4837
- rooftopPz: T.seg.rooftopPz ?? 0
4866
+ const T = M.map((E) => ({
4867
+ idx: E.idx,
4868
+ start: { x: E.seg.start.x, y: E.seg.start.y, z: E.seg.start.z },
4869
+ end: { x: E.seg.end.x, y: E.seg.end.y, z: E.seg.end.z },
4870
+ length: E.seg.length,
4871
+ rooftopPz: E.seg.rooftopPz ?? 0
4838
4872
  }));
4839
- a.push({ values: [...D], segments: E });
4873
+ a.push({ values: [...D], segments: T });
4840
4874
  }
4841
- [...new Set(M.map((E) => String(E.seg.buildRosource)))];
4842
- const _ = Ur(M, m, V, v, e);
4843
- for (const { l: E, r: T, srcIdxs: A } of _) {
4844
- if (T - E < 0.01) continue;
4845
- const O = Zr(m, E, T, V, v, z, m.buildRosource);
4875
+ [...new Set(M.map((T) => String(T.seg.buildRosource)))];
4876
+ const _ = Jr(M, m, V, v, e);
4877
+ for (const { l: T, r: E, srcIdxs: A } of _) {
4878
+ if (E - T < 0.01) continue;
4879
+ const O = ti(m, T, E, V, v, z, m.buildRosource);
4846
4880
  r.push(O), s.push(A);
4847
4881
  }
4848
4882
  }
4849
4883
  }
4850
4884
  return {
4851
- ...Kr(r, s),
4885
+ ...ei(r, s),
4852
4886
  debugRPZGroups: a
4853
4887
  };
4854
4888
  }
4855
- function Qr(n) {
4889
+ function ni(n) {
4856
4890
  return {
4857
4891
  minLengthRatio: 0.95,
4858
4892
  maxDistance: 0.5,
@@ -4862,7 +4896,7 @@ function Qr(n) {
4862
4896
  ...n
4863
4897
  };
4864
4898
  }
4865
- function Jr(n, t, e) {
4899
+ function oi(n, t, e) {
4866
4900
  return [
4867
4901
  { x: t, y: e, z: 0 },
4868
4902
  { x: n[0].x, y: n[0].y, z: 0 },
@@ -4871,7 +4905,7 @@ function Jr(n, t, e) {
4871
4905
  { x: n[3].x, y: n[3].y, z: 0 }
4872
4906
  ];
4873
4907
  }
4874
- function ti(n, t, e, o, i, r, s) {
4908
+ function ri(n, t, e, o, i, r, s) {
4875
4909
  const a = [
4876
4910
  { margin: r.projectionMargin, maxDist: r.maxDistance, label: "严格" },
4877
4911
  { margin: 0.4, maxDist: 0.65, label: "宽松" }
@@ -4883,19 +4917,19 @@ function ti(n, t, e, o, i, r, s) {
4883
4917
  const f = t * r.minLengthRatio;
4884
4918
  if (h.length < f)
4885
4919
  continue;
4886
- const { start: u, end: g } = h;
4920
+ const { start: u, end: p } = h;
4887
4921
  let w = !1, x = 1 / 0;
4888
4922
  for (const S of i) {
4889
- const { dist: z, t: D } = Yn(S.x, S.y, u.x, u.y, g.x, g.y);
4923
+ const { dist: z, t: D } = Un(S.x, S.y, u.x, u.y, p.x, p.y);
4890
4924
  D >= -c.margin && D <= 1 + c.margin && z <= c.maxDist && (w = !0, x = Math.min(x, z));
4891
4925
  }
4892
4926
  if (!w) {
4893
4927
  `${c.maxDist}${(-c.margin).toFixed(1)}${(1 + c.margin).toFixed(1)}`;
4894
4928
  continue;
4895
4929
  }
4896
- const P = Math.sqrt((g.x - u.x) ** 2 + (g.y - u.y) ** 2);
4930
+ const P = Math.sqrt((p.x - u.x) ** 2 + (p.y - u.y) ** 2);
4897
4931
  if (P < 1e-12) continue;
4898
- const M = (g.x - u.x) / P, m = (g.y - u.y) / P, d = Math.abs(e * M + o * m), p = Math.abs(-o * M + e * m), b = Math.max(d, p), V = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
4932
+ const M = (p.x - u.x) / P, m = (p.y - u.y) / P, d = Math.abs(e * M + o * m), g = Math.abs(-o * M + e * m), b = Math.max(d, g), V = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
4899
4933
  if (V > r.angleThreshold) {
4900
4934
  `${V.toFixed(1)}${r.angleThreshold}`;
4901
4935
  continue;
@@ -4904,7 +4938,7 @@ function ti(n, t, e, o, i, r, s) {
4904
4938
  if (P > 0.01) {
4905
4939
  const S = [];
4906
4940
  for (let _ = 1; _ <= 4; _++) {
4907
- const E = i[_], T = E.x - u.x, A = E.y - u.y, O = (T * M + A * m) / P;
4941
+ const T = i[_], E = T.x - u.x, A = T.y - u.y, O = (E * M + A * m) / P;
4908
4942
  S.push(O);
4909
4943
  }
4910
4944
  const z = Math.min(...S), D = Math.max(...S);
@@ -4922,66 +4956,66 @@ function ti(n, t, e, o, i, r, s) {
4922
4956
  }
4923
4957
  return l;
4924
4958
  }
4925
- function ei(n, t, e, o) {
4959
+ function ii(n, t, e, o) {
4926
4960
  if (n.length <= 1)
4927
4961
  return n.length === 1 && (n[0].score = -1), n;
4928
4962
  for (const i of n) {
4929
- const { score: r, details: s } = Yr(i.seg, t, e);
4963
+ const { score: r, details: s } = Ur(i.seg, t, e);
4930
4964
  i.score = r, i.details = s;
4931
4965
  }
4932
4966
  return n.sort((i, r) => r.embedRatio - i.embedRatio || r.score - i.score || i.minDist - r.minDist), n;
4933
4967
  }
4934
- function ni(n, t, e, o) {
4968
+ function si(n, t, e, o) {
4935
4969
  const i = n.end.x - n.start.x, r = n.end.y - n.start.y, s = Math.sqrt(i * i + r * r), a = i / s, l = r / s, c = t.map((v) => {
4936
4970
  const S = v.x - n.start.x, z = v.y - n.start.y;
4937
4971
  return (S * a + z * l) / s;
4938
- }), h = Math.min(...c), f = Math.max(...c), u = (f - h) * s, g = (h + f) / 2, w = n.start.x + g * i, x = n.start.y + g * r, P = e.box.min.z, M = e.box.max.z, m = Math.abs(M - P), d = Hn(o, n.start.x, n.start.y), p = Math.max(0, P - d), b = h <= 0 && f >= 1, V = n.start.z + g * (n.end.z - n.start.z);
4972
+ }), h = Math.min(...c), f = Math.max(...c), u = (f - h) * s, p = (h + f) / 2, w = n.start.x + p * i, x = n.start.y + p * r, P = e.box.min.z, M = e.box.max.z, m = Math.abs(M - P), d = jn(o, n.start.x, n.start.y), g = Math.max(0, P - d), b = h <= 0 && f >= 1, V = n.start.z + p * (n.end.z - n.start.z);
4939
4973
  return {
4940
4974
  p: { x: w, y: x, z: V },
4941
4975
  width: u,
4942
4976
  full: b,
4943
4977
  height: m,
4944
- groundClearance: p
4978
+ groundClearance: g
4945
4979
  };
4946
4980
  }
4947
- function Gn(n, t, e) {
4948
- var h, f, u, g, w;
4981
+ function Kn(n, t, e) {
4982
+ var h, f, u, p, w;
4949
4983
  const o = t.map((x) => e[x]), i = [], r = [], s = [], a = [], l = [];
4950
4984
  let c;
4951
4985
  for (const x of o) {
4952
4986
  if ((h = x.points) != null && h.length) for (const P of x.points) i.push(P);
4953
4987
  if ((f = x.originalPoints) != null && f.length) for (const P of x.originalPoints) r.push(P);
4954
4988
  if ((u = x.doorAndBeamData) != null && u.length) for (const P of x.doorAndBeamData) s.push(P);
4955
- if ((g = x.insetionArr) != null && g.length) for (const P of x.insetionArr) a.push(P);
4989
+ if ((p = x.insetionArr) != null && p.length) for (const P of x.insetionArr) a.push(P);
4956
4990
  if ((w = x.drawWindow) != null && w.length) for (const P of x.drawWindow) l.push(P);
4957
4991
  x.boxData && !c && (c = x.boxData);
4958
4992
  }
4959
4993
  i.length && (n.points = i), r.length && (n.originalPoints = r), s.length && (n.doorAndBeamData = s), a.length && (n.insetionArr = a), l.length && (n.drawWindow = l), c && (n.boxData = c);
4960
4994
  }
4961
- function oi(n, t, e) {
4995
+ function ai(n, t, e) {
4962
4996
  var l;
4963
- const o = Qr(e), i = [], { segments: r, sourceMap: s } = $n(t), a = r;
4997
+ const o = ni(e), i = [], { segments: r, sourceMap: s } = Zn(t), a = r;
4964
4998
  for (const c of n) {
4965
4999
  const h = (l = c.coordinatesByArea) == null ? void 0 : l.coordinates;
4966
5000
  if (!h || h.length < 4)
4967
5001
  continue;
4968
- const f = h.slice(0, 4), u = f.reduce((z, D) => z + D.x, 0) / 4, g = f.reduce((z, D) => z + D.y, 0) / 4, { longSide: w, dirX: x, dirY: P } = Nr(f);
5002
+ const f = h.slice(0, 4), u = f.reduce((z, D) => z + D.x, 0) / 4, p = f.reduce((z, D) => z + D.y, 0) / 4, { longSide: w, dirX: x, dirY: P } = Yr(f);
4969
5003
  if (w < 0.01)
4970
5004
  continue;
4971
- const M = f.reduce((z, D) => z + D.z, 0) / 4, m = Hn(t, u, g);
5005
+ const M = f.reduce((z, D) => z + D.z, 0) / 4, m = jn(t, u, p);
4972
5006
  if (M < m - 0.3)
4973
5007
  continue;
4974
- const d = Jr(f, u, g);
5008
+ const d = oi(f, u, p);
4975
5009
  c.name;
4976
- let p = ti(a, w, x, P, d, o, c.name);
4977
- p = ei(p, d, t, c.name);
5010
+ let g = ri(a, w, x, P, d, o, c.name);
5011
+ g = ii(g, d, t, c.name);
4978
5012
  let b = null, V = 1 / 0, v = 0;
4979
- if (p.length > 0) {
4980
- const z = p[0];
5013
+ if (g.length > 0) {
5014
+ const z = g[0];
4981
5015
  b = z.seg, V = z.minDist, v = z.ratio;
4982
5016
  }
4983
5017
  let S;
4984
- if (b && (S = ni(b, f, c, r), !o.printOnly)) {
5018
+ if (b && (S = si(b, f, c, r), !o.printOnly)) {
4985
5019
  const z = b;
4986
5020
  z.drawWindow || (z.drawWindow = []), z.drawWindow.push(S);
4987
5021
  }
@@ -4999,18 +5033,18 @@ function oi(n, t, e) {
4999
5033
  const h = c.wallSegment, f = r.indexOf(h);
5000
5034
  if (f === -1) continue;
5001
5035
  const u = s[f];
5002
- !u || u.length <= 1 || Gn(h, u, t);
5036
+ !u || u.length <= 1 || Kn(h, u, t);
5003
5037
  }
5004
5038
  return i;
5005
5039
  }
5006
- function fi(n, t, e) {
5040
+ function pi(n, t, e) {
5007
5041
  const o = {
5008
5042
  printOnly: !1,
5009
5043
  ...e
5010
- }, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], r = oi(i, n, o), { segments: s, sourceMap: a } = $n(n);
5044
+ }, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], r = ai(i, n, o), { segments: s, sourceMap: a } = Zn(n);
5011
5045
  for (let c = 0; c < s.length; c++) {
5012
5046
  const h = a[c];
5013
- h && Gn(s[c], h, n);
5047
+ h && Kn(s[c], h, n);
5014
5048
  }
5015
5049
  const l = new Set(r.map((c) => c.windowName));
5016
5050
  for (const c of t)
@@ -5025,14 +5059,14 @@ function fi(n, t, e) {
5025
5059
  return { segments: s, matches: r, sourceMap: a };
5026
5060
  }
5027
5061
  export {
5028
- rn as computeContour,
5029
- Hn as computeLocalFloorZ,
5030
- oi as findWindowWalls,
5031
- si as getAllGeometry,
5032
- li as getBeamLine,
5033
- ci as getColLine,
5034
- hi as getMergeMeaning,
5035
- $n as mergeCollinearSegments,
5036
- fi as processData,
5037
- ai as updateStEdPoint
5062
+ cn as computeContour,
5063
+ jn as computeLocalFloorZ,
5064
+ ai as findWindowWalls,
5065
+ ui as getAllGeometry,
5066
+ fi as getBeamLine,
5067
+ di as getColLine,
5068
+ gi as getMergeMeaning,
5069
+ Zn as mergeCollinearSegments,
5070
+ pi as processData,
5071
+ hi as updateStEdPoint
5038
5072
  };