@solid-labs/fab-one-widget 1.1.10 → 1.1.11

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,19 +1,19 @@
1
1
  import { jsxs as y, jsx as i, Fragment as We } from "react/jsx-runtime";
2
- import { createContext as Do, Component as Wo, useCallback as ce, useMemo as Q, useState as B, memo as _o, useEffect as Y, useRef as de, forwardRef as Ro, createElement as Mn } from "react";
3
- import { useFrame as En, useThree as Bn, Canvas as Io } from "@react-three/fiber";
4
- import { Html as Xe, Line as ye, OrbitControls as $n } from "@react-three/drei";
5
- import * as U from "three";
6
- import { Plane as St, Vector3 as M, Box3 as Tn, Line3 as On, Raycaster as Eo } from "three";
7
- import { create as Bo } from "zustand";
2
+ import { createContext as Wo, Component as Ro, useCallback as de, useMemo as te, useState as E, memo as _o, useEffect as Z, useRef as ue, forwardRef as Io, createElement as Mn } from "react";
3
+ import { useFrame as Bn, useThree as En, Canvas as Bo } from "@react-three/fiber";
4
+ import { Html as Xe, Line as ve, OrbitControls as $n } from "@react-three/drei";
5
+ import * as q from "three";
6
+ import { Plane as Ct, Vector3 as P, Box3 as Tn, Line3 as On, Raycaster as Eo } from "three";
7
+ import { create as $o } from "zustand";
8
8
  import { OBJLoader as Hn } from "three/examples/jsm/loaders/OBJLoader.js";
9
9
  import { STLLoader as Nn } from "three/examples/jsm/loaders/STLLoader.js";
