@solid-labs/fab-one-widget 1.1.0 → 1.1.1

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.
@@ -1,9 +1,9 @@
1
1
  import { jsxs as v, jsx as i, Fragment as Ie } from "react/jsx-runtime";
2
2
  import { createContext as mo, Component as xo, useCallback as ie, useMemo as Y, useState as I, memo as bo, useEffect as q, useRef as ae, forwardRef as yo, createElement as xn } from "react";
3
- import { useFrame as An, useThree as kn, Canvas as wo } from "@react-three/fiber";
4
- import { Html as Xe, Line as we, OrbitControls as Mn } from "@react-three/drei";
3
+ import { useFrame as An, useThree as Mn, Canvas as wo } from "@react-three/fiber";
4
+ import { Html as Xe, Line as we, OrbitControls as kn } from "@react-three/drei";
5
5
  import * as j from "three";
6
- import { Plane as St, Vector3 as M, Box3 as Fn, Line3 as Pn, Raycaster as vo } from "three";
6
+ import { Plane as St, Vector3 as k, Box3 as Fn, Line3 as Pn, Raycaster as vo } from "three";
7
7
  import { create as So } from "zustand";
8
8
  import { OBJLoader as Ln } from "three/examples/jsm/loaders/OBJLoader.js";
9
9
  import { STLLoader as Co } from "three/examples/jsm/loaders/STLLoader.js";
