rm-graphical-computing 1.0.66 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -131,8 +131,8 @@ const so = (n, t, e) => {
131
131
  let f = Math.min(c + a * 2, l), w = o + a * 2;
132
132
  const x = document.createElement("canvas");
133
133
  x.width = f, x.height = w;
134
- const P = x.getContext("2d");
135
- P.fillStyle = r, P.fillRect(0, 0, f, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", c > l - a * 2 ? lo(P, n, f / 2, w / 2, l, o) : P.fillText(n, f / 2, w / 2);
134
+ const b = x.getContext("2d");
135
+ b.fillStyle = r, b.fillRect(0, 0, f, w), b.fillStyle = s, b.font = `bold ${o}px ${i}`, b.textAlign = "center", b.textBaseline = "middle", c > l - a * 2 ? lo(b, n, f / 2, w / 2, l, o) : b.fillText(n, f / 2, w / 2);
136
136
  const M = new y.CanvasTexture(x), g = new y.SpriteMaterial({
137
137
  map: M,
138
138
  depthTest: !1,
@@ -171,26 +171,26 @@ const oe = (n, t, e = 0.01) => {
171
171
  const s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = s.clone().cross(a).normalize();
172
172
  let u = 1 / 0, h = -1 / 0, d = 1 / 0, c = -1 / 0;
173
173
  for (const z of i) {
174
- const v = z.dot(s), S = z.dot(a);
175
- v < u && (u = v), v > h && (h = v), S < d && (d = S), S > c && (c = S);
174
+ const S = z.dot(s), v = z.dot(a);
175
+ S < u && (u = S), S > h && (h = S), v < d && (d = v), v > c && (c = v);
176
176
  }
177
- const f = i[0].dot(l), w = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(d)).add(l.clone().multiplyScalar(f)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(d)).add(l.clone().multiplyScalar(f)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(f)), M = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(f));
178
- let g = [w, x, P, M], m = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
179
- m && m.parallel && (g = [w, M, P, x]);
177
+ const f = i[0].dot(l), w = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(d)).add(l.clone().multiplyScalar(f)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(d)).add(l.clone().multiplyScalar(f)), b = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(f)), M = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(f));
178
+ let g = [w, x, b, M], m = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
179
+ m && m.parallel && (g = [w, M, b, x]);
180
180
  let p = 0;