10
- import { unzipSync as $o } from "three/examples/jsm/libs/fflate.module.js";
11
- import { PLYLoader as To } from "three/examples/jsm/loaders/PLYLoader.js";
12
- import { MeshBVH as Ct } from "three-mesh-bvh";
13
- let ai, yt, Yr, Jn, qt;
10
+ import { unzipSync as To } from "three/examples/jsm/libs/fflate.module.js";
11
+ import { PLYLoader as Oo } from "three/examples/jsm/loaders/PLYLoader.js";
12
+ import { MeshBVH as At } from "three-mesh-bvh";
13
+ let ci, wt, Kr, Jn, Jt;
14
14
  let __tla = (async () => {
15
- let Oo, Ho, No, Vo, At, Yt, wt, jo;
16
- Oo = {
15
+ let Ho, No, Vo, jo, zt, Kt, vt, Xo;
16
+ Ho = {
17
17
  showDragDrop: true,
18
18
  showStartOver: true,
19
19
  showDebug: true,
@@ -23,7 +23,7 @@ let __tla = (async () => {
23
23
  showToolbar: false,
24
24
  showSaveButton: true
25
25
  };
26
- Ho = {
26
+ No = {
27
27
  showDragDrop: false,
28
28
  showStartOver: false,
29
29
  showDebug: false,
@@ -33,8 +33,8 @@ let __tla = (async () => {
33
33
  showToolbar: false,
34
34
  showSaveButton: false
35
35
  };
36
- No = Do(Oo);
37
- qt = Bo((e, o) => ({
36
+ Vo = Wo(Ho);
37
+ Jt = $o((e, o) => ({
38
38
  landmarkPoints: [],
39
39
  isAligned: false,
40
40
  isCut: false,
@@ -74,17 +74,17 @@ let __tla = (async () => {
74
74
  isCut: false
75
75
  })
76
76
  }));
77
- Vo = 0.45;
78
- At = 3;
79
- Yt = 1e-3;
80
- wt = 25.4;
81
- jo = [
77
+ jo = 0.45;
78
+ zt = 3;
79
+ Kt = 1e-3;
80
+ vt = 25.4;
81
+ Xo = [
82
82
  0.25,
83
83
  -0.25,
84
84
  0.5,
85
85
  -0.5
86
86
  ];
87
- function Xo(e) {
87
+ function Go(e) {
88
88
  var _a;
89
89
  const o = e.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
90
90
  if (!o || !((_a = o[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
@@ -95,8 +95,8 @@ let __tla = (async () => {
95
95
  const a = d.trim().split(/\s+/);
96
96
  if (a.length >= 7) {
97
97
  n.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3]));
98
- let r = parseFloat(a[4]), c = parseFloat(a[5]), p = parseFloat(a[6]);
99
- (r > 1 || c > 1 || p > 1) && (r /= 255, c /= 255, p /= 255), s.push(r, c, p), l = true;
98
+ let r = parseFloat(a[4]), c = parseFloat(a[5]), u = parseFloat(a[6]);
99
+ (r > 1 || c > 1 || u > 1) && (r /= 255, c /= 255, u /= 255), s.push(r, c, u), l = true;
100
100
  } else a.length >= 4 && (n.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), s.push(0, 0, 0));
101
101
  }
102
102
  return l ? {
@@ -104,38 +104,38 @@ let __tla = (async () => {
104
104
  colors: new Float32Array(s)
105
105
  } : null;
106
106
  }
107
- function Go(e, o, t, n) {
107
+ function Yo(e, o, t, n) {
108
108
  const s = e.getAttribute("position"), l = s.count, d = new Float32Array(l * 3), a = o.length / 3;
109
- let r = 1 / 0, c = 1 / 0, p = 1 / 0, u = -1 / 0, f = -1 / 0, g = -1 / 0;
109
+ let r = 1 / 0, c = 1 / 0, u = 1 / 0, p = -1 / 0, f = -1 / 0, m = -1 / 0;
110
110
  for (let I = 0; I < a; I++) {
111
- const L = o[I * 3] * n, $ = o[I * 3 + 1] * n, j = o[I * 3 + 2] * n;
112
- L < r && (r = L), L > u && (u = L), $ < c && (c = $), $ > f && (f = $), j < p && (p = j), j > g && (g = j);
111
+ const W = o[I * 3] * n, $ = o[I * 3 + 1] * n, G = o[I * 3 + 2] * n;
112
+ W < r && (r = W), W > p && (p = W), $ < c && (c = $), $ > f && (f = $), G < u && (u = G), G > m && (m = G);
113
113
  }
114
- const v = (r + u) * 0.5, h = (c + f) * 0.5, x = (p + g) * 0.5, w = u - r + 1e-6, C = f - c + 1e-6, b = g - p + 1e-6, k = w * 0.5, S = C * 0.5, A = b * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), _ = w / z, E = C / z, H = b / z, P = /* @__PURE__ */ new Map();
114
+ const v = (r + p) * 0.5, h = (c + f) * 0.5, x = (u + m) * 0.5, w = p - r + 1e-6, C = f - c + 1e-6, b = m - u + 1e-6, F = w * 0.5, S = C * 0.5, A = b * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), R = w / z, B = C / z, N = b / z, k = /* @__PURE__ */ new Map();
115
115
  for (let I = 0; I < a; I++) {
116
- const L = o[I * 3] * n - v, $ = o[I * 3 + 1] * n - h, j = o[I * 3 + 2] * n - x, te = Math.min(z - 1, Math.max(0, Math.floor((L + k) / _))), se = Math.min(z - 1, Math.max(0, Math.floor(($ + S) / E))), oe = Math.min(z - 1, Math.max(0, Math.floor((j + A) / H))), q = te * z * z + se * z + oe;
117
- let ie = P.get(q);
118
- ie || (ie = [], P.set(q, ie)), ie.push(I);
116
+ const W = o[I * 3] * n - v, $ = o[I * 3 + 1] * n - h, G = o[I * 3 + 2] * n - x, oe = Math.min(z - 1, Math.max(0, Math.floor((W + F) / R))), ce = Math.min(z - 1, Math.max(0, Math.floor(($ + S) / B))), se = Math.min(z - 1, Math.max(0, Math.floor((G + A) / N))), J = oe * z * z + ce * z + se;
117
+ let ae = k.get(J);
118
+ ae || (ae = [], k.set(J, ae)), ae.push(I);
119
119
  }
120
120
  for (let I = 0; I < l; I++) {
121
- const L = s.getX(I), $ = s.getY(I), j = s.getZ(I), te = Math.min(z - 1, Math.max(0, Math.floor((L + k) / _))), se = Math.min(z - 1, Math.max(0, Math.floor(($ + S) / E))), oe = Math.min(z - 1, Math.max(0, Math.floor((j + A) / H)));
122
- let q = 1 / 0, ie = 0;
123
- for (let Z = 0; Z <= z && q > 0; Z++) {
124
- for (let pe = -Z; pe <= Z; pe++) for (let ne = -Z; ne <= Z; ne++) for (let R = -Z; R <= Z; R++) {
125
- if (Z > 0 && Math.abs(pe) < Z && Math.abs(ne) < Z && Math.abs(R) < Z) continue;
126
- const O = te + pe, ee = se + ne, J = oe + R;
127
- if (O < 0 || O >= z || ee < 0 || ee >= z || J < 0 || J >= z) continue;
128
- const N = P.get(O * z * z + ee * z + J);
129
- if (N) for (const K of N) {
130
- const fe = o[K * 3] * n - v, le = o[K * 3 + 1] * n - h, he = o[K * 3 + 2] * n - x, ue = (L - fe) ** 2 + ($ - le) ** 2 + (j - he) ** 2;
131
- ue < q && (q = ue, ie = K);
121
+ const W = s.getX(I), $ = s.getY(I), G = s.getZ(I), oe = Math.min(z - 1, Math.max(0, Math.floor((W + F) / R))), ce = Math.min(z - 1, Math.max(0, Math.floor(($ + S) / B))), se = Math.min(z - 1, Math.max(0, Math.floor((G + A) / N)));
122
+ let J = 1 / 0, ae = 0;
123
+ for (let U = 0; U <= z && J > 0; U++) {
124
+ for (let ge = -U; ge <= U; ge++) for (let re = -U; re <= U; re++) for (let _ = -U; _ <= U; _++) {
125
+ if (U > 0 && Math.abs(ge) < U && Math.abs(re) < U && Math.abs(_) < U) continue;
126
+ const H = oe + ge, ne = ce + re, Q = se + _;
127
+ if (H < 0 || H >= z || ne < 0 || ne >= z || Q < 0 || Q >= z) continue;
128
+ const j = k.get(H * z * z + ne * z + Q);
129
+ if (j) for (const K of j) {
130
+ const fe = o[K * 3] * n - v, ie = o[K * 3 + 1] * n - h, pe = o[K * 3 + 2] * n - x, he = (W - fe) ** 2 + ($ - ie) ** 2 + (G - pe) ** 2;
131
+ he < J && (J = he, ae = K);
132
132
  }
133
133
  }
134
- if (q < 1 / 0) break;
134
+ if (J < 1 / 0) break;
135
135
  }
136
- d[I * 3] = t[ie * 3], d[I * 3 + 1] = t[ie * 3 + 1], d[I * 3 + 2] = t[ie * 3 + 2];
136
+ d[I * 3] = t[ae * 3], d[I * 3 + 1] = t[ae * 3 + 1], d[I * 3 + 2] = t[ae * 3 + 2];
137
137
  }
138
- e.setAttribute("color", new U.Float32BufferAttribute(d, 3));
138
+ e.setAttribute("color", new q.Float32BufferAttribute(d, 3));
139
139
  }
140
140
  const Pn = {
141
141
  debug: 0,
@@ -144,7 +144,7 @@ let __tla = (async () => {
144
144
  error: 3
145
145
  };
146
146
  let Vn = "warn", jn = null;
147
- const ge = {
147
+ const xe = {
148
148
  setLevel(e) {
149
149
  Vn = e;
150
150
  },
@@ -152,19 +152,19 @@ let __tla = (async () => {
152
152
  jn = e;
153
153
  },
154
154
  debug(e, o, t) {
155
- xt("debug", e, o, t);
155
+ bt("debug", e, o, t);
156
156
  },
157
157
  info(e, o, t) {
158
- xt("info", e, o, t);
158
+ bt("info", e, o, t);
159
159
  },
160
160
  warn(e, o, t) {
161
- xt("warn", e, o, t);
161
+ bt("warn", e, o, t);
162
162
  },
163
163
  error(e, o, t) {
164
- xt("error", e, o, t);
164
+ bt("error", e, o, t);
165
165
  }
166
166
  };
167
- function xt(e, o, t, n) {
167
+ function bt(e, o, t, n) {
168
168
  if (Pn[e] < Pn[Vn]) return;
169
169
  const s = `[${o}]`, l = n !== void 0 ? [
170
170
  s,
@@ -190,7 +190,7 @@ let __tla = (async () => {
190
190
  }
191
191
  jn == null ? void 0 : jn(e, o, t, n);
192
192
  }
193
- function vt(e) {
193
+ function St(e) {
194
194
  const o = e.getAttribute("position"), t = new Float32Array(o.array), n = e.getIndex();
195
195
  if (n) return {
196
196
  positions: t,
@@ -204,50 +204,50 @@ let __tla = (async () => {
204
204
  };
205
205
  }
206
206
  function Xn(e, o) {
207
- const t = new U.BufferGeometry();
208
- return t.setAttribute("position", new U.Float32BufferAttribute(e, 3)), t.setIndex(new U.BufferAttribute(o, 1)), t.computeVertexNormals(), t;
207
+ const t = new q.BufferGeometry();
208
+ return t.setAttribute("position", new q.Float32BufferAttribute(e, 3)), t.setIndex(new q.BufferAttribute(o, 1)), t.computeVertexNormals(), t;
209
209
  }
210
- async function Yo(e, o, t) {
210
+ async function Ko(e, o, t) {
211
211
  try {
212
- const n = Xo(e);
212
+ const n = Go(e);
213
213
  t == null ? void 0 : t("Parsing mesh...");
214
214
  const l = new Hn().parse(e);
215
215
  let d = null;
216
216
  if (l.traverse((w) => {
217
217
  w.isMesh && !d && (d = w.geometry);
218
218
  }), !d) return null;
219
- const { positions: a, indices: r } = vt(d);
220
- if (a.length < 9 || r.length < 3) return ge.warn("wasm", `Mesh too small: positions=${a.length} indices=${r.length}`), null;
221
- for (let w = 0; w < Math.min(a.length, 300); w++) if (!isFinite(a[w])) return ge.error("wasm", `Invalid position data: NaN/Infinity at index ${w}`), null;
219
+ const { positions: a, indices: r } = St(d);
220
+ if (a.length < 9 || r.length < 3) return xe.warn("wasm", `Mesh too small: positions=${a.length} indices=${r.length}`), null;
221
+ for (let w = 0; w < Math.min(a.length, 300); w++) if (!isFinite(a[w])) return xe.error("wasm", `Invalid position data: NaN/Infinity at index ${w}`), null;
222
222
  const c = a.length / 3;
223
- for (let w = 0; w < Math.min(r.length, 300); w++) if (r[w] >= c) return ge.error("wasm", `Out-of-bounds index: ${r[w]} >= ${c}`), null;
223
+ for (let w = 0; w < Math.min(r.length, 300); w++) if (r[w] >= c) return xe.error("wasm", `Out-of-bounds index: ${r[w]} >= ${c}`), null;
224
224
  t == null ? void 0 : t("Processing mesh (WASM)...");
225
- const p = o.preprocess_mesh(a, r, 10, 100, 1e-4, 500), u = p.positions(), f = p.indices(), g = p.unit_converted(), v = p.detected_unit(), h = p.log();
226
- if (ge.debug("wasm", "preprocess result", h), u.length === 0) return null;
225
+ const u = o.preprocess_mesh(a, r, 10, 100, 1e-4, 500), p = u.positions(), f = u.indices(), m = u.unit_converted(), v = u.detected_unit(), h = u.log();
226
+ if (xe.debug("wasm", "preprocess result", h), p.length === 0) return null;
227
227
  t == null ? void 0 : t("Building geometry...");
228
- const x = Xn(u, f);
228
+ const x = Xn(p, f);
229
229
  if (n) {
230
230
  const w = v === "meter" ? 1e3 : v === "cm" ? 10 : 1;
231
- Go(x, n.positions, n.colors, w);
231
+ Yo(x, n.positions, n.colors, w);
232
232
  }
233
233
  return {
234
234
  geometry: x,
235
- wasScaled: g,
236
- unitConverted: g,
235
+ wasScaled: m,
236
+ unitConverted: m,
237
237
  detectedUnit: v
238
238
  };
239
239
  } catch (n) {
240
- return ge.error("wasm", "Processing failed", n), null;
240
+ return xe.error("wasm", "Processing failed", n), null;
241
241
  }
242
242
  }
243
- function Ko(e) {
243
+ function Zo(e) {
244
244
  const t = new Hn().parse(e);
245
245
  let n = null;
246
246
  return t.traverse((s) => {
247
247
  s.isMesh && !n && (n = s.geometry);
248
248
  }), n;
249
249
  }
250
- function Kt(e) {
250
+ function Zt(e) {
251
251
  const o = e.getAttribute("position");
252
252
  if (!o || o.count === 0) throw new Error("Empty geometry");
253
253
  const t = [];
@@ -258,24 +258,24 @@ let __tla = (async () => {
258
258
  return t.join(`
259
259
  `);
260
260
  }
261
- async function Fn(e) {
261
+ async function kn(e) {
262
262
  const o = await e.arrayBuffer(), n = new Nn().parse(o);
263
- return Kt(n);
263
+ return Zt(n);
264
264
  }
265
- const Zt = "aop";
266
- async function Zo(e) {
265
+ const Ut = "aop";
266
+ async function Uo(e) {
267
267
  const o = await e.arrayBuffer(), t = new Uint8Array(o);
268
- return t.length > 3 && t[0] === 80 && t[1] === 75 && (t[2] === 3 || t[2] === 5 || t[2] === 7) ? Uo(t) : (ge.warn(Zt, "AOP payload is not a ZIP container \u2014 sniffing as a bare mesh"), Gn(t, e.name));
268
+ return t.length > 3 && t[0] === 80 && t[1] === 75 && (t[2] === 3 || t[2] === 5 || t[2] === 7) ? qo(t) : (xe.warn(Ut, "AOP payload is not a ZIP container \u2014 sniffing as a bare mesh"), Gn(t, e.name));
269
269
  }
270
- function Uo(e) {
270
+ function qo(e) {
271
271
  let o;
272
272
  try {
273
- o = $o(e);
273
+ o = To(e);
274
274
  } catch (s) {
275
275
  throw new Error(`Could not read the .aop archive: ${s instanceof Error ? s.message : "invalid ZIP"}`);
276
276
  }
277
277
  const t = Object.keys(o);
278
- ge.debug(Zt, `AOP archive entries: ${t.join(", ") || "(none)"}`);
278
+ xe.debug(Ut, `AOP archive entries: ${t.join(", ") || "(none)"}`);
279
279
  const n = [
280
280
  ".obj",
281
281
  ".ply",
@@ -283,7 +283,7 @@ let __tla = (async () => {
283
283
  ];
284
284
  for (const s of n) {
285
285
  const l = t.find((d) => d.toLowerCase().endsWith(s) && o[d] && o[d].length > 0);
286
- if (l) return ge.debug(Zt, `Using mesh entry "${l}" from AOP archive`), Gn(o[l], l);
286
+ if (l) return xe.debug(Ut, `Using mesh entry "${l}" from AOP archive`), Gn(o[l], l);
287
287
  }
288
288
  throw new Error(`No mesh found inside the .aop file (looked for .obj/.ply/.stl). Archive contained: ${t.join(", ") || "no files"}`);
289
289
  }
@@ -292,17 +292,17 @@ let __tla = (async () => {
292
292
  if (t.endsWith(".obj") || n.startsWith("v ") || n.startsWith("# ")) return new TextDecoder().decode(e);
293
293
  const s = e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
294
294
  if (t.endsWith(".ply") || n.toLowerCase().startsWith("ply")) {
295
- const d = new To().parse(s);
296
- return Kt(d);
295
+ const d = new Oo().parse(s);
296
+ return Zt(d);
297
297
  }
298
298
  const l = new Nn().parse(s);
299
- return Kt(l);
299
+ return Zt(l);
300
300
  }
301
- function qo(e, o) {
301
+ function Jo(e, o) {
302
302
  const t = 1 / o;
303
303
  return `${Math.round(e.x * t)}_${Math.round(e.y * t)}_${Math.round(e.z * t)}`;
304
304
  }
305
- function Jo(e, o) {
305
+ function Qo(e, o) {
306
306
  if (!e.length) return [];
307
307
  const t = [];
308
308
  for (const n of e) (t.length === 0 || t[t.length - 1].distanceTo(n) > o) && t.push(n.clone());
@@ -315,22 +315,22 @@ let __tla = (async () => {
315
315
  }
316
316
  function Yn(e, o = 1e-3, t = false) {
317
317
  if (!e.length) return [];
318
- const n = /* @__PURE__ */ new Map(), s = (u) => {
319
- const f = qo(u, o);
320
- let g = n.get(f);
321
- return g || (g = u.clone(), n.set(f, g)), g;
322
- }, l = e.map((u) => ({
323
- a: s(u.a),
324
- b: s(u.b)
318
+ const n = /* @__PURE__ */ new Map(), s = (p) => {
319
+ const f = Jo(p, o);
320
+ let m = n.get(f);
321
+ return m || (m = p.clone(), n.set(f, m)), m;
322
+ }, l = e.map((p) => ({
323
+ a: s(p.a),
324
+ b: s(p.b)
325
325
  })), d = [];
326
326
  for (; l.length; ) {
327
- const u = l.pop(), f = [
328
- u.a,
329
- u.b
327
+ const p = l.pop(), f = [
328
+ p.a,
329
+ p.b
330
330
  ];
331
- let g = true;
332
- for (; g; ) {
333
- g = false;
331
+ let m = true;
332
+ for (; m; ) {
333
+ m = false;
334
334
  for (let h = l.length - 1; h >= 0; h--) {
335
335
  const { a: x, b: w } = l[h];
336
336
  if (x.equals(f[f.length - 1])) f.push(w);
@@ -338,40 +338,40 @@ let __tla = (async () => {
338
338
  else if (x.equals(f[0])) f.unshift(w);
339
339
  else if (w.equals(f[0])) f.unshift(x);
340
340
  else continue;
341
- l.splice(h, 1), g = true;
341
+ l.splice(h, 1), m = true;
342
342
  }
343
343
  }
344
- const v = Jo(f, o);
344
+ const v = Qo(f, o);
345
345
  v.length > 1 && d.push(v);
346
346
  }
347
347
  if (!d.length) return [];
348
348
  if (t) {
349
- d.sort((g, v) => Ue(v) - Ue(g));
350
- const u = Ue(d[0]), f = d.filter((g) => Ue(g) >= u * 0.3);
349
+ d.sort((m, v) => Ue(v) - Ue(m));
350
+ const p = Ue(d[0]), f = d.filter((m) => Ue(m) >= p * 0.3);
351
351
  return f[f.length - 1] ?? d[0];
352
352
  }
353
- const a = d.filter((u) => u.length >= 3 && u[0].distanceTo(u[u.length - 1]) < o * 10), r = a.length > 0 ? a : d;
353
+ const a = d.filter((p) => p.length >= 3 && p[0].distanceTo(p[p.length - 1]) < o * 10), r = a.length > 0 ? a : d;
354
354
  if (r.length === 1) return r[0];
355
- let c = r[0], p = 1 / 0;
356
- for (const u of r) {
357
- let f = 0, g = 0;
358
- for (const h of u) f += h.x, g += h.z;
359
- f /= u.length, g /= u.length;
360
- const v = Math.sqrt(f * f + g * g);
361
- v < p && (p = v, c = u);
355
+ let c = r[0], u = 1 / 0;
356
+ for (const p of r) {
357
+ let f = 0, m = 0;
358
+ for (const h of p) f += h.x, m += h.z;
359
+ f /= p.length, m /= p.length;
360
+ const v = Math.sqrt(f * f + m * m);
361
+ v < u && (u = v, c = p);
362
362
  }
363
363
  return c;
364
364
  }
365
- function kn(e, o, t, n = false) {
366
- const s = new St(new M(0, 1, 0), -t), l = [], d = new Tn();
365
+ function Fn(e, o, t, n = false) {
366
+ const s = new Ct(new P(0, 1, 0), -t), l = [], d = new Tn();
367
367
  d.setFromBufferAttribute(o.getAttribute("position"));
368
368
  const a = {
369
369
  linePoints: [],
370
370
  lineLength: 0,
371
- rightmostPoint: new M(0, t, 0)
371
+ rightmostPoint: new P(0, t, 0)
372
372
  };
373
373
  if (!s.intersectsBox(d)) return a;
374
- const r = new On(), c = new M();
374
+ const r = new On(), c = new P();
375
375
  e.shapecast({
376
376
  intersectsBounds: (h) => s.intersectsBox(h),
377
377
  intersectsTriangle: (h) => {
@@ -382,54 +382,54 @@ let __tla = (async () => {
382
382
  });
383
383
  }
384
384
  });
385
- const p = Yn(l, Yt, n);
386
- if (p.length < 2) return a;
387
- const u = Ue(p);
388
- let f = -1 / 0, g = new M(0, t, 0);
389
- for (const h of p) h.x > f && (f = h.x, g = h.clone());
390
- const v = p.length > 2 && p[0].distanceTo(p[p.length - 1]) < Yt * 10;
385
+ const u = Yn(l, Kt, n);
386
+ if (u.length < 2) return a;
387
+ const p = Ue(u);
388
+ let f = -1 / 0, m = new P(0, t, 0);
389
+ for (const h of u) h.x > f && (f = h.x, m = h.clone());
390
+ const v = u.length > 2 && u[0].distanceTo(u[u.length - 1]) < Kt * 10;
391
391
  return {
392
- linePoints: p,
393
- lineLength: u,
394
- rightmostPoint: g,
392
+ linePoints: u,
393
+ lineLength: p,
394
+ rightmostPoint: m,
395
395
  isClosed: v
396
396
  };
397
397
  }
398
398
  function je(e, o, t, n = false) {
399
- const s = kn(e, o, t, n);
399
+ const s = Fn(e, o, t, n);
400
400
  if (s.isClosed && s.linePoints.length >= 3) return s;
401
- ge.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
401
+ xe.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
402
402
  let l = s;
403
- for (const d of jo) {
404
- const a = kn(e, o, t + d, n);
405
- if (a.isClosed && a.linePoints.length >= 3) return ge.debug("slice", `y=${t.toFixed(2)} recovered with offset ${d > 0 ? "+" : ""}${d}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
403
+ for (const d of Xo) {
404
+ const a = Fn(e, o, t + d, n);
405
+ if (a.isClosed && a.linePoints.length >= 3) return xe.debug("slice", `y=${t.toFixed(2)} recovered with offset ${d > 0 ? "+" : ""}${d}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
406
406
  a.linePoints.length > l.linePoints.length && (l = a);
407
407
  }
408
- return ge.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${l.linePoints.length}, closed=${l.isClosed})`), l;
408
+ return xe.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${l.linePoints.length}, closed=${l.isClosed})`), l;
409
409
  }
410
- function Qo(e, o, t, n) {
411
- const s = new St().setFromNormalAndCoplanarPoint(n.clone().normalize(), t), l = new Tn();
410
+ function er(e, o, t, n) {
411
+ const s = new Ct().setFromNormalAndCoplanarPoint(n.clone().normalize(), t), l = new Tn();
412
412
  if (l.setFromBufferAttribute(o.getAttribute("position")), !s.intersectsBox(l)) return 0;
413
- const d = [], a = new On(), r = new M();
413
+ const d = [], a = new On(), r = new P();
414
414
  e.shapecast({
415
- intersectsBounds: (p) => s.intersectsBox(p),
416
- intersectsTriangle: (p) => {
417
- const u = [];
418
- a.set(p.a, p.b), s.intersectLine(a, r) && u.push(r.clone()), a.set(p.b, p.c), s.intersectLine(a, r) && u.push(r.clone()), a.set(p.c, p.a), s.intersectLine(a, r) && u.push(r.clone()), u.length === 2 && d.push({
419
- a: u[0],
420
- b: u[1]
415
+ intersectsBounds: (u) => s.intersectsBox(u),
416
+ intersectsTriangle: (u) => {
417
+ const p = [];
418
+ a.set(u.a, u.b), s.intersectLine(a, r) && p.push(r.clone()), a.set(u.b, u.c), s.intersectLine(a, r) && p.push(r.clone()), a.set(u.c, u.a), s.intersectLine(a, r) && p.push(r.clone()), p.length === 2 && d.push({
419
+ a: p[0],
420
+ b: p[1]
421
421
  });
422
422
  }
423
423
  });
424
- const c = Yn(d, Yt);
424
+ const c = Yn(d, Kt);
425
425
  return Ue(c);
426
426
  }
427
- function Ut(e) {
428
- return new Ct(e, {
429
- maxLeafTris: At
427
+ function qt(e) {
428
+ return new At(e, {
429
+ maxLeafTris: zt
430
430
  });
431
431
  }
432
- function er(e, o, t, n) {
432
+ function tr(e, o, t, n) {
433
433
  const s = e.getIndex(), l = s ? s.count / 3 : 0;
434
434
  if (l < 10) return {
435
435
  valid: false,
@@ -444,8 +444,8 @@ let __tla = (async () => {
444
444
  valid: false,
445
445
  reason: `Height too large (${d.toFixed(1)}mm > 1000mm)`
446
446
  };
447
- const a = new Ct(e, {
448
- maxLeafTris: At
447
+ const a = new At(e, {
448
+ maxLeafTris: zt
449
449
  }), r = je(a, e, o);
450
450
  if (r.lineLength === 0) return {
451
451
  valid: false,
@@ -456,22 +456,22 @@ let __tla = (async () => {
456
456
  valid: true,
457
457
  reason: ""
458
458
  };
459
- const p = je(a, e, c);
460
- if (r.lineLength > 0 && p.lineLength > 0) {
461
- const f = r.lineLength / p.lineLength;
459
+ const u = je(a, e, c);
460
+ if (r.lineLength > 0 && u.lineLength > 0) {
461
+ const f = r.lineLength / u.lineLength;
462
462
  if (f < 0.5) return {
463
463
  valid: false,
464
464
  reason: `First circumference is too small relative to second (ratio ${f.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
465
465
  };
466
466
  }
467
- const u = o - n * 2;
468
- if (u > t) {
469
- const f = je(a, e, u);
470
- if (p.lineLength > 0 && f.lineLength > 0) {
471
- const g = p.lineLength / f.lineLength;
472
- if (g < 0.5) return {
467
+ const p = o - n * 2;
468
+ if (p > t) {
469
+ const f = je(a, e, p);
470
+ if (u.lineLength > 0 && f.lineLength > 0) {
471
+ const m = u.lineLength / f.lineLength;
472
+ if (m < 0.5) return {
473
473
  valid: false,
474
- reason: `Second circumference is too small relative to third (ratio ${g.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
474
+ reason: `Second circumference is too small relative to third (ratio ${m.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
475
475
  };
476
476
  }
477
477
  }
@@ -480,31 +480,31 @@ let __tla = (async () => {
480
480
  reason: ""
481
481
  };
482
482
  }
483
- const Le = "pipeline";
484
- function tr(e, o, t, n) {
483
+ const De = "pipeline";
484
+ function nr(e, o, t, n) {
485
485
  var _a, _b, _c, _d;
486
486
  const s = e.geometry.clone(), l = o.map((a) => ({
487
487
  ...a
488
488
  })), d = n.wasmModule;
489
489
  try {
490
- let a = e.geometry, r = l.map((N) => new M(N.position.x, N.position.y, N.position.z));
491
- const c = r[0], p = r[1];
490
+ let a = e.geometry, r = l.map((j) => new P(j.position.x, j.position.y, j.position.z));
491
+ const c = r[0], u = r[1];
492
492
  if (!d) {
493
- n.onStatus("Aligning mesh (JS fallback)..."), ge.warn(Le, "WASM not available, using JS fallback alignment");
494
- const N = new M(0, 1, 0), K = new M().subVectors(p, c).normalize(), fe = K.dot(N), le = new M().crossVectors(K, N);
495
- if (le.length() > 1e-4) {
496
- le.normalize();
497
- const T = new U.Quaternion().setFromAxisAngle(le, Math.acos(Math.min(1, Math.max(-1, fe))));
498
- a.applyMatrix4(new U.Matrix4().makeRotationFromQuaternion(T)), r = r.map((ke) => ke.clone().applyQuaternion(T));
493
+ n.onStatus("Aligning mesh (JS fallback)..."), xe.warn(De, "WASM not available, using JS fallback alignment");
494
+ const j = new P(0, 1, 0), K = new P().subVectors(u, c).normalize(), fe = K.dot(j), ie = new P().crossVectors(K, j);
495
+ if (ie.length() > 1e-4) {
496
+ ie.normalize();
497
+ const T = new q.Quaternion().setFromAxisAngle(ie, Math.acos(Math.min(1, Math.max(-1, fe))));
498
+ a.applyMatrix4(new q.Matrix4().makeRotationFromQuaternion(T)), r = r.map((Le) => Le.clone().applyQuaternion(T));
499
499
  }
500
500
  if (r[0].y > r[1].y) {
501
- const T = new U.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
502
- a.applyMatrix4(new U.Matrix4().makeRotationFromQuaternion(T)), r = r.map((ke) => ke.clone().applyQuaternion(T));
501
+ const T = new q.Quaternion().setFromAxisAngle(new P(1, 0, 0), Math.PI);
502
+ a.applyMatrix4(new q.Matrix4().makeRotationFromQuaternion(T)), r = r.map((Le) => Le.clone().applyQuaternion(T));
503
503
  }
504
- const he = r[0].clone();
505
- a.translate(-he.x, -he.y, -he.z), r = r.map((T) => new M(T.x - he.x, T.y - he.y, T.z - he.z)), a.computeVertexNormals(), a.computeBoundingBox();
506
- const ue = new M(r[0].x, r[0].y, r[0].z);
507
- r.push(ue), n.addLandmarkPoint({
504
+ const pe = r[0].clone();
505
+ a.translate(-pe.x, -pe.y, -pe.z), r = r.map((T) => new P(T.x - pe.x, T.y - pe.y, T.z - pe.z)), a.computeVertexNormals(), a.computeBoundingBox();
506
+ const he = new P(r[0].x, r[0].y, r[0].z);
507
+ r.push(he), n.addLandmarkPoint({
508
508
  faceIndex: -1,
509
509
  vertexIndices: [
510
510
  0,
@@ -512,9 +512,9 @@ let __tla = (async () => {
512
512
  2
513
513
  ],
514
514
  position: {
515
- x: ue.x,
516
- y: ue.y,
517
- z: ue.z
515
+ x: he.x,
516
+ y: he.y,
517
+ z: he.z
518
518
  },
519
519
  barycentricCoords: {
520
520
  u: 0.33,
@@ -525,82 +525,82 @@ let __tla = (async () => {
525
525
  x: T.x,
526
526
  y: T.y,
527
527
  z: T.z
528
- }))), n.setAligned(true), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * wt);
529
- const we = new M();
530
- a.computeBoundingBox(), a.boundingBox.getSize(we), n.setModelSize(Math.max(we.x, we.y, we.z)), s.dispose();
528
+ }))), n.setAligned(true), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * vt);
529
+ const Se = new P();
530
+ a.computeBoundingBox(), a.boundingBox.getSize(Se), n.setModelSize(Math.max(Se.x, Se.y, Se.z)), s.dispose();
531
531
  return;
532
532
  }
533
- const { positions: u, indices: f } = vt(a), g = new Float32Array([
533
+ const { positions: p, indices: f } = St(a), m = new Float32Array([
534
534
  c.x,
535
535
  c.y,
536
536
  c.z
537
537
  ]), v = new Float32Array([
538
- p.x,
539
- p.y,
540
- p.z
538
+ u.x,
539
+ u.y,
540
+ u.z
541
541
  ]);
542
542
  n.onStatus("Detecting shell type...");
543
- const h = d.detect_shell(u, f, v, 40), x = h.is_double_shell(), w = h.surface_normal();
544
- ge.info(Le, `Shell: ${x ? "DOUBLE" : "SINGLE"}`, h.details()), (_a = n.setDoubleShell) == null ? void 0 : _a.call(n, x), n.onStatus("Finding cross-section plane...");
543
+ const h = d.detect_shell(p, f, v, 40), x = h.is_double_shell(), w = h.surface_normal();
544
+ xe.info(De, `Shell: ${x ? "DOUBLE" : "SINGLE"}`, h.details()), (_a = n.setDoubleShell) == null ? void 0 : _a.call(n, x), n.onStatus("Finding cross-section plane...");
545
545
  const C = new Float32Array([
546
546
  w[0],
547
547
  w[1],
548
548
  w[2]
549
- ]), b = d.find_min_cross_section(u, f, v, C, 10), k = b.plane_normal();
550
- ge.info(Le, "Cross-section found", b.details()), n.onStatus("Aligning mesh...");
549
+ ]), b = d.find_min_cross_section(p, f, v, C, 10), F = b.plane_normal();
550
+ xe.info(De, "Cross-section found", b.details()), n.onStatus("Aligning mesh...");
551
551
  const S = new Float32Array([
552
- k[0],
553
- k[1],
554
- k[2]
555
- ]), A = d.align_to_origin(u, g, v, S);
556
- let z = A.positions(), _ = A.mpt(), E = A.origin();
557
- const H = A.transform();
558
- ge.info(Le, "Alignment complete", A.details());
559
- const P = [
560
- H[3],
561
- H[4],
562
- H[5],
563
- H[6],
564
- H[7],
565
- H[8],
566
- H[9],
567
- H[10],
568
- H[11]
552
+ F[0],
553
+ F[1],
554
+ F[2]
555
+ ]), A = d.align_to_origin(p, m, v, S);
556
+ let z = A.positions(), R = A.mpt(), B = A.origin();
557
+ const N = A.transform();
558
+ xe.info(De, "Alignment complete", A.details());
559
+ const k = [
560
+ N[3],
561
+ N[4],
562
+ N[5],
563
+ N[6],
564
+ N[7],
565
+ N[8],
566
+ N[9],
567
+ N[10],
568
+ N[11]
569
569
  ], I = new Float32Array([
570
- P[0] * k[0] + P[1] * k[1] + P[2] * k[2],
571
- P[3] * k[0] + P[4] * k[1] + P[5] * k[2],
572
- P[6] * k[0] + P[7] * k[1] + P[8] * k[2]
570
+ k[0] * F[0] + k[1] * F[1] + k[2] * F[2],
571
+ k[3] * F[0] + k[4] * F[1] + k[5] * F[2],
572
+ k[6] * F[0] + k[7] * F[1] + k[8] * F[2]
573
573
  ]);
574
574
  n.onStatus("Generating measurement points...");
575
- const L = d.subdivide_origin_to_plane(new Float32Array(E), new Float32Array(_), I);
576
- ge.debug(Le, `Subdivide: ${L.count()} pts, spacing=${L.spacing().toFixed(1)}mm`);
577
- const $ = L.points(), j = L.count(), te = 2, se = 1, oe = [];
578
- for (let N = te; N < j - se; N++) oe.push($[N * 3 + 1]);
575
+ const W = d.subdivide_origin_to_plane(new Float32Array(B), new Float32Array(R), I);
576
+ xe.debug(De, `Subdivide: ${W.count()} pts, spacing=${W.spacing().toFixed(1)}mm`);
577
+ const $ = W.points(), G = W.count(), oe = 2, ce = 1, se = [];
578
+ for (let j = oe; j < G - ce; j++) se.push($[j * 3 + 1]);
579
579
  n.onStatus("Computing cross-sections...");
580
- let q = [];
581
- if (oe.length >= 2) {
582
- const K = (x ? d.batch_cross_sections_y_inner.bind(d) : d.batch_cross_sections_y.bind(d))(z, f, new Float32Array(oe), 10);
583
- ge.debug(Le, "Batch (subdivision)", K.details());
584
- const fe = K.all_loop_points(), le = K.offsets(), he = K.circumferences();
585
- for (let ue = 0; ue < le.length - 1; ue++) {
586
- const we = le[ue], T = le[ue + 1];
587
- if (T <= we || he[ue] <= 0) continue;
588
- const ke = (T - we) / 3;
589
- if (ke < 3) continue;
590
- let _e = 0, Be = 0, xe = 0;
591
- for (let Fe = we; Fe < T; Fe += 3) _e += fe[Fe], Be += fe[Fe + 1], xe += fe[Fe + 2];
592
- q.push(_e / ke, Be / ke, xe / ke);
580
+ let J = [];
581
+ if (se.length >= 2) {
582
+ const K = (x ? d.batch_cross_sections_y_inner.bind(d) : d.batch_cross_sections_y.bind(d))(z, f, new Float32Array(se), 10);
583
+ xe.debug(De, "Batch (subdivision)", K.details());
584
+ const fe = K.all_loop_points(), ie = K.offsets(), pe = K.circumferences();
585
+ for (let he = 0; he < ie.length - 1; he++) {
586
+ const Se = ie[he], T = ie[he + 1];
587
+ if (T <= Se || pe[he] <= 0) continue;
588
+ const Le = (T - Se) / 3;
589
+ if (Le < 3) continue;
590
+ let ke = 0, Ie = 0, ye = 0;
591
+ for (let Fe = Se; Fe < T; Fe += 3) ke += fe[Fe], Ie += fe[Fe + 1], ye += fe[Fe + 2];
592
+ J.push(ke / Le, Ie / Le, ye / Le);
593
593
  }
594
594
  }
595
- if (q.length >= 6) {
595
+ if (J.length >= 6) {
596
596
  n.onStatus("Refining alignment...");
597
- const N = d.refine_alignment(new Float32Array(q), z, new Float32Array(E), new Float32Array(_));
598
- ge.info(Le, "Refinement complete", N.details()), z = N.positions(), _ = N.mpt(), E = N.origin();
597
+ const j = d.refine_alignment(new Float32Array(J), z, new Float32Array(B), new Float32Array(R));
598
+ xe.info(De, "Refinement complete", j.details()), z = j.positions(), R = j.mpt(), B = j.origin();
599
599
  }
600
- const ie = a.getAttribute("color"), Z = Xn(z, f);
601
- ie && Z.setAttribute("color", ie), a.dispose(), a = Z, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), r[0] = new M(E[0], E[1], E[2]), r[1] = new M(_[0], _[1], _[2]), n.onStatus("Setting blue point...");
602
- const pe = new M(r[0].x, r[0].y, r[0].z);
603
- r.push(pe), n.addLandmarkPoint({
600
+ const ae = a.getAttribute("color"), U = Xn(z, f);
601
+ ae && U.setAttribute("color", ae), a.dispose(), a = U, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), r[0] = new P(B[0], B[1], B[2]), r[1] = new P(R[0], R[1], R[2]), n.onStatus("Setting blue point...");
602
+ const ge = new P(r[0].x, r[0].y, r[0].z);
603
+ r.push(ge), n.addLandmarkPoint({
604
604
  faceIndex: -1,
605
605
  vertexIndices: [
606
606
  0,
@@ -608,55 +608,55 @@ let __tla = (async () => {
608
608
  2
609
609
  ],
610
610
  position: {
611
- x: pe.x,
612
- y: pe.y,
613
- z: pe.z
611
+ x: ge.x,
612
+ y: ge.y,
613
+ z: ge.z
614
614
  },
615
615
  barycentricCoords: {
616
616
  u: 0.33,
617
617
  v: 0.33,
618
618
  w: 0.34
619
619
  }
620
- }), n.updateLandmarkPositions(r.map((N) => ({
621
- x: N.x,
622
- y: N.y,
623
- z: N.z
620
+ }), n.updateLandmarkPositions(r.map((j) => ({
621
+ x: j.x,
622
+ y: j.y,
623
+ z: j.z
624
624
  }))), n.setAligned(true);
625
- const ne = a.boundingBox, R = new M();
626
- ne.getSize(R), n.setModelSize(Math.max(R.x, R.y, R.z)), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * wt), n.onStatus("Computing final measurements...");
625
+ const re = a.boundingBox, _ = new P();
626
+ re.getSize(_), n.setModelSize(Math.max(_.x, _.y, _.z)), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * vt), n.onStatus("Computing final measurements...");
627
627
  {
628
- const N = vt(a), K = r[1].y, fe = r[0].y;
629
- let le = 1 / 0, he = -1 / 0;
630
- const ue = N.positions;
631
- for (let xe = 1; xe < ue.length; xe += 3) ue[xe] < le && (le = ue[xe]), ue[xe] > he && (he = ue[xe]);
632
- const we = 25.4, T = [];
628
+ const j = St(a), K = r[1].y, fe = r[0].y;
629
+ let ie = 1 / 0, pe = -1 / 0;
630
+ const he = j.positions;
631
+ for (let ye = 1; ye < he.length; ye += 3) he[ye] < ie && (ie = he[ye]), he[ye] > pe && (pe = he[ye]);
632
+ const Se = 25.4, T = [];
633
633
  T.push(K);
634
- for (let xe = 1; xe <= 2; xe++) {
635
- const Fe = K + xe * we;
636
- Fe < he - 1 && T.push(Fe);
634
+ for (let ye = 1; ye <= 2; ye++) {
635
+ const Fe = K + ye * Se;
636
+ Fe < pe - 1 && T.push(Fe);
637
637
  }
638
- for (let xe = K - we; xe > fe; xe -= we) T.push(xe);
639
- T.sort((xe, Fe) => xe - Fe), ge.info(Le, `Horizontal slices: ${T.length} Y planes, range ${(_b = T[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = T[T.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
640
- const _e = (x ? d.batch_cross_sections_y_inner.bind(d) : d.batch_cross_sections_y.bind(d))(N.positions, N.indices, new Float32Array(T), 10);
641
- ge.info(Le, `Horizontal slices (${x ? "inner" : "outer"}): ${_e.count()}/${T.length} valid`), ge.debug(Le, "Slice details", _e.details());
642
- const Be = {
638
+ for (let ye = K - Se; ye > fe; ye -= Se) T.push(ye);
639
+ T.sort((ye, Fe) => ye - Fe), xe.info(De, `Horizontal slices: ${T.length} Y planes, range ${(_b = T[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = T[T.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
640
+ const ke = (x ? d.batch_cross_sections_y_inner.bind(d) : d.batch_cross_sections_y.bind(d))(j.positions, j.indices, new Float32Array(T), 10);
641
+ xe.info(De, `Horizontal slices (${x ? "inner" : "outer"}): ${ke.count()}/${T.length} valid`), xe.debug(De, "Slice details", ke.details());
642
+ const Ie = {
643
643
  yValues: T,
644
- circumferences: Array.from(_e.circumferences()),
645
- allLoopPoints: new Float32Array(_e.all_loop_points()),
646
- offsets: new Uint32Array(_e.offsets()),
644
+ circumferences: Array.from(ke.circumferences()),
645
+ allLoopPoints: new Float32Array(ke.all_loop_points()),
646
+ offsets: new Uint32Array(ke.offsets()),
647
647
  mptY: K,
648
648
  originY: fe
649
649
  };
650
- (_d = n.setWasmSlices) == null ? void 0 : _d.call(n, Be);
650
+ (_d = n.setWasmSlices) == null ? void 0 : _d.call(n, Ie);
651
651
  }
652
652
  n.onStatus("Validating results...");
653
- const O = r[1].y, ee = r[0].y, J = er(a, O, ee, t);
654
- J.valid || ge.warn(Le, `Validation: ${J.reason}`), n.setClippedReferenceGeometry ? (s.computeVertexNormals(), n.setClippedReferenceGeometry(s)) : s.dispose();
653
+ const H = r[1].y, ne = r[0].y, Q = tr(a, H, ne, t);
654
+ Q.valid || xe.warn(De, `Validation: ${Q.reason}`), n.setClippedReferenceGeometry ? (s.computeVertexNormals(), n.setClippedReferenceGeometry(s)) : s.dispose();
655
655
  } catch (a) {
656
- ge.error(Le, "Processing failed", a), n.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
656
+ xe.error(De, "Processing failed", a), n.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
657
657
  }
658
658
  }
659
- class nr extends Wo {
659
+ class or extends Ro {
660
660
  constructor() {
661
661
  super(...arguments), this.state = {
662
662
  error: null
@@ -723,7 +723,7 @@ let __tla = (async () => {
723
723
  }) : this.props.children;
724
724
  }
725
725
  }
726
- const or = ({ message: e, onDismiss: o }) => y("div", {
726
+ const rr = ({ message: e, onDismiss: o }) => y("div", {
727
727
  style: {
728
728
  position: "absolute",
729
729
  top: 16,
@@ -814,19 +814,19 @@ let __tla = (async () => {
814
814
  })
815
815
  ]
816
816
  });
817
- function rr(e, o, t, n) {
818
- const s = new M().subVectors(t, o), l = new M().subVectors(n, o), d = new M().subVectors(e, o), a = s.dot(s), r = s.dot(l), c = s.dot(d), p = l.dot(l), u = l.dot(d), f = 1 / (a * p - r * r), g = (p * c - r * u) * f, v = (a * u - r * c) * f;
817
+ function ir(e, o, t, n) {
818
+ const s = new P().subVectors(t, o), l = new P().subVectors(n, o), d = new P().subVectors(e, o), a = s.dot(s), r = s.dot(l), c = s.dot(d), u = l.dot(l), p = l.dot(d), f = 1 / (a * u - r * r), m = (u * c - r * p) * f, v = (a * p - r * c) * f;
819
819
  return {
820
- u: 1 - g - v,
821
- v: g,
820
+ u: 1 - m - v,
821
+ v: m,
822
822
  w: v
823
823
  };
824
824
  }
825
- const ir = ({ mesh: e, maxPoints: o = 2, meshColor: t = "#c8c8c8", meshOpacity: n = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
826
- const { addLandmarkPoint: d, landmarkPoints: a } = qt(), r = ce((g) => {
825
+ const sr = ({ mesh: e, maxPoints: o = 2, meshColor: t = "#c8c8c8", meshOpacity: n = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
826
+ const { addLandmarkPoint: d, landmarkPoints: a } = Jt(), r = de((m) => {
827
827
  if (a.length >= o) return;
828
- g.stopPropagation();
829
- const v = g.intersections[0], h = v == null ? void 0 : v.faceIndex;
828
+ m.stopPropagation();
829
+ const v = m.intersections[0], h = v == null ? void 0 : v.faceIndex;
830
830
  if (!v || h == null) return;
831
831
  const x = e.geometry, w = x.index;
832
832
  let C;
@@ -839,9 +839,9 @@ let __tla = (async () => {
839
839
  h * 3 + 1,
840
840
  h * 3 + 2
841
841
  ];
842
- const b = x.getAttribute("position"), k = new M().fromBufferAttribute(b, C[0]), S = new M().fromBufferAttribute(b, C[1]), A = new M().fromBufferAttribute(b, C[2]);
843
- k.applyMatrix4(e.matrixWorld), S.applyMatrix4(e.matrixWorld), A.applyMatrix4(e.matrixWorld);
844
- const z = v.point, _ = rr(z, k, S, A), E = {
842
+ const b = x.getAttribute("position"), F = new P().fromBufferAttribute(b, C[0]), S = new P().fromBufferAttribute(b, C[1]), A = new P().fromBufferAttribute(b, C[2]);
843
+ F.applyMatrix4(e.matrixWorld), S.applyMatrix4(e.matrixWorld), A.applyMatrix4(e.matrixWorld);
844
+ const z = v.point, R = ir(z, F, S, A), B = {
845
845
  faceIndex: h,
846
846
  vertexIndices: C,
847
847
  position: {
@@ -849,29 +849,29 @@ let __tla = (async () => {
849
849
  y: z.y,
850
850
  z: z.z
851
851
  },
852
- barycentricCoords: _
852
+ barycentricCoords: R
853
853
  };
854
- d(E);
854
+ d(B);
855
855
  }, [
856
856
  e,
857
857
  d,
858
858
  a.length,
859
859
  o
860
- ]), c = Q(() => !!e.geometry.getAttribute("color"), [
860
+ ]), c = te(() => !!e.geometry.getAttribute("color"), [
861
861
  e
862
- ]), p = l ? Math.min(n, 0.65) : n, u = p < 1, f = Q(() => new U.MeshStandardMaterial({
862
+ ]), u = l ? Math.min(n, 0.65) : n, p = u < 1, f = te(() => new q.MeshStandardMaterial({
863
863
  color: c ? "#ffffff" : t,
864
- side: s ? U.FrontSide : U.DoubleSide,
864
+ side: s ? q.FrontSide : q.DoubleSide,
865
865
  roughness: 0.6,
866
866
  metalness: 0.1,
867
- transparent: u,
868
- opacity: p,
867
+ transparent: p,
868
+ opacity: u,
869
869
  depthWrite: !l,
870
870
  vertexColors: c
871
871
  }), [
872
872
  t,
873
- p,
874
873
  u,
874
+ p,
875
875
  c,
876
876
  s,
877
877
  l
@@ -882,8 +882,8 @@ let __tla = (async () => {
882
882
  material: f,
883
883
  renderOrder: l ? 0 : void 0
884
884
  });
885
- }, sr = ({ point: e, index: o, markerSize: t, color: n, label: s }) => {
886
- const [l, d] = B(false);
885
+ }, lr = ({ point: e, index: o, markerSize: t, color: n, label: s }) => {
886
+ const [l, d] = E(false);
887
887
  return y("mesh", {
888
888
  position: [
889
889
  e.position.x,
@@ -924,8 +924,8 @@ let __tla = (async () => {
924
924
  })
925
925
  ]
926
926
  }, o);
927
- }, lr = ({ modelSize: e, labels: o }) => {
928
- const { landmarkPoints: t } = qt(), n = e * 0.02, s = [
927
+ }, ar = ({ modelSize: e, labels: o }) => {
928
+ const { landmarkPoints: t } = Jt(), n = e * 0.02, s = [
929
929
  "#44ff44",
930
930
  "#ff4444",
931
931
  "#4444ff"
@@ -935,7 +935,7 @@ let __tla = (async () => {
935
935
  "Cut Plane"
936
936
  ];
937
937
  return i(We, {
938
- children: t.map((a, r) => i(sr, {
938
+ children: t.map((a, r) => i(lr, {
939
939
  point: a,
940
940
  index: r,
941
941
  markerSize: n,
@@ -945,8 +945,8 @@ let __tla = (async () => {
945
945
  });
946
946
  };
947
947
  function Kn(e) {
948
- return Q(() => e ? new Ct(e, {
949
- maxLeafTris: At
948
+ return te(() => e ? new At(e, {
949
+ maxLeafTris: zt
950
950
  }) : null, [
951
951
  e
952
952
  ]);
@@ -954,75 +954,75 @@ let __tla = (async () => {
954
954
  const Dn = (e, o) => {
955
955
  const t = Math.abs(e - o);
956
956
  return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
957
- }, Wn = new U.Color("#8BC34A"), _n = new U.Color("#FFC107"), ar = new U.Color("#FF5722"), cr = (e) => {
957
+ }, Wn = new q.Color("#8BC34A"), Rn = new q.Color("#FFC107"), cr = new q.Color("#FF5722"), dr = (e) => {
958
958
  if (e <= 7) return Wn.clone();
959
959
  if (e <= 20) {
960
960
  const t = (e - 7) / 13;
961
- return Wn.clone().lerp(_n, t);
961
+ return Wn.clone().lerp(Rn, t);
962
962
  }
963
963
  const o = Math.min((e - 20) / 20, 1);
964
- return _n.clone().lerp(ar, o);
965
- }, dr = (e, o) => {
964
+ return Rn.clone().lerp(cr, o);
965
+ }, fr = (e, o) => {
966
966
  const t = e.length, n = new Float32Array(t * 2 * 3), s = new Float32Array(t * 2 * 3), l = [];
967
967
  for (let r = 0; r < t; r++) {
968
- const c = e[r], p = o[r], u = c.distanceTo(p), f = cr(u);
969
- if (n[r * 6] = c.x, n[r * 6 + 1] = c.y, n[r * 6 + 2] = c.z, s[r * 6] = f.r, s[r * 6 + 1] = f.g, s[r * 6 + 2] = f.b, n[r * 6 + 3] = p.x, n[r * 6 + 4] = p.y, n[r * 6 + 5] = p.z, s[r * 6 + 3] = f.r, s[r * 6 + 4] = f.g, s[r * 6 + 5] = f.b, r < t - 1) {
970
- const g = r * 2, v = g + 1, h = (r + 1) * 2, x = h + 1;
971
- l.push(g, v, h, v, x, h);
968
+ const c = e[r], u = o[r], p = c.distanceTo(u), f = dr(p);
969
+ if (n[r * 6] = c.x, n[r * 6 + 1] = c.y, n[r * 6 + 2] = c.z, s[r * 6] = f.r, s[r * 6 + 1] = f.g, s[r * 6 + 2] = f.b, n[r * 6 + 3] = u.x, n[r * 6 + 4] = u.y, n[r * 6 + 5] = u.z, s[r * 6 + 3] = f.r, s[r * 6 + 4] = f.g, s[r * 6 + 5] = f.b, r < t - 1) {
970
+ const m = r * 2, v = m + 1, h = (r + 1) * 2, x = h + 1;
971
+ l.push(m, v, h, v, x, h);
972
972
  }
973
973
  }
974
- const d = new U.BufferGeometry();
975
- d.setAttribute("position", new U.Float32BufferAttribute(n, 3)), d.setAttribute("color", new U.Float32BufferAttribute(s, 3)), d.setIndex(l);
976
- const a = new U.MeshBasicMaterial({
974
+ const d = new q.BufferGeometry();
975
+ d.setAttribute("position", new q.Float32BufferAttribute(n, 3)), d.setAttribute("color", new q.Float32BufferAttribute(s, 3)), d.setIndex(l);
976
+ const a = new q.MeshBasicMaterial({
977
977
  vertexColors: true,
978
978
  transparent: true,
979
979
  opacity: 0.25,
980
- side: U.DoubleSide,
980
+ side: q.DoubleSide,
981
981
  depthTest: false,
982
982
  depthWrite: false
983
983
  });
984
- return new U.Mesh(d, a);
985
- }, fr = ({ bvh: e, geometry: o, yPosition: t, color: n = "#00ff00", labelX: s, onDataChange: l, displayUnit: d = "cm", useInnerSurface: a = false, formValue: r, lineWidth: c = 1.5, wasmLoopPoints: p, wasmCircumference: u }) => {
986
- const f = Q(() => p && u != null ? null : je(e, o, t, a), [
984
+ return new q.Mesh(d, a);
985
+ }, ur = ({ bvh: e, geometry: o, yPosition: t, color: n = "#00ff00", labelX: s, onDataChange: l, displayUnit: d = "cm", useInnerSurface: a = false, formValue: r, lineWidth: c = 1.5, wasmLoopPoints: u, wasmCircumference: p }) => {
986
+ const f = te(() => u && p != null ? null : je(e, o, t, a), [
987
987
  e,
988
988
  o,
989
989
  t,
990
990
  a,
991
- p,
992
- u
993
- ]), g = p ?? (f == null ? void 0 : f.linePoints) ?? [], v = u ?? (f == null ? void 0 : f.lineLength) ?? 0, h = Q(() => {
994
- if (r == null || r === 0 || v <= 0 || g.length < 2) return null;
995
- const b = r / v, k = g.reduce((A, z) => A + z.x, 0) / g.length, S = g.reduce((A, z) => A + z.z, 0) / g.length;
996
- return g.map((A) => new M(k + (A.x - k) * b, A.y, S + (A.z - S) * b));
991
+ u,
992
+ p
993
+ ]), m = u ?? (f == null ? void 0 : f.linePoints) ?? [], v = p ?? (f == null ? void 0 : f.lineLength) ?? 0, h = te(() => {
994
+ if (r == null || r === 0 || v <= 0 || m.length < 2) return null;
995
+ const b = r / v, F = m.reduce((A, z) => A + z.x, 0) / m.length, S = m.reduce((A, z) => A + z.z, 0) / m.length;
996
+ return m.map((A) => new P(F + (A.x - F) * b, A.y, S + (A.z - S) * b));
997
997
  }, [
998
- g,
998
+ m,
999
999
  v,
1000
1000
  r
1001
- ]), x = Q(() => !h || g.length < 2 ? null : dr(g, h), [
1002
- g,
1001
+ ]), x = te(() => !h || m.length < 2 ? null : fr(m, h), [
1002
+ m,
1003
1003
  h
1004
1004
  ]);
1005
- Y(() => () => {
1005
+ Z(() => () => {
1006
1006
  x && (x.geometry.dispose(), x.material.dispose());
1007
1007
  }, [
1008
1008
  x
1009
1009
  ]);
1010
- const w = de(null), C = Q(() => {
1011
- const b = new U.BufferGeometry();
1012
- b.setAttribute("position", new U.Float32BufferAttribute(new Float32Array(6), 3));
1013
- const k = new U.LineBasicMaterial({
1010
+ const w = ue(null), C = te(() => {
1011
+ const b = new q.BufferGeometry();
1012
+ b.setAttribute("position", new q.Float32BufferAttribute(new Float32Array(6), 3));
1013
+ const F = new q.LineBasicMaterial({
1014
1014
  color: 6710886,
1015
1015
  depthTest: false,
1016
1016
  depthWrite: false,
1017
1017
  transparent: true
1018
1018
  });
1019
- return new U.Line(b, k);
1019
+ return new q.Line(b, F);
1020
1020
  }, []);
1021
- return Y(() => () => {
1021
+ return Z(() => () => {
1022
1022
  C.geometry.dispose(), C.material.dispose();
1023
1023
  }, [
1024
1024
  C
1025
- ]), Y(() => {
1025
+ ]), Z(() => {
1026
1026
  v > 0 && (l == null ? void 0 : l({
1027
1027
  yPosition: t,
1028
1028
  originalValue: v,
@@ -1032,28 +1032,28 @@ let __tla = (async () => {
1032
1032
  v,
1033
1033
  t,
1034
1034
  l
1035
- ]), En(({ camera: b }) => {
1036
- if (!w.current || g.length < 2) return;
1037
- const k = new M();
1038
- b.getWorldDirection(k);
1039
- const S = new M(k.x, 0, k.z);
1035
+ ]), Bn(({ camera: b }) => {
1036
+ if (!w.current || m.length < 2) return;
1037
+ const F = new P();
1038
+ b.getWorldDirection(F);
1039
+ const S = new P(F.x, 0, F.z);
1040
1040
  if (S.lengthSq() < 1e-8) return;
1041
1041
  S.normalize();
1042
- const A = new M().crossVectors(S, new M(0, 1, 0)).normalize();
1043
- let z = -1 / 0, _ = g[0];
1044
- for (const I of g) {
1045
- const L = A.x * I.x + A.z * I.z;
1046
- L > z && (z = L, _ = I);
1042
+ const A = new P().crossVectors(S, new P(0, 1, 0)).normalize();
1043
+ let z = -1 / 0, R = m[0];
1044
+ for (const I of m) {
1045
+ const W = A.x * I.x + A.z * I.z;
1046
+ W > z && (z = W, R = I);
1047
1047
  }
1048
- const E = s * 0.35, H = new M(_.x + A.x * E, t, _.z + A.z * E);
1049
- w.current.position.copy(H);
1050
- const P = C.geometry.getAttribute("position");
1051
- P.setXYZ(0, _.x, _.y, _.z), P.setXYZ(1, H.x, H.y, H.z), P.needsUpdate = true;
1052
- }), g.length < 2 ? null : y("group", {
1048
+ const B = s * 0.35, N = new P(R.x + A.x * B, t, R.z + A.z * B);
1049
+ w.current.position.copy(N);
1050
+ const k = C.geometry.getAttribute("position");
1051
+ k.setXYZ(0, R.x, R.y, R.z), k.setXYZ(1, N.x, N.y, N.z), k.needsUpdate = true;
1052
+ }), m.length < 2 ? null : y("group", {
1053
1053
  renderOrder: 10,
1054
1054
  children: [
1055
- i(ye, {
1056
- points: g,
1055
+ i(ve, {
1056
+ points: m,
1057
1057
  color: n,
1058
1058
  lineWidth: c,
1059
1059
  depthTest: false,
@@ -1065,7 +1065,7 @@ let __tla = (async () => {
1065
1065
  object: x,
1066
1066
  renderOrder: 10
1067
1067
  }),
1068
- h && r != null && r !== 0 && i(ye, {
1068
+ h && r != null && r !== 0 && i(ve, {
1069
1069
  points: h,
1070
1070
  color: Dn(v, r),
1071
1071
  lineWidth: 2.5,
@@ -1134,7 +1134,7 @@ let __tla = (async () => {
1134
1134
  ]
1135
1135
  }),
1136
1136
  r != null && r !== 0 && v > 0 && (() => {
1137
- const b = v - r, k = b > 0.5 ? "\u25B2" : b < -0.5 ? "\u25BC" : "", S = Dn(v, r);
1137
+ const b = v - r, F = b > 0.5 ? "\u25B2" : b < -0.5 ? "\u25BC" : "", S = Dn(v, r);
1138
1138
  return y("div", {
1139
1139
  style: {
1140
1140
  display: "flex",
@@ -1146,13 +1146,13 @@ let __tla = (async () => {
1146
1146
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1147
1147
  },
1148
1148
  children: [
1149
- k && i("span", {
1149
+ F && i("span", {
1150
1150
  style: {
1151
1151
  fontSize: 10,
1152
1152
  color: S,
1153
1153
  lineHeight: 1
1154
1154
  },
1155
- children: k
1155
+ children: F
1156
1156
  }),
1157
1157
  y("span", {
1158
1158
  style: {
@@ -1186,20 +1186,20 @@ let __tla = (async () => {
1186
1186
  })
1187
1187
  ]
1188
1188
  });
1189
- }, ur = _o(fr), pr = ({ mesh: e, startY: o, endY: t, spacing: n, modelSize: s, onMeasurementsChange: l, reverseOrder: d = false, displayUnit: a = "cm", useInnerSurface: r = false, formMeasurements: c, originY: p, wasmSlices: u }) => {
1190
- const f = de(/* @__PURE__ */ new Map()), g = e.geometry, v = Kn(g), h = Q(() => {
1191
- if (u) {
1189
+ }, pr = _o(ur), hr = ({ mesh: e, startY: o, endY: t, spacing: n, modelSize: s, onMeasurementsChange: l, reverseOrder: d = false, displayUnit: a = "cm", useInnerSurface: r = false, formMeasurements: c, originY: u, wasmSlices: p }) => {
1190
+ const f = ue(/* @__PURE__ */ new Map()), m = e.geometry, v = Kn(m), h = te(() => {
1191
+ if (p) {
1192
1192
  let z = [
1193
- ...u.yValues
1193
+ ...p.yValues
1194
1194
  ];
1195
1195
  if (n > 25.4 + 0.1) {
1196
- const _ = u.mptY;
1197
- z = z.filter((E) => {
1198
- const H = Math.abs(E - _);
1199
- return E > _ + 0.5 ? false : H < 0.5 || Math.abs(Math.round(H / n) * n - H) < 0.5;
1196
+ const R = p.mptY;
1197
+ z = z.filter((B) => {
1198
+ const N = Math.abs(B - R);
1199
+ return B > R + 0.5 ? false : N < 0.5 || Math.abs(Math.round(N / n) * n - N) < 0.5;
1200
1200
  });
1201
1201
  }
1202
- return d ? z.sort((_, E) => E - _) : z.sort((_, E) => _ - E), z;
1202
+ return d ? z.sort((R, B) => B - R) : z.sort((R, B) => R - B), z;
1203
1203
  }
1204
1204
  const S = [];
1205
1205
  if (d) for (let A = t; A >= o; A -= n) S.push(A);
@@ -1210,33 +1210,33 @@ let __tla = (async () => {
1210
1210
  t,
1211
1211
  n,
1212
1212
  d,
1213
- u
1214
- ]), x = Q(() => {
1215
- if (!u) return null;
1216
- const S = /* @__PURE__ */ new Map(), { allLoopPoints: A, offsets: z, yValues: _ } = u;
1217
- for (let E = 0; E < z.length - 1; E++) {
1218
- const H = z[E], P = z[E + 1];
1219
- if (P <= H) continue;
1213
+ p
1214
+ ]), x = te(() => {
1215
+ if (!p) return null;
1216
+ const S = /* @__PURE__ */ new Map(), { allLoopPoints: A, offsets: z, yValues: R } = p;
1217
+ for (let B = 0; B < z.length - 1; B++) {
1218
+ const N = z[B], k = z[B + 1];
1219
+ if (k <= N) continue;
1220
1220
  const I = [];
1221
- for (let L = H; L < P; L += 3) I.push(new M(A[L], A[L + 1], A[L + 2]));
1222
- I.length >= 3 && S.set(_[E], I);
1221
+ for (let W = N; W < k; W += 3) I.push(new P(A[W], A[W + 1], A[W + 2]));
1222
+ I.length >= 3 && S.set(R[B], I);
1223
1223
  }
1224
1224
  return S;
1225
1225
  }, [
1226
- u
1227
- ]), w = Q(() => {
1228
- if (!u) return null;
1226
+ p
1227
+ ]), w = te(() => {
1228
+ if (!p) return null;
1229
1229
  const S = /* @__PURE__ */ new Map();
1230
- for (let A = 0; A < u.yValues.length; A++) S.set(u.yValues[A], u.circumferences[A]);
1230
+ for (let A = 0; A < p.yValues.length; A++) S.set(p.yValues[A], p.circumferences[A]);
1231
1231
  return S;
1232
1232
  }, [
1233
- u
1233
+ p
1234
1234
  ]);
1235
- Y(() => {
1235
+ Z(() => {
1236
1236
  f.current.clear();
1237
1237
  }, [
1238
1238
  h
1239
- ]), Y(() => {
1239
+ ]), Z(() => {
1240
1240
  if (!w || !l) return;
1241
1241
  const S = h.filter((A) => (w.get(A) ?? 0) > 0).map((A) => ({
1242
1242
  yPosition: A,
@@ -1251,10 +1251,10 @@ let __tla = (async () => {
1251
1251
  ]);
1252
1252
  const C = [
1253
1253
  "#5B9BD5"
1254
- ], b = s * Vo, k = ce((S) => {
1254
+ ], b = s * jo, F = de((S) => {
1255
1255
  if (w) return;
1256
1256
  f.current.set(S.yPosition, S);
1257
- const A = Array.from(f.current.values()).sort((z, _) => d ? _.yPosition - z.yPosition : z.yPosition - _.yPosition);
1257
+ const A = Array.from(f.current.values()).sort((z, R) => d ? R.yPosition - z.yPosition : z.yPosition - R.yPosition);
1258
1258
  l == null ? void 0 : l(A);
1259
1259
  }, [
1260
1260
  l,
@@ -1262,54 +1262,54 @@ let __tla = (async () => {
1262
1262
  w
1263
1263
  ]);
1264
1264
  return v ? i(We, {
1265
- children: h.map((S, A) => i(ur, {
1265
+ children: h.map((S, A) => i(pr, {
1266
1266
  bvh: v,
1267
- geometry: g,
1267
+ geometry: m,
1268
1268
  yPosition: S,
1269
- color: p != null && Math.abs(S - p) < n * 0.5 ? "#44ff44" : C[A % C.length],
1269
+ color: u != null && Math.abs(S - u) < n * 0.5 ? "#44ff44" : C[A % C.length],
1270
1270
  labelX: b,
1271
- onDataChange: k,
1271
+ onDataChange: F,
1272
1272
  displayUnit: a,
1273
1273
  useInnerSurface: r,
1274
1274
  formValue: c == null ? void 0 : c[A],
1275
- lineWidth: p != null && Math.abs(S - p) < n * 0.5 ? 4 : 1.5,
1275
+ lineWidth: u != null && Math.abs(S - u) < n * 0.5 ? 4 : 1.5,
1276
1276
  wasmLoopPoints: x == null ? void 0 : x.get(S),
1277
1277
  wasmCircumference: w == null ? void 0 : w.get(S)
1278
1278
  }, S))
1279
1279
  }) : null;
1280
- }, hr = (e, o) => {
1280
+ }, gr = (e, o) => {
1281
1281
  const t = Math.abs(e - o);
1282
1282
  return t <= 7 ? "#4caf50" : t <= 15 ? "#ff9800" : "#f44336";
1283
- }, gr = ({ mesh: e, greenY: o, modelSize: t, displayUnit: n = "cm", bottomY: s, formHeight: l }) => {
1283
+ }, mr = ({ mesh: e, greenY: o, modelSize: t, displayUnit: n = "cm", bottomY: s, formHeight: l }) => {
1284
1284
  var _a;
1285
1285
  const d = e.geometry;
1286
1286
  d.computeBoundingBox();
1287
- const a = s ?? ((_a = d.boundingBox) == null ? void 0 : _a.min.y) ?? 0, r = o - a, c = t * 0.4, p = t * 0.03, u = de(null);
1288
- En(({ camera: A }) => {
1289
- if (!u.current) return;
1290
- const z = new M();
1287
+ const a = s ?? ((_a = d.boundingBox) == null ? void 0 : _a.min.y) ?? 0, r = o - a, c = t * 0.4, u = t * 0.03, p = ue(null);
1288
+ Bn(({ camera: A }) => {
1289
+ if (!p.current) return;
1290
+ const z = new P();
1291
1291
  A.getWorldDirection(z);
1292
- const _ = new M(z.x, 0, z.z);
1293
- if (_.lengthSq() < 1e-8) return;
1294
- _.normalize();
1295
- const E = new M().crossVectors(new M(0, 1, 0), _).normalize();
1296
- u.current.position.set(E.x * c, 0, E.z * c);
1297
- const H = A.position.x - u.current.position.x, P = A.position.z - u.current.position.z;
1298
- u.current.rotation.y = Math.atan2(H, P);
1292
+ const R = new P(z.x, 0, z.z);
1293
+ if (R.lengthSq() < 1e-8) return;
1294
+ R.normalize();
1295
+ const B = new P().crossVectors(new P(0, 1, 0), R).normalize();
1296
+ p.current.position.set(B.x * c, 0, B.z * c);
1297
+ const N = A.position.x - p.current.position.x, k = A.position.z - p.current.position.z;
1298
+ p.current.rotation.y = Math.atan2(N, k);
1299
1299
  });
1300
- const f = new M(0, o, 0), g = new M(0, a, 0), v = new M(0, (o + a) / 2, 0), h = new M(-p, o, 0), x = new M(p, o, 0), w = new M(-p, a, 0), C = new M(p, a, 0), b = l != null && l > 0, k = b ? r - l : 0, S = b ? hr(r, l) : "#fff";
1300
+ const f = new P(0, o, 0), m = new P(0, a, 0), v = new P(0, (o + a) / 2, 0), h = new P(-u, o, 0), x = new P(u, o, 0), w = new P(-u, a, 0), C = new P(u, a, 0), b = l != null && l > 0, F = b ? r - l : 0, S = b ? gr(r, l) : "#fff";
1301
1301
  return y("group", {
1302
- ref: u,
1302
+ ref: p,
1303
1303
  children: [
1304
- i(ye, {
1304
+ i(ve, {
1305
1305
  points: [
1306
1306
  f,
1307
- g
1307
+ m
1308
1308
  ],
1309
1309
  color: "#888888",
1310
1310
  lineWidth: 1.5
1311
1311
  }),
1312
- i(ye, {
1312
+ i(ve, {
1313
1313
  points: [
1314
1314
  h,
1315
1315
  x
@@ -1317,7 +1317,7 @@ let __tla = (async () => {
1317
1317
  color: "#888888",
1318
1318
  lineWidth: 1.5
1319
1319
  }),
1320
- i(ye, {
1320
+ i(ve, {
1321
1321
  points: [
1322
1322
  w,
1323
1323
  C
@@ -1377,13 +1377,13 @@ let __tla = (async () => {
1377
1377
  pointerEvents: "none"
1378
1378
  },
1379
1379
  children: [
1380
- Math.abs(k) > 0.5 && i("span", {
1380
+ Math.abs(F) > 0.5 && i("span", {
1381
1381
  style: {
1382
1382
  fontSize: 10,
1383
1383
  color: S,
1384
1384
  lineHeight: 1
1385
1385
  },
1386
- children: k > 0.5 ? "\u25B2" : "\u25BC"
1386
+ children: F > 0.5 ? "\u25B2" : "\u25BC"
1387
1387
  }),
1388
1388
  y("span", {
1389
1389
  style: {
@@ -1393,8 +1393,8 @@ let __tla = (async () => {
1393
1393
  fontWeight: 600
1394
1394
  },
1395
1395
  children: [
1396
- k > 0 ? "+" : "",
1397
- n === "inch" ? (k / 25.4).toFixed(2) : (k / 10).toFixed(1)
1396
+ F > 0 ? "+" : "",
1397
+ n === "inch" ? (F / 25.4).toFixed(2) : (F / 10).toFixed(1)
1398
1398
  ]
1399
1399
  }),
1400
1400
  y("span", {
@@ -1416,38 +1416,38 @@ let __tla = (async () => {
1416
1416
  })
1417
1417
  ]
1418
1418
  });
1419
- }, mr = ({ modelSize: e, isAligned: o, isCut: t, mesh: n, viewMode: s, sliceY: l, landmarkCount: d = 0, measurementGeometry: a, fitYMin: r, fitYMax: c, resetCameraToFrontRef: p }) => {
1420
- const { set: u, size: f, camera: g, invalidate: v } = Bn(), h = de(false), x = de(s), w = de(new M()), C = de(null), b = de(d), k = de(o), S = de(t), A = de(a), z = de({
1419
+ }, xr = ({ modelSize: e, isAligned: o, isCut: t, mesh: n, viewMode: s, sliceY: l, landmarkCount: d = 0, measurementGeometry: a, fitYMin: r, fitYMax: c, resetCameraToFrontRef: u }) => {
1420
+ const { set: p, size: f, camera: m, invalidate: v } = En(), h = ue(false), x = ue(s), w = ue(new P()), C = ue(null), b = ue(d), F = ue(o), S = ue(t), A = ue(a), z = ue({
1421
1421
  min: r,
1422
1422
  max: c
1423
- }), _ = de(0), E = ce(() => {
1423
+ }), R = ue(0), B = de(() => {
1424
1424
  if (!n || e <= 0) return null;
1425
- const P = a ?? n.geometry;
1426
- P.computeBoundingBox();
1427
- const I = P.boundingBox, L = new M();
1428
- I.getCenter(L);
1429
- const $ = new M();
1425
+ const k = a ?? n.geometry;
1426
+ k.computeBoundingBox();
1427
+ const I = k.boundingBox, W = new P();
1428
+ I.getCenter(W);
1429
+ const $ = new P();
1430
1430
  I.getSize($);
1431
- const j = r != null && c != null && c > r;
1432
- if (j) {
1433
- const ne = r, R = c, O = P.getAttribute("position");
1434
- if (O) {
1435
- const ee = O.array, J = (R - ne) * 0.08;
1436
- let N = 1 / 0, K = -1 / 0, fe = ne - J, le = R + J, he = false;
1437
- for (let ue = 0; ue < O.count; ue++) {
1438
- const we = ee[ue * 3 + 1];
1439
- if (we < ne - J || we > R + J) continue;
1440
- const T = ee[ue * 3];
1441
- T < N && (N = T), T > K && (K = T), he = true;
1431
+ const G = r != null && c != null && c > r;
1432
+ if (G) {
1433
+ const re = r, _ = c, H = k.getAttribute("position");
1434
+ if (H) {
1435
+ const ne = H.array, Q = (_ - re) * 0.08;
1436
+ let j = 1 / 0, K = -1 / 0, fe = re - Q, ie = _ + Q, pe = false;
1437
+ for (let he = 0; he < H.count; he++) {
1438
+ const Se = ne[he * 3 + 1];
1439
+ if (Se < re - Q || Se > _ + Q) continue;
1440
+ const T = ne[he * 3];
1441
+ T < j && (j = T), T > K && (K = T), pe = true;
1442
1442
  }
1443
- he && (L.set((N + K) / 2, (fe + le) / 2, 0), $.set(K - N, le - fe, 0));
1443
+ pe && (W.set((j + K) / 2, (fe + ie) / 2, 0), $.set(K - j, ie - fe, 0));
1444
1444
  }
1445
1445
  }
1446
1446
  w.current.copy($);
1447
- const te = f.width / f.height, se = 1.35, oe = j ? 1.15 : 1.6, q = Math.max($.y * oe, $.x * se / te), ie = q * te, Z = L.y - $.y * 0.05;
1448
- _.current = Z;
1449
- const pe = new U.OrthographicCamera(-ie / 2, ie / 2, q / 2, -q / 2, 0.1, e * 10);
1450
- return pe.position.set(0, Z, e * 2), pe.lookAt(0, Z, 0), pe;
1447
+ const oe = f.width / f.height, ce = 1.35, se = G ? 1.15 : 1.6, J = Math.max($.y * se, $.x * ce / oe), ae = J * oe, U = W.y - $.y * 0.05;
1448
+ R.current = U;
1449
+ const ge = new q.OrthographicCamera(-ae / 2, ae / 2, J / 2, -J / 2, 0.1, e * 10);
1450
+ return ge.position.set(0, U, e * 2), ge.lookAt(0, U, 0), ge;
1451
1451
  }, [
1452
1452
  n,
1453
1453
  e,
@@ -1456,58 +1456,58 @@ let __tla = (async () => {
1456
1456
  r,
1457
1457
  c
1458
1458
  ]);
1459
- Y(() => {
1460
- if (p) return p.current = () => {
1461
- const P = E();
1462
- P && (u({
1463
- camera: P
1459
+ Z(() => {
1460
+ if (u) return u.current = () => {
1461
+ const k = B();
1462
+ k && (p({
1463
+ camera: k
1464
1464
  }), v());
1465
1465
  }, () => {
1466
- p && (p.current = null);
1466
+ u && (u.current = null);
1467
1467
  };
1468
1468
  }, [
1469
- p,
1470
- E,
1471
1469
  u,
1470
+ B,
1471
+ p,
1472
1472
  v
1473
1473
  ]);
1474
- const H = ce((P) => {
1475
- const I = P.position.clone(), L = I.length(), $ = Math.atan2(I.x, I.z), j = Math.acos(I.y / L), se = $ + 0.02;
1476
- P.position.set(L * Math.sin(j) * Math.sin(se), L * Math.cos(j), L * Math.sin(j) * Math.cos(se)), P.lookAt(0, 0, 0), P.updateMatrixWorld(true), v();
1474
+ const N = de((k) => {
1475
+ const I = k.position.clone(), W = I.length(), $ = Math.atan2(I.x, I.z), G = Math.acos(I.y / W), ce = $ + 0.02;
1476
+ k.position.set(W * Math.sin(G) * Math.sin(ce), W * Math.cos(G), W * Math.sin(G) * Math.cos(ce)), k.lookAt(0, 0, 0), k.updateMatrixWorld(true), v();
1477
1477
  }, [
1478
1478
  v
1479
1479
  ]);
1480
- return Y(() => {
1480
+ return Z(() => {
1481
1481
  if (e > 0 && !h.current && !o) {
1482
1482
  h.current = true;
1483
- const P = new U.PerspectiveCamera(50, f.width / f.height, 0.1, e * 10);
1484
- P.position.set(e * 0.3, e * 0.2, e * 1.5), P.lookAt(0, 0, 0), u({
1485
- camera: P
1486
- }), requestAnimationFrame(() => H(P));
1483
+ const k = new q.PerspectiveCamera(50, f.width / f.height, 0.1, e * 10);
1484
+ k.position.set(e * 0.3, e * 0.2, e * 1.5), k.lookAt(0, 0, 0), p({
1485
+ camera: k
1486
+ }), requestAnimationFrame(() => N(k));
1487
1487
  }
1488
1488
  }, [
1489
1489
  e,
1490
1490
  f,
1491
- u,
1491
+ p,
1492
1492
  o,
1493
- H
1494
- ]), Y(() => {
1495
- const P = b.current;
1496
- b.current = d, P === 0 && d === 1 && !o && requestAnimationFrame(() => H(g));
1493
+ N
1494
+ ]), Z(() => {
1495
+ const k = b.current;
1496
+ b.current = d, k === 0 && d === 1 && !o && requestAnimationFrame(() => N(m));
1497
1497
  }, [
1498
1498
  d,
1499
1499
  o,
1500
- g,
1501
- H
1502
- ]), Y(() => {
1503
- const P = k.current !== o, I = S.current !== t, L = !A.current && !!a, $ = (z.current.min == null || z.current.max == null) && r != null && c != null;
1504
- if (k.current = o, S.current = t, A.current = a, z.current = {
1500
+ m,
1501
+ N
1502
+ ]), Z(() => {
1503
+ const k = F.current !== o, I = S.current !== t, W = !A.current && !!a, $ = (z.current.min == null || z.current.max == null) && r != null && c != null;
1504
+ if (F.current = o, S.current = t, A.current = a, z.current = {
1505
1505
  min: r,
1506
1506
  max: c
1507
- }, !P && !I && !L && !$ || !o || s !== "3D") return;
1508
- const j = E();
1509
- j && u({
1510
- camera: j
1507
+ }, !k && !I && !W && !$ || !o || s !== "3D") return;
1508
+ const G = B();
1509
+ G && p({
1510
+ camera: G
1511
1511
  });
1512
1512
  }, [
1513
1513
  o,
@@ -1516,38 +1516,38 @@ let __tla = (async () => {
1516
1516
  a,
1517
1517
  r,
1518
1518
  c,
1519
- E,
1520
- u
1521
- ]), Y(() => {
1519
+ B,
1520
+ p
1521
+ ]), Z(() => {
1522
1522
  if (x.current === s) return;
1523
- const P = x.current;
1523
+ const k = x.current;
1524
1524
  if (x.current = s, !(!o || !n || e <= 0)) {
1525
1525
  if (s === "2D" && l != null) {
1526
- C.current = g;
1527
- const I = n.geometry, L = I.getAttribute("position"), $ = L.array, j = e * 0.15;
1528
- let te = 1 / 0, se = -1 / 0, oe = 1 / 0, q = -1 / 0, ie = false;
1529
- for (let fe = 0; fe < L.count; fe++) if (Math.abs($[fe * 3 + 1] - l) < j) {
1530
- const le = $[fe * 3], he = $[fe * 3 + 2];
1531
- le < te && (te = le), le > se && (se = le), he < oe && (oe = he), he > q && (q = he), ie = true;
1526
+ C.current = m;
1527
+ const I = n.geometry, W = I.getAttribute("position"), $ = W.array, G = e * 0.15;
1528
+ let oe = 1 / 0, ce = -1 / 0, se = 1 / 0, J = -1 / 0, ae = false;
1529
+ for (let fe = 0; fe < W.count; fe++) if (Math.abs($[fe * 3 + 1] - l) < G) {
1530
+ const ie = $[fe * 3], pe = $[fe * 3 + 2];
1531
+ ie < oe && (oe = ie), ie > ce && (ce = ie), pe < se && (se = pe), pe > J && (J = pe), ae = true;
1532
1532
  }
1533
- if (!ie) {
1533
+ if (!ae) {
1534
1534
  I.computeBoundingBox();
1535
1535
  const fe = I.boundingBox;
1536
- te = fe.min.x, se = fe.max.x, oe = fe.min.z, q = fe.max.z;
1536
+ oe = fe.min.x, ce = fe.max.x, se = fe.min.z, J = fe.max.z;
1537
1537
  }
1538
- const Z = (te + se) / 2, pe = (oe + q) / 2, ne = f.width / f.height, R = 1.4, O = (se - te) * R, ee = (q - oe) * R;
1539
- let J, N;
1540
- O / ee > ne ? (J = O, N = O / ne) : (N = ee, J = ee * ne);
1541
- const K = new U.OrthographicCamera(-J / 2, J / 2, N / 2, -N / 2, 0.1, e * 10);
1542
- K.position.set(Z, l + e * 2, pe), K.up.set(0, 0, -1), K.lookAt(Z, l, pe), u({
1538
+ const U = (oe + ce) / 2, ge = (se + J) / 2, re = f.width / f.height, _ = 1.4, H = (ce - oe) * _, ne = (J - se) * _;
1539
+ let Q, j;
1540
+ H / ne > re ? (Q = H, j = H / re) : (j = ne, Q = ne * re);
1541
+ const K = new q.OrthographicCamera(-Q / 2, Q / 2, j / 2, -j / 2, 0.1, e * 10);
1542
+ K.position.set(U, l + e * 2, ge), K.up.set(0, 0, -1), K.lookAt(U, l, ge), p({
1543
1543
  camera: K
1544
1544
  });
1545
- } else if (P === "2D") if (C.current) u({
1545
+ } else if (k === "2D") if (C.current) p({
1546
1546
  camera: C.current
1547
1547
  }), C.current = null;
1548
1548
  else {
1549
- const I = E();
1550
- I && u({
1549
+ const I = B();
1550
+ I && p({
1551
1551
  camera: I
1552
1552
  });
1553
1553
  }
@@ -1559,46 +1559,46 @@ let __tla = (async () => {
1559
1559
  n,
1560
1560
  e,
1561
1561
  f,
1562
- u,
1563
- g,
1564
- E
1565
- ]), Y(() => {
1566
- if (!o || !g || !g.isOrthographicCamera) return;
1567
- const P = g;
1562
+ p,
1563
+ m,
1564
+ B
1565
+ ]), Z(() => {
1566
+ if (!o || !m || !m.isOrthographicCamera) return;
1567
+ const k = m;
1568
1568
  if (s === "2D") {
1569
1569
  if (!n || l == null) return;
1570
- const I = n.geometry, L = I.getAttribute("position"), $ = L.array, j = e * 0.15;
1571
- let te = 1 / 0, se = -1 / 0, oe = 1 / 0, q = -1 / 0, ie = false;
1572
- for (let J = 0; J < L.count; J++) if (Math.abs($[J * 3 + 1] - l) < j) {
1573
- const N = $[J * 3], K = $[J * 3 + 2];
1574
- N < te && (te = N), N > se && (se = N), K < oe && (oe = K), K > q && (q = K), ie = true;
1570
+ const I = n.geometry, W = I.getAttribute("position"), $ = W.array, G = e * 0.15;
1571
+ let oe = 1 / 0, ce = -1 / 0, se = 1 / 0, J = -1 / 0, ae = false;
1572
+ for (let Q = 0; Q < W.count; Q++) if (Math.abs($[Q * 3 + 1] - l) < G) {
1573
+ const j = $[Q * 3], K = $[Q * 3 + 2];
1574
+ j < oe && (oe = j), j > ce && (ce = j), K < se && (se = K), K > J && (J = K), ae = true;
1575
1575
  }
1576
- if (!ie) {
1576
+ if (!ae) {
1577
1577
  I.computeBoundingBox();
1578
- const J = I.boundingBox;
1579
- te = J.min.x, se = J.max.x, oe = J.min.z, q = J.max.z;
1578
+ const Q = I.boundingBox;
1579
+ oe = Q.min.x, ce = Q.max.x, se = Q.min.z, J = Q.max.z;
1580
1580
  }
1581
- const Z = f.width / f.height, pe = 1.4, ne = (se - te) * pe, R = (q - oe) * pe;
1582
- let O, ee;
1583
- ne / R > Z ? (O = ne, ee = ne / Z) : (ee = R, O = R * Z), P.left = -O / 2, P.right = O / 2, P.top = ee / 2, P.bottom = -ee / 2;
1581
+ const U = f.width / f.height, ge = 1.4, re = (ce - oe) * ge, _ = (J - se) * ge;
1582
+ let H, ne;
1583
+ re / _ > U ? (H = re, ne = re / U) : (ne = _, H = _ * U), k.left = -H / 2, k.right = H / 2, k.top = ne / 2, k.bottom = -ne / 2;
1584
1584
  } else {
1585
- const I = w.current, L = f.width / f.height, $ = Math.max(I.y, I.x / L) * 1.6, j = $ * L;
1586
- P.left = -j / 2, P.right = j / 2, P.top = $ / 2, P.bottom = -$ / 2;
1585
+ const I = w.current, W = f.width / f.height, $ = Math.max(I.y, I.x / W) * 1.6, G = $ * W;
1586
+ k.left = -G / 2, k.right = G / 2, k.top = $ / 2, k.bottom = -$ / 2;
1587
1587
  }
1588
- P.updateProjectionMatrix();
1588
+ k.updateProjectionMatrix();
1589
1589
  }, [
1590
1590
  f.width,
1591
1591
  f.height,
1592
1592
  o,
1593
- g,
1593
+ m,
1594
1594
  s,
1595
1595
  n
1596
1596
  ]), null;
1597
- }, xr = ({ mesh: e, isDragging: o }) => {
1597
+ }, br = ({ mesh: e, isDragging: o }) => {
1598
1598
  var _a;
1599
1599
  const t = e.geometry;
1600
1600
  t.computeBoundingBox();
1601
- const n = new M();
1601
+ const n = new P();
1602
1602
  return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(n), i($n, {
1603
1603
  enableDamping: false,
1604
1604
  enablePan: false,
@@ -1613,12 +1613,12 @@ let __tla = (async () => {
1613
1613
  n.z
1614
1614
  ]
1615
1615
  });
1616
- }, br = {
1616
+ }, yr = {
1617
1617
  meter: "Scan units detected as meters \u2014 auto-scaled to millimeters",
1618
1618
  cm: "Scan units detected as centimeters \u2014 auto-scaled to millimeters",
1619
1619
  mm: "Scan units detected as millimeters"
1620
- }, yr = ({ detectedUnit: e, onDismiss: o }) => {
1621
- const t = e === "meter" || e === "cm", n = br[e] ?? "Scan units could not be determined";
1620
+ }, wr = ({ detectedUnit: e, onDismiss: o }) => {
1621
+ const t = e === "meter" || e === "cm", n = yr[e] ?? "Scan units could not be determined";
1622
1622
  return y("div", {
1623
1623
  style: {
1624
1624
  position: "absolute",
@@ -1661,7 +1661,7 @@ let __tla = (async () => {
1661
1661
  })
1662
1662
  ]
1663
1663
  });
1664
- }, wr = ({ isDoubleShell: e, onDismiss: o }) => (Y(() => {
1664
+ }, vr = ({ isDoubleShell: e, onDismiss: o }) => (Z(() => {
1665
1665
  const t = setTimeout(o, 1e4);
1666
1666
  return () => clearTimeout(t);
1667
1667
  }, []), y("div", {
@@ -1705,41 +1705,41 @@ let __tla = (async () => {
1705
1705
  children: "X"
1706
1706
  })
1707
1707
  ]
1708
- })), Rn = (e, o) => {
1708
+ })), _n = (e, o) => {
1709
1709
  const t = Math.abs(e - o);
1710
1710
  return t <= 7 ? "#4caf50" : t <= 15 ? "#ff9800" : "#f44336";
1711
- }, vr = ({ mesh: e, upperY: o, originY: t, modelSize: n, meshColor: s = "#c8c8c8", displayUnit: l = "cm", formML: d, formAP: a }) => {
1712
- const r = e.geometry, c = Q(() => new Ct(r, {
1713
- maxLeafTris: At
1711
+ }, Sr = ({ mesh: e, upperY: o, originY: t, modelSize: n, meshColor: s = "#c8c8c8", displayUnit: l = "cm", formML: d, formAP: a }) => {
1712
+ const r = e.geometry, c = te(() => new At(r, {
1713
+ maxLeafTris: zt
1714
1714
  }), [
1715
1715
  r
1716
- ]), p = Q(() => je(c, r, t), [
1716
+ ]), u = te(() => je(c, r, t), [
1717
1717
  c,
1718
1718
  r,
1719
1719
  t
1720
- ]), u = Q(() => new St(new M(0, -1, 0), o), [
1720
+ ]), p = te(() => new Ct(new P(0, -1, 0), o), [
1721
1721
  o
1722
- ]), { mlLine: f, apLine: g, mlWidth: v, apWidth: h } = Q(() => {
1723
- let C = null, b = null, k = 0, S = 0;
1724
- if (p.linePoints.length >= 2) {
1725
- let A = p.linePoints[0], z = p.linePoints[0], _ = p.linePoints[0], E = p.linePoints[0];
1726
- for (const H of p.linePoints) H.x < A.x && (A = H), H.x > z.x && (z = H), H.z < _.z && (_ = H), H.z > E.z && (E = H);
1722
+ ]), { mlLine: f, apLine: m, mlWidth: v, apWidth: h } = te(() => {
1723
+ let C = null, b = null, F = 0, S = 0;
1724
+ if (u.linePoints.length >= 2) {
1725
+ let A = u.linePoints[0], z = u.linePoints[0], R = u.linePoints[0], B = u.linePoints[0];
1726
+ for (const N of u.linePoints) N.x < A.x && (A = N), N.x > z.x && (z = N), N.z < R.z && (R = N), N.z > B.z && (B = N);
1727
1727
  C = [
1728
- new M(A.x, t, A.z),
1729
- new M(z.x, t, z.z)
1728
+ new P(A.x, t, A.z),
1729
+ new P(z.x, t, z.z)
1730
1730
  ], b = [
1731
- new M(_.x, t, _.z),
1732
- new M(E.x, t, E.z)
1733
- ], k = C[0].distanceTo(C[1]), S = b[0].distanceTo(b[1]);
1731
+ new P(R.x, t, R.z),
1732
+ new P(B.x, t, B.z)
1733
+ ], F = C[0].distanceTo(C[1]), S = b[0].distanceTo(b[1]);
1734
1734
  }
1735
1735
  return {
1736
1736
  mlLine: C,
1737
1737
  apLine: b,
1738
- mlWidth: k,
1738
+ mlWidth: F,
1739
1739
  apWidth: S
1740
1740
  };
1741
1741
  }, [
1742
- p,
1742
+ u,
1743
1743
  t
1744
1744
  ]), x = (C) => l === "inch" ? (C / 25.4).toFixed(2) : (C / 10).toFixed(1), w = l === "inch" ? "in" : "cm";
1745
1745
  return y(We, {
@@ -1748,17 +1748,17 @@ let __tla = (async () => {
1748
1748
  geometry: e.geometry,
1749
1749
  children: i("meshStandardMaterial", {
1750
1750
  color: s,
1751
- side: U.DoubleSide,
1751
+ side: q.DoubleSide,
1752
1752
  transparent: true,
1753
1753
  opacity: 0.15,
1754
1754
  depthWrite: false,
1755
1755
  clippingPlanes: [
1756
- u
1756
+ p
1757
1757
  ]
1758
1758
  })
1759
1759
  }),
1760
- p.linePoints.length >= 2 && i(ye, {
1761
- points: p.linePoints,
1760
+ u.linePoints.length >= 2 && i(ve, {
1761
+ points: u.linePoints,
1762
1762
  color: "#00ff00",
1763
1763
  lineWidth: 3,
1764
1764
  depthTest: false,
@@ -1767,7 +1767,7 @@ let __tla = (async () => {
1767
1767
  }),
1768
1768
  f && y(We, {
1769
1769
  children: [
1770
- i(ye, {
1770
+ i(ve, {
1771
1771
  points: f,
1772
1772
  color: "#ff8800",
1773
1773
  lineWidth: 2,
@@ -1814,7 +1814,7 @@ let __tla = (async () => {
1814
1814
  })
1815
1815
  }),
1816
1816
  d != null && d > 0 && (() => {
1817
- const C = v - d, b = Rn(v, d), k = C > 0.5 ? "\u25B2" : C < -0.5 ? "\u25BC" : "";
1817
+ const C = v - d, b = _n(v, d), F = C > 0.5 ? "\u25B2" : C < -0.5 ? "\u25BC" : "";
1818
1818
  return y("div", {
1819
1819
  style: {
1820
1820
  display: "flex",
@@ -1826,13 +1826,13 @@ let __tla = (async () => {
1826
1826
  borderTop: "1px solid rgba(255,255,255,0.12)"
1827
1827
  },
1828
1828
  children: [
1829
- k && i("span", {
1829
+ F && i("span", {
1830
1830
  style: {
1831
1831
  fontSize: 9,
1832
1832
  color: b,
1833
1833
  lineHeight: 1
1834
1834
  },
1835
- children: k
1835
+ children: F
1836
1836
  }),
1837
1837
  y("span", {
1838
1838
  style: {
@@ -1865,10 +1865,10 @@ let __tla = (async () => {
1865
1865
  })
1866
1866
  ]
1867
1867
  }),
1868
- g && y(We, {
1868
+ m && y(We, {
1869
1869
  children: [
1870
- i(ye, {
1871
- points: g,
1870
+ i(ve, {
1871
+ points: m,
1872
1872
  color: "#ff00ff",
1873
1873
  lineWidth: 2,
1874
1874
  depthTest: false,
@@ -1877,9 +1877,9 @@ let __tla = (async () => {
1877
1877
  }),
1878
1878
  i(Xe, {
1879
1879
  position: [
1880
- Math.max(g[0].x, g[1].x) + n * 0.02,
1880
+ Math.max(m[0].x, m[1].x) + n * 0.02,
1881
1881
  t,
1882
- g[0].z > g[1].z ? g[0].z : g[1].z
1882
+ m[0].z > m[1].z ? m[0].z : m[1].z
1883
1883
  ],
1884
1884
  center: true,
1885
1885
  style: {
@@ -1914,7 +1914,7 @@ let __tla = (async () => {
1914
1914
  })
1915
1915
  }),
1916
1916
  a != null && a > 0 && (() => {
1917
- const C = h - a, b = Rn(h, a), k = C > 0.5 ? "\u25B2" : C < -0.5 ? "\u25BC" : "";
1917
+ const C = h - a, b = _n(h, a), F = C > 0.5 ? "\u25B2" : C < -0.5 ? "\u25BC" : "";
1918
1918
  return y("div", {
1919
1919
  style: {
1920
1920
  display: "flex",
@@ -1926,13 +1926,13 @@ let __tla = (async () => {
1926
1926
  borderTop: "1px solid rgba(255,255,255,0.12)"
1927
1927
  },
1928
1928
  children: [
1929
- k && i("span", {
1929
+ F && i("span", {
1930
1930
  style: {
1931
1931
  fontSize: 9,
1932
1932
  color: b,
1933
1933
  lineHeight: 1
1934
1934
  },
1935
- children: k
1935
+ children: F
1936
1936
  }),
1937
1937
  y("span", {
1938
1938
  style: {
@@ -1967,66 +1967,66 @@ let __tla = (async () => {
1967
1967
  })
1968
1968
  ]
1969
1969
  });
1970
- }, Sr = ({ mesh: e, yPosition: o, onYChange: t, minY: n, maxY: s, modelSize: l, color: d, hoverColor: a, dragColor: r, label: c, onDragStart: p, onDragEnd: u }) => {
1971
- const [f, g] = B(false), [v, h] = B(false), { camera: x, gl: w } = Bn(), C = de(0), b = de(null), k = e.geometry, S = Kn(k), A = Q(() => S ? je(S, k, o) : {
1970
+ }, Cr = ({ mesh: e, yPosition: o, onYChange: t, minY: n, maxY: s, modelSize: l, color: d, hoverColor: a, dragColor: r, label: c, onDragStart: u, onDragEnd: p }) => {
1971
+ const [f, m] = E(false), [v, h] = E(false), { camera: x, gl: w } = En(), C = ue(0), b = ue(null), F = e.geometry, S = Kn(F), A = te(() => S ? je(S, F, o) : {
1972
1972
  linePoints: [],
1973
1973
  lineLength: 0,
1974
- rightmostPoint: new M()
1974
+ rightmostPoint: new P()
1975
1975
  }, [
1976
1976
  S,
1977
- k,
1977
+ F,
1978
1978
  o
1979
- ]), z = ce((L, $, j) => {
1980
- const te = w.domElement.getBoundingClientRect(), se = (L - te.left) / te.width * 2 - 1, oe = -(($ - te.top) / te.height) * 2 + 1, q = new Eo();
1981
- q.setFromCamera(new U.Vector2(se, oe), x);
1982
- const ie = new M();
1983
- return q.ray.intersectPlane(j, ie) ? ie.y : null;
1979
+ ]), z = de((W, $, G) => {
1980
+ const oe = w.domElement.getBoundingClientRect(), ce = (W - oe.left) / oe.width * 2 - 1, se = -(($ - oe.top) / oe.height) * 2 + 1, J = new Eo();
1981
+ J.setFromCamera(new q.Vector2(ce, se), x);
1982
+ const ae = new P();
1983
+ return J.ray.intersectPlane(G, ae) ? ae.y : null;
1984
1984
  }, [
1985
1985
  x,
1986
1986
  w
1987
- ]), _ = ce((L) => {
1988
- const $ = new M();
1987
+ ]), R = de((W) => {
1988
+ const $ = new P();
1989
1989
  x.getWorldDirection($), $.y = 0, $.lengthSq() < 1e-6 && $.set(0, 0, 1), $.normalize();
1990
- const j = $.multiplyScalar(-1);
1991
- return new St().setFromNormalAndCoplanarPoint(j, new M(0, L, 0));
1990
+ const G = $.multiplyScalar(-1);
1991
+ return new Ct().setFromNormalAndCoplanarPoint(G, new P(0, W, 0));
1992
1992
  }, [
1993
1993
  x
1994
- ]), E = ce((L) => {
1995
- L.stopPropagation(), g(true), w.domElement.style.cursor = "ns-resize";
1996
- const $ = _(o);
1994
+ ]), B = de((W) => {
1995
+ W.stopPropagation(), m(true), w.domElement.style.cursor = "ns-resize";
1996
+ const $ = R(o);
1997
1997
  b.current = $;
1998
- const j = z(L.clientX, L.clientY, $);
1999
- C.current = j != null ? o - j : 0, L.target.setPointerCapture(L.pointerId), p == null ? void 0 : p();
1998
+ const G = z(W.clientX, W.clientY, $);
1999
+ C.current = G != null ? o - G : 0, W.target.setPointerCapture(W.pointerId), u == null ? void 0 : u();
2000
2000
  }, [
2001
2001
  o,
2002
2002
  w,
2003
- _,
2003
+ R,
2004
2004
  z,
2005
- p
2006
- ]), H = ce((L) => {
2005
+ u
2006
+ ]), N = de((W) => {
2007
2007
  if (!f || !b.current) return;
2008
- const $ = z(L.clientX, L.clientY, b.current);
2008
+ const $ = z(W.clientX, W.clientY, b.current);
2009
2009
  if ($ == null) return;
2010
- let j = $ + C.current;
2011
- j = Math.max(n, Math.min(s, j)), t(j);
2010
+ let G = $ + C.current;
2011
+ G = Math.max(n, Math.min(s, G)), t(G);
2012
2012
  }, [
2013
2013
  f,
2014
2014
  z,
2015
2015
  t,
2016
2016
  n,
2017
2017
  s
2018
- ]), P = ce((L) => {
2019
- g(false), w.domElement.style.cursor = "auto", b.current = null, L.target.releasePointerCapture(L.pointerId), u == null ? void 0 : u();
2018
+ ]), k = de((W) => {
2019
+ m(false), w.domElement.style.cursor = "auto", b.current = null, W.target.releasePointerCapture(W.pointerId), p == null ? void 0 : p();
2020
2020
  }, [
2021
2021
  w,
2022
- u
2022
+ p
2023
2023
  ]);
2024
2024
  if (A.linePoints.length < 2) return null;
2025
2025
  const I = f ? r : v ? a : d;
2026
2026
  return y("group", {
2027
2027
  renderOrder: 10,
2028
2028
  children: [
2029
- i(ye, {
2029
+ i(ve, {
2030
2030
  points: A.linePoints,
2031
2031
  color: I,
2032
2032
  lineWidth: f ? 6 : v ? 5 : 4,
@@ -2034,9 +2034,9 @@ let __tla = (async () => {
2034
2034
  depthWrite: false,
2035
2035
  transparent: true,
2036
2036
  renderOrder: 10,
2037
- onPointerDown: E,
2038
- onPointerMove: H,
2039
- onPointerUp: P,
2037
+ onPointerDown: B,
2038
+ onPointerMove: N,
2039
+ onPointerUp: k,
2040
2040
  onPointerEnter: () => {
2041
2041
  h(true), w.domElement.style.cursor = "ns-resize";
2042
2042
  },
@@ -2069,16 +2069,16 @@ let __tla = (async () => {
2069
2069
  ]
2070
2070
  });
2071
2071
  };
2072
- function Cr(e, o) {
2072
+ function Ar(e, o) {
2073
2073
  if (e == null) return {};
2074
2074
  var t = {}, n = Object.keys(e), s, l;
2075
2075
  for (l = 0; l < n.length; l++) s = n[l], !(o.indexOf(s) >= 0) && (t[s] = e[s]);
2076
2076
  return t;
2077
2077
  }
2078
- var Ar = [
2078
+ var zr = [
2079
2079
  "color"
2080
- ], zr = Ro(function(e, o) {
2081
- var t = e.color, n = t === void 0 ? "currentColor" : t, s = Cr(e, Ar);
2080
+ ], Mr = Io(function(e, o) {
2081
+ var t = e.color, n = t === void 0 ? "currentColor" : t, s = Ar(e, zr);
2082
2082
  return Mn("svg", Object.assign({
2083
2083
  width: "15",
2084
2084
  height: "15",
@@ -2112,19 +2112,19 @@ let __tla = (async () => {
2112
2112
  outline: "none",
2113
2113
  boxSizing: "border-box",
2114
2114
  fontFamily: "system-ui, sans-serif"
2115
- }, Mr = ({ amputationType: e, spacingInches: o, scanMeasurements: t, scanFrontalHeight: n, scanTransverseML: s = 0, scanTransverseAP: l = 0, onSave: d, onSkip: a, onFormChange: r, onHeightChange: c, onTransverseMLChange: p, onTransverseAPChange: u, initialValues: f, initialFrontalHeight: g }) => {
2116
- const v = e === "AK" ? "Perineum" : "MPT", h = o, x = e === "AK" ? 18 : 9, w = Q(() => {
2117
- const R = [];
2118
- if (e !== "AK") for (let O = 2; O >= 1; O -= h) R.push(`${O}\u2033 above ${v}`);
2119
- R.push(`At ${v}`);
2120
- for (let O = h; O <= x; O += h) R.push(`${O}\u2033 below ${v}`);
2121
- return R;
2115
+ }, Pr = ({ amputationType: e, spacingInches: o, scanMeasurements: t, scanFrontalHeight: n, scanTransverseML: s = 0, scanTransverseAP: l = 0, onSave: d, onSkip: a, onFormChange: r, onHeightChange: c, onTransverseMLChange: u, onTransverseAPChange: p, initialValues: f, initialFrontalHeight: m }) => {
2116
+ const v = e === "AK" ? "Perineum" : "MPT", h = o, x = e === "AK" ? 18 : 9, w = te(() => {
2117
+ const _ = [];
2118
+ if (e !== "AK") for (let H = 2; H >= 1; H -= h) _.push(`${H}\u2033 above ${v}`);
2119
+ _.push(`At ${v}`);
2120
+ for (let H = h; H <= x; H += h) _.push(`${H}\u2033 below ${v}`);
2121
+ return _;
2122
2122
  }, [
2123
2123
  h,
2124
2124
  v,
2125
2125
  x,
2126
2126
  e
2127
- ]), C = Q(() => e === "BK" ? /* @__PURE__ */ new Set([
2127
+ ]), C = te(() => e === "BK" ? /* @__PURE__ */ new Set([
2128
2128
  `At ${v}`,
2129
2129
  `2\u2033 below ${v}`,
2130
2130
  `4\u2033 below ${v}`
@@ -2135,93 +2135,93 @@ let __tla = (async () => {
2135
2135
  ]), [
2136
2136
  e,
2137
2137
  v
2138
- ]), [b, k] = B(() => {
2138
+ ]), [b, F] = E(() => {
2139
2139
  if (!f) return {};
2140
- const R = {};
2141
- return w.forEach((O, ee) => {
2142
- f[ee] != null && f[ee] !== 0 && (R[O] = (f[ee] / 10).toFixed(1));
2143
- }), R;
2144
- }), [S, A] = B(g && g > 0 ? (g / 10).toFixed(1) : ""), [z, _] = B(""), [E, H] = B(""), [P, I] = B(""), [L, $] = B(""), j = e === "AK" ? "Perineum to Distal (Axial)" : "MPT to Distal (Axial)", te = e === "AK" ? "M/L at Perineum" : "M/L at MPT", se = e === "AK" ? "A/P at Perineum" : "A/P at MPT", oe = Q(() => w.map((R) => {
2145
- const O = b[R];
2146
- return O != null && O !== "" && !isNaN(parseFloat(O)) ? parseFloat(O) * 10 : 0;
2140
+ const _ = {};
2141
+ return w.forEach((H, ne) => {
2142
+ f[ne] != null && f[ne] !== 0 && (_[H] = (f[ne] / 10).toFixed(1));
2143
+ }), _;
2144
+ }), [S, A] = E(m && m > 0 ? (m / 10).toFixed(1) : ""), [z, R] = E(""), [B, N] = E(""), [k, I] = E(""), [W, $] = E(""), G = e === "AK" ? "Perineum to Distal (Axial)" : "MPT to Distal (Axial)", oe = e === "AK" ? "M/L at Perineum" : "M/L at MPT", ce = e === "AK" ? "A/P at Perineum" : "A/P at MPT", se = te(() => w.map((_) => {
2145
+ const H = b[_];
2146
+ return H != null && H !== "" && !isNaN(parseFloat(H)) ? parseFloat(H) * 10 : 0;
2147
2147
  }), [
2148
2148
  w,
2149
2149
  b
2150
2150
  ]);
2151
- Y(() => {
2152
- r == null ? void 0 : r(oe);
2151
+ Z(() => {
2152
+ r == null ? void 0 : r(se);
2153
2153
  }, [
2154
- oe,
2154
+ se,
2155
2155
  r
2156
- ]), Y(() => {
2157
- const R = S !== "" && !isNaN(parseFloat(S)) ? parseFloat(S) * 10 : void 0;
2158
- c == null ? void 0 : c(R);
2156
+ ]), Z(() => {
2157
+ const _ = S !== "" && !isNaN(parseFloat(S)) ? parseFloat(S) * 10 : void 0;
2158
+ c == null ? void 0 : c(_);
2159
2159
  }, [
2160
2160
  S,
2161
2161
  c
2162
2162
  ]);
2163
- const q = e === "AK" ? z : P, ie = e === "AK" ? E : L;
2164
- Y(() => {
2165
- const R = q !== "" && !isNaN(parseFloat(q)) ? parseFloat(q) * 10 : void 0;
2166
- p == null ? void 0 : p(R);
2167
- }, [
2168
- q,
2169
- p
2170
- ]), Y(() => {
2171
- const R = ie !== "" && !isNaN(parseFloat(ie)) ? parseFloat(ie) * 10 : void 0;
2172
- u == null ? void 0 : u(R);
2163
+ const J = e === "AK" ? z : k, ae = e === "AK" ? B : W;
2164
+ Z(() => {
2165
+ const _ = J !== "" && !isNaN(parseFloat(J)) ? parseFloat(J) * 10 : void 0;
2166
+ u == null ? void 0 : u(_);
2173
2167
  }, [
2174
- ie,
2168
+ J,
2175
2169
  u
2170
+ ]), Z(() => {
2171
+ const _ = ae !== "" && !isNaN(parseFloat(ae)) ? parseFloat(ae) * 10 : void 0;
2172
+ p == null ? void 0 : p(_);
2173
+ }, [
2174
+ ae,
2175
+ p
2176
2176
  ]);
2177
- const Z = Q(() => {
2178
- for (const R of C) {
2179
- const O = w.indexOf(R);
2180
- if (O === -1) continue;
2181
- if (oe[O] === 0) return false;
2177
+ const U = te(() => {
2178
+ for (const _ of C) {
2179
+ const H = w.indexOf(_);
2180
+ if (H === -1) continue;
2181
+ if (se[H] === 0) return false;
2182
2182
  }
2183
2183
  return !(!S || isNaN(parseFloat(S)) || parseFloat(S) === 0);
2184
2184
  }, [
2185
- oe,
2185
+ se,
2186
2186
  w,
2187
2187
  C,
2188
2188
  S
2189
- ]), pe = ce(() => {
2190
- if (!Z) return;
2191
- const R = (ee) => ee !== "" && !isNaN(parseFloat(ee)) ? parseFloat(ee) * 10 : void 0, O = R(S) ?? 0;
2189
+ ]), ge = de(() => {
2190
+ if (!U) return;
2191
+ const _ = (ne) => ne !== "" && !isNaN(parseFloat(ne)) ? parseFloat(ne) * 10 : void 0, H = _(S) ?? 0;
2192
2192
  d({
2193
- circumferences: oe,
2194
- frontalHeight: O,
2195
- perineumML: e === "AK" ? R(z) : void 0,
2196
- perineumAP: e === "AK" ? R(E) : void 0,
2197
- mptML: e === "BK" ? R(P) : void 0,
2198
- mptAP: e === "BK" ? R(L) : void 0
2193
+ circumferences: se,
2194
+ frontalHeight: H,
2195
+ perineumML: e === "AK" ? _(z) : void 0,
2196
+ perineumAP: e === "AK" ? _(B) : void 0,
2197
+ mptML: e === "BK" ? _(k) : void 0,
2198
+ mptAP: e === "BK" ? _(W) : void 0
2199
2199
  });
2200
2200
  }, [
2201
- Z,
2202
- oe,
2201
+ U,
2202
+ se,
2203
2203
  S,
2204
2204
  z,
2205
- E,
2206
- P,
2207
- L,
2205
+ B,
2206
+ k,
2207
+ W,
2208
2208
  e,
2209
2209
  d
2210
- ]), ne = ce(() => {
2211
- const R = {};
2212
- if (w.forEach((O, ee) => {
2213
- const J = t[ee];
2214
- if (J) {
2215
- const N = J.modifiedValue ?? J.originalValue;
2216
- R[O] = (N / 10).toFixed(1);
2210
+ ]), re = de(() => {
2211
+ const _ = {};
2212
+ if (w.forEach((H, ne) => {
2213
+ const Q = t[ne];
2214
+ if (Q) {
2215
+ const j = Q.modifiedValue ?? Q.originalValue;
2216
+ _[H] = (j / 10).toFixed(1);
2217
2217
  }
2218
- }), k(R), n > 0 && A((n / 10).toFixed(1)), s > 0) {
2219
- const O = (s / 10).toFixed(1);
2220
- e === "AK" ? _(O) : I(O);
2218
+ }), F(_), n > 0 && A((n / 10).toFixed(1)), s > 0) {
2219
+ const H = (s / 10).toFixed(1);
2220
+ e === "AK" ? R(H) : I(H);
2221
2221
  }
2222
2222
  if (l > 0) {
2223
- const O = (l / 10).toFixed(1);
2224
- e === "AK" ? H(O) : $(O);
2223
+ const H = (l / 10).toFixed(1);
2224
+ e === "AK" ? N(H) : $(H);
2225
2225
  }
2226
2226
  }, [
2227
2227
  w,
@@ -2264,7 +2264,7 @@ let __tla = (async () => {
2264
2264
  2,
2265
2265
  3,
2266
2266
  4
2267
- ].map((R) => i("div", {
2267
+ ].map((_) => i("div", {
2268
2268
  style: {
2269
2269
  height: 4,
2270
2270
  flex: 1,
@@ -2272,7 +2272,7 @@ let __tla = (async () => {
2272
2272
  borderRadius: 2,
2273
2273
  backgroundColor: "rgb(12, 67, 173)"
2274
2274
  }
2275
- }, R)),
2275
+ }, _)),
2276
2276
  i("div", {
2277
2277
  style: {
2278
2278
  fontSize: 11,
@@ -2353,7 +2353,7 @@ let __tla = (async () => {
2353
2353
  ]
2354
2354
  }),
2355
2355
  i("button", {
2356
- onClick: ne,
2356
+ onClick: re,
2357
2357
  style: {
2358
2358
  ...In,
2359
2359
  backgroundColor: "#fff",
@@ -2372,7 +2372,7 @@ let __tla = (async () => {
2372
2372
  gap: 4
2373
2373
  },
2374
2374
  children: [
2375
- i(zr, {
2375
+ i(Mr, {
2376
2376
  style: {
2377
2377
  width: 14,
2378
2378
  height: 14
@@ -2409,8 +2409,8 @@ let __tla = (async () => {
2409
2409
  gap: 10,
2410
2410
  marginBottom: 20
2411
2411
  },
2412
- children: w.map((R, O) => {
2413
- const ee = C.has(R), J = !!b[R];
2412
+ children: w.map((_, H) => {
2413
+ const ne = C.has(_), Q = !!b[_];
2414
2414
  return y("div", {
2415
2415
  style: {
2416
2416
  display: "flex",
@@ -2429,10 +2429,10 @@ let __tla = (async () => {
2429
2429
  overflow: "hidden",
2430
2430
  textOverflow: "ellipsis"
2431
2431
  },
2432
- title: R,
2432
+ title: _,
2433
2433
  children: [
2434
- R,
2435
- ee && i("span", {
2434
+ _,
2435
+ ne && i("span", {
2436
2436
  style: {
2437
2437
  color: "#e53935",
2438
2438
  marginLeft: 2
@@ -2444,22 +2444,22 @@ let __tla = (async () => {
2444
2444
  i("input", {
2445
2445
  type: "number",
2446
2446
  step: "0.1",
2447
- value: b[R] ?? "",
2448
- onChange: (N) => k((K) => ({
2447
+ value: b[_] ?? "",
2448
+ onChange: (j) => F((K) => ({
2449
2449
  ...K,
2450
- [R]: N.target.value
2450
+ [_]: j.target.value
2451
2451
  })),
2452
2452
  style: {
2453
2453
  ...Ze,
2454
2454
  padding: "6px 8px",
2455
2455
  fontSize: 13,
2456
- borderColor: J ? "rgb(12, 67, 173)" : "#ccc",
2456
+ borderColor: Q ? "rgb(12, 67, 173)" : "#ccc",
2457
2457
  borderWidth: 1
2458
2458
  },
2459
2459
  placeholder: "0.0"
2460
2460
  })
2461
2461
  ]
2462
- }, O);
2462
+ }, H);
2463
2463
  })
2464
2464
  }),
2465
2465
  i("div", {
@@ -2496,9 +2496,9 @@ let __tla = (async () => {
2496
2496
  overflow: "hidden",
2497
2497
  textOverflow: "ellipsis"
2498
2498
  },
2499
- title: j,
2499
+ title: G,
2500
2500
  children: [
2501
- j,
2501
+ G,
2502
2502
  i("span", {
2503
2503
  style: {
2504
2504
  color: "#e53935",
@@ -2512,7 +2512,7 @@ let __tla = (async () => {
2512
2512
  type: "number",
2513
2513
  step: "0.1",
2514
2514
  value: S,
2515
- onChange: (R) => A(R.target.value),
2515
+ onChange: (_) => A(_.target.value),
2516
2516
  style: {
2517
2517
  ...Ze,
2518
2518
  padding: "6px 8px",
@@ -2544,14 +2544,14 @@ let __tla = (async () => {
2544
2544
  overflow: "hidden",
2545
2545
  textOverflow: "ellipsis"
2546
2546
  },
2547
- title: te,
2548
- children: te
2547
+ title: oe,
2548
+ children: oe
2549
2549
  }),
2550
2550
  i("input", {
2551
2551
  type: "number",
2552
2552
  step: "0.1",
2553
2553
  value: z,
2554
- onChange: (R) => _(R.target.value),
2554
+ onChange: (_) => R(_.target.value),
2555
2555
  style: {
2556
2556
  ...Ze,
2557
2557
  padding: "6px 8px",
@@ -2581,19 +2581,19 @@ let __tla = (async () => {
2581
2581
  overflow: "hidden",
2582
2582
  textOverflow: "ellipsis"
2583
2583
  },
2584
- title: se,
2585
- children: se
2584
+ title: ce,
2585
+ children: ce
2586
2586
  }),
2587
2587
  i("input", {
2588
2588
  type: "number",
2589
2589
  step: "0.1",
2590
- value: E,
2591
- onChange: (R) => H(R.target.value),
2590
+ value: B,
2591
+ onChange: (_) => N(_.target.value),
2592
2592
  style: {
2593
2593
  ...Ze,
2594
2594
  padding: "6px 8px",
2595
2595
  fontSize: 13,
2596
- borderColor: E ? "rgb(12, 67, 173)" : "#ccc",
2596
+ borderColor: B ? "rgb(12, 67, 173)" : "#ccc",
2597
2597
  borderWidth: 1
2598
2598
  },
2599
2599
  placeholder: "0.0"
@@ -2621,19 +2621,19 @@ let __tla = (async () => {
2621
2621
  overflow: "hidden",
2622
2622
  textOverflow: "ellipsis"
2623
2623
  },
2624
- title: te,
2625
- children: te
2624
+ title: oe,
2625
+ children: oe
2626
2626
  }),
2627
2627
  i("input", {
2628
2628
  type: "number",
2629
2629
  step: "0.1",
2630
- value: P,
2631
- onChange: (R) => I(R.target.value),
2630
+ value: k,
2631
+ onChange: (_) => I(_.target.value),
2632
2632
  style: {
2633
2633
  ...Ze,
2634
2634
  padding: "6px 8px",
2635
2635
  fontSize: 13,
2636
- borderColor: P ? "rgb(12, 67, 173)" : "#ccc",
2636
+ borderColor: k ? "rgb(12, 67, 173)" : "#ccc",
2637
2637
  borderWidth: 1
2638
2638
  },
2639
2639
  placeholder: "0.0"
@@ -2658,19 +2658,19 @@ let __tla = (async () => {
2658
2658
  overflow: "hidden",
2659
2659
  textOverflow: "ellipsis"
2660
2660
  },
2661
- title: se,
2662
- children: se
2661
+ title: ce,
2662
+ children: ce
2663
2663
  }),
2664
2664
  i("input", {
2665
2665
  type: "number",
2666
2666
  step: "0.1",
2667
- value: L,
2668
- onChange: (R) => $(R.target.value),
2667
+ value: W,
2668
+ onChange: (_) => $(_.target.value),
2669
2669
  style: {
2670
2670
  ...Ze,
2671
2671
  padding: "6px 8px",
2672
2672
  fontSize: 13,
2673
- borderColor: L ? "rgb(12, 67, 173)" : "#ccc",
2673
+ borderColor: W ? "rgb(12, 67, 173)" : "#ccc",
2674
2674
  borderWidth: 1
2675
2675
  },
2676
2676
  placeholder: "0.0"
@@ -2694,14 +2694,14 @@ let __tla = (async () => {
2694
2694
  flexShrink: 0
2695
2695
  },
2696
2696
  children: i("button", {
2697
- onClick: pe,
2698
- disabled: !Z,
2697
+ onClick: ge,
2698
+ disabled: !U,
2699
2699
  style: {
2700
2700
  ...In,
2701
- backgroundColor: Z ? "rgb(12, 67, 173)" : "#e0e0e0",
2701
+ backgroundColor: U ? "rgb(12, 67, 173)" : "#e0e0e0",
2702
2702
  border: "none",
2703
- color: Z ? "#fff" : "#9e9e9e",
2704
- cursor: Z ? "pointer" : "not-allowed",
2703
+ color: U ? "#fff" : "#9e9e9e",
2704
+ cursor: U ? "pointer" : "not-allowed",
2705
2705
  padding: "6px 16px",
2706
2706
  fontSize: 13,
2707
2707
  width: "100%"
@@ -2711,13 +2711,13 @@ let __tla = (async () => {
2711
2711
  })
2712
2712
  ]
2713
2713
  });
2714
- }, Pr = [
2714
+ }, kr = [
2715
2715
  "Scan doesn't load properly",
2716
2716
  "Modified CAD",
2717
2717
  "I don't want to",
2718
2718
  "I want a second opinion",
2719
2719
  "I measured from Perineum"
2720
- ], bt = {
2720
+ ], yt = {
2721
2721
  padding: "8px 20px",
2722
2722
  borderRadius: 4,
2723
2723
  fontSize: 14,
@@ -2735,18 +2735,18 @@ let __tla = (async () => {
2735
2735
  outline: "none",
2736
2736
  boxSizing: "border-box",
2737
2737
  fontFamily: "system-ui, sans-serif"
2738
- }, kr = ({ onSkip: e, onCancel: o }) => {
2739
- const [t, n] = B("confirm"), [s, l] = B(null), [d, a] = B(""), r = ce(() => {
2738
+ }, Lr = ({ onSkip: e, onCancel: o }) => {
2739
+ const [t, n] = E("confirm"), [s, l] = E(null), [d, a] = E(""), r = de(() => {
2740
2740
  n("reasons");
2741
- }, []), c = ce(() => {
2741
+ }, []), c = de(() => {
2742
2742
  t === "reasons" ? (n("confirm"), l(null), a("")) : o();
2743
2743
  }, [
2744
2744
  t,
2745
2745
  o
2746
- ]), p = s != null && (s !== "Other" || d.trim() !== ""), u = ce(() => {
2747
- !p || !s || e(s === "Other" ? `Other: ${d.trim()}` : s);
2746
+ ]), u = s != null && (s !== "Other" || d.trim() !== ""), p = de(() => {
2747
+ !u || !s || e(s === "Other" ? `Other: ${d.trim()}` : s);
2748
2748
  }, [
2749
- p,
2749
+ u,
2750
2750
  s,
2751
2751
  d,
2752
2752
  e
@@ -2804,7 +2804,7 @@ let __tla = (async () => {
2804
2804
  },
2805
2805
  children: [
2806
2806
  [
2807
- ...Pr,
2807
+ ...kr,
2808
2808
  "Other"
2809
2809
  ].map((f) => y("label", {
2810
2810
  style: {
@@ -2848,7 +2848,7 @@ let __tla = (async () => {
2848
2848
  value: d,
2849
2849
  onChange: (f) => a(f.target.value),
2850
2850
  onKeyDown: (f) => {
2851
- f.key === "Enter" && u();
2851
+ f.key === "Enter" && p();
2852
2852
  },
2853
2853
  style: {
2854
2854
  ...Fr,
@@ -2872,7 +2872,7 @@ let __tla = (async () => {
2872
2872
  i("button", {
2873
2873
  onClick: c,
2874
2874
  style: {
2875
- ...bt,
2875
+ ...yt,
2876
2876
  backgroundColor: "#fff",
2877
2877
  border: "1px solid #ddd",
2878
2878
  color: "#666"
@@ -2880,14 +2880,14 @@ let __tla = (async () => {
2880
2880
  children: "Cancel"
2881
2881
  }),
2882
2882
  i("button", {
2883
- onClick: u,
2884
- disabled: !p,
2883
+ onClick: p,
2884
+ disabled: !u,
2885
2885
  style: {
2886
- ...bt,
2887
- backgroundColor: p ? "rgb(12, 67, 173)" : "#e0e0e0",
2886
+ ...yt,
2887
+ backgroundColor: u ? "rgb(12, 67, 173)" : "#e0e0e0",
2888
2888
  border: "none",
2889
- color: p ? "#fff" : "#9e9e9e",
2890
- cursor: p ? "pointer" : "not-allowed"
2889
+ color: u ? "#fff" : "#9e9e9e",
2890
+ cursor: u ? "pointer" : "not-allowed"
2891
2891
  },
2892
2892
  children: "Submit"
2893
2893
  })
@@ -2944,7 +2944,7 @@ let __tla = (async () => {
2944
2944
  i("button", {
2945
2945
  onClick: o,
2946
2946
  style: {
2947
- ...bt,
2947
+ ...yt,
2948
2948
  backgroundColor: "#fff",
2949
2949
  border: "1px solid #bdbdbd",
2950
2950
  color: "#333"
@@ -2954,7 +2954,7 @@ let __tla = (async () => {
2954
2954
  i("button", {
2955
2955
  onClick: r,
2956
2956
  style: {
2957
- ...bt,
2957
+ ...yt,
2958
2958
  backgroundColor: "rgb(12, 67, 173)",
2959
2959
  border: "none",
2960
2960
  color: "#fff"
@@ -2973,31 +2973,31 @@ let __tla = (async () => {
2973
2973
  const l = 30, d = s / l, a = [];
2974
2974
  for (let x = 0; x < l; x++) {
2975
2975
  const w = o + x * d, C = o + (x + 1) * d;
2976
- let b = 0, k = 0, S = 0, A = 0;
2976
+ let b = 0, F = 0, S = 0, A = 0;
2977
2977
  for (let z = 0; z < n.count; z++) {
2978
- const _ = n.getY(z);
2979
- _ >= w && _ < C && (b += n.getX(z), k += _, S += n.getZ(z), A++);
2978
+ const R = n.getY(z);
2979
+ R >= w && R < C && (b += n.getX(z), F += R, S += n.getZ(z), A++);
2980
2980
  }
2981
- A > 20 && a.push(new M(b / A, k / A, S / A));
2981
+ A > 20 && a.push(new P(b / A, F / A, S / A));
2982
2982
  }
2983
2983
  if (a.length < 5) return null;
2984
- const r = new M();
2984
+ const r = new P();
2985
2985
  for (const x of a) r.add(x);
2986
2986
  r.divideScalar(a.length);
2987
- let c = 0, p = 0, u = 0, f = 0, g = 0, v = 0;
2987
+ let c = 0, u = 0, p = 0, f = 0, m = 0, v = 0;
2988
2988
  for (const x of a) {
2989
2989
  const w = x.x - r.x, C = x.y - r.y, b = x.z - r.z;
2990
- c += w * w, p += w * C, u += w * b, f += C * C, g += C * b, v += b * b;
2990
+ c += w * w, u += w * C, p += w * b, f += C * C, m += C * b, v += b * b;
2991
2991
  }
2992
- let h = new M(0.01, 1, 0.01).normalize();
2992
+ let h = new P(0.01, 1, 0.01).normalize();
2993
2993
  for (let x = 0; x < 30; x++) {
2994
- const w = c * h.x + p * h.y + u * h.z, C = p * h.x + f * h.y + g * h.z, b = u * h.x + g * h.y + v * h.z, k = new M(w, C, b), S = k.length();
2995
- if (S < 1e-10 || (k.divideScalar(S), h.distanceTo(k) < 1e-8)) break;
2996
- h = k;
2994
+ const w = c * h.x + u * h.y + p * h.z, C = u * h.x + f * h.y + m * h.z, b = p * h.x + m * h.y + v * h.z, F = new P(w, C, b), S = F.length();
2995
+ if (S < 1e-10 || (F.divideScalar(S), h.distanceTo(F) < 1e-8)) break;
2996
+ h = F;
2997
2997
  }
2998
2998
  return h.y < 0 && h.negate(), h;
2999
2999
  }
3000
- const Lr = {
3000
+ const Dr = {
3001
3001
  pcaAxes: true,
3002
3002
  obb: true,
3003
3003
  obbAxis: true,
@@ -3007,13 +3007,13 @@ let __tla = (async () => {
3007
3007
  landmarkAxis: true,
3008
3008
  iterativePCA: false,
3009
3009
  fullRegionPCA: true
3010
- }, Dr = [
3010
+ }, Wr = [
3011
3011
  "#ff4444",
3012
3012
  "#44cc44",
3013
3013
  "#4488ff"
3014
3014
  ];
3015
3015
  function Un(e) {
3016
- const o = e.getAttribute("position"), t = o.count, n = new M();
3016
+ const o = e.getAttribute("position"), t = o.count, n = new P();
3017
3017
  for (let h = 0; h < t; h++) n.x += o.getX(h), n.y += o.getY(h), n.z += o.getZ(h);
3018
3018
  n.divideScalar(t);
3019
3019
  let s = 0, l = 0, d = 0, a = 0, r = 0, c = 0;
@@ -3022,7 +3022,7 @@ let __tla = (async () => {
3022
3022
  s += x * x, l += x * w, d += x * C, a += w * w, r += w * C, c += C * C;
3023
3023
  }
3024
3024
  s /= t, l /= t, d /= t, a /= t, r /= t, c /= t;
3025
- const p = [], u = [], f = [
3025
+ const u = [], p = [], f = [
3026
3026
  [
3027
3027
  s,
3028
3028
  l,
@@ -3040,9 +3040,9 @@ let __tla = (async () => {
3040
3040
  ]
3041
3041
  ];
3042
3042
  for (let h = 0; h < 3; h++) {
3043
- let x = new M(1 + h * 0.1, 1 - h * 0.1, 0.5 + h * 0.3).normalize(), w = 0;
3043
+ let x = new P(1 + h * 0.1, 1 - h * 0.1, 0.5 + h * 0.3).normalize(), w = 0;
3044
3044
  for (let C = 0; C < 100; C++) {
3045
- const b = f[0][0] * x.x + f[0][1] * x.y + f[0][2] * x.z, k = f[1][0] * x.x + f[1][1] * x.y + f[1][2] * x.z, S = f[2][0] * x.x + f[2][1] * x.y + f[2][2] * x.z, A = new M(b, k, S);
3045
+ const b = f[0][0] * x.x + f[0][1] * x.y + f[0][2] * x.z, F = f[1][0] * x.x + f[1][1] * x.y + f[1][2] * x.z, S = f[2][0] * x.x + f[2][1] * x.y + f[2][2] * x.z, A = new P(b, F, S);
3046
3046
  if (w = A.length(), w < 1e-12) break;
3047
3047
  if (A.divideScalar(w), x.distanceTo(A) < 1e-10) {
3048
3048
  x = A;
@@ -3050,9 +3050,9 @@ let __tla = (async () => {
3050
3050
  }
3051
3051
  x = A;
3052
3052
  }
3053
- p.push(x.clone()), u.push(w);
3053
+ u.push(x.clone()), p.push(w);
3054
3054
  for (let C = 0; C < 3; C++) for (let b = 0; b < 3; b++) {
3055
- const k = [
3055
+ const F = [
3056
3056
  x.x,
3057
3057
  x.y,
3058
3058
  x.z
@@ -3061,12 +3061,12 @@ let __tla = (async () => {
3061
3061
  x.y,
3062
3062
  x.z
3063
3063
  ][b];
3064
- f[C][b] -= w * k * S;
3064
+ f[C][b] -= w * F * S;
3065
3065
  }
3066
3066
  }
3067
- const g = new M();
3068
- for (let h = 0; h < t; h++) g.x += o.getX(h), g.y += o.getY(h), g.z += o.getZ(h);
3069
- g.divideScalar(t);
3067
+ const m = new P();
3068
+ for (let h = 0; h < t; h++) m.x += o.getX(h), m.y += o.getY(h), m.z += o.getZ(h);
3069
+ m.divideScalar(t);
3070
3070
  const v = [
3071
3071
  0,
3072
3072
  0,
@@ -3074,37 +3074,37 @@ let __tla = (async () => {
3074
3074
  ];
3075
3075
  for (let h = 0; h < 3; h++) {
3076
3076
  let x = 1 / 0, w = -1 / 0;
3077
- const C = p[h];
3077
+ const C = u[h];
3078
3078
  for (let b = 0; b < t; b++) {
3079
- const k = o.getX(b) - g.x, S = o.getY(b) - g.y, A = o.getZ(b) - g.z, z = k * C.x + S * C.y + A * C.z;
3079
+ const F = o.getX(b) - m.x, S = o.getY(b) - m.y, A = o.getZ(b) - m.z, z = F * C.x + S * C.y + A * C.z;
3080
3080
  z < x && (x = z), z > w && (w = z);
3081
3081
  }
3082
3082
  v[h] = (w - x) / 2;
3083
3083
  }
3084
3084
  return {
3085
- axes: p,
3086
- eigenvalues: u,
3087
- center: g,
3085
+ axes: u,
3086
+ eigenvalues: p,
3087
+ center: m,
3088
3088
  halfExtents: v
3089
3089
  };
3090
3090
  }
3091
- function Wr({ pca: e }) {
3091
+ function Rr({ pca: e }) {
3092
3092
  return i("group", {
3093
3093
  children: e.axes.map((o, t) => {
3094
3094
  const n = e.center.clone().addScaledVector(o, e.halfExtents[t]), s = e.center.clone().addScaledVector(o, -e.halfExtents[t]);
3095
- return i(ye, {
3095
+ return i(ve, {
3096
3096
  points: [
3097
3097
  s,
3098
3098
  n
3099
3099
  ],
3100
- color: Dr[t],
3100
+ color: Wr[t],
3101
3101
  lineWidth: 2
3102
3102
  }, t);
3103
3103
  })
3104
3104
  });
3105
3105
  }
3106
3106
  function _r({ pca: e }) {
3107
- const o = Q(() => {
3107
+ const o = te(() => {
3108
3108
  const { center: t, axes: n, halfExtents: s } = e, l = [];
3109
3109
  for (let a = -1; a <= 1; a += 2) for (let r = -1; r <= 1; r += 2) for (let c = -1; c <= 1; c += 2) l.push(t.clone().addScaledVector(n[0], a * s[0]).addScaledVector(n[1], r * s[1]).addScaledVector(n[2], c * s[2]));
3110
3110
  return [
@@ -3164,7 +3164,7 @@ let __tla = (async () => {
3164
3164
  e
3165
3165
  ]);
3166
3166
  return i("group", {
3167
- children: o.map((t, n) => i(ye, {
3167
+ children: o.map((t, n) => i(ve, {
3168
3168
  points: t,
3169
3169
  color: "#ffaa00",
3170
3170
  lineWidth: 1,
@@ -3173,19 +3173,19 @@ let __tla = (async () => {
3173
3173
  }, n))
3174
3174
  });
3175
3175
  }
3176
- function Rr({ redPoint: e, greenPoint: o }) {
3177
- const t = Q(() => new M().subVectors(o, e).normalize(), [
3176
+ function Ir({ redPoint: e, greenPoint: o }) {
3177
+ const t = te(() => new P().subVectors(o, e).normalize(), [
3178
3178
  e,
3179
3179
  o
3180
- ]), n = Q(() => {
3181
- const l = t.dot(new M(0, 1, 0));
3180
+ ]), n = te(() => {
3181
+ const l = t.dot(new P(0, 1, 0));
3182
3182
  return Math.acos(Math.min(1, Math.abs(l))) * 180 / Math.PI;
3183
3183
  }, [
3184
3184
  t
3185
3185
  ]), s = n < 1 ? "#44ff44" : n < 5 ? "#ffcc00" : "#ff4444";
3186
3186
  return y("group", {
3187
3187
  children: [
3188
- i(ye, {
3188
+ i(ve, {
3189
3189
  points: [
3190
3190
  e,
3191
3191
  o
@@ -3226,19 +3226,19 @@ let __tla = (async () => {
3226
3226
  ]
3227
3227
  });
3228
3228
  }
3229
- function Ir({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3230
- const l = n * 0.15, d = Q(() => {
3229
+ function Br({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3230
+ const l = n * 0.15, d = te(() => {
3231
3231
  const a = [];
3232
3232
  let r = t - 10;
3233
- const c = new M(0, 1, 0);
3233
+ const c = new P(0, 1, 0);
3234
3234
  for (; r > o; ) {
3235
- const p = Math.min(r, t), u = Math.max(r, t), f = Zn(e, p, u);
3235
+ const u = Math.min(r, t), p = Math.max(r, t), f = Zn(e, u, p);
3236
3236
  if (f) {
3237
- const g = f.dot(c), v = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
3237
+ const m = f.dot(c), v = Math.acos(Math.min(1, Math.abs(m))) * 180 / Math.PI;
3238
3238
  a.push({
3239
3239
  axis: f,
3240
- regionMin: p,
3241
- regionMax: u,
3240
+ regionMin: u,
3241
+ regionMax: p,
3242
3242
  angleDeg: v
3243
3243
  });
3244
3244
  }
@@ -3252,23 +3252,23 @@ let __tla = (async () => {
3252
3252
  ]);
3253
3253
  return i("group", {
3254
3254
  children: d.map((a, r) => {
3255
- const c = (a.regionMin + a.regionMax) / 2, p = new M(0, c, 0), u = p.clone().addScaledVector(a.axis, l), f = p.clone().addScaledVector(a.axis, -l), g = r / Math.max(1, d.length - 1), v = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
3255
+ const c = (a.regionMin + a.regionMax) / 2, u = new P(0, c, 0), p = u.clone().addScaledVector(a.axis, l), f = u.clone().addScaledVector(a.axis, -l), m = r / Math.max(1, d.length - 1), v = a.angleDeg < 0.5 ? `hsl(${120 - m * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
3256
3256
  return y("group", {
3257
3257
  children: [
3258
- i(ye, {
3258
+ i(ve, {
3259
3259
  points: [
3260
3260
  f,
3261
- u
3261
+ p
3262
3262
  ],
3263
3263
  color: v,
3264
3264
  lineWidth: 1.5,
3265
3265
  transparent: true,
3266
3266
  opacity: 0.7
3267
3267
  }),
3268
- i(ye, {
3268
+ i(ve, {
3269
3269
  points: [
3270
- new M(-l * 0.3, a.regionMin, 0),
3271
- new M(l * 0.3, a.regionMin, 0)
3270
+ new P(-l * 0.3, a.regionMin, 0),
3271
+ new P(l * 0.3, a.regionMin, 0)
3272
3272
  ],
3273
3273
  color: v,
3274
3274
  lineWidth: 0.5,
@@ -3281,13 +3281,13 @@ let __tla = (async () => {
3281
3281
  });
3282
3282
  }
3283
3283
  function Er({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3284
- const s = Q(() => {
3285
- const u = Zn(e, o, t);
3286
- if (!u) return null;
3287
- const f = u.dot(new M(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(f))) * 180 / Math.PI;
3284
+ const s = te(() => {
3285
+ const p = Zn(e, o, t);
3286
+ if (!p) return null;
3287
+ const f = p.dot(new P(0, 1, 0)), m = Math.acos(Math.min(1, Math.abs(f))) * 180 / Math.PI;
3288
3288
  return {
3289
- axis: u,
3290
- angleDeg: g
3289
+ axis: p,
3290
+ angleDeg: m
3291
3291
  };
3292
3292
  }, [
3293
3293
  e,
@@ -3295,14 +3295,14 @@ let __tla = (async () => {
3295
3295
  t
3296
3296
  ]);
3297
3297
  if (!s) return null;
3298
- const l = (o + t) / 2, d = new M(0, l, 0), a = n * 0.4, r = d.clone().addScaledVector(s.axis, a), c = d.clone().addScaledVector(s.axis, -a), p = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
3298
+ const l = (o + t) / 2, d = new P(0, l, 0), a = n * 0.4, r = d.clone().addScaledVector(s.axis, a), c = d.clone().addScaledVector(s.axis, -a), u = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
3299
3299
  return i("group", {
3300
- children: i(ye, {
3300
+ children: i(ve, {
3301
3301
  points: [
3302
3302
  c,
3303
3303
  r
3304
3304
  ],
3305
- color: p,
3305
+ color: u,
3306
3306
  lineWidth: 3,
3307
3307
  dashed: true,
3308
3308
  dashSize: 3,
@@ -3310,9 +3310,9 @@ let __tla = (async () => {
3310
3310
  })
3311
3311
  });
3312
3312
  }
3313
- function Br({ pca: e, modelSize: o }) {
3313
+ function $r({ pca: e, modelSize: o }) {
3314
3314
  const t = e.axes[0], n = o * 0.6, s = e.center.clone().addScaledVector(t, n), l = e.center.clone().addScaledVector(t, -n);
3315
- return i(ye, {
3315
+ return i(ve, {
3316
3316
  points: [
3317
3317
  l,
3318
3318
  s
@@ -3324,20 +3324,20 @@ let __tla = (async () => {
3324
3324
  gapSize: 2
3325
3325
  });
3326
3326
  }
3327
- function $r({ geometry: e, redY: o, greenY: t, modelSize: n, measurementGeometry: s }) {
3328
- const l = Q(() => {
3329
- const p = s ?? e, u = Ut(p), f = new M(0, 1, 0), g = 5, h = t + 3 * 25.4, x = [];
3330
- for (let _ = o + g; _ < h; _ += g) {
3331
- const E = Qo(u, p, new M(0, _, 0), f);
3332
- E > 0 && x.push({
3333
- y: _,
3334
- circ: E
3327
+ function Tr({ geometry: e, redY: o, greenY: t, modelSize: n, measurementGeometry: s }) {
3328
+ const l = te(() => {
3329
+ const u = s ?? e, p = qt(u), f = new P(0, 1, 0), m = 5, h = t + 3 * 25.4, x = [];
3330
+ for (let R = o + m; R < h; R += m) {
3331
+ const B = er(p, u, new P(0, R, 0), f);
3332
+ B > 0 && x.push({
3333
+ y: R,
3334
+ circ: B
3335
3335
  });
3336
3336
  }
3337
3337
  if (x.length < 5) return null;
3338
- const w = t - o, C = o + w * 0.3, b = o + w * 0.7, k = x.filter((_) => _.y >= C && _.y <= b);
3339
- if (k.length < 3) return null;
3340
- const S = k.map((_) => _.circ).sort((_, E) => _ - E), A = S[Math.floor(S.length / 2)], z = Math.max(...x.map((_) => _.circ));
3338
+ const w = t - o, C = o + w * 0.3, b = o + w * 0.7, F = x.filter((R) => R.y >= C && R.y <= b);
3339
+ if (F.length < 3) return null;
3340
+ const S = F.map((R) => R.circ).sort((R, B) => R - B), A = S[Math.floor(S.length / 2)], z = Math.max(...x.map((R) => R.circ));
3341
3341
  return {
3342
3342
  circumferences: x,
3343
3343
  baseline: A,
@@ -3352,12 +3352,12 @@ let __tla = (async () => {
3352
3352
  const { circumferences: d, baseline: a, maxCirc: r } = l, c = n * 0.3 / r;
3353
3353
  return y("group", {
3354
3354
  children: [
3355
- d.map(({ y: p, circ: u }, f) => {
3356
- const g = u / a, v = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", h = u * c;
3357
- return i(ye, {
3355
+ d.map(({ y: u, circ: p }, f) => {
3356
+ const m = p / a, v = m > 1.6 ? "#ff4444" : m > 1.3 ? "#ffcc00" : "#22cc66", h = p * c;
3357
+ return i(ve, {
3358
3358
  points: [
3359
- new M(-h, p, 0),
3360
- new M(h, p, 0)
3359
+ new P(-h, u, 0),
3360
+ new P(h, u, 0)
3361
3361
  ],
3362
3362
  color: v,
3363
3363
  lineWidth: 1.5,
@@ -3366,13 +3366,13 @@ let __tla = (async () => {
3366
3366
  }, f);
3367
3367
  }),
3368
3368
  (() => {
3369
- const p = a * 1.6 * c, u = d[0].y, f = d[d.length - 1].y;
3369
+ const u = a * 1.6 * c, p = d[0].y, f = d[d.length - 1].y;
3370
3370
  return y(We, {
3371
3371
  children: [
3372
- i(ye, {
3372
+ i(ve, {
3373
3373
  points: [
3374
- new M(-p, u, 0),
3375
- new M(-p, f, 0)
3374
+ new P(-u, p, 0),
3375
+ new P(-u, f, 0)
3376
3376
  ],
3377
3377
  color: "#ff4444",
3378
3378
  lineWidth: 1,
@@ -3382,10 +3382,10 @@ let __tla = (async () => {
3382
3382
  transparent: true,
3383
3383
  opacity: 0.4
3384
3384
  }),
3385
- i(ye, {
3385
+ i(ve, {
3386
3386
  points: [
3387
- new M(p, u, 0),
3388
- new M(p, f, 0)
3387
+ new P(u, p, 0),
3388
+ new P(u, f, 0)
3389
3389
  ],
3390
3390
  color: "#ff4444",
3391
3391
  lineWidth: 1,
@@ -3401,12 +3401,12 @@ let __tla = (async () => {
3401
3401
  ]
3402
3402
  });
3403
3403
  }
3404
- function Tr({ componentDebug: e }) {
3404
+ function Or({ componentDebug: e }) {
3405
3405
  return i("group", {
3406
3406
  children: e.geometries.map((o, t) => {
3407
3407
  const n = e.colors[t] ?? "#888888", s = t === e.innerIdx;
3408
3408
  o.computeBoundingBox();
3409
- const l = new M();
3409
+ const l = new P();
3410
3410
  return o.boundingBox.getCenter(l), y("group", {
3411
3411
  children: [
3412
3412
  i("mesh", {
@@ -3416,7 +3416,7 @@ let __tla = (async () => {
3416
3416
  color: n,
3417
3417
  transparent: true,
3418
3418
  opacity: s ? 0.5 : 0.2,
3419
- side: U.DoubleSide,
3419
+ side: q.DoubleSide,
3420
3420
  depthWrite: false,
3421
3421
  polygonOffset: true,
3422
3422
  polygonOffsetFactor: 1,
@@ -3465,22 +3465,22 @@ let __tla = (async () => {
3465
3465
  })
3466
3466
  });
3467
3467
  }
3468
- function Or({ geometry: e, aoData: o }) {
3469
- const t = Q(() => {
3468
+ function Hr({ geometry: e, aoData: o }) {
3469
+ const t = te(() => {
3470
3470
  const n = e.toNonIndexed(), s = n.getAttribute("position"), l = o.length, d = s.count, a = new Float32Array(d * 3);
3471
3471
  for (let r = 0; r < l && r * 3 + 2 < d; r++) {
3472
- const c = o[r], p = c, u = c < 0.5 ? 0.8 - c * 1.2 : 0.2 * (1 - c), f = 1 - c;
3473
- for (let g = 0; g < 3; g++) {
3474
- const v = (r * 3 + g) * 3;
3475
- a[v] = p, a[v + 1] = u, a[v + 2] = f;
3472
+ const c = o[r], u = c, p = c < 0.5 ? 0.8 - c * 1.2 : 0.2 * (1 - c), f = 1 - c;
3473
+ for (let m = 0; m < 3; m++) {
3474
+ const v = (r * 3 + m) * 3;
3475
+ a[v] = u, a[v + 1] = p, a[v + 2] = f;
3476
3476
  }
3477
3477
  }
3478
- return n.setAttribute("color", new U.Float32BufferAttribute(a, 3)), n;
3478
+ return n.setAttribute("color", new q.Float32BufferAttribute(a, 3)), n;
3479
3479
  }, [
3480
3480
  e,
3481
3481
  o
3482
3482
  ]);
3483
- return Q(() => () => t.dispose(), [
3483
+ return te(() => () => t.dispose(), [
3484
3484
  t
3485
3485
  ]), i("mesh", {
3486
3486
  geometry: t,
@@ -3489,40 +3489,40 @@ let __tla = (async () => {
3489
3489
  vertexColors: true,
3490
3490
  transparent: true,
3491
3491
  opacity: 0.85,
3492
- side: U.DoubleSide,
3492
+ side: q.DoubleSide,
3493
3493
  depthWrite: false
3494
3494
  })
3495
3495
  });
3496
3496
  }
3497
- function Hr({ mesh: e, layers: o, landmarkPoints: t, componentDebug: n, aoData: s, aoGeometry: l, measurementGeometry: d }) {
3498
- const a = e.geometry, r = Q(() => a.getAttribute("position") ? Un(a) : null, [
3497
+ function Nr({ mesh: e, layers: o, landmarkPoints: t, componentDebug: n, aoData: s, aoGeometry: l, measurementGeometry: d }) {
3498
+ const a = e.geometry, r = te(() => a.getAttribute("position") ? Un(a) : null, [
3499
3499
  a
3500
- ]), c = Q(() => !t || t.length < 2 ? null : {
3501
- red: new M(t[1].position.x, t[1].position.y, t[1].position.z),
3502
- green: new M(t[0].position.x, t[0].position.y, t[0].position.z)
3500
+ ]), c = te(() => !t || t.length < 2 ? null : {
3501
+ red: new P(t[1].position.x, t[1].position.y, t[1].position.z),
3502
+ green: new P(t[0].position.x, t[0].position.y, t[0].position.z)
3503
3503
  }, [
3504
3504
  t
3505
3505
  ]);
3506
3506
  return y("group", {
3507
3507
  children: [
3508
- o.pcaAxes && r && i(Wr, {
3508
+ o.pcaAxes && r && i(Rr, {
3509
3509
  pca: r
3510
3510
  }),
3511
3511
  o.obb && r && i(_r, {
3512
3512
  pca: r
3513
3513
  }),
3514
- o.obbAxis && r && i(Br, {
3514
+ o.obbAxis && r && i($r, {
3515
3515
  pca: r,
3516
3516
  modelSize: r.halfExtents[0] ? Math.max(...r.halfExtents) * 2 : 100
3517
3517
  }),
3518
- o.shellComponents && n && i(Tr, {
3518
+ o.shellComponents && n && i(Or, {
3519
3519
  componentDebug: n
3520
3520
  }),
3521
- o.ambientOcclusion && s && s.length > 0 && i(Or, {
3521
+ o.ambientOcclusion && s && s.length > 0 && i(Hr, {
3522
3522
  geometry: l ?? a,
3523
3523
  aoData: s
3524
3524
  }),
3525
- o.circumferenceScan && c && i($r, {
3525
+ o.circumferenceScan && c && i(Tr, {
3526
3526
  geometry: a,
3527
3527
  redY: c.red.y,
3528
3528
  greenY: c.green.y,
@@ -3540,11 +3540,11 @@ let __tla = (async () => {
3540
3540
  depthWrite: false
3541
3541
  })
3542
3542
  }),
3543
- o.landmarkAxis && c && i(Rr, {
3543
+ o.landmarkAxis && c && i(Ir, {
3544
3544
  redPoint: c.red,
3545
3545
  greenPoint: c.green
3546
3546
  }),
3547
- o.iterativePCA && c && i(Ir, {
3547
+ o.iterativePCA && c && i(Br, {
3548
3548
  geometry: a,
3549
3549
  redY: c.red.y,
3550
3550
  greenY: c.green.y,
@@ -3559,8 +3559,8 @@ let __tla = (async () => {
3559
3559
  ]
3560
3560
  });
3561
3561
  }
3562
- function Nr({ mesh: e }) {
3563
- const o = e.geometry, t = Q(() => {
3562
+ function Vr({ mesh: e }) {
3563
+ const o = e.geometry, t = te(() => {
3564
3564
  if (!o.getAttribute("position")) return null;
3565
3565
  const l = Un(o), d = l.axes[0], a = l.halfExtents[0] * 1.3;
3566
3566
  return {
@@ -3573,7 +3573,7 @@ let __tla = (async () => {
3573
3573
  ]);
3574
3574
  if (!t) return null;
3575
3575
  const n = t.center.clone().addScaledVector(t.axis, t.halfLen), s = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3576
- return i(ye, {
3576
+ return i(ve, {
3577
3577
  points: [
3578
3578
  s,
3579
3579
  n
@@ -3645,10 +3645,10 @@ let __tla = (async () => {
3645
3645
  color: "#00ffff",
3646
3646
  group: "Alignment"
3647
3647
  }
3648
- ], Vr = [
3648
+ ], jr = [
3649
3649
  ...new Set(qn.map((e) => e.group))
3650
3650
  ];
3651
- function jr({ layers: e, onToggleLayer: o, isDoubleShell: t }) {
3651
+ function Xr({ layers: e, onToggleLayer: o, isDoubleShell: t }) {
3652
3652
  return y("div", {
3653
3653
  style: {
3654
3654
  position: "absolute",
@@ -3677,7 +3677,7 @@ let __tla = (async () => {
3677
3677
  },
3678
3678
  children: "Debug Layers"
3679
3679
  }),
3680
- Vr.map((n) => {
3680
+ jr.map((n) => {
3681
3681
  const s = qn.filter((l) => l.group === n && !(l.hideWhenDoubleShell && t));
3682
3682
  return s.length === 0 ? null : y("div", {
3683
3683
  children: [
@@ -3738,261 +3738,307 @@ let __tla = (async () => {
3738
3738
  ]
3739
3739
  });
3740
3740
  }
3741
- const Xr = ({ config: e, spacingType: o, scanUrl: t, formMeasurements: n, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: d, wasmModule: a, autoProcessOnTwoPoints: r = false }) => {
3742
- const [c, p] = B(null), [u, f] = B(0), [g, v] = B(false), [h, x] = B(false), [w, C] = B(""), [b, k] = B("3D"), [S, A] = B(o === "AK" ? 2 : 1), [z, _] = B(false), [E, H] = B(null), [P, I] = B(o ?? null), [L, $] = B("cm"), [j, te] = B(false), [se, oe] = B(""), [q, ie] = B("mm"), [Z, pe] = B(false), [ne, R] = B(false), [O, ee] = B(false), [J, N] = B(null), [K, fe] = B(null), [le, he] = B(null), [ue, we] = B(false), [T, ke] = B([]), [_e, Be] = B(null), [xe, Fe] = B(null), [zt, Mt] = B(null), [rt, Jt] = B(null), [Qn, Qt] = B(false), [it, en] = B(null), [Pt, De] = B(null), [Ie, eo] = B(false), [tn, to] = B(Lr), [Oe, nn] = B("obj"), [ze, Ft] = B(n), [He, kt] = B(true), [Ge, qe] = B(false), [Lt, on] = B(false), [st, lt] = B(false), Ye = de(false), [no, rn] = B(false), [Dt, sn] = B(() => {
3741
+ const Gr = ({ config: e, spacingType: o, scanUrl: t, formMeasurements: n, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: d, wasmModule: a, autoProcessOnTwoPoints: r = false }) => {
3742
+ const [c, u] = E(null), [p, f] = E(0), [m, v] = E(false), [h, x] = E(false), [w, C] = E(""), [b, F] = E("3D"), [S, A] = E(o === "AK" ? 2 : 1), [z, R] = E(false), [B, N] = E(null), [k, I] = E(o ?? null), [W, $] = E("cm"), [G, oe] = E(false), [ce, se] = E(""), [J, ae] = E("mm"), [U, ge] = E(false), [re, _] = E(false), [H, ne] = E(false), [Q, j] = E(null), [K, fe] = E(null), [ie, pe] = E(null), [he, Se] = E(false), [T, Le] = E([]), [ke, Ie] = E(null), [ye, Fe] = E(null), [Mt, Pt] = E(null), [rt, Qt] = E(null), [Qn, en] = E(false), [it, tn] = E(null), [kt, Re] = E(null), [Be, eo] = E(false), [nn, to] = E(Dr), [Oe, on] = E("obj"), [Pe, Ft] = E(n), [He, Lt] = E(true), [Ge, qe] = E(false), [Dt, rn] = E(false), [st, lt] = E(false), Ye = ue(false), [no, sn] = E(false), [Wt, ln] = E(() => {
3743
3743
  try {
3744
3744
  return localStorage.getItem("gm_helpTipDismissed") !== "1";
3745
3745
  } catch {
3746
3746
  return true;
3747
3747
  }
3748
3748
  });
3749
- Y(() => {
3750
- if (!Dt) return;
3751
- const m = setTimeout(() => {
3752
- sn(false);
3749
+ Z(() => {
3750
+ if (!Wt) return;
3751
+ const g = setTimeout(() => {
3752
+ ln(false);
3753
3753
  try {
3754
3754
  localStorage.setItem("gm_helpTipDismissed", "1");
3755
3755
  } catch {
3756
3756
  }
3757
3757
  }, 1e4);
3758
- return () => clearTimeout(m);
3758
+ return () => clearTimeout(g);
3759
3759
  }, [
3760
- Dt
3761
- ]), Y(() => {
3762
- if (!Z) return;
3763
- const m = setTimeout(() => pe(false), 5e3);
3764
- return () => clearTimeout(m);
3760
+ Wt
3761
+ ]), Z(() => {
3762
+ if (!U) return;
3763
+ const g = setTimeout(() => ge(false), 5e3);
3764
+ return () => clearTimeout(g);
3765
3765
  }, [
3766
- Z
3766
+ U
3767
3767
  ]);
3768
- const Wt = de(null), [Ne, oo] = B(0);
3769
- Y(() => {
3770
- if (!Wt.current) return;
3771
- const m = new ResizeObserver((F) => {
3772
- for (const D of F) oo(D.contentRect.width);
3768
+ const Rt = ue(null), [Ne, oo] = E(0);
3769
+ Z(() => {
3770
+ if (!Rt.current) return;
3771
+ const g = new ResizeObserver((M) => {
3772
+ for (const D of M) oo(D.contentRect.width);
3773
3773
  });
3774
- return m.observe(Wt.current), () => m.disconnect();
3774
+ return g.observe(Rt.current), () => g.disconnect();
3775
3775
  }, []);
3776
- const [ve, ro] = B(null), [io, so] = B(void 0), [lo, ao] = B(void 0), [co, fo] = B(void 0), [uo, po] = B(void 0), [ln] = B("#c8c8c8"), [ho] = B(1), [$e, go] = B(false), [_t, an] = B([]), at = de(null), Ve = de(null), ct = de(false), mo = de(null), Rt = de(null), It = de(null), Je = ce(async (m) => {
3777
- if (!It.current) return;
3778
- const F = (m == null ? void 0 : m.restoreView) ?? true;
3776
+ const [Ce, ro] = E(null), [io, so] = E(void 0), [lo, ao] = E(void 0), [co, fo] = E(void 0), [uo, po] = E(void 0), [an] = E("#c8c8c8"), [ho] = E(1), [$e, go] = E(false), [_t, cn] = E([]), at = ue(null), Ve = ue(null), ct = ue(false), mo = ue(null), It = ue(null), Bt = ue(null), Je = de(async (g) => {
3777
+ if (!Bt.current) return;
3778
+ const M = (g == null ? void 0 : g.restoreView) ?? true;
3779
3779
  try {
3780
- const D = It.current, W = () => {
3781
- const G = D.querySelector("canvas");
3782
- if (!G) return;
3783
- const me = D.getBoundingClientRect(), Pe = G.width, Me = G.height, Ce = Pe / me.width, tt = Me / me.height, pt = document.createElement("canvas");
3784
- pt.width = Pe, pt.height = Me;
3785
- const Ae = pt.getContext("2d");
3786
- return Ae.drawImage(G, 0, 0), D.querySelectorAll("[style*='pointer-events']").forEach((zo) => {
3787
- const bn = zo;
3780
+ const D = Bt.current, L = () => {
3781
+ const O = D.querySelector("canvas");
3782
+ if (!O) return;
3783
+ const ee = D.getBoundingClientRect(), me = O.width, be = O.height, ze = me / ee.width, tt = be / ee.height, ht = document.createElement("canvas");
3784
+ ht.width = me, ht.height = be;
3785
+ const Me = ht.getContext("2d");
3786
+ return Me.drawImage(O, 0, 0), D.querySelectorAll("[style*='pointer-events']").forEach((Mo) => {
3787
+ const bn = Mo;
3788
3788
  if (bn.hasAttribute("data-finalizing-overlay")) return;
3789
3789
  const yn = bn.querySelectorAll("div[style*='background']");
3790
3790
  yn.length !== 0 && yn.forEach((Ke) => {
3791
3791
  var _a;
3792
- const Re = Ke.getBoundingClientRect();
3793
- if (Re.width === 0 || Re.height === 0) return;
3794
- let jt = 0, nt = Ke;
3792
+ const _e = Ke.getBoundingClientRect();
3793
+ if (_e.width === 0 || _e.height === 0) return;
3794
+ let Xt = 0, nt = Ke;
3795
3795
  for (; nt && nt !== D; ) {
3796
- const mt = (nt.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3797
- if (mt) {
3798
- jt = parseFloat(mt[1]);
3796
+ const xt = (nt.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3797
+ if (xt) {
3798
+ Xt = parseFloat(xt[1]);
3799
3799
  break;
3800
3800
  }
3801
3801
  nt = nt.parentElement;
3802
3802
  }
3803
- const wn = (Re.left + Re.width / 2 - me.left) * Ce, vn = (Re.top + Re.height / 2 - me.top) * tt, ht = Math.abs(jt) > 1, Sn = (ht ? Re.height : Re.width) * Ce, Cn = (ht ? Re.width : Re.height) * tt;
3804
- Ae.save(), Ae.translate(wn, vn), ht && Ae.rotate(jt * Math.PI / 180);
3805
- const Mo = Ke.style.backgroundColor || "rgba(0,0,0,0.75)";
3806
- Ae.fillStyle = Mo;
3807
- const Po = 4 * Ce;
3808
- Ae.beginPath(), Ae.roundRect(-Sn / 2, -Cn / 2, Sn, Cn, Po), Ae.fill();
3803
+ const wn = (_e.left + _e.width / 2 - ee.left) * ze, vn = (_e.top + _e.height / 2 - ee.top) * tt, gt = Math.abs(Xt) > 1, Sn = (gt ? _e.height : _e.width) * ze, Cn = (gt ? _e.width : _e.height) * tt;
3804
+ Me.save(), Me.translate(wn, vn), gt && Me.rotate(Xt * Math.PI / 180);
3805
+ const Po = Ke.style.backgroundColor || "rgba(0,0,0,0.75)";
3806
+ Me.fillStyle = Po;
3807
+ const ko = 4 * ze;
3808
+ Me.beginPath(), Me.roundRect(-Sn / 2, -Cn / 2, Sn, Cn, ko), Me.fill();
3809
3809
  const An = ((_a = Ke.textContent) == null ? void 0 : _a.trim()) || "";
3810
3810
  if (An) {
3811
- const gt = window.getComputedStyle(Ke), mt = parseFloat(gt.fontSize || "14") * tt;
3812
- Ae.font = `${gt.fontWeight || "normal"} ${mt}px monospace`, Ae.fillStyle = gt.color || "#fff", Ae.textAlign = "center", Ae.textBaseline = "middle";
3811
+ const mt = window.getComputedStyle(Ke), xt = parseFloat(mt.fontSize || "14") * tt;
3812
+ Me.font = `${mt.fontWeight || "normal"} ${xt}px monospace`, Me.fillStyle = mt.color || "#fff", Me.textAlign = "center", Me.textBaseline = "middle";
3813
3813
  const zn = Ke.querySelectorAll("span");
3814
- zn.length > 0 && !ht ? zn.forEach((Xt) => {
3815
- const ot = Xt.getBoundingClientRect();
3814
+ zn.length > 0 && !gt ? zn.forEach((Gt) => {
3815
+ const ot = Gt.getBoundingClientRect();
3816
3816
  if (ot.width === 0) return;
3817
- const Fo = (ot.left + ot.width / 2 - me.left) * Ce - wn, ko = (ot.top + ot.height / 2 - me.top) * tt - vn, Gt = window.getComputedStyle(Xt), Lo = parseFloat(Gt.fontSize) * tt;
3818
- Ae.font = `${Gt.fontWeight || "normal"} ${Lo}px monospace`, Ae.fillStyle = Gt.color || "#fff", Ae.fillText(Xt.textContent || "", Fo, ko);
3819
- }) : Ae.fillText(An, 0, 0);
3817
+ const Fo = (ot.left + ot.width / 2 - ee.left) * ze - wn, Lo = (ot.top + ot.height / 2 - ee.top) * tt - vn, Yt = window.getComputedStyle(Gt), Do = parseFloat(Yt.fontSize) * tt;
3818
+ Me.font = `${Yt.fontWeight || "normal"} ${Do}px monospace`, Me.fillStyle = Yt.color || "#fff", Me.fillText(Gt.textContent || "", Fo, Lo);
3819
+ }) : Me.fillText(An, 0, 0);
3820
3820
  }
3821
- Ae.restore();
3821
+ Me.restore();
3822
3822
  });
3823
- }), pt.toDataURL("image/png");
3823
+ }), ht.toDataURL("image/png");
3824
3824
  };
3825
- Rt.current && Rt.current(), await new Promise((G) => requestAnimationFrame(() => requestAnimationFrame(G)));
3826
- const ae = W();
3827
- k("2D"), await new Promise((G) => setTimeout(G, 150)), await new Promise((G) => requestAnimationFrame(() => requestAnimationFrame(G)));
3828
- const X = W();
3829
- return F && k("3D"), !ae || !X ? void 0 : {
3830
- frontal_view_png: ae,
3825
+ It.current && It.current(), await new Promise((O) => requestAnimationFrame(() => requestAnimationFrame(O)));
3826
+ const Y = L();
3827
+ F("2D"), await new Promise((O) => setTimeout(O, 150)), await new Promise((O) => requestAnimationFrame(() => requestAnimationFrame(O)));
3828
+ const X = L();
3829
+ return M && F("3D"), !Y || !X ? void 0 : {
3830
+ frontal_view_png: Y,
3831
3831
  side_view_png: X
3832
3832
  };
3833
3833
  } catch {
3834
3834
  return;
3835
3835
  }
3836
- }, []), Se = ce((m) => {
3837
- const F = /* @__PURE__ */ new Date(), D = `${String(F.getHours()).padStart(2, "0")}:${String(F.getMinutes()).padStart(2, "0")}:${String(F.getSeconds()).padStart(2, "0")}.${String(F.getMilliseconds()).padStart(3, "0")}`;
3838
- an((W) => [
3839
- ...W.slice(-200),
3840
- `[${D}] ${m}`
3836
+ }, []), Ae = de((g) => {
3837
+ const M = /* @__PURE__ */ new Date(), D = `${String(M.getHours()).padStart(2, "0")}:${String(M.getMinutes()).padStart(2, "0")}:${String(M.getSeconds()).padStart(2, "0")}.${String(M.getMilliseconds()).padStart(3, "0")}`;
3838
+ cn((L) => [
3839
+ ...L.slice(-200),
3840
+ `[${D}] ${g}`
3841
3841
  ]);
3842
- }, []), { landmarkPoints: V, clearLandmarkPoints: xo, addLandmarkPoint: cn, removeLandmarkPoint: dn, undoLastLandmarkPoint: Et, updateLandmarkPositions: fn, setAligned: un, isAligned: re, setCut: pn, isCut: Bt, reset: dt } = qt();
3843
- Y(() => {
3844
- dt();
3842
+ }, []), { landmarkPoints: V, clearLandmarkPoints: xo, addLandmarkPoint: dn, removeLandmarkPoint: fn, undoLastLandmarkPoint: Et, updateLandmarkPositions: dt, setAligned: un, isAligned: le, setCut: pn, isCut: $t, reset: ft } = Jt();
3843
+ Z(() => {
3844
+ ft();
3845
3845
  }, [
3846
- dt
3846
+ ft
3847
3847
  ]);
3848
- const ft = S * wt;
3849
- Y(() => {
3848
+ const ut = S * vt;
3849
+ Z(() => {
3850
3850
  if (!l || V.length === 0) return;
3851
- const m = V[V.length - 1];
3852
- Se(`LANDMARK[${V.length - 1}]: placed at (${m.position.x.toFixed(1)}, ${m.position.y.toFixed(1)}, ${m.position.z.toFixed(1)}) face=${m.faceIndex}`);
3851
+ const g = V[V.length - 1];
3852
+ Ae(`LANDMARK[${V.length - 1}]: placed at (${g.position.x.toFixed(1)}, ${g.position.y.toFixed(1)}, ${g.position.z.toFixed(1)}) face=${g.faceIndex}`);
3853
3853
  }, [
3854
3854
  V.length,
3855
3855
  l,
3856
- Se
3857
- ]), Y(() => {
3858
- l && re && Se("STATE: mesh aligned");
3856
+ Ae
3857
+ ]), Z(() => {
3858
+ l && le && Ae("STATE: mesh aligned");
3859
3859
  }, [
3860
- re,
3860
+ le,
3861
3861
  l,
3862
- Se
3863
- ]), Y(() => {
3864
- const m = (F) => {
3862
+ Ae
3863
+ ]), Z(() => {
3864
+ const g = (M) => {
3865
3865
  var _a;
3866
- if (F.key !== "z" && F.key !== "Z" || !(F.ctrlKey || F.metaKey) || F.shiftKey || F.altKey) return;
3867
- const D = ((_a = F.composedPath) == null ? void 0 : _a.call(F)[0]) ?? F.target, W = D == null ? void 0 : D.tagName;
3868
- W === "INPUT" || W === "TEXTAREA" || (D == null ? void 0 : D.isContentEditable) || !c || re || V.length === 0 || (F.preventDefault(), Et(), Se(`UNDO: removed landmark point ${V.length - 1}`));
3866
+ if (M.key !== "z" && M.key !== "Z" || !(M.ctrlKey || M.metaKey) || M.shiftKey || M.altKey) return;
3867
+ const D = ((_a = M.composedPath) == null ? void 0 : _a.call(M)[0]) ?? M.target, L = D == null ? void 0 : D.tagName;
3868
+ L === "INPUT" || L === "TEXTAREA" || (D == null ? void 0 : D.isContentEditable) || !c || le || V.length === 0 || (M.preventDefault(), Et(), Ae(`UNDO: removed landmark point ${V.length - 1}`));
3869
3869
  };
3870
- return document.addEventListener("keydown", m, true), () => document.removeEventListener("keydown", m, true);
3870
+ return document.addEventListener("keydown", g, true), () => document.removeEventListener("keydown", g, true);
3871
3871
  }, [
3872
3872
  c,
3873
- re,
3873
+ le,
3874
3874
  V.length,
3875
3875
  Et,
3876
- Se
3877
- ]), Y(() => {
3878
- l && Bt && Se("STATE: mesh cut");
3876
+ Ae
3877
+ ]), Z(() => {
3878
+ l && $t && Ae("STATE: mesh cut");
3879
3879
  }, [
3880
- Bt,
3880
+ $t,
3881
3881
  l,
3882
- Se
3883
- ]), Y(() => {
3882
+ Ae
3883
+ ]);
3884
+ const bo = de(() => {
3885
+ if (!c) return;
3886
+ const g = (L) => {
3887
+ const Y = L.clone();
3888
+ Y.scale(-1, 1, 1);
3889
+ const X = Y.getIndex();
3890
+ if (X) {
3891
+ const O = X.array;
3892
+ for (let ee = 0; ee < O.length; ee += 3) {
3893
+ const me = O[ee];
3894
+ O[ee] = O[ee + 2], O[ee + 2] = me;
3895
+ }
3896
+ X.needsUpdate = true;
3897
+ } else {
3898
+ const O = Y.getAttribute("position"), ee = O.array;
3899
+ for (let me = 0; me < ee.length; me += 9) for (let be = 0; be < 3; be++) {
3900
+ const ze = ee[me + be];
3901
+ ee[me + be] = ee[me + 6 + be], ee[me + 6 + be] = ze;
3902
+ }
3903
+ O.needsUpdate = true;
3904
+ }
3905
+ return Y.computeVertexNormals(), Y.computeBoundingBox(), Y.computeBoundingSphere(), Y;
3906
+ }, M = g(c.geometry), D = new q.Mesh(M, c.material);
3907
+ if (u(D), ie && pe(g(ie)), K && fe(g(K)), ke) {
3908
+ const L = new Float32Array(ke.allLoopPoints);
3909
+ for (let Y = 0; Y < L.length; Y += 3) L[Y] = -L[Y];
3910
+ Ie({
3911
+ ...ke,
3912
+ allLoopPoints: L
3913
+ });
3914
+ }
3915
+ V.length > 0 && dt(V.map((L) => ({
3916
+ x: -L.position.x,
3917
+ y: L.position.y,
3918
+ z: L.position.z
3919
+ }))), Ae("MIRROR: flipped scan across X axis (alignment preserved)");
3920
+ }, [
3921
+ c,
3922
+ ie,
3923
+ K,
3924
+ ke,
3925
+ V,
3926
+ dt,
3927
+ Ae
3928
+ ]);
3929
+ Z(() => {
3884
3930
  at.current && (at.current.scrollTop = at.current.scrollHeight);
3885
3931
  }, [
3886
3932
  _t
3887
3933
  ]);
3888
- const Te = Q(() => le ? new U.Mesh(le) : null, [
3889
- le
3934
+ const Te = te(() => ie ? new q.Mesh(ie) : null, [
3935
+ ie
3890
3936
  ]);
3891
- Y(() => () => {
3937
+ Z(() => () => {
3892
3938
  c && c.geometry.dispose();
3893
3939
  }, [
3894
3940
  c
3895
- ]), Y(() => () => {
3896
- le && le.dispose();
3941
+ ]), Z(() => () => {
3942
+ ie && ie.dispose();
3897
3943
  }, [
3898
- le
3899
- ]), Y(() => () => {
3944
+ ie
3945
+ ]), Z(() => () => {
3900
3946
  K && K.dispose();
3901
3947
  }, [
3902
3948
  K
3903
- ]), Y(() => () => {
3904
- E && E.geometry.dispose();
3949
+ ]), Z(() => () => {
3950
+ B && B.geometry.dispose();
3905
3951
  }, [
3906
- E
3907
- ]), Y(() => {
3952
+ B
3953
+ ]), Z(() => {
3908
3954
  n && Ft(n);
3909
3955
  }, [
3910
3956
  n
3911
- ]), Y(() => {
3957
+ ]), Z(() => {
3912
3958
  n || Ft(void 0);
3913
3959
  }, [
3914
3960
  S
3915
3961
  ]);
3916
- const ut = de(false);
3917
- Y(() => {
3918
- if (!re || T.length === 0 || ut.current || !d) return;
3919
- ut.current = true;
3920
- const m = V.length >= 3 ? Math.abs(V[2].position.y - V[0].position.y) : null;
3962
+ const pt = ue(false);
3963
+ Z(() => {
3964
+ if (!le || T.length === 0 || pt.current || !d) return;
3965
+ pt.current = true;
3966
+ const g = V.length >= 3 ? Math.abs(V[2].position.y - V[0].position.y) : null;
3921
3967
  d("dimensions_calculated", {
3922
- spacing_type: P,
3968
+ spacing_type: k,
3923
3969
  source_unit: "mm",
3924
3970
  file_format: Oe,
3925
3971
  measurement_source: "scan_derived",
3926
- is_double_wall: ne,
3972
+ is_double_wall: re,
3927
3973
  is_unit_converted: false,
3928
- form_measurements: (ze == null ? void 0 : ze.filter((F) => F != null)) ?? null,
3929
- scan_measurements: T.map((F) => +(F.modifiedValue ?? F.originalValue).toFixed(1)),
3930
- measurement_variance: ze ? T.map((F, D) => {
3931
- const W = ze[D];
3932
- return W == null ? null : +((F.modifiedValue ?? F.originalValue) - W).toFixed(1);
3974
+ form_measurements: (Pe == null ? void 0 : Pe.filter((M) => M != null)) ?? null,
3975
+ scan_measurements: T.map((M) => +(M.modifiedValue ?? M.originalValue).toFixed(1)),
3976
+ measurement_variance: Pe ? T.map((M, D) => {
3977
+ const L = Pe[D];
3978
+ return L == null ? null : +((M.modifiedValue ?? M.originalValue) - L).toFixed(1);
3933
3979
  }) : null,
3934
- frontal_height: m !== null ? +m.toFixed(1) : null
3980
+ frontal_height: g !== null ? +g.toFixed(1) : null
3935
3981
  });
3936
3982
  }, [
3937
- re,
3983
+ le,
3938
3984
  T
3939
- ]), Y(() => {
3985
+ ]), Z(() => {
3940
3986
  a !== void 0 && (Ve.current = a), a !== void 0 && go(true);
3941
3987
  }, [
3942
3988
  a
3943
3989
  ]);
3944
- const Qe = ce((m, F) => {
3945
- m.computeBoundingBox();
3946
- const D = m.boundingBox, W = new M();
3947
- D.getCenter(W), m.translate(-W.x, -W.y, -W.z), m.computeBoundingBox();
3948
- const ae = m.boundingBox, X = new M();
3949
- ae.getSize(X), f(Math.max(X.x, X.y, X.z));
3950
- const G = new U.Mesh(m, new U.MeshStandardMaterial({
3990
+ const Qe = de((g, M) => {
3991
+ g.computeBoundingBox();
3992
+ const D = g.boundingBox, L = new P();
3993
+ D.getCenter(L), g.translate(-L.x, -L.y, -L.z), g.computeBoundingBox();
3994
+ const Y = g.boundingBox, X = new P();
3995
+ Y.getSize(X), f(Math.max(X.x, X.y, X.z));
3996
+ const O = new q.Mesh(g, new q.MeshStandardMaterial({
3951
3997
  color: 8947848,
3952
- side: U.DoubleSide
3998
+ side: q.DoubleSide
3953
3999
  }));
3954
- p(G), ie(F), pe(true), ee(false), ct.current = false;
3955
- }, []), Ee = ce(async (m, F) => {
3956
- De(null);
3957
- const D = F.toLowerCase(), W = D.endsWith(".stl"), ae = D.endsWith(".obj"), X = D.endsWith(".aop");
3958
- if (!ae && !W && !X) {
3959
- De("Unsupported file format. Please use OBJ, STL, or AOP.");
4000
+ u(O), ae(M), ge(true), ne(false), ct.current = false;
4001
+ }, []), Ee = de(async (g, M) => {
4002
+ Re(null);
4003
+ const D = M.toLowerCase(), L = D.endsWith(".stl"), Y = D.endsWith(".obj"), X = D.endsWith(".aop");
4004
+ if (!Y && !L && !X) {
4005
+ Re("Unsupported file format. Please use OBJ, STL, or AOP.");
3960
4006
  return;
3961
4007
  }
3962
- nn(W ? "stl" : X ? "aop" : "obj"), x(true), C("Processing file..."), Se(`FILE_LOAD: ${F} (${W ? "STL" : X ? "AOP" : "OBJ"})`);
4008
+ on(L ? "stl" : X ? "aop" : "obj"), x(true), C("Processing file..."), Ae(`FILE_LOAD: ${M} (${L ? "STL" : X ? "AOP" : "OBJ"})`);
3963
4009
  try {
3964
- let G;
3965
- if (W) {
4010
+ let O;
4011
+ if (L) {
3966
4012
  C("Converting STL...");
3967
- const Me = new Blob([
3968
- m
3969
- ]), Ce = new File([
3970
- Me
3971
- ], F);
3972
- G = await Fn(Ce);
4013
+ const be = new Blob([
4014
+ g
4015
+ ]), ze = new File([
4016
+ be
4017
+ ], M);
4018
+ O = await kn(ze);
3973
4019
  } else if (X) {
3974
4020
  C("Extracting AOP...");
3975
- const Me = new Blob([
3976
- m
3977
- ]), Ce = new File([
3978
- Me
3979
- ], F);
3980
- G = await Zo(Ce);
3981
- } else G = typeof m == "string" ? m : new TextDecoder().decode(m);
3982
- const me = performance.now(), Pe = Ve.current ? await Yo(G, Ve.current, (Me) => {
3983
- C(Me), Se(`PREPROCESS: ${Me}`);
4021
+ const be = new Blob([
4022
+ g
4023
+ ]), ze = new File([
4024
+ be
4025
+ ], M);
4026
+ O = await Uo(ze);
4027
+ } else O = typeof g == "string" ? g : new TextDecoder().decode(g);
4028
+ const ee = performance.now(), me = Ve.current ? await Ko(O, Ve.current, (be) => {
4029
+ C(be), Ae(`PREPROCESS: ${be}`);
3984
4030
  }) : null;
3985
- if (Pe) Se(`PREPROCESS: done in ${(performance.now() - me).toFixed(0)}ms \u2014 unit=${Pe.detectedUnit}, scaled=${Pe.wasScaled}`), e.showAmputationModal && !o ? (H(Pe), _(true)) : Qe(Pe.geometry, Pe.detectedUnit);
4031
+ if (me) Ae(`PREPROCESS: done in ${(performance.now() - ee).toFixed(0)}ms \u2014 unit=${me.detectedUnit}, scaled=${me.wasScaled}`), e.showAmputationModal && !o ? (N(me), R(true)) : Qe(me.geometry, me.detectedUnit);
3986
4032
  else {
3987
4033
  C("Using fallback loader...");
3988
- const Me = Ko(G);
3989
- Me ? e.showAmputationModal && !o ? (H({
3990
- geometry: Me,
4034
+ const be = Zo(O);
4035
+ be ? e.showAmputationModal && !o ? (N({
4036
+ geometry: be,
3991
4037
  detectedUnit: "mm"
3992
- }), _(true)) : Qe(Me, "mm") : De("Failed to parse the mesh.");
4038
+ }), R(true)) : Qe(be, "mm") : Re("Failed to parse the mesh.");
3993
4039
  }
3994
- } catch (G) {
3995
- De(G instanceof Error ? G.message : "Failed to process the mesh file.");
4040
+ } catch (O) {
4041
+ Re(O instanceof Error ? O.message : "Failed to process the mesh file.");
3996
4042
  } finally {
3997
4043
  x(false), C("");
3998
4044
  }
@@ -4002,195 +4048,195 @@ let __tla = (async () => {
4002
4048
  o,
4003
4049
  Qe
4004
4050
  ]);
4005
- Y(() => {
4051
+ Z(() => {
4006
4052
  if (!t || !$e) return;
4007
4053
  (async () => {
4008
4054
  x(true), C("Loading scan...");
4009
4055
  try {
4010
- const F = await fetch(t);
4011
- if (!F.ok) throw new Error(`Failed to download scan: ${F.status}`);
4012
- const W = new URL(t).pathname.split("/").pop() || "scan.obj", ae = W.toLowerCase();
4013
- if (ae.endsWith(".stl") || ae.endsWith(".aop")) {
4014
- const G = await F.arrayBuffer();
4015
- await Ee(G, W);
4056
+ const M = await fetch(t);
4057
+ if (!M.ok) throw new Error(`Failed to download scan: ${M.status}`);
4058
+ const L = new URL(t).pathname.split("/").pop() || "scan.obj", Y = L.toLowerCase();
4059
+ if (Y.endsWith(".stl") || Y.endsWith(".aop")) {
4060
+ const O = await M.arrayBuffer();
4061
+ await Ee(O, L);
4016
4062
  } else {
4017
- const G = await F.text();
4018
- await Ee(G, W);
4063
+ const O = await M.text();
4064
+ await Ee(O, L);
4019
4065
  }
4020
- } catch (F) {
4021
- De(F instanceof Error ? F.message : "Failed to load scan from URL."), x(false), C("");
4066
+ } catch (M) {
4067
+ Re(M instanceof Error ? M.message : "Failed to load scan from URL."), x(false), C("");
4022
4068
  }
4023
4069
  })();
4024
4070
  }, [
4025
4071
  t,
4026
4072
  $e
4027
4073
  ]);
4028
- const bo = ce((m) => {
4029
- m.preventDefault(), v(true);
4030
- }, []), yo = ce((m) => {
4031
- m.preventDefault(), v(false);
4032
- }, []), wo = ce(async (m) => {
4033
- if (m.preventDefault(), v(false), !$e) {
4034
- De("WASM module is still loading. Please wait.");
4074
+ const yo = de((g) => {
4075
+ g.preventDefault(), v(true);
4076
+ }, []), wo = de((g) => {
4077
+ g.preventDefault(), v(false);
4078
+ }, []), vo = de(async (g) => {
4079
+ if (g.preventDefault(), v(false), !$e) {
4080
+ Re("WASM module is still loading. Please wait.");
4035
4081
  return;
4036
4082
  }
4037
- const F = m.dataTransfer.files[0];
4038
- if (!F) return;
4039
- const D = F.name.toLowerCase();
4083
+ const M = g.dataTransfer.files[0];
4084
+ if (!M) return;
4085
+ const D = M.name.toLowerCase();
4040
4086
  if (!D.endsWith(".obj") && !D.endsWith(".stl") && !D.endsWith(".aop")) {
4041
- De("Please drop an OBJ, STL, or AOP file.");
4087
+ Re("Please drop an OBJ, STL, or AOP file.");
4042
4088
  return;
4043
4089
  }
4044
- if (D.endsWith(".aop")) await Ee(await F.arrayBuffer(), F.name);
4090
+ if (D.endsWith(".aop")) await Ee(await M.arrayBuffer(), M.name);
4045
4091
  else if (D.endsWith(".stl")) {
4046
- nn("stl"), x(true), C("Converting STL...");
4092
+ on("stl"), x(true), C("Converting STL...");
4047
4093
  try {
4048
- const W = await Fn(F);
4049
- await Ee(W, F.name.replace(/\.stl$/i, ".obj"));
4050
- } catch (W) {
4051
- De(W instanceof Error ? W.message : "Failed to process STL file."), x(false), C("");
4094
+ const L = await kn(M);
4095
+ await Ee(L, M.name.replace(/\.stl$/i, ".obj"));
4096
+ } catch (L) {
4097
+ Re(L instanceof Error ? L.message : "Failed to process STL file."), x(false), C("");
4052
4098
  }
4053
4099
  } else {
4054
- const W = await F.text();
4055
- await Ee(W, F.name);
4100
+ const L = await M.text();
4101
+ await Ee(L, M.name);
4056
4102
  }
4057
4103
  }, [
4058
4104
  $e,
4059
4105
  Ee
4060
- ]), vo = ce((m) => {
4061
- I(m), A(m === "AK" ? 2 : 1), _(false), E && (Qe(E.geometry, E.detectedUnit), H(null)), d == null ? void 0 : d("file_loaded", {
4062
- spacing_type: m,
4106
+ ]), So = de((g) => {
4107
+ I(g), A(g === "AK" ? 2 : 1), R(false), B && (Qe(B.geometry, B.detectedUnit), N(null)), d == null ? void 0 : d("file_loaded", {
4108
+ spacing_type: g,
4063
4109
  file_format: Oe,
4064
4110
  is_double_wall: false
4065
4111
  });
4066
4112
  }, [
4067
- E,
4113
+ B,
4068
4114
  Qe,
4069
4115
  d,
4070
4116
  Oe
4071
4117
  ]);
4072
- Y(() => {
4118
+ Z(() => {
4073
4119
  if (!c || V.length !== 1 || !Ve.current || ct.current) return;
4074
4120
  ct.current = true;
4075
- const m = V[0], F = Ve.current, D = c.geometry, { positions: W, indices: ae } = vt(D), X = new Float32Array([
4076
- m.position.x,
4077
- m.position.y,
4078
- m.position.z
4079
- ]), G = F.detect_shell(W, ae, X, 40), me = G.details(), Pe = G.is_double_shell();
4080
- Se(`SHELL_DETECT: ${Pe ? "DOUBLE" : "SINGLE"} \u2014 ${me}`), Pe && (R(true), we(true), Se(`SHELL_DETECT: double shell, thickness=${G.thickness().toFixed(1)}mm`));
4121
+ const g = V[0], M = Ve.current, D = c.geometry, { positions: L, indices: Y } = St(D), X = new Float32Array([
4122
+ g.position.x,
4123
+ g.position.y,
4124
+ g.position.z
4125
+ ]), O = M.detect_shell(L, Y, X, 40), ee = O.details(), me = O.is_double_shell();
4126
+ Ae(`SHELL_DETECT: ${me ? "DOUBLE" : "SINGLE"} \u2014 ${ee}`), me && (_(true), Se(true), Ae(`SHELL_DETECT: double shell, thickness=${O.thickness().toFixed(1)}mm`));
4081
4127
  }, [
4082
4128
  c,
4083
4129
  V,
4084
- Se
4130
+ Ae
4085
4131
  ]);
4086
- const $t = ce(() => {
4132
+ const Tt = de(() => {
4087
4133
  if (!c || V.length < 2) return;
4088
- te(true), oe("Please wait..."), Se("PIPELINE: starting processing pipeline...");
4089
- const m = performance.now();
4134
+ oe(true), se("Please wait..."), Ae("PIPELINE: starting processing pipeline...");
4135
+ const g = performance.now();
4090
4136
  setTimeout(() => {
4091
- const F = [
4137
+ const M = [
4092
4138
  V[1],
4093
4139
  V[0],
4094
4140
  ...V.slice(2)
4095
4141
  ];
4096
- tr(c, F, wt, {
4142
+ nr(c, M, vt, {
4097
4143
  onStatus: (D) => {
4098
- oe(D), Se(`PIPELINE: ${D}`);
4144
+ se(D), Ae(`PIPELINE: ${D}`);
4099
4145
  },
4100
- addLandmarkPoint: cn,
4101
- removeLandmarkPoint: dn,
4146
+ addLandmarkPoint: dn,
4147
+ removeLandmarkPoint: fn,
4102
4148
  updateLandmarkPositions: (D) => {
4103
- const W = [
4149
+ const L = [
4104
4150
  D[1],
4105
4151
  D[0],
4106
4152
  ...D.slice(2)
4107
4153
  ];
4108
- fn(W);
4154
+ dt(L);
4109
4155
  },
4110
4156
  setAligned: un,
4111
4157
  setCut: pn,
4112
4158
  setModelSize: f,
4113
- setOriginalEndY: Jt,
4159
+ setOriginalEndY: Qt,
4114
4160
  setAdjustedStartY: Fe,
4115
- setAdjustedEndY: Mt,
4116
- setError: De,
4161
+ setAdjustedEndY: Pt,
4162
+ setError: Re,
4117
4163
  setDoubleShell: (D) => {
4118
- R(D), we(true);
4164
+ _(D), Se(true);
4119
4165
  },
4120
- setAoData: (D, W) => {
4121
- N(D), fe(W ?? null);
4166
+ setAoData: (D, L) => {
4167
+ j(D), fe(L ?? null);
4122
4168
  },
4123
- setInnerShellExtracted: ee,
4124
- setMeasurementGeometry: he,
4125
- setWasmSlices: Be,
4169
+ setInnerShellExtracted: ne,
4170
+ setMeasurementGeometry: pe,
4171
+ setWasmSlices: Ie,
4126
4172
  wasmModule: Ve.current ?? void 0
4127
- }), Se(`PIPELINE: completed in ${(performance.now() - m).toFixed(0)}ms`), ut.current = false, te(false);
4173
+ }), Ae(`PIPELINE: completed in ${(performance.now() - g).toFixed(0)}ms`), pt.current = false, oe(false);
4128
4174
  }, 50);
4129
4175
  }, [
4130
4176
  c,
4131
4177
  V,
4132
- fn,
4178
+ dt,
4133
4179
  un,
4134
- cn,
4135
4180
  dn,
4181
+ fn,
4136
4182
  pn,
4137
- O
4138
- ]), Tt = de(false);
4139
- Y(() => {
4140
- r && (Tt.current || !c || re || j || V.length < 2 || (Tt.current = true, $t()));
4183
+ H
4184
+ ]), Ot = ue(false);
4185
+ Z(() => {
4186
+ r && (Ot.current || !c || le || G || V.length < 2 || (Ot.current = true, Tt()));
4141
4187
  }, [
4142
4188
  r,
4143
4189
  c,
4144
4190
  V.length,
4145
- re,
4146
- j,
4147
- $t
4148
- ]), Y(() => {
4149
- V.length < 2 && (Tt.current = false);
4191
+ le,
4192
+ G,
4193
+ Tt
4194
+ ]), Z(() => {
4195
+ V.length < 2 && (Ot.current = false);
4150
4196
  }, [
4151
4197
  V.length
4152
4198
  ]);
4153
- const Ot = de(false), So = ce(async () => {
4154
- if (dt(), ke([]), Be(null), he(null), Fe(null), Mt(null), en(null), Jt(null), qe(false), on(false), kt(true), R(false), ee(false), ct.current = false, Ot.current = false, ut.current = false, k("3D"), t && $e) {
4155
- p(null);
4199
+ const Ht = ue(false), Co = de(async () => {
4200
+ if (ft(), Le([]), Ie(null), pe(null), Fe(null), Pt(null), tn(null), Qt(null), qe(false), rn(false), Lt(true), _(false), ne(false), ct.current = false, Ht.current = false, pt.current = false, F("3D"), t && $e) {
4201
+ u(null);
4156
4202
  try {
4157
- const m = await fetch(t);
4158
- if (!m.ok) throw new Error(`Failed to download scan: ${m.status}`);
4159
- const D = new URL(t).pathname.split("/").pop() || "scan.obj", W = D.toLowerCase();
4160
- W.endsWith(".stl") || W.endsWith(".aop") ? await Ee(await m.arrayBuffer(), D) : await Ee(await m.text(), D);
4161
- } catch (m) {
4162
- De(m instanceof Error ? m.message : "Failed to reload scan.");
4203
+ const g = await fetch(t);
4204
+ if (!g.ok) throw new Error(`Failed to download scan: ${g.status}`);
4205
+ const D = new URL(t).pathname.split("/").pop() || "scan.obj", L = D.toLowerCase();
4206
+ L.endsWith(".stl") || L.endsWith(".aop") ? await Ee(await g.arrayBuffer(), D) : await Ee(await g.text(), D);
4207
+ } catch (g) {
4208
+ Re(g instanceof Error ? g.message : "Failed to reload scan.");
4163
4209
  }
4164
4210
  }
4165
4211
  }, [
4166
4212
  t,
4167
4213
  $e,
4168
4214
  Ee,
4169
- dt
4215
+ ft
4170
4216
  ]);
4171
- Y(() => {
4172
- re && T.length > 0 && !Ot.current && (Ot.current = true, qe(true));
4217
+ Z(() => {
4218
+ le && T.length > 0 && !Ht.current && (Ht.current = true, qe(true));
4173
4219
  }, [
4174
- re,
4220
+ le,
4175
4221
  T.length
4176
4222
  ]);
4177
- const { scanTransverseML: Ht, scanTransverseAP: Nt } = Q(() => {
4178
- if (!c || !re || V.length < 1) return {
4223
+ const { scanTransverseML: Nt, scanTransverseAP: Vt } = te(() => {
4224
+ if (!c || !le || V.length < 1) return {
4179
4225
  scanTransverseML: 0,
4180
4226
  scanTransverseAP: 0
4181
4227
  };
4182
4228
  try {
4183
- const m = (Te ?? c).geometry, F = V[0].position.y, D = Ut(m), W = je(D, m, F);
4184
- if (W.linePoints.length < 2) return {
4229
+ const g = (Te ?? c).geometry, M = V[0].position.y, D = qt(g), L = je(D, g, M);
4230
+ if (L.linePoints.length < 2) return {
4185
4231
  scanTransverseML: 0,
4186
4232
  scanTransverseAP: 0
4187
4233
  };
4188
- let ae = W.linePoints[0], X = W.linePoints[0], G = W.linePoints[0], me = W.linePoints[0];
4189
- for (const Ce of W.linePoints) Ce.x < ae.x && (ae = Ce), Ce.x > X.x && (X = Ce), Ce.z < G.z && (G = Ce), Ce.z > me.z && (me = Ce);
4190
- const Pe = new M(ae.x, F, ae.z).distanceTo(new M(X.x, F, X.z)), Me = new M(G.x, F, G.z).distanceTo(new M(me.x, F, me.z));
4234
+ let Y = L.linePoints[0], X = L.linePoints[0], O = L.linePoints[0], ee = L.linePoints[0];
4235
+ for (const ze of L.linePoints) ze.x < Y.x && (Y = ze), ze.x > X.x && (X = ze), ze.z < O.z && (O = ze), ze.z > ee.z && (ee = ze);
4236
+ const me = new P(Y.x, M, Y.z).distanceTo(new P(X.x, M, X.z)), be = new P(O.x, M, O.z).distanceTo(new P(ee.x, M, ee.z));
4191
4237
  return {
4192
- scanTransverseML: Pe,
4193
- scanTransverseAP: Me
4238
+ scanTransverseML: me,
4239
+ scanTransverseAP: be
4194
4240
  };
4195
4241
  } catch {
4196
4242
  return {
@@ -4201,53 +4247,53 @@ let __tla = (async () => {
4201
4247
  }, [
4202
4248
  c,
4203
4249
  Te,
4204
- re,
4250
+ le,
4205
4251
  V
4206
- ]), et = Q(() => {
4252
+ ]), et = te(() => {
4207
4253
  var _a;
4208
4254
  if (!c || V.length < 1) return 0;
4209
- const m = c.geometry;
4210
- m.computeBoundingBox();
4211
- const F = ((_a = m.boundingBox) == null ? void 0 : _a.min.y) ?? 0, D = V[0].position.y;
4212
- if (ne && V.length >= 3) {
4213
- const W = Math.abs(D - V[2].position.y);
4214
- if (W > 0.5) return W;
4255
+ const g = c.geometry;
4256
+ g.computeBoundingBox();
4257
+ const M = ((_a = g.boundingBox) == null ? void 0 : _a.min.y) ?? 0, D = V[0].position.y;
4258
+ if (re && V.length >= 3) {
4259
+ const L = Math.abs(D - V[2].position.y);
4260
+ if (L > 0.5) return L;
4215
4261
  }
4216
- return Math.abs(D - F);
4262
+ return Math.abs(D - M);
4217
4263
  }, [
4218
4264
  c,
4219
4265
  V,
4220
- ne
4221
- ]), Co = ce((m) => {
4222
- ro(m), Ft(m.circumferences), kt(true), on(true), qe(false);
4223
- }, []), be = (m) => m == null ? m : +(m / 10).toFixed(2), hn = ce(async (m) => {
4266
+ re
4267
+ ]), Ao = de((g) => {
4268
+ ro(g), Ft(g.circumferences), Lt(true), rn(true), qe(false);
4269
+ }, []), we = (g) => g == null ? g : +(g / 10).toFixed(2), hn = de(async (g) => {
4224
4270
  if (!s || Ye.current) return;
4225
- Ye.current = true, qe(false), rn(false), lt(true), await new Promise((D) => requestAnimationFrame(() => requestAnimationFrame(() => D())));
4226
- const F = c ? await Je({
4271
+ Ye.current = true, qe(false), sn(false), lt(true), await new Promise((D) => requestAnimationFrame(() => requestAnimationFrame(() => D())));
4272
+ const M = c ? await Je({
4227
4273
  restoreView: false
4228
4274
  }).catch(() => {
4229
4275
  }) : void 0;
4230
4276
  try {
4231
4277
  s({
4232
- spacingType: P ?? "BK",
4278
+ spacingType: k ?? "BK",
4233
4279
  sourceUnit: "cm",
4234
4280
  fileFormat: Oe,
4235
4281
  measurementSource: "form_provided",
4236
- isDoubleWall: ne,
4282
+ isDoubleWall: re,
4237
4283
  isUnitConverted: false,
4238
- formMeasurements: ze == null ? void 0 : ze.map((D) => be(D)),
4284
+ formMeasurements: Pe == null ? void 0 : Pe.map((D) => we(D)),
4239
4285
  scanMeasurements: T.map((D) => ({
4240
4286
  yPosition: D.yPosition,
4241
- originalValue: be(D.originalValue),
4242
- modifiedValue: D.modifiedValue == null ? null : be(D.modifiedValue)
4287
+ originalValue: we(D.originalValue),
4288
+ modifiedValue: D.modifiedValue == null ? null : we(D.modifiedValue)
4243
4289
  })),
4244
- frontalHeight: be(et),
4290
+ frontalHeight: we(et),
4245
4291
  transverseML: 0,
4246
4292
  transverseAP: 0,
4247
4293
  scanUrl: t,
4248
4294
  decision: "skip",
4249
- skipReason: m,
4250
- screenshots: F,
4295
+ skipReason: g,
4296
+ screenshots: M,
4251
4297
  alignedGeometry: c == null ? void 0 : c.geometry
4252
4298
  });
4253
4299
  } finally {
@@ -4256,67 +4302,67 @@ let __tla = (async () => {
4256
4302
  }, [
4257
4303
  s,
4258
4304
  c,
4259
- P,
4305
+ k,
4260
4306
  Oe,
4261
- ne,
4262
- ze,
4307
+ re,
4308
+ Pe,
4263
4309
  T,
4264
4310
  et,
4265
4311
  t,
4266
4312
  Je
4267
- ]), gn = de(null);
4268
- Y(() => {
4269
- if (!c || !re) {
4313
+ ]), gn = ue(null);
4314
+ Z(() => {
4315
+ if (!c || !le) {
4270
4316
  gn.current = null;
4271
4317
  return;
4272
4318
  }
4273
- const m = (Te ?? c).geometry;
4274
- gn.current = Ut(m);
4319
+ const g = (Te ?? c).geometry;
4320
+ gn.current = qt(g);
4275
4321
  }, [
4276
4322
  c,
4277
- re,
4323
+ le,
4278
4324
  Te
4279
4325
  ]);
4280
- const Vt = ce(async (m) => {
4281
- if (!s || !c || T.length === 0 || !P || Ye.current) return;
4326
+ const jt = de(async (g) => {
4327
+ if (!s || !c || T.length === 0 || !k || Ye.current) return;
4282
4328
  Ye.current = true, lt(true), await new Promise((D) => requestAnimationFrame(() => requestAnimationFrame(() => D())));
4283
- const F = await Je({
4329
+ const M = await Je({
4284
4330
  restoreView: false
4285
4331
  }).catch(() => {
4286
4332
  });
4287
4333
  try {
4288
- const D = Ht, W = Nt, ae = ve ? {
4289
- circumferences: ve.circumferences.map((X) => be(X)),
4290
- frontalHeight: be(ve.frontalHeight),
4291
- perineumML: be(ve.perineumML),
4292
- perineumAP: be(ve.perineumAP),
4293
- mptML: be(ve.mptML),
4294
- mptAP: be(ve.mptAP)
4334
+ const D = Nt, L = Vt, Y = Ce ? {
4335
+ circumferences: Ce.circumferences.map((X) => we(X)),
4336
+ frontalHeight: we(Ce.frontalHeight),
4337
+ perineumML: we(Ce.perineumML),
4338
+ perineumAP: we(Ce.perineumAP),
4339
+ mptML: we(Ce.mptML),
4340
+ mptAP: we(Ce.mptAP)
4295
4341
  } : void 0;
4296
4342
  s({
4297
- spacingType: P,
4343
+ spacingType: k,
4298
4344
  sourceUnit: "cm",
4299
4345
  fileFormat: Oe,
4300
- measurementSource: m === "use_form_measurements" ? "form_provided" : "scan_derived",
4301
- isDoubleWall: ne,
4346
+ measurementSource: g === "use_form_measurements" ? "form_provided" : "scan_derived",
4347
+ isDoubleWall: re,
4302
4348
  isUnitConverted: false,
4303
- formMeasurements: ze == null ? void 0 : ze.map((X) => be(X)),
4349
+ formMeasurements: Pe == null ? void 0 : Pe.map((X) => we(X)),
4304
4350
  scanMeasurements: T.map((X) => ({
4305
4351
  yPosition: X.yPosition,
4306
- originalValue: be(X.originalValue),
4307
- modifiedValue: X.modifiedValue == null ? null : be(X.modifiedValue)
4352
+ originalValue: we(X.originalValue),
4353
+ modifiedValue: X.modifiedValue == null ? null : we(X.modifiedValue)
4308
4354
  })),
4309
- frontalHeight: be((ve == null ? void 0 : ve.frontalHeight) ?? et),
4310
- transverseML: be(D),
4311
- transverseAP: be(W),
4312
- perineumML: be(ve == null ? void 0 : ve.perineumML),
4313
- perineumAP: be(ve == null ? void 0 : ve.perineumAP),
4314
- mptML: be(ve == null ? void 0 : ve.mptML),
4315
- mptAP: be(ve == null ? void 0 : ve.mptAP),
4355
+ frontalHeight: we((Ce == null ? void 0 : Ce.frontalHeight) ?? et),
4356
+ transverseML: we(D),
4357
+ transverseAP: we(L),
4358
+ perineumML: we(Ce == null ? void 0 : Ce.perineumML),
4359
+ perineumAP: we(Ce == null ? void 0 : Ce.perineumAP),
4360
+ mptML: we(Ce == null ? void 0 : Ce.mptML),
4361
+ mptAP: we(Ce == null ? void 0 : Ce.mptAP),
4316
4362
  scanUrl: t,
4317
- decision: m,
4318
- userEnteredMeasurements: ae,
4319
- screenshots: F,
4363
+ decision: g,
4364
+ userEnteredMeasurements: Y,
4365
+ screenshots: M,
4320
4366
  alignedGeometry: (Te ?? c).geometry
4321
4367
  });
4322
4368
  } finally {
@@ -4327,33 +4373,33 @@ let __tla = (async () => {
4327
4373
  c,
4328
4374
  Te,
4329
4375
  T,
4330
- P,
4376
+ k,
4331
4377
  V,
4332
4378
  Oe,
4333
- ne,
4334
- ze,
4379
+ re,
4380
+ Pe,
4335
4381
  t,
4336
- ve,
4382
+ Ce,
4337
4383
  et,
4338
- Ht,
4339
4384
  Nt,
4385
+ Vt,
4340
4386
  Je
4341
- ]), Ao = Q(() => {
4342
- if (!ze || T.length === 0) return false;
4343
- const m = Math.min(ze.length, T.length);
4344
- if (m === 0) return false;
4345
- for (let F = 0; F < m; F++) {
4346
- const D = ze[F], W = T[F];
4347
- if (!W || D == null || D === 0) continue;
4348
- const ae = W.modifiedValue ?? W.originalValue;
4349
- if (Math.abs(ae - D) > 7) return false;
4387
+ ]), zo = te(() => {
4388
+ if (!Pe || T.length === 0) return false;
4389
+ const g = Math.min(Pe.length, T.length);
4390
+ if (g === 0) return false;
4391
+ for (let M = 0; M < g; M++) {
4392
+ const D = Pe[M], L = T[M];
4393
+ if (!L || D == null || D === 0) continue;
4394
+ const Y = L.modifiedValue ?? L.originalValue;
4395
+ if (Math.abs(Y - D) > 7) return false;
4350
4396
  }
4351
4397
  return true;
4352
4398
  }, [
4353
- ze,
4399
+ Pe,
4354
4400
  T
4355
4401
  ]), mn = Ne === 0 ? 320 : Ne < 520 ? Math.max(200, Math.round(Ne * 0.42)) : Ne < 900 ? 280 : Ne < 1400 ? 340 : 400, xn = Ne < 520 ? 16 : Ne < 900 ? 20 : 24;
4356
- return y(No.Provider, {
4402
+ return y(Vo.Provider, {
4357
4403
  value: e,
4358
4404
  children: [
4359
4405
  y("div", {
@@ -4394,7 +4440,7 @@ let __tla = (async () => {
4394
4440
  },
4395
4441
  children: [
4396
4442
  y("div", {
4397
- ref: Wt,
4443
+ ref: Rt,
4398
4444
  style: {
4399
4445
  flex: 1,
4400
4446
  display: "flex",
@@ -4402,8 +4448,8 @@ let __tla = (async () => {
4402
4448
  minHeight: 0
4403
4449
  },
4404
4450
  children: [
4405
- c && !re && (() => {
4406
- const m = V.length === 0 ? 1 : V.length === 1 ? 2 : 3, F = P === "AK" ? "Perineum" : "MPT", D = m === 1 ? `Place Point at ${F}` : m === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", W = m === 1 ? `Click on the model to mark the ${F}.` : m === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", ae = m === 1 ? "#2fbf4a" : m === 2 ? "#e53935" : "#2fbf4a", X = V.length >= 2;
4451
+ c && !le && (() => {
4452
+ const g = V.length === 0 ? 1 : V.length === 1 ? 2 : 3, M = k === "AK" ? "Perineum" : "MPT", D = g === 1 ? `Place Point at ${M}` : g === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", L = g === 1 ? `Click on the model to mark the ${M}.` : g === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", Y = g === 1 ? "#2fbf4a" : g === 2 ? "#e53935" : "#2fbf4a", X = V.length >= 2;
4407
4453
  return y("div", {
4408
4454
  style: {
4409
4455
  width: mn,
@@ -4434,13 +4480,13 @@ let __tla = (async () => {
4434
4480
  },
4435
4481
  children: [
4436
4482
  i("button", {
4437
- onClick: () => sn((G) => {
4438
- const me = !G;
4439
- if (!me) try {
4483
+ onClick: () => ln((O) => {
4484
+ const ee = !O;
4485
+ if (!ee) try {
4440
4486
  localStorage.setItem("gm_helpTipDismissed", "1");
4441
4487
  } catch {
4442
4488
  }
4443
- return me;
4489
+ return ee;
4444
4490
  }),
4445
4491
  "aria-label": "How to use",
4446
4492
  style: {
@@ -4468,7 +4514,7 @@ let __tla = (async () => {
4468
4514
  },
4469
4515
  children: "i"
4470
4516
  }),
4471
- Dt && y("div", {
4517
+ Wt && y("div", {
4472
4518
  role: "tooltip",
4473
4519
  style: {
4474
4520
  position: "absolute",
@@ -4521,16 +4567,16 @@ let __tla = (async () => {
4521
4567
  2,
4522
4568
  3,
4523
4569
  4
4524
- ].map((G) => i("div", {
4570
+ ].map((O) => i("div", {
4525
4571
  style: {
4526
4572
  height: 4,
4527
4573
  flex: 1,
4528
4574
  maxWidth: 40,
4529
4575
  borderRadius: 2,
4530
- backgroundColor: G <= m ? "rgb(12, 67, 173)" : "rgba(0,0,0,0.12)",
4576
+ backgroundColor: O <= g ? "rgb(12, 67, 173)" : "rgba(0,0,0,0.12)",
4531
4577
  transition: "background-color 200ms"
4532
4578
  }
4533
- }, G)),
4579
+ }, O)),
4534
4580
  y("div", {
4535
4581
  style: {
4536
4582
  fontSize: 11,
@@ -4540,7 +4586,7 @@ let __tla = (async () => {
4540
4586
  letterSpacing: "0.4px"
4541
4587
  },
4542
4588
  children: [
4543
- m,
4589
+ g,
4544
4590
  " / 4"
4545
4591
  ]
4546
4592
  })
@@ -4559,9 +4605,9 @@ let __tla = (async () => {
4559
4605
  width: 12,
4560
4606
  height: 12,
4561
4607
  borderRadius: "50%",
4562
- backgroundColor: ae,
4608
+ backgroundColor: Y,
4563
4609
  flexShrink: 0,
4564
- boxShadow: `0 0 0 3px ${ae}22`
4610
+ boxShadow: `0 0 0 3px ${Y}22`
4565
4611
  }
4566
4612
  }),
4567
4613
  i("div", {
@@ -4581,11 +4627,11 @@ let __tla = (async () => {
4581
4627
  color: "rgba(0,0,0,0.6)",
4582
4628
  lineHeight: "19px"
4583
4629
  },
4584
- children: W
4630
+ children: L
4585
4631
  }),
4586
4632
  i("button", {
4587
4633
  disabled: !X,
4588
- onClick: $t,
4634
+ onClick: Tt,
4589
4635
  style: {
4590
4636
  marginTop: 4,
4591
4637
  padding: "11px 14px",
@@ -4623,7 +4669,7 @@ let __tla = (async () => {
4623
4669
  ]
4624
4670
  });
4625
4671
  })(),
4626
- re && Ge && P && i("div", {
4672
+ le && Ge && k && i("div", {
4627
4673
  style: {
4628
4674
  width: mn,
4629
4675
  flexShrink: 0,
@@ -4647,35 +4693,35 @@ let __tla = (async () => {
4647
4693
  border: "1px solid rgba(0,0,0,0.06)",
4648
4694
  overflow: "hidden"
4649
4695
  },
4650
- children: i(Mr, {
4651
- amputationType: P,
4696
+ children: i(Pr, {
4697
+ amputationType: k,
4652
4698
  spacingInches: S,
4653
4699
  scanMeasurements: T,
4654
4700
  scanFrontalHeight: et,
4655
- scanTransverseML: Ht,
4656
- scanTransverseAP: Nt,
4657
- onSave: Co,
4701
+ scanTransverseML: Nt,
4702
+ scanTransverseAP: Vt,
4703
+ onSave: Ao,
4658
4704
  onSkip: hn,
4659
4705
  onFormChange: so,
4660
4706
  onHeightChange: ao,
4661
4707
  onTransverseMLChange: fo,
4662
4708
  onTransverseAPChange: po,
4663
- initialValues: ze,
4664
- initialFrontalHeight: ve == null ? void 0 : ve.frontalHeight
4709
+ initialValues: Pe,
4710
+ initialFrontalHeight: Ce == null ? void 0 : Ce.frontalHeight
4665
4711
  })
4666
4712
  })
4667
4713
  }),
4668
4714
  y("div", {
4669
- ref: It,
4715
+ ref: Bt,
4670
4716
  style: {
4671
4717
  flex: 1,
4672
4718
  position: "relative",
4673
4719
  minHeight: 0,
4674
4720
  overflow: "hidden"
4675
4721
  },
4676
- onDragOver: e.showDragDrop ? bo : void 0,
4677
- onDragLeave: e.showDragDrop ? yo : void 0,
4678
- onDrop: e.showDragDrop ? wo : void 0,
4722
+ onDragOver: e.showDragDrop ? yo : void 0,
4723
+ onDragLeave: e.showDragDrop ? wo : void 0,
4724
+ onDrop: e.showDragDrop ? vo : void 0,
4679
4725
  children: [
4680
4726
  e.showDragDrop && !c && !h && i("div", {
4681
4727
  style: {
@@ -4726,7 +4772,7 @@ let __tla = (async () => {
4726
4772
  ]
4727
4773
  })
4728
4774
  }),
4729
- !e.showDragDrop && !c && !h && !Pt && i("div", {
4775
+ !e.showDragDrop && !c && !h && !kt && i("div", {
4730
4776
  style: {
4731
4777
  position: "absolute",
4732
4778
  inset: 0,
@@ -4767,12 +4813,12 @@ let __tla = (async () => {
4767
4813
  h && i(Ln, {
4768
4814
  message: w || "Processing mesh..."
4769
4815
  }),
4770
- j && i(Ln, {
4771
- message: se
4816
+ G && i(Ln, {
4817
+ message: ce
4772
4818
  }),
4773
- Pt && i(or, {
4774
- message: Pt,
4775
- onDismiss: () => De(null)
4819
+ kt && i(rr, {
4820
+ message: kt,
4821
+ onDismiss: () => Re(null)
4776
4822
  }),
4777
4823
  e.showAmputationModal && z && i("div", {
4778
4824
  style: {
@@ -4825,8 +4871,8 @@ let __tla = (async () => {
4825
4871
  children: [
4826
4872
  "AK",
4827
4873
  "BK"
4828
- ].map((m) => y("label", {
4829
- onClick: () => I(m),
4874
+ ].map((g) => y("label", {
4875
+ onClick: () => I(g),
4830
4876
  style: {
4831
4877
  flex: 1,
4832
4878
  display: "flex",
@@ -4835,16 +4881,16 @@ let __tla = (async () => {
4835
4881
  border: "2px solid",
4836
4882
  borderRadius: 4,
4837
4883
  cursor: "pointer",
4838
- borderColor: P === m ? "rgb(12, 67, 173)" : "#e0e0e0",
4839
- backgroundColor: P === m ? "rgba(12, 67, 173, 0.04)" : "#fff",
4884
+ borderColor: k === g ? "rgb(12, 67, 173)" : "#e0e0e0",
4885
+ backgroundColor: k === g ? "rgba(12, 67, 173, 0.04)" : "#fff",
4840
4886
  transition: "border-color 0.15s, background-color 0.15s"
4841
4887
  },
4842
4888
  children: [
4843
4889
  i("input", {
4844
4890
  type: "radio",
4845
4891
  name: "ampType",
4846
- checked: P === m,
4847
- onChange: () => I(m),
4892
+ checked: k === g,
4893
+ onChange: () => I(g),
4848
4894
  style: {
4849
4895
  accentColor: "rgb(12, 67, 173)",
4850
4896
  marginBottom: 12,
@@ -4859,7 +4905,7 @@ let __tla = (async () => {
4859
4905
  color: "rgba(0,0,0,0.87)",
4860
4906
  marginBottom: 4
4861
4907
  },
4862
- children: m
4908
+ children: g
4863
4909
  }),
4864
4910
  y("span", {
4865
4911
  style: {
@@ -4867,12 +4913,12 @@ let __tla = (async () => {
4867
4913
  color: "rgba(0,0,0,0.54)"
4868
4914
  },
4869
4915
  children: [
4870
- m === "AK" ? "2" : "1",
4916
+ g === "AK" ? "2" : "1",
4871
4917
  "-inch measurement spacing"
4872
4918
  ]
4873
4919
  })
4874
4920
  ]
4875
- }, m))
4921
+ }, g))
4876
4922
  })
4877
4923
  ]
4878
4924
  }),
@@ -4887,7 +4933,7 @@ let __tla = (async () => {
4887
4933
  children: [
4888
4934
  i("button", {
4889
4935
  onClick: () => {
4890
- _(false), H(null);
4936
+ R(false), N(null);
4891
4937
  },
4892
4938
  style: {
4893
4939
  padding: "6px 16px",
@@ -4905,17 +4951,17 @@ let __tla = (async () => {
4905
4951
  children: "Cancel"
4906
4952
  }),
4907
4953
  i("button", {
4908
- onClick: () => P && vo(P),
4909
- disabled: !P,
4954
+ onClick: () => k && So(k),
4955
+ disabled: !k,
4910
4956
  style: {
4911
4957
  padding: "6px 16px",
4912
4958
  borderRadius: 4,
4913
4959
  fontSize: 14,
4914
4960
  fontWeight: 500,
4915
- backgroundColor: P ? "rgb(12, 67, 173)" : "#e0e0e0",
4961
+ backgroundColor: k ? "rgb(12, 67, 173)" : "#e0e0e0",
4916
4962
  border: "none",
4917
- color: P ? "#fff" : "#9e9e9e",
4918
- cursor: P ? "pointer" : "not-allowed",
4963
+ color: k ? "#fff" : "#9e9e9e",
4964
+ cursor: k ? "pointer" : "not-allowed",
4919
4965
  fontFamily: "system-ui, sans-serif",
4920
4966
  lineHeight: "36px",
4921
4967
  letterSpacing: "0.4px"
@@ -4927,7 +4973,7 @@ let __tla = (async () => {
4927
4973
  ]
4928
4974
  })
4929
4975
  }),
4930
- e.showDragDrop && g && i("div", {
4976
+ e.showDragDrop && m && i("div", {
4931
4977
  style: {
4932
4978
  position: "absolute",
4933
4979
  inset: 0,
@@ -4937,8 +4983,8 @@ let __tla = (async () => {
4937
4983
  zIndex: 10
4938
4984
  }
4939
4985
  }),
4940
- i(nr, {
4941
- children: y(Io, {
4986
+ i(or, {
4987
+ children: y(Bo, {
4942
4988
  camera: {
4943
4989
  position: [
4944
4990
  0,
@@ -4948,14 +4994,14 @@ let __tla = (async () => {
4948
4994
  },
4949
4995
  style: {
4950
4996
  display: c ? "block" : "none",
4951
- backgroundColor: Ie ? "#070611" : void 0
4997
+ backgroundColor: Be ? "#070611" : void 0
4952
4998
  },
4953
4999
  gl: {
4954
5000
  localClippingEnabled: true,
4955
5001
  preserveDrawingBuffer: true
4956
5002
  },
4957
5003
  scene: {
4958
- background: Ie ? new U.Color("#070611") : null
5004
+ background: Be ? new q.Color("#070611") : null
4959
5005
  },
4960
5006
  children: [
4961
5007
  i("ambientLight", {
@@ -4985,122 +5031,122 @@ let __tla = (async () => {
4985
5031
  ],
4986
5032
  intensity: 0.2
4987
5033
  }),
4988
- c && b === "3D" && i(ir, {
5034
+ c && b === "3D" && i(sr, {
4989
5035
  mesh: c,
4990
5036
  maxPoints: 2,
4991
- meshColor: ln,
4992
- meshOpacity: Ie ? 0.3 : ho,
4993
- frontFaceOnly: O,
4994
- doubleShellTransparency: ne && re
5037
+ meshColor: an,
5038
+ meshOpacity: Be ? 0.3 : ho,
5039
+ frontFaceOnly: H,
5040
+ doubleShellTransparency: re && le
4995
5041
  }),
4996
- c && b === "3D" && i(lr, {
4997
- modelSize: u,
5042
+ c && b === "3D" && i(ar, {
5043
+ modelSize: p,
4998
5044
  labels: [
4999
- P === "AK" ? "Perineum" : "MPT",
5045
+ k === "AK" ? "Perineum" : "MPT",
5000
5046
  "Distal Most Point",
5001
5047
  "Cut Plane"
5002
5048
  ]
5003
5049
  }),
5004
- i(mr, {
5005
- modelSize: u,
5006
- isAligned: re,
5007
- isCut: Bt,
5050
+ i(xr, {
5051
+ modelSize: p,
5052
+ isAligned: le,
5053
+ isCut: $t,
5008
5054
  mesh: c,
5009
5055
  viewMode: b,
5010
- sliceY: re && V.length >= 2 ? zt ?? rt ?? V[0].position.y : void 0,
5056
+ sliceY: le && V.length >= 2 ? Mt ?? rt ?? V[0].position.y : void 0,
5011
5057
  landmarkCount: V.length,
5012
- measurementGeometry: le,
5013
- fitYMin: re && V.length >= 2 ? zt ?? rt ?? void 0 : void 0,
5014
- fitYMax: re && V.length >= 2 ? it ?? V[0].position.y : void 0,
5015
- resetCameraToFrontRef: Rt
5058
+ measurementGeometry: ie,
5059
+ fitYMin: le && V.length >= 2 ? Mt ?? rt ?? void 0 : void 0,
5060
+ fitYMax: le && V.length >= 2 ? it ?? V[0].position.y : void 0,
5061
+ resetCameraToFrontRef: It
5016
5062
  }),
5017
- !re && i($n, {
5063
+ !le && i($n, {
5018
5064
  enableDamping: false
5019
5065
  }),
5020
- re && T.length > 0 && c && b === "3D" && i(xr, {
5066
+ le && T.length > 0 && c && b === "3D" && i(br, {
5021
5067
  mesh: c,
5022
5068
  isDragging: Qn
5023
5069
  }),
5024
- c && re && V.length >= 3 && (() => {
5025
- const F = c.geometry.getIndex();
5026
- if (!F || F.count < 30) return null;
5027
- const D = V[2], W = V[0], ae = xe ?? D.position.y, X = zt ?? rt ?? W.position.y;
5070
+ c && le && V.length >= 3 && (() => {
5071
+ const M = c.geometry.getIndex();
5072
+ if (!M || M.count < 30) return null;
5073
+ const D = V[2], L = V[0], Y = ye ?? D.position.y, X = Mt ?? rt ?? L.position.y;
5028
5074
  if (b === "2D") {
5029
- const G = Ge ? co : He ? P === "AK" ? ve == null ? void 0 : ve.perineumML : ve == null ? void 0 : ve.mptML : void 0, me = Ge ? uo : He ? P === "AK" ? ve == null ? void 0 : ve.perineumAP : ve == null ? void 0 : ve.mptAP : void 0;
5030
- return i(vr, {
5075
+ const O = Ge ? co : He ? k === "AK" ? Ce == null ? void 0 : Ce.perineumML : Ce == null ? void 0 : Ce.mptML : void 0, ee = Ge ? uo : He ? k === "AK" ? Ce == null ? void 0 : Ce.perineumAP : Ce == null ? void 0 : Ce.mptAP : void 0;
5076
+ return i(Sr, {
5031
5077
  mesh: Te ?? c,
5032
5078
  upperY: X,
5033
- originY: W.position.y,
5034
- modelSize: u,
5035
- meshColor: ln,
5036
- displayUnit: L,
5037
- formML: G,
5038
- formAP: me
5079
+ originY: L.position.y,
5080
+ modelSize: p,
5081
+ meshColor: an,
5082
+ displayUnit: W,
5083
+ formML: O,
5084
+ formAP: ee
5039
5085
  });
5040
5086
  }
5041
5087
  return y(We, {
5042
5088
  children: [
5043
- i(pr, {
5089
+ i(hr, {
5044
5090
  mesh: Te ?? c,
5045
- startY: ae,
5091
+ startY: Y,
5046
5092
  endY: X,
5047
- spacing: ft,
5048
- modelSize: u,
5049
- onMeasurementsChange: ke,
5093
+ spacing: ut,
5094
+ modelSize: p,
5095
+ onMeasurementsChange: Le,
5050
5096
  reverseOrder: true,
5051
- displayUnit: L,
5052
- useInnerSurface: ne && !O,
5053
- formMeasurements: Ge ? io ?? ze : He ? ze : void 0,
5054
- originY: it ?? W.position.y,
5055
- wasmSlices: _e
5097
+ displayUnit: W,
5098
+ useInnerSurface: re && !H,
5099
+ formMeasurements: Ge ? io ?? Pe : He ? Pe : void 0,
5100
+ originY: it ?? L.position.y,
5101
+ wasmSlices: ke
5056
5102
  }),
5057
- i(gr, {
5103
+ i(mr, {
5058
5104
  mesh: c,
5059
- greenY: it ?? W.position.y,
5060
- modelSize: u,
5061
- displayUnit: L,
5062
- bottomY: ne ? D.position.y : void 0,
5063
- formHeight: Ge ? lo : He ? ve == null ? void 0 : ve.frontalHeight : void 0
5105
+ greenY: it ?? L.position.y,
5106
+ modelSize: p,
5107
+ displayUnit: W,
5108
+ bottomY: re ? D.position.y : void 0,
5109
+ formHeight: Ge ? lo : He ? Ce == null ? void 0 : Ce.frontalHeight : void 0
5064
5110
  }),
5065
- i(Sr, {
5111
+ i(Cr, {
5066
5112
  mesh: c,
5067
- yPosition: it ?? W.position.y,
5068
- onYChange: (G) => {
5069
- en(G), Be(null);
5070
- const me = G - W.position.y;
5071
- Mt((rt ?? W.position.y + ft * 2) + me);
5113
+ yPosition: it ?? L.position.y,
5114
+ onYChange: (O) => {
5115
+ tn(O), Ie(null);
5116
+ const ee = O - L.position.y;
5117
+ Pt((rt ?? L.position.y + ut * 2) + ee);
5072
5118
  },
5073
- minY: W.position.y - ft,
5074
- maxY: W.position.y + ft,
5075
- modelSize: u,
5119
+ minY: L.position.y - ut,
5120
+ maxY: L.position.y + ut,
5121
+ modelSize: p,
5076
5122
  color: "#44ff44",
5077
5123
  hoverColor: "#88ff88",
5078
5124
  dragColor: "#ffffff",
5079
- label: P === "AK" ? "Perineum" : "MPT",
5080
- onDragStart: () => Qt(true),
5081
- onDragEnd: () => Qt(false)
5125
+ label: k === "AK" ? "Perineum" : "MPT",
5126
+ onDragStart: () => en(true),
5127
+ onDragEnd: () => en(false)
5082
5128
  })
5083
5129
  ]
5084
5130
  });
5085
5131
  })(),
5086
- c && re && b === "3D" && Ie && i(Nr, {
5132
+ c && le && b === "3D" && Be && i(Vr, {
5087
5133
  mesh: c
5088
5134
  }),
5089
- c && e.showDebug && Ie && b === "3D" && i(Hr, {
5135
+ c && e.showDebug && Be && b === "3D" && i(Nr, {
5090
5136
  mesh: c,
5091
- modelSize: u,
5092
- layers: tn,
5137
+ modelSize: p,
5138
+ layers: nn,
5093
5139
  landmarkPoints: V,
5094
5140
  componentDebug: null,
5095
- aoData: J,
5141
+ aoData: Q,
5096
5142
  aoGeometry: K,
5097
- measurementGeometry: le
5143
+ measurementGeometry: ie
5098
5144
  }),
5099
- i(Gr, {
5145
+ i(Yr, {
5100
5146
  screenshotFnRef: mo,
5101
5147
  mesh: c,
5102
- modelSize: u,
5103
- measurementGeometry: le
5148
+ modelSize: p,
5149
+ measurementGeometry: ie
5104
5150
  })
5105
5151
  ]
5106
5152
  })
@@ -5115,7 +5161,7 @@ let __tla = (async () => {
5115
5161
  gap: 8
5116
5162
  },
5117
5163
  children: [
5118
- e.showStartOver && re && i("button", {
5164
+ e.showStartOver && le && i("button", {
5119
5165
  onClick: () => window.location.reload(),
5120
5166
  style: {
5121
5167
  padding: "6px 16px",
@@ -5132,7 +5178,7 @@ let __tla = (async () => {
5132
5178
  },
5133
5179
  children: "Start Over"
5134
5180
  }),
5135
- !re && V.length >= 1 && y(We, {
5181
+ !le && V.length >= 1 && y(We, {
5136
5182
  children: [
5137
5183
  i("button", {
5138
5184
  onClick: () => Et(),
@@ -5171,34 +5217,56 @@ let __tla = (async () => {
5171
5217
  })
5172
5218
  ]
5173
5219
  }),
5174
- re && !Lt && i("button", {
5175
- onClick: So,
5176
- style: {
5177
- padding: "6px 16px",
5178
- borderRadius: 4,
5179
- fontSize: 13,
5180
- fontWeight: 500,
5181
- backgroundColor: "#fff",
5182
- border: "1px solid #e53935",
5183
- color: "#e53935",
5184
- cursor: "pointer",
5185
- fontFamily: "system-ui, sans-serif",
5186
- letterSpacing: "0.4px",
5187
- boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5188
- },
5189
- children: "Reset Points"
5220
+ le && !Dt && y(We, {
5221
+ children: [
5222
+ i("button", {
5223
+ onClick: Co,
5224
+ style: {
5225
+ padding: "6px 16px",
5226
+ borderRadius: 4,
5227
+ fontSize: 13,
5228
+ fontWeight: 500,
5229
+ backgroundColor: "#fff",
5230
+ border: "1px solid #e53935",
5231
+ color: "#e53935",
5232
+ cursor: "pointer",
5233
+ fontFamily: "system-ui, sans-serif",
5234
+ letterSpacing: "0.4px",
5235
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5236
+ },
5237
+ children: "Reset Points"
5238
+ }),
5239
+ i("button", {
5240
+ onClick: bo,
5241
+ title: "Mirror scan across the vertical axis (use if the scan came in flipped). Alignment will reset so you can re-place landmarks.",
5242
+ style: {
5243
+ padding: "6px 16px",
5244
+ borderRadius: 4,
5245
+ fontSize: 13,
5246
+ fontWeight: 500,
5247
+ backgroundColor: "#fff",
5248
+ border: "1px solid #bdbdbd",
5249
+ color: "#333",
5250
+ cursor: "pointer",
5251
+ fontFamily: "system-ui, sans-serif",
5252
+ letterSpacing: "0.4px",
5253
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5254
+ },
5255
+ children: "Mirror"
5256
+ })
5257
+ ]
5190
5258
  })
5191
5259
  ]
5192
5260
  }),
5193
- e.showDebug && Ie && c && b === "3D" && i(jr, {
5194
- layers: tn,
5195
- onToggleLayer: (m) => to((F) => ({
5196
- ...F,
5197
- [m]: !F[m]
5261
+ e.showDebug && Be && c && b === "3D" && i(Xr, {
5262
+ layers: nn,
5263
+ onToggleLayer: (g) => to((M) => ({
5264
+ ...M,
5265
+ [g]: !M[g]
5198
5266
  })),
5199
- isDoubleShell: ne
5267
+ isDoubleShell: re
5200
5268
  }),
5201
- re && T.length > 0 && y("div", {
5269
+ le && T.length > 0 && y("div", {
5202
5270
  style: {
5203
5271
  position: "absolute",
5204
5272
  top: 16,
@@ -5218,7 +5286,7 @@ let __tla = (async () => {
5218
5286
  },
5219
5287
  children: [
5220
5288
  i("button", {
5221
- onClick: () => k("3D"),
5289
+ onClick: () => F("3D"),
5222
5290
  style: {
5223
5291
  padding: "6px 14px",
5224
5292
  fontSize: 13,
@@ -5232,7 +5300,7 @@ let __tla = (async () => {
5232
5300
  children: "Orbital"
5233
5301
  }),
5234
5302
  i("button", {
5235
- onClick: () => k("2D"),
5303
+ onClick: () => F("2D"),
5236
5304
  style: {
5237
5305
  padding: "6px 14px",
5238
5306
  fontSize: 13,
@@ -5262,9 +5330,9 @@ let __tla = (async () => {
5262
5330
  style: {
5263
5331
  padding: "6px 14px",
5264
5332
  fontSize: 13,
5265
- fontWeight: L === "cm" ? 600 : 400,
5266
- backgroundColor: L === "cm" ? "rgb(12, 67, 173)" : "#fff",
5267
- color: L === "cm" ? "#fff" : "#666",
5333
+ fontWeight: W === "cm" ? 600 : 400,
5334
+ backgroundColor: W === "cm" ? "rgb(12, 67, 173)" : "#fff",
5335
+ color: W === "cm" ? "#fff" : "#666",
5268
5336
  border: "none",
5269
5337
  cursor: "pointer",
5270
5338
  fontFamily: "system-ui, sans-serif"
@@ -5276,9 +5344,9 @@ let __tla = (async () => {
5276
5344
  style: {
5277
5345
  padding: "6px 14px",
5278
5346
  fontSize: 13,
5279
- fontWeight: L === "inch" ? 600 : 400,
5280
- backgroundColor: L === "inch" ? "rgb(12, 67, 173)" : "#fff",
5281
- color: L === "inch" ? "#fff" : "#666",
5347
+ fontWeight: W === "inch" ? 600 : 400,
5348
+ backgroundColor: W === "inch" ? "rgb(12, 67, 173)" : "#fff",
5349
+ color: W === "inch" ? "#fff" : "#666",
5282
5350
  border: "none",
5283
5351
  borderLeft: "1px solid #ccc",
5284
5352
  cursor: "pointer",
@@ -5328,7 +5396,7 @@ let __tla = (async () => {
5328
5396
  })
5329
5397
  ]
5330
5398
  }),
5331
- b === "3D" && ze && i("div", {
5399
+ b === "3D" && Pe && i("div", {
5332
5400
  style: {
5333
5401
  display: "flex",
5334
5402
  borderRadius: 6,
@@ -5337,7 +5405,7 @@ let __tla = (async () => {
5337
5405
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5338
5406
  },
5339
5407
  children: i("button", {
5340
- onClick: () => kt((m) => !m),
5408
+ onClick: () => Lt((g) => !g),
5341
5409
  style: {
5342
5410
  padding: "6px 14px",
5343
5411
  fontSize: 13,
@@ -5361,13 +5429,13 @@ let __tla = (async () => {
5361
5429
  },
5362
5430
  children: i("button", {
5363
5431
  onClick: async () => {
5364
- const m = await Je();
5365
- if (!m) return;
5366
- const F = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), D = (W, ae) => {
5432
+ const g = await Je();
5433
+ if (!g) return;
5434
+ const M = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), D = (L, Y) => {
5367
5435
  const X = document.createElement("a");
5368
- X.href = W, X.download = ae, X.click();
5436
+ X.href = L, X.download = Y, X.click();
5369
5437
  };
5370
- D(m.frontal_view_png, `measurements_front_${F}.png`), await new Promise((W) => setTimeout(W, 300)), D(m.side_view_png, `measurements_transverse_${F}.png`);
5438
+ D(g.frontal_view_png, `measurements_front_${M}.png`), await new Promise((L) => setTimeout(L, 300)), D(g.side_view_png, `measurements_transverse_${M}.png`);
5371
5439
  },
5372
5440
  style: {
5373
5441
  padding: "6px 14px",
@@ -5391,13 +5459,13 @@ let __tla = (async () => {
5391
5459
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5392
5460
  },
5393
5461
  children: i("button", {
5394
- onClick: () => eo((m) => !m),
5462
+ onClick: () => eo((g) => !g),
5395
5463
  style: {
5396
5464
  padding: "6px 14px",
5397
5465
  fontSize: 13,
5398
- fontWeight: Ie ? 600 : 400,
5399
- backgroundColor: Ie ? "#e65100" : "#fff",
5400
- color: Ie ? "#fff" : "#666",
5466
+ fontWeight: Be ? 600 : 400,
5467
+ backgroundColor: Be ? "#e65100" : "#fff",
5468
+ color: Be ? "#fff" : "#666",
5401
5469
  border: "none",
5402
5470
  cursor: "pointer",
5403
5471
  fontFamily: "system-ui, sans-serif"
@@ -5407,15 +5475,15 @@ let __tla = (async () => {
5407
5475
  })
5408
5476
  ]
5409
5477
  }),
5410
- c && Z && i(yr, {
5411
- detectedUnit: q,
5412
- onDismiss: () => pe(false)
5478
+ c && U && i(wr, {
5479
+ detectedUnit: J,
5480
+ onDismiss: () => ge(false)
5413
5481
  }),
5414
- c && ue && re && i(wr, {
5415
- isDoubleShell: ne,
5416
- onDismiss: () => we(false)
5482
+ c && he && le && i(vr, {
5483
+ isDoubleShell: re,
5484
+ onDismiss: () => Se(false)
5417
5485
  }),
5418
- s && re && i("div", {
5486
+ s && le && i("div", {
5419
5487
  className: "gm-action-row-container",
5420
5488
  style: {
5421
5489
  position: "absolute",
@@ -5465,28 +5533,28 @@ let __tla = (async () => {
5465
5533
  y("div", {
5466
5534
  className: "gm-btn-group",
5467
5535
  children: [
5468
- Lt && !Ge && i("button", {
5536
+ Dt && !Ge && i("button", {
5469
5537
  className: "gm-btn gm-btn-secondary",
5470
5538
  onClick: () => qe(true),
5471
5539
  children: "Edit Measurements"
5472
5540
  }),
5473
- Lt && (Ao ? i("button", {
5541
+ Dt && (zo ? i("button", {
5474
5542
  className: "gm-btn gm-btn-primary",
5475
5543
  disabled: st,
5476
- onClick: () => Vt("continue"),
5544
+ onClick: () => jt("continue"),
5477
5545
  children: "Continue \u2192"
5478
5546
  }) : y(We, {
5479
5547
  children: [
5480
5548
  i("button", {
5481
5549
  className: "gm-btn gm-btn-primary",
5482
5550
  disabled: st,
5483
- onClick: () => Vt("use_scan"),
5551
+ onClick: () => jt("use_scan"),
5484
5552
  children: "Go with Scan"
5485
5553
  }),
5486
5554
  i("button", {
5487
5555
  className: "gm-btn gm-btn-primary",
5488
5556
  disabled: st,
5489
- onClick: () => Vt("use_form_measurements"),
5557
+ onClick: () => jt("use_form_measurements"),
5490
5558
  children: "Go with Measurements"
5491
5559
  })
5492
5560
  ]
@@ -5590,14 +5658,14 @@ let __tla = (async () => {
5590
5658
  " | ",
5591
5659
  V.length,
5592
5660
  " pts | ",
5593
- re ? "aligned" : "unaligned",
5661
+ le ? "aligned" : "unaligned",
5594
5662
  " | ",
5595
5663
  T.length,
5596
5664
  " slices"
5597
5665
  ]
5598
5666
  }),
5599
5667
  i("button", {
5600
- onClick: () => an([]),
5668
+ onClick: () => cn([]),
5601
5669
  style: {
5602
5670
  background: "none",
5603
5671
  border: "1px solid #30363d",
@@ -5621,30 +5689,30 @@ let __tla = (async () => {
5621
5689
  padding: "4px 10px",
5622
5690
  lineHeight: 1.6
5623
5691
  },
5624
- children: _t.map((m, F) => {
5625
- const D = m.includes("ERROR") || m.includes("failed"), W = m.includes("warning") || m.includes("WARN"), ae = m.includes("PIPELINE:"), X = m.includes("STATE:");
5692
+ children: _t.map((g, M) => {
5693
+ const D = g.includes("ERROR") || g.includes("failed"), L = g.includes("warning") || g.includes("WARN"), Y = g.includes("PIPELINE:"), X = g.includes("STATE:");
5626
5694
  return i("div", {
5627
5695
  style: {
5628
- color: D ? "#f85149" : W ? "#d29922" : ae ? "#58a6ff" : X ? "#3fb950" : "#8b949e",
5696
+ color: D ? "#f85149" : L ? "#d29922" : Y ? "#58a6ff" : X ? "#3fb950" : "#8b949e",
5629
5697
  whiteSpace: "pre"
5630
5698
  },
5631
- children: m
5632
- }, F);
5699
+ children: g
5700
+ }, M);
5633
5701
  })
5634
5702
  })
5635
5703
  ]
5636
5704
  })
5637
5705
  ]
5638
5706
  }),
5639
- no && i(kr, {
5707
+ no && i(Lr, {
5640
5708
  onSkip: hn,
5641
- onCancel: () => rn(false)
5709
+ onCancel: () => sn(false)
5642
5710
  })
5643
5711
  ]
5644
5712
  });
5645
5713
  };
5646
- function Gr({ screenshotFnRef: e }) {
5647
- return Y(() => {
5714
+ function Yr({ screenshotFnRef: e }) {
5715
+ return Z(() => {
5648
5716
  e.current = null;
5649
5717
  }, [
5650
5718
  e
@@ -5669,7 +5737,7 @@ let __tla = (async () => {
5669
5737
  ]) t.push(`${n}_below`);
5670
5738
  return t;
5671
5739
  };
5672
- yt = function(e, o) {
5740
+ wt = function(e, o) {
5673
5741
  const t = Jn(o), n = {};
5674
5742
  for (let s = 0; s < Math.min(e.length, t.length); s++) {
5675
5743
  const l = e[s];
@@ -5677,7 +5745,7 @@ let __tla = (async () => {
5677
5745
  }
5678
5746
  return n;
5679
5747
  };
5680
- Yr = function(e, o) {
5748
+ Kr = function(e, o) {
5681
5749
  if (!e) return;
5682
5750
  const n = Jn(o).map((s) => {
5683
5751
  const l = e[s];
@@ -5685,7 +5753,7 @@ let __tla = (async () => {
5685
5753
  });
5686
5754
  if (!n.every((s) => s == null)) return n;
5687
5755
  };
5688
- function Kr(e) {
5756
+ function Zr(e) {
5689
5757
  const o = e.getAttribute("position");
5690
5758
  if (!o) return "";
5691
5759
  const t = [
@@ -5706,7 +5774,7 @@ let __tla = (async () => {
5706
5774
  return t.join(`
5707
5775
  `);
5708
5776
  }
5709
- async function Zr(e, o) {
5777
+ async function Ur(e, o) {
5710
5778
  for (let t = 0; t < 3; t++) try {
5711
5779
  const n = await fetch(e, {
5712
5780
  method: "PUT",
@@ -5745,20 +5813,20 @@ let __tla = (async () => {
5745
5813
  error: "Upload failed after 3 attempts"
5746
5814
  };
5747
5815
  }
5748
- ai = ({ request: e, onComplete: o, wasmModule: t }) => {
5749
- const [n, s] = B(null);
5750
- Y(() => {
5816
+ ci = ({ request: e, onComplete: o, wasmModule: t }) => {
5817
+ const [n, s] = E(null);
5818
+ Z(() => {
5751
5819
  if (t != null) return;
5752
5820
  let r = false;
5753
- const c = async (p) => {
5821
+ const c = async (u) => {
5754
5822
  try {
5755
- const u = await import("./geo_wasm-BBuWXukA.js");
5756
- await u.default(), r || s(u);
5757
- } catch (u) {
5758
- if (p < 2 && !r) {
5759
- const f = (p + 1) * 1e3 + p * 1e3;
5760
- if (console.warn(`[GirthManagerWidget] WASM load failed (attempt ${p + 1}/3), retrying in ${f}ms...`, u), await new Promise((g) => setTimeout(g, f)), !r) return c(p + 1);
5761
- } else console.error("[GirthManagerWidget] WASM load failed after 3 attempts:", u);
5823
+ const p = await import("./geo_wasm-BBuWXukA.js");
5824
+ await p.default(), r || s(p);
5825
+ } catch (p) {
5826
+ if (u < 2 && !r) {
5827
+ const f = (u + 1) * 1e3 + u * 1e3;
5828
+ if (console.warn(`[GirthManagerWidget] WASM load failed (attempt ${u + 1}/3), retrying in ${f}ms...`, p), await new Promise((m) => setTimeout(m, f)), !r) return c(u + 1);
5829
+ } else console.error("[GirthManagerWidget] WASM load failed after 3 attempts:", p);
5762
5830
  }
5763
5831
  };
5764
5832
  return c(0), () => {
@@ -5767,23 +5835,23 @@ let __tla = (async () => {
5767
5835
  }, [
5768
5836
  t
5769
5837
  ]);
5770
- const l = t !== void 0 ? t : n ?? void 0, d = Q(() => Yr(e.form_measurements, e.spacing_type), [
5838
+ const l = t !== void 0 ? t : n ?? void 0, d = te(() => Kr(e.form_measurements, e.spacing_type), [
5771
5839
  e.form_measurements,
5772
5840
  e.spacing_type
5773
5841
  ]), a = async (r) => {
5774
5842
  var _a, _b;
5775
- const c = r.scanMeasurements.map((b) => +(b.modifiedValue ?? b.originalValue).toFixed(1)), p = yt(c, e.spacing_type);
5776
- let u, f;
5843
+ const c = r.scanMeasurements.map((b) => +(b.modifiedValue ?? b.originalValue).toFixed(1)), u = wt(c, e.spacing_type);
5844
+ let p, f;
5777
5845
  if (r.formMeasurements) {
5778
- u = yt(r.formMeasurements, e.spacing_type);
5779
- const b = r.scanMeasurements.map((k, S) => {
5846
+ p = wt(r.formMeasurements, e.spacing_type);
5847
+ const b = r.scanMeasurements.map((F, S) => {
5780
5848
  var _a2;
5781
5849
  const A = (_a2 = r.formMeasurements) == null ? void 0 : _a2[S];
5782
- return A == null || isNaN(A) ? null : +((k.modifiedValue ?? k.originalValue) - A).toFixed(1);
5850
+ return A == null || isNaN(A) ? null : +((F.modifiedValue ?? F.originalValue) - A).toFixed(1);
5783
5851
  });
5784
- f = yt(b, e.spacing_type);
5852
+ f = wt(b, e.spacing_type);
5785
5853
  }
5786
- const g = r.userEnteredMeasurements ? yt(r.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, v = r.decision === "use_scan" || r.decision === "continue", h = v ? p : g ?? u ?? p, x = v ? +r.frontalHeight.toFixed(1) : +(((_a = r.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? r.frontalHeight).toFixed(1);
5854
+ const m = r.userEnteredMeasurements ? wt(r.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, v = r.decision === "use_scan" || r.decision === "continue", h = v ? u : m ?? p ?? u, x = v ? +r.frontalHeight.toFixed(1) : +(((_a = r.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? r.frontalHeight).toFixed(1);
5787
5855
  let w;
5788
5856
  if (e.upload_url) if (!r.alignedGeometry) w = {
5789
5857
  success: false,
@@ -5791,9 +5859,9 @@ let __tla = (async () => {
5791
5859
  message: "No aligned geometry available \u2014 mesh processing may not have completed."
5792
5860
  };
5793
5861
  else try {
5794
- const b = Kr(r.alignedGeometry), k = new Blob([
5862
+ const b = Zr(r.alignedGeometry), F = new Blob([
5795
5863
  b
5796
- ]), S = await Zr(e.upload_url, k);
5864
+ ]), S = await Ur(e.upload_url, F);
5797
5865
  w = {
5798
5866
  ...S,
5799
5867
  url: e.upload_url,
@@ -5814,8 +5882,8 @@ let __tla = (async () => {
5814
5882
  measurement_source: r.formMeasurements ? "form_provided" : "scan_derived",
5815
5883
  is_double_wall: r.isDoubleWall,
5816
5884
  is_unit_converted: false,
5817
- form_measurements: u,
5818
- scan_measurements: p,
5885
+ form_measurements: p,
5886
+ scan_measurements: u,
5819
5887
  measurement_variance: f,
5820
5888
  scan_url: e.scan_url,
5821
5889
  frontal_height: +r.frontalHeight.toFixed(1),
@@ -5823,7 +5891,7 @@ let __tla = (async () => {
5823
5891
  transverse_ap: +r.transverseAP.toFixed(1),
5824
5892
  decision: r.decision,
5825
5893
  skip_reason: r.skipReason,
5826
- user_measurements: g,
5894
+ user_measurements: m,
5827
5895
  user_frontal_height: (_b = r.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
5828
5896
  final_measurements: h,
5829
5897
  final_frontal_height: x,
@@ -5844,8 +5912,8 @@ let __tla = (async () => {
5844
5912
  height: "100%",
5845
5913
  display: "flex"
5846
5914
  },
5847
- children: i(Xr, {
5848
- config: Ho,
5915
+ children: i(Gr, {
5916
+ config: No,
5849
5917
  spacingType: e.spacing_type,
5850
5918
  scanUrl: e.scan_url,
5851
5919
  formMeasurements: d,
@@ -5856,10 +5924,10 @@ let __tla = (async () => {
5856
5924
  };
5857
5925
  })();
5858
5926
  export {
5859
- ai as G,
5927
+ ci as G,
5860
5928
  __tla,
5861
- yt as a,
5862
- Yr as c,
5929
+ wt as a,
5930
+ Kr as c,
5863
5931
  Jn as g,
5864
- qt as u
5932
+ Jt as u
5865
5933
  };