@@ -28,7 +28,7 @@ let __tla = (async () => {
28
28
  showNavigation: false,
29
29
  showToolbar: false,
30
30
  showSaveButton: false
31
- }, ko = mo(zo), Gt = So((t, r) => ({
31
+ }, Mo = mo(zo), Gt = So((t, r) => ({
32
32
  landmarkPoints: [],
33
33
  isAligned: false,
34
34
  isCut: false,
@@ -64,7 +64,7 @@ let __tla = (async () => {
64
64
  isAligned: false,
65
65
  isCut: false
66
66
  })
67
- })), Mo = 0.45, zt = 3, Vt = 1e-3, wt = 25.4, Fo = [
67
+ })), ko = 0.45, zt = 3, Vt = 1e-3, wt = 25.4, Fo = [
68
68
  0.25,
69
69
  -0.25,
70
70
  0.5,
@@ -97,9 +97,9 @@ let __tla = (async () => {
97
97
  const D = r[z * 3] * o, B = r[z * 3 + 1] * o, $ = r[z * 3 + 2] * o;
98
98
  D < e && (e = D), D > f && (f = D), B < h && (h = B), B > u && (u = B), $ < d && (d = $), $ > g && (g = $);
99
99
  }
100
- const k = (e + f) * 0.5, p = (h + u) * 0.5, b = (d + g) * 0.5, m = f - e + 1e-6, P = u - h + 1e-6, y = g - d + 1e-6, F = m * 0.5, A = P * 0.5, S = y * 0.5, C = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), L = m / C, T = P / C, E = y / C, w = /* @__PURE__ */ new Map();
100
+ const M = (e + f) * 0.5, p = (h + u) * 0.5, b = (d + g) * 0.5, m = f - e + 1e-6, P = u - h + 1e-6, y = g - d + 1e-6, F = m * 0.5, A = P * 0.5, S = y * 0.5, C = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), L = m / C, T = P / C, E = y / C, w = /* @__PURE__ */ new Map();
101
101
  for (let z = 0; z < a; z++) {
102
- const D = r[z * 3] * o - k, B = r[z * 3 + 1] * o - p, $ = r[z * 3 + 2] * o - b, ee = Math.min(C - 1, Math.max(0, Math.floor((D + F) / L))), se = Math.min(C - 1, Math.max(0, Math.floor((B + A) / T))), ce = Math.min(C - 1, Math.max(0, Math.floor(($ + S) / E))), U = ee * C * C + se * C + ce;
102
+ const D = r[z * 3] * o - M, B = r[z * 3 + 1] * o - p, $ = r[z * 3 + 2] * o - b, ee = Math.min(C - 1, Math.max(0, Math.floor((D + F) / L))), se = Math.min(C - 1, Math.max(0, Math.floor((B + A) / T))), ce = Math.min(C - 1, Math.max(0, Math.floor(($ + S) / E))), U = ee * C * C + se * C + ce;
103
103
  let oe = w.get(U);
104
104
  oe || (oe = [], w.set(U, oe)), oe.push(z);
105
105
  }
@@ -113,7 +113,7 @@ let __tla = (async () => {
113
113
  if (he < 0 || he >= C || ve < 0 || ve >= C || te < 0 || te >= C) continue;
114
114
  const O = w.get(he * C * C + ve * C + te);
115
115
  if (O) for (const X of O) {
116
- const Q = r[X * 3] * o - k, ue = r[X * 3 + 1] * o - p, fe = r[X * 3 + 2] * o - b, re = (D - Q) ** 2 + (B - ue) ** 2 + ($ - fe) ** 2;
116
+ const Q = r[X * 3] * o - M, ue = r[X * 3 + 1] * o - p, fe = r[X * 3 + 2] * o - b, re = (D - Q) ** 2 + (B - ue) ** 2 + ($ - fe) ** 2;
117
117
  re < U && (U = re, oe = X);
118
118
  }
119
119
  }
@@ -208,7 +208,7 @@ let __tla = (async () => {
208
208
  const h = a.length / 3;
209
209
  for (let m = 0; m < Math.min(e.length, 300); m++) if (e[m] >= h) return ye.error("wasm", `Out-of-bounds index: ${e[m]} >= ${h}`), null;
210
210
  n == null ? void 0 : n("Processing mesh (WASM)...");
211
- const d = r.preprocess_mesh(a, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), g = d.unit_converted(), k = d.detected_unit(), p = d.log();
211
+ const d = r.preprocess_mesh(a, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), g = d.unit_converted(), M = d.detected_unit(), p = d.log();
212
212
  if (ye.debug("wasm", "preprocess result", p), f.length === 0) return null;
213
213
  n == null ? void 0 : n("Building geometry...");
214
214
  const b = Rn(f, u);
@@ -220,7 +220,7 @@ let __tla = (async () => {
220
220
  geometry: b,
221
221
  wasScaled: g,
222
222
  unitConverted: g,
223
- detectedUnit: k
223
+ detectedUnit: M
224
224
  };
225
225
  } catch (o) {
226
226
  return ye.error("wasm", "Processing failed", o), null;
@@ -285,12 +285,12 @@ let __tla = (async () => {
285
285
  l.splice(p, 1), g = true;
286
286
  }
287
287
  }
288
- const k = Wo(u, r);
289
- k.length > 1 && c.push(k);
288
+ const M = Wo(u, r);
289
+ M.length > 1 && c.push(M);
290
290
  }
291
291
  if (!c.length) return [];
292
292
  if (n) {
293
- c.sort((g, k) => qe(k) - qe(g));
293
+ c.sort((g, M) => qe(M) - qe(g));
294
294
  const f = qe(c[0]), u = c.filter((g) => qe(g) >= f * 0.3);
295
295
  return u[u.length - 1] ?? c[0];
296
296
  }
@@ -301,21 +301,21 @@ let __tla = (async () => {
301
301
  let u = 0, g = 0;
302
302
  for (const p of f) u += p.x, g += p.z;
303
303
  u /= f.length, g /= f.length;
304
- const k = Math.sqrt(u * u + g * g);
305
- k < d && (d = k, h = f);
304
+ const M = Math.sqrt(u * u + g * g);
305
+ M < d && (d = M, h = f);
306
306
  }
307
307
  return h;
308
308
  }
309
309
  function yn(t, r, n, o = false) {
310
- const s = new St(new M(0, 1, 0), -n), l = [], c = new Fn();
310
+ const s = new St(new k(0, 1, 0), -n), l = [], c = new Fn();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
312
  const a = {
313
313
  linePoints: [],
314
314
  lineLength: 0,
315
- rightmostPoint: new M(0, n, 0)
315
+ rightmostPoint: new k(0, n, 0)
316
316
  };
317
317
  if (!s.intersectsBox(c)) return a;
318
- const e = new Pn(), h = new M();
318
+ const e = new Pn(), h = new k();
319
319
  t.shapecast({
320
320
  intersectsBounds: (p) => s.intersectsBox(p),
321
321
  intersectsTriangle: (p) => {
@@ -329,14 +329,14 @@ let __tla = (async () => {
329
329
  const d = Wn(l, Vt, o);
330
330
  if (d.length < 2) return a;
331
331
  const f = qe(d);
332
- let u = -1 / 0, g = new M(0, n, 0);
332
+ let u = -1 / 0, g = new k(0, n, 0);
333
333
  for (const p of d) p.x > u && (u = p.x, g = p.clone());
334
- const k = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Vt * 10;
334
+ const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Vt * 10;
335
335
  return {
336
336
  linePoints: d,
337
337
  lineLength: f,
338
338
  rightmostPoint: g,
339
- isClosed: k
339
+ isClosed: M
340
340
  };
341
341
  }
342
342
  function Ge(t, r, n, o = false) {
@@ -354,7 +354,7 @@ let __tla = (async () => {
354
354
  function Io(t, r, n, o) {
355
355
  const s = new St().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), l = new Fn();
356
356
  if (l.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(l)) return 0;
357
- const c = [], a = new Pn(), e = new M();
357
+ const c = [], a = new Pn(), e = new k();
358
358
  t.shapecast({
359
359
  intersectsBounds: (d) => s.intersectsBox(d),
360
360
  intersectsTriangle: (d) => {
@@ -424,30 +424,30 @@ let __tla = (async () => {
424
424
  reason: ""
425
425
  };
426
426
  }
427
- const ke = "pipeline";
427
+ const Me = "pipeline";
428
428
  function Eo(t, r, n, o) {
429
429
  var _a, _b, _c, _d;
430
430
  const s = t.geometry.clone(), l = r.map((a) => ({
431
431
  ...a
432
432
  })), c = o.wasmModule;
433
433
  try {
434
- let a = t.geometry, e = l.map((O) => new M(O.position.x, O.position.y, O.position.z));
434
+ let a = t.geometry, e = l.map((O) => new k(O.position.x, O.position.y, O.position.z));
435
435
  const h = e[0], d = e[1];
436
436
  if (!c) {
437
- o.onStatus("Aligning mesh (JS fallback)..."), ye.warn(ke, "WASM not available, using JS fallback alignment");
438
- const O = new M(0, 1, 0), X = new M().subVectors(d, h).normalize(), Q = X.dot(O), ue = new M().crossVectors(X, O);
437
+ o.onStatus("Aligning mesh (JS fallback)..."), ye.warn(Me, "WASM not available, using JS fallback alignment");
438
+ const O = new k(0, 1, 0), X = new k().subVectors(d, h).normalize(), Q = X.dot(O), ue = new k().crossVectors(X, O);
439
439
  if (ue.length() > 1e-4) {
440
440
  ue.normalize();
441
441
  const V = new j.Quaternion().setFromAxisAngle(ue, Math.acos(Math.min(1, Math.max(-1, Q))));
442
- a.applyMatrix4(new j.Matrix4().makeRotationFromQuaternion(V)), e = e.map((Me) => Me.clone().applyQuaternion(V));
442
+ a.applyMatrix4(new j.Matrix4().makeRotationFromQuaternion(V)), e = e.map((ke) => ke.clone().applyQuaternion(V));
443
443
  }
444
444
  if (e[0].y > e[1].y) {
445
- const V = new j.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
446
- a.applyMatrix4(new j.Matrix4().makeRotationFromQuaternion(V)), e = e.map((Me) => Me.clone().applyQuaternion(V));
445
+ const V = new j.Quaternion().setFromAxisAngle(new k(1, 0, 0), Math.PI);
446
+ a.applyMatrix4(new j.Matrix4().makeRotationFromQuaternion(V)), e = e.map((ke) => ke.clone().applyQuaternion(V));
447
447
  }
448
448
  const fe = e[0].clone();
449
- a.translate(-fe.x, -fe.y, -fe.z), e = e.map((V) => new M(V.x - fe.x, V.y - fe.y, V.z - fe.z)), a.computeVertexNormals(), a.computeBoundingBox();
450
- const re = new M(e[0].x, e[0].y, e[0].z);
449
+ a.translate(-fe.x, -fe.y, -fe.z), e = e.map((V) => new k(V.x - fe.x, V.y - fe.y, V.z - fe.z)), a.computeVertexNormals(), a.computeBoundingBox();
450
+ const re = new k(e[0].x, e[0].y, e[0].z);
451
451
  e.push(re), o.addLandmarkPoint({
452
452
  faceIndex: -1,
453
453
  vertexIndices: [
@@ -470,7 +470,7 @@ let __tla = (async () => {
470
470
  y: V.y,
471
471
  z: V.z
472
472
  }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * wt);
473
- const G = new M();
473
+ const G = new k();
474
474
  a.computeBoundingBox(), a.boundingBox.getSize(G), o.setModelSize(Math.max(G.x, G.y, G.z)), s.dispose();
475
475
  return;
476
476
  }
@@ -478,28 +478,28 @@ let __tla = (async () => {
478
478
  h.x,
479
479
  h.y,
480
480
  h.z
481
- ]), k = new Float32Array([
481
+ ]), M = new Float32Array([
482
482
  d.x,
483
483
  d.y,
484
484
  d.z
485
485
  ]);
486
486
  o.onStatus("Detecting shell type...");
487
- const p = c.detect_shell(f, u, k, 40), b = p.is_double_shell(), m = p.surface_normal();
488
- ye.info(ke, `Shell: ${b ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, b), o.onStatus("Finding cross-section plane...");
487
+ const p = c.detect_shell(f, u, M, 40), b = p.is_double_shell(), m = p.surface_normal();
488
+ ye.info(Me, `Shell: ${b ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, b), o.onStatus("Finding cross-section plane...");
489
489
  const P = new Float32Array([
490
490
  m[0],
491
491
  m[1],
492
492
  m[2]
493
- ]), y = c.find_min_cross_section(f, u, k, P, 10), F = y.plane_normal();
494
- ye.info(ke, "Cross-section found", y.details()), o.onStatus("Aligning mesh...");
493
+ ]), y = c.find_min_cross_section(f, u, M, P, 10), F = y.plane_normal();
494
+ ye.info(Me, "Cross-section found", y.details()), o.onStatus("Aligning mesh...");
495
495
  const A = new Float32Array([
496
496
  F[0],
497
497
  F[1],
498
498
  F[2]
499
- ]), S = c.align_to_origin(f, g, k, A);
499
+ ]), S = c.align_to_origin(f, g, M, A);
500
500
  let C = S.positions(), L = S.mpt(), T = S.origin();
501
501
  const E = S.transform();
502
- ye.info(ke, "Alignment complete", S.details());
502
+ ye.info(Me, "Alignment complete", S.details());
503
503
  const w = [
504
504
  E[3],
505
505
  E[4],
@@ -517,33 +517,33 @@ let __tla = (async () => {
517
517
  ]);
518
518
  o.onStatus("Generating measurement points...");
519
519
  const D = c.subdivide_origin_to_plane(new Float32Array(T), new Float32Array(L), z);
520
- ye.debug(ke, `Subdivide: ${D.count()} pts, spacing=${D.spacing().toFixed(1)}mm`);
520
+ ye.debug(Me, `Subdivide: ${D.count()} pts, spacing=${D.spacing().toFixed(1)}mm`);
521
521
  const B = D.points(), $ = D.count(), ee = 2, se = 1, ce = [];
522
522
  for (let O = ee; O < $ - se; O++) ce.push(B[O * 3 + 1]);
523
523
  o.onStatus("Computing cross-sections...");
524
524
  let U = [];
525
525
  if (ce.length >= 2) {
526
526
  const X = (b ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(C, u, new Float32Array(ce), 10);
527
- ye.debug(ke, "Batch (subdivision)", X.details());
527
+ ye.debug(Me, "Batch (subdivision)", X.details());
528
528
  const Q = X.all_loop_points(), ue = X.offsets(), fe = X.circumferences();
529
529
  for (let re = 0; re < ue.length - 1; re++) {
530
530
  const G = ue[re], V = ue[re + 1];
531
531
  if (V <= G || fe[re] <= 0) continue;
532
- const Me = (V - G) / 3;
533
- if (Me < 3) continue;
532
+ const ke = (V - G) / 3;
533
+ if (ke < 3) continue;
534
534
  let Ae = 0, Ye = 0, me = 0;
535
535
  for (let ze = G; ze < V; ze += 3) Ae += Q[ze], Ye += Q[ze + 1], me += Q[ze + 2];
536
- U.push(Ae / Me, Ye / Me, me / Me);
536
+ U.push(Ae / ke, Ye / ke, me / ke);
537
537
  }
538
538
  }
539
539
  if (U.length >= 6) {
540
540
  o.onStatus("Refining alignment...");
541
541
  const O = c.refine_alignment(new Float32Array(U), C, new Float32Array(T), new Float32Array(L));
542
- ye.info(ke, "Refinement complete", O.details()), C = O.positions(), L = O.mpt(), T = O.origin();
542
+ ye.info(Me, "Refinement complete", O.details()), C = O.positions(), L = O.mpt(), T = O.origin();
543
543
  }
544
544
  const oe = a.getAttribute("color"), J = Rn(C, u);
545
- oe && J.setAttribute("color", oe), a.dispose(), a = J, t.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), e[0] = new M(T[0], T[1], T[2]), e[1] = new M(L[0], L[1], L[2]), o.onStatus("Setting blue point...");
546
- const Z = new M(e[0].x, e[0].y, e[0].z);
545
+ oe && J.setAttribute("color", oe), a.dispose(), a = J, t.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), e[0] = new k(T[0], T[1], T[2]), e[1] = new k(L[0], L[1], L[2]), o.onStatus("Setting blue point...");
546
+ const Z = new k(e[0].x, e[0].y, e[0].z);
547
547
  e.push(Z), o.addLandmarkPoint({
548
548
  faceIndex: -1,
549
549
  vertexIndices: [
@@ -566,7 +566,7 @@ let __tla = (async () => {
566
566
  y: O.y,
567
567
  z: O.z
568
568
  }))), o.setAligned(true);
569
- const ge = a.boundingBox, de = new M();
569
+ const ge = a.boundingBox, de = new k();
570
570
  ge.getSize(de), o.setModelSize(Math.max(de.x, de.y, de.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * wt), o.onStatus("Computing final measurements...");
571
571
  {
572
572
  const O = vt(a), X = e[1].y, Q = e[0].y;
@@ -580,9 +580,9 @@ let __tla = (async () => {
580
580
  ze < fe - 1 && V.push(ze);
581
581
  }
582
582
  for (let me = X - G; me > Q; me -= G) V.push(me);
583
- V.sort((me, ze) => me - ze), ye.info(ke, `Horizontal slices: ${V.length} Y planes, range ${(_b = V[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = V[V.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
583
+ V.sort((me, ze) => me - ze), ye.info(Me, `Horizontal slices: ${V.length} Y planes, range ${(_b = V[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = V[V.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
584
584
  const Ae = (b ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(O.positions, O.indices, new Float32Array(V), 10);
585
- ye.info(ke, `Horizontal slices (${b ? "inner" : "outer"}): ${Ae.count()}/${V.length} valid`), ye.debug(ke, "Slice details", Ae.details());
585
+ ye.info(Me, `Horizontal slices (${b ? "inner" : "outer"}): ${Ae.count()}/${V.length} valid`), ye.debug(Me, "Slice details", Ae.details());
586
586
  const Ye = {
587
587
  yValues: V,
588
588
  circumferences: Array.from(Ae.circumferences()),
@@ -595,9 +595,9 @@ let __tla = (async () => {
595
595
  }
596
596
  o.onStatus("Validating results...");
597
597
  const he = e[1].y, ve = e[0].y, te = Bo(a, he, ve, n);
598
- te.valid || ye.warn(ke, `Validation: ${te.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
598
+ te.valid || ye.warn(Me, `Validation: ${te.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
599
599
  } catch (a) {
600
- ye.error(ke, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
600
+ ye.error(Me, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
601
601
  }
602
602
  }
603
603
  class To extends xo {
@@ -759,19 +759,19 @@ let __tla = (async () => {
759
759
  ]
760
760
  });
761
761
  function Oo(t, r, n, o) {
762
- const s = new M().subVectors(n, r), l = new M().subVectors(o, r), c = new M().subVectors(t, r), a = s.dot(s), e = s.dot(l), h = s.dot(c), d = l.dot(l), f = l.dot(c), u = 1 / (a * d - e * e), g = (d * h - e * f) * u, k = (a * f - e * h) * u;
762
+ const s = new k().subVectors(n, r), l = new k().subVectors(o, r), c = new k().subVectors(t, r), a = s.dot(s), e = s.dot(l), h = s.dot(c), d = l.dot(l), f = l.dot(c), u = 1 / (a * d - e * e), g = (d * h - e * f) * u, M = (a * f - e * h) * u;
763
763
  return {
764
- u: 1 - g - k,
764
+ u: 1 - g - M,
765
765
  v: g,
766
- w: k
766
+ w: M
767
767
  };
768
768
  }
769
769
  const Ho = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
770
770
  const { addLandmarkPoint: c, landmarkPoints: a } = Gt(), e = ie((g) => {
771
771
  if (a.length >= r) return;
772
772
  g.stopPropagation();
773
- const k = g.intersections[0], p = k == null ? void 0 : k.faceIndex;
774
- if (!k || p == null) return;
773
+ const M = g.intersections[0], p = M == null ? void 0 : M.faceIndex;
774
+ if (!M || p == null) return;
775
775
  const b = t.geometry, m = b.index;
776
776
  let P;
777
777
  m ? P = [
@@ -783,9 +783,9 @@ let __tla = (async () => {
783
783
  p * 3 + 1,
784
784
  p * 3 + 2
785
785
  ];
786
- const y = b.getAttribute("position"), F = new M().fromBufferAttribute(y, P[0]), A = new M().fromBufferAttribute(y, P[1]), S = new M().fromBufferAttribute(y, P[2]);
786
+ const y = b.getAttribute("position"), F = new k().fromBufferAttribute(y, P[0]), A = new k().fromBufferAttribute(y, P[1]), S = new k().fromBufferAttribute(y, P[2]);
787
787
  F.applyMatrix4(t.matrixWorld), A.applyMatrix4(t.matrixWorld), S.applyMatrix4(t.matrixWorld);
788
- const C = k.point, L = Oo(C, F, A, S), T = {
788
+ const C = M.point, L = Oo(C, F, A, S), T = {
789
789
  faceIndex: p,
790
790
  vertexIndices: P,
791
791
  position: {
@@ -875,7 +875,7 @@ let __tla = (async () => {
875
875
  "#4444ff"
876
876
  ], c = r ?? [
877
877
  "MPT",
878
- "Origin",
878
+ "Distal Most Point",
879
879
  "Cut Plane"
880
880
  ];
881
881
  return i(Ie, {
@@ -911,8 +911,8 @@ let __tla = (async () => {
911
911
  for (let e = 0; e < n; e++) {
912
912
  const h = t[e], d = r[e], f = h.distanceTo(d), u = Go(f);
913
913
  if (o[e * 6] = h.x, o[e * 6 + 1] = h.y, o[e * 6 + 2] = h.z, s[e * 6] = u.r, s[e * 6 + 1] = u.g, s[e * 6 + 2] = u.b, o[e * 6 + 3] = d.x, o[e * 6 + 4] = d.y, o[e * 6 + 5] = d.z, s[e * 6 + 3] = u.r, s[e * 6 + 4] = u.g, s[e * 6 + 5] = u.b, e < n - 1) {
914
- const g = e * 2, k = g + 1, p = (e + 1) * 2, b = p + 1;
915
- l.push(g, k, p, k, b, p);
914
+ const g = e * 2, M = g + 1, p = (e + 1) * 2, b = p + 1;
915
+ l.push(g, M, p, M, b, p);
916
916
  }
917
917
  }
918
918
  const c = new j.BufferGeometry();
@@ -934,13 +934,13 @@ let __tla = (async () => {
934
934
  a,
935
935
  d,
936
936
  f
937
- ]), g = d ?? (u == null ? void 0 : u.linePoints) ?? [], k = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = Y(() => {
938
- if (e == null || e === 0 || k <= 0 || g.length < 2) return null;
939
- const y = e / k, F = g.reduce((S, C) => S + C.x, 0) / g.length, A = g.reduce((S, C) => S + C.z, 0) / g.length;
940
- return g.map((S) => new M(F + (S.x - F) * y, S.y, A + (S.z - A) * y));
937
+ ]), g = d ?? (u == null ? void 0 : u.linePoints) ?? [], M = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = Y(() => {
938
+ if (e == null || e === 0 || M <= 0 || g.length < 2) return null;
939
+ const y = e / M, F = g.reduce((S, C) => S + C.x, 0) / g.length, A = g.reduce((S, C) => S + C.z, 0) / g.length;
940
+ return g.map((S) => new k(F + (S.x - F) * y, S.y, A + (S.z - A) * y));
941
941
  }, [
942
942
  g,
943
- k,
943
+ M,
944
944
  e
945
945
  ]), b = Y(() => !p || g.length < 2 ? null : Xo(g, p), [
946
946
  g,
@@ -967,29 +967,29 @@ let __tla = (async () => {
967
967
  }, [
968
968
  P
969
969
  ]), q(() => {
970
- k > 0 && (l == null ? void 0 : l({
970
+ M > 0 && (l == null ? void 0 : l({
971
971
  yPosition: n,
972
- originalValue: k,
972
+ originalValue: M,
973
973
  modifiedValue: null
974
974
  }));
975
975
  }, [
976
- k,
976
+ M,
977
977
  n,
978
978
  l
979
979
  ]), An(({ camera: y }) => {
980
980
  if (!m.current || g.length < 2) return;
981
- const F = new M();
981
+ const F = new k();
982
982
  y.getWorldDirection(F);
983
- const A = new M(F.x, 0, F.z);
983
+ const A = new k(F.x, 0, F.z);
984
984
  if (A.lengthSq() < 1e-8) return;
985
985
  A.normalize();
986
- const S = new M().crossVectors(A, new M(0, 1, 0)).normalize();
986
+ const S = new k().crossVectors(A, new k(0, 1, 0)).normalize();
987
987
  let C = -1 / 0, L = g[0];
988
988
  for (const z of g) {
989
989
  const D = S.x * z.x + S.z * z.z;
990
990
  D > C && (C = D, L = z);
991
991
  }
992
- const T = s * 0.35, E = new M(L.x + S.x * T, n, L.z + S.z * T);
992
+ const T = s * 0.35, E = new k(L.x + S.x * T, n, L.z + S.z * T);
993
993
  m.current.position.copy(E);
994
994
  const w = P.geometry.getAttribute("position");
995
995
  w.setXYZ(0, L.x, L.y, L.z), w.setXYZ(1, E.x, E.y, E.z), w.needsUpdate = true;
@@ -1011,7 +1011,7 @@ let __tla = (async () => {
1011
1011
  }),
1012
1012
  p && e != null && e !== 0 && i(we, {
1013
1013
  points: p,
1014
- color: vn(k, e),
1014
+ color: vn(M, e),
1015
1015
  lineWidth: 2.5,
1016
1016
  dashed: true,
1017
1017
  dashSize: 2,
@@ -1065,7 +1065,7 @@ let __tla = (async () => {
1065
1065
  minWidth: 52,
1066
1066
  textAlign: "right"
1067
1067
  },
1068
- children: c === "inch" ? (k / 25.4).toFixed(2) : k.toFixed(1)
1068
+ children: c === "inch" ? (M / 25.4).toFixed(2) : M.toFixed(1)
1069
1069
  }),
1070
1070
  i("span", {
1071
1071
  style: {
@@ -1077,8 +1077,8 @@ let __tla = (async () => {
1077
1077
  })
1078
1078
  ]
1079
1079
  }),
1080
- e != null && e !== 0 && k > 0 && (() => {
1081
- const y = k - e, F = y > 0.5 ? "\u25B2" : y < -0.5 ? "\u25BC" : "", A = vn(k, e);
1080
+ e != null && e !== 0 && M > 0 && (() => {
1081
+ const y = M - e, F = y > 0.5 ? "\u25B2" : y < -0.5 ? "\u25BC" : "", A = vn(M, e);
1082
1082
  return v("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
@@ -1131,7 +1131,7 @@ let __tla = (async () => {
1131
1131
  ]
1132
1132
  });
1133
1133
  }, Zo = bo(Yo), Ko = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: l, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: e = false, formMeasurements: h, originY: d, wasmSlices: f }) => {
1134
- const u = ae(/* @__PURE__ */ new Map()), g = t.geometry, k = In(g), p = Y(() => {
1134
+ const u = ae(/* @__PURE__ */ new Map()), g = t.geometry, M = In(g), p = Y(() => {
1135
1135
  if (f) {
1136
1136
  let C = [
1137
1137
  ...f.yValues
@@ -1162,7 +1162,7 @@ let __tla = (async () => {
1162
1162
  const E = C[T], w = C[T + 1];
1163
1163
  if (w <= E) continue;
1164
1164
  const z = [];
1165
- for (let D = E; D < w; D += 3) z.push(new M(S[D], S[D + 1], S[D + 2]));
1165
+ for (let D = E; D < w; D += 3) z.push(new k(S[D], S[D + 1], S[D + 2]));
1166
1166
  z.length >= 3 && A.set(L[T], z);
1167
1167
  }
1168
1168
  return A;
@@ -1195,7 +1195,7 @@ let __tla = (async () => {
1195
1195
  ]);
1196
1196
  const P = [
1197
1197
  "#5B9BD5"
1198
- ], y = s * Mo, F = ie((A) => {
1198
+ ], y = s * ko, F = ie((A) => {
1199
1199
  if (m) return;
1200
1200
  u.current.set(A.yPosition, A);
1201
1201
  const S = Array.from(u.current.values()).sort((C, L) => c ? L.yPosition - C.yPosition : C.yPosition - L.yPosition);
@@ -1205,9 +1205,9 @@ let __tla = (async () => {
1205
1205
  c,
1206
1206
  m
1207
1207
  ]);
1208
- return k ? i(Ie, {
1208
+ return M ? i(Ie, {
1209
1209
  children: p.map((A, S) => i(Zo, {
1210
- bvh: k,
1210
+ bvh: M,
1211
1211
  geometry: g,
1212
1212
  yPosition: A,
1213
1213
  color: d != null && Math.abs(A - d) < o * 0.5 ? "#44ff44" : P[S % P.length],
@@ -1231,17 +1231,17 @@ let __tla = (async () => {
1231
1231
  const a = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - a, h = n * 0.4, d = n * 0.03, f = ae(null);
1232
1232
  An(({ camera: S }) => {
1233
1233
  if (!f.current) return;
1234
- const C = new M();
1234
+ const C = new k();
1235
1235
  S.getWorldDirection(C);
1236
- const L = new M(C.x, 0, C.z);
1236
+ const L = new k(C.x, 0, C.z);
1237
1237
  if (L.lengthSq() < 1e-8) return;
1238
1238
  L.normalize();
1239
- const T = new M().crossVectors(new M(0, 1, 0), L).normalize();
1239
+ const T = new k().crossVectors(new k(0, 1, 0), L).normalize();
1240
1240
  f.current.position.set(T.x * h, 0, T.z * h);
1241
1241
  const E = S.position.x - f.current.position.x, w = S.position.z - f.current.position.z;
1242
1242
  f.current.rotation.y = Math.atan2(E, w);
1243
1243
  });
1244
- const u = new M(0, r, 0), g = new M(0, a, 0), k = new M(0, (r + a) / 2, 0), p = new M(-d, r, 0), b = new M(d, r, 0), m = new M(-d, a, 0), P = new M(d, a, 0), y = l != null && l > 0, F = y ? e - l : 0, A = y ? qo(e, l) : "#fff";
1244
+ const u = new k(0, r, 0), g = new k(0, a, 0), M = new k(0, (r + a) / 2, 0), p = new k(-d, r, 0), b = new k(d, r, 0), m = new k(-d, a, 0), P = new k(d, a, 0), y = l != null && l > 0, F = y ? e - l : 0, A = y ? qo(e, l) : "#fff";
1245
1245
  return v("group", {
1246
1246
  ref: f,
1247
1247
  children: [
@@ -1270,7 +1270,7 @@ let __tla = (async () => {
1270
1270
  lineWidth: 1.5
1271
1271
  }),
1272
1272
  i("mesh", {
1273
- position: k,
1273
+ position: M,
1274
1274
  children: i(Xe, {
1275
1275
  center: true,
1276
1276
  style: {
@@ -1361,16 +1361,16 @@ let __tla = (async () => {
1361
1361
  ]
1362
1362
  });
1363
1363
  }, Jo = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: l, landmarkCount: c = 0, measurementGeometry: a, fitYMin: e, fitYMax: h, resetCameraToFrontRef: d }) => {
1364
- const { set: f, size: u, camera: g, invalidate: k } = kn(), p = ae(false), b = ae(s), m = ae(new M()), P = ae(null), y = ae(c), F = ae(r), A = ae(n), S = ae(a), C = ae({
1364
+ const { set: f, size: u, camera: g, invalidate: M } = Mn(), p = ae(false), b = ae(s), m = ae(new k()), P = ae(null), y = ae(c), F = ae(r), A = ae(n), S = ae(a), C = ae({
1365
1365
  min: e,
1366
1366
  max: h
1367
1367
  }), L = ae(0), T = ie(() => {
1368
1368
  if (!o || t <= 0) return null;
1369
1369
  const w = a ?? o.geometry;
1370
1370
  w.computeBoundingBox();
1371
- const z = w.boundingBox, D = new M();
1371
+ const z = w.boundingBox, D = new k();
1372
1372
  z.getCenter(D);
1373
- const B = new M();
1373
+ const B = new k();
1374
1374
  z.getSize(B);
1375
1375
  const $ = e != null && h != null && h > e;
1376
1376
  if ($) {
@@ -1405,7 +1405,7 @@ let __tla = (async () => {
1405
1405
  const w = T();
1406
1406
  w && (f({
1407
1407
  camera: w
1408
- }), k());
1408
+ }), M());
1409
1409
  }, () => {
1410
1410
  d && (d.current = null);
1411
1411
  };
@@ -1413,13 +1413,13 @@ let __tla = (async () => {
1413
1413
  d,
1414
1414
  T,
1415
1415
  f,
1416
- k
1416
+ M
1417
1417
  ]);
1418
1418
  const E = ie((w) => {
1419
1419
  const z = w.position.clone(), D = z.length(), B = Math.atan2(z.x, z.z), $ = Math.acos(z.y / D), se = B + 0.02;
1420
- w.position.set(D * Math.sin($) * Math.sin(se), D * Math.cos($), D * Math.sin($) * Math.cos(se)), w.lookAt(0, 0, 0), w.updateMatrixWorld(true), k();
1420
+ w.position.set(D * Math.sin($) * Math.sin(se), D * Math.cos($), D * Math.sin($) * Math.cos(se)), w.lookAt(0, 0, 0), w.updateMatrixWorld(true), M();
1421
1421
  }, [
1422
- k
1422
+ M
1423
1423
  ]);
1424
1424
  return q(() => {
1425
1425
  if (t > 0 && !p.current && !r) {
@@ -1542,8 +1542,8 @@ let __tla = (async () => {
1542
1542
  var _a;
1543
1543
  const n = t.geometry;
1544
1544
  n.computeBoundingBox();
1545
- const o = new M();
1546
- return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(Mn, {
1545
+ const o = new k();
1546
+ return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(kn, {
1547
1547
  enableDamping: false,
1548
1548
  enablePan: false,
1549
1549
  minPolarAngle: Math.PI * 0.15,
@@ -1651,7 +1651,7 @@ let __tla = (async () => {
1651
1651
  a,
1652
1652
  c,
1653
1653
  n
1654
- ]), h = Y(() => new St(new M(0, -1, 0), r), [
1654
+ ]), h = Y(() => new St(new k(0, -1, 0), r), [
1655
1655
  r
1656
1656
  ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: g } = Y(() => {
1657
1657
  let b = null, m = null, P = 0, y = 0;
@@ -1659,11 +1659,11 @@ let __tla = (async () => {
1659
1659
  let F = e.linePoints[0], A = e.linePoints[0], S = e.linePoints[0], C = e.linePoints[0];
1660
1660
  for (const L of e.linePoints) L.x < F.x && (F = L), L.x > A.x && (A = L), L.z < S.z && (S = L), L.z > C.z && (C = L);
1661
1661
  b = [
1662
- new M(F.x, n, F.z),
1663
- new M(A.x, n, A.z)
1662
+ new k(F.x, n, F.z),
1663
+ new k(A.x, n, A.z)
1664
1664
  ], m = [
1665
- new M(S.x, n, S.z),
1666
- new M(C.x, n, C.z)
1665
+ new k(S.x, n, S.z),
1666
+ new k(C.x, n, C.z)
1667
1667
  ], P = b[0].distanceTo(b[1]), y = m[0].distanceTo(m[1]);
1668
1668
  }
1669
1669
  return {
@@ -1675,7 +1675,7 @@ let __tla = (async () => {
1675
1675
  }, [
1676
1676
  e,
1677
1677
  n
1678
- ]), k = (b) => l === "inch" ? (b / 25.4).toFixed(2) : b.toFixed(1), p = l === "inch" ? "in" : "mm";
1678
+ ]), M = (b) => l === "inch" ? (b / 25.4).toFixed(2) : b.toFixed(1), p = l === "inch" ? "in" : "mm";
1679
1679
  return v(Ie, {
1680
1680
  children: [
1681
1681
  i("mesh", {
@@ -1734,7 +1734,7 @@ let __tla = (async () => {
1734
1734
  },
1735
1735
  children: [
1736
1736
  "ML ",
1737
- k(u),
1737
+ M(u),
1738
1738
  " ",
1739
1739
  p
1740
1740
  ]
@@ -1778,7 +1778,7 @@ let __tla = (async () => {
1778
1778
  },
1779
1779
  children: [
1780
1780
  "AP ",
1781
- k(g),
1781
+ M(g),
1782
1782
  " ",
1783
1783
  p
1784
1784
  ]
@@ -1790,10 +1790,10 @@ let __tla = (async () => {
1790
1790
  ]
1791
1791
  });
1792
1792
  }, or = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: l, color: c, hoverColor: a, dragColor: e, label: h, onDragStart: d, onDragEnd: f }) => {
1793
- const [u, g] = I(false), [k, p] = I(false), { camera: b, gl: m } = kn(), P = ae(0), y = ae(null), F = t.geometry, A = In(F), S = Y(() => A ? Ge(A, F, r) : {
1793
+ const [u, g] = I(false), [M, p] = I(false), { camera: b, gl: m } = Mn(), P = ae(0), y = ae(null), F = t.geometry, A = In(F), S = Y(() => A ? Ge(A, F, r) : {
1794
1794
  linePoints: [],
1795
1795
  lineLength: 0,
1796
- rightmostPoint: new M()
1796
+ rightmostPoint: new k()
1797
1797
  }, [
1798
1798
  A,
1799
1799
  F,
@@ -1801,16 +1801,16 @@ let __tla = (async () => {
1801
1801
  ]), C = ie((D, B, $) => {
1802
1802
  const ee = m.domElement.getBoundingClientRect(), se = (D - ee.left) / ee.width * 2 - 1, ce = -((B - ee.top) / ee.height) * 2 + 1, U = new vo();
1803
1803
  U.setFromCamera(new j.Vector2(se, ce), b);
1804
- const oe = new M();
1804
+ const oe = new k();
1805
1805
  return U.ray.intersectPlane($, oe) ? oe.y : null;
1806
1806
  }, [
1807
1807
  b,
1808
1808
  m
1809
1809
  ]), L = ie((D) => {
1810
- const B = new M();
1810
+ const B = new k();
1811
1811
  b.getWorldDirection(B), B.y = 0, B.lengthSq() < 1e-6 && B.set(0, 0, 1), B.normalize();
1812
1812
  const $ = B.multiplyScalar(-1);
1813
- return new St().setFromNormalAndCoplanarPoint($, new M(0, D, 0));
1813
+ return new St().setFromNormalAndCoplanarPoint($, new k(0, D, 0));
1814
1814
  }, [
1815
1815
  b
1816
1816
  ]), T = ie((D) => {
@@ -1844,14 +1844,14 @@ let __tla = (async () => {
1844
1844
  f
1845
1845
  ]);
1846
1846
  if (S.linePoints.length < 2) return null;
1847
- const z = u ? e : k ? a : c;
1847
+ const z = u ? e : M ? a : c;
1848
1848
  return v("group", {
1849
1849
  renderOrder: 10,
1850
1850
  children: [
1851
1851
  i(we, {
1852
1852
  points: S.linePoints,
1853
1853
  color: z,
1854
- lineWidth: u ? 6 : k ? 5 : 4,
1854
+ lineWidth: u ? 6 : M ? 5 : 4,
1855
1855
  depthTest: false,
1856
1856
  depthWrite: false,
1857
1857
  transparent: true,
@@ -1866,7 +1866,7 @@ let __tla = (async () => {
1866
1866
  u || (p(false), m.domElement.style.cursor = "auto");
1867
1867
  }
1868
1868
  }),
1869
- (k || u) && i("mesh", {
1869
+ (M || u) && i("mesh", {
1870
1870
  position: [
1871
1871
  S.rightmostPoint.x + l * 0.15,
1872
1872
  r,
@@ -1945,7 +1945,7 @@ let __tla = (async () => {
1945
1945
  f,
1946
1946
  d,
1947
1947
  u
1948
- ]), k = Y(() => t === "BK" ? /* @__PURE__ */ new Set([
1948
+ ]), M = Y(() => t === "BK" ? /* @__PURE__ */ new Set([
1949
1949
  `At ${d}`,
1950
1950
  `2\u2033 below ${d}`,
1951
1951
  `4\u2033 below ${d}`
@@ -1982,7 +1982,7 @@ let __tla = (async () => {
1982
1982
  a
1983
1983
  ]);
1984
1984
  const L = Y(() => {
1985
- for (const w of k) {
1985
+ for (const w of M) {
1986
1986
  const z = g.indexOf(w);
1987
1987
  if (z === -1) continue;
1988
1988
  if (C[z] === 0) return false;
@@ -1991,7 +1991,7 @@ let __tla = (async () => {
1991
1991
  }, [
1992
1992
  C,
1993
1993
  g,
1994
- k,
1994
+ M,
1995
1995
  t,
1996
1996
  y,
1997
1997
  A
@@ -2189,7 +2189,7 @@ let __tla = (async () => {
2189
2189
  marginBottom: 20
2190
2190
  },
2191
2191
  children: g.map((w, z) => {
2192
- const D = k.has(w), B = !!p[w];
2192
+ const D = M.has(w), B = !!p[w];
2193
2193
  return v("div", {
2194
2194
  style: {
2195
2195
  display: "flex",
@@ -2694,20 +2694,20 @@ let __tla = (async () => {
2694
2694
  const L = o.getY(C);
2695
2695
  L >= m && L < P && (y += o.getX(C), F += L, A += o.getZ(C), S++);
2696
2696
  }
2697
- S > 20 && a.push(new M(y / S, F / S, A / S));
2697
+ S > 20 && a.push(new k(y / S, F / S, A / S));
2698
2698
  }
2699
2699
  if (a.length < 5) return null;
2700
- const e = new M();
2700
+ const e = new k();
2701
2701
  for (const b of a) e.add(b);
2702
2702
  e.divideScalar(a.length);
2703
- let h = 0, d = 0, f = 0, u = 0, g = 0, k = 0;
2703
+ let h = 0, d = 0, f = 0, u = 0, g = 0, M = 0;
2704
2704
  for (const b of a) {
2705
2705
  const m = b.x - e.x, P = b.y - e.y, y = b.z - e.z;
2706
- h += m * m, d += m * P, f += m * y, u += P * P, g += P * y, k += y * y;
2706
+ h += m * m, d += m * P, f += m * y, u += P * P, g += P * y, M += y * y;
2707
2707
  }
2708
- let p = new M(0.01, 1, 0.01).normalize();
2708
+ let p = new k(0.01, 1, 0.01).normalize();
2709
2709
  for (let b = 0; b < 30; b++) {
2710
- const m = h * p.x + d * p.y + f * p.z, P = d * p.x + u * p.y + g * p.z, y = f * p.x + g * p.y + k * p.z, F = new M(m, P, y), A = F.length();
2710
+ const m = h * p.x + d * p.y + f * p.z, P = d * p.x + u * p.y + g * p.z, y = f * p.x + g * p.y + M * p.z, F = new k(m, P, y), A = F.length();
2711
2711
  if (A < 1e-10 || (F.divideScalar(A), p.distanceTo(F) < 1e-8)) break;
2712
2712
  p = F;
2713
2713
  }
@@ -2729,7 +2729,7 @@ let __tla = (async () => {
2729
2729
  "#4488ff"
2730
2730
  ];
2731
2731
  function En(t) {
2732
- const r = t.getAttribute("position"), n = r.count, o = new M();
2732
+ const r = t.getAttribute("position"), n = r.count, o = new k();
2733
2733
  for (let p = 0; p < n; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
2734
2734
  o.divideScalar(n);
2735
2735
  let s = 0, l = 0, c = 0, a = 0, e = 0, h = 0;
@@ -2756,9 +2756,9 @@ let __tla = (async () => {
2756
2756
  ]
2757
2757
  ];
2758
2758
  for (let p = 0; p < 3; p++) {
2759
- let b = new M(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), m = 0;
2759
+ let b = new k(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), m = 0;
2760
2760
  for (let P = 0; P < 100; P++) {
2761
- const y = u[0][0] * b.x + u[0][1] * b.y + u[0][2] * b.z, F = u[1][0] * b.x + u[1][1] * b.y + u[1][2] * b.z, A = u[2][0] * b.x + u[2][1] * b.y + u[2][2] * b.z, S = new M(y, F, A);
2761
+ const y = u[0][0] * b.x + u[0][1] * b.y + u[0][2] * b.z, F = u[1][0] * b.x + u[1][1] * b.y + u[1][2] * b.z, A = u[2][0] * b.x + u[2][1] * b.y + u[2][2] * b.z, S = new k(y, F, A);
2762
2762
  if (m = S.length(), m < 1e-12) break;
2763
2763
  if (S.divideScalar(m), b.distanceTo(S) < 1e-10) {
2764
2764
  b = S;
@@ -2780,10 +2780,10 @@ let __tla = (async () => {
2780
2780
  u[P][y] -= m * F * A;
2781
2781
  }
2782
2782
  }
2783
- const g = new M();
2783
+ const g = new k();
2784
2784
  for (let p = 0; p < n; p++) g.x += r.getX(p), g.y += r.getY(p), g.z += r.getZ(p);
2785
2785
  g.divideScalar(n);
2786
- const k = [
2786
+ const M = [
2787
2787
  0,
2788
2788
  0,
2789
2789
  0
@@ -2795,13 +2795,13 @@ let __tla = (async () => {
2795
2795
  const F = r.getX(y) - g.x, A = r.getY(y) - g.y, S = r.getZ(y) - g.z, C = F * P.x + A * P.y + S * P.z;
2796
2796
  C < b && (b = C), C > m && (m = C);
2797
2797
  }
2798
- k[p] = (m - b) / 2;
2798
+ M[p] = (m - b) / 2;
2799
2799
  }
2800
2800
  return {
2801
2801
  axes: d,
2802
2802
  eigenvalues: f,
2803
2803
  center: g,
2804
- halfExtents: k
2804
+ halfExtents: M
2805
2805
  };
2806
2806
  }
2807
2807
  function pr({ pca: t }) {
@@ -2890,11 +2890,11 @@ let __tla = (async () => {
2890
2890
  });
2891
2891
  }
2892
2892
  function hr({ redPoint: t, greenPoint: r }) {
2893
- const n = Y(() => new M().subVectors(r, t).normalize(), [
2893
+ const n = Y(() => new k().subVectors(r, t).normalize(), [
2894
2894
  t,
2895
2895
  r
2896
2896
  ]), o = Y(() => {
2897
- const l = n.dot(new M(0, 1, 0));
2897
+ const l = n.dot(new k(0, 1, 0));
2898
2898
  return Math.acos(Math.min(1, Math.abs(l))) * 180 / Math.PI;
2899
2899
  }, [
2900
2900
  n
@@ -2946,16 +2946,16 @@ let __tla = (async () => {
2946
2946
  const l = o * 0.15, c = Y(() => {
2947
2947
  const a = [];
2948
2948
  let e = n - 10;
2949
- const h = new M(0, 1, 0);
2949
+ const h = new k(0, 1, 0);
2950
2950
  for (; e > r; ) {
2951
2951
  const d = Math.min(e, n), f = Math.max(e, n), u = Bn(t, d, f);
2952
2952
  if (u) {
2953
- const g = u.dot(h), k = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2953
+ const g = u.dot(h), M = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2954
2954
  a.push({
2955
2955
  axis: u,
2956
2956
  regionMin: d,
2957
2957
  regionMax: f,
2958
- angleDeg: k
2958
+ angleDeg: M
2959
2959
  });
2960
2960
  }
2961
2961
  e -= 10;
@@ -2968,7 +2968,7 @@ let __tla = (async () => {
2968
2968
  ]);
2969
2969
  return i("group", {
2970
2970
  children: c.map((a, e) => {
2971
- const h = (a.regionMin + a.regionMax) / 2, d = new M(0, h, 0), f = d.clone().addScaledVector(a.axis, l), u = d.clone().addScaledVector(a.axis, -l), g = e / Math.max(1, c.length - 1), k = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2971
+ const h = (a.regionMin + a.regionMax) / 2, d = new k(0, h, 0), f = d.clone().addScaledVector(a.axis, l), u = d.clone().addScaledVector(a.axis, -l), g = e / Math.max(1, c.length - 1), M = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2972
2972
  return v("group", {
2973
2973
  children: [
2974
2974
  i(we, {
@@ -2976,17 +2976,17 @@ let __tla = (async () => {
2976
2976
  u,
2977
2977
  f
2978
2978
  ],
2979
- color: k,
2979
+ color: M,
2980
2980
  lineWidth: 1.5,
2981
2981
  transparent: true,
2982
2982
  opacity: 0.7
2983
2983
  }),
2984
2984
  i(we, {
2985
2985
  points: [
2986
- new M(-l * 0.3, a.regionMin, 0),
2987
- new M(l * 0.3, a.regionMin, 0)
2986
+ new k(-l * 0.3, a.regionMin, 0),
2987
+ new k(l * 0.3, a.regionMin, 0)
2988
2988
  ],
2989
- color: k,
2989
+ color: M,
2990
2990
  lineWidth: 0.5,
2991
2991
  transparent: true,
2992
2992
  opacity: 0.3
@@ -3000,7 +3000,7 @@ let __tla = (async () => {
3000
3000
  const s = Y(() => {
3001
3001
  const f = Bn(t, r, n);
3002
3002
  if (!f) return null;
3003
- const u = f.dot(new M(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
3003
+ const u = f.dot(new k(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
3004
3004
  return {
3005
3005
  axis: f,
3006
3006
  angleDeg: g
@@ -3011,7 +3011,7 @@ let __tla = (async () => {
3011
3011
  n
3012
3012
  ]);
3013
3013
  if (!s) return null;
3014
- const l = (r + n) / 2, c = new M(0, l, 0), a = o * 0.4, e = c.clone().addScaledVector(s.axis, a), h = c.clone().addScaledVector(s.axis, -a), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
3014
+ const l = (r + n) / 2, c = new k(0, l, 0), a = o * 0.4, e = c.clone().addScaledVector(s.axis, a), h = c.clone().addScaledVector(s.axis, -a), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
3015
3015
  return i("group", {
3016
3016
  children: i(we, {
3017
3017
  points: [
@@ -3042,9 +3042,9 @@ let __tla = (async () => {
3042
3042
  }
3043
3043
  function yr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
3044
3044
  const l = Y(() => {
3045
- const d = s ?? t, f = jt(d), u = new M(0, 1, 0), g = 5, p = n + 3 * 25.4, b = [];
3045
+ const d = s ?? t, f = jt(d), u = new k(0, 1, 0), g = 5, p = n + 3 * 25.4, b = [];
3046
3046
  for (let L = r + g; L < p; L += g) {
3047
- const T = Io(f, d, new M(0, L, 0), u);
3047
+ const T = Io(f, d, new k(0, L, 0), u);
3048
3048
  T > 0 && b.push({
3049
3049
  y: L,
3050
3050
  circ: T
@@ -3069,13 +3069,13 @@ let __tla = (async () => {
3069
3069
  return v("group", {
3070
3070
  children: [
3071
3071
  c.map(({ y: d, circ: f }, u) => {
3072
- const g = f / a, k = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", p = f * h;
3072
+ const g = f / a, M = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", p = f * h;
3073
3073
  return i(we, {
3074
3074
  points: [
3075
- new M(-p, d, 0),
3076
- new M(p, d, 0)
3075
+ new k(-p, d, 0),
3076
+ new k(p, d, 0)
3077
3077
  ],
3078
- color: k,
3078
+ color: M,
3079
3079
  lineWidth: 1.5,
3080
3080
  transparent: true,
3081
3081
  opacity: 0.6
@@ -3087,8 +3087,8 @@ let __tla = (async () => {
3087
3087
  children: [
3088
3088
  i(we, {
3089
3089
  points: [
3090
- new M(-d, f, 0),
3091
- new M(-d, u, 0)
3090
+ new k(-d, f, 0),
3091
+ new k(-d, u, 0)
3092
3092
  ],
3093
3093
  color: "#ff4444",
3094
3094
  lineWidth: 1,
@@ -3100,8 +3100,8 @@ let __tla = (async () => {
3100
3100
  }),
3101
3101
  i(we, {
3102
3102
  points: [
3103
- new M(d, f, 0),
3104
- new M(d, u, 0)
3103
+ new k(d, f, 0),
3104
+ new k(d, u, 0)
3105
3105
  ],
3106
3106
  color: "#ff4444",
3107
3107
  lineWidth: 1,
@@ -3122,7 +3122,7 @@ let __tla = (async () => {
3122
3122
  children: t.geometries.map((r, n) => {
3123
3123
  const o = t.colors[n] ?? "#888888", s = n === t.innerIdx;
3124
3124
  r.computeBoundingBox();
3125
- const l = new M();
3125
+ const l = new k();
3126
3126
  return r.boundingBox.getCenter(l), v("group", {
3127
3127
  children: [
3128
3128
  i("mesh", {
@@ -3187,8 +3187,8 @@ let __tla = (async () => {
3187
3187
  for (let e = 0; e < l && e * 3 + 2 < c; e++) {
3188
3188
  const h = r[e], d = h, f = h < 0.5 ? 0.8 - h * 1.2 : 0.2 * (1 - h), u = 1 - h;
3189
3189
  for (let g = 0; g < 3; g++) {
3190
- const k = (e * 3 + g) * 3;
3191
- a[k] = d, a[k + 1] = f, a[k + 2] = u;
3190
+ const M = (e * 3 + g) * 3;
3191
+ a[M] = d, a[M + 1] = f, a[M + 2] = u;
3192
3192
  }
3193
3193
  }
3194
3194
  return o.setAttribute("color", new j.Float32BufferAttribute(a, 3)), o;
@@ -3214,8 +3214,8 @@ let __tla = (async () => {
3214
3214
  const a = t.geometry, e = Y(() => a.getAttribute("position") ? En(a) : null, [
3215
3215
  a
3216
3216
  ]), h = Y(() => !n || n.length < 2 ? null : {
3217
- red: new M(n[1].position.x, n[1].position.y, n[1].position.z),
3218
- green: new M(n[0].position.x, n[0].position.y, n[0].position.z)
3217
+ red: new k(n[1].position.x, n[1].position.y, n[1].position.z),
3218
+ green: new k(n[0].position.x, n[0].position.y, n[0].position.z)
3219
3219
  }, [
3220
3220
  n
3221
3221
  ]);
@@ -3454,8 +3454,8 @@ let __tla = (async () => {
3454
3454
  ]
3455
3455
  });
3456
3456
  }
3457
- const kr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: c, wasmModule: a }) => {
3458
- const [e, h] = I(null), [d, f] = I(0), [u, g] = I(false), [k, p] = I(false), [b, m] = I(""), [P, y] = I("3D"), [F, A] = I(r === "AK" ? 2 : 1), [S, C] = I(false), [L, T] = I(null), [E, w] = I(r ?? null), [z, D] = I("mm"), [B, $] = I(false), [ee, se] = I(""), [ce, U] = I(false), [oe, J] = I(false), [Z, ge] = I(false), [de, he] = I(false), [ve, te] = I(null), [O, X] = I(null), [Q, ue] = I(null), [fe, re] = I(false), [G, V] = I([]), [Me, Ae] = I(null), [Ye, me] = I(null), [ze, At] = I(null), [rt, Xt] = I(null), [On, Yt] = I(false), [it, Zt] = I(null), [kt, Fe] = I(null), [_e, Hn] = I(false), [Kt, Nn] = I(fr), [$e, qt] = I("obj"), [Se, Mt] = I(o), [Ue, Ft] = I(true), [Oe, Je] = I(false), [Pt, Ut] = I(false), [Be, st] = I(false), Ze = ae(false), [Vn, lt] = I(false), [Lt, Jt] = I(() => {
3457
+ const Mr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: c, wasmModule: a }) => {
3458
+ const [e, h] = I(null), [d, f] = I(0), [u, g] = I(false), [M, p] = I(false), [b, m] = I(""), [P, y] = I("3D"), [F, A] = I(r === "AK" ? 2 : 1), [S, C] = I(false), [L, T] = I(null), [E, w] = I(r ?? null), [z, D] = I("mm"), [B, $] = I(false), [ee, se] = I(""), [ce, U] = I(false), [oe, J] = I(false), [Z, ge] = I(false), [de, he] = I(false), [ve, te] = I(null), [O, X] = I(null), [Q, ue] = I(null), [fe, re] = I(false), [G, V] = I([]), [ke, Ae] = I(null), [Ye, me] = I(null), [ze, At] = I(null), [rt, Xt] = I(null), [On, Yt] = I(false), [it, Zt] = I(null), [Mt, Fe] = I(null), [_e, Hn] = I(false), [Kt, Nn] = I(fr), [$e, qt] = I("obj"), [Se, kt] = I(o), [Ue, Ft] = I(true), [Oe, Je] = I(false), [Pt, Ut] = I(false), [Be, st] = I(false), Ze = ae(false), [Vn, lt] = I(false), [Lt, Jt] = I(() => {
3459
3459
  try {
3460
3460
  return localStorage.getItem("gm_helpTipDismissed") !== "1";
3461
3461
  } catch {
@@ -3591,11 +3591,11 @@ let __tla = (async () => {
3591
3591
  Q
3592
3592
  ]);
3593
3593
  q(() => {
3594
- o && Mt(o);
3594
+ o && kt(o);
3595
3595
  }, [
3596
3596
  o
3597
3597
  ]), q(() => {
3598
- o || Mt(void 0);
3598
+ o || kt(void 0);
3599
3599
  }, [
3600
3600
  F
3601
3601
  ]);
@@ -3629,9 +3629,9 @@ let __tla = (async () => {
3629
3629
  ]);
3630
3630
  const et = ie((x, _) => {
3631
3631
  x.computeBoundingBox();
3632
- const W = x.boundingBox, R = new M();
3632
+ const W = x.boundingBox, R = new k();
3633
3633
  W.getCenter(R), x.translate(-R.x, -R.y, -R.z), x.computeBoundingBox();
3634
- const xe = x.boundingBox, N = new M();
3634
+ const xe = x.boundingBox, N = new k();
3635
3635
  xe.getSize(N), f(Math.max(N.x, N.y, N.z));
3636
3636
  const K = new j.Mesh(x, new j.MeshStandardMaterial({
3637
3637
  color: 8947848,
@@ -3856,7 +3856,7 @@ let __tla = (async () => {
3856
3856
  H,
3857
3857
  Z
3858
3858
  ]), so = ie((x) => {
3859
- Gn(x), Mt(x.circumferences), Ft(true), Ut(true), Je(false);
3859
+ Gn(x), kt(x.circumferences), Ft(true), Ut(true), Je(false);
3860
3860
  }, []), ln = ie(async (x) => {
3861
3861
  if (!s || Ze.current) return;
3862
3862
  Ze.current = true, Je(false), lt(false), st(true), await new Promise((W) => requestAnimationFrame(() => requestAnimationFrame(() => W())));
@@ -3926,7 +3926,7 @@ let __tla = (async () => {
3926
3926
  if (pe.linePoints.length >= 2) {
3927
3927
  let Pe = pe.linePoints[0], Re = pe.linePoints[0], Le = pe.linePoints[0], We = pe.linePoints[0];
3928
3928
  for (const le of pe.linePoints) le.x < Pe.x && (Pe = le), le.x > Re.x && (Re = le), le.z < Le.z && (Le = le), le.z > We.z && (We = le);
3929
- W = new M(Pe.x, K, Pe.z).distanceTo(new M(Re.x, K, Re.z)), R = new M(Le.x, K, Le.z).distanceTo(new M(We.x, K, We.z));
3929
+ W = new k(Pe.x, K, Pe.z).distanceTo(new k(Re.x, K, Re.z)), R = new k(Le.x, K, Le.z).distanceTo(new k(We.x, K, We.z));
3930
3930
  }
3931
3931
  } catch {
3932
3932
  }
@@ -3983,7 +3983,7 @@ let __tla = (async () => {
3983
3983
  Se,
3984
3984
  G
3985
3985
  ]), ao = He === 0 ? 320 : He < 520 ? Math.max(200, Math.round(He * 0.42)) : He < 900 ? 280 : He < 1400 ? 340 : 400, an = He < 520 ? 16 : He < 900 ? 20 : 24;
3986
- return v(ko.Provider, {
3986
+ return v(Mo.Provider, {
3987
3987
  value: t,
3988
3988
  children: [
3989
3989
  v("div", {
@@ -4033,7 +4033,7 @@ let __tla = (async () => {
4033
4033
  },
4034
4034
  children: [
4035
4035
  e && !ne && (() => {
4036
- const x = H.length === 0 ? 1 : H.length === 1 ? 2 : 3, _ = E === "AK" ? "Perineum" : "MPT", W = x === 1 ? `Place Point at ${_}` : x === 2 ? "Place Point at Origin" : "Ready to Continue", R = x === 1 ? `Click on the model to mark the ${_}.` : x === 2 ? "Click on the model to mark the Origin." : "Both points are placed. Click Continue to process the scan.", xe = x === 1 ? "#2fbf4a" : x === 2 ? "#e53935" : "#2fbf4a", N = H.length >= 2;
4036
+ const x = H.length === 0 ? 1 : H.length === 1 ? 2 : 3, _ = E === "AK" ? "Perineum" : "MPT", W = x === 1 ? `Place Point at ${_}` : x === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", R = x === 1 ? `Click on the model to mark the ${_}.` : x === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", xe = x === 1 ? "#2fbf4a" : x === 2 ? "#e53935" : "#2fbf4a", N = H.length >= 2;
4037
4037
  return v("div", {
4038
4038
  style: {
4039
4039
  width: ao,
@@ -4321,7 +4321,7 @@ let __tla = (async () => {
4321
4321
  onDragLeave: t.showDragDrop ? to : void 0,
4322
4322
  onDrop: t.showDragDrop ? no : void 0,
4323
4323
  children: [
4324
- t.showDragDrop && !e && !k && i("div", {
4324
+ t.showDragDrop && !e && !M && i("div", {
4325
4325
  style: {
4326
4326
  position: "absolute",
4327
4327
  inset: 16,
@@ -4370,7 +4370,7 @@ let __tla = (async () => {
4370
4370
  ]
4371
4371
  })
4372
4372
  }),
4373
- !t.showDragDrop && !e && !k && !kt && i("div", {
4373
+ !t.showDragDrop && !e && !M && !Mt && i("div", {
4374
4374
  style: {
4375
4375
  position: "absolute",
4376
4376
  inset: 0,
@@ -4408,14 +4408,14 @@ let __tla = (async () => {
4408
4408
  ]
4409
4409
  })
4410
4410
  }),
4411
- k && i(wn, {
4411
+ M && i(wn, {
4412
4412
  message: b || "Processing mesh..."
4413
4413
  }),
4414
4414
  B && i(wn, {
4415
4415
  message: ee
4416
4416
  }),
4417
- kt && i($o, {
4418
- message: kt,
4417
+ Mt && i($o, {
4418
+ message: Mt,
4419
4419
  onDismiss: () => Fe(null)
4420
4420
  }),
4421
4421
  t.showAmputationModal && S && i("div", {
@@ -4641,7 +4641,7 @@ let __tla = (async () => {
4641
4641
  modelSize: d,
4642
4642
  labels: [
4643
4643
  E === "AK" ? "Perineum" : "MPT",
4644
- "Origin",
4644
+ "Distal Most Point",
4645
4645
  "Cut Plane"
4646
4646
  ]
4647
4647
  }),
@@ -4658,7 +4658,7 @@ let __tla = (async () => {
4658
4658
  fitYMax: ne && H.length >= 2 ? it ?? H[0].position.y : void 0,
4659
4659
  resetCameraToFrontRef: Rt
4660
4660
  }),
4661
- !ne && i(Mn, {
4661
+ !ne && i(kn, {
4662
4662
  enableDamping: false
4663
4663
  }),
4664
4664
  ne && G.length > 0 && e && P === "3D" && i(Qo, {
@@ -4690,7 +4690,7 @@ let __tla = (async () => {
4690
4690
  useInnerSurface: Z && !de,
4691
4691
  formMeasurements: Oe ? Xn ?? Se : Ue ? Se : void 0,
4692
4692
  originY: it ?? R.position.y,
4693
- wasmSlices: Me
4693
+ wasmSlices: ke
4694
4694
  }),
4695
4695
  i(Uo, {
4696
4696
  mesh: e,
@@ -4734,7 +4734,7 @@ let __tla = (async () => {
4734
4734
  aoGeometry: O,
4735
4735
  measurementGeometry: Q
4736
4736
  }),
4737
- i(Mr, {
4737
+ i(kr, {
4738
4738
  screenshotFnRef: Jn,
4739
4739
  mesh: e,
4740
4740
  modelSize: d,
@@ -5266,7 +5266,7 @@ let __tla = (async () => {
5266
5266
  ]
5267
5267
  });
5268
5268
  };
5269
- function Mr({ screenshotFnRef: t }) {
5269
+ function kr({ screenshotFnRef: t }) {
5270
5270
  return q(() => {
5271
5271
  t.current = null;
5272
5272
  }, [
@@ -5406,7 +5406,7 @@ let __tla = (async () => {
5406
5406
  });
5407
5407
  u = yt(y, t.spacing_type);
5408
5408
  }
5409
- const g = e.userEnteredMeasurements ? yt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, k = e.decision === "use_scan" || e.decision === "continue", p = k ? d : g ?? f ?? d, b = k ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1);
5409
+ const g = e.userEnteredMeasurements ? yt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, M = e.decision === "use_scan" || e.decision === "continue", p = M ? d : g ?? f ?? d, b = M ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1);
5410
5410
  let m;
5411
5411
  if (t.upload_url) if (!e.alignedGeometry) m = {
5412
5412
  success: false,
@@ -5465,7 +5465,7 @@ let __tla = (async () => {
5465
5465
  height: "100%",
5466
5466
  display: "flex"
5467
5467
  },
5468
- children: i(kr, {
5468
+ children: i(Mr, {
5469
5469
  config: Ao,
5470
5470
  spacingType: t.spacing_type,
5471
5471
  scanUrl: t.scan_url,