181
181
  if (o.length > 0) {
182
- const z = new y.Vector3().subVectors(g[1], g[0]).normalize(), v = z.clone().negate(), S = new y.Vector3().subVectors(g[3], g[0]).normalize(), V = S.clone().negate();
182
+ const z = new y.Vector3().subVectors(g[1], g[0]).normalize(), S = z.clone().negate(), v = new y.Vector3().subVectors(g[3], g[0]).normalize(), V = v.clone().negate();
183
183
  let D = g[0].distanceTo(g[1]), _ = g[0].distanceTo(g[3]), E = D / t, T = _ / e, A = 1e-3;
184
184
  for (let O = 0; O < E; O++) {
185
185
  let I = g[0], B = 0;
186
- for (let L = 0; L < T; L++) {
187
- let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(S, e), R = I.clone().addScaledVector(S, e), $ = new y.Vector3().add(I).add(N).add(C).add(R).multiplyScalar(0.25);
186
+ for (let R = 0; R < T; R++) {
187
+ let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(v, e), L = I.clone().addScaledVector(v, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
188
188
  for (let X = 0; X < r.length; X++)
189
189
  if (r[X].distanceTo($) < A) {
190
190
  B++;
191
191
  break;
192
192
  }
193
- I = R;
193
+ I = L;
194
194
  }
195
195
  if (B >= T / 2)
196
196
  break;
@@ -199,24 +199,24 @@ const oe = (n, t, e = 0.01) => {
199
199
  D = g[0].distanceTo(g[1]), E = D / t;
200
200
  for (let O = 0; O < E; O++) {
201
201
  let I = g[1], B = 0;
202
- for (let L = 0; L < T; L++) {
203
- let N = I.clone().addScaledVector(v, t), C = N.clone().addScaledVector(S, e), R = I.clone().addScaledVector(S, e), $ = new y.Vector3().add(I).add(N).add(C).add(R).multiplyScalar(0.25);
202
+ for (let R = 0; R < T; R++) {
203
+ let N = I.clone().addScaledVector(S, t), C = N.clone().addScaledVector(v, e), L = I.clone().addScaledVector(v, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
204
204
  for (let X = 0; X < r.length; X++)
205
205
  if (r[X].distanceTo($) < A) {
206
206
  B++;
207
207
  break;
208
208
  }
209
- I = R;
209
+ I = L;
210
210
  }
211
211
  if (B >= T / 2)
212
212
  break;
213
- p += B, g[1] = g[1].addScaledVector(v, t), g[2] = g[2].addScaledVector(v, t);
213
+ p += B, g[1] = g[1].addScaledVector(S, t), g[2] = g[2].addScaledVector(S, t);
214
214
  }
215
215
  D = g[0].distanceTo(g[1]), E = D / t;
216
216
  for (let O = 0; O < T; O++) {
217
217
  let I = g[3], B = 0;
218
- for (let L = 0; L < E; L++) {
219
- let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(V, e), R = I.clone().addScaledVector(V, e), $ = new y.Vector3().add(I).add(N).add(C).add(R).multiplyScalar(0.25);
218
+ for (let R = 0; R < E; R++) {
219
+ let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(V, e), L = I.clone().addScaledVector(V, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
220
220
  for (let X = 0; X < r.length; X++)
221
221
  if (r[X].distanceTo($) < A) {
222
222
  B++;
@@ -229,10 +229,10 @@ const oe = (n, t, e = 0.01) => {
229
229
  p += B, g[2] = g[2].addScaledVector(V, e), g[3] = g[3].addScaledVector(V, e);
230
230
  }
231
231
  }
232
- const b = g[0].distanceTo(g[1]) * g[0].distanceTo(g[3]);
232
+ const P = g[0].distanceTo(g[1]) * g[0].distanceTo(g[3]);
233
233
  return {
234
234
  facePoints: g,
235
- boxArea: b,
235
+ boxArea: P,
236
236
  totalInPlaneNum: p
237
237
  };
238
238
  }, Jt = (n, t, e, o, i = y.MathUtils.degToRad(8)) => {
@@ -298,7 +298,7 @@ const oe = (n, t, e = 0.01) => {
298
298
  closestDistance: null
299
299
  };
300
300
  f < 0 && c.negate();
301
- const P = new y.Vector3().addVectors(d, c).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), g = Je(e, M, d), m = Je(o, M, d), p = (g + m) / 2, b = Math.max(g, m), z = n.dot(P), v = t.dot(P), S = e.dot(P), V = o.dot(P), D = Math.min(z, v), _ = Math.max(z, v), E = Math.min(S, V), T = Math.max(S, V), A = _ - D, O = T - E, I = Math.min(A, O), B = Math.min(_, T) - Math.max(D, E), L = B < 0 ? -B : 0, N = B > 0 ? B : 0, C = I > 0 ? N / I : 0, R = uo(
301
+ const b = new y.Vector3().addVectors(d, c).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), g = Je(e, M, d), m = Je(o, M, d), p = (g + m) / 2, P = Math.max(g, m), z = n.dot(b), S = t.dot(b), v = e.dot(b), V = o.dot(b), D = Math.min(z, S), _ = Math.max(z, S), E = Math.min(v, V), T = Math.max(v, V), A = _ - D, O = T - E, I = Math.min(A, O), B = Math.min(_, T) - Math.max(D, E), R = B < 0 ? -B : 0, N = B > 0 ? B : 0, C = I > 0 ? N / I : 0, L = uo(
302
302
  n,
303
303
  t,
304
304
  e,
@@ -309,10 +309,10 @@ const oe = (n, t, e = 0.01) => {
309
309
  type: X,
310
310
  angleDeg: x,
311
311
  avgPerpendicularDistance: p,
312
- maxPerpendicularDistance: b,
313
- gap: L,
312
+ maxPerpendicularDistance: P,
313
+ gap: R,
314
314
  overlap: N,
315
- closestDistance: R
315
+ closestDistance: L
316
316
  };
317
317
  };
318
318
  function Je(n, t, e) {
@@ -323,8 +323,8 @@ 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), u = r.dot(r), h = i.dot(s), d = r.dot(s), c = a * u - l * l;
324
324
  let f, w;
325
325
  c < 1e-10 ? (f = 0, w = u !== 0 ? d / u : 0) : (f = (l * d - u * h) / c, w = (a * d - l * h) / c), f = y.MathUtils.clamp(f, 0, 1), w = u !== 0 ? y.MathUtils.clamp((l * f + d) / u, 0, 1) : 0, f = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
326
- const x = n.clone().add(i.clone().multiplyScalar(f)), P = e.clone().add(r.clone().multiplyScalar(w));
327
- return x.distanceTo(P);
326
+ const x = n.clone().add(i.clone().multiplyScalar(f)), b = e.clone().add(r.clone().multiplyScalar(w));
327
+ return x.distanceTo(b);
328
328
  }
329
329
  const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), ho = (n) => {
330
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();
@@ -333,23 +333,23 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
333
333
  let u = new y.Line3(t, e);
334
334
  const h = n.originalPoints, d = new y.Vector3();
335
335
  for (let x = 0; x < h.length; x++) {
336
- const P = h[x];
337
- let g = u.closestPointToPoint(P, !0, d).distanceTo(P);
336
+ const b = h[x];
337
+ let g = u.closestPointToPoint(b, !0, d).distanceTo(b);
338
338
  const m = Math.floor(g / a);
339
339
  if (m < s) {
340
340
  const p = l.get((m + 1) * a);
341
- p.count++, P.z < p.minZ && (p.minZ = P.z), P.z > p.maxZ && (p.maxZ = P.z);
341
+ p.count++, b.z < p.minZ && (p.minZ = b.z), b.z > p.maxZ && (p.maxZ = b.z);
342
342
  }
343
343
  }
344
344
  let c, f, w = r / 2;
345
- for (const [x, P] of l)
346
- if (P.count >= w) {
347
- c = P.minZ;
345
+ for (const [x, b] of l)
346
+ if (b.count >= w) {
347
+ c = b.minZ;
348
348
  break;
349
349
  }
350
- for (const [x, P] of [...l.entries()].reverse())
351
- if (P.count >= w) {
352
- f = P.maxZ;
350
+ for (const [x, b] of [...l.entries()].reverse())
351
+ if (b.count >= w) {
352
+ f = b.maxZ;
353
353
  break;
354
354
  }
355
355
  return { minZ: c, maxZ: f };
@@ -358,54 +358,54 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
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);
360
360
  const a = [], l = [];
361
- e.forEach((P) => {
361
+ e.forEach((b) => {
362
362
  const M = new y.Vector3();
363
- o.projectPoint(P, M), l.push(M.clone()), M.z = i.z, a.push(M);
363
+ o.projectPoint(b, M), l.push(M.clone()), M.z = i.z, a.push(M);
364
364
  });
365
365
  let u = new y.Vector3(), h = new y.Vector3();
366
366
  o.projectPoint(i, u), o.projectPoint(r, h);
367
367
  const d = new y.Line3(u, h), c = [], f = [], w = [];
368
368
  let x = new y.Vector3();
369
- return a.forEach((P, M) => {
370
- d.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (c.push(e[M]), f.push(l[M])) : w.push(P);
369
+ return a.forEach((b, M) => {
370
+ d.closestPointToPoint(b, !0, x).distanceTo(b) < 1e-3 ? (c.push(e[M]), f.push(l[M])) : w.push(b);
371
371
  }), { newOriginalPoints: c, newProjectPoints: w, newOnLinePoints: f };
372
372
  }, fo = (n) => {
373
373
  function t(e, o, i, r, s, a, l, u, h) {
374
- let d = new y.Line3(e, o), c = /* @__PURE__ */ new Map(), f = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
374
+ let d = new y.Line3(e, o), c = /* @__PURE__ */ new Map(), f = new y.Vector3(), w = e.clone(), x = o.clone(), b = 0;
375
375
  for (; ; ) {
376
376
  let M = /* @__PURE__ */ new Map(), g = 0;
377
377
  for (let m = 0; m < h.checkResults.length; m++)
378
378
  if (!(h.checkResults[m].allCenterPoints.length / u * 100 < 1))
379
- for (let b = 0; b < h.checkResults[m].allCenterPoints.length; b++) {
380
- if (c.has(m) && c.get(m).removePtsIndex.includes(b))
379
+ for (let P = 0; P < h.checkResults[m].allCenterPoints.length; P++) {
380
+ if (c.has(m) && c.get(m).removePtsIndex.includes(P))
381
381
  continue;
382
- let z = h.checkResults[m].allCenterPoints[b];
382
+ let z = h.checkResults[m].allCenterPoints[P];
383
383
  z = new y.Vector3(z.x, z.y, z.z);
384
- let v = d.closestPointToPoint(z, !0, f), S = z.distanceTo(v);
385
- Math.abs(S - s) < 0.01 && (g++, M.has(m) ? M.get(m).removePtsIndex.push(b) : M.set(m, {
384
+ let S = d.closestPointToPoint(z, !0, f), v = z.distanceTo(S);
385
+ Math.abs(v - s) < 0.01 && (g++, M.has(m) ? M.get(m).removePtsIndex.push(P) : M.set(m, {
386
386
  index: m,
387
- removePtsIndex: [b]
387
+ removePtsIndex: [P]
388
388
  }));
389
389
  }
390
- if (P == l) {
390
+ if (b == l) {
391
391
  e = w, o = x;
392
392
  break;
393
393
  }
394
394
  if (g < a / 20 * 18 || g == 0) {
395
- M.clear(), l - P < 5 && (e = w, o = x, c.clear());
395
+ M.clear(), l - b < 5 && (e = w, o = x, c.clear());
396
396
  break;
397
397
  } else {
398
- P++;
398
+ b++;
399
399
  for (const [m, p] of M)
400
400
  c.has(m) ? c.get(m).removePtsIndex.push(...p.removePtsIndex) : c.set(m, p);
401
401
  M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r), d.set(e, o);
402
402
  }
403
403
  }
404
- if (c.size > 0 && P != l)
404
+ if (c.size > 0 && b != l)
405
405
  for (const [M, g] of c) {
406
406
  let m = [], p = [];
407
- for (let b = 0; b < h.checkResults[M].allCenterPoints.length; b++)
408
- g.removePtsIndex.includes(b) || (m.push(h.checkResults[M].allCenterPoints[b]), p.push(h.checkResults[M].originalVertices[b]));
407
+ for (let P = 0; P < h.checkResults[M].allCenterPoints.length; P++)
408
+ g.removePtsIndex.includes(P) || (m.push(h.checkResults[M].allCenterPoints[P]), p.push(h.checkResults[M].originalVertices[P]));
409
409
  h.checkResults[M].allCenterPoints = m, h.checkResults[M].originalVertices = p;
410
410
  }
411
411
  }
@@ -417,8 +417,8 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
417
417
  if (!o.checkResults || o.checkResults.length <= 0)
418
418
  continue;
419
419
  if (o.checkResults[0].originalVertices && o.checkResults[0].originalVertices.length > 0) {
420
- const S = o.checkResults[0].originalVertices[0];
421
- let [V, D, _, E] = S;
420
+ const v = o.checkResults[0].originalVertices[0];
421
+ let [V, D, _, E] = v;
422
422
  V = new y.Vector3(V.x, V.y, V.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 = V.distanceTo(D), r = V.distanceTo(E);
423
423
  let T = new y.Vector3().subVectors(V, D).normalize(), A = oe(T, new y.Vector3(0, 0, 1));
424
424
  A && A.parallel && ([r, i] = [i, r]);
@@ -427,17 +427,17 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
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), u = o.rooftopPz - o.start.z, h = Math.ceil(l / i), d = Math.ceil(u / r);
430
- let c = s.clone(), f = a.clone(), w = f.clone().add(new y.Vector3(0, 0, u)), x = c.clone().add(new y.Vector3(0, 0, u)), P = new y.Vector3().subVectors(f, c).normalize(), M = P.clone().negate();
430
+ let c = s.clone(), f = a.clone(), w = f.clone().add(new y.Vector3(0, 0, u)), x = c.clone().add(new y.Vector3(0, 0, u)), b = new y.Vector3().subVectors(f, c).normalize(), M = b.clone().negate();
431
431
  new y.Vector3().subVectors(w, c).normalize().clone().negate();
432
- let m = i / 2, p = l * u, b = i * r, z = p / b;
433
- t(c, x, P, i, m, d, h, z, o), t(f, w, M, i, m, d, h, z, o), o.start = c, o.end = f;
434
- const { newOriginalPoints: v } = ze(c, f, o.originalPoints);
435
- o.originalPoints = v;
432
+ let m = i / 2, p = l * u, P = i * r, z = p / P;
433
+ t(c, x, b, i, m, d, h, z, o), t(f, w, M, i, m, d, h, z, o), o.start = c, o.end = f;
434
+ const { newOriginalPoints: S } = ze(c, f, o.originalPoints);
435
+ o.originalPoints = S;
436
436
  }
437
- }, Lt = (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) => {
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
- }, Se = (n) => {
440
+ }, ve = (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++) {
@@ -501,8 +501,8 @@ class yo {
501
501
  */
502
502
  createWallPlaneMeshFromFourPoints(t, e, o, i, r, s, a = 16777215) {
503
503
  const l = [t, e, o, i];
504
- for (let P = 0; P < l.length; P++)
505
- this.isValidVector3(l[P]) || (console.error(`点${P + 1}包含无效数据:`, l[P]), l[P] = new y.Vector3(P, 0, P));
504
+ for (let b = 0; b < l.length; b++)
505
+ this.isValidVector3(l[b]) || (console.error(`点${b + 1}包含无效数据:`, l[b]), l[b] = new y.Vector3(b, 0, b));
506
506
  const u = new y.BufferGeometry(), h = new Float32Array([
507
507
  l[0].x,
508
508
  l[0].y,
@@ -556,22 +556,22 @@ class yo {
556
556
  const c = a.distanceTo(l), f = Math.abs(t.rooftopPz - t.start.z);
557
557
  if (c === 0 || f === 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 = c / o, x = f / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
559
+ const w = c / o, x = f / e, b = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
560
560
  for (let g = 0; g < e; g++)
561
561
  for (let m = 0; m < o; m++)
562
562
  try {
563
- const p = new y.Vector3().copy(a).add(P.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar(g * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar(g * x)), z = new y.Vector3().copy(a).add(P.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar((g + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar((g + 1) * x)), S = {
564
- points: [p, b, z, v],
563
+ const p = new y.Vector3().copy(a).add(b.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar(g * x)), P = new y.Vector3().copy(a).add(b.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar(g * x)), z = new y.Vector3().copy(a).add(b.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar((g + 1) * x)), S = new y.Vector3().copy(a).add(b.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar((g + 1) * x)), v = {
564
+ points: [p, P, z, S],
565
565
  userData: {}
566
566
  };
567
- S.userData = {
567
+ v.userData = {
568
568
  type: "wallSegment",
569
569
  row: g,
570
570
  col: m,
571
571
  originalMaterial: i,
572
572
  width: w,
573
573
  height: x
574
- }, s.push(S);
574
+ }, s.push(v);
575
575
  } catch (p) {
576
576
  console.error(`创建墙体小平面(${g}, ${m})时出错:`, p);
577
577
  }
@@ -873,9 +873,9 @@ class yo {
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}`, [u, h, d, c] = s.vertices, f = new y.Vector3().subVectors(h, u).normalize(), w = new y.Vector3().subVectors(c, u).normalize(), x = u.distanceTo(h), P = u.distanceTo(c), M = new y.Plane();
876
+ const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [u, h, d, c] = s.vertices, f = new y.Vector3().subVectors(h, u).normalize(), w = new y.Vector3().subVectors(c, u).normalize(), x = u.distanceTo(h), b = u.distanceTo(c), M = new y.Plane();
877
877
  M.setFromCoplanarPoints(u, h, c);
878
- const g = x / 2, m = P / 2;
878
+ const g = x / 2, m = b / 2;
879
879
  for (let p = 0; p < e.length; p++)
880
880
  this.isPointInWallSegmentOptimized(
881
881
  e[p],
@@ -885,7 +885,7 @@ class yo {
885
885
  f,
886
886
  w,
887
887
  x,
888
- P,
888
+ b,
889
889
  g,
890
890
  m,
891
891
  o
@@ -917,7 +917,7 @@ class yo {
917
917
  const f = new y.Vector3().subVectors(t, e), w = Math.abs(f.dot(r)), x = Math.abs(f.dot(s));
918
918
  if (w > u && x > h)
919
919
  return !1;
920
- const P = new y.Vector3().subVectors(t, i), M = P.dot(r), g = P.dot(s), m = M >= -d && M <= a + d, p = g >= -d && g <= l + d;
920
+ const b = new y.Vector3().subVectors(t, i), M = b.dot(r), g = b.dot(s), m = M >= -d && M <= a + d, p = g >= -d && g <= l + d;
921
921
  return m && p;
922
922
  }
923
923
  // 判断点是否在细分墙体平面内
@@ -937,8 +937,8 @@ class yo {
937
937
  return !1;
938
938
  const d = new y.Vector3().subVectors(s, r).normalize(), c = new y.Vector3().subVectors(l, r).normalize();
939
939
  new y.Vector3().crossVectors(d, c).normalize();
940
- const f = new y.Vector3().subVectors(e, r), w = f.dot(d), x = f.dot(c), P = r.distanceTo(s), M = r.distanceTo(l), g = w >= -i && w <= P + i, m = x >= -i && x <= M + i;
941
- return g && m && o.distanceTo(e) < P / 2 && o.distanceTo(e) < M / 2;
940
+ const f = new y.Vector3().subVectors(e, r), w = f.dot(d), x = f.dot(c), b = r.distanceTo(s), M = r.distanceTo(l), g = w >= -i && w <= b + i, m = x >= -i && x <= M + i;
941
+ return g && m && o.distanceTo(e) < b / 2 && o.distanceTo(e) < M / 2;
942
942
  }
943
943
  // 优化顶点获取(添加缓存)
944
944
  getWorldVertices(t) {
@@ -1041,15 +1041,15 @@ class yo {
1041
1041
  for (const [c, f] of r) {
1042
1042
  const w = (d = s.get(f.row)) == null ? void 0 : d.get(f.col);
1043
1043
  if (w && !w.visited) {
1044
- const x = [], P = [[f.row, f.col]];
1045
- for (w.visited = !0; P.length > 0; ) {
1046
- const [M, g] = P.shift(), m = `row${M}_col${g}`;
1044
+ const x = [], b = [[f.row, f.col]];
1045
+ for (w.visited = !0; b.length > 0; ) {
1046
+ const [M, g] = b.shift(), m = `row${M}_col${g}`;
1047
1047
  r.has(m) && x.push(r.get(m));
1048
- for (const [p, b] of l) {
1049
- const z = M + p, v = g + b;
1050
- if (s.has(z) && s.get(z).has(v)) {
1051
- const S = s.get(z).get(v);
1052
- !S.visited && S.isEmpty && (S.visited = !0, P.push([z, v]));
1048
+ for (const [p, P] of l) {
1049
+ const z = M + p, S = g + P;
1050
+ if (s.has(z) && s.get(z).has(S)) {
1051
+ const v = s.get(z).get(S);
1052
+ !v.visited && v.isEmpty && (v.visited = !0, b.push([z, S]));
1053
1053
  }
1054
1054
  }
1055
1055
  }
@@ -1244,9 +1244,9 @@ const xo = (n) => {
1244
1244
  let a = new y.Vector3(r.end.x, r.end.y, r.end.z);
1245
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
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)), u = [];
1247
- r.originalPoints.forEach((v, S) => {
1247
+ r.originalPoints.forEach((S, v) => {
1248
1248
  const V = new zt();
1249
- l.projectPoint(v, V), u.push(V);
1249
+ l.projectPoint(S, V), u.push(V);
1250
1250
  });
1251
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)), d = Math.abs(r.rooftopPz - r.start.z), c = new y.MeshBasicMaterial({
1252
1252
  color: "red",
@@ -1254,7 +1254,7 @@ const xo = (n) => {
1254
1254
  wireframe: !1,
1255
1255
  transparent: !0,
1256
1256
  opacity: 0.5
1257
- }), f = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, d), M = w.createSubdividedWallPlane(r, P, x, c, f);
1257
+ }), f = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: b } = w.initLimits4(h, d), M = w.createSubdividedWallPlane(r, b, x, c, f);
1258
1258
  w.analyzePointDistribution(M, u, 0.01);
1259
1259
  const g = new y.MeshBasicMaterial({
1260
1260
  color: "black",
@@ -1262,9 +1262,9 @@ const xo = (n) => {
1262
1262
  opacity: 0.8,
1263
1263
  side: y.DoubleSide
1264
1264
  }), m = w.highlightEmptySegments(M, g, f), p = [];
1265
- for (const v of m.clusters) {
1266
- const S = xo(v);
1267
- S && p.push(S);
1265
+ for (const S of m.clusters) {
1266
+ const v = xo(S);
1267
+ v && p.push(v);
1268
1268
  }
1269
1269
  const z = wo(r).direction;
1270
1270
  r.checkResults = p, r.verticalDirection = z, r.originaIndex = i, o.push(r);
@@ -1275,13 +1275,13 @@ const xo = (n) => {
1275
1275
  for (let e = 0; e < n.length; e++) {
1276
1276
  const o = n[e], i = [];
1277
1277
  o.originalPoints.forEach((m) => {
1278
- let p = new y.Vector3(m.x, m.y, 0), b = !1;
1278
+ let p = new y.Vector3(m.x, m.y, 0), P = !1;
1279
1279
  for (let z = 0; z < i.length; z++)
1280
1280
  if (kt(p, i[z], 0.01)) {
1281
- b = !0;
1281
+ P = !0;
1282
1282
  break;
1283
1283
  }
1284
- b || i.push(p);
1284
+ P || i.push(p);
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), u = new y.Vector3().subVectors(l, a).normalize(), h = u.clone().cross(new y.Vector3(0, 0, 1)).normalize(), d = h.clone().negate(), c = [];
@@ -1291,18 +1291,18 @@ const xo = (n) => {
1291
1291
  for (let m = 0; m < r; m++) {
1292
1292
  const p = [];
1293
1293
  p.push(a.clone().addScaledVector(h, s)), p.push(p[0].clone().addScaledVector(u, w)), p.push(p[1].clone().addScaledVector(d, s * 2)), p.push(a.clone().addScaledVector(d, w));
1294
- let b = [];
1294
+ let P = [];
1295
1295
  for (let z = 0; z < i.length; z++)
1296
- c.includes(z) || Po(i[z], p) && (c.push(z), b.push(i[z]));
1297
- b.length > 0 && f.push(Mo(b)), a = a.addScaledVector(u, w);
1296
+ c.includes(z) || Po(i[z], p) && (c.push(z), P.push(i[z]));
1297
+ P.length > 0 && f.push(Mo(P)), a = a.addScaledVector(u, w);
1298
1298
  }
1299
1299
  const x = new Float32Array(i.length * 3);
1300
1300
  i.forEach((m, p) => {
1301
1301
  x[p * 3] = m.x, x[p * 3 + 1] = m.y, x[p * 3 + 2] = m.z;
1302
1302
  });
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: go(), size: 0.02 })));
1305
- const [M, g] = vo(f, {
1303
+ const b = new y.BufferGeometry();
1304
+ b.setAttribute("position", new y.BufferAttribute(x, 3)), b.rotateX(-Math.PI / 2), t.add(new y.Points(b, new y.PointsMaterial({ color: go(), size: 0.02 })));
1305
+ const [M, g] = So(f, {
1306
1306
  plane: "xy",
1307
1307
  trimRatio: 0
1308
1308
  });
@@ -1376,7 +1376,7 @@ function nn(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 So(n, t, e) {
1379
+ function vo(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 So(n, t, e) {
1387
1387
  y: u / h
1388
1388
  };
1389
1389
  }
1390
- function vo(n, t = {}) {
1390
+ function So(n, t = {}) {
1391
1391
  const {
1392
1392
  plane: e = "xy",
1393
1393
  // 0 表示完全取最远两端
@@ -1403,33 +1403,33 @@ function vo(n, t = {}) {
1403
1403
  r /= i.length, s /= i.length, a /= i.length;
1404
1404
  let l = 0, u = 0, h = 0;
1405
1405
  for (const B of i) {
1406
- const L = B.x - r, N = B.y - s;
1407
- l += L * L, u += L * N, h += N * N;
1406
+ const R = B.x - r, N = B.y - s;
1407
+ l += R * R, u += R * N, h += N * N;
1408
1408
  }
1409
1409
  l /= i.length, u /= i.length, h /= i.length;
1410
- const d = So(l, u, h), c = {
1410
+ const d = vo(l, u, h), c = {
1411
1411
  x: -d.y,
1412
1412
  y: d.x
1413
1413
  }, f = [];
1414
1414
  for (const B of i) {
1415
- const L = B.x - r, N = B.y - s, C = L * d.x + N * d.y, R = L * c.x + N * c.y;
1415
+ const R = B.x - r, N = B.y - s, C = R * d.x + N * d.y, L = R * c.x + N * c.y;
1416
1416
  f.push({
1417
1417
  s: C,
1418
- t: R,
1418
+ t: L,
1419
1419
  up: B.up
1420
1420
  });
1421
1421
  }
1422
- f.sort((B, L) => B.s - L.s);
1422
+ f.sort((B, R) => B.s - R.s);
1423
1423
  const w = f.length;
1424
- let x = Math.floor(w * o), P = Math.ceil(w * (1 - o)) - 1;
1425
- x = Math.max(0, Math.min(w - 1, x)), P = Math.max(0, Math.min(w - 1, P));
1426
- const M = f[x], g = f[P], m = (() => {
1427
- const B = f.map((N) => N.t).sort((N, C) => N - C), L = Math.floor(B.length / 2);
1428
- return B.length % 2 === 0 ? (B[L - 1] + B[L]) * 0.5 : B[L];
1424
+ let x = Math.floor(w * o), b = Math.ceil(w * (1 - o)) - 1;
1425
+ x = Math.max(0, Math.min(w - 1, x)), b = Math.max(0, Math.min(w - 1, b));
1426
+ const M = f[x], g = f[b], m = (() => {
1427
+ const B = f.map((N) => N.t).sort((N, C) => N - C), R = Math.floor(B.length / 2);
1428
+ return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1429
1429
  })(), p = (() => {
1430
- const B = f.map((N) => N.up).sort((N, C) => N - 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, z = g.s, v = m, S = m, V = p, D = p, _ = r + d.x * b + c.x * v, E = s + d.y * b + c.y * v, T = r + d.x * z + c.x * S, A = s + d.y * z + c.y * S, O = nn(_, E, V, e), I = nn(T, A, D, e);
1430
+ const B = f.map((N) => N.up).sort((N, C) => N - C), R = Math.floor(B.length / 2);
1431
+ return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1432
+ })(), P = M.s, z = g.s, S = m, v = m, V = p, D = p, _ = r + d.x * P + c.x * S, E = s + d.y * P + c.y * S, T = r + d.x * z + c.x * v, A = s + d.y * z + c.y * v, O = nn(_, E, V, e), I = nn(T, A, D, e);
1433
1433
  return [O, I];
1434
1434
  }
1435
1435
  const wi = async (n, t, e, o, i) => {
@@ -1444,26 +1444,26 @@ const wi = async (n, t, e, o, i) => {
1444
1444
  for (const m of n) {
1445
1445
  let p = [];
1446
1446
  if (!(!m.checkResults || m.checkResults.length <= 0)) {
1447
- for (let b = 0; b < m.checkResults.length; b++) {
1447
+ for (let P = 0; P < m.checkResults.length; P++) {
1448
1448
  let D = function(A) {
1449
1449
  for (; V[A] !== A; )
1450
1450
  V[A] = V[V[A]], A = V[A];
1451
1451
  return A;
1452
1452
  };
1453
- const z = m.checkResults[b];
1453
+ const z = m.checkResults[P];
1454
1454
  if (z.isDoor = !1, !z.originalVertices || z.originalVertices.length == 0)
1455
1455
  continue;
1456
- const v = [];
1456
+ const S = [];
1457
1457
  z.originalVertices.forEach((A) => {
1458
1458
  let O = [];
1459
1459
  A.forEach((I) => {
1460
1460
  O.push(new y.Vector3(I.x, I.y, I.z));
1461
- }), v.push(O);
1461
+ }), S.push(O);
1462
1462
  });
1463
- const S = v.length, V = Array.from({ length: S }, (A, O) => O);
1464
- for (let A = 0; A < S; A++)
1465
- for (let O = A + 1; O < S; O++) {
1466
- const I = v[A], B = v[O];
1463
+ const v = S.length, V = Array.from({ length: v }, (A, O) => O);
1464
+ for (let A = 0; A < v; A++)
1465
+ for (let O = A + 1; O < v; O++) {
1466
+ const I = S[A], B = S[O];
1467
1467
  if (I.some((N) => B.some((C) => N.equals(C)))) {
1468
1468
  const N = D(A), C = D(O);
1469
1469
  N !== C && (V[N] = C);
@@ -1471,7 +1471,7 @@ const wi = async (n, t, e, o, i) => {
1471
1471
  }
1472
1472
  const _ = /* @__PURE__ */ new Map();
1473
1473
  let E = -1, T = -1;
1474
- for (let A = 0; A < S; A++) {
1474
+ for (let A = 0; A < v; A++) {
1475
1475
  const O = D(A);
1476
1476
  _.has(O) || _.set(O, {
1477
1477
  points: [],
@@ -1483,11 +1483,11 @@ const wi = async (n, t, e, o, i) => {
1483
1483
  centerPts: []
1484
1484
  });
1485
1485
  const I = _.get(O);
1486
- let [B, L, N, C] = v[A];
1487
- const R = new y.Vector3().add(B).add(L).add(N).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 $ = new y.Vector3().subVectors(B, L).normalize();
1490
- T = B.distanceTo(C), E = B.distanceTo(L);
1486
+ let [B, R, N, C] = S[A];
1487
+ const L = new y.Vector3().add(B).add(R).add(N).add(C).multiplyScalar(0.25);
1488
+ if (I.points.push(...S[A]), I.area += B.distanceTo(R) * B.distanceTo(C), I.originalVertices.push(S[A]), I.index = P, I.centerPts.push(L), E == -1 || T == -1) {
1489
+ let $ = new y.Vector3().subVectors(B, R).normalize();
1490
+ T = B.distanceTo(C), E = B.distanceTo(R);
1491
1491
  let X = oe($, new y.Vector3(0, 0, 1));
1492
1492
  X && X.parallel && ([T, E] = [E, T]);
1493
1493
  }
@@ -1501,11 +1501,11 @@ const wi = async (n, t, e, o, i) => {
1501
1501
  let r = /* @__PURE__ */ new Map();
1502
1502
  for (const m of n) {
1503
1503
  if (m.length < 0.3) continue;
1504
- let p = m.rooftopPz - m.start.z, b = Math.floor(m.rooftopPz - m.start.z);
1505
- r.has(b) ? r.set(b, {
1506
- num: r.get(b).num + 1,
1507
- totalHeight: r.get(b).totalHeight + p
1508
- }) : r.set(b, {
1504
+ let p = m.rooftopPz - m.start.z, P = Math.floor(m.rooftopPz - m.start.z);
1505
+ r.has(P) ? r.set(P, {
1506
+ num: r.get(P).num + 1,
1507
+ totalHeight: r.get(P).totalHeight + p
1508
+ }) : r.set(P, {
1509
1509
  num: 1,
1510
1510
  totalHeight: p
1511
1511
  });
@@ -1518,17 +1518,17 @@ const wi = async (n, t, e, o, i) => {
1518
1518
  for (let m = 0; m < e.length; m++) {
1519
1519
  const p = e[m];
1520
1520
  if (p.isFindBeam = !1, p.category == "door") {
1521
- let b = [];
1521
+ let P = [];
1522
1522
  p.coordinatesByArea.coordinates.forEach((D) => {
1523
- b.push(new y.Vector3(D.x, D.y, D.z));
1524
- }), b[0].equals(b[b.length - 1]) && b.pop();
1525
- let z = b[0].distanceTo(b[1]), v = b[0].distanceTo(b[3]);
1526
- v > z && ([z, v] = [v, z], b = [b[0], b[3], b[2], b[1]]);
1527
- let S = ee(b[0], b[3], !0), V = ee(b[1], b[2], !0);
1523
+ P.push(new y.Vector3(D.x, D.y, D.z));
1524
+ }), P[0].equals(P[P.length - 1]) && P.pop();
1525
+ let z = P[0].distanceTo(P[1]), S = P[0].distanceTo(P[3]);
1526
+ S > z && ([z, S] = [S, z], P = [P[0], P[3], P[2], P[1]]);
1527
+ let v = ee(P[0], P[3], !0), V = ee(P[1], P[2], !0);
1528
1528
  a.push({
1529
- doorStartPt: S,
1529
+ doorStartPt: v,
1530
1530
  doorEndPt: V,
1531
- boxPoints: b,
1531
+ boxPoints: P,
1532
1532
  minZ: p.coordinatesByArea.heightData.minZ,
1533
1533
  maxZ: p.coordinatesByArea.heightData.maxZ,
1534
1534
  index: m,
@@ -1540,33 +1540,33 @@ const wi = async (n, t, e, o, i) => {
1540
1540
  }
1541
1541
  for (let m = 0; m < a.length; m++) {
1542
1542
  const p = a[m];
1543
- for (let b = 0; b < n.length; b++) {
1544
- if (n[b].length < 0.5) continue;
1543
+ for (let P = 0; P < n.length; P++) {
1544
+ if (n[P].length < 0.5) continue;
1545
1545
  let z = [];
1546
- const v = ee(n[b].start, n[b].end, !0);
1547
- z.push(v), z.push(ee(v, n[b].start, !0)), z.push(ee(v, n[b].end, !0));
1548
- let S = !1;
1546
+ const S = ee(n[P].start, n[P].end, !0);
1547
+ z.push(S), z.push(ee(S, n[P].start, !0)), z.push(ee(S, n[P].end, !0));
1548
+ let v = !1;
1549
1549
  const V = p.boxPoints.length;
1550
1550
  for (let D = 0; D < z.length; D++) {
1551
1551
  const _ = z[D].x, E = z[D].y;
1552
1552
  for (let T = 0, A = V - 1; T < V; 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);
1553
+ const O = p.boxPoints[T].x, I = p.boxPoints[T].y, B = p.boxPoints[A].x, R = p.boxPoints[A].y;
1554
+ I > E != R > E && _ < (B - O) * (E - I) / (R - I) + O && (v = !v);
1555
1555
  }
1556
- if (S) break;
1556
+ if (v) break;
1557
1557
  }
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 = Jt(p.doorStartPt, p.doorEndPt, D, _);
1558
+ if (v) {
1559
+ let D = new y.Vector3(n[P].start.x, n[P].start.y, 0), _ = new y.Vector3(n[P].end.x, n[P].end.y, 0), E = p.doorStartPt.distanceTo(p.doorEndPt), T = D.distanceTo(_), A = Jt(p.doorStartPt, p.doorEndPt, D, _);
1560
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);
1561
+ p.doorStartPt = new y.Vector3(n[P].start.x, n[P].start.y, 0), p.doorEndPt = new y.Vector3(n[P].end.x, n[P].end.y, 0);
1562
1562
  break;
1563
1563
  } else if (Math.abs(T - E) > 1.3 && A && A.angleDeg < 15) {
1564
- let O = ne(p.doorStartPt, p.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = p.doorStartPt.distanceTo(D), B = p.doorStartPt.distanceTo(_), L = p.doorEndPt.distanceTo(D), N = p.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || L < 0.2 || N < 0.2;
1564
+ let O = ne(p.doorStartPt, p.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = p.doorStartPt.distanceTo(D), B = p.doorStartPt.distanceTo(_), R = p.doorEndPt.distanceTo(D), N = p.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || R < 0.2 || N < 0.2;
1565
1565
  if (O && O.type == "collinear_overlap" && O.maxPerpendicularDistance < 0.1 && !C) {
1566
1566
  p.inWall = !0;
1567
1567
  break;
1568
1568
  } else {
1569
- let R = new y.Line3(D, _), $ = R.closestPointToPoint(p.doorStartPt, !0, new y.Vector3()), X = R.closestPointToPoint(p.doorEndPt, !0, new y.Vector3()), ot = $.distanceTo(p.doorStartPt), K = X.distanceTo(p.doorEndPt);
1569
+ let L = new y.Line3(D, _), $ = L.closestPointToPoint(p.doorStartPt, !0, new y.Vector3()), X = L.closestPointToPoint(p.doorEndPt, !0, new y.Vector3()), ot = $.distanceTo(p.doorStartPt), K = X.distanceTo(p.doorEndPt);
1570
1570
  if (ot < 0.1 || K < 0.1) {
1571
1571
  p.inWall = !0;
1572
1572
  break;
@@ -1585,11 +1585,11 @@ const wi = async (n, t, e, o, i) => {
1585
1585
  if (p.noDetection || (p.doorAndBeamData = [], !p.mergeCheckRegion || p.mergeCheckRegion.length == 0))
1586
1586
  continue;
1587
1587
  p.completePointAreaPercentage = -1;
1588
- let b = new y.Box3();
1589
- b.setFromPoints(p.originalPoints);
1590
- let z = b.max.z;
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);
1588
+ let P = new y.Box3();
1589
+ P.setFromPoints(p.originalPoints);
1590
+ let z = P.max.z;
1591
+ P.min.z;
1592
+ const S = new y.Vector3(p.start.x, p.start.y, p.start.z), v = new y.Vector3(p.end.x, p.end.y, p.end.z);
1593
1593
  let V = p.rooftopPz - p.start.z, D = 0;
1594
1594
  for (const E of p.mergeCheckRegion) {
1595
1595
  const { facePoints: T, boxArea: A, totalInPlaneNum: O } = co(
@@ -1603,22 +1603,22 @@ const wi = async (n, t, e, o, i) => {
1603
1603
  T[0].distanceTo(T[1]);
1604
1604
  let I = T[0].distanceTo(T[3]);
1605
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), N = new y.Vector3(T[1].x, T[1].y, T[1].z + B);
1607
- const C = new y.Line3(L, N), R = [];
1606
+ let R = new y.Vector3(T[0].x, T[0].y, T[0].z + B), N = new y.Vector3(T[1].x, T[1].y, T[1].z + B);
1607
+ const C = new y.Line3(R, N), L = [];
1608
1608
  let $ = new y.Vector3();
1609
1609
  E.points.forEach((rt) => {
1610
- C.closestPointToPoint(rt, !0, $).distanceTo(rt) < E.gridHeight + 0.01 && R.push(rt);
1610
+ C.closestPointToPoint(rt, !0, $).distanceTo(rt) < E.gridHeight + 0.01 && L.push(rt);
1611
1611
  });
1612
1612
  let X = [], ot = [];
1613
1613
  for (; ; ) {
1614
1614
  let rt = [];
1615
- for (let F = 0; F < R.length; F++)
1616
- ot.includes(F) || rt.length == 0 && (rt.push(R[F]), ot.push(F));
1617
- for (let F = 0; F < R.length; F++)
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
1618
  if (!ot.includes(F)) {
1619
1619
  for (let H = 0; H < rt.length; H++)
1620
- if (R[F].distanceTo(rt[H]) < E.gridWidth + 0.01) {
1621
- rt.push(R[F]), ot.push(F), F = -1;
1620
+ if (L[F].distanceTo(rt[H]) < E.gridWidth + 0.01) {
1621
+ rt.push(L[F]), ot.push(F), F = -1;
1622
1622
  break;
1623
1623
  }
1624
1624
  }
@@ -1633,7 +1633,7 @@ const wi = async (n, t, e, o, i) => {
1633
1633
  lineEd: new y.Vector3(),
1634
1634
  facePoints: []
1635
1635
  };
1636
- let H = Se(X[rt]);
1636
+ let H = ve(X[rt]);
1637
1637
  Array.isArray(H) && H.length == 2 && (F.lineSt = H[0], F.lineEd = H[1], F.facePoints.push(new y.Vector3(H[0].x, H[0].y, T[0].z)), F.facePoints.push(new y.Vector3(H[1].x, H[1].y, T[0].z)), F.facePoints.push(new y.Vector3(H[1].x, H[1].y, T[2].z)), F.facePoints.push(new y.Vector3(H[0].x, H[0].y, T[2].z)), K.push(F));
1638
1638
  }
1639
1639
  D += E.area;
@@ -1644,10 +1644,10 @@ const wi = async (n, t, e, o, i) => {
1644
1644
  let H = F.facePoints[0].distanceTo(F.facePoints[1]), Mt = F.facePoints[0].distanceTo(F.facePoints[3]), Zt = H / p.length * 100, qt = p.rooftopPz - F.facePoints[2].z;
1645
1645
  if (Mt < 1.5 || z < F.facePoints[2].z || qt > V / 3 * 2)
1646
1646
  continue;
1647
- let Rt = !1, _t = !1, Et = !1, Ft = [], tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), W = F.facePoints[0].clone(), j = F.facePoints[1].clone(), Nt = !1, Tt = -1;
1647
+ let Lt = !1, _t = !1, Et = !1, Ft = [], tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), W = F.facePoints[0].clone(), j = F.facePoints[1].clone(), Nt = !1, Tt = -1;
1648
1648
  if (Math.abs(F.facePoints[0].z - p.start.z) < 0.25) {
1649
1649
  if (H > 0.17 && p.length > 0.5) {
1650
- let Wt = Lt(v, W), J = Lt(v, j), ct = Lt(S, W), q = Lt(S, j);
1650
+ let Wt = Rt(S, W), J = Rt(S, j), ct = Rt(v, W), q = Rt(v, j);
1651
1651
  const bt = 0.1, Vt = 10;
1652
1652
  if (Wt < bt || J < bt) {
1653
1653
  const { newOriginalPoints: Ut } = ze(W, j, p.originalPoints), at = [];
@@ -1659,9 +1659,9 @@ const wi = async (n, t, e, o, i) => {
1659
1659
  for (let U = 0; U < n.length; U++) {
1660
1660
  if (U == m) continue;
1661
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);
1662
+ let vt = re(Q, gt, it, dt);
1663
1663
  if (Ct != null) {
1664
- if (St && St.angle > 85) {
1664
+ if (vt && vt.angle > 85) {
1665
1665
  let At = Ct.point.distanceTo(Q);
1666
1666
  if (Ct.point.distanceTo(gt), At < 0.3) {
1667
1667
  ft = !0, ht = 1 / 0, Z = -1;
@@ -1670,19 +1670,19 @@ const wi = async (n, t, e, o, i) => {
1670
1670
  }
1671
1671
  continue;
1672
1672
  }
1673
- if (St && St.angle > 85) {
1673
+ if (vt && vt.angle > 85) {
1674
1674
  const Y = new y.Line3(it, dt).closestPointToPoint(Q, !0, Gt);
1675
1675
  let pt = Jt(Q, gt, Y, Q);
1676
1676
  if (!pt || pt.direction != "same") continue;
1677
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);
1678
+ let xt = new y.Vector3().subVectors(dt, it).normalize(), St = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1679
+ const wt = te(et, st, St, Bt);
1680
1680
  if (wt == null) continue;
1681
1681
  let Xt = Q.distanceTo(wt.point);
1682
1682
  Xt < ht && (ht = Xt, Z = U);
1683
- } else if (St && St.angle < 5) {
1683
+ } else if (vt && vt.angle < 5) {
1684
1684
  const At = new y.Vector3(W.x, W.y, 0), Y = new y.Vector3(j.x, j.y, 0);
1685
- let pt = Lt(At, it), et = Lt(At, dt), st = Lt(Y, it), xt = Lt(Y, dt), vt = Jt(Q, gt, it, At), Bt = !1;
1685
+ let pt = Rt(At, it), et = Rt(At, dt), st = Rt(Y, it), xt = Rt(Y, dt), St = Jt(Q, gt, it, At), Bt = !1;
1686
1686
  for (let wt = 0; wt < n[U].checkResults.length; wt++) {
1687
1687
  let Xt = [];
1688
1688
  for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
@@ -1691,16 +1691,16 @@ const wi = async (n, t, e, o, i) => {
1691
1691
  n[U].checkResults[wt].allCenterPoints[Kt].y,
1692
1692
  0
1693
1693
  ));
1694
- let $t = Se(Xt);
1694
+ let $t = ve(Xt);
1695
1695
  if ($t.length == 2) {
1696
- let Kt = Lt(At, $t[0]), Le = Lt(At, $t[1]), Re = Lt(Y, $t[0]), Fe = Lt(Y, $t[1]);
1697
- if (Kt < 0.2 || Le < 0.2 || Re < 0.2 || Fe < 0.2) {
1696
+ let Kt = Rt(At, $t[0]), Re = Rt(At, $t[1]), Le = Rt(Y, $t[0]), Fe = Rt(Y, $t[1]);
1697
+ if (Kt < 0.2 || Re < 0.2 || Le < 0.2 || Fe < 0.2) {
1698
1698
  Bt = !0;
1699
1699
  break;
1700
1700
  }
1701
1701
  }
1702
1702
  }
1703
- if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1703
+ if (St && St.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1704
1704
  k = !0, ht = 1 / 0, Z = -1;
1705
1705
  break;
1706
1706
  }
@@ -1727,27 +1727,27 @@ const wi = async (n, t, e, o, i) => {
1727
1727
  for (let U = 0; U < n.length; U++) {
1728
1728
  if (U == m) continue;
1729
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);
1730
+ let vt = re(Q, gt, it, dt);
1731
1731
  if (Ct != null) {
1732
- if (St && St.angle > 85 && (Ct.point.distanceTo(Q), Ct.point.distanceTo(gt) < 0.3)) {
1732
+ if (vt && vt.angle > 85 && (Ct.point.distanceTo(Q), Ct.point.distanceTo(gt) < 0.3)) {
1733
1733
  ft = !0, ht = 1 / 0, Z = -1;
1734
1734
  break;
1735
1735
  }
1736
1736
  continue;
1737
1737
  }
1738
- if (St && St.angle > 85) {
1738
+ if (vt && vt.angle > 85) {
1739
1739
  const Y = new y.Line3(it, dt).closestPointToPoint(gt, !0, Gt);
1740
1740
  let pt = Jt(gt, Q, Y, gt);
1741
1741
  if (!pt || pt.direction != "same") continue;
1742
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);
1743
+ let xt = new y.Vector3().subVectors(dt, it).normalize(), St = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1744
+ const wt = te(et, st, St, Bt);
1745
1745
  if (wt == null) continue;
1746
1746
  let Xt = gt.distanceTo(wt.point);
1747
1747
  Xt < ht && (ht = Xt, Z = U);
1748
- } else if (St && St.angle < 5) {
1748
+ } else if (vt && vt.angle < 5) {
1749
1749
  const At = new y.Vector3(W.x, W.y, 0), Y = new y.Vector3(j.x, j.y, 0);
1750
- let pt = Lt(At, it), et = Lt(At, dt), st = Lt(Y, it), xt = Lt(Y, dt), vt = Jt(gt, Q, it, At), Bt = !1;
1750
+ let pt = Rt(At, it), et = Rt(At, dt), st = Rt(Y, it), xt = Rt(Y, dt), St = Jt(gt, Q, it, At), Bt = !1;
1751
1751
  for (let wt = 0; wt < n[U].checkResults.length; wt++) {
1752
1752
  let Xt = [];
1753
1753
  for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
@@ -1756,16 +1756,16 @@ const wi = async (n, t, e, o, i) => {
1756
1756
  n[U].checkResults[wt].allCenterPoints[Kt].y,
1757
1757
  0
1758
1758
  ));
1759
- let $t = Se(Xt);
1759
+ let $t = ve(Xt);
1760
1760
  if ($t.length == 2) {
1761
- let Kt = Lt(At, $t[0]), Le = Lt(At, $t[1]), Re = Lt(Y, $t[0]), Fe = Lt(Y, $t[1]);
1762
- if (Kt < 0.2 || Le < 0.2 || Re < 0.2 || Fe < 0.2) {
1761
+ let Kt = Rt(At, $t[0]), Re = Rt(At, $t[1]), Le = Rt(Y, $t[0]), Fe = Rt(Y, $t[1]);
1762
+ if (Kt < 0.2 || Re < 0.2 || Le < 0.2 || Fe < 0.2) {
1763
1763
  Bt = !0;
1764
1764
  break;
1765
1765
  }
1766
1766
  }
1767
1767
  }
1768
- if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1768
+ if (St && St.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1769
1769
  k = !0, ht = 1 / 0, Z = -1;
1770
1770
  break;
1771
1771
  }
@@ -1839,10 +1839,10 @@ const wi = async (n, t, e, o, i) => {
1839
1839
  let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), q = 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, q).normalize(), at = new y.Vector3().subVectors(bt, Vt).normalize(), Q = 0.25, gt = ct.clone().addScaledVector(Ut, Q), Pt = q.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 = q.distanceTo(bt), dt = q.distanceTo(Vt);
1840
1840
  (ft < f || U < f || it < f || dt < f || Z) && k && (e[a[J].index].isFindBeam = !0, _t = !0, a[J].isFind = !0, Tt = J);
1841
1841
  }
1842
- (_t || Wt || Math.abs(Mt - V) > 0.1 && Mt > V / 2 && H > 0.3) && (Rt = !0);
1842
+ (_t || Wt || Math.abs(Mt - V) > 0.1 && Mt > V / 2 && H > 0.3) && (Lt = !0);
1843
1843
  }
1844
1844
  }
1845
- if (Rt) {
1845
+ if (Lt) {
1846
1846
  let Wt = !1;
1847
1847
  for (let Z = 0; Z < d.length; Z++) {
1848
1848
  let k = ne(d[Z].start, d[Z].end, W, j);
@@ -1862,19 +1862,19 @@ const wi = async (n, t, e, o, i) => {
1862
1862
  {
1863
1863
  new y.PointsMaterial({ color: 65535, size: 0.01 });
1864
1864
  let Z = new y.Vector3().subVectors(W, j), k = new y.Vector3().subVectors(j, W), ft = 1 / 0, U = 1 / 0, it = W.clone(), dt = j.clone();
1865
- const Ct = [], St = [];
1865
+ const Ct = [], vt = [];
1866
1866
  let At = new y.Line3(tt, lt), Y = new y.Vector3(), pt = 999999;
1867
1867
  if (p.originalPoints.forEach((et) => {
1868
1868
  if (et.z - W.z < Mt / 2 + 0.1 && et.z - W.z > Mt / 2 - 0.1 && Ct.push(et), et.z > tt.z) {
1869
- let st = At.closestPointToPoint(et, !0, Y), 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);
1869
+ let st = At.closestPointToPoint(et, !0, Y), xt = new y.Vector3().subVectors(st, tt), St = new y.Vector3().subVectors(st, lt), Bt = oe(Z, St), wt = oe(k, xt);
1870
+ Bt && Bt.parallel && !Bt.sameDirection && wt && wt.parallel && !wt.sameDirection && vt.push(et);
1871
1871
  }
1872
1872
  }), Ct.length > 0) {
1873
1873
  const { newProjectPoints: et } = ze(W, j, Ct);
1874
1874
  for (const st of et)
1875
1875
  st.z = W.z;
1876
1876
  et.forEach((st) => {
1877
- let xt = new y.Vector3(st.x, st.y, W.z), vt = new y.Vector3().subVectors(xt, j), Bt = new y.Vector3().subVectors(xt, W), wt = oe(Z, Bt), Xt = oe(k, vt);
1877
+ let xt = new y.Vector3(st.x, st.y, W.z), St = new y.Vector3().subVectors(xt, j), Bt = new y.Vector3().subVectors(xt, W), wt = oe(Z, Bt), Xt = oe(k, St);
1878
1878
  if (wt && wt.parallel && wt.sameDirection) {
1879
1879
  let $t = xt.distanceTo(W);
1880
1880
  $t < ft && (ft = $t, it = xt);
@@ -1884,11 +1884,11 @@ const wi = async (n, t, e, o, i) => {
1884
1884
  }
1885
1885
  });
1886
1886
  }
1887
- if (it.equals(W) || (W = it, lt = new y.Vector3(W.x, W.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);
1887
+ if (it.equals(W) || (W = it, lt = new y.Vector3(W.x, W.y, lt.z)), dt.equals(j) || (j = dt, tt = new y.Vector3(j.x, j.y, tt.z)), vt.length > 10) {
1888
+ const { newOnLinePoints: et } = ze(lt, tt, vt);
1889
1889
  for (let st = 0; st < et.length; st++) {
1890
- let vt = At.closestPointToPoint(et[st], !0, Y).distanceTo(et[st]);
1891
- vt > 0.02 && pt > vt && (pt = vt);
1890
+ let St = At.closestPointToPoint(et[st], !0, Y).distanceTo(et[st]);
1891
+ St > 0.02 && pt > St && (pt = St);
1892
1892
  }
1893
1893
  tt.z += pt, lt.z += pt, Mt += pt;
1894
1894
  }
@@ -1929,8 +1929,8 @@ const wi = async (n, t, e, o, i) => {
1929
1929
  dt.start.z = 0, dt.end.z = 0;
1930
1930
  let Ct = ee(k.beamStart, k.beamEnd, !0);
1931
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), Y = At.distanceTo(Ct), pt = new y.Vector3().subVectors(Ct, At).normalize(), et = pt.clone().negate(), st = Ct.clone().addScaledVector(et, Y + 0.1), xt = te(dt.start, dt.end, Ct, st), vt = !_t && !k.isDoor && (U > it * 2 || it > U * 2);
1933
- if (Y < 0.4 && xt != null && !vt) {
1932
+ let vt = new y.Vector3(), At = dt.closestPointToPoint(Ct, !0, vt), Y = At.distanceTo(Ct), pt = new y.Vector3().subVectors(Ct, At).normalize(), et = pt.clone().negate(), st = Ct.clone().addScaledVector(et, Y + 0.1), xt = te(dt.start, dt.end, Ct, st), St = !_t && !k.isDoor && (U > it * 2 || it > U * 2);
1933
+ if (Y < 0.4 && xt != null && !St) {
1934
1934
  k.nearId = l, q.nearId = k.id;
1935
1935
  let Bt = 0.8;
1936
1936
  (k.isDoor || q.isDoor) && (k.isDoor = !0, q.isDoor = !0);
@@ -1949,28 +1949,28 @@ const wi = async (n, t, e, o, i) => {
1949
1949
  const Ct = ho(n[k]);
1950
1950
  if (it && it.maxPerpendicularDistance < 0.5) {
1951
1951
  if (dt && dt.isParallel) {
1952
- let st = new y.Line3(ft, U), xt = new y.Vector3(W.x, W.y, ft.z), vt = st.closestPointToPoint(xt, !0, new y.Vector3()), Bt = re(vt, xt, W, j);
1953
- Bt && Bt.angle > 85 && (q.beamNearWallVec = new y.Vector3().subVectors(vt, xt).normalize());
1952
+ let st = new y.Line3(ft, U), xt = new y.Vector3(W.x, W.y, ft.z), St = st.closestPointToPoint(xt, !0, new y.Vector3()), Bt = re(St, xt, W, j);
1953
+ Bt && Bt.angle > 85 && (q.beamNearWallVec = new y.Vector3().subVectors(St, xt).normalize());
1954
1954
  }
1955
- const St = [];
1955
+ const vt = [];
1956
1956
  n[k].originalPoints.forEach((st) => {
1957
- st.z > W.z + 0.2 && st.z < W.z + Mt / 2 && St.push(new y.Vector3(st.x, st.y, W.z));
1957
+ st.z > W.z + 0.2 && st.z < W.z + Mt / 2 && vt.push(new y.Vector3(st.x, st.y, W.z));
1958
1958
  });
1959
1959
  const At = new y.Vector3();
1960
1960
  let Y = [], 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 && (Y.push(St[st]), pt.push(xt.clone()));
1961
+ for (let st = 0; st < vt.length; st++) {
1962
+ let xt = Z.closestPointToPoint(vt[st], !0, At);
1963
+ xt.distanceTo(vt[st]) < 0.15 && (Y.push(vt[st]), pt.push(xt.clone()));
1964
1964
  }
1965
1965
  for (let st = 0; st < pt.length; st++)
1966
1966
  mo(Z, pt[st]) && Y.push(pt[st]);
1967
1967
  if (Y = pt, Y = po(Y), Y.length < 150) continue;
1968
- let et = Se(Y);
1968
+ let et = ve(Y);
1969
1969
  if (et.length == 2) {
1970
1970
  let st = et[0].distanceTo(et[1]);
1971
1971
  if (Math.abs(st - Z.distance()) < 0.3) {
1972
- let xt = new y.Line3(ft, U), vt = new y.Vector3(W.x, W.y, ft.z), Bt = xt.closestPointToPoint(vt, !0, new y.Vector3());
1973
- if (q.beamNearWallVec = new y.Vector3().subVectors(Bt, vt).normalize(), q.beamStart.z > Ct.maxZ - 0.03 && H > 1)
1972
+ let xt = new y.Line3(ft, U), St = new y.Vector3(W.x, W.y, ft.z), Bt = xt.closestPointToPoint(St, !0, new y.Vector3());
1973
+ if (q.beamNearWallVec = new y.Vector3().subVectors(Bt, St).normalize(), q.beamStart.z > Ct.maxZ - 0.03 && H > 1)
1974
1974
  Pt = !0;
1975
1975
  else if (Wt = !0, Tt != -1 && (e[a[Tt].index].isFindBeam = !1, a[Tt].isFind = !1), Q != -1 && gt != -1) {
1976
1976
  const wt = n[Q].doorAndBeamData[gt];
@@ -2020,55 +2020,55 @@ const wi = async (n, t, e, o, i) => {
2020
2020
  if (h.length > 1)
2021
2021
  for (let m = 0; m < h.length; m++) {
2022
2022
  let p = [];
2023
- for (let b = 0; b < n[h[m]].doorAndBeamData.length; b++) {
2023
+ for (let P = 0; P < n[h[m]].doorAndBeamData.length; P++) {
2024
2024
  let z = !1;
2025
- if (n[h[m]].doorAndBeamData[b].type === "beam" && n[h[m]].doorAndBeamData[b].beamNearWallVec.x == 0 && n[h[m]].doorAndBeamData[b].beamNearWallVec.y == 0 && n[h[m]].doorAndBeamData[b].beamNearWallVec.z == 0 && n[h[m]].doorAndBeamData[b].nearId == -1 && (z = !0), !z) {
2026
- let v = n[h[m]].doorAndBeamData[b].doorStart.clone(), S = n[h[m]].doorAndBeamData[b].doorEnd.clone();
2027
- v.z = S.z = 0;
2028
- let V = v.distanceTo(S);
2025
+ if (n[h[m]].doorAndBeamData[P].type === "beam" && n[h[m]].doorAndBeamData[P].beamNearWallVec.x == 0 && n[h[m]].doorAndBeamData[P].beamNearWallVec.y == 0 && n[h[m]].doorAndBeamData[P].beamNearWallVec.z == 0 && n[h[m]].doorAndBeamData[P].nearId == -1 && (z = !0), !z) {
2026
+ let S = n[h[m]].doorAndBeamData[P].doorStart.clone(), v = n[h[m]].doorAndBeamData[P].doorEnd.clone();
2027
+ S.z = v.z = 0;
2028
+ let V = S.distanceTo(v);
2029
2029
  for (let D = 0; D < h.length; D++)
2030
2030
  if (m != D)
2031
2031
  for (let _ = 0; _ < n[h[D]].doorAndBeamData.length; _++) {
2032
2032
  let E = n[h[D]].doorAndBeamData[_].doorStart.clone(), T = n[h[D]].doorAndBeamData[_].doorEnd.clone();
2033
2033
  E.z = T.z = 0, E.distanceTo(T);
2034
- let A = ne(v, S, E, T);
2034
+ let A = ne(S, v, E, T);
2035
2035
  if (A.type == "collinear_overlap" && A.maxPerpendicularDistance < 0.2) {
2036
- let O = new y.Line3(E, T), I = ee(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), L = I.distanceTo(B);
2037
- if (Math.abs(V - A.overlap) < 0.1 && L < 0.04) {
2038
- n[h[D]].doorAndBeamData[_].nearId == n[h[m]].doorAndBeamData[b].id && (n[h[D]].doorAndBeamData[_].nearId = -1), z = !0;
2036
+ let O = new y.Line3(E, T), I = ee(S, v), B = O.closestPointToPoint(I, !0, new y.Vector3()), R = I.distanceTo(B);
2037
+ if (Math.abs(V - A.overlap) < 0.1 && R < 0.04) {
2038
+ n[h[D]].doorAndBeamData[_].nearId == n[h[m]].doorAndBeamData[P].id && (n[h[D]].doorAndBeamData[_].nearId = -1), z = !0;
2039
2039
  break;
2040
2040
  }
2041
2041
  }
2042
2042
  }
2043
2043
  }
2044
- z || p.push(n[h[m]].doorAndBeamData[b]);
2044
+ z || p.push(n[h[m]].doorAndBeamData[P]);
2045
2045
  }
2046
2046
  p.length != n[h[m]].doorAndBeamData.length && (n[h[m]].doorAndBeamData = p);
2047
2047
  }
2048
- let w = 0.65, x = 2, P = [], M = [];
2048
+ let w = 0.65, x = 2, b = [], M = [];
2049
2049
  for (let m = 0; m < a.length; m++) {
2050
2050
  if (a[m].isFind || a[m].inWall)
2051
2051
  continue;
2052
- let p = new y.Vector3(a[m].doorStartPt.x, a[m].doorStartPt.y, 0), b = new y.Vector3(a[m].doorEndPt.x, a[m].doorEndPt.y, 0), z = new y.Vector3().subVectors(p, b).normalize();
2053
- for (let v = 0; v < n.length; v++) {
2054
- if (n[v].length < 0.7 || n[v].completePointAreaPercentage > 60)
2052
+ let p = new y.Vector3(a[m].doorStartPt.x, a[m].doorStartPt.y, 0), P = new y.Vector3(a[m].doorEndPt.x, a[m].doorEndPt.y, 0), z = new y.Vector3().subVectors(p, P).normalize();
2053
+ for (let S = 0; S < n.length; S++) {
2054
+ if (n[S].length < 0.7 || n[S].completePointAreaPercentage > 60)
2055
2055
  continue;
2056
- let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), V = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, V).normalize(), _ = 0.3, E = p.clone().addScaledVector(z, _), T = b.clone().addScaledVector(z.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = V.clone().addScaledVector(D.clone().negate(), _);
2056
+ let v = new y.Vector3(n[S].start.x, n[S].start.y, 0), V = new y.Vector3(n[S].end.x, n[S].end.y, 0), D = new y.Vector3().subVectors(v, V).normalize(), _ = 0.3, E = p.clone().addScaledVector(z, _), T = P.clone().addScaledVector(z.clone().negate(), _), A = v.clone().addScaledVector(D, _), O = V.clone().addScaledVector(D.clone().negate(), _);
2057
2057
  te(E, T, A, O);
2058
2058
  let I = Jt(
2059
2059
  E,
2060
2060
  T,
2061
2061
  A,
2062
2062
  O
2063
- ), B = p.distanceTo(S) > b.distanceTo(S) ? b : p, L = B.distanceTo(S), N = B.distanceTo(V);
2064
- if ((L < f || N < f) && I && !I.isParallel) {
2065
- let R = p.distanceTo(S), $ = p.distanceTo(V), X = R < $ ? S : V, ot = !1;
2063
+ ), B = p.distanceTo(v) > P.distanceTo(v) ? P : p, R = B.distanceTo(v), N = B.distanceTo(V);
2064
+ if ((R < f || N < f) && I && !I.isParallel) {
2065
+ let L = p.distanceTo(v), $ = p.distanceTo(V), X = L < $ ? v : V, ot = !1;
2066
2066
  for (let K = 0; K < n.length; K++) {
2067
- if (K == v || P.includes(K) || n[K].length < 0.7)
2067
+ if (K == S || b.includes(K) || n[K].length < 0.7)
2068
2068
  continue;
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(), H = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(S, V, G, ut), qt = ne(S, V, G, ut), Rt = te(S, V, H, Mt), _t = !0;
2070
- if (Rt != null && (_t = Rt.point.distanceTo(S) < f || Rt.point.distanceTo(V) < f), (Zt && Zt.angle > 85 || qt && qt.type == "collinear_gap") && _t) {
2071
- let Et = new y.Line3(S, V), Ft = new y.Vector3(), tt = Et.closestPointToPoint(G, !0, Ft), lt = Et.closestPointToPoint(ut, !0, Ft), W = tt.distanceTo(G), j = lt.distanceTo(ut), Nt, Tt;
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(), H = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(v, V, G, ut), qt = ne(v, V, G, ut), Lt = te(v, V, H, Mt), _t = !0;
2070
+ if (Lt != null && (_t = Lt.point.distanceTo(v) < f || Lt.point.distanceTo(V) < f), (Zt && Zt.angle > 85 || qt && qt.type == "collinear_gap") && _t) {
2071
+ let Et = new y.Line3(v, V), Ft = new y.Vector3(), tt = Et.closestPointToPoint(G, !0, Ft), lt = Et.closestPointToPoint(ut, !0, Ft), W = tt.distanceTo(G), j = lt.distanceTo(ut), Nt, Tt;
2072
2072
  if (W > j && j > w)
2073
2073
  Nt = ut, Tt = lt;
2074
2074
  else if (W < j && W > w)
@@ -2080,7 +2080,7 @@ const wi = async (n, t, e, o, i) => {
2080
2080
  let Wt = Jt(Nt, Tt, G, ut), J = Jt(Nt, Tt, E, T);
2081
2081
  if (J && J.isParallel || !Wt || !Wt.isParallel)
2082
2082
  continue;
2083
- let ct = ne(p, b, Nt, Tt);
2083
+ let ct = ne(p, P, Nt, Tt);
2084
2084
  if (ct && ct.type == "collinear_overlap" && ct.maxPerpendicularDistance < 0.2)
2085
2085
  continue;
2086
2086
  Nt.z = Tt.z = n[K].start.z;
@@ -2107,8 +2107,8 @@ const wi = async (n, t, e, o, i) => {
2107
2107
  M.push({
2108
2108
  start: Nt,
2109
2109
  end: Tt
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;
2110
+ }), b.push(K);
2111
+ let bt = n[K].rooftopPz - n[K].start.z, Vt = n[S].rooftopPz - n[S].start.z, Ut = bt < Vt ? bt : Vt;
2112
2112
  n[K].doorAndBeamData || (n[K].doorAndBeamData = []), n[K].doorAndBeamData.push({
2113
2113
  id: l,
2114
2114
  beamStart: Nt,
@@ -2148,40 +2148,40 @@ const wi = async (n, t, e, o, i) => {
2148
2148
  let u = n[l].length;
2149
2149
  if (o.has(n[l].uuid) || u < i || u > r)
2150
2150
  continue;
2151
- let h = [], d = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), c = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), w = new y.Vector3().subVectors(c, d).normalize().clone().negate(), x = new y.Vector3(), P = new y.Vector3(), M = new y.Vector3();
2151
+ let h = [], d = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), c = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), w = new y.Vector3().subVectors(c, d).normalize().clone().negate(), x = new y.Vector3(), b = new y.Vector3(), M = new y.Vector3();
2152
2152
  new y.Vector3();
2153
2153
  for (let g = 0; g < n.length; g++) {
2154
2154
  let m = n[g].length;
2155
2155
  if (g == l || m < i || m > r)
2156
2156
  continue;
2157
- let p = new y.Vector3(n[g].start.x, n[g].start.y, n[g].start.z), b = new y.Vector3(n[g].end.x, n[g].end.y, n[g].end.z), z = re(d, c, p, b);
2157
+ let p = new y.Vector3(n[g].start.x, n[g].start.y, n[g].start.z), P = new y.Vector3(n[g].end.x, n[g].end.y, n[g].end.z), z = re(d, c, p, P);
2158
2158
  if (!z || z.angle < 85)
2159
2159
  continue;
2160
- let v = kt(p, d), S = kt(p, c), V = kt(b, d), D = kt(b, c);
2161
- if (!(!v && !S && !V && !D)) {
2162
- 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();
2160
+ let S = kt(p, d), v = kt(p, c), V = kt(P, d), D = kt(P, c);
2161
+ if (!(!S && !v && !V && !D)) {
2162
+ S || v ? (x = p.clone(), b = P.clone()) : (x = P.clone(), b = p.clone()), M = new y.Vector3().subVectors(b, x).normalize(), M.clone().negate();
2163
2163
  for (let _ = 0; _ < n.length; _++) {
2164
2164
  let E = n[_].length;
2165
2165
  if (_ == l || _ == g || E < i || E > r)
2166
2166
  continue;
2167
- 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 = re(p, b, T, A);
2167
+ 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 = re(p, P, T, A);
2168
2168
  if (!O || O.angle < 85)
2169
2169
  continue;
2170
- let I = kt(T, P), B = kt(A, P);
2170
+ let I = kt(T, b), B = kt(A, b);
2171
2171
  if (!I && !B) continue;
2172
2172
  new y.Vector3();
2173
- let L = new y.Vector3(), N = new y.Vector3();
2174
- I ? (N = new y.Vector3().subVectors(A, T).normalize(), T.clone(), L = A.clone()) : (N = new y.Vector3().subVectors(T, A).normalize(), A.clone(), L = T.clone());
2173
+ let R = new y.Vector3(), N = new y.Vector3();
2174
+ I ? (N = new y.Vector3().subVectors(A, T).normalize(), T.clone(), R = A.clone()) : (N = new y.Vector3().subVectors(T, A).normalize(), A.clone(), R = T.clone());
2175
2175
  let C = oe(w, N, 0.1);
2176
2176
  if (!(!C || !C.parallel || !C.sameDirection)) {
2177
- for (let R = 0; R < n.length; R++) {
2178
- let $ = n[R].length;
2179
- if (R == l || R == g || R == _ || $ < i || $ > r)
2177
+ for (let L = 0; L < n.length; L++) {
2178
+ let $ = n[L].length;
2179
+ if (L == l || L == g || L == _ || $ < i || $ > r)
2180
2180
  continue;
2181
- let X = new y.Vector3(n[R].start.x, n[R].start.y, n[R].start.z), ot = new y.Vector3(n[R].end.x, n[R].end.y, n[R].end.z), K = re(X, ot, T, A);
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, T, A);
2182
2182
  if (!K || K.angle < 85)
2183
2183
  continue;
2184
- let G = kt(X, L), ut = kt(ot, L);
2184
+ let G = kt(X, R), ut = kt(ot, R);
2185
2185
  if (!G && !ut) continue;
2186
2186
  new y.Vector3();
2187
2187
  let rt = new y.Vector3();
@@ -2190,7 +2190,7 @@ const wi = async (n, t, e, o, i) => {
2190
2190
  if (!F && !H) continue;
2191
2191
  let Mt = u * m;
2192
2192
  if (!(Mt < s || Mt > a)) {
2193
- h = [n[l].uuid, n[g].uuid, n[_].uuid, n[R].uuid];
2193
+ h = [n[l].uuid, n[g].uuid, n[_].uuid, n[L].uuid];
2194
2194
  break;
2195
2195
  }
2196
2196
  }
@@ -2209,7 +2209,7 @@ const wi = async (n, t, e, o, i) => {
2209
2209
  if (o.has(n[l].uuid) || u < i || u > r)
2210
2210
  continue;
2211
2211
  let h = {
2212
- indexs: [],
2212
+ uuids: [],
2213
2213
  missingEdge: {
2214
2214
  start: new y.Vector3(),
2215
2215
  end: new y.Vector3()
@@ -2218,25 +2218,25 @@ const wi = async (n, t, e, o, i) => {
2218
2218
  for (let M = 0; M < n.length; M++) {
2219
2219
  if (M == l || n[M].length < i)
2220
2220
  continue;
2221
- let g = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), m = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), p = kt(g, d), b = kt(m, d), z = kt(g, c), v = kt(m, c);
2222
- if (p || b ? f = !1 : (z || v) && (w = !1), !f && !w) break;
2221
+ let g = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), m = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), p = kt(g, d), P = kt(m, d), z = kt(g, c), S = kt(m, c);
2222
+ if (p || P ? f = !1 : (z || S) && (w = !1), !f && !w) break;
2223
2223
  }
2224
2224
  if (!f && !w) continue;
2225
2225
  let x = new y.Vector3();
2226
2226
  f || ([d, c] = [c, d]), x = new y.Vector3().subVectors(c, d).normalize();
2227
- let P = x.clone().negate();
2227
+ let b = x.clone().negate();
2228
2228
  for (let M = 0; M < n.length; M++) {
2229
2229
  let g = n[M].length;
2230
2230
  if (M == l || o.has(M) || g < i || g > r)
2231
2231
  continue;
2232
- let m = 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 = re(d, c, m, p);
2233
- if (!b || b.angle < 85)
2232
+ let m = 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), P = re(d, c, m, p);
2233
+ if (!P || P.angle < 85)
2234
2234
  continue;
2235
- let z = kt(m, c), v = kt(p, c);
2236
- if (!z && !v) continue;
2235
+ let z = kt(m, c), S = kt(p, c);
2236
+ if (!z && !S) continue;
2237
2237
  new y.Vector3();
2238
- let S = new y.Vector3();
2239
- z ? (m.clone(), S = p.clone()) : (p.clone(), S = m.clone());
2238
+ let v = new y.Vector3();
2239
+ z ? (m.clone(), v = p.clone()) : (p.clone(), v = m.clone());
2240
2240
  for (let V = 0; V < n.length; V++) {
2241
2241
  let D = n[V].length;
2242
2242
  if (V == l || V == M || o.has(V) || D < i || D > r)
@@ -2244,28 +2244,28 @@ const wi = async (n, t, e, o, i) => {
2244
2244
  let _ = new y.Vector3(n[V].start.x, n[V].start.y, n[V].start.z), E = new y.Vector3(n[V].end.x, n[V].end.y, n[V].end.z), T = re(m, p, _, E);
2245
2245
  if (!T || T.angle < 85)
2246
2246
  continue;
2247
- let A = kt(_, S), O = kt(E, S);
2247
+ let A = kt(_, v), O = kt(E, v);
2248
2248
  if (!A && !O) continue;
2249
2249
  let I = new y.Vector3(), B = new y.Vector3();
2250
2250
  A ? (I = _.clone(), B = E.clone()) : (I = E.clone(), B = _.clone());
2251
- let L = new y.Vector3().subVectors(B, I).normalize(), N = oe(P, L, 0.1);
2251
+ let R = new y.Vector3().subVectors(B, I).normalize(), N = oe(b, R, 0.1);
2252
2252
  if (!N || !N.parallel || !N.sameDirection) continue;
2253
- let C = !0, R = !0;
2253
+ let C = !0, L = !0;
2254
2254
  for (let X = 0; X < n.length; X++) {
2255
2255
  if (X == V || n[X].length < i) continue;
2256
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, E), F = kt(K, E);
2257
- if (G || ut ? C = !1 : (rt || F) && (R = !1), !C && !R) break;
2257
+ if (G || ut ? C = !1 : (rt || F) && (L = !1), !C && !L) break;
2258
2258
  }
2259
- if (!C && !R) continue;
2259
+ if (!C && !L) continue;
2260
2260
  let $ = u * g;
2261
2261
  if (!($ < s || $ > a)) {
2262
- h.indexs = [n[l].uuid, n[M].uuid, n[V].uuid], h.missingEdge.start = B, h.missingEdge.end = d;
2262
+ h.uuids = [n[l].uuid, n[M].uuid, n[V].uuid], h.missingEdge.start = B, h.missingEdge.end = d;
2263
2263
  break;
2264
2264
  }
2265
2265
  }
2266
- if (h.indexs.length == 3) break;
2266
+ if (h.uuids.length == 3) break;
2267
2267
  }
2268
- h.indexs.length == 3 && (h.indexs.forEach((M) => o.add(M)), e.threeEdgeRect.push(h));
2268
+ h.uuids.length == 3 && (h.uuids.forEach((M) => o.add(M)), e.threeEdgeRect.push(h));
2269
2269
  }
2270
2270
  return e;
2271
2271
  }, ae = 11102230246251565e-32, Yt = 134217729, Do = (3 + 8 * ae) * ae;
@@ -2292,20 +2292,20 @@ function Ve(n) {
2292
2292
  }
2293
2293
  const Eo = (3 + 16 * ae) * ae, To = (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
2294
  function Bo(n, t, e, o, i, r, s) {
2295
- let a, l, u, h, d, c, f, w, x, P, M, g, m, p, b, z, v, S;
2295
+ let a, l, u, h, d, c, f, w, x, b, M, g, m, p, P, z, S, v;
2296
2296
  const V = n - i, D = e - i, _ = t - r, E = o - r;
2297
- p = V * E, c = Yt * V, f = c - (c - V), w = V - f, c = Yt * E, x = c - (c - E), P = E - x, b = w * P - (p - f * x - w * x - f * P), z = _ * D, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * D, x = c - (c - D), P = D - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, me[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, me[1] = m - (M + d) + (d - z), S = g + M, d = S - g, me[2] = g - (S - d) + (M - d), me[3] = S;
2297
+ p = V * E, c = Yt * V, f = c - (c - V), w = V - f, c = Yt * E, x = c - (c - E), b = E - x, P = w * b - (p - f * x - w * x - f * b), z = _ * D, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * D, x = c - (c - D), b = D - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, me[0] = P - (M + d) + (d - S), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, me[1] = m - (M + d) + (d - z), v = g + M, d = v - g, me[2] = g - (v - d) + (M - d), me[3] = v;
2298
2298
  let T = _o(4, me), A = To * s;
2299
2299
  if (T >= A || -T >= A || (d = n - V, a = n - (V + d) + (d - i), d = e - D, u = e - (D + d) + (d - i), d = t - _, l = t - (_ + d) + (d - r), d = o - E, h = o - (E + d) + (d - r), a === 0 && l === 0 && u === 0 && h === 0) || (A = Ao * s + Do * Math.abs(T), T += V * h + E * a - (_ * u + D * l), T >= A || -T >= A)) return T;
2300
- p = a * E, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * E, x = c - (c - E), P = E - x, b = w * P - (p - f * x - w * x - f * P), z = l * D, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * D, x = c - (c - D), P = D - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, jt[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
2300
+ p = a * E, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * E, x = c - (c - E), b = E - x, P = w * b - (p - f * x - w * x - f * b), z = l * D, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * D, x = c - (c - D), b = D - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, jt[0] = P - (M + d) + (d - S), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), v = g + M, d = v - g, jt[2] = g - (v - d) + (M - d), jt[3] = v;
2301
2301
  const O = qe(4, me, 4, jt, on);
2302
- p = V * h, c = Yt * V, f = c - (c - V), w = V - f, c = Yt * h, x = c - (c - h), P = h - x, b = w * P - (p - f * x - w * x - f * P), z = _ * u, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * u, x = c - (c - u), P = u - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, jt[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
2302
+ p = V * h, c = Yt * V, f = c - (c - V), w = V - f, c = Yt * h, x = c - (c - h), b = h - x, P = w * b - (p - f * x - w * x - f * b), z = _ * u, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * u, x = c - (c - u), b = u - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, jt[0] = P - (M + d) + (d - S), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), v = g + M, d = v - g, jt[2] = g - (v - d) + (M - d), jt[3] = v;
2303
2303
  const I = qe(O, on, 4, jt, rn);
2304
- p = a * h, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * h, x = c - (c - h), P = h - x, b = w * P - (p - f * x - w * x - f * P), z = l * u, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * u, x = c - (c - u), P = u - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, jt[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
2304
+ p = a * h, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * h, x = c - (c - h), b = h - x, P = w * b - (p - f * x - w * x - f * b), z = l * u, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * u, x = c - (c - u), b = u - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, jt[0] = P - (M + d) + (d - S), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), v = g + M, d = v - g, jt[2] = g - (v - d) + (M - d), jt[3] = v;
2305
2305
  const B = qe(I, rn, 4, jt, sn);
2306
2306
  return sn[B - 1];
2307
2307
  }
2308
- function ve(n, t, e, o, i, r) {
2308
+ function Se(n, t, e, o, i, r) {
2309
2309
  const s = (t - r) * (e - i), a = (n - i) * (o - r), l = s - a, u = Math.abs(s + a);
2310
2310
  return Math.abs(l) >= Eo * u ? l : -Bo(n, t, e, o, i, r, u);
2311
2311
  }
@@ -2321,7 +2321,7 @@ class Be {
2321
2321
  * @param {(p: P) => number} [getY]
2322
2322
  */
2323
2323
  // @ts-expect-error TS2322
2324
- static from(t, e = Ro, o = Fo) {
2324
+ static from(t, e = Lo, o = Fo) {
2325
2325
  const i = t.length, r = new Float64Array(i * 2);
2326
2326
  for (let s = 0; s < i; s++) {
2327
2327
  const a = t[s];
@@ -2359,19 +2359,19 @@ class Be {
2359
2359
  const _ = We(d, c, t[2 * V], t[2 * V + 1]);
2360
2360
  _ < D && (f = V, D = _);
2361
2361
  }
2362
- const P = t[2 * f], M = t[2 * f + 1];
2362
+ const b = t[2 * f], M = t[2 * f + 1];
2363
2363
  for (let V = 0, D = 1 / 0; V < s; V++) {
2364
2364
  if (V === f) continue;
2365
- const _ = We(P, M, t[2 * V], t[2 * V + 1]);
2365
+ const _ = We(b, M, t[2 * V], t[2 * V + 1]);
2366
2366
  _ < D && _ > 0 && (w = V, D = _);
2367
2367
  }
2368
2368
  let g = t[2 * w], m = t[2 * w + 1], p = 1 / 0;
2369
2369
  for (let V = 0; V < s; V++) {
2370
2370
  if (V === f || V === w) continue;
2371
- const D = Co(P, M, g, m, t[2 * V], t[2 * V + 1]);
2371
+ const D = Co(b, M, g, m, t[2 * V], t[2 * V + 1]);
2372
2372
  D < p && (x = V, p = D);
2373
2373
  }
2374
- let b = t[2 * x], z = t[2 * x + 1];
2374
+ let P = t[2 * x], z = t[2 * x + 1];
2375
2375
  if (p === 1 / 0) {
2376
2376
  for (let _ = 0; _ < s; _++)
2377
2377
  this._dists[_] = t[2 * _] - t[0] || t[2 * _ + 1] - t[1];
@@ -2385,43 +2385,43 @@ class Be {
2385
2385
  this.hull = V.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
2386
2386
  return;
2387
2387
  }
2388
- if (ve(P, M, g, m, b, z) < 0) {
2388
+ if (Se(b, M, g, m, P, z) < 0) {
2389
2389
  const V = w, D = g, _ = m;
2390
- w = x, g = b, m = z, x = V, b = D, z = _;
2390
+ w = x, g = P, m = z, x = V, P = D, z = _;
2391
2391
  }
2392
- const v = Lo(P, M, g, m, b, z);
2393
- this._cx = v.x, this._cy = v.y;
2392
+ const S = Ro(b, M, g, m, P, z);
2393
+ this._cx = S.x, this._cy = S.y;
2394
2394
  for (let V = 0; V < s; V++)
2395
- this._dists[V] = We(t[2 * V], t[2 * V + 1], v.x, v.y);
2395
+ this._dists[V] = We(t[2 * V], t[2 * V + 1], S.x, S.y);
2396
2396
  ye(this._ids, this._dists, 0, s - 1), this._hullStart = f;
2397
- let S = 3;
2398
- o[f] = e[x] = w, o[w] = e[f] = x, o[x] = e[w] = f, i[f] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = f, r[this._hashKey(g, m)] = w, r[this._hashKey(b, z)] = x, this.trianglesLen = 0, this._addTriangle(f, w, x, -1, -1, -1);
2397
+ let v = 3;
2398
+ o[f] = e[x] = w, o[w] = e[f] = x, o[x] = e[w] = f, i[f] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(b, M)] = f, r[this._hashKey(g, m)] = w, r[this._hashKey(P, z)] = x, this.trianglesLen = 0, this._addTriangle(f, w, x, -1, -1, -1);
2399
2399
  for (let V = 0, D = 0, _ = 0; V < this._ids.length; V++) {
2400
2400
  const E = this._ids[V], T = t[2 * E], A = t[2 * E + 1];
2401
2401
  if (V > 0 && Math.abs(T - D) <= an && Math.abs(A - _) <= an || (D = T, _ = A, E === f || E === w || E === x)) continue;
2402
2402
  let O = 0;
2403
- 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(T, A); C < this._hashSize && (O = r[(L + C) % this._hashSize], !(O !== -1 && O !== o[O])); C++)
2404
2404
  ;
2405
2405
  O = e[O];
2406
2406
  let I = O, B;
2407
- 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], Se(T, A, t[2 * I], t[2 * I + 1], t[2 * B], t[2 * B + 1]) >= 0; )
2408
2408
  if (I = B, I === O) {
2409
2409
  I = -1;
2410
2410
  break;
2411
2411
  }
2412
2412
  if (I === -1) continue;
2413
- let L = this._addTriangle(I, E, o[I], -1, -1, i[I]);
2414
- i[E] = this._legalize(L + 2), i[I] = L, S++;
2413
+ let R = this._addTriangle(I, E, o[I], -1, -1, i[I]);
2414
+ i[E] = this._legalize(R + 2), i[I] = R, v++;
2415
2415
  let N = o[I];
2416
- for (; B = o[N], ve(T, A, t[2 * N], t[2 * N + 1], t[2 * B], t[2 * B + 1]) < 0; )
2417
- L = this._addTriangle(N, E, B, i[E], -1, i[N]), i[E] = this._legalize(L + 2), o[N] = N, S--, N = B;
2416
+ for (; B = o[N], Se(T, A, t[2 * N], t[2 * N + 1], t[2 * B], t[2 * B + 1]) < 0; )
2417
+ R = this._addTriangle(N, E, B, i[E], -1, i[N]), i[E] = this._legalize(R + 2), o[N] = N, v--, N = B;
2418
2418
  if (I === O)
2419
- for (; B = e[I], ve(T, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
2420
- L = this._addTriangle(B, E, I, -1, i[I], i[B]), this._legalize(L + 2), i[B] = L, o[I] = I, S--, I = B;
2419
+ for (; B = e[I], Se(T, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
2420
+ R = this._addTriangle(B, E, I, -1, i[I], i[B]), this._legalize(R + 2), i[B] = R, o[I] = I, v--, I = B;
2421
2421
  this._hullStart = e[E] = I, o[I] = e[N] = E, o[E] = N, r[this._hashKey(T, A)] = E, r[this._hashKey(t[2 * I], t[2 * I + 1])] = I;
2422
2422
  }
2423
- this.hull = new Uint32Array(S);
2424
- for (let V = 0, D = this._hullStart; V < S; V++)
2423
+ this.hull = new Uint32Array(v);
2424
+ for (let V = 0, D = this._hullStart; V < v; V++)
2425
2425
  this.hull[V] = D, D = o[D];
2426
2426
  this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
2427
2427
  }
@@ -2518,14 +2518,14 @@ function We(n, t, e, o) {
2518
2518
  return i * i + r * r;
2519
2519
  }
2520
2520
  function ko(n, t, e, o, i, r, s, a) {
2521
- const l = n - s, u = t - a, h = e - s, d = o - a, c = i - s, f = r - a, w = l * l + u * u, x = h * h + d * d, P = c * c + f * f;
2522
- return l * (d * P - x * f) - u * (h * P - x * c) + w * (h * f - d * c) < 0;
2521
+ const l = n - s, u = t - a, h = e - s, d = o - a, c = i - s, f = r - a, w = l * l + u * u, x = h * h + d * d, b = c * c + f * f;
2522
+ return l * (d * b - x * f) - u * (h * b - x * c) + w * (h * f - d * c) < 0;
2523
2523
  }
2524
2524
  function Co(n, t, e, o, i, r) {
2525
2525
  const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a, d = l * l + u * u, c = 0.5 / (s * u - a * l), f = (u * h - a * d) * c, w = (s * d - l * h) * c;
2526
2526
  return f * f + w * w;
2527
2527
  }
2528
- function Lo(n, t, e, o, i, r) {
2528
+ function Ro(n, t, e, o, i, r) {
2529
2529
  const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a, d = l * l + u * u, c = 0.5 / (s * u - a * l), f = n + (u * h - a * d) * c, w = t + (s * d - l * h) * c;
2530
2530
  return { x: f, y: w };
2531
2531
  }
@@ -2559,7 +2559,7 @@ function Me(n, t, e) {
2559
2559
  const o = n[t];
2560
2560
  n[t] = n[e], n[e] = o;
2561
2561
  }
2562
- function Ro(n) {
2562
+ function Lo(n) {
2563
2563
  return n[0];
2564
2564
  }
2565
2565
  function Fo(n) {
@@ -2622,21 +2622,21 @@ class Oo {
2622
2622
  const { delaunay: { points: t, hull: e, triangles: o }, vectors: i } = this;
2623
2623
  let r, s;
2624
2624
  const a = this.circumcenters = this._circumcenters.subarray(0, o.length / 3 * 2);
2625
- for (let x = 0, P = 0, M = o.length, g, m; x < M; x += 3, P += 2) {
2626
- const p = o[x] * 2, b = o[x + 1] * 2, z = o[x + 2] * 2, v = t[p], S = t[p + 1], V = t[b], D = t[b + 1], _ = t[z], E = t[z + 1], T = V - v, A = D - S, O = _ - v, I = E - S, B = (T * I - A * O) * 2;
2625
+ for (let x = 0, b = 0, M = o.length, g, m; x < M; x += 3, b += 2) {
2626
+ const p = o[x] * 2, P = o[x + 1] * 2, z = o[x + 2] * 2, S = t[p], v = t[p + 1], V = t[P], D = t[P + 1], _ = t[z], E = t[z + 1], T = V - S, A = D - v, O = _ - S, I = E - v, B = (T * I - A * O) * 2;
2627
2627
  if (Math.abs(B) < 1e-9) {
2628
2628
  if (r === void 0) {
2629
2629
  r = s = 0;
2630
2630
  for (const N of e) r += t[N * 2], s += t[N * 2 + 1];
2631
2631
  r /= e.length, s /= e.length;
2632
2632
  }
2633
- const L = 1e9 * Math.sign((r - v) * I - (s - S) * O);
2634
- g = (v + _) / 2 - L * I, m = (S + E) / 2 + L * O;
2633
+ const R = 1e9 * Math.sign((r - S) * I - (s - v) * O);
2634
+ g = (S + _) / 2 - R * I, m = (v + E) / 2 + R * O;
2635
2635
  } else {
2636
- const L = 1 / B, N = T * T + A * A, C = O * O + I * I;
2637
- g = v + (I * N - A * C) * L, m = S + (T * C - O * N) * L;
2636
+ const R = 1 / B, N = T * T + A * A, C = O * O + I * I;
2637
+ g = S + (I * N - A * C) * R, m = v + (T * C - O * N) * R;
2638
2638
  }
2639
- a[P] = g, a[P + 1] = m;
2639
+ a[b] = g, a[b + 1] = m;
2640
2640
  }
2641
2641
  let l = e[e.length - 1], u, h = l * 4, d, c = t[2 * l], f, w = t[2 * l + 1];
2642
2642
  i.fill(0);
@@ -2649,8 +2649,8 @@ class Oo {
2649
2649
  for (let h = 0, d = o.length; h < d; ++h) {
2650
2650
  const c = o[h];
2651
2651
  if (c < h) continue;
2652
- const f = Math.floor(h / 3) * 2, w = Math.floor(c / 3) * 2, x = s[f], P = s[f + 1], M = s[w], g = s[w + 1];
2653
- this._renderSegment(x, P, M, g, t);
2652
+ const f = Math.floor(h / 3) * 2, w = Math.floor(c / 3) * 2, x = s[f], b = s[f + 1], M = s[w], g = s[w + 1];
2653
+ this._renderSegment(x, b, M, g, t);
2654
2654
  }
2655
2655
  let l, u = r[r.length - 1];
2656
2656
  for (let h = 0; h < r.length; ++h) {
@@ -2734,13 +2734,13 @@ class Oo {
2734
2734
  if (r = a, s = l, a = e[f], l = e[f + 1], u = h, h = this._regioncode(a, l), u === 0 && h === 0)
2735
2735
  d = c, c = 0, i ? i.push(a, l) : i = [a, l];
2736
2736
  else {
2737
- let w, x, P, M, g;
2737
+ let w, x, b, M, g;
2738
2738
  if (u === 0) {
2739
2739
  if ((w = this._clipSegment(r, s, a, l, u, h)) === null) continue;
2740
- [x, P, M, g] = w;
2740
+ [x, b, M, g] = w;
2741
2741
  } else {
2742
2742
  if ((w = this._clipSegment(a, l, r, s, h, u)) === null) continue;
2743
- [M, g, x, P] = w, d = c, c = this._edgecode(x, P), d && c && this._edge(t, d, c, i, i.length), i ? i.push(x, P) : i = [x, P];
2743
+ [M, g, x, b] = w, d = c, c = this._edgecode(x, b), d && c && this._edge(t, d, c, i, i.length), i ? i.push(x, b) : i = [x, b];
2744
2744
  }
2745
2745
  d = c, c = this._edgecode(M, g), d && c && this._edge(t, d, c, i, i.length), i ? i.push(M, g) : i = [M, g];
2746
2746
  }
@@ -3009,9 +3009,9 @@ function cn(n) {
3009
3009
  if (!i.length) return [];
3010
3010
  const r = /* @__PURE__ */ new Map(), s = (w, x) => w < x ? `${w}_${x}` : `${x}_${w}`;
3011
3011
  for (let w = 0; w < i.length; w += 3) {
3012
- const x = i[w], P = i[w + 1], M = i[w + 2], [g, m] = e[x], [p, b] = e[P], [z, v] = e[M], S = jo(g, m, p, b, z, v), V = Go(e, x, P, M);
3013
- if (S <= 1 / V)
3014
- for (const [D, _] of [[x, P], [P, M], [M, x]]) {
3012
+ const x = i[w], b = i[w + 1], M = i[w + 2], [g, m] = e[x], [p, P] = e[b], [z, S] = e[M], v = jo(g, m, p, P, z, S), V = Go(e, x, b, M);
3013
+ if (v <= 1 / V)
3014
+ for (const [D, _] of [[x, b], [b, M], [M, x]]) {
3015
3015
  const E = s(D, _);
3016
3016
  r.set(E, (r.get(E) || 0) + 1);
3017
3017
  }
@@ -3027,8 +3027,8 @@ function cn(n) {
3027
3027
  do {
3028
3028
  h.push(e[c]), d.add(c);
3029
3029
  const w = l.get(c) || [];
3030
- let x = w.find((P) => P !== f && !d.has(P));
3031
- if (x === void 0 && (x = w.find((P) => P !== f)), x === void 0) break;
3030
+ let x = w.find((b) => b !== f && !d.has(b));
3031
+ if (x === void 0 && (x = w.find((b) => b !== f)), x === void 0) break;
3032
3032
  f = c, c = x;
3033
3033
  } while (c !== u && h.length <= a.length + 1);
3034
3034
  return h;
@@ -3294,13 +3294,13 @@ function Ko(n, t = "kilometers") {
3294
3294
  throw new Error(t + " units is invalid");
3295
3295
  return n / e;
3296
3296
  }
3297
- function Ln(n) {
3297
+ function Rn(n) {
3298
3298
  return n % (2 * Math.PI) * 180 / Math.PI;
3299
3299
  }
3300
3300
  function ie(n) {
3301
3301
  return n % 360 * Math.PI / 180;
3302
3302
  }
3303
- function Rn(n, t = "kilometers", e = "kilometers") {
3303
+ function Ln(n, t = "kilometers", e = "kilometers") {
3304
3304
  if (!(n >= 0))
3305
3305
  throw new Error("length must be a positive number");
3306
3306
  return Zo(Ko(n, t), e);
@@ -3313,7 +3313,7 @@ function Qo(n) {
3313
3313
  }
3314
3314
  function Pe(n, t, e) {
3315
3315
  if (n !== null)
3316
- for (var o, i, r, s, a, l, u, h = 0, d = 0, c, f = n.type, w = f === "FeatureCollection", x = f === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
3316
+ for (var o, i, r, s, a, l, u, h = 0, d = 0, c, f = n.type, w = f === "FeatureCollection", x = f === "Feature", b = w ? n.features.length : 1, M = 0; M < b; M++) {
3317
3317
  u = w ? (
3318
3318
  // @ts-expect-error: Known type conflict
3319
3319
  n.features[M].geometry
@@ -3325,8 +3325,8 @@ function Pe(n, t, e) {
3325
3325
  var m = 0, p = 0;
3326
3326
  if (s = c ? u.geometries[g] : u, s !== null) {
3327
3327
  l = s.coordinates;
3328
- var b = s.type;
3329
- switch (h = e && (b === "Polygon" || b === "MultiPolygon") ? 1 : 0, b) {
3328
+ var P = s.type;
3329
+ switch (h = e && (P === "Polygon" || P === "MultiPolygon") ? 1 : 0, P) {
3330
3330
  case null:
3331
3331
  break;
3332
3332
  case "Point":
@@ -3357,9 +3357,9 @@ function Pe(n, t, e) {
3357
3357
  ) === !1
3358
3358
  )
3359
3359
  return !1;
3360
- d++, b === "MultiPoint" && m++;
3360
+ d++, P === "MultiPoint" && m++;
3361
3361
  }
3362
- b === "LineString" && m++;
3362
+ P === "LineString" && m++;
3363
3363
  break;
3364
3364
  case "Polygon":
3365
3365
  case "MultiLineString":
@@ -3378,9 +3378,9 @@ function Pe(n, t, e) {
3378
3378
  return !1;
3379
3379
  d++;
3380
3380
  }
3381
- b === "MultiLineString" && m++, b === "Polygon" && p++;
3381
+ P === "MultiLineString" && m++, P === "Polygon" && p++;
3382
3382
  }
3383
- b === "Polygon" && m++;
3383
+ P === "Polygon" && m++;
3384
3384
  break;
3385
3385
  case "MultiPolygon":
3386
3386
  for (o = 0; o < l.length; o++) {
@@ -3555,25 +3555,25 @@ var Ze = { exports: {} }, On = { exports: {} };
3555
3555
  (function(e, o) {
3556
3556
  n.exports = o();
3557
3557
  })(Fn, function() {
3558
- function e(g, m, p, b, z) {
3559
- (function v(S, V, D, _, E) {
3558
+ function e(g, m, p, P, z) {
3559
+ (function S(v, V, D, _, E) {
3560
3560
  for (; _ > D; ) {
3561
3561
  if (_ - D > 600) {
3562
- var T = _ - D + 1, A = V - 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(V - A * I / T + B)), N = Math.min(_, Math.floor(V + (T - A) * I / T + B));
3563
- v(S, V, L, N, E);
3562
+ var T = _ - D + 1, A = V - 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), R = Math.max(D, Math.floor(V - A * I / T + B)), N = Math.min(_, Math.floor(V + (T - A) * I / T + B));
3563
+ S(v, V, R, N, E);
3564
3564
  }
3565
- var C = S[V], R = D, $ = _;
3566
- for (o(S, D, V), E(S[_], C) > 0 && o(S, D, _); R < $; ) {
3567
- for (o(S, R, $), R++, $--; E(S[R], C) < 0; ) R++;
3568
- for (; E(S[$], C) > 0; ) $--;
3565
+ var C = v[V], L = D, $ = _;
3566
+ for (o(v, D, V), E(v[_], C) > 0 && o(v, D, _); L < $; ) {
3567
+ for (o(v, L, $), L++, $--; E(v[L], C) < 0; ) L++;
3568
+ for (; E(v[$], C) > 0; ) $--;
3569
3569
  }
3570
- E(S[D], C) === 0 ? o(S, D, $) : o(S, ++$, _), $ <= V && (D = $ + 1), V <= $ && (_ = $ - 1);
3570
+ E(v[D], C) === 0 ? o(v, D, $) : o(v, ++$, _), $ <= V && (D = $ + 1), V <= $ && (_ = $ - 1);
3571
3571
  }
3572
- })(g, m, p || 0, b || g.length - 1, z || i);
3572
+ })(g, m, p || 0, P || g.length - 1, z || i);
3573
3573
  }
3574
3574
  function o(g, m, p) {
3575
- var b = g[m];
3576
- g[m] = g[p], g[p] = b;
3575
+ var P = g[m];
3576
+ g[m] = g[p], g[p] = P;
3577
3577
  }
3578
3578
  function i(g, m) {
3579
3579
  return g < m ? -1 : g > m ? 1 : 0;
@@ -3583,17 +3583,17 @@ var Ze = { exports: {} }, On = { exports: {} };
3583
3583
  };
3584
3584
  function s(g, m, p) {
3585
3585
  if (!p) return m.indexOf(g);
3586
- for (var b = 0; b < m.length; b++) if (p(g, m[b])) return b;
3586
+ for (var P = 0; P < m.length; P++) if (p(g, m[P])) return P;
3587
3587
  return -1;
3588
3588
  }
3589
3589
  function a(g, m) {
3590
3590
  l(g, 0, g.children.length, m, g);
3591
3591
  }
3592
- function l(g, m, p, b, z) {
3593
- z || (z = P(null)), z.minX = 1 / 0, z.minY = 1 / 0, z.maxX = -1 / 0, z.maxY = -1 / 0;
3594
- for (var v = m; v < p; v++) {
3595
- var S = g.children[v];
3596
- u(z, g.leaf ? b(S) : S);
3592
+ function l(g, m, p, P, z) {
3593
+ z || (z = b(null)), z.minX = 1 / 0, z.minY = 1 / 0, z.maxX = -1 / 0, z.maxY = -1 / 0;
3594
+ for (var S = m; S < p; S++) {
3595
+ var v = g.children[S];
3596
+ u(z, g.leaf ? P(v) : v);
3597
3597
  }
3598
3598
  return z;
3599
3599
  }
@@ -3618,13 +3618,13 @@ var Ze = { exports: {} }, On = { exports: {} };
3618
3618
  function x(g, m) {
3619
3619
  return m.minX <= g.maxX && m.minY <= g.maxY && m.maxX >= g.minX && m.maxY >= g.minY;
3620
3620
  }
3621
- function P(g) {
3621
+ function b(g) {
3622
3622
  return { children: g, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
3623
3623
  }
3624
- function M(g, m, p, b, z) {
3625
- for (var v = [m, p]; v.length; ) if (!((p = v.pop()) - (m = v.pop()) <= b)) {
3626
- var S = m + Math.ceil((p - m) / b / 2) * b;
3627
- e(g, S, m, p, z), v.push(m, S, S, p);
3624
+ function M(g, m, p, P, z) {
3625
+ for (var S = [m, p]; S.length; ) if (!((p = S.pop()) - (m = S.pop()) <= P)) {
3626
+ var v = m + Math.ceil((p - m) / P / 2) * P;
3627
+ e(g, v, m, p, z), S.push(m, v, v, p);
3628
3628
  }
3629
3629
  }
3630
3630
  return r.prototype.all = function() {
@@ -3632,10 +3632,10 @@ var Ze = { exports: {} }, On = { exports: {} };
3632
3632
  }, r.prototype.search = function(g) {
3633
3633
  var m = this.data, p = [];
3634
3634
  if (!x(g, m)) return p;
3635
- for (var b = this.toBBox, z = []; m; ) {
3636
- for (var v = 0; v < m.children.length; v++) {
3637
- var S = m.children[v], V = m.leaf ? b(S) : S;
3638
- x(g, V) && (m.leaf ? p.push(S) : w(g, V) ? this._all(S, p) : z.push(S));
3635
+ for (var P = this.toBBox, z = []; m; ) {
3636
+ for (var S = 0; S < m.children.length; S++) {
3637
+ var v = m.children[S], V = m.leaf ? P(v) : v;
3638
+ x(g, V) && (m.leaf ? p.push(v) : w(g, V) ? this._all(v, p) : z.push(v));
3639
3639
  }
3640
3640
  m = z.pop();
3641
3641
  }
@@ -3644,10 +3644,10 @@ var Ze = { exports: {} }, On = { exports: {} };
3644
3644
  var m = this.data;
3645
3645
  if (!x(g, m)) return !1;
3646
3646
  for (var p = []; m; ) {
3647
- for (var b = 0; b < m.children.length; b++) {
3648
- var z = m.children[b], v = m.leaf ? this.toBBox(z) : z;
3649
- if (x(g, v)) {
3650
- if (m.leaf || w(g, v)) return !0;
3647
+ for (var P = 0; P < m.children.length; P++) {
3648
+ var z = m.children[P], S = m.leaf ? this.toBBox(z) : z;
3649
+ if (x(g, S)) {
3650
+ if (m.leaf || w(g, S)) return !0;
3651
3651
  p.push(z);
3652
3652
  }
3653
3653
  }
@@ -3664,8 +3664,8 @@ var Ze = { exports: {} }, On = { exports: {} };
3664
3664
  if (this.data.children.length) if (this.data.height === p.height) this._splitRoot(this.data, p);
3665
3665
  else {
3666
3666
  if (this.data.height < p.height) {
3667
- var b = this.data;
3668
- this.data = p, p = b;
3667
+ var P = this.data;
3668
+ this.data = p, p = P;
3669
3669
  }
3670
3670
  this._insert(p, this.data.height - p.height - 1, !0);
3671
3671
  }
@@ -3674,15 +3674,15 @@ var Ze = { exports: {} }, On = { exports: {} };
3674
3674
  }, r.prototype.insert = function(g) {
3675
3675
  return g && this._insert(g, this.data.height - 1), this;
3676
3676
  }, r.prototype.clear = function() {
3677
- return this.data = P([]), this;
3677
+ return this.data = b([]), this;
3678
3678
  }, r.prototype.remove = function(g, m) {
3679
3679
  if (!g) return this;
3680
- for (var p, b, z, v = this.data, S = this.toBBox(g), V = [], D = []; v || V.length; ) {
3681
- if (v || (v = V.pop(), b = V[V.length - 1], p = D.pop(), z = !0), v.leaf) {
3682
- var _ = s(g, v.children, m);
3683
- if (_ !== -1) return v.children.splice(_, 1), V.push(v), this._condense(V), this;
3680
+ for (var p, P, z, S = this.data, v = this.toBBox(g), V = [], D = []; S || V.length; ) {
3681
+ if (S || (S = V.pop(), P = V[V.length - 1], p = D.pop(), z = !0), S.leaf) {
3682
+ var _ = s(g, S.children, m);
3683
+ if (_ !== -1) return S.children.splice(_, 1), V.push(S), this._condense(V), this;
3684
3684
  }
3685
- z || v.leaf || !w(v, S) ? b ? (p++, v = b.children[p], z = !1) : v = null : (V.push(v), D.push(p), p = 0, b = v, v = v.children[0]);
3685
+ z || S.leaf || !w(S, v) ? P ? (p++, S = P.children[p], z = !1) : S = null : (V.push(S), D.push(p), p = 0, P = S, S = S.children[0]);
3686
3686
  }
3687
3687
  return this;
3688
3688
  }, r.prototype.toBBox = function(g) {
@@ -3698,64 +3698,64 @@ var Ze = { exports: {} }, On = { exports: {} };
3698
3698
  }, r.prototype._all = function(g, m) {
3699
3699
  for (var p = []; g; ) g.leaf ? m.push.apply(m, g.children) : p.push.apply(p, g.children), g = p.pop();
3700
3700
  return m;
3701
- }, r.prototype._build = function(g, m, p, b) {
3702
- var z, v = p - m + 1, S = this._maxEntries;
3703
- if (v <= S) return a(z = P(g.slice(m, p + 1)), this.toBBox), z;
3704
- b || (b = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, b - 1))), (z = P([])).leaf = !1, z.height = b;
3705
- var V = Math.ceil(v / S), D = V * Math.ceil(Math.sqrt(S));
3701
+ }, r.prototype._build = function(g, m, p, P) {
3702
+ var z, S = p - m + 1, v = this._maxEntries;
3703
+ if (S <= v) return a(z = b(g.slice(m, p + 1)), this.toBBox), z;
3704
+ P || (P = Math.ceil(Math.log(S) / Math.log(v)), v = Math.ceil(S / Math.pow(v, P - 1))), (z = b([])).leaf = !1, z.height = P;
3705
+ var V = Math.ceil(S / v), D = V * Math.ceil(Math.sqrt(v));
3706
3706
  M(g, m, p, D, this.compareMinX);
3707
3707
  for (var _ = m; _ <= p; _ += D) {
3708
3708
  var E = Math.min(_ + D - 1, p);
3709
3709
  M(g, _, E, V, this.compareMinY);
3710
3710
  for (var T = _; T <= E; T += V) {
3711
3711
  var A = Math.min(T + V - 1, E);
3712
- z.children.push(this._build(g, T, A, b - 1));
3712
+ z.children.push(this._build(g, T, A, P - 1));
3713
3713
  }
3714
3714
  }
3715
3715
  return a(z, this.toBBox), z;
3716
- }, r.prototype._chooseSubtree = function(g, m, p, b) {
3717
- for (; b.push(m), !m.leaf && b.length - 1 !== p; ) {
3718
- for (var z = 1 / 0, v = 1 / 0, S = void 0, V = 0; V < m.children.length; V++) {
3716
+ }, r.prototype._chooseSubtree = function(g, m, p, P) {
3717
+ for (; P.push(m), !m.leaf && P.length - 1 !== p; ) {
3718
+ for (var z = 1 / 0, S = 1 / 0, v = void 0, V = 0; V < m.children.length; V++) {
3719
3719
  var D = m.children[V], _ = c(D), E = (T = g, 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)) - _);
3720
- E < v ? (v = E, z = _ < z ? _ : z, S = D) : E === v && _ < z && (z = _, S = D);
3720
+ E < S ? (S = E, z = _ < z ? _ : z, v = D) : E === S && _ < z && (z = _, v = D);
3721
3721
  }
3722
- m = S || m.children[0];
3722
+ m = v || m.children[0];
3723
3723
  }
3724
3724
  var T, A;
3725
3725
  return m;
3726
3726
  }, r.prototype._insert = function(g, m, p) {
3727
- var b = p ? g : this.toBBox(g), z = [], v = this._chooseSubtree(b, this.data, m, z);
3728
- for (v.children.push(g), u(v, b); m >= 0 && z[m].children.length > this._maxEntries; ) this._split(z, m), m--;
3729
- this._adjustParentBBoxes(b, z, m);
3727
+ var P = p ? g : this.toBBox(g), z = [], S = this._chooseSubtree(P, this.data, m, z);
3728
+ for (S.children.push(g), u(S, P); m >= 0 && z[m].children.length > this._maxEntries; ) this._split(z, m), m--;
3729
+ this._adjustParentBBoxes(P, z, m);
3730
3730
  }, r.prototype._split = function(g, m) {
3731
- var p = g[m], b = p.children.length, z = this._minEntries;
3732
- this._chooseSplitAxis(p, z, b);
3733
- var v = this._chooseSplitIndex(p, z, b), S = P(p.children.splice(v, p.children.length - v));
3734
- S.height = p.height, S.leaf = p.leaf, a(p, this.toBBox), a(S, this.toBBox), m ? g[m - 1].children.push(S) : this._splitRoot(p, S);
3731
+ var p = g[m], P = p.children.length, z = this._minEntries;
3732
+ this._chooseSplitAxis(p, z, P);
3733
+ var S = this._chooseSplitIndex(p, z, P), v = b(p.children.splice(S, p.children.length - S));
3734
+ v.height = p.height, v.leaf = p.leaf, a(p, this.toBBox), a(v, this.toBBox), m ? g[m - 1].children.push(v) : this._splitRoot(p, v);
3735
3735
  }, r.prototype._splitRoot = function(g, m) {
3736
- this.data = P([g, m]), this.data.height = g.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
3736
+ this.data = b([g, m]), this.data.height = g.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
3737
3737
  }, r.prototype._chooseSplitIndex = function(g, m, p) {
3738
- for (var b, z, v, S, V, D, _, E = 1 / 0, T = 1 / 0, A = m; A <= p - m; A++) {
3739
- var O = l(g, 0, A, this.toBBox), I = l(g, A, p, this.toBBox), B = (z = O, v = I, S = void 0, V = void 0, D = void 0, _ = void 0, S = Math.max(z.minX, v.minX), V = Math.max(z.minY, v.minY), D = Math.min(z.maxX, v.maxX), _ = Math.min(z.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - V)), L = c(O) + c(I);
3740
- B < E ? (E = B, b = A, T = L < T ? L : T) : B === E && L < T && (T = L, b = A);
3738
+ for (var P, z, S, v, V, D, _, E = 1 / 0, T = 1 / 0, A = m; A <= p - m; A++) {
3739
+ var O = l(g, 0, A, this.toBBox), I = l(g, A, p, this.toBBox), B = (z = O, S = I, v = void 0, V = void 0, D = void 0, _ = void 0, v = Math.max(z.minX, S.minX), V = Math.max(z.minY, S.minY), D = Math.min(z.maxX, S.maxX), _ = Math.min(z.maxY, S.maxY), Math.max(0, D - v) * Math.max(0, _ - V)), R = c(O) + c(I);
3740
+ B < E ? (E = B, P = A, T = R < T ? R : T) : B === E && R < T && (T = R, P = A);
3741
3741
  }
3742
- return b || p - m;
3742
+ return P || p - m;
3743
3743
  }, r.prototype._chooseSplitAxis = function(g, m, p) {
3744
- var b = g.leaf ? this.compareMinX : h, z = g.leaf ? this.compareMinY : d;
3745
- this._allDistMargin(g, m, p, b) < this._allDistMargin(g, m, p, z) && g.children.sort(b);
3746
- }, r.prototype._allDistMargin = function(g, m, p, b) {
3747
- g.children.sort(b);
3748
- for (var z = this.toBBox, v = l(g, 0, m, z), S = l(g, p - m, p, z), V = f(v) + f(S), D = m; D < p - m; D++) {
3744
+ var P = g.leaf ? this.compareMinX : h, z = g.leaf ? this.compareMinY : d;
3745
+ this._allDistMargin(g, m, p, P) < this._allDistMargin(g, m, p, z) && g.children.sort(P);
3746
+ }, r.prototype._allDistMargin = function(g, m, p, P) {
3747
+ g.children.sort(P);
3748
+ for (var z = this.toBBox, S = l(g, 0, m, z), v = l(g, p - m, p, z), V = f(S) + f(v), D = m; D < p - m; D++) {
3749
3749
  var _ = g.children[D];
3750
- u(v, g.leaf ? z(_) : _), V += f(v);
3750
+ u(S, g.leaf ? z(_) : _), V += f(S);
3751
3751
  }
3752
3752
  for (var E = p - m - 1; E >= m; E--) {
3753
3753
  var T = g.children[E];
3754
- u(S, g.leaf ? z(T) : T), V += f(S);
3754
+ u(v, g.leaf ? z(T) : T), V += f(v);
3755
3755
  }
3756
3756
  return V;
3757
3757
  }, r.prototype._adjustParentBBoxes = function(g, m, p) {
3758
- for (var b = p; b >= 0; b--) u(m[b], g);
3758
+ for (var P = p; P >= 0; P--) u(m[P], g);
3759
3759
  }, r.prototype._condense = function(g) {
3760
3760
  for (var m = g.length - 1, p = void 0; m >= 0; m--) g[m].children.length === 0 ? m > 0 ? (p = g[m - 1].children).splice(p.indexOf(g[m]), 1) : this.clear() : a(g[m], this.toBBox);
3761
3761
  }, r;
@@ -3833,43 +3833,43 @@ var hr = Ce.exports, Ue = { exports: {} };
3833
3833
  o(t);
3834
3834
  })(Fn, function(e) {
3835
3835
  const i = 33306690738754706e-32;
3836
- function r(x, P, M, g, m) {
3837
- let p, b, z, v, S = P[0], V = g[0], D = 0, _ = 0;
3838
- V > S == V > -S ? (p = S, S = P[++D]) : (p = V, V = g[++_]);
3836
+ function r(x, b, M, g, m) {
3837
+ let p, P, z, S, v = b[0], V = g[0], D = 0, _ = 0;
3838
+ V > v == V > -v ? (p = v, v = b[++D]) : (p = V, V = g[++_]);
3839
3839
  let E = 0;
3840
- if (D < x && _ < M) for (V > S == V > -S ? (z = p - ((b = S + p) - S), S = P[++D]) : (z = p - ((b = V + p) - V), V = g[++_]), p = b, z !== 0 && (m[E++] = z); D < x && _ < M; ) V > S == V > -S ? (z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D]) : (z = p - ((b = p + V) - (v = b - p)) + (V - v), V = g[++_]), p = b, z !== 0 && (m[E++] = z);
3841
- for (; D < x; ) z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D], p = b, z !== 0 && (m[E++] = z);
3842
- for (; _ < M; ) z = p - ((b = p + V) - (v = b - p)) + (V - v), V = g[++_], p = b, z !== 0 && (m[E++] = z);
3840
+ if (D < x && _ < M) for (V > v == V > -v ? (z = p - ((P = v + p) - v), v = b[++D]) : (z = p - ((P = V + p) - V), V = g[++_]), p = P, z !== 0 && (m[E++] = z); D < x && _ < M; ) V > v == V > -v ? (z = p - ((P = p + v) - (S = P - p)) + (v - S), v = b[++D]) : (z = p - ((P = p + V) - (S = P - p)) + (V - S), V = g[++_]), p = P, z !== 0 && (m[E++] = z);
3841
+ for (; D < x; ) z = p - ((P = p + v) - (S = P - p)) + (v - S), v = b[++D], p = P, z !== 0 && (m[E++] = z);
3842
+ for (; _ < M; ) z = p - ((P = p + V) - (S = P - p)) + (V - S), V = g[++_], p = P, z !== 0 && (m[E++] = z);
3843
3843
  return p === 0 && E !== 0 || (m[E++] = p), E;
3844
3844
  }
3845
3845
  function s(x) {
3846
3846
  return new Float64Array(x);
3847
3847
  }
3848
3848
  const a = 33306690738754716e-32, l = 22204460492503146e-32, u = 11093356479670487e-47, h = s(4), d = s(8), c = s(12), f = s(16), w = s(4);
3849
- e.orient2d = function(x, P, M, g, m, p) {
3850
- const b = (P - p) * (M - m), z = (x - m) * (g - p), v = b - z;
3851
- if (b === 0 || z === 0 || b > 0 != z > 0) return v;
3852
- const S = Math.abs(b + z);
3853
- return Math.abs(v) >= a * S ? v : -function(V, D, _, E, T, A, O) {
3854
- let I, B, L, N, C, R, $, X, ot, K, G, ut, rt, F, H, Mt, Zt, qt;
3855
- const Rt = V - T, _t = _ - T, Et = D - A, Ft = E - A;
3856
- C = (H = (X = Rt - ($ = (R = 134217729 * Rt) - (R - Rt))) * (K = Ft - (ot = (R = 134217729 * Ft) - (R - Ft))) - ((F = Rt * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (R = 134217729 * Et) - (R - Et))) * (K = _t - (ot = (R = 134217729 * _t) - (R - _t))) - ((Mt = Et * _t) - $ * ot - X * ot - $ * K))), h[0] = H - (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 = (qt = ut + G) - ut, h[2] = ut - (qt - C) + (G - C), h[3] = qt;
3849
+ e.orient2d = function(x, b, M, g, m, p) {
3850
+ const P = (b - p) * (M - m), z = (x - m) * (g - p), S = P - z;
3851
+ if (P === 0 || z === 0 || P > 0 != z > 0) return S;
3852
+ const v = Math.abs(P + z);
3853
+ return Math.abs(S) >= a * v ? S : -function(V, D, _, E, T, A, O) {
3854
+ let I, B, R, N, C, L, $, X, ot, K, G, ut, rt, F, H, Mt, Zt, qt;
3855
+ const Lt = V - T, _t = _ - T, Et = D - A, Ft = E - A;
3856
+ C = (H = (X = Lt - ($ = (L = 134217729 * Lt) - (L - Lt))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = Lt * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (L = 134217729 * Et) - (L - Et))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = Et * _t) - $ * ot - X * ot - $ * K))), h[0] = H - (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 = (qt = ut + G) - ut, h[2] = ut - (qt - C) + (G - C), h[3] = qt;
3857
3857
  let tt = function(Tt, Wt) {
3858
3858
  let J = Wt[0];
3859
3859
  for (let ct = 1; ct < Tt; ct++) J += Wt[ct];
3860
3860
  return J;
3861
3861
  }(4, h), lt = l * O;
3862
- if (tt >= lt || -tt >= lt || (I = V - (Rt + (C = V - Rt)) + (C - T), L = _ - (_t + (C = _ - _t)) + (C - T), B = D - (Et + (C = D - Et)) + (C - A), N = E - (Ft + (C = E - Ft)) + (C - A), I === 0 && B === 0 && L === 0 && N === 0) || (lt = u * O + i * Math.abs(tt), (tt += Rt * N + Ft * I - (Et * L + _t * B)) >= lt || -tt >= lt)) return tt;
3863
- C = (H = (X = I - ($ = (R = 134217729 * I) - (R - I))) * (K = Ft - (ot = (R = 134217729 * Ft) - (R - Ft))) - ((F = I * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (R = 134217729 * B) - (R - B))) * (K = _t - (ot = (R = 134217729 * _t) - (R - _t))) - ((Mt = B * _t) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
3862
+ if (tt >= lt || -tt >= lt || (I = V - (Lt + (C = V - Lt)) + (C - T), R = _ - (_t + (C = _ - _t)) + (C - T), B = D - (Et + (C = D - Et)) + (C - A), N = E - (Ft + (C = E - Ft)) + (C - A), I === 0 && B === 0 && R === 0 && N === 0) || (lt = u * O + i * Math.abs(tt), (tt += Lt * N + Ft * I - (Et * R + _t * B)) >= lt || -tt >= lt)) return tt;
3863
+ C = (H = (X = I - ($ = (L = 134217729 * I) - (L - I))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = I * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (L = 134217729 * B) - (L - B))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = B * _t) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
3864
3864
  const W = r(4, h, 4, w, d);
3865
- C = (H = (X = Rt - ($ = (R = 134217729 * Rt) - (R - Rt))) * (K = N - (ot = (R = 134217729 * N) - (R - N))) - ((F = Rt * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (R = 134217729 * Et) - (R - Et))) * (K = L - (ot = (R = 134217729 * L) - (R - L))) - ((Mt = Et * L) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
3865
+ C = (H = (X = Lt - ($ = (L = 134217729 * Lt) - (L - Lt))) * (K = N - (ot = (L = 134217729 * N) - (L - N))) - ((F = Lt * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (L = 134217729 * Et) - (L - Et))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = Et * R) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
3866
3866
  const j = r(W, d, 4, w, c);
3867
- C = (H = (X = I - ($ = (R = 134217729 * I) - (R - I))) * (K = N - (ot = (R = 134217729 * N) - (R - N))) - ((F = I * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (R = 134217729 * B) - (R - B))) * (K = L - (ot = (R = 134217729 * L) - (R - L))) - ((Mt = B * L) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
3867
+ C = (H = (X = I - ($ = (L = 134217729 * I) - (L - I))) * (K = N - (ot = (L = 134217729 * N) - (L - N))) - ((F = I * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (L = 134217729 * B) - (L - B))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = B * R) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
3868
3868
  const Nt = r(j, c, 4, w, f);
3869
3869
  return f[Nt - 1];
3870
- }(x, P, M, g, m, p, S);
3871
- }, e.orient2dfast = function(x, P, M, g, m, p) {
3872
- return (P - p) * (M - m) - (x - m) * (g - p);
3870
+ }(x, b, M, g, m, p, v);
3871
+ }, e.orient2dfast = function(x, b, M, g, m, p) {
3872
+ return (b - p) * (M - m) - (x - m) * (g - p);
3873
3873
  }, Object.defineProperty(e, "__esModule", { value: !0 });
3874
3874
  });
3875
3875
  })(Ue, Ue.exports);
@@ -3901,8 +3901,8 @@ function Wn(n, t, e) {
3901
3901
  for (var h = t * t, d = e * e; r.length; ) {
3902
3902
  var c = r.shift(), f = c.p, w = c.next.p, x = $e(f, w);
3903
3903
  if (!(x < d)) {
3904
- var P = x / h;
3905
- l = gr(i, c.prev.p, f, w, c.next.next.p, P, u), l && Math.min($e(l, f), $e(l, w)) <= P && (r.push(c), r.push(wn(l, c)), i.remove(l), u.remove(c), u.insert(Xe(c)), u.insert(Xe(c.next)));
3904
+ var b = x / h;
3905
+ l = gr(i, c.prev.p, f, w, c.next.next.p, b, u), l && Math.min($e(l, f), $e(l, w)) <= b && (r.push(c), r.push(wn(l, c)), i.remove(l), u.remove(c), u.insert(Xe(c)), u.insert(Xe(c.next)));
3906
3906
  }
3907
3907
  }
3908
3908
  c = a;
@@ -3996,8 +3996,8 @@ function He(n, t, e) {
3996
3996
  return r = n[0] - o, s = n[1] - i, r * r + s * s;
3997
3997
  }
3998
3998
  function Ee(n, t, e, o, i, r, s, a) {
3999
- var l = e - n, u = o - t, h = s - i, d = a - r, c = n - i, f = t - r, w = l * l + u * u, x = l * h + u * d, P = h * h + d * d, M = l * c + u * f, g = h * c + d * f, m = w * P - x * x, p, b, z, v, S = m, V = m;
4000
- m === 0 ? (b = 0, S = 1, v = g, V = P) : (b = x * g - P * M, v = w * g - x * M, b < 0 ? (b = 0, v = g, V = P) : b > S && (b = S, v = g + x, V = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > V && (v = V, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), p = b === 0 ? 0 : b / S, z = v === 0 ? 0 : v / V;
3999
+ var l = e - n, u = o - t, h = s - i, d = a - r, c = n - i, f = t - r, w = l * l + u * u, x = l * h + u * d, b = h * h + d * d, M = l * c + u * f, g = h * c + d * f, m = w * b - x * x, p, P, z, S, v = m, V = m;
4000
+ m === 0 ? (P = 0, v = 1, S = g, V = b) : (P = x * g - b * M, S = w * g - x * M, P < 0 ? (P = 0, S = g, V = b) : P > v && (P = v, S = g + x, V = b)), S < 0 ? (S = 0, -M < 0 ? P = 0 : -M > w ? P = v : (P = -M, v = w)) : S > V && (S = V, -M + x < 0 ? P = 0 : -M + x > w ? P = v : (P = -M + x, v = w)), p = P === 0 ? 0 : P / v, z = S === 0 ? 0 : S / V;
4001
4001
  var D = (1 - p) * n + p * e, _ = (1 - p) * t + p * o, E = (1 - z) * i + z * s, T = (1 - z) * r + z * a, A = E - D, O = T - _;
4002
4002
  return A * A + O * O;
4003
4003
  }
@@ -4053,7 +4053,7 @@ function se(n) {
4053
4053
  return [...n];
4054
4054
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4055
4055
  }
4056
- function Sr(n) {
4056
+ function vr(n) {
4057
4057
  if (Array.isArray(n))
4058
4058
  return n;
4059
4059
  if (n.type === "Feature") {
@@ -4065,7 +4065,7 @@ function Sr(n) {
4065
4065
  "coords must be GeoJSON Feature, Geometry Object or an Array"
4066
4066
  );
4067
4067
  }
4068
- function vr(n, t, e = {}) {
4068
+ function Sr(n, t, e = {}) {
4069
4069
  let o;
4070
4070
  return e.final ? o = bn(se(t), se(n)) : o = bn(se(n), se(t)), o > 180 ? -(360 - o) : o;
4071
4071
  }
@@ -4076,13 +4076,13 @@ function bn(n, t) {
4076
4076
  const r = Math.log(
4077
4077
  Math.tan(o / 2 + Math.PI / 4) / Math.tan(e / 2 + Math.PI / 4)
4078
4078
  ), s = Math.atan2(i, r);
4079
- return (Ln(s) + 360) % 360;
4079
+ return (Rn(s) + 360) % 360;
4080
4080
  }
4081
4081
  function Dr(n, t, e = {}) {
4082
4082
  const o = se(n), i = se(t);
4083
4083
  i[0] += i[0] - o[0] > 180 ? -360 : o[0] - i[0] > 180 ? 360 : 0;
4084
4084
  const r = _r(o, i);
4085
- return Rn(r, "meters", e.units);
4085
+ return Ln(r, "meters", e.units);
4086
4086
  }
4087
4087
  function _r(n, t, e) {
4088
4088
  e = e === void 0 ? Ht : Number(e);
@@ -4098,7 +4098,7 @@ function _r(n, t, e) {
4098
4098
  }
4099
4099
  function Er(n, t, e, o = {}) {
4100
4100
  const i = t < 0;
4101
- let r = Rn(
4101
+ let r = Ln(
4102
4102
  Math.abs(t),
4103
4103
  o.units,
4104
4104
  "meters"
@@ -4193,7 +4193,7 @@ function Pn(n, t, e) {
4193
4193
  if (t === 0) return n;
4194
4194
  const r = o ?? Xn(n);
4195
4195
  return (i === !1 || i === void 0) && (n = Ar(n)), Pe(n, function(s) {
4196
- const l = vr(r, s) + t, u = Dr(r, s), h = Sr(
4196
+ const l = Sr(r, s) + t, u = Dr(r, s), h = vr(
4197
4197
  Er(r, u, l)
4198
4198
  );
4199
4199
  s[0] = h[0], s[1] = h[1];
@@ -4203,7 +4203,7 @@ function Gn(n, t, e = {}) {
4203
4203
  if (e.final === !0)
4204
4204
  return Ir(n, t);
4205
4205
  const o = se(n), i = se(t), r = ie(o[0]), s = ie(i[0]), a = ie(o[1]), l = ie(i[1]), u = 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 Ln(Math.atan2(u, h));
4206
+ return Rn(Math.atan2(u, h));
4207
4207
  }
4208
4208
  function Ir(n, t) {
4209
4209
  let e = Gn(t, n);
@@ -4230,10 +4230,10 @@ function Cr(n, t = {}) {
4230
4230
  { bbox: n, id: t.id }
4231
4231
  );
4232
4232
  }
4233
- function Lr(n) {
4233
+ function Rr(n) {
4234
4234
  return Cr(kr(n));
4235
4235
  }
4236
- function Rr(n) {
4236
+ function Lr(n) {
4237
4237
  return er(
4238
4238
  n,
4239
4239
  (t, e) => t + Fr(e),
@@ -4286,7 +4286,7 @@ function Nr(n) {
4286
4286
  for (let s = 0; s < o.length - 1; s++) {
4287
4287
  let a = Gn(o[s], o[s + 1]), l = Pn(t, -1 * a, {
4288
4288
  pivot: e
4289
- }), u = Lr(l), h = Rr(u);
4289
+ }), u = Rr(l), h = Lr(u);
4290
4290
  h < i && (i = h, r = Pn(u, a, {
4291
4291
  pivot: e
4292
4292
  }));
@@ -4349,12 +4349,12 @@ class Ie extends An {
4349
4349
  });
4350
4350
  if (!r) throw new Error("2d obb 获取失败");
4351
4351
  const s = r.geometry.coordinates[0], a = Vn(s[0], s[1]), l = Vn(s[1], s[2]), u = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
4352
- Te.set(a, l, o), Sn.set(0, 0, u);
4352
+ Te.set(a, l, o), vn.set(0, 0, u);
4353
4353
  const [h, d] = qr(s);
4354
- return e.x = h, e.y = d, this.from(Te, e, Sn, i);
4354
+ return e.x = h, e.y = d, this.from(Te, e, vn, i);
4355
4355
  }
4356
4356
  }
4357
- const le = new y.Matrix4(), fe = new y.Quaternion(), Sn = new y.Euler(), Wr = new y.Vector3(1, 1, 1), Te = new y.Vector3(), Xr = new y.Box3();
4357
+ const le = new y.Matrix4(), fe = new y.Quaternion(), vn = new y.Euler(), Wr = new y.Vector3(1, 1, 1), Te = new y.Vector3(), Xr = new y.Box3();
4358
4358
  function $r(n, t, e = 5e-3, o = 0.2) {
4359
4359
  if (!n.length || !t.length) return 0;
4360
4360
  const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (d, c, f) => `${Math.floor(d / i)},${Math.floor(c / i)},${Math.floor(f / i)}`;
@@ -4371,8 +4371,8 @@ function $r(n, t, e = 5e-3, o = 0.2) {
4371
4371
  for (const d of n) {
4372
4372
  const c = Math.floor(d.x / i), f = Math.floor(d.y / i), w = Math.floor(d.z / i);
4373
4373
  let x = !1;
4374
- for (const [P, M, g] of h) {
4375
- const m = `${c + P},${f + M},${w + g}`;
4374
+ for (const [b, M, g] of h) {
4375
+ const m = `${c + b},${f + M},${w + g}`;
4376
4376
  if (s.has(m)) {
4377
4377
  for (const p of s.get(m))
4378
4378
  if (d.distanceToSquared(p) < r) {
@@ -4404,7 +4404,7 @@ function Ge(n, t, e, o) {
4404
4404
  }
4405
4405
  return !1;
4406
4406
  }
4407
- function vn(n, t) {
4407
+ function Sn(n, t) {
4408
4408
  const e = new y.Vector3(), o = new y.Vector3();
4409
4409
  n.getSize(e), t.getSize(o);
4410
4410
  const i = e.x * e.y * e.z, r = o.x * o.y * o.z;
@@ -4451,30 +4451,30 @@ const Mi = (n) => {
4451
4451
  if (n.length == 0) return [];
4452
4452
  const t = [], e = /* @__PURE__ */ new Map();
4453
4453
  for (let r = 0; r < n.length; r++) {
4454
- let s = n[r].points.map((P) => [P.x, P.y]), a = n[r].obj_id;
4454
+ let s = n[r].points.map((b) => [b.x, b.y]), a = n[r].obj_id;
4455
4455
  a = a.replace(/calcony railing/g, "balcony railing").replace(/glass balcony railing/g, "balcony railing").replace(/metal balcony railing/g, "balcony railing").replace(/temporary construction guardrail/g, "balcony railing").replace(/the floor of the house/g, "floor").replace(/the outdoor floor/g, "floor"), a.split("_").slice(1, 3).join("_").split(".")[0].split("_")[0];
4456
4456
  const l = a.indexOf("_") + 1, u = a.lastIndexOf("_"), h = a.substring(l, u);
4457
4457
  if (h === "wall")
4458
4458
  continue;
4459
4459
  let d = [];
4460
- for (let P = 0; P < n[r].points.length; P++)
4460
+ for (let b = 0; b < n[r].points.length; b++)
4461
4461
  d.push(new y.Vector3(
4462
- n[r].points[P].x,
4463
- n[r].points[P].y,
4464
- n[r].points[P].z
4462
+ n[r].points[b].x,
4463
+ n[r].points[b].y,
4464
+ n[r].points[b].z
4465
4465
  ));
4466
4466
  let c = -99999;
4467
4467
  if (h === "floor") {
4468
- let P = /* @__PURE__ */ new Map();
4468
+ let b = /* @__PURE__ */ new Map();
4469
4469
  for (let g = 0; g < n[r].points.length; g++) {
4470
4470
  let m = n[r].points[g].z;
4471
- if (m = Math.floor(m * 10) / 10, P.has(m)) {
4472
- const p = P.get(m);
4473
- p.num += 1, p.points.push(n[r].points[g]), P.set(m, p);
4471
+ if (m = Math.floor(m * 10) / 10, b.has(m)) {
4472
+ const p = b.get(m);
4473
+ p.num += 1, p.points.push(n[r].points[g]), b.set(m, p);
4474
4474
  } else
4475
- P.set(m, { num: 1, points: [n[r].points[g]] });
4475
+ b.set(m, { num: 1, points: [n[r].points[g]] });
4476
4476
  }
4477
- let M = [...P.entries()].reduce(
4477
+ let M = [...b.entries()].reduce(
4478
4478
  (g, m) => m[1].num > g[1].num ? m : g
4479
4479
  );
4480
4480
  s = [], s = M[1].points.map((g) => [g.x, g.y]), d = [], d = M[1].points.map((g) => new y.Vector3(g.x, g.y, g.z)), c = M[0];
@@ -4496,9 +4496,9 @@ const Mi = (n) => {
4496
4496
  };
4497
4497
  if (w.obb = _n(w.path, w.center, w.h, (w.maxz + w.minz) / 2), w.obb == null) continue;
4498
4498
  let x = -1;
4499
- for (let P = 0; P < t.length; P++)
4500
- if (t[P].type == h) {
4501
- x = P;
4499
+ for (let b = 0; b < t.length; b++)
4500
+ if (t[b].type == h) {
4501
+ x = b;
4502
4502
  break;
4503
4503
  }
4504
4504
  if (x != -1 ? t[x].array.push(w) : t.push({
@@ -4506,8 +4506,8 @@ const Mi = (n) => {
4506
4506
  array: [w]
4507
4507
  }), h == "floor" && c != -99999)
4508
4508
  if (e.has(c)) {
4509
- const P = e.get(c);
4510
- P.num += w.points.length, P.datas.push(w), e.set(c, P);
4509
+ const b = e.get(c);
4510
+ b.num += w.points.length, b.datas.push(w), e.set(c, b);
4511
4511
  } else
4512
4512
  e.set(c, { num: w.points.length, datas: [w] });
4513
4513
  }
@@ -4538,9 +4538,9 @@ const Mi = (n) => {
4538
4538
  continue;
4539
4539
  if (d.obb.intersectsOBB(s[c].obb)) {
4540
4540
  a.push(c);
4541
- for (let P = 0; P < s[c].points.length; P++)
4542
- (s[c].points[P].z > o && s[c].points[P].z - o > 0.1 || d.type == "floor") && d.points.push(s[c].points[P]);
4543
- const w = d.points.map((P) => [P.x, P.y]);
4541
+ for (let b = 0; b < s[c].points.length; b++)
4542
+ (s[c].points[b].z > o && s[c].points[b].z - o > 0.1 || d.type == "floor") && d.points.push(s[c].points[b]);
4543
+ const w = d.points.map((b) => [b.x, b.y]);
4544
4544
  d.path = cn(w);
4545
4545
  const x = Dn(d.points);
4546
4546
  d.h = x.h, d.minz = x.minz, d.maxz = x.maxz, d.center = { x: x.x, y: x.y, z: x.z }, d.obb = _n(d.path, d.center, d.h, (d.maxz + d.minz) / 2), d.positionArr.push(...s[c].positionArr), c = h;
@@ -4581,10 +4581,10 @@ const Mi = (n) => {
4581
4581
  const w = t[c].array;
4582
4582
  for (let x = 0; x < w.length; x++) {
4583
4583
  if (w[x].isDel) continue;
4584
- const P = w[x].obb, M = w[x].minz;
4585
- if (w[x].maxz, u.intersectsOBB(P)) {
4584
+ const b = w[x].obb, M = w[x].minz;
4585
+ if (w[x].maxz, u.intersectsOBB(b)) {
4586
4586
  pe(w[x].points, u);
4587
- const g = pe(a[l].points, P), m = vn(u, P);
4587
+ const g = pe(a[l].points, b), m = Sn(u, b);
4588
4588
  if (g >= 0.3 && m == -1) {
4589
4589
  a[l].isDel = !0;
4590
4590
  break;
@@ -4595,11 +4595,11 @@ const Mi = (n) => {
4595
4595
  w[x].isDel = !0;
4596
4596
  continue;
4597
4597
  }
4598
- if (f === "balcony railing" && we(P, a[l].points)) {
4598
+ if (f === "balcony railing" && we(b, a[l].points)) {
4599
4599
  a[l].isDel = !0;
4600
4600
  break;
4601
4601
  }
4602
- if (f === "balcony railing" && Ge(u, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - d) > 0.3)) {
4602
+ if (f === "balcony railing" && Ge(u, b, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - d) > 0.3)) {
4603
4603
  w[x].isDel = !0;
4604
4604
  continue;
4605
4605
  }
@@ -4608,37 +4608,37 @@ const Mi = (n) => {
4608
4608
  w[x].isDel = !0;
4609
4609
  continue;
4610
4610
  }
4611
- if (f === "window" && we(P, a[l].points)) {
4611
+ if (f === "window" && we(b, a[l].points)) {
4612
4612
  a[l].isDel = !0;
4613
4613
  break;
4614
4614
  }
4615
- if (f === "window" && Ge(u, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - d) > 0.3)) {
4615
+ if (f === "window" && Ge(u, b, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - d) > 0.3)) {
4616
4616
  a[l].isDel = !0;
4617
4617
  break;
4618
4618
  }
4619
4619
  }
4620
- let p = !1, b = [], z = [];
4621
- const v = a[l].points, S = w[x].points;
4622
- if (v.length > S.length ? (p = !0, b = v, z = S) : (b = S, z = v), $r(z, b, 0.03, 0.5) > 0.5)
4620
+ let p = !1, P = [], z = [];
4621
+ const S = a[l].points, v = w[x].points;
4622
+ if (S.length > v.length ? (p = !0, P = S, z = v) : (P = v, z = S), $r(z, P, 0.03, 0.5) > 0.5)
4623
4623
  if (p)
4624
4624
  w[x].isDel = !0;
4625
4625
  else {
4626
4626
  a[l].isDel = !0;
4627
4627
  break;
4628
4628
  }
4629
- else if (Ge(u, P)) {
4630
- const D = vn(u, P);
4629
+ else if (Ge(u, b)) {
4630
+ const D = Sn(u, b);
4631
4631
  if (D === 1 || D === 0) {
4632
4632
  if (f === "switch") continue;
4633
- v.length > S.length ? pe(z, u) >= 0.5 && (w[x].isDel = !0) : pe(b, u) >= 0.5 && (w[x].isDel = !0);
4633
+ S.length > v.length ? pe(z, u) >= 0.5 && (w[x].isDel = !0) : pe(P, u) >= 0.5 && (w[x].isDel = !0);
4634
4634
  } else {
4635
4635
  if (s === "switch") continue;
4636
- if (v.length > S.length) {
4637
- if (pe(b, P) >= 0.5) {
4636
+ if (S.length > v.length) {
4637
+ if (pe(P, b) >= 0.5) {
4638
4638
  a[l].isDel = !0;
4639
4639
  break;
4640
4640
  }
4641
- } else if (pe(z, P) >= 0.5) {
4641
+ } else if (pe(z, b) >= 0.5) {
4642
4642
  a[l].isDel = !0;
4643
4643
  break;
4644
4644
  }
@@ -4722,7 +4722,7 @@ function jr(n, t) {
4722
4722
  const c = i(h, d);
4723
4723
  if (o.has(c)) continue;
4724
4724
  o.add(c);
4725
- const [f, w] = n[h], [x, P] = n[d], M = Math.hypot(x - f, P - w);
4725
+ const [f, w] = n[h], [x, b] = n[d], M = Math.hypot(x - f, b - w);
4726
4726
  Number.isFinite(M) && M > 0 && e.push(M);
4727
4727
  }
4728
4728
  }
@@ -4774,19 +4774,19 @@ function zi(n, t = {}) {
4774
4774
  return [];
4775
4775
  const l = a * e, u = /* @__PURE__ */ new Map(), h = (f, w) => f < w ? `${f}_${w}` : `${w}_${f}`;
4776
4776
  for (let f = 0; f < s.length; f += 3) {
4777
- const w = s[f], x = s[f + 1], P = s[f + 2], [M, g] = i[w], [m, p] = i[x], [b, z] = i[P], { radius: v, maxEdge: S } = Gr(
4777
+ const w = s[f], x = s[f + 1], b = s[f + 2], [M, g] = i[w], [m, p] = i[x], [P, z] = i[b], { radius: S, maxEdge: v } = Gr(
4778
4778
  M,
4779
4779
  g,
4780
4780
  m,
4781
4781
  p,
4782
- b,
4782
+ P,
4783
4783
  z
4784
- ), V = Hr(i, w, x, P) * o;
4785
- if (v <= 1 / V && S <= l) {
4784
+ ), V = Hr(i, w, x, b) * o;
4785
+ if (S <= 1 / V && v <= l) {
4786
4786
  const D = [
4787
4787
  [w, x],
4788
- [x, P],
4789
- [P, w]
4788
+ [x, b],
4789
+ [b, w]
4790
4790
  ];
4791
4791
  for (const [_, E] of D) {
4792
4792
  const T = h(_, E);
@@ -4856,12 +4856,12 @@ function ei(n, t, e = 0.15) {
4856
4856
  for (const f of t) {
4857
4857
  if (f === n) continue;
4858
4858
  const w = be(c, f.start), x = be(c, f.end);
4859
- let P = null;
4860
- if (w <= e ? P = f.end : x <= e && (P = f.start), !P) continue;
4859
+ let b = null;
4860
+ if (w <= e ? b = f.end : x <= e && (b = f.start), !b) continue;
4861
4861
  const M = f.end.x - f.start.x, g = f.end.y - f.start.y, m = Math.sqrt(M * M + g * g);
4862
4862
  if (m < 1e-12 || Math.abs(o * M + i * g) / (r * m) >= 0.342) continue;
4863
- const b = (P.x - c.x) * s + (P.y - c.y) * a;
4864
- l[d].push(b > 0 ? 1 : -1);
4863
+ const P = (b.x - c.x) * s + (b.y - c.y) * a;
4864
+ l[d].push(P > 0 ? 1 : -1);
4865
4865
  }
4866
4866
  }
4867
4867
  if (l[0].length === 0 || l[1].length === 0) return 0;
@@ -4941,7 +4941,7 @@ function li(n, t) {
4941
4941
  let c = r.start, f = r.end;
4942
4942
  a ? f = s.end : l ? c = s.start : u ? f = s.start : h && (c = s.end);
4943
4943
  const w = Math.hypot(f.x - c.x, f.y - c.y), x = { ...r };
4944
- x.start = c, x.end = f, x.length = w, x.direction = { x: (f.x - c.x) / w, y: (f.y - c.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;
4944
+ x.start = c, x.end = f, x.length = w, x.direction = { x: (f.x - c.x) / w, y: (f.y - c.y) / w, z: 0 }, r.rooftopPz !== void 0 && s.rooftopPz !== void 0 ? x.rooftopPz = Math.max(r.rooftopPz, s.rooftopPz) : 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;
4945
4945
  }
4946
4946
  }
4947
4947
  return { segments: n, sourceMap: t };
@@ -4963,14 +4963,14 @@ function Zn(n, t = 5, e = 0.05) {
4963
4963
  return { seg: M.seg, offset: Math.abs(g * f + m * w), idx: M.idx };
4964
4964
  });
4965
4965
  x.sort((M, g) => M.offset - g.offset);
4966
- const P = ii(x);
4967
- for (const M of P) {
4966
+ const b = ii(x);
4967
+ for (const M of b) {
4968
4968
  let g = M[0].seg;
4969
4969
  for (const E of M)
4970
4970
  E.seg.length > g.length && (g = E.seg);
4971
- const m = g.end.x - g.start.x, p = g.end.y - g.start.y, b = Math.sqrt(m * m + p * p);
4972
- if (b < 1e-12) continue;
4973
- const z = m / b, v = p / b, S = M.map((E) => E.seg.rooftopPz ?? 0), V = Math.max(...S), D = [...new Set(S.map((E) => E.toFixed(3)))];
4971
+ const m = g.end.x - g.start.x, p = g.end.y - g.start.y, P = Math.sqrt(m * m + p * p);
4972
+ if (P < 1e-12) continue;
4973
+ const z = m / P, S = p / P, v = M.map((E) => E.seg.rooftopPz ?? 0), V = Math.max(...v), D = [...new Set(v.map((E) => E.toFixed(3)))];
4974
4974
  if (D.length > 1) {
4975
4975
  const E = M.map((T) => ({
4976
4976
  idx: T.idx,
@@ -4982,10 +4982,10 @@ function Zn(n, t = 5, e = 0.05) {
4982
4982
  a.push({ values: [...D], segments: E });
4983
4983
  }
4984
4984
  [...new Set(M.map((E) => String(E.seg.buildRosource)))];
4985
- const _ = si(M, g, z, v, e);
4985
+ const _ = si(M, g, z, S, e);
4986
4986
  for (const { l: E, r: T, srcIdxs: A } of _) {
4987
4987
  if (T - E < 0.01) continue;
4988
- const O = ai(g, E, T, z, v, V, g.buildRosource);
4988
+ const O = ai(g, E, T, z, S, V, g.buildRosource);
4989
4989
  r.push(O), s.push(A);
4990
4990
  }
4991
4991
  }
@@ -5028,35 +5028,35 @@ function hi(n, t, e, o, i, r, s) {
5028
5028
  continue;
5029
5029
  const { start: c, end: f } = h;
5030
5030
  let w = !1, x = 1 / 0;
5031
- for (const S of i) {
5032
- const { dist: V, t: D } = Un(S.x, S.y, c.x, c.y, f.x, f.y);
5031
+ for (const v of i) {
5032
+ const { dist: V, t: D } = Un(v.x, v.y, c.x, c.y, f.x, f.y);
5033
5033
  D >= -u.margin && D <= 1 + u.margin && V <= u.maxDist && (w = !0, x = Math.min(x, V));
5034
5034
  }
5035
5035
  if (!w) {
5036
5036
  `${u.maxDist}${(-u.margin).toFixed(1)}${(1 + u.margin).toFixed(1)}`;
5037
5037
  continue;
5038
5038
  }
5039
- const P = Math.sqrt((f.x - c.x) ** 2 + (f.y - c.y) ** 2);
5040
- if (P < 1e-12) continue;
5041
- const M = (f.x - c.x) / P, g = (f.y - c.y) / P, m = Math.abs(e * M + o * g), p = Math.abs(-o * M + e * g), b = Math.max(m, p), z = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
5039
+ const b = Math.sqrt((f.x - c.x) ** 2 + (f.y - c.y) ** 2);
5040
+ if (b < 1e-12) continue;
5041
+ const M = (f.x - c.x) / b, g = (f.y - c.y) / b, m = Math.abs(e * M + o * g), p = Math.abs(-o * M + e * g), P = Math.max(m, p), z = Math.acos(Math.min(P, 1)) * (180 / Math.PI);
5042
5042
  if (z > r.angleThreshold) {
5043
5043
  `${z.toFixed(1)}${r.angleThreshold}`;
5044
5044
  continue;
5045
5045
  }
5046
- let v = 0;
5047
- if (P > 0.01) {
5048
- const S = [];
5046
+ let S = 0;
5047
+ if (b > 0.01) {
5048
+ const v = [];
5049
5049
  for (let _ = 1; _ <= 4; _++) {
5050
- const E = i[_], T = E.x - c.x, A = E.y - c.y, O = (T * M + A * g) / P;
5051
- S.push(O);
5050
+ const E = i[_], T = E.x - c.x, A = E.y - c.y, O = (T * M + A * g) / b;
5051
+ v.push(O);
5052
5052
  }
5053
- const V = Math.min(...S), D = Math.max(...S);
5054
- D > V && (v = Math.max(0, Math.min(1, D) - Math.max(0, V)) / (D - V));
5053
+ const V = Math.min(...v), D = Math.max(...v);
5054
+ D > V && (S = Math.max(0, Math.min(1, D) - Math.max(0, V)) / (D - V));
5055
5055
  }
5056
5056
  l.push({
5057
5057
  seg: h,
5058
5058
  minDist: x,
5059
- embedRatio: v,
5059
+ embedRatio: S,
5060
5060
  ratio: h.length / t,
5061
5061
  score: 0,
5062
5062
  details: { conn: 0, variance: 0, sameSide: 0 }
@@ -5075,31 +5075,31 @@ function fi(n, t, e, o) {
5075
5075
  return n.sort((i, r) => r.embedRatio - i.embedRatio || r.score - i.score || i.minDist - r.minDist), n;
5076
5076
  }
5077
5077
  function di(n, t, e, o) {
5078
- 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, u = t.map((v) => {
5079
- const S = v.x - n.start.x, V = v.y - n.start.y;
5080
- return (S * a + V * l) / s;
5081
- }), h = Math.min(...u), d = Math.max(...u), c = (d - h) * s, f = (h + d) / 2, w = n.start.x + f * i, x = n.start.y + f * r, P = e.box.min.z, M = e.box.max.z, g = Math.abs(M - P), m = jn(o, n.start.x, n.start.y), p = Math.max(0, P - m), b = h <= 0 && d >= 1, z = n.start.z + f * (n.end.z - n.start.z);
5078
+ 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, u = t.map((S) => {
5079
+ const v = S.x - n.start.x, V = S.y - n.start.y;
5080
+ return (v * a + V * l) / s;
5081
+ }), h = Math.min(...u), d = Math.max(...u), c = (d - h) * s, f = (h + d) / 2, w = n.start.x + f * i, x = n.start.y + f * r, b = e.box.min.z, M = e.box.max.z, g = Math.abs(M - b), m = jn(o, n.start.x, n.start.y), p = Math.max(0, b - m), P = h <= 0 && d >= 1, z = n.start.z + f * (n.end.z - n.start.z);
5082
5082
  return {
5083
5083
  p: { x: w, y: x, z },
5084
5084
  width: c,
5085
- full: b,
5085
+ full: P,
5086
5086
  height: g,
5087
5087
  groundClearance: p
5088
5088
  };
5089
5089
  }
5090
5090
  function Kn(n, t, e) {
5091
- var h, d, c, f, w;
5092
- const o = t.map((x) => e[x]), i = [], r = [], s = [], a = [], l = [];
5093
- let u;
5094
- for (const x of o) {
5095
- if ((h = x.points) != null && h.length) for (const P of x.points) i.push(P);
5096
- if ((d = x.originalPoints) != null && d.length) for (const P of x.originalPoints) r.push(P);
5097
- if ((c = x.doorAndBeamData) != null && c.length) for (const P of x.doorAndBeamData) s.push(P);
5098
- if ((f = x.insetionArr) != null && f.length) for (const P of x.insetionArr) a.push(P);
5099
- if ((w = x.drawWindow) != null && w.length) for (const P of x.drawWindow) l.push(P);
5100
- x.boxData && !u && (u = x.boxData);
5101
- }
5102
- 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), u && (n.boxData = u);
5091
+ var d, c, f, w, x;
5092
+ const o = t.map((b) => e[b]), i = [], r = [], s = [], a = [], l = [];
5093
+ let u, h;
5094
+ for (const b of o) {
5095
+ if ((d = b.points) != null && d.length) for (const M of b.points) i.push(M);
5096
+ if ((c = b.originalPoints) != null && c.length) for (const M of b.originalPoints) r.push(M);
5097
+ if ((f = b.doorAndBeamData) != null && f.length) for (const M of b.doorAndBeamData) s.push(M);
5098
+ if ((w = b.insetionArr) != null && w.length) for (const M of b.insetionArr) a.push(M);
5099
+ if ((x = b.drawWindow) != null && x.length) for (const M of b.drawWindow) l.push(M);
5100
+ b.boxData && !u && (u = b.boxData), b.rooftopPz !== void 0 && (h === void 0 || b.rooftopPz > h) && (h = b.rooftopPz);
5101
+ }
5102
+ 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), u && (n.boxData = u), h !== void 0 && (n.rooftopPz = h);
5103
5103
  }
5104
5104
  function mi(n, t, e, o) {
5105
5105
  var u;
@@ -5108,7 +5108,7 @@ function mi(n, t, e, o) {
5108
5108
  const d = (u = h.coordinatesByArea) == null ? void 0 : u.coordinates;
5109
5109
  if (!d || d.length < 4)
5110
5110
  continue;
5111
- const c = d.slice(0, 4), f = c.reduce((D, _) => D + _.x, 0) / 4, w = c.reduce((D, _) => D + _.y, 0) / 4, { longSide: x, dirX: P, dirY: M } = Qr(c);
5111
+ const c = d.slice(0, 4), f = c.reduce((D, _) => D + _.x, 0) / 4, w = c.reduce((D, _) => D + _.y, 0) / 4, { longSide: x, dirX: b, dirY: M } = Qr(c);
5112
5112
  if (x < 0.01)
5113
5113
  continue;
5114
5114
  const g = c.reduce((D, _) => D + _.z, 0) / 4, m = jn(t, f, w);
@@ -5116,12 +5116,12 @@ function mi(n, t, e, o) {
5116
5116
  continue;
5117
5117
  const p = ui(c, f, w);
5118
5118
  h.name;
5119
- let b = hi(l, x, P, M, p, i, h.name);
5120
- b = fi(b, p, t, h.name);
5121
- let z = null, v = 1 / 0, S = 0;
5122
- if (b.length > 0) {
5123
- const D = b[0];
5124
- z = D.seg, v = D.minDist, S = D.ratio;
5119
+ let P = hi(l, x, b, M, p, i, h.name);
5120
+ P = fi(P, p, t, h.name);
5121
+ let z = null, S = 1 / 0, v = 0;
5122
+ if (P.length > 0) {
5123
+ const D = P[0];
5124
+ z = D.seg, S = D.minDist, v = D.ratio;
5125
5125
  }
5126
5126
  let V;
5127
5127
  if (z && (V = di(z, c, h, s), !i.printOnly)) {
@@ -5133,8 +5133,8 @@ function mi(n, t, e, o) {
5133
5133
  windowCategory: h.category,
5134
5134
  windowCenter: h.center,
5135
5135
  wallSegment: z,
5136
- distance: v,
5137
- wallLengthRatio: S,
5136
+ distance: S,
5137
+ wallLengthRatio: v,
5138
5138
  drawWindow: V
5139
5139
  });
5140
5140
  }