@solid-labs/fab-one-widget 0.1.10 → 0.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,16 +1,16 @@
1
- import { jsxs as L, jsx as i, Fragment as Te } from "react/jsx-runtime";
2
- import { createContext as Xn, Component as Gn, useCallback as re, useMemo as j, useState as E, memo as Zn, useEffect as ne, useRef as le, forwardRef as Kn, createElement as Qt } from "react";
3
- import { useFrame as sn, useThree as ln, Canvas as Un } from "@react-three/fiber";
4
- import { Html as Ye, Line as de, OrbitControls as an } from "@react-three/drei";
1
+ import { jsxs as F, jsx as i, Fragment as Oe } from "react/jsx-runtime";
2
+ import { createContext as Zn, Component as Kn, useCallback as re, useMemo as j, useState as E, memo as Un, useEffect as ne, useRef as le, forwardRef as Jn, createElement as en } from "react";
3
+ import { useFrame as an, useThree as cn, Canvas as Qn } from "@react-three/fiber";
4
+ import { Html as Xe, Line as de, OrbitControls as dn } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as dt, Vector3 as C, Box3 as cn, Line3 as dn, Raycaster as Jn } from "three";
7
- import { create as Qn } from "zustand";
8
- import { OBJLoader as fn } from "three/examples/jsm/loaders/OBJLoader.js";
9
- import { STLLoader as qn } from "three/examples/jsm/loaders/STLLoader.js";
10
- import { MeshBVH as ft } from "three-mesh-bvh";
11
- let hr, lt, or, Sn;
6
+ import { Plane as ft, Vector3 as C, Box3 as fn, Line3 as un, Raycaster as qn } from "three";
7
+ import { create as eo } from "zustand";
8
+ import { OBJLoader as pn } from "three/examples/jsm/loaders/OBJLoader.js";
9
+ import { STLLoader as to } from "three/examples/jsm/loaders/STLLoader.js";
10
+ import { MeshBVH as ut } from "three-mesh-bvh";
11
+ let mr, at, ir, Cn;
12
12
  let __tla = (async () => {
13
- const eo = {
13
+ const no = {
14
14
  showDragDrop: true,
15
15
  showStartOver: true,
16
16
  showDebug: true,
@@ -19,7 +19,7 @@ let __tla = (async () => {
19
19
  showNavigation: true,
20
20
  showToolbar: false,
21
21
  showSaveButton: true
22
- }, to = {
22
+ }, oo = {
23
23
  showDragDrop: false,
24
24
  showStartOver: false,
25
25
  showDebug: false,
@@ -28,7 +28,7 @@ let __tla = (async () => {
28
28
  showNavigation: false,
29
29
  showToolbar: false,
30
30
  showSaveButton: false
31
- }, no = Xn(eo), It = Qn((e, r) => ({
31
+ }, ro = Zn(no), _t = eo((e, r) => ({
32
32
  landmarkPoints: [],
33
33
  isAligned: false,
34
34
  isCut: false,
@@ -64,13 +64,13 @@ let __tla = (async () => {
64
64
  isAligned: false,
65
65
  isCut: false
66
66
  })
67
- })), oo = 0.45, ut = 3, Pt = 1e-3, at = 25.4, ro = [
67
+ })), io = 0.45, pt = 3, It = 1e-3, ct = 25.4, so = [
68
68
  0.25,
69
69
  -0.25,
70
70
  0.5,
71
71
  -0.5
72
72
  ];
73
- function io(e) {
73
+ function lo(e) {
74
74
  var _a;
75
75
  const r = e.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
76
76
  if (!r || !((_a = r[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
@@ -90,21 +90,21 @@ let __tla = (async () => {
90
90
  colors: new Float32Array(l)
91
91
  } : null;
92
92
  }
93
- function so(e, r, t, o) {
93
+ function ao(e, r, t, o) {
94
94
  const l = e.getAttribute("position"), s = l.count, c = new Float32Array(s * 3), a = r.length / 3;
95
95
  let n = 1 / 0, h = 1 / 0, d = 1 / 0, u = -1 / 0, p = -1 / 0, g = -1 / 0;
96
96
  for (let k = 0; k < a; k++) {
97
97
  const B = r[k * 3] * o, $ = r[k * 3 + 1] * o, N = r[k * 3 + 2] * o;
98
98
  B < n && (n = B), B > u && (u = B), $ < h && (h = $), $ > p && (p = $), N < d && (d = N), N > g && (g = N);
99
99
  }
100
- const M = (n + u) * 0.5, f = (h + p) * 0.5, m = (d + g) * 0.5, x = u - n + 1e-6, S = p - h + 1e-6, I = g - d + 1e-6, F = x * 0.5, P = S * 0.5, b = I * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), y = x / z, D = S / z, w = I / z, A = /* @__PURE__ */ new Map();
100
+ const M = (n + u) * 0.5, f = (h + p) * 0.5, m = (d + g) * 0.5, x = u - n + 1e-6, S = p - h + 1e-6, I = g - d + 1e-6, L = x * 0.5, P = S * 0.5, b = I * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), y = x / z, D = S / z, w = I / z, A = /* @__PURE__ */ new Map();
101
101
  for (let k = 0; k < a; k++) {
102
- const B = r[k * 3] * o - M, $ = r[k * 3 + 1] * o - f, N = r[k * 3 + 2] * o - m, U = Math.min(z - 1, Math.max(0, Math.floor((B + F) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w))), fe = U * z * z + be * z + ae;
102
+ const B = r[k * 3] * o - M, $ = r[k * 3 + 1] * o - f, N = r[k * 3 + 2] * o - m, U = Math.min(z - 1, Math.max(0, Math.floor((B + L) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w))), fe = U * z * z + be * z + ae;
103
103
  let ie = A.get(fe);
104
104
  ie || (ie = [], A.set(fe, ie)), ie.push(k);
105
105
  }
106
106
  for (let k = 0; k < s; k++) {
107
- const B = l.getX(k), $ = l.getY(k), N = l.getZ(k), U = Math.min(z - 1, Math.max(0, Math.floor((B + F) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w)));
107
+ const B = l.getX(k), $ = l.getY(k), N = l.getZ(k), U = Math.min(z - 1, Math.max(0, Math.floor((B + L) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w)));
108
108
  let fe = 1 / 0, ie = 0;
109
109
  for (let J = 0; J <= z && fe > 0; J++) {
110
110
  for (let Y = -J; Y <= J; Y++) for (let pe = -J; pe <= J; pe++) for (let Z = -J; Z <= J; Z++) {
@@ -123,35 +123,35 @@ let __tla = (async () => {
123
123
  }
124
124
  e.setAttribute("color", new O.Float32BufferAttribute(c, 3));
125
125
  }
126
- const qt = {
126
+ const tn = {
127
127
  debug: 0,
128
128
  info: 1,
129
129
  warn: 2,
130
130
  error: 3
131
131
  };
132
- let un = "warn", pn = null;
132
+ let hn = "warn", gn = null;
133
133
  const ce = {
134
134
  setLevel(e) {
135
- un = e;
135
+ hn = e;
136
136
  },
137
137
  setHandler(e) {
138
- pn = e;
138
+ gn = e;
139
139
  },
140
140
  debug(e, r, t) {
141
- st("debug", e, r, t);
141
+ lt("debug", e, r, t);
142
142
  },
143
143
  info(e, r, t) {
144
- st("info", e, r, t);
144
+ lt("info", e, r, t);
145
145
  },
146
146
  warn(e, r, t) {
147
- st("warn", e, r, t);
147
+ lt("warn", e, r, t);
148
148
  },
149
149
  error(e, r, t) {
150
- st("error", e, r, t);
150
+ lt("error", e, r, t);
151
151
  }
152
152
  };
153
- function st(e, r, t, o) {
154
- if (qt[e] < qt[un]) return;
153
+ function lt(e, r, t, o) {
154
+ if (tn[e] < tn[hn]) return;
155
155
  const l = `[${r}]`, s = o !== void 0 ? [
156
156
  l,
157
157
  t,
@@ -174,9 +174,9 @@ let __tla = (async () => {
174
174
  console.error(...s);
175
175
  break;
176
176
  }
177
- pn == null ? void 0 : pn(e, r, t, o);
177
+ gn == null ? void 0 : gn(e, r, t, o);
178
178
  }
179
- function ct(e) {
179
+ function dt(e) {
180
180
  const r = e.getAttribute("position"), t = new Float32Array(r.array), o = e.getIndex();
181
181
  if (o) return {
182
182
  positions: t,
@@ -189,20 +189,20 @@ let __tla = (async () => {
189
189
  indices: s
190
190
  };
191
191
  }
192
- function hn(e, r) {
192
+ function mn(e, r) {
193
193
  const t = new O.BufferGeometry();
194
194
  return t.setAttribute("position", new O.Float32BufferAttribute(e, 3)), t.setIndex(new O.BufferAttribute(r, 1)), t.computeVertexNormals(), t;
195
195
  }
196
- async function lo(e, r, t) {
196
+ async function co(e, r, t) {
197
197
  try {
198
- const o = io(e);
198
+ const o = lo(e);
199
199
  t == null ? void 0 : t("Parsing mesh...");
200
- const s = new fn().parse(e);
200
+ const s = new pn().parse(e);
201
201
  let c = null;
202
202
  if (s.traverse((x) => {
203
203
  x.isMesh && !c && (c = x.geometry);
204
204
  }), !c) return null;
205
- const { positions: a, indices: n } = ct(c);
205
+ const { positions: a, indices: n } = dt(c);
206
206
  if (a.length < 9 || n.length < 3) return ce.warn("wasm", `Mesh too small: positions=${a.length} indices=${n.length}`), null;
207
207
  for (let x = 0; x < Math.min(a.length, 300); x++) if (!isFinite(a[x])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${x}`), null;
208
208
  const h = a.length / 3;
@@ -211,10 +211,10 @@ let __tla = (async () => {
211
211
  const d = r.preprocess_mesh(a, n, 10, 1e-4, 500), u = d.positions(), p = d.indices(), g = d.unit_converted(), M = d.detected_unit(), f = d.log();
212
212
  if (ce.debug("wasm", "preprocess result", f), u.length === 0) return null;
213
213
  t == null ? void 0 : t("Building geometry...");
214
- const m = hn(u, p);
214
+ const m = mn(u, p);
215
215
  if (o) {
216
216
  const x = g ? 1e3 : 1;
217
- so(m, o.positions, o.colors, x);
217
+ ao(m, o.positions, o.colors, x);
218
218
  }
219
219
  return {
220
220
  geometry: m,
@@ -226,15 +226,15 @@ let __tla = (async () => {
226
226
  return ce.error("wasm", "Processing failed", o), null;
227
227
  }
228
228
  }
229
- function ao(e) {
230
- const t = new fn().parse(e);
229
+ function fo(e) {
230
+ const t = new pn().parse(e);
231
231
  let o = null;
232
232
  return t.traverse((l) => {
233
233
  l.isMesh && !o && (o = l.geometry);
234
234
  }), o;
235
235
  }
236
- async function Ft(e) {
237
- const r = await e.arrayBuffer(), l = new qn().parse(r).getAttribute("position");
236
+ async function Lt(e) {
237
+ const r = await e.arrayBuffer(), l = new to().parse(r).getAttribute("position");
238
238
  if (!l || l.count === 0) throw new Error("Empty STL geometry");
239
239
  const s = [];
240
240
  for (let c = 0; c < l.count; c++) s.push(`v ${l.getX(c)} ${l.getY(c)} ${l.getZ(c)}`);
@@ -242,25 +242,25 @@ let __tla = (async () => {
242
242
  return s.join(`
243
243
  `);
244
244
  }
245
- function co(e, r) {
245
+ function uo(e, r) {
246
246
  const t = 1 / r;
247
247
  return `${Math.round(e.x * t)}_${Math.round(e.y * t)}_${Math.round(e.z * t)}`;
248
248
  }
249
- function fo(e, r) {
249
+ function po(e, r) {
250
250
  if (!e.length) return [];
251
251
  const t = [];
252
252
  for (const o of e) (t.length === 0 || t[t.length - 1].distanceTo(o) > r) && t.push(o.clone());
253
253
  return t.length > 2 && t[0].distanceTo(t[t.length - 1]) > r && t.push(t[0].clone()), t;
254
254
  }
255
- function Ze(e) {
255
+ function Ke(e) {
256
256
  let r = 0;
257
257
  for (let t = 0; t < e.length - 1; t++) r += e[t].distanceTo(e[t + 1]);
258
258
  return r;
259
259
  }
260
- function gn(e, r = 1e-3, t = false) {
260
+ function xn(e, r = 1e-3, t = false) {
261
261
  if (!e.length) return [];
262
262
  const o = /* @__PURE__ */ new Map(), l = (u) => {
263
- const p = co(u, r);
263
+ const p = uo(u, r);
264
264
  let g = o.get(p);
265
265
  return g || (g = u.clone(), o.set(p, g)), g;
266
266
  }, s = e.map((u) => ({
@@ -285,13 +285,13 @@ let __tla = (async () => {
285
285
  s.splice(f, 1), g = true;
286
286
  }
287
287
  }
288
- const M = fo(p, r);
288
+ const M = po(p, r);
289
289
  M.length > 1 && c.push(M);
290
290
  }
291
291
  if (!c.length) return [];
292
292
  if (t) {
293
- c.sort((g, M) => Ze(M) - Ze(g));
294
- const u = Ze(c[0]), p = c.filter((g) => Ze(g) >= u * 0.3);
293
+ c.sort((g, M) => Ke(M) - Ke(g));
294
+ const u = Ke(c[0]), p = c.filter((g) => Ke(g) >= u * 0.3);
295
295
  return p[p.length - 1] ?? c[0];
296
296
  }
297
297
  const a = c.filter((u) => u.length >= 3 && u[0].distanceTo(u[u.length - 1]) < r * 10), n = a.length > 0 ? a : c;
@@ -306,8 +306,8 @@ let __tla = (async () => {
306
306
  }
307
307
  return h;
308
308
  }
309
- function en(e, r, t, o = false) {
310
- const l = new dt(new C(0, 1, 0), -t), s = [], c = new cn();
309
+ function nn(e, r, t, o = false) {
310
+ const l = new ft(new C(0, 1, 0), -t), s = [], c = new fn();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
312
  const a = {
313
313
  linePoints: [],
@@ -315,7 +315,7 @@ let __tla = (async () => {
315
315
  rightmostPoint: new C(0, t, 0)
316
316
  };
317
317
  if (!l.intersectsBox(c)) return a;
318
- const n = new dn(), h = new C();
318
+ const n = new un(), h = new C();
319
319
  e.shapecast({
320
320
  intersectsBounds: (f) => l.intersectsBox(f),
321
321
  intersectsTriangle: (f) => {
@@ -326,12 +326,12 @@ let __tla = (async () => {
326
326
  });
327
327
  }
328
328
  });
329
- const d = gn(s, Pt, o);
329
+ const d = xn(s, It, o);
330
330
  if (d.length < 2) return a;
331
- const u = Ze(d);
331
+ const u = Ke(d);
332
332
  let p = -1 / 0, g = new C(0, t, 0);
333
333
  for (const f of d) f.x > p && (p = f.x, g = f.clone());
334
- const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Pt * 10;
334
+ const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < It * 10;
335
335
  return {
336
336
  linePoints: d,
337
337
  lineLength: u,
@@ -339,22 +339,22 @@ let __tla = (async () => {
339
339
  isClosed: M
340
340
  };
341
341
  }
342
- function Ne(e, r, t, o = false) {
343
- const l = en(e, r, t, o);
342
+ function Ye(e, r, t, o = false) {
343
+ const l = nn(e, r, t, o);
344
344
  if (l.isClosed && l.linePoints.length >= 3) return l;
345
345
  ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${l.linePoints.length}, closed=${l.isClosed}), retrying...`);
346
346
  let s = l;
347
- for (const c of ro) {
348
- const a = en(e, r, t + c, o);
347
+ for (const c of so) {
348
+ const a = nn(e, r, t + c, o);
349
349
  if (a.isClosed && a.linePoints.length >= 3) return ce.debug("slice", `y=${t.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
350
350
  a.linePoints.length > s.linePoints.length && (s = a);
351
351
  }
352
352
  return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${s.linePoints.length}, closed=${s.isClosed})`), s;
353
353
  }
354
- function uo(e, r, t, o) {
355
- const l = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new cn();
354
+ function ho(e, r, t, o) {
355
+ const l = new ft().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new fn();
356
356
  if (s.setFromBufferAttribute(r.getAttribute("position")), !l.intersectsBox(s)) return 0;
357
- const c = [], a = new dn(), n = new C();
357
+ const c = [], a = new un(), n = new C();
358
358
  e.shapecast({
359
359
  intersectsBounds: (d) => l.intersectsBox(d),
360
360
  intersectsTriangle: (d) => {
@@ -365,15 +365,15 @@ let __tla = (async () => {
365
365
  });
366
366
  }
367
367
  });
368
- const h = gn(c, Pt);
369
- return Ze(h);
368
+ const h = xn(c, It);
369
+ return Ke(h);
370
370
  }
371
- function mn(e) {
372
- return new ft(e, {
373
- maxLeafTris: ut
371
+ function yn(e) {
372
+ return new ut(e, {
373
+ maxLeafTris: pt
374
374
  });
375
375
  }
376
- function po(e, r, t, o) {
376
+ function go(e, r, t, o) {
377
377
  const l = e.getIndex(), s = l ? l.count / 3 : 0;
378
378
  if (s < 10) return {
379
379
  valid: false,
@@ -388,9 +388,9 @@ let __tla = (async () => {
388
388
  valid: false,
389
389
  reason: `Height too large (${c.toFixed(1)}mm > 1000mm)`
390
390
  };
391
- const a = new ft(e, {
392
- maxLeafTris: ut
393
- }), n = Ne(a, e, r);
391
+ const a = new ut(e, {
392
+ maxLeafTris: pt
393
+ }), n = Ye(a, e, r);
394
394
  if (n.lineLength === 0) return {
395
395
  valid: false,
396
396
  reason: "No circumference at green point \u2014 mesh may be empty at that height"
@@ -400,7 +400,7 @@ let __tla = (async () => {
400
400
  valid: true,
401
401
  reason: ""
402
402
  };
403
- const d = Ne(a, e, h);
403
+ const d = Ye(a, e, h);
404
404
  if (n.lineLength > 0 && d.lineLength > 0) {
405
405
  const p = n.lineLength / d.lineLength;
406
406
  if (p < 0.5) return {
@@ -410,7 +410,7 @@ let __tla = (async () => {
410
410
  }
411
411
  const u = r - o * 2;
412
412
  if (u > t) {
413
- const p = Ne(a, e, u);
413
+ const p = Ye(a, e, u);
414
414
  if (d.lineLength > 0 && p.lineLength > 0) {
415
415
  const g = d.lineLength / p.lineLength;
416
416
  if (g < 0.5) return {
@@ -425,7 +425,7 @@ let __tla = (async () => {
425
425
  };
426
426
  }
427
427
  const Fe = "pipeline";
428
- function ho(e, r, t, o) {
428
+ function mo(e, r, t, o) {
429
429
  var _a, _b, _c, _d;
430
430
  const l = e.geometry.clone(), s = r.map((a) => ({
431
431
  ...a
@@ -469,12 +469,12 @@ let __tla = (async () => {
469
469
  x: X.x,
470
470
  y: X.y,
471
471
  z: X.z
472
- }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * at);
472
+ }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * ct);
473
473
  const V = new C();
474
474
  a.computeBoundingBox(), a.boundingBox.getSize(V), o.setModelSize(Math.max(V.x, V.y, V.z)), l.dispose();
475
475
  return;
476
476
  }
477
- const { positions: u, indices: p } = ct(a), g = new Float32Array([
477
+ const { positions: u, indices: p } = dt(a), g = new Float32Array([
478
478
  h.x,
479
479
  h.y,
480
480
  h.z
@@ -490,12 +490,12 @@ let __tla = (async () => {
490
490
  x[0],
491
491
  x[1],
492
492
  x[2]
493
- ]), I = c.find_min_cross_section(u, p, M, S, 10), F = I.plane_normal();
493
+ ]), I = c.find_min_cross_section(u, p, M, S, 10), L = I.plane_normal();
494
494
  ce.info(Fe, "Cross-section found", I.details()), o.onStatus("Aligning mesh...");
495
495
  const P = new Float32Array([
496
- F[0],
497
- F[1],
498
- F[2]
496
+ L[0],
497
+ L[1],
498
+ L[2]
499
499
  ]), b = c.align_to_origin(u, g, M, P);
500
500
  let z = b.positions(), y = b.mpt(), D = b.origin();
501
501
  const w = b.transform();
@@ -511,9 +511,9 @@ let __tla = (async () => {
511
511
  w[10],
512
512
  w[11]
513
513
  ], k = new Float32Array([
514
- A[0] * F[0] + A[1] * F[1] + A[2] * F[2],
515
- A[3] * F[0] + A[4] * F[1] + A[5] * F[2],
516
- A[6] * F[0] + A[7] * F[1] + A[8] * F[2]
514
+ A[0] * L[0] + A[1] * L[1] + A[2] * L[2],
515
+ A[3] * L[0] + A[4] * L[1] + A[5] * L[2],
516
+ A[6] * L[0] + A[7] * L[1] + A[8] * L[2]
517
517
  ]);
518
518
  o.onStatus("Generating measurement points...");
519
519
  const B = c.subdivide_origin_to_plane(new Float32Array(D), new Float32Array(y), k);
@@ -531,9 +531,9 @@ let __tla = (async () => {
531
531
  if (X <= V || we[oe] <= 0) continue;
532
532
  const Le = (X - V) / 3;
533
533
  if (Le < 3) continue;
534
- let Pe = 0, Xe = 0, se = 0;
535
- for (let ze = V; ze < X; ze += 3) Pe += xe[ze], Xe += xe[ze + 1], se += xe[ze + 2];
536
- fe.push(Pe / Le, Xe / Le, se / Le);
534
+ let Pe = 0, Ge = 0, se = 0;
535
+ for (let ze = V; ze < X; ze += 3) Pe += xe[ze], Ge += xe[ze + 1], se += xe[ze + 2];
536
+ fe.push(Pe / Le, Ge / Le, se / Le);
537
537
  }
538
538
  }
539
539
  if (fe.length >= 6) {
@@ -541,7 +541,7 @@ let __tla = (async () => {
541
541
  const H = c.refine_alignment(new Float32Array(fe), z, new Float32Array(D), new Float32Array(y));
542
542
  ce.info(Fe, "Refinement complete", H.details()), z = H.positions(), y = H.mpt(), D = H.origin();
543
543
  }
544
- const ie = a.getAttribute("color"), J = hn(z, p);
544
+ const ie = a.getAttribute("color"), J = mn(z, p);
545
545
  ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new C(D[0], D[1], D[2]), n[1] = new C(y[0], y[1], y[2]), o.onStatus("Setting blue point...");
546
546
  const Y = new C(n[0].x, n[0].y, n[0].z);
547
547
  n.push(Y), o.addLandmarkPoint({
@@ -567,9 +567,9 @@ let __tla = (async () => {
567
567
  z: H.z
568
568
  }))), o.setAligned(true);
569
569
  const pe = a.boundingBox, Z = new C();
570
- pe.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * at), o.onStatus("Computing final measurements...");
570
+ pe.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * ct), o.onStatus("Computing final measurements...");
571
571
  {
572
- const H = ct(a), q = n[1].y, xe = n[0].y;
572
+ const H = dt(a), q = n[1].y, xe = n[0].y;
573
573
  let Ce = 1 / 0, we = -1 / 0;
574
574
  const oe = H.positions;
575
575
  for (let se = 1; se < oe.length; se += 3) oe[se] < Ce && (Ce = oe[se]), oe[se] > we && (we = oe[se]);
@@ -583,7 +583,7 @@ let __tla = (async () => {
583
583
  X.sort((se, ze) => se - ze), ce.info(Fe, `Horizontal slices: ${X.length} Y planes, range ${(_b = X[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = X[X.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
584
584
  const Pe = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(H.positions, H.indices, new Float32Array(X), 10);
585
585
  ce.info(Fe, `Horizontal slices (${m ? "inner" : "outer"}): ${Pe.count()}/${X.length} valid`), ce.debug(Fe, "Slice details", Pe.details());
586
- const Xe = {
586
+ const Ge = {
587
587
  yValues: X,
588
588
  circumferences: Array.from(Pe.circumferences()),
589
589
  allLoopPoints: new Float32Array(Pe.all_loop_points()),
@@ -591,16 +591,16 @@ let __tla = (async () => {
591
591
  mptY: q,
592
592
  originY: xe
593
593
  };
594
- (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Xe);
594
+ (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ge);
595
595
  }
596
596
  o.onStatus("Validating results...");
597
- const he = n[1].y, me = n[0].y, ue = po(a, he, me, t);
597
+ const he = n[1].y, me = n[0].y, ue = go(a, he, me, t);
598
598
  ue.valid || ce.warn(Fe, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (l.computeVertexNormals(), o.setClippedReferenceGeometry(l)) : l.dispose();
599
599
  } catch (a) {
600
600
  ce.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), l.dispose();
601
601
  }
602
602
  }
603
- class go extends Gn {
603
+ class xo extends Kn {
604
604
  constructor() {
605
605
  super(...arguments), this.state = {
606
606
  error: null
@@ -619,7 +619,7 @@ let __tla = (async () => {
619
619
  console.error("[ErrorBoundary] Caught error:", r, t.componentStack);
620
620
  }
621
621
  render() {
622
- return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : L("div", {
622
+ return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : F("div", {
623
623
  style: {
624
624
  display: "flex",
625
625
  flexDirection: "column",
@@ -667,7 +667,7 @@ let __tla = (async () => {
667
667
  }) : this.props.children;
668
668
  }
669
669
  }
670
- const mo = ({ message: e, onDismiss: r }) => L("div", {
670
+ const yo = ({ message: e, onDismiss: r }) => F("div", {
671
671
  style: {
672
672
  position: "absolute",
673
673
  top: 16,
@@ -684,7 +684,7 @@ let __tla = (async () => {
684
684
  gap: 12
685
685
  },
686
686
  children: [
687
- L("div", {
687
+ F("div", {
688
688
  style: {
689
689
  flex: 1
690
690
  },
@@ -720,7 +720,7 @@ let __tla = (async () => {
720
720
  children: "x"
721
721
  })
722
722
  ]
723
- }), tn = ({ message: e }) => L("div", {
723
+ }), on = ({ message: e }) => F("div", {
724
724
  style: {
725
725
  position: "absolute",
726
726
  top: 0,
@@ -758,7 +758,7 @@ let __tla = (async () => {
758
758
  })
759
759
  ]
760
760
  });
761
- function xo(e, r, t, o) {
761
+ function bo(e, r, t, o) {
762
762
  const l = new C().subVectors(t, r), s = new C().subVectors(o, r), c = new C().subVectors(e, r), a = l.dot(l), n = l.dot(s), h = l.dot(c), d = s.dot(s), u = s.dot(c), p = 1 / (a * d - n * n), g = (d * h - n * u) * p, M = (a * u - n * h) * p;
763
763
  return {
764
764
  u: 1 - g - M,
@@ -766,8 +766,8 @@ let __tla = (async () => {
766
766
  w: M
767
767
  };
768
768
  }
769
- const yo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
770
- const { addLandmarkPoint: c, landmarkPoints: a } = It(), n = re((g) => {
769
+ const wo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: a } = _t(), n = re((g) => {
771
771
  if (a.length >= r) return;
772
772
  g.stopPropagation();
773
773
  const M = g.intersections[0], f = M == null ? void 0 : M.faceIndex;
@@ -783,9 +783,9 @@ let __tla = (async () => {
783
783
  f * 3 + 1,
784
784
  f * 3 + 2
785
785
  ];
786
- const I = m.getAttribute("position"), F = new C().fromBufferAttribute(I, S[0]), P = new C().fromBufferAttribute(I, S[1]), b = new C().fromBufferAttribute(I, S[2]);
787
- F.applyMatrix4(e.matrixWorld), P.applyMatrix4(e.matrixWorld), b.applyMatrix4(e.matrixWorld);
788
- const z = M.point, y = xo(z, F, P, b), D = {
786
+ const I = m.getAttribute("position"), L = new C().fromBufferAttribute(I, S[0]), P = new C().fromBufferAttribute(I, S[1]), b = new C().fromBufferAttribute(I, S[2]);
787
+ L.applyMatrix4(e.matrixWorld), P.applyMatrix4(e.matrixWorld), b.applyMatrix4(e.matrixWorld);
788
+ const z = M.point, y = bo(z, L, P, b), D = {
789
789
  faceIndex: f,
790
790
  vertexIndices: S,
791
791
  position: {
@@ -826,9 +826,9 @@ let __tla = (async () => {
826
826
  material: p,
827
827
  renderOrder: s ? 0 : void 0
828
828
  });
829
- }, bo = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
829
+ }, So = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
830
830
  const [s, c] = E(false);
831
- return L("mesh", {
831
+ return F("mesh", {
832
832
  position: [
833
833
  e.position.x,
834
834
  e.position.y,
@@ -847,7 +847,7 @@ let __tla = (async () => {
847
847
  i("meshBasicMaterial", {
848
848
  color: o
849
849
  }),
850
- s && i(Ye, {
850
+ s && i(Xe, {
851
851
  center: true,
852
852
  style: {
853
853
  pointerEvents: "none"
@@ -868,8 +868,8 @@ let __tla = (async () => {
868
868
  })
869
869
  ]
870
870
  }, r);
871
- }, wo = ({ modelSize: e, labels: r }) => {
872
- const { landmarkPoints: t } = It(), o = e * 0.02, l = [
871
+ }, vo = ({ modelSize: e, labels: r }) => {
872
+ const { landmarkPoints: t } = _t(), o = e * 0.02, l = [
873
873
  "#44ff44",
874
874
  "#ff4444",
875
875
  "#4444ff"
@@ -878,8 +878,8 @@ let __tla = (async () => {
878
878
  "Origin",
879
879
  "Cut Plane"
880
880
  ];
881
- return i(Te, {
882
- children: t.map((a, n) => i(bo, {
881
+ return i(Oe, {
882
+ children: t.map((a, n) => i(So, {
883
883
  point: a,
884
884
  index: n,
885
885
  markerSize: o,
@@ -888,28 +888,28 @@ let __tla = (async () => {
888
888
  }, n))
889
889
  });
890
890
  };
891
- function xn(e) {
892
- return j(() => e ? new ft(e, {
893
- maxLeafTris: ut
891
+ function bn(e) {
892
+ return j(() => e ? new ut(e, {
893
+ maxLeafTris: pt
894
894
  }) : null, [
895
895
  e
896
896
  ]);
897
897
  }
898
- const nn = (e, r) => {
898
+ const rn = (e, r) => {
899
899
  const t = Math.abs(e - r);
900
900
  return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
901
- }, on = new O.Color("#8BC34A"), rn = new O.Color("#FFC107"), So = new O.Color("#FF5722"), vo = (e) => {
902
- if (e <= 7) return on.clone();
901
+ }, sn = new O.Color("#8BC34A"), ln = new O.Color("#FFC107"), Co = new O.Color("#FF5722"), Mo = (e) => {
902
+ if (e <= 7) return sn.clone();
903
903
  if (e <= 20) {
904
904
  const t = (e - 7) / 13;
905
- return on.clone().lerp(rn, t);
905
+ return sn.clone().lerp(ln, t);
906
906
  }
907
907
  const r = Math.min((e - 20) / 20, 1);
908
- return rn.clone().lerp(So, r);
909
- }, Co = (e, r) => {
908
+ return ln.clone().lerp(Co, r);
909
+ }, zo = (e, r) => {
910
910
  const t = e.length, o = new Float32Array(t * 2 * 3), l = new Float32Array(t * 2 * 3), s = [];
911
911
  for (let n = 0; n < t; n++) {
912
- const h = e[n], d = r[n], u = h.distanceTo(d), p = vo(u);
912
+ const h = e[n], d = r[n], u = h.distanceTo(d), p = Mo(u);
913
913
  if (o[n * 6] = h.x, o[n * 6 + 1] = h.y, o[n * 6 + 2] = h.z, l[n * 6] = p.r, l[n * 6 + 1] = p.g, l[n * 6 + 2] = p.b, o[n * 6 + 3] = d.x, o[n * 6 + 4] = d.y, o[n * 6 + 5] = d.z, l[n * 6 + 3] = p.r, l[n * 6 + 4] = p.g, l[n * 6 + 5] = p.b, n < t - 1) {
914
914
  const g = n * 2, M = g + 1, f = (n + 1) * 2, m = f + 1;
915
915
  s.push(g, M, f, M, m, f);
@@ -926,8 +926,8 @@ let __tla = (async () => {
926
926
  depthWrite: false
927
927
  });
928
928
  return new O.Mesh(c, a);
929
- }, Mo = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: d, wasmCircumference: u }) => {
930
- const p = j(() => d && u != null ? null : Ne(e, r, t, a), [
929
+ }, Ao = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: d, wasmCircumference: u }) => {
930
+ const p = j(() => d && u != null ? null : Ye(e, r, t, a), [
931
931
  e,
932
932
  r,
933
933
  t,
@@ -936,13 +936,13 @@ let __tla = (async () => {
936
936
  u
937
937
  ]), g = d ?? (p == null ? void 0 : p.linePoints) ?? [], M = u ?? (p == null ? void 0 : p.lineLength) ?? 0, f = j(() => {
938
938
  if (n == null || M <= 0 || g.length < 2) return null;
939
- const I = n / M, F = g.reduce((b, z) => b + z.x, 0) / g.length, P = g.reduce((b, z) => b + z.z, 0) / g.length;
940
- return g.map((b) => new C(F + (b.x - F) * I, b.y, P + (b.z - P) * I));
939
+ const I = n / M, L = g.reduce((b, z) => b + z.x, 0) / g.length, P = g.reduce((b, z) => b + z.z, 0) / g.length;
940
+ return g.map((b) => new C(L + (b.x - L) * I, b.y, P + (b.z - P) * I));
941
941
  }, [
942
942
  g,
943
943
  M,
944
944
  n
945
- ]), m = j(() => !f || g.length < 2 ? null : Co(g, f), [
945
+ ]), m = j(() => !f || g.length < 2 ? null : zo(g, f), [
946
946
  g,
947
947
  f
948
948
  ]);
@@ -954,13 +954,13 @@ let __tla = (async () => {
954
954
  const x = le(null), S = j(() => {
955
955
  const I = new O.BufferGeometry();
956
956
  I.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
957
- const F = new O.LineBasicMaterial({
957
+ const L = new O.LineBasicMaterial({
958
958
  color: 6710886,
959
959
  depthTest: false,
960
960
  depthWrite: false,
961
961
  transparent: true
962
962
  });
963
- return new O.Line(I, F);
963
+ return new O.Line(I, L);
964
964
  }, []);
965
965
  return ne(() => () => {
966
966
  S.geometry.dispose(), S.material.dispose();
@@ -976,11 +976,11 @@ let __tla = (async () => {
976
976
  M,
977
977
  t,
978
978
  s
979
- ]), sn(({ camera: I }) => {
979
+ ]), an(({ camera: I }) => {
980
980
  if (!x.current || g.length < 2) return;
981
- const F = new C();
982
- I.getWorldDirection(F);
983
- const P = new C(F.x, 0, F.z);
981
+ const L = new C();
982
+ I.getWorldDirection(L);
983
+ const P = new C(L.x, 0, L.z);
984
984
  if (P.lengthSq() < 1e-8) return;
985
985
  P.normalize();
986
986
  const b = new C().crossVectors(P, new C(0, 1, 0)).normalize();
@@ -993,7 +993,7 @@ let __tla = (async () => {
993
993
  x.current.position.copy(w);
994
994
  const A = S.geometry.getAttribute("position");
995
995
  A.setXYZ(0, y.x, y.y, y.z), A.setXYZ(1, w.x, w.y, w.z), A.needsUpdate = true;
996
- }), g.length < 2 ? null : L("group", {
996
+ }), g.length < 2 ? null : F("group", {
997
997
  renderOrder: 10,
998
998
  children: [
999
999
  i(de, {
@@ -1011,7 +1011,7 @@ let __tla = (async () => {
1011
1011
  }),
1012
1012
  f && n != null && i(de, {
1013
1013
  points: f,
1014
- color: nn(M, n),
1014
+ color: rn(M, n),
1015
1015
  lineWidth: 2.5,
1016
1016
  dashed: true,
1017
1017
  dashSize: 2,
@@ -1028,7 +1028,7 @@ let __tla = (async () => {
1028
1028
  }),
1029
1029
  i("group", {
1030
1030
  ref: x,
1031
- children: i(Ye, {
1031
+ children: i(Xe, {
1032
1032
  zIndexRange: [
1033
1033
  100,
1034
1034
  0
@@ -1037,7 +1037,7 @@ let __tla = (async () => {
1037
1037
  pointerEvents: "none",
1038
1038
  transform: "translateY(-50%)"
1039
1039
  },
1040
- children: L("div", {
1040
+ children: F("div", {
1041
1041
  style: {
1042
1042
  display: "flex",
1043
1043
  alignItems: "stretch",
@@ -1047,7 +1047,7 @@ let __tla = (async () => {
1047
1047
  whiteSpace: "nowrap"
1048
1048
  },
1049
1049
  children: [
1050
- L("div", {
1050
+ F("div", {
1051
1051
  style: {
1052
1052
  display: "flex",
1053
1053
  alignItems: "center",
@@ -1078,8 +1078,8 @@ let __tla = (async () => {
1078
1078
  ]
1079
1079
  }),
1080
1080
  n != null && M > 0 && (() => {
1081
- const I = M - n, F = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", P = nn(M, n);
1082
- return L("div", {
1081
+ const I = M - n, L = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", P = rn(M, n);
1082
+ return F("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
1085
1085
  alignItems: "center",
@@ -1090,15 +1090,15 @@ let __tla = (async () => {
1090
1090
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1091
1091
  },
1092
1092
  children: [
1093
- F && i("span", {
1093
+ L && i("span", {
1094
1094
  style: {
1095
1095
  fontSize: 10,
1096
1096
  color: P,
1097
1097
  lineHeight: 1
1098
1098
  },
1099
- children: F
1099
+ children: L
1100
1100
  }),
1101
- L("span", {
1101
+ F("span", {
1102
1102
  style: {
1103
1103
  fontSize: 13,
1104
1104
  color: P,
@@ -1110,7 +1110,7 @@ let __tla = (async () => {
1110
1110
  c === "inch" ? (I / 25.4).toFixed(2) : I.toFixed(1)
1111
1111
  ]
1112
1112
  }),
1113
- L("span", {
1113
+ F("span", {
1114
1114
  style: {
1115
1115
  fontSize: 11,
1116
1116
  color: "rgba(255,255,255,0.4)",
@@ -1130,8 +1130,8 @@ let __tla = (async () => {
1130
1130
  })
1131
1131
  ]
1132
1132
  });
1133
- }, zo = Zn(Mo), Ao = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: d, wasmSlices: u }) => {
1134
- const p = le(/* @__PURE__ */ new Map()), g = e.geometry, M = xn(g), f = j(() => {
1133
+ }, ko = Un(Ao), Fo = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: d, wasmSlices: u }) => {
1134
+ const p = le(/* @__PURE__ */ new Map()), g = e.geometry, M = bn(g), f = j(() => {
1135
1135
  if (u) {
1136
1136
  let z = [
1137
1137
  ...u.yValues
@@ -1195,7 +1195,7 @@ let __tla = (async () => {
1195
1195
  ]);
1196
1196
  const S = [
1197
1197
  "#5B9BD5"
1198
- ], I = l * oo, F = re((P) => {
1198
+ ], I = l * io, L = re((P) => {
1199
1199
  if (x) return;
1200
1200
  p.current.set(P.yPosition, P);
1201
1201
  const b = Array.from(p.current.values()).sort((z, y) => c ? y.yPosition - z.yPosition : z.yPosition - y.yPosition);
@@ -1205,14 +1205,14 @@ let __tla = (async () => {
1205
1205
  c,
1206
1206
  x
1207
1207
  ]);
1208
- return M ? i(Te, {
1209
- children: f.map((P, b) => i(zo, {
1208
+ return M ? i(Oe, {
1209
+ children: f.map((P, b) => i(ko, {
1210
1210
  bvh: M,
1211
1211
  geometry: g,
1212
1212
  yPosition: P,
1213
1213
  color: d != null && Math.abs(P - d) < o * 0.5 ? "#44ff44" : S[b % S.length],
1214
1214
  labelX: I,
1215
- onDataChange: F,
1215
+ onDataChange: L,
1216
1216
  displayUnit: a,
1217
1217
  useInnerSurface: n,
1218
1218
  formValue: h == null ? void 0 : h[b],
@@ -1221,25 +1221,25 @@ let __tla = (async () => {
1221
1221
  wasmCircumference: x == null ? void 0 : x.get(P)
1222
1222
  }, P))
1223
1223
  }) : null;
1224
- }, ko = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
1224
+ }, Lo = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
1225
1225
  var _a;
1226
1226
  const s = e.geometry;
1227
1227
  s.computeBoundingBox();
1228
1228
  const c = l ?? ((_a = s.boundingBox) == null ? void 0 : _a.min.y) ?? 0, a = r - c, n = t * 0.4, h = t * 0.03, d = le(null);
1229
- sn(({ camera: S }) => {
1229
+ an(({ camera: S }) => {
1230
1230
  if (!d.current) return;
1231
1231
  const I = new C();
1232
1232
  S.getWorldDirection(I);
1233
- const F = new C(I.x, 0, I.z);
1234
- if (F.lengthSq() < 1e-8) return;
1235
- F.normalize();
1236
- const P = new C().crossVectors(new C(0, 1, 0), F).normalize();
1233
+ const L = new C(I.x, 0, I.z);
1234
+ if (L.lengthSq() < 1e-8) return;
1235
+ L.normalize();
1236
+ const P = new C().crossVectors(new C(0, 1, 0), L).normalize();
1237
1237
  d.current.position.set(P.x * n, 0, P.z * n);
1238
1238
  const b = S.position.x - d.current.position.x, z = S.position.z - d.current.position.z;
1239
1239
  d.current.rotation.y = Math.atan2(b, z);
1240
1240
  });
1241
1241
  const u = new C(0, r, 0), p = new C(0, c, 0), g = new C(0, (r + c) / 2, 0), M = new C(-h, r, 0), f = new C(h, r, 0), m = new C(-h, c, 0), x = new C(h, c, 0);
1242
- return L("group", {
1242
+ return F("group", {
1243
1243
  ref: d,
1244
1244
  children: [
1245
1245
  i(de, {
@@ -1268,7 +1268,7 @@ let __tla = (async () => {
1268
1268
  }),
1269
1269
  i("mesh", {
1270
1270
  position: g,
1271
- children: i(Ye, {
1271
+ children: i(Xe, {
1272
1272
  center: true,
1273
1273
  style: {
1274
1274
  pointerEvents: "none"
@@ -1277,7 +1277,7 @@ let __tla = (async () => {
1277
1277
  0,
1278
1278
  0
1279
1279
  ],
1280
- children: L("div", {
1280
+ children: F("div", {
1281
1281
  style: {
1282
1282
  padding: "4px 8px",
1283
1283
  backgroundColor: "rgba(0, 0, 0, 0.7)",
@@ -1300,8 +1300,8 @@ let __tla = (async () => {
1300
1300
  })
1301
1301
  ]
1302
1302
  });
1303
- }, Fo = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1304
- const { set: h, size: d, camera: u, invalidate: p } = ln(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), F = le(a), P = le(0), b = re(() => {
1303
+ }, Po = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1304
+ const { set: h, size: d, camera: u, invalidate: p } = cn(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), L = le(a), P = le(0), b = re(() => {
1305
1305
  if (!o || e <= 0) return null;
1306
1306
  const y = a ?? o.geometry;
1307
1307
  y.computeBoundingBox();
@@ -1363,8 +1363,8 @@ let __tla = (async () => {
1363
1363
  u,
1364
1364
  z
1365
1365
  ]), ne(() => {
1366
- const y = S.current !== r, D = I.current !== t, w = !F.current && !!a;
1367
- if (S.current = r, I.current = t, F.current = a, !y && !D && !w || !r || l !== "3D") return;
1366
+ const y = S.current !== r, D = I.current !== t, w = !L.current && !!a;
1367
+ if (S.current = r, I.current = t, L.current = a, !y && !D && !w || !r || l !== "3D") return;
1368
1368
  const A = b();
1369
1369
  A && h({
1370
1370
  camera: A
@@ -1452,12 +1452,12 @@ let __tla = (async () => {
1452
1452
  l,
1453
1453
  o
1454
1454
  ]), null;
1455
- }, Lo = ({ mesh: e, isDragging: r }) => {
1455
+ }, Io = ({ mesh: e, isDragging: r }) => {
1456
1456
  var _a;
1457
1457
  const t = e.geometry;
1458
1458
  t.computeBoundingBox();
1459
1459
  const o = new C();
1460
- return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(an, {
1460
+ return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(dn, {
1461
1461
  enableDamping: false,
1462
1462
  enablePan: false,
1463
1463
  minPolarAngle: Math.PI * 0.15,
@@ -1471,7 +1471,7 @@ let __tla = (async () => {
1471
1471
  o.z
1472
1472
  ]
1473
1473
  });
1474
- }, Po = ({ wasAutoScaled: e, onDismiss: r }) => L("div", {
1474
+ }, _o = ({ wasAutoScaled: e, onDismiss: r }) => F("div", {
1475
1475
  style: {
1476
1476
  position: "absolute",
1477
1477
  bottom: 16,
@@ -1512,7 +1512,7 @@ let __tla = (async () => {
1512
1512
  children: "X"
1513
1513
  })
1514
1514
  ]
1515
- }), Io = ({ isDoubleShell: e, onDismiss: r }) => L("div", {
1515
+ }), Do = ({ isDoubleShell: e, onDismiss: r }) => F("div", {
1516
1516
  style: {
1517
1517
  position: "absolute",
1518
1518
  bottom: 68,
@@ -1553,7 +1553,7 @@ let __tla = (async () => {
1553
1553
  children: "X"
1554
1554
  })
1555
1555
  ]
1556
- }), _o = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1556
+ }), Bo = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1557
1557
  style: {
1558
1558
  backgroundColor: "#fff",
1559
1559
  borderBottom: "1px solid #e0e0e0",
@@ -1564,12 +1564,12 @@ let __tla = (async () => {
1564
1564
  },
1565
1565
  children: e.map((o, l) => {
1566
1566
  const s = o.number < r, c = o.number === r;
1567
- return L("div", {
1567
+ return F("div", {
1568
1568
  style: {
1569
1569
  display: "contents"
1570
1570
  },
1571
1571
  children: [
1572
- L("div", {
1572
+ F("div", {
1573
1573
  style: {
1574
1574
  display: "flex",
1575
1575
  alignItems: "center",
@@ -1617,24 +1617,24 @@ let __tla = (async () => {
1617
1617
  ]
1618
1618
  }, o.number);
1619
1619
  })
1620
- }), Do = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1621
- const c = e.geometry, a = j(() => new ft(c, {
1622
- maxLeafTris: ut
1620
+ }), Ro = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1621
+ const c = e.geometry, a = j(() => new ut(c, {
1622
+ maxLeafTris: pt
1623
1623
  }), [
1624
1624
  c
1625
- ]), n = j(() => Ne(a, c, t), [
1625
+ ]), n = j(() => Ye(a, c, t), [
1626
1626
  a,
1627
1627
  c,
1628
1628
  t
1629
- ]), h = j(() => new dt(new C(0, -1, 0), r), [
1629
+ ]), h = j(() => new ft(new C(0, -1, 0), r), [
1630
1630
  r
1631
1631
  ]), { mlLine: d, apLine: u, mlWidth: p, apWidth: g } = j(() => {
1632
1632
  let m = null, x = null, S = 0, I = 0;
1633
1633
  if (n.linePoints.length >= 2) {
1634
- let F = n.linePoints[0], P = n.linePoints[0], b = n.linePoints[0], z = n.linePoints[0];
1635
- for (const y of n.linePoints) y.x < F.x && (F = y), y.x > P.x && (P = y), y.z < b.z && (b = y), y.z > z.z && (z = y);
1634
+ let L = n.linePoints[0], P = n.linePoints[0], b = n.linePoints[0], z = n.linePoints[0];
1635
+ for (const y of n.linePoints) y.x < L.x && (L = y), y.x > P.x && (P = y), y.z < b.z && (b = y), y.z > z.z && (z = y);
1636
1636
  m = [
1637
- new C(F.x, t, F.z),
1637
+ new C(L.x, t, L.z),
1638
1638
  new C(P.x, t, P.z)
1639
1639
  ], x = [
1640
1640
  new C(b.x, t, b.z),
@@ -1651,7 +1651,7 @@ let __tla = (async () => {
1651
1651
  n,
1652
1652
  t
1653
1653
  ]), M = (m) => s === "inch" ? (m / 25.4).toFixed(2) : m.toFixed(1), f = s === "inch" ? "in" : "mm";
1654
- return L(Te, {
1654
+ return F(Oe, {
1655
1655
  children: [
1656
1656
  i("mesh", {
1657
1657
  geometry: e.geometry,
@@ -1674,7 +1674,7 @@ let __tla = (async () => {
1674
1674
  depthWrite: false,
1675
1675
  transparent: true
1676
1676
  }),
1677
- d && L(Te, {
1677
+ d && F(Oe, {
1678
1678
  children: [
1679
1679
  i(de, {
1680
1680
  points: d,
@@ -1684,7 +1684,7 @@ let __tla = (async () => {
1684
1684
  depthWrite: false,
1685
1685
  transparent: true
1686
1686
  }),
1687
- i(Ye, {
1687
+ i(Xe, {
1688
1688
  position: [
1689
1689
  d[0].x,
1690
1690
  t,
@@ -1701,7 +1701,7 @@ let __tla = (async () => {
1701
1701
  backgroundColor: "rgba(0,0,0,0.75)",
1702
1702
  borderRadius: 3
1703
1703
  },
1704
- children: L("span", {
1704
+ children: F("span", {
1705
1705
  style: {
1706
1706
  fontSize: 12,
1707
1707
  color: "#ff8800",
@@ -1718,7 +1718,7 @@ let __tla = (async () => {
1718
1718
  })
1719
1719
  ]
1720
1720
  }),
1721
- u && L(Te, {
1721
+ u && F(Oe, {
1722
1722
  children: [
1723
1723
  i(de, {
1724
1724
  points: u,
@@ -1728,7 +1728,7 @@ let __tla = (async () => {
1728
1728
  depthWrite: false,
1729
1729
  transparent: true
1730
1730
  }),
1731
- i(Ye, {
1731
+ i(Xe, {
1732
1732
  position: [
1733
1733
  Math.max(u[0].x, u[1].x) + o * 0.02,
1734
1734
  t,
@@ -1745,7 +1745,7 @@ let __tla = (async () => {
1745
1745
  backgroundColor: "rgba(0,0,0,0.75)",
1746
1746
  borderRadius: 3
1747
1747
  },
1748
- children: L("span", {
1748
+ children: F("span", {
1749
1749
  style: {
1750
1750
  fontSize: 12,
1751
1751
  color: "#ff00ff",
@@ -1764,19 +1764,19 @@ let __tla = (async () => {
1764
1764
  })
1765
1765
  ]
1766
1766
  });
1767
- }, Bo = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
1768
- const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = ln(), S = le(0), I = e.geometry, F = xn(I), P = j(() => F ? Ne(F, I, r) : {
1767
+ }, Wo = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
1768
+ const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = cn(), S = le(0), I = e.geometry, L = bn(I), P = j(() => L ? Ye(L, I, r) : {
1769
1769
  linePoints: [],
1770
1770
  lineLength: 0,
1771
1771
  rightmostPoint: new C()
1772
1772
  }, [
1773
- F,
1773
+ L,
1774
1774
  I,
1775
1775
  r
1776
1776
  ]), b = re((A, k) => {
1777
- const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new Jn();
1777
+ const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new qn();
1778
1778
  U.setFromCamera(new O.Vector2($, N), m);
1779
- const be = new dt(new C(0, 0, 1), 0), ae = new C();
1779
+ const be = new ft(new C(0, 0, 1), 0), ae = new C();
1780
1780
  return U.ray.intersectPlane(be, ae), ae ? ae.y : r;
1781
1781
  }, [
1782
1782
  m,
@@ -1807,7 +1807,7 @@ let __tla = (async () => {
1807
1807
  ]);
1808
1808
  if (P.linePoints.length < 2) return null;
1809
1809
  const w = p ? n : M ? a : c;
1810
- return L("group", {
1810
+ return F("group", {
1811
1811
  renderOrder: 10,
1812
1812
  children: [
1813
1813
  i(de, {
@@ -1834,7 +1834,7 @@ let __tla = (async () => {
1834
1834
  r,
1835
1835
  0
1836
1836
  ],
1837
- children: i(Ye, {
1837
+ children: i(Xe, {
1838
1838
  center: true,
1839
1839
  children: i("div", {
1840
1840
  style: {
@@ -1853,17 +1853,17 @@ let __tla = (async () => {
1853
1853
  ]
1854
1854
  });
1855
1855
  };
1856
- function Ro(e, r) {
1856
+ function Eo(e, r) {
1857
1857
  if (e == null) return {};
1858
1858
  var t = {}, o = Object.keys(e), l, s;
1859
1859
  for (s = 0; s < o.length; s++) l = o[s], !(r.indexOf(l) >= 0) && (t[l] = e[l]);
1860
1860
  return t;
1861
1861
  }
1862
- var Wo = [
1862
+ var To = [
1863
1863
  "color"
1864
- ], Eo = Kn(function(e, r) {
1865
- var t = e.color, o = t === void 0 ? "currentColor" : t, l = Ro(e, Wo);
1866
- return Qt("svg", Object.assign({
1864
+ ], Oo = Jn(function(e, r) {
1865
+ var t = e.color, o = t === void 0 ? "currentColor" : t, l = Eo(e, To);
1866
+ return en("svg", Object.assign({
1867
1867
  width: "15",
1868
1868
  height: "15",
1869
1869
  viewBox: "0 0 15 15",
@@ -1871,20 +1871,20 @@ let __tla = (async () => {
1871
1871
  xmlns: "http://www.w3.org/2000/svg"
1872
1872
  }, l, {
1873
1873
  ref: r
1874
- }), Qt("path", {
1874
+ }), en("path", {
1875
1875
  d: "M7.5 2C7.77614 2 8 2.22386 8 2.5L8 11.2929L11.1464 8.14645C11.3417 7.95118 11.6583 7.95118 11.8536 8.14645C12.0488 8.34171 12.0488 8.65829 11.8536 8.85355L7.85355 12.8536C7.75979 12.9473 7.63261 13 7.5 13C7.36739 13 7.24021 12.9473 7.14645 12.8536L3.14645 8.85355C2.95118 8.65829 2.95118 8.34171 3.14645 8.14645C3.34171 7.95118 3.65829 7.95118 3.85355 8.14645L7 11.2929L7 2.5C7 2.22386 7.22386 2 7.5 2Z",
1876
1876
  fill: o,
1877
1877
  fillRule: "evenodd",
1878
1878
  clipRule: "evenodd"
1879
1879
  }));
1880
1880
  });
1881
- const To = [
1881
+ const $o = [
1882
1882
  "Scan doesn't load properly",
1883
1883
  "Takes too long",
1884
1884
  "I don't want to",
1885
1885
  "I want a second opinion",
1886
1886
  "I measured from IT"
1887
- ], je = {
1887
+ ], Ne = {
1888
1888
  padding: "8px 20px",
1889
1889
  borderRadius: 4,
1890
1890
  fontSize: 14,
@@ -1893,7 +1893,7 @@ let __tla = (async () => {
1893
1893
  fontFamily: "system-ui, sans-serif",
1894
1894
  letterSpacing: "0.4px",
1895
1895
  lineHeight: "36px"
1896
- }, Lt = {
1896
+ }, Pt = {
1897
1897
  width: "100%",
1898
1898
  padding: "10px 12px",
1899
1899
  fontSize: 15,
@@ -1902,7 +1902,7 @@ let __tla = (async () => {
1902
1902
  outline: "none",
1903
1903
  boxSizing: "border-box",
1904
1904
  fontFamily: "system-ui, sans-serif"
1905
- }, Oo = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s }) => {
1905
+ }, Ho = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s }) => {
1906
1906
  const c = e === "AK" ? "IT" : "MPT", a = r, n = e === "AK" ? 18 : 9, h = j(() => {
1907
1907
  const w = [];
1908
1908
  for (let A = 2; A >= 1; A -= a) w.push(`${A}\u2033 above ${c}`);
@@ -1913,7 +1913,7 @@ let __tla = (async () => {
1913
1913
  a,
1914
1914
  c,
1915
1915
  n
1916
- ]), [d, u] = E({}), [p, g] = E(""), [M, f] = E(false), [m, x] = E(false), [S, I] = E(null), [F, P] = E(""), b = j(() => {
1916
+ ]), [d, u] = E({}), [p, g] = E(""), [M, f] = E(false), [m, x] = E(false), [S, I] = E(null), [L, P] = E(""), b = j(() => {
1917
1917
  const w = p !== "" && !isNaN(parseFloat(p)), A = h.some((k) => {
1918
1918
  const B = d[k];
1919
1919
  return B != null && B !== "" && !isNaN(parseFloat(B));
@@ -1956,8 +1956,8 @@ let __tla = (async () => {
1956
1956
  f(false), x(true);
1957
1957
  }, []);
1958
1958
  if (m) {
1959
- const w = S != null && (S !== "Other" || F.trim() !== ""), A = () => {
1960
- w && s(S === "Other" ? `Other: ${F.trim()}` : S);
1959
+ const w = S != null && (S !== "Other" || L.trim() !== ""), A = () => {
1960
+ w && s(S === "Other" ? `Other: ${L.trim()}` : S);
1961
1961
  };
1962
1962
  return i("div", {
1963
1963
  style: {
@@ -1972,7 +1972,7 @@ let __tla = (async () => {
1972
1972
  zIndex: 9999,
1973
1973
  fontFamily: "system-ui, sans-serif"
1974
1974
  },
1975
- children: L("div", {
1975
+ children: F("div", {
1976
1976
  style: {
1977
1977
  backgroundColor: "#fff",
1978
1978
  borderRadius: 12,
@@ -1980,7 +1980,7 @@ let __tla = (async () => {
1980
1980
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
1981
1981
  },
1982
1982
  children: [
1983
- L("div", {
1983
+ F("div", {
1984
1984
  style: {
1985
1985
  padding: "24px 24px 0"
1986
1986
  },
@@ -2003,7 +2003,7 @@ let __tla = (async () => {
2003
2003
  })
2004
2004
  ]
2005
2005
  }),
2006
- L("div", {
2006
+ F("div", {
2007
2007
  style: {
2008
2008
  padding: "20px 24px",
2009
2009
  display: "flex",
@@ -2012,9 +2012,9 @@ let __tla = (async () => {
2012
2012
  },
2013
2013
  children: [
2014
2014
  [
2015
- ...To,
2015
+ ...$o,
2016
2016
  "Other"
2017
- ].map((k) => L("label", {
2017
+ ].map((k) => F("label", {
2018
2018
  style: {
2019
2019
  display: "flex",
2020
2020
  alignItems: "center",
@@ -2053,13 +2053,13 @@ let __tla = (async () => {
2053
2053
  autoFocus: true,
2054
2054
  type: "text",
2055
2055
  placeholder: "Please describe...",
2056
- value: F,
2056
+ value: L,
2057
2057
  onChange: (k) => P(k.target.value),
2058
2058
  onKeyDown: (k) => {
2059
2059
  k.key === "Enter" && A();
2060
2060
  },
2061
2061
  style: {
2062
- ...Lt,
2062
+ ...Pt,
2063
2063
  marginTop: 8,
2064
2064
  marginLeft: 40,
2065
2065
  width: "calc(100% - 40px)",
@@ -2068,7 +2068,7 @@ let __tla = (async () => {
2068
2068
  })
2069
2069
  ]
2070
2070
  }),
2071
- L("div", {
2071
+ F("div", {
2072
2072
  style: {
2073
2073
  display: "flex",
2074
2074
  justifyContent: "flex-end",
@@ -2082,7 +2082,7 @@ let __tla = (async () => {
2082
2082
  x(false), I(null), P("");
2083
2083
  },
2084
2084
  style: {
2085
- ...je,
2085
+ ...Ne,
2086
2086
  backgroundColor: "#fff",
2087
2087
  border: "1px solid #ddd",
2088
2088
  color: "#666"
@@ -2093,7 +2093,7 @@ let __tla = (async () => {
2093
2093
  onClick: A,
2094
2094
  disabled: !w,
2095
2095
  style: {
2096
- ...je,
2096
+ ...Ne,
2097
2097
  backgroundColor: w ? "rgb(12, 67, 173)" : "#e0e0e0",
2098
2098
  border: "none",
2099
2099
  color: w ? "#fff" : "#9e9e9e",
@@ -2120,7 +2120,7 @@ let __tla = (async () => {
2120
2120
  zIndex: 9999,
2121
2121
  fontFamily: "system-ui, sans-serif"
2122
2122
  },
2123
- children: L("div", {
2123
+ children: F("div", {
2124
2124
  style: {
2125
2125
  backgroundColor: "#fff",
2126
2126
  borderRadius: 8,
@@ -2146,7 +2146,7 @@ let __tla = (async () => {
2146
2146
  },
2147
2147
  children: "Your measurements will be submitted without comparing to the scan. Are you sure?"
2148
2148
  }),
2149
- L("div", {
2149
+ F("div", {
2150
2150
  style: {
2151
2151
  display: "flex",
2152
2152
  justifyContent: "flex-end",
@@ -2156,7 +2156,7 @@ let __tla = (async () => {
2156
2156
  i("button", {
2157
2157
  onClick: () => f(false),
2158
2158
  style: {
2159
- ...je,
2159
+ ...Ne,
2160
2160
  backgroundColor: "#fff",
2161
2161
  border: "1px solid #bdbdbd",
2162
2162
  color: "#333"
@@ -2166,7 +2166,7 @@ let __tla = (async () => {
2166
2166
  i("button", {
2167
2167
  onClick: D,
2168
2168
  style: {
2169
- ...je,
2169
+ ...Ne,
2170
2170
  backgroundColor: "rgb(12, 67, 173)",
2171
2171
  border: "none",
2172
2172
  color: "#fff"
@@ -2177,7 +2177,7 @@ let __tla = (async () => {
2177
2177
  })
2178
2178
  ]
2179
2179
  })
2180
- }) : L("div", {
2180
+ }) : F("div", {
2181
2181
  style: {
2182
2182
  position: "fixed",
2183
2183
  inset: 0,
@@ -2195,7 +2195,7 @@ let __tla = (async () => {
2195
2195
  borderBottom: "1px solid #e0e0e0",
2196
2196
  flexShrink: 0
2197
2197
  },
2198
- children: L("div", {
2198
+ children: F("div", {
2199
2199
  style: {
2200
2200
  display: "flex",
2201
2201
  alignItems: "center",
@@ -2204,9 +2204,9 @@ let __tla = (async () => {
2204
2204
  gap: 12
2205
2205
  },
2206
2206
  children: [
2207
- L("div", {
2207
+ F("div", {
2208
2208
  children: [
2209
- L("div", {
2209
+ F("div", {
2210
2210
  style: {
2211
2211
  fontSize: 22,
2212
2212
  fontWeight: 600,
@@ -2217,7 +2217,7 @@ let __tla = (async () => {
2217
2217
  " Measurements"
2218
2218
  ]
2219
2219
  }),
2220
- L("div", {
2220
+ F("div", {
2221
2221
  style: {
2222
2222
  fontSize: 13,
2223
2223
  color: "rgba(0,0,0,0.54)",
@@ -2235,7 +2235,7 @@ let __tla = (async () => {
2235
2235
  i("button", {
2236
2236
  onClick: y,
2237
2237
  style: {
2238
- ...je,
2238
+ ...Ne,
2239
2239
  backgroundColor: "#fff",
2240
2240
  border: "2px solid rgb(12, 67, 173)",
2241
2241
  color: "rgb(12, 67, 173)",
@@ -2243,7 +2243,7 @@ let __tla = (async () => {
2243
2243
  padding: "6px 16px",
2244
2244
  fontSize: 13
2245
2245
  },
2246
- children: L("span", {
2246
+ children: F("span", {
2247
2247
  style: {
2248
2248
  marginRight: 8,
2249
2249
  display: "flex",
@@ -2251,7 +2251,7 @@ let __tla = (async () => {
2251
2251
  gap: 4
2252
2252
  },
2253
2253
  children: [
2254
- i(Eo, {
2254
+ i(Oo, {
2255
2255
  style: {
2256
2256
  width: 16,
2257
2257
  height: 16
@@ -2264,7 +2264,7 @@ let __tla = (async () => {
2264
2264
  ]
2265
2265
  })
2266
2266
  }),
2267
- L("div", {
2267
+ F("div", {
2268
2268
  style: {
2269
2269
  flex: 1,
2270
2270
  minHeight: 0,
@@ -2289,9 +2289,9 @@ let __tla = (async () => {
2289
2289
  gap: "12px 20px",
2290
2290
  marginBottom: 28
2291
2291
  },
2292
- children: h.map((w, A) => L("div", {
2292
+ children: h.map((w, A) => F("div", {
2293
2293
  children: [
2294
- L("label", {
2294
+ F("label", {
2295
2295
  style: {
2296
2296
  display: "block",
2297
2297
  fontSize: 12,
@@ -2319,7 +2319,7 @@ let __tla = (async () => {
2319
2319
  [w]: k.target.value
2320
2320
  })),
2321
2321
  style: {
2322
- ...Lt,
2322
+ ...Pt,
2323
2323
  padding: "8px 10px",
2324
2324
  fontSize: 14,
2325
2325
  borderColor: d[w] ? "rgb(12, 67, 173)" : "#ccc"
@@ -2344,9 +2344,9 @@ let __tla = (async () => {
2344
2344
  gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
2345
2345
  gap: "12px 20px"
2346
2346
  },
2347
- children: L("div", {
2347
+ children: F("div", {
2348
2348
  children: [
2349
- L("label", {
2349
+ F("label", {
2350
2350
  style: {
2351
2351
  display: "block",
2352
2352
  fontSize: 12,
@@ -2370,7 +2370,7 @@ let __tla = (async () => {
2370
2370
  value: p,
2371
2371
  onChange: (w) => g(w.target.value),
2372
2372
  style: {
2373
- ...Lt,
2373
+ ...Pt,
2374
2374
  padding: "8px 10px",
2375
2375
  fontSize: 14,
2376
2376
  borderColor: p ? "rgb(12, 67, 173)" : "#ccc"
@@ -2382,7 +2382,7 @@ let __tla = (async () => {
2382
2382
  })
2383
2383
  ]
2384
2384
  }),
2385
- L("div", {
2385
+ F("div", {
2386
2386
  style: {
2387
2387
  padding: "12px 24px",
2388
2388
  backgroundColor: "#fff",
@@ -2398,7 +2398,7 @@ let __tla = (async () => {
2398
2398
  i("button", {
2399
2399
  onClick: () => f(true),
2400
2400
  style: {
2401
- ...je,
2401
+ ...Ne,
2402
2402
  backgroundColor: "#fff",
2403
2403
  border: "1px solid #bdbdbd",
2404
2404
  color: "#666",
@@ -2411,7 +2411,7 @@ let __tla = (async () => {
2411
2411
  onClick: z,
2412
2412
  disabled: !b,
2413
2413
  style: {
2414
- ...je,
2414
+ ...Ne,
2415
2415
  backgroundColor: b ? "rgb(12, 67, 173)" : "#e0e0e0",
2416
2416
  border: "none",
2417
2417
  color: b ? "#fff" : "#9e9e9e",
@@ -2426,18 +2426,18 @@ let __tla = (async () => {
2426
2426
  ]
2427
2427
  });
2428
2428
  };
2429
- function yn(e, r, t) {
2429
+ function wn(e, r, t) {
2430
2430
  const o = e.getAttribute("position"), l = t - r;
2431
2431
  if (l < 1) return null;
2432
2432
  const s = 30, c = l / s, a = [];
2433
2433
  for (let m = 0; m < s; m++) {
2434
2434
  const x = r + m * c, S = r + (m + 1) * c;
2435
- let I = 0, F = 0, P = 0, b = 0;
2435
+ let I = 0, L = 0, P = 0, b = 0;
2436
2436
  for (let z = 0; z < o.count; z++) {
2437
2437
  const y = o.getY(z);
2438
- y >= x && y < S && (I += o.getX(z), F += y, P += o.getZ(z), b++);
2438
+ y >= x && y < S && (I += o.getX(z), L += y, P += o.getZ(z), b++);
2439
2439
  }
2440
- b > 20 && a.push(new C(I / b, F / b, P / b));
2440
+ b > 20 && a.push(new C(I / b, L / b, P / b));
2441
2441
  }
2442
2442
  if (a.length < 5) return null;
2443
2443
  const n = new C();
@@ -2450,13 +2450,13 @@ let __tla = (async () => {
2450
2450
  }
2451
2451
  let f = new C(0.01, 1, 0.01).normalize();
2452
2452
  for (let m = 0; m < 30; m++) {
2453
- const x = h * f.x + d * f.y + u * f.z, S = d * f.x + p * f.y + g * f.z, I = u * f.x + g * f.y + M * f.z, F = new C(x, S, I), P = F.length();
2454
- if (P < 1e-10 || (F.divideScalar(P), f.distanceTo(F) < 1e-8)) break;
2455
- f = F;
2453
+ const x = h * f.x + d * f.y + u * f.z, S = d * f.x + p * f.y + g * f.z, I = u * f.x + g * f.y + M * f.z, L = new C(x, S, I), P = L.length();
2454
+ if (P < 1e-10 || (L.divideScalar(P), f.distanceTo(L) < 1e-8)) break;
2455
+ f = L;
2456
2456
  }
2457
2457
  return f.y < 0 && f.negate(), f;
2458
2458
  }
2459
- const $o = {
2459
+ const Vo = {
2460
2460
  pcaAxes: true,
2461
2461
  obb: true,
2462
2462
  obbAxis: true,
@@ -2466,12 +2466,12 @@ let __tla = (async () => {
2466
2466
  landmarkAxis: true,
2467
2467
  iterativePCA: false,
2468
2468
  fullRegionPCA: true
2469
- }, Ho = [
2469
+ }, jo = [
2470
2470
  "#ff4444",
2471
2471
  "#44cc44",
2472
2472
  "#4488ff"
2473
2473
  ];
2474
- function bn(e) {
2474
+ function Sn(e) {
2475
2475
  const r = e.getAttribute("position"), t = r.count, o = new C();
2476
2476
  for (let f = 0; f < t; f++) o.x += r.getX(f), o.y += r.getY(f), o.z += r.getZ(f);
2477
2477
  o.divideScalar(t);
@@ -2501,7 +2501,7 @@ let __tla = (async () => {
2501
2501
  for (let f = 0; f < 3; f++) {
2502
2502
  let m = new C(1 + f * 0.1, 1 - f * 0.1, 0.5 + f * 0.3).normalize(), x = 0;
2503
2503
  for (let S = 0; S < 100; S++) {
2504
- const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, F = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, P = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, b = new C(I, F, P);
2504
+ const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, L = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, P = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, b = new C(I, L, P);
2505
2505
  if (x = b.length(), x < 1e-12) break;
2506
2506
  if (b.divideScalar(x), m.distanceTo(b) < 1e-10) {
2507
2507
  m = b;
@@ -2511,7 +2511,7 @@ let __tla = (async () => {
2511
2511
  }
2512
2512
  d.push(m.clone()), u.push(x);
2513
2513
  for (let S = 0; S < 3; S++) for (let I = 0; I < 3; I++) {
2514
- const F = [
2514
+ const L = [
2515
2515
  m.x,
2516
2516
  m.y,
2517
2517
  m.z
@@ -2520,7 +2520,7 @@ let __tla = (async () => {
2520
2520
  m.y,
2521
2521
  m.z
2522
2522
  ][I];
2523
- p[S][I] -= x * F * P;
2523
+ p[S][I] -= x * L * P;
2524
2524
  }
2525
2525
  }
2526
2526
  const g = new C();
@@ -2535,7 +2535,7 @@ let __tla = (async () => {
2535
2535
  let m = 1 / 0, x = -1 / 0;
2536
2536
  const S = d[f];
2537
2537
  for (let I = 0; I < t; I++) {
2538
- const F = r.getX(I) - g.x, P = r.getY(I) - g.y, b = r.getZ(I) - g.z, z = F * S.x + P * S.y + b * S.z;
2538
+ const L = r.getX(I) - g.x, P = r.getY(I) - g.y, b = r.getZ(I) - g.z, z = L * S.x + P * S.y + b * S.z;
2539
2539
  z < m && (m = z), z > x && (x = z);
2540
2540
  }
2541
2541
  M[f] = (x - m) / 2;
@@ -2547,7 +2547,7 @@ let __tla = (async () => {
2547
2547
  halfExtents: M
2548
2548
  };
2549
2549
  }
2550
- function Vo({ pca: e }) {
2550
+ function No({ pca: e }) {
2551
2551
  return i("group", {
2552
2552
  children: e.axes.map((r, t) => {
2553
2553
  const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), l = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
@@ -2556,13 +2556,13 @@ let __tla = (async () => {
2556
2556
  l,
2557
2557
  o
2558
2558
  ],
2559
- color: Ho[t],
2559
+ color: jo[t],
2560
2560
  lineWidth: 2
2561
2561
  }, t);
2562
2562
  })
2563
2563
  });
2564
2564
  }
2565
- function jo({ pca: e }) {
2565
+ function Yo({ pca: e }) {
2566
2566
  const r = j(() => {
2567
2567
  const { center: t, axes: o, halfExtents: l } = e, s = [];
2568
2568
  for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let h = -1; h <= 1; h += 2) s.push(t.clone().addScaledVector(o[0], a * l[0]).addScaledVector(o[1], n * l[1]).addScaledVector(o[2], h * l[2]));
@@ -2632,7 +2632,7 @@ let __tla = (async () => {
2632
2632
  }, o))
2633
2633
  });
2634
2634
  }
2635
- function No({ redPoint: e, greenPoint: r }) {
2635
+ function Xo({ redPoint: e, greenPoint: r }) {
2636
2636
  const t = j(() => new C().subVectors(r, e).normalize(), [
2637
2637
  e,
2638
2638
  r
@@ -2642,7 +2642,7 @@ let __tla = (async () => {
2642
2642
  }, [
2643
2643
  t
2644
2644
  ]), l = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2645
- return L("group", {
2645
+ return F("group", {
2646
2646
  children: [
2647
2647
  i(de, {
2648
2648
  points: [
@@ -2652,7 +2652,7 @@ let __tla = (async () => {
2652
2652
  color: l,
2653
2653
  lineWidth: 3
2654
2654
  }),
2655
- L("mesh", {
2655
+ F("mesh", {
2656
2656
  position: e,
2657
2657
  children: [
2658
2658
  i("sphereGeometry", {
@@ -2667,7 +2667,7 @@ let __tla = (async () => {
2667
2667
  })
2668
2668
  ]
2669
2669
  }),
2670
- L("mesh", {
2670
+ F("mesh", {
2671
2671
  position: r,
2672
2672
  children: [
2673
2673
  i("sphereGeometry", {
@@ -2685,13 +2685,13 @@ let __tla = (async () => {
2685
2685
  ]
2686
2686
  });
2687
2687
  }
2688
- function Yo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2688
+ function Go({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2689
2689
  const s = o * 0.15, c = j(() => {
2690
2690
  const a = [];
2691
2691
  let n = t - 10;
2692
2692
  const h = new C(0, 1, 0);
2693
2693
  for (; n > r; ) {
2694
- const d = Math.min(n, t), u = Math.max(n, t), p = yn(e, d, u);
2694
+ const d = Math.min(n, t), u = Math.max(n, t), p = wn(e, d, u);
2695
2695
  if (p) {
2696
2696
  const g = p.dot(h), M = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2697
2697
  a.push({
@@ -2712,7 +2712,7 @@ let __tla = (async () => {
2712
2712
  return i("group", {
2713
2713
  children: c.map((a, n) => {
2714
2714
  const h = (a.regionMin + a.regionMax) / 2, d = new C(0, h, 0), u = d.clone().addScaledVector(a.axis, s), p = d.clone().addScaledVector(a.axis, -s), g = n / Math.max(1, c.length - 1), M = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2715
- return L("group", {
2715
+ return F("group", {
2716
2716
  children: [
2717
2717
  i(de, {
2718
2718
  points: [
@@ -2739,9 +2739,9 @@ let __tla = (async () => {
2739
2739
  })
2740
2740
  });
2741
2741
  }
2742
- function Xo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2742
+ function Zo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2743
2743
  const l = j(() => {
2744
- const u = yn(e, r, t);
2744
+ const u = wn(e, r, t);
2745
2745
  if (!u) return null;
2746
2746
  const p = u.dot(new C(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(p))) * 180 / Math.PI;
2747
2747
  return {
@@ -2769,7 +2769,7 @@ let __tla = (async () => {
2769
2769
  })
2770
2770
  });
2771
2771
  }
2772
- function Go({ pca: e, modelSize: r }) {
2772
+ function Ko({ pca: e, modelSize: r }) {
2773
2773
  const t = e.axes[0], o = r * 0.6, l = e.center.clone().addScaledVector(t, o), s = e.center.clone().addScaledVector(t, -o);
2774
2774
  return i(de, {
2775
2775
  points: [
@@ -2783,20 +2783,20 @@ let __tla = (async () => {
2783
2783
  gapSize: 2
2784
2784
  });
2785
2785
  }
2786
- function Zo({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2786
+ function Uo({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2787
2787
  const s = j(() => {
2788
- const d = l ?? e, u = mn(d), p = new C(0, 1, 0), g = 5, f = t + 3 * 25.4, m = [];
2788
+ const d = l ?? e, u = yn(d), p = new C(0, 1, 0), g = 5, f = t + 3 * 25.4, m = [];
2789
2789
  for (let y = r + g; y < f; y += g) {
2790
- const D = uo(u, d, new C(0, y, 0), p);
2790
+ const D = ho(u, d, new C(0, y, 0), p);
2791
2791
  D > 0 && m.push({
2792
2792
  y,
2793
2793
  circ: D
2794
2794
  });
2795
2795
  }
2796
2796
  if (m.length < 5) return null;
2797
- const x = t - r, S = r + x * 0.3, I = r + x * 0.7, F = m.filter((y) => y.y >= S && y.y <= I);
2798
- if (F.length < 3) return null;
2799
- const P = F.map((y) => y.circ).sort((y, D) => y - D), b = P[Math.floor(P.length / 2)], z = Math.max(...m.map((y) => y.circ));
2797
+ const x = t - r, S = r + x * 0.3, I = r + x * 0.7, L = m.filter((y) => y.y >= S && y.y <= I);
2798
+ if (L.length < 3) return null;
2799
+ const P = L.map((y) => y.circ).sort((y, D) => y - D), b = P[Math.floor(P.length / 2)], z = Math.max(...m.map((y) => y.circ));
2800
2800
  return {
2801
2801
  circumferences: m,
2802
2802
  baseline: b,
@@ -2809,7 +2809,7 @@ let __tla = (async () => {
2809
2809
  ]);
2810
2810
  if (!s) return null;
2811
2811
  const { circumferences: c, baseline: a, maxCirc: n } = s, h = o * 0.3 / n;
2812
- return L("group", {
2812
+ return F("group", {
2813
2813
  children: [
2814
2814
  c.map(({ y: d, circ: u }, p) => {
2815
2815
  const g = u / a, M = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", f = u * h;
@@ -2826,7 +2826,7 @@ let __tla = (async () => {
2826
2826
  }),
2827
2827
  (() => {
2828
2828
  const d = a * 1.6 * h, u = c[0].y, p = c[c.length - 1].y;
2829
- return L(Te, {
2829
+ return F(Oe, {
2830
2830
  children: [
2831
2831
  i(de, {
2832
2832
  points: [
@@ -2860,13 +2860,13 @@ let __tla = (async () => {
2860
2860
  ]
2861
2861
  });
2862
2862
  }
2863
- function Ko({ componentDebug: e }) {
2863
+ function Jo({ componentDebug: e }) {
2864
2864
  return i("group", {
2865
2865
  children: e.geometries.map((r, t) => {
2866
2866
  const o = e.colors[t] ?? "#888888", l = t === e.innerIdx;
2867
2867
  r.computeBoundingBox();
2868
2868
  const s = new C();
2869
- return r.boundingBox.getCenter(s), L("group", {
2869
+ return r.boundingBox.getCenter(s), F("group", {
2870
2870
  children: [
2871
2871
  i("mesh", {
2872
2872
  geometry: r,
@@ -2894,7 +2894,7 @@ let __tla = (async () => {
2894
2894
  }),
2895
2895
  i("group", {
2896
2896
  position: s,
2897
- children: i(Ye, {
2897
+ children: i(Xe, {
2898
2898
  center: true,
2899
2899
  style: {
2900
2900
  pointerEvents: "none"
@@ -2924,7 +2924,7 @@ let __tla = (async () => {
2924
2924
  })
2925
2925
  });
2926
2926
  }
2927
- function Uo({ geometry: e, aoData: r }) {
2927
+ function Qo({ geometry: e, aoData: r }) {
2928
2928
  const t = j(() => {
2929
2929
  const o = e.toNonIndexed(), l = o.getAttribute("position"), s = r.length, c = l.count, a = new Float32Array(c * 3);
2930
2930
  for (let n = 0; n < s && n * 3 + 2 < c; n++) {
@@ -2953,8 +2953,8 @@ let __tla = (async () => {
2953
2953
  })
2954
2954
  });
2955
2955
  }
2956
- function Jo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
2957
- const a = e.geometry, n = j(() => a.getAttribute("position") ? bn(a) : null, [
2956
+ function qo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
2957
+ const a = e.geometry, n = j(() => a.getAttribute("position") ? Sn(a) : null, [
2958
2958
  a
2959
2959
  ]), h = j(() => !t || t.length < 2 ? null : {
2960
2960
  red: new C(t[1].position.x, t[1].position.y, t[1].position.z),
@@ -2962,26 +2962,26 @@ let __tla = (async () => {
2962
2962
  }, [
2963
2963
  t
2964
2964
  ]);
2965
- return L("group", {
2965
+ return F("group", {
2966
2966
  children: [
2967
- r.pcaAxes && n && i(Vo, {
2967
+ r.pcaAxes && n && i(No, {
2968
2968
  pca: n
2969
2969
  }),
2970
- r.obb && n && i(jo, {
2970
+ r.obb && n && i(Yo, {
2971
2971
  pca: n
2972
2972
  }),
2973
- r.obbAxis && n && i(Go, {
2973
+ r.obbAxis && n && i(Ko, {
2974
2974
  pca: n,
2975
2975
  modelSize: n.halfExtents[0] ? Math.max(...n.halfExtents) * 2 : 100
2976
2976
  }),
2977
- r.shellComponents && o && i(Ko, {
2977
+ r.shellComponents && o && i(Jo, {
2978
2978
  componentDebug: o
2979
2979
  }),
2980
- r.ambientOcclusion && l && l.length > 0 && i(Uo, {
2980
+ r.ambientOcclusion && l && l.length > 0 && i(Qo, {
2981
2981
  geometry: s ?? a,
2982
2982
  aoData: l
2983
2983
  }),
2984
- r.circumferenceScan && h && i(Zo, {
2984
+ r.circumferenceScan && h && i(Uo, {
2985
2985
  geometry: a,
2986
2986
  redY: h.red.y,
2987
2987
  greenY: h.green.y,
@@ -2999,17 +2999,17 @@ let __tla = (async () => {
2999
2999
  depthWrite: false
3000
3000
  })
3001
3001
  }),
3002
- r.landmarkAxis && h && i(No, {
3002
+ r.landmarkAxis && h && i(Xo, {
3003
3003
  redPoint: h.red,
3004
3004
  greenPoint: h.green
3005
3005
  }),
3006
- r.iterativePCA && h && i(Yo, {
3006
+ r.iterativePCA && h && i(Go, {
3007
3007
  geometry: a,
3008
3008
  redY: h.red.y,
3009
3009
  greenY: h.green.y,
3010
3010
  modelSize: (n == null ? void 0 : n.halfExtents[0]) ? Math.max(...n.halfExtents) * 2 : 100
3011
3011
  }),
3012
- r.fullRegionPCA && h && i(Xo, {
3012
+ r.fullRegionPCA && h && i(Zo, {
3013
3013
  geometry: a,
3014
3014
  redY: h.red.y,
3015
3015
  greenY: h.green.y,
@@ -3018,10 +3018,10 @@ let __tla = (async () => {
3018
3018
  ]
3019
3019
  });
3020
3020
  }
3021
- function Qo({ mesh: e }) {
3021
+ function er({ mesh: e }) {
3022
3022
  const r = e.geometry, t = j(() => {
3023
3023
  if (!r.getAttribute("position")) return null;
3024
- const s = bn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3024
+ const s = Sn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3025
3025
  return {
3026
3026
  axis: c,
3027
3027
  center: s.center,
@@ -3048,7 +3048,7 @@ let __tla = (async () => {
3048
3048
  renderOrder: 999
3049
3049
  });
3050
3050
  }
3051
- const wn = [
3051
+ const vn = [
3052
3052
  {
3053
3053
  key: "pcaAxes",
3054
3054
  label: "PCA Axes (full mesh)",
@@ -3104,11 +3104,11 @@ let __tla = (async () => {
3104
3104
  color: "#00ffff",
3105
3105
  group: "Alignment"
3106
3106
  }
3107
- ], qo = [
3108
- ...new Set(wn.map((e) => e.group))
3107
+ ], tr = [
3108
+ ...new Set(vn.map((e) => e.group))
3109
3109
  ];
3110
- function er({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3111
- return L("div", {
3110
+ function nr({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3111
+ return F("div", {
3112
3112
  style: {
3113
3113
  position: "absolute",
3114
3114
  top: 16,
@@ -3136,9 +3136,9 @@ let __tla = (async () => {
3136
3136
  },
3137
3137
  children: "Debug Layers"
3138
3138
  }),
3139
- qo.map((o) => {
3140
- const l = wn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3141
- return l.length === 0 ? null : L("div", {
3139
+ tr.map((o) => {
3140
+ const l = vn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3141
+ return l.length === 0 ? null : F("div", {
3142
3142
  children: [
3143
3143
  i("div", {
3144
3144
  style: {
@@ -3152,7 +3152,7 @@ let __tla = (async () => {
3152
3152
  },
3153
3153
  children: o
3154
3154
  }),
3155
- l.map(({ key: s, label: c, color: a }) => L("label", {
3155
+ l.map(({ key: s, label: c, color: a }) => F("label", {
3156
3156
  style: {
3157
3157
  display: "flex",
3158
3158
  alignItems: "center",
@@ -3197,45 +3197,45 @@ let __tla = (async () => {
3197
3197
  ]
3198
3198
  });
3199
3199
  }
3200
- const tr = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3201
- const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [F, P] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, fe] = E(false), [ie, J] = E(false), [Y, pe] = E(false), [Z, he] = E(false), [me, ue] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, oe] = E(false), [V, X] = E([]), [Le, Pe] = E(null), [Xe, se] = E(null), [ze, _t] = E(null), [pt, vn] = E(null), [Cn, Dt] = E(false), [Bt, Mn] = E(null), [ht, Ie] = E(null), [Be, zn] = E(false), [Rt, An] = E($o), [Oe, Wt] = E("obj"), [Ae, gt] = E(o), [et, Et] = E(true), [Tt, mt] = E(false), [Ot, kn] = E(false), [xt, Fn] = E(null), [$t] = E("#c8c8c8"), [Ln] = E(1), [Ge, Pn] = E(false), [yt, Ht] = E([]), tt = le(null), $e = le(null), bt = le(false), In = le(null), wt = le(null), St = le(null), Ke = re(async () => {
3202
- if (St.current) try {
3203
- const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = St.current, W = 2, R = async (K = false) => {
3200
+ const or = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3201
+ const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [L, P] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, fe] = E(false), [ie, J] = E(false), [Y, pe] = E(false), [Z, he] = E(false), [me, ue] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, oe] = E(false), [V, X] = E([]), [Le, Pe] = E(null), [Ge, se] = E(null), [ze, Dt] = E(null), [ht, Mn] = E(null), [zn, Bt] = E(false), [Rt, An] = E(null), [gt, _e] = E(null), [Re, kn] = E(false), [Wt, Fn] = E(Vo), [$e, Et] = E("obj"), [Ae, mt] = E(o), [tt, Tt] = E(true), [Ot, xt] = E(false), [$t, Ln] = E(false), [Ie, Ht] = E(false), [yt, Pn] = E(null), [Vt] = E("#c8c8c8"), [In] = E(1), [Ze, _n] = E(false), [bt, jt] = E([]), nt = le(null), He = le(null), wt = le(false), Dn = le(null), St = le(null), vt = le(null), Ue = re(async () => {
3202
+ if (vt.current) try {
3203
+ const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = vt.current, W = 2, R = async (K = false) => {
3204
3204
  const te = await v(_, {
3205
3205
  backgroundColor: null,
3206
3206
  useCORS: true,
3207
3207
  scale: W,
3208
- ignoreElements: (rt) => {
3208
+ ignoreElements: (it) => {
3209
3209
  var _a;
3210
- return ((_a = rt.style) == null ? void 0 : _a.zIndex) === "10";
3210
+ return ((_a = it.style) == null ? void 0 : _a.zIndex) === "10";
3211
3211
  }
3212
- }), Q = _.getBoundingClientRect(), ke = Q.width, Re = Q.height;
3213
- let ve, Me, ye, Ee;
3212
+ }), Q = _.getBoundingClientRect(), ke = Q.width, We = Q.height;
3213
+ let ve, Me, ye, Te;
3214
3214
  if (K) {
3215
- const _e = te.getContext("2d").getImageData(0, 0, te.width, te.height).data;
3216
- let De = te.width, We = te.height, qe = 0, it = 0;
3217
- for (let He = 0; He < te.height; He++) for (let Ve = 0; Ve < te.width; Ve++) {
3218
- const Yn = (He * te.width + Ve) * 4;
3219
- _e[Yn + 3] > 20 && (Ve < De && (De = Ve), Ve > qe && (qe = Ve), He < We && (We = He), He > it && (it = He));
3215
+ const De = te.getContext("2d").getImageData(0, 0, te.width, te.height).data;
3216
+ let Be = te.width, Ee = te.height, et = 0, st = 0;
3217
+ for (let Ve = 0; Ve < te.height; Ve++) for (let je = 0; je < te.width; je++) {
3218
+ const Gn = (Ve * te.width + je) * 4;
3219
+ De[Gn + 3] > 20 && (je < Be && (Be = je), je > et && (et = je), Ve < Ee && (Ee = Ve), Ve > st && (st = Ve));
3220
3220
  }
3221
- qe <= De && (De = 0, We = 0, qe = te.width, it = te.height), ve = De / W, Me = We / W, ye = qe / W, Ee = it / W;
3221
+ et <= Be && (Be = 0, Ee = 0, et = te.width, st = te.height), ve = Be / W, Me = Ee / W, ye = et / W, Te = st / W;
3222
3222
  } else {
3223
- const rt = _.querySelectorAll("[style*='pointer-events: none']");
3224
- ve = 1 / 0, Me = 1 / 0, ye = -1 / 0, Ee = -1 / 0, rt.forEach((kt) => {
3225
- const _e = kt.getBoundingClientRect();
3226
- if (_e.width === 0 || _e.height === 0) return;
3227
- const De = _e.left - Q.left, We = _e.top - Q.top;
3228
- De < ve && (ve = De), We < Me && (Me = We), De + _e.width > ye && (ye = De + _e.width), We + _e.height > Ee && (Ee = We + _e.height);
3229
- }), ve === 1 / 0 && (ve = 0, Me = 0, ye = ke, Ee = Re);
3223
+ const it = _.querySelectorAll("[style*='pointer-events: none']");
3224
+ ve = 1 / 0, Me = 1 / 0, ye = -1 / 0, Te = -1 / 0, it.forEach((Ft) => {
3225
+ const De = Ft.getBoundingClientRect();
3226
+ if (De.width === 0 || De.height === 0) return;
3227
+ const Be = De.left - Q.left, Ee = De.top - Q.top;
3228
+ Be < ve && (ve = Be), Ee < Me && (Me = Ee), Be + De.width > ye && (ye = Be + De.width), Ee + De.height > Te && (Te = Ee + De.height);
3229
+ }), ve === 1 / 0 && (ve = 0, Me = 0, ye = ke, Te = We);
3230
3230
  }
3231
- const Ut = Math.max(ke, Re) * 0.03, Jt = Math.max(ke, Re) * 0.06;
3232
- ve = Math.max(0, ve - Ut), Me = Math.max(0, Me - Jt), ye = Math.min(ke, ye + Ut), Ee = Math.min(Re, Ee + Jt);
3233
- const zt = (ye - ve) * W, At = (Ee - Me) * W, jn = Math.max(0, ve * W), Nn = Math.max(0, Me * W), ot = document.createElement("canvas");
3234
- return ot.width = Math.round(zt), ot.height = Math.round(At), ot.getContext("2d").drawImage(te, Math.round(jn), Math.round(Nn), Math.round(zt), Math.round(At), 0, 0, Math.round(zt), Math.round(At)), ot.toDataURL("image/png");
3231
+ const Qt = Math.max(ke, We) * 0.03, qt = Math.max(ke, We) * 0.06;
3232
+ ve = Math.max(0, ve - Qt), Me = Math.max(0, Me - qt), ye = Math.min(ke, ye + Qt), Te = Math.min(We, Te + qt);
3233
+ const At = (ye - ve) * W, kt = (Te - Me) * W, Yn = Math.max(0, ve * W), Xn = Math.max(0, Me * W), rt = document.createElement("canvas");
3234
+ return rt.width = Math.round(At), rt.height = Math.round(kt), rt.getContext("2d").drawImage(te, Math.round(Yn), Math.round(Xn), Math.round(At), Math.round(kt), 0, 0, Math.round(At), Math.round(kt)), rt.toDataURL("image/png");
3235
3235
  };
3236
- wt.current && wt.current(), await new Promise((K) => setTimeout(K, 200)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
3236
+ St.current && St.current(), await new Promise((K) => setTimeout(K, 100)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
3237
3237
  const ge = await R();
3238
- I("2D"), await new Promise((K) => setTimeout(K, 500)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
3238
+ I("2D"), await new Promise((K) => setTimeout(K, 200)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
3239
3239
  const G = await R(true);
3240
3240
  return I("3D"), {
3241
3241
  frontal_view_png: ge,
@@ -3246,17 +3246,17 @@ let __tla = (async () => {
3246
3246
  }
3247
3247
  }, []), Se = re((v) => {
3248
3248
  const _ = /* @__PURE__ */ new Date(), W = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3249
- Ht((R) => [
3249
+ jt((R) => [
3250
3250
  ...R.slice(-200),
3251
3251
  `[${W}] ${v}`
3252
3252
  ]);
3253
- }, []), { landmarkPoints: T, clearLandmarkPoints: _n, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt, reset: Gt } = It();
3253
+ }, []), { landmarkPoints: T, clearLandmarkPoints: Bn, addLandmarkPoint: Nt, removeLandmarkPoint: Yt, updateLandmarkPositions: Xt, setAligned: Gt, isAligned: ee, setCut: Zt, isCut: Ct, reset: Kt } = _t();
3254
3254
  ne(() => {
3255
- Gt();
3255
+ Kt();
3256
3256
  }, [
3257
- Gt
3257
+ Kt
3258
3258
  ]);
3259
- const nt = F * at;
3259
+ const ot = L * ct;
3260
3260
  ne(() => {
3261
3261
  if (!s || T.length === 0) return;
3262
3262
  const v = T[T.length - 1];
@@ -3272,37 +3272,37 @@ let __tla = (async () => {
3272
3272
  s,
3273
3273
  Se
3274
3274
  ]), ne(() => {
3275
- s && vt && Se("STATE: mesh cut");
3275
+ s && Ct && Se("STATE: mesh cut");
3276
3276
  }, [
3277
- vt,
3277
+ Ct,
3278
3278
  s,
3279
3279
  Se
3280
3280
  ]), ne(() => {
3281
- tt.current && (tt.current.scrollTop = tt.current.scrollHeight);
3281
+ nt.current && (nt.current.scrollTop = nt.current.scrollHeight);
3282
3282
  }, [
3283
- yt
3283
+ bt
3284
3284
  ]);
3285
- const Zt = j(() => xe ? new O.Mesh(xe) : null, [
3285
+ const Ut = j(() => xe ? new O.Mesh(xe) : null, [
3286
3286
  xe
3287
3287
  ]);
3288
3288
  ne(() => {
3289
- o && gt(o);
3289
+ o && mt(o);
3290
3290
  }, [
3291
3291
  o
3292
3292
  ]), ne(() => {
3293
- o || gt(void 0);
3293
+ o || mt(void 0);
3294
3294
  }, [
3295
- F
3295
+ L
3296
3296
  ]);
3297
- const Ct = le(false);
3297
+ const Mt = le(false);
3298
3298
  ne(() => {
3299
- if (!ee || V.length === 0 || Ct.current || !c) return;
3300
- Ct.current = true;
3299
+ if (!ee || V.length === 0 || Mt.current || !c) return;
3300
+ Mt.current = true;
3301
3301
  const v = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3302
3302
  c("dimensions_calculated", {
3303
3303
  spacing_type: w,
3304
3304
  source_unit: "mm",
3305
- file_format: Oe,
3305
+ file_format: $e,
3306
3306
  measurement_source: "scan_derived",
3307
3307
  is_double_wall: Y,
3308
3308
  is_unit_converted: false,
@@ -3318,11 +3318,11 @@ let __tla = (async () => {
3318
3318
  ee,
3319
3319
  V
3320
3320
  ]), ne(() => {
3321
- a !== void 0 && ($e.current = a), Pn(true);
3321
+ a !== void 0 && (He.current = a), _n(true);
3322
3322
  }, [
3323
3323
  a
3324
3324
  ]);
3325
- const Ue = re((v, _) => {
3325
+ const Je = re((v, _) => {
3326
3326
  v.computeBoundingBox();
3327
3327
  const W = v.boundingBox, R = new C();
3328
3328
  W.getCenter(R), v.translate(-R.x, -R.y, -R.z), v.computeBoundingBox();
@@ -3332,15 +3332,15 @@ let __tla = (async () => {
3332
3332
  color: 8947848,
3333
3333
  side: O.DoubleSide
3334
3334
  }));
3335
- h(K), fe(_), J(true), he(false), bt.current = false;
3336
- }, []), Je = re(async (v, _) => {
3337
- Ie(null);
3335
+ h(K), fe(_), J(true), he(false), wt.current = false;
3336
+ }, []), Qe = re(async (v, _) => {
3337
+ _e(null);
3338
3338
  const W = _.toLowerCase(), R = W.endsWith(".stl");
3339
3339
  if (!W.endsWith(".obj") && !R) {
3340
- Ie("Unsupported file format. Please use OBJ or STL.");
3340
+ _e("Unsupported file format. Please use OBJ or STL.");
3341
3341
  return;
3342
3342
  }
3343
- Wt(R ? "stl" : "obj"), f(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3343
+ Et(R ? "stl" : "obj"), f(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3344
3344
  try {
3345
3345
  let G;
3346
3346
  if (R) if (x("Converting STL..."), v instanceof ArrayBuffer) {
@@ -3349,41 +3349,41 @@ let __tla = (async () => {
3349
3349
  ]), ke = new File([
3350
3350
  Q
3351
3351
  ], _);
3352
- G = await Ft(ke);
3352
+ G = await Lt(ke);
3353
3353
  } else {
3354
3354
  const Q = new Blob([
3355
3355
  v
3356
3356
  ]), ke = new File([
3357
3357
  Q
3358
3358
  ], _);
3359
- G = await Ft(ke);
3359
+ G = await Lt(ke);
3360
3360
  }
3361
3361
  else G = typeof v == "string" ? v : new TextDecoder().decode(v);
3362
- const K = performance.now(), te = $e.current ? await lo(G, $e.current, (Q) => {
3362
+ const K = performance.now(), te = He.current ? await co(G, He.current, (Q) => {
3363
3363
  x(Q), Se(`PREPROCESS: ${Q}`);
3364
3364
  }) : null;
3365
- if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), z(true)) : Ue(te.geometry, te.wasScaled);
3365
+ if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), z(true)) : Je(te.geometry, te.wasScaled);
3366
3366
  else {
3367
3367
  x("Using fallback loader...");
3368
- const Q = ao(G);
3368
+ const Q = fo(G);
3369
3369
  Q ? e.showAmputationModal && !r ? (D({
3370
3370
  geometry: Q,
3371
3371
  wasScaled: false
3372
- }), z(true)) : Ue(Q, false) : Ie("Failed to parse the mesh.");
3372
+ }), z(true)) : Je(Q, false) : _e("Failed to parse the mesh.");
3373
3373
  }
3374
3374
  } catch (G) {
3375
- Ie(G instanceof Error ? G.message : "Failed to process the mesh file.");
3375
+ _e(G instanceof Error ? G.message : "Failed to process the mesh file.");
3376
3376
  } finally {
3377
3377
  f(false), x("");
3378
3378
  }
3379
3379
  }, [
3380
- Ge,
3380
+ Ze,
3381
3381
  e.showAmputationModal,
3382
3382
  r,
3383
- Ue
3383
+ Je
3384
3384
  ]);
3385
3385
  ne(() => {
3386
- if (!t || !Ge) return;
3386
+ if (!t || !Ze) return;
3387
3387
  (async () => {
3388
3388
  f(true), x("Loading scan...");
3389
3389
  try {
@@ -3392,66 +3392,66 @@ let __tla = (async () => {
3392
3392
  const R = new URL(t).pathname.split("/").pop() || "scan.obj";
3393
3393
  if (R.toLowerCase().endsWith(".stl")) {
3394
3394
  const G = await _.arrayBuffer();
3395
- await Je(G, R);
3395
+ await Qe(G, R);
3396
3396
  } else {
3397
3397
  const G = await _.text();
3398
- await Je(G, R);
3398
+ await Qe(G, R);
3399
3399
  }
3400
3400
  } catch (_) {
3401
- Ie(_ instanceof Error ? _.message : "Failed to load scan from URL."), f(false), x("");
3401
+ _e(_ instanceof Error ? _.message : "Failed to load scan from URL."), f(false), x("");
3402
3402
  }
3403
3403
  })();
3404
3404
  }, [
3405
3405
  t,
3406
- Ge
3406
+ Ze
3407
3407
  ]);
3408
- const Dn = re((v) => {
3408
+ const Rn = re((v) => {
3409
3409
  v.preventDefault(), g(true);
3410
- }, []), Bn = re((v) => {
3410
+ }, []), Wn = re((v) => {
3411
3411
  v.preventDefault(), g(false);
3412
- }, []), Rn = re(async (v) => {
3413
- if (v.preventDefault(), g(false), !Ge) {
3414
- Ie("WASM module is still loading. Please wait.");
3412
+ }, []), En = re(async (v) => {
3413
+ if (v.preventDefault(), g(false), !Ze) {
3414
+ _e("WASM module is still loading. Please wait.");
3415
3415
  return;
3416
3416
  }
3417
3417
  const _ = v.dataTransfer.files[0];
3418
3418
  if (!_) return;
3419
3419
  const W = _.name.toLowerCase();
3420
3420
  if (!W.endsWith(".obj") && !W.endsWith(".stl")) {
3421
- Ie("Please drop an OBJ or STL file.");
3421
+ _e("Please drop an OBJ or STL file.");
3422
3422
  return;
3423
3423
  }
3424
3424
  if (W.endsWith(".stl")) {
3425
- Wt("stl"), f(true), x("Converting STL...");
3425
+ Et("stl"), f(true), x("Converting STL...");
3426
3426
  try {
3427
- const R = await Ft(_);
3428
- await Je(R, _.name.replace(/\.stl$/i, ".obj"));
3427
+ const R = await Lt(_);
3428
+ await Qe(R, _.name.replace(/\.stl$/i, ".obj"));
3429
3429
  } catch (R) {
3430
- Ie(R instanceof Error ? R.message : "Failed to process STL file."), f(false), x("");
3430
+ _e(R instanceof Error ? R.message : "Failed to process STL file."), f(false), x("");
3431
3431
  }
3432
3432
  } else {
3433
3433
  const R = await _.text();
3434
- await Je(R, _.name);
3434
+ await Qe(R, _.name);
3435
3435
  }
3436
3436
  }, [
3437
- Ge,
3438
- Je
3439
- ]), Wn = re((v) => {
3440
- A(v), P(v === "AK" ? 2 : 1), z(false), y && (Ue(y.geometry, y.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3437
+ Ze,
3438
+ Qe
3439
+ ]), Tn = re((v) => {
3440
+ A(v), P(v === "AK" ? 2 : 1), z(false), y && (Je(y.geometry, y.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3441
3441
  spacing_type: v,
3442
- file_format: Oe,
3442
+ file_format: $e,
3443
3443
  is_double_wall: false
3444
3444
  });
3445
3445
  }, [
3446
3446
  y,
3447
- Ue,
3447
+ Je,
3448
3448
  c,
3449
- Oe
3449
+ $e
3450
3450
  ]);
3451
3451
  ne(() => {
3452
- if (!n || T.length !== 1 || !$e.current || bt.current) return;
3453
- bt.current = true;
3454
- const v = T[0], _ = $e.current, W = n.geometry, { positions: R, indices: ge } = ct(W), G = new Float32Array([
3452
+ if (!n || T.length !== 1 || !He.current || wt.current) return;
3453
+ wt.current = true;
3454
+ const v = T[0], _ = He.current, W = n.geometry, { positions: R, indices: ge } = dt(W), G = new Float32Array([
3455
3455
  v.position.x,
3456
3456
  v.position.y,
3457
3457
  v.position.z
@@ -3462,7 +3462,7 @@ let __tla = (async () => {
3462
3462
  T,
3463
3463
  Se
3464
3464
  ]);
3465
- const En = re(() => {
3465
+ const On = re(() => {
3466
3466
  if (!n || T.length < 2) return;
3467
3467
  N(true), be("Please wait..."), Se("PIPELINE: starting processing pipeline...");
3468
3468
  const v = performance.now();
@@ -3472,27 +3472,27 @@ let __tla = (async () => {
3472
3472
  T[0],
3473
3473
  ...T.slice(2)
3474
3474
  ];
3475
- ho(n, _, at, {
3475
+ mo(n, _, ct, {
3476
3476
  onStatus: (W) => {
3477
3477
  be(W), Se(`PIPELINE: ${W}`);
3478
3478
  },
3479
- addLandmarkPoint: Vt,
3480
- removeLandmarkPoint: jt,
3479
+ addLandmarkPoint: Nt,
3480
+ removeLandmarkPoint: Yt,
3481
3481
  updateLandmarkPositions: (W) => {
3482
3482
  const R = [
3483
3483
  W[1],
3484
3484
  W[0],
3485
3485
  ...W.slice(2)
3486
3486
  ];
3487
- Nt(R);
3487
+ Xt(R);
3488
3488
  },
3489
- setAligned: Yt,
3490
- setCut: Xt,
3489
+ setAligned: Gt,
3490
+ setCut: Zt,
3491
3491
  setModelSize: u,
3492
- setOriginalEndY: vn,
3492
+ setOriginalEndY: Mn,
3493
3493
  setAdjustedStartY: se,
3494
- setAdjustedEndY: _t,
3495
- setError: Ie,
3494
+ setAdjustedEndY: Dt,
3495
+ setError: _e,
3496
3496
  setDoubleShell: (W) => {
3497
3497
  pe(W), oe(true);
3498
3498
  },
@@ -3502,26 +3502,26 @@ let __tla = (async () => {
3502
3502
  setInnerShellExtracted: he,
3503
3503
  setMeasurementGeometry: Ce,
3504
3504
  setWasmSlices: Pe,
3505
- wasmModule: $e.current ?? void 0
3506
- }), Se(`PIPELINE: completed in ${(performance.now() - v).toFixed(0)}ms`), Ct.current = false, N(false);
3505
+ wasmModule: He.current ?? void 0
3506
+ }), Se(`PIPELINE: completed in ${(performance.now() - v).toFixed(0)}ms`), Mt.current = false, N(false);
3507
3507
  }, 50);
3508
3508
  }, [
3509
3509
  n,
3510
3510
  T,
3511
+ Xt,
3512
+ Gt,
3511
3513
  Nt,
3512
3514
  Yt,
3513
- Vt,
3514
- jt,
3515
- Xt,
3515
+ Zt,
3516
3516
  Z
3517
- ]), Kt = le(false);
3517
+ ]), Jt = le(false);
3518
3518
  ne(() => {
3519
- ee && V.length > 0 && !Kt.current && (Kt.current = true, mt(true));
3519
+ ee && V.length > 0 && !Jt.current && (Jt.current = true, xt(true));
3520
3520
  }, [
3521
3521
  ee,
3522
3522
  V.length
3523
3523
  ]);
3524
- const Qe = j(() => {
3524
+ const qe = j(() => {
3525
3525
  var _a;
3526
3526
  if (!n || T.length < 3) return 0;
3527
3527
  if (Y) return Math.abs(T[0].position.y - T[2].position.y);
@@ -3533,22 +3533,22 @@ let __tla = (async () => {
3533
3533
  n,
3534
3534
  T,
3535
3535
  Y
3536
- ]), Tn = re((v) => {
3537
- Fn(v), gt(v.circumferences), mt(false), Et(true), kn(true);
3538
- }, []), On = re(async (v) => {
3536
+ ]), $n = re((v) => {
3537
+ Pn(v), mt(v.circumferences), xt(false), Tt(true), Ln(true);
3538
+ }, []), Hn = re(async (v) => {
3539
3539
  if (!l || !n || !w) return;
3540
- mt(false);
3541
- const _ = await Ke();
3540
+ xt(false), Ht(true);
3541
+ const _ = await Ue();
3542
3542
  l({
3543
3543
  spacingType: w,
3544
3544
  sourceUnit: "mm",
3545
- fileFormat: Oe,
3545
+ fileFormat: $e,
3546
3546
  measurementSource: "form_provided",
3547
3547
  isDoubleWall: Y,
3548
3548
  isUnitConverted: false,
3549
3549
  formMeasurements: Ae,
3550
3550
  scanMeasurements: V,
3551
- frontalHeight: Qe,
3551
+ frontalHeight: qe,
3552
3552
  transverseML: 0,
3553
3553
  transverseAP: 0,
3554
3554
  scanUrl: t,
@@ -3560,44 +3560,45 @@ let __tla = (async () => {
3560
3560
  l,
3561
3561
  n,
3562
3562
  w,
3563
- Oe,
3563
+ $e,
3564
3564
  Y,
3565
3565
  Ae,
3566
3566
  V,
3567
- Qe,
3567
+ qe,
3568
3568
  t,
3569
- Ke
3570
- ]), Mt = re(async (v) => {
3569
+ Ue
3570
+ ]), zt = re(async (v) => {
3571
3571
  if (!l || !n || V.length === 0 || !w) return;
3572
+ Ht(true);
3572
3573
  let _ = 0, W = 0;
3573
3574
  if (T.length >= 2) {
3574
3575
  const ge = n.geometry, K = T[0].position.y;
3575
3576
  try {
3576
- const te = mn(ge), Q = Ne(te, ge, K);
3577
+ const te = yn(ge), Q = Ye(te, ge, K);
3577
3578
  if (Q.linePoints.length >= 2) {
3578
- let ke = Q.linePoints[0], Re = Q.linePoints[0], ve = Q.linePoints[0], Me = Q.linePoints[0];
3579
- for (const ye of Q.linePoints) ye.x < ke.x && (ke = ye), ye.x > Re.x && (Re = ye), ye.z < ve.z && (ve = ye), ye.z > Me.z && (Me = ye);
3580
- _ = new C(ke.x, K, ke.z).distanceTo(new C(Re.x, K, Re.z)), W = new C(ve.x, K, ve.z).distanceTo(new C(Me.x, K, Me.z));
3579
+ let ke = Q.linePoints[0], We = Q.linePoints[0], ve = Q.linePoints[0], Me = Q.linePoints[0];
3580
+ for (const ye of Q.linePoints) ye.x < ke.x && (ke = ye), ye.x > We.x && (We = ye), ye.z < ve.z && (ve = ye), ye.z > Me.z && (Me = ye);
3581
+ _ = new C(ke.x, K, ke.z).distanceTo(new C(We.x, K, We.z)), W = new C(ve.x, K, ve.z).distanceTo(new C(Me.x, K, Me.z));
3581
3582
  }
3582
3583
  } catch {
3583
3584
  }
3584
3585
  }
3585
- const R = await Ke();
3586
+ const R = await Ue();
3586
3587
  l({
3587
3588
  spacingType: w,
3588
3589
  sourceUnit: "mm",
3589
- fileFormat: Oe,
3590
+ fileFormat: $e,
3590
3591
  measurementSource: v === "use_form_measurements" ? "form_provided" : "scan_derived",
3591
3592
  isDoubleWall: Y,
3592
3593
  isUnitConverted: false,
3593
3594
  formMeasurements: Ae,
3594
3595
  scanMeasurements: V,
3595
- frontalHeight: (xt == null ? void 0 : xt.frontalHeight) ?? Qe,
3596
+ frontalHeight: (yt == null ? void 0 : yt.frontalHeight) ?? qe,
3596
3597
  transverseML: _,
3597
3598
  transverseAP: W,
3598
3599
  scanUrl: t,
3599
3600
  decision: v,
3600
- userEnteredMeasurements: xt ?? void 0,
3601
+ userEnteredMeasurements: yt ?? void 0,
3601
3602
  screenshots: R
3602
3603
  });
3603
3604
  }, [
@@ -3606,14 +3607,14 @@ let __tla = (async () => {
3606
3607
  V,
3607
3608
  w,
3608
3609
  T,
3609
- Oe,
3610
+ $e,
3610
3611
  Y,
3611
3612
  Ae,
3612
3613
  t,
3613
- xt,
3614
- Qe,
3615
- Ke
3616
- ]), $n = j(() => {
3614
+ yt,
3615
+ qe,
3616
+ Ue
3617
+ ]), Vn = j(() => {
3617
3618
  if (!Ae || V.length === 0) return false;
3618
3619
  const v = Math.min(Ae.length, V.length);
3619
3620
  if (v === 0) return false;
@@ -3627,7 +3628,7 @@ let __tla = (async () => {
3627
3628
  }, [
3628
3629
  Ae,
3629
3630
  V
3630
- ]), Hn = Ot ? 5 : ee && Tt || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Vn = [
3631
+ ]), jn = $t ? 5 : ee && Ot || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Nn = [
3631
3632
  {
3632
3633
  label: "Load File",
3633
3634
  number: 1
@@ -3649,10 +3650,10 @@ let __tla = (async () => {
3649
3650
  number: 5
3650
3651
  }
3651
3652
  ];
3652
- return L(no.Provider, {
3653
+ return F(ro.Provider, {
3653
3654
  value: e,
3654
3655
  children: [
3655
- L("div", {
3656
+ F("div", {
3656
3657
  style: {
3657
3658
  flex: 1,
3658
3659
  display: "flex",
@@ -3681,11 +3682,11 @@ let __tla = (async () => {
3681
3682
  }
3682
3683
  })
3683
3684
  }),
3684
- i(_o, {
3685
- steps: Vn,
3686
- currentStep: Hn
3685
+ i(Bo, {
3686
+ steps: Nn,
3687
+ currentStep: jn
3687
3688
  }),
3688
- L("div", {
3689
+ F("div", {
3689
3690
  style: {
3690
3691
  flex: 1,
3691
3692
  display: "flex",
@@ -3693,17 +3694,17 @@ let __tla = (async () => {
3693
3694
  minHeight: 0
3694
3695
  },
3695
3696
  children: [
3696
- L("div", {
3697
- ref: St,
3697
+ F("div", {
3698
+ ref: vt,
3698
3699
  style: {
3699
3700
  flex: 1,
3700
3701
  position: "relative",
3701
3702
  minHeight: 0,
3702
3703
  overflow: "hidden"
3703
3704
  },
3704
- onDragOver: e.showDragDrop ? Dn : void 0,
3705
- onDragLeave: e.showDragDrop ? Bn : void 0,
3706
- onDrop: e.showDragDrop ? Rn : void 0,
3705
+ onDragOver: e.showDragDrop ? Rn : void 0,
3706
+ onDragLeave: e.showDragDrop ? Wn : void 0,
3707
+ onDrop: e.showDragDrop ? En : void 0,
3707
3708
  children: [
3708
3709
  e.showDragDrop && !n && !M && i("div", {
3709
3710
  style: {
@@ -3716,7 +3717,7 @@ let __tla = (async () => {
3716
3717
  justifyContent: "center",
3717
3718
  pointerEvents: "none"
3718
3719
  },
3719
- children: Ge ? i("div", {
3720
+ children: Ze ? i("div", {
3720
3721
  style: {
3721
3722
  fontSize: 18,
3722
3723
  color: "#aaa",
@@ -3724,7 +3725,7 @@ let __tla = (async () => {
3724
3725
  fontFamily: "system-ui, sans-serif"
3725
3726
  },
3726
3727
  children: "Drag & Drop Files Here"
3727
- }) : L("div", {
3728
+ }) : F("div", {
3728
3729
  style: {
3729
3730
  textAlign: "center"
3730
3731
  },
@@ -3754,7 +3755,7 @@ let __tla = (async () => {
3754
3755
  ]
3755
3756
  })
3756
3757
  }),
3757
- !e.showDragDrop && !n && !M && !ht && i("div", {
3758
+ !e.showDragDrop && !n && !M && !gt && i("div", {
3758
3759
  style: {
3759
3760
  position: "absolute",
3760
3761
  inset: 0,
@@ -3762,7 +3763,7 @@ let __tla = (async () => {
3762
3763
  alignItems: "center",
3763
3764
  justifyContent: "center"
3764
3765
  },
3765
- children: L("div", {
3766
+ children: F("div", {
3766
3767
  style: {
3767
3768
  textAlign: "center"
3768
3769
  },
@@ -3792,7 +3793,7 @@ let __tla = (async () => {
3792
3793
  ]
3793
3794
  })
3794
3795
  }),
3795
- n && !ee && T.length === 0 && L("div", {
3796
+ n && !ee && T.length === 0 && F("div", {
3796
3797
  style: {
3797
3798
  position: "absolute",
3798
3799
  top: 16,
@@ -3824,7 +3825,7 @@ let __tla = (async () => {
3824
3825
  w === "AK" ? "IT" : "MPT"
3825
3826
  ]
3826
3827
  }),
3827
- n && !ee && T.length === 1 && L("div", {
3828
+ n && !ee && T.length === 1 && F("div", {
3828
3829
  style: {
3829
3830
  position: "absolute",
3830
3831
  top: 16,
@@ -3855,15 +3856,15 @@ let __tla = (async () => {
3855
3856
  "Click mesh to set Origin"
3856
3857
  ]
3857
3858
  }),
3858
- M && i(tn, {
3859
+ M && i(on, {
3859
3860
  message: m || "Processing mesh..."
3860
3861
  }),
3861
- $ && i(tn, {
3862
+ $ && i(on, {
3862
3863
  message: U
3863
3864
  }),
3864
- ht && i(mo, {
3865
- message: ht,
3866
- onDismiss: () => Ie(null)
3865
+ gt && i(yo, {
3866
+ message: gt,
3867
+ onDismiss: () => _e(null)
3867
3868
  }),
3868
3869
  e.showAmputationModal && b && i("div", {
3869
3870
  style: {
@@ -3877,7 +3878,7 @@ let __tla = (async () => {
3877
3878
  justifyContent: "center",
3878
3879
  zIndex: 20
3879
3880
  },
3880
- children: L("div", {
3881
+ children: F("div", {
3881
3882
  style: {
3882
3883
  backgroundColor: "#fff",
3883
3884
  borderRadius: 4,
@@ -3886,7 +3887,7 @@ let __tla = (async () => {
3886
3887
  fontFamily: "system-ui, sans-serif"
3887
3888
  },
3888
3889
  children: [
3889
- L("div", {
3890
+ F("div", {
3890
3891
  style: {
3891
3892
  padding: "24px 24px 20px"
3892
3893
  },
@@ -3916,7 +3917,7 @@ let __tla = (async () => {
3916
3917
  children: [
3917
3918
  "AK",
3918
3919
  "BK"
3919
- ].map((v) => L("label", {
3920
+ ].map((v) => F("label", {
3920
3921
  onClick: () => A(v),
3921
3922
  style: {
3922
3923
  flex: 1,
@@ -3952,7 +3953,7 @@ let __tla = (async () => {
3952
3953
  },
3953
3954
  children: v
3954
3955
  }),
3955
- L("span", {
3956
+ F("span", {
3956
3957
  style: {
3957
3958
  fontSize: 13,
3958
3959
  color: "rgba(0,0,0,0.54)"
@@ -3967,7 +3968,7 @@ let __tla = (async () => {
3967
3968
  })
3968
3969
  ]
3969
3970
  }),
3970
- L("div", {
3971
+ F("div", {
3971
3972
  style: {
3972
3973
  display: "flex",
3973
3974
  justifyContent: "flex-end",
@@ -3996,7 +3997,7 @@ let __tla = (async () => {
3996
3997
  children: "Cancel"
3997
3998
  }),
3998
3999
  i("button", {
3999
- onClick: () => w && Wn(w),
4000
+ onClick: () => w && Tn(w),
4000
4001
  disabled: !w,
4001
4002
  style: {
4002
4003
  padding: "6px 16px",
@@ -4028,8 +4029,8 @@ let __tla = (async () => {
4028
4029
  zIndex: 10
4029
4030
  }
4030
4031
  }),
4031
- i(go, {
4032
- children: L(Un, {
4032
+ i(xo, {
4033
+ children: F(Qn, {
4033
4034
  camera: {
4034
4035
  position: [
4035
4036
  0,
@@ -4039,14 +4040,14 @@ let __tla = (async () => {
4039
4040
  },
4040
4041
  style: {
4041
4042
  display: n ? "block" : "none",
4042
- backgroundColor: Be ? "#070611" : void 0
4043
+ backgroundColor: Re ? "#070611" : void 0
4043
4044
  },
4044
4045
  gl: {
4045
4046
  localClippingEnabled: true,
4046
4047
  preserveDrawingBuffer: true
4047
4048
  },
4048
4049
  scene: {
4049
- background: Be ? new O.Color("#070611") : null
4050
+ background: Re ? new O.Color("#070611") : null
4050
4051
  },
4051
4052
  children: [
4052
4053
  i("ambientLight", {
@@ -4076,15 +4077,15 @@ let __tla = (async () => {
4076
4077
  ],
4077
4078
  intensity: 0.2
4078
4079
  }),
4079
- n && S === "3D" && i(yo, {
4080
+ n && S === "3D" && i(wo, {
4080
4081
  mesh: n,
4081
4082
  maxPoints: 2,
4082
- meshColor: $t,
4083
- meshOpacity: Be ? 0.3 : Ln,
4083
+ meshColor: Vt,
4084
+ meshOpacity: Re ? 0.3 : In,
4084
4085
  frontFaceOnly: Z,
4085
4086
  doubleShellTransparency: Y && ee
4086
4087
  }),
4087
- n && S === "3D" && i(wo, {
4088
+ n && S === "3D" && i(vo, {
4088
4089
  modelSize: d,
4089
4090
  labels: [
4090
4091
  w === "AK" ? "IT" : "MPT",
@@ -4092,94 +4093,94 @@ let __tla = (async () => {
4092
4093
  "Cut Plane"
4093
4094
  ]
4094
4095
  }),
4095
- i(Fo, {
4096
+ i(Po, {
4096
4097
  modelSize: d,
4097
4098
  isAligned: ee,
4098
- isCut: vt,
4099
+ isCut: Ct,
4099
4100
  mesh: n,
4100
4101
  viewMode: S,
4101
- sliceY: ee && T.length >= 2 ? ze ?? pt ?? T[0].position.y : void 0,
4102
+ sliceY: ee && T.length >= 2 ? ze ?? ht ?? T[0].position.y : void 0,
4102
4103
  landmarkCount: T.length,
4103
4104
  measurementGeometry: xe,
4104
- resetCameraToFrontRef: wt
4105
+ resetCameraToFrontRef: St
4105
4106
  }),
4106
- !ee && i(an, {
4107
+ !ee && i(dn, {
4107
4108
  enableDamping: false
4108
4109
  }),
4109
- ee && V.length > 0 && n && S === "3D" && i(Lo, {
4110
+ ee && V.length > 0 && n && S === "3D" && i(Io, {
4110
4111
  mesh: n,
4111
- isDragging: Cn
4112
+ isDragging: zn
4112
4113
  }),
4113
4114
  n && ee && T.length >= 3 && (() => {
4114
4115
  const _ = n.geometry.getIndex();
4115
4116
  if (!_ || _.count < 30) return null;
4116
- const W = T[2], R = T[0], ge = Xe ?? W.position.y, G = ze ?? pt ?? R.position.y;
4117
- return S === "2D" ? i(Do, {
4118
- mesh: Zt ?? n,
4117
+ const W = T[2], R = T[0], ge = Ge ?? W.position.y, G = ze ?? ht ?? R.position.y;
4118
+ return S === "2D" ? i(Ro, {
4119
+ mesh: Ut ?? n,
4119
4120
  upperY: G,
4120
4121
  originY: R.position.y,
4121
4122
  modelSize: d,
4122
- meshColor: $t,
4123
+ meshColor: Vt,
4123
4124
  displayUnit: k
4124
- }) : L(Te, {
4125
+ }) : F(Oe, {
4125
4126
  children: [
4126
- i(Ao, {
4127
- mesh: Zt ?? n,
4127
+ i(Fo, {
4128
+ mesh: Ut ?? n,
4128
4129
  startY: ge,
4129
4130
  endY: G,
4130
- spacing: nt,
4131
+ spacing: ot,
4131
4132
  modelSize: d,
4132
4133
  onMeasurementsChange: X,
4133
4134
  reverseOrder: true,
4134
4135
  displayUnit: k,
4135
4136
  useInnerSurface: Y && !Z,
4136
- formMeasurements: et ? Ae : void 0,
4137
- originY: Bt ?? R.position.y,
4137
+ formMeasurements: tt ? Ae : void 0,
4138
+ originY: Rt ?? R.position.y,
4138
4139
  wasmSlices: Le
4139
4140
  }),
4140
- i(ko, {
4141
+ i(Lo, {
4141
4142
  mesh: n,
4142
4143
  greenY: R.position.y,
4143
4144
  modelSize: d,
4144
4145
  displayUnit: k,
4145
4146
  bottomY: Y ? W.position.y : void 0
4146
4147
  }),
4147
- i(Bo, {
4148
+ i(Wo, {
4148
4149
  mesh: n,
4149
- yPosition: Bt ?? R.position.y,
4150
+ yPosition: Rt ?? R.position.y,
4150
4151
  onYChange: (K) => {
4151
- Mn(K), Pe(null);
4152
+ An(K), Pe(null);
4152
4153
  const te = K - R.position.y;
4153
- _t((pt ?? R.position.y + nt * 2) + te);
4154
+ Dt((ht ?? R.position.y + ot * 2) + te);
4154
4155
  },
4155
- minY: R.position.y - nt,
4156
- maxY: R.position.y + nt,
4156
+ minY: R.position.y - ot,
4157
+ maxY: R.position.y + ot,
4157
4158
  modelSize: d,
4158
4159
  color: "#44ff44",
4159
4160
  hoverColor: "#88ff88",
4160
4161
  dragColor: "#ffffff",
4161
4162
  label: w === "AK" ? "IT" : "MPT",
4162
- onDragStart: () => Dt(true),
4163
- onDragEnd: () => Dt(false)
4163
+ onDragStart: () => Bt(true),
4164
+ onDragEnd: () => Bt(false)
4164
4165
  })
4165
4166
  ]
4166
4167
  });
4167
4168
  })(),
4168
- n && ee && S === "3D" && Be && i(Qo, {
4169
+ n && ee && S === "3D" && Re && i(er, {
4169
4170
  mesh: n
4170
4171
  }),
4171
- n && e.showDebug && Be && S === "3D" && i(Jo, {
4172
+ n && e.showDebug && Re && S === "3D" && i(qo, {
4172
4173
  mesh: n,
4173
4174
  modelSize: d,
4174
- layers: Rt,
4175
+ layers: Wt,
4175
4176
  landmarkPoints: T,
4176
4177
  componentDebug: null,
4177
4178
  aoData: me,
4178
4179
  aoGeometry: H,
4179
4180
  measurementGeometry: xe
4180
4181
  }),
4181
- i(nr, {
4182
- screenshotFnRef: In,
4182
+ i(rr, {
4183
+ screenshotFnRef: Dn,
4183
4184
  mesh: n,
4184
4185
  modelSize: d,
4185
4186
  measurementGeometry: xe
@@ -4187,7 +4188,7 @@ let __tla = (async () => {
4187
4188
  ]
4188
4189
  })
4189
4190
  }),
4190
- n && L("div", {
4191
+ n && F("div", {
4191
4192
  style: {
4192
4193
  position: "absolute",
4193
4194
  top: 16,
@@ -4215,7 +4216,7 @@ let __tla = (async () => {
4215
4216
  children: "Start Over"
4216
4217
  }),
4217
4218
  !ee && T.length >= 1 && i("button", {
4218
- onClick: _n,
4219
+ onClick: Bn,
4219
4220
  style: {
4220
4221
  padding: "6px 16px",
4221
4222
  borderRadius: 4,
@@ -4233,15 +4234,15 @@ let __tla = (async () => {
4233
4234
  })
4234
4235
  ]
4235
4236
  }),
4236
- e.showDebug && Be && n && S === "3D" && i(er, {
4237
- layers: Rt,
4238
- onToggleLayer: (v) => An((_) => ({
4237
+ e.showDebug && Re && n && S === "3D" && i(nr, {
4238
+ layers: Wt,
4239
+ onToggleLayer: (v) => Fn((_) => ({
4239
4240
  ..._,
4240
4241
  [v]: !_[v]
4241
4242
  })),
4242
4243
  isDoubleShell: Y
4243
4244
  }),
4244
- ee && V.length > 0 && L("div", {
4245
+ ee && V.length > 0 && F("div", {
4245
4246
  style: {
4246
4247
  position: "absolute",
4247
4248
  top: 16,
@@ -4251,7 +4252,7 @@ let __tla = (async () => {
4251
4252
  zIndex: 10
4252
4253
  },
4253
4254
  children: [
4254
- L("div", {
4255
+ F("div", {
4255
4256
  style: {
4256
4257
  display: "flex",
4257
4258
  borderRadius: 6,
@@ -4291,7 +4292,7 @@ let __tla = (async () => {
4291
4292
  })
4292
4293
  ]
4293
4294
  }),
4294
- L("div", {
4295
+ F("div", {
4295
4296
  style: {
4296
4297
  display: "flex",
4297
4298
  borderRadius: 6,
@@ -4331,7 +4332,7 @@ let __tla = (async () => {
4331
4332
  })
4332
4333
  ]
4333
4334
  }),
4334
- e.showSpacingToggle && S === "3D" && L("div", {
4335
+ e.showSpacingToggle && S === "3D" && F("div", {
4335
4336
  style: {
4336
4337
  display: "flex",
4337
4338
  borderRadius: 6,
@@ -4345,9 +4346,9 @@ let __tla = (async () => {
4345
4346
  style: {
4346
4347
  padding: "6px 14px",
4347
4348
  fontSize: 13,
4348
- fontWeight: F === 1 ? 600 : 400,
4349
- backgroundColor: F === 1 ? "rgb(12, 67, 173)" : "#fff",
4350
- color: F === 1 ? "#fff" : "#666",
4349
+ fontWeight: L === 1 ? 600 : 400,
4350
+ backgroundColor: L === 1 ? "rgb(12, 67, 173)" : "#fff",
4351
+ color: L === 1 ? "#fff" : "#666",
4351
4352
  border: "none",
4352
4353
  cursor: "pointer",
4353
4354
  fontFamily: "system-ui, sans-serif"
@@ -4359,9 +4360,9 @@ let __tla = (async () => {
4359
4360
  style: {
4360
4361
  padding: "6px 14px",
4361
4362
  fontSize: 13,
4362
- fontWeight: F === 2 ? 600 : 400,
4363
- backgroundColor: F === 2 ? "rgb(12, 67, 173)" : "#fff",
4364
- color: F === 2 ? "#fff" : "#666",
4363
+ fontWeight: L === 2 ? 600 : 400,
4364
+ backgroundColor: L === 2 ? "rgb(12, 67, 173)" : "#fff",
4365
+ color: L === 2 ? "#fff" : "#666",
4365
4366
  border: "none",
4366
4367
  borderLeft: "1px solid #ccc",
4367
4368
  cursor: "pointer",
@@ -4380,13 +4381,13 @@ let __tla = (async () => {
4380
4381
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4381
4382
  },
4382
4383
  children: i("button", {
4383
- onClick: () => Et((v) => !v),
4384
+ onClick: () => Tt((v) => !v),
4384
4385
  style: {
4385
4386
  padding: "6px 14px",
4386
4387
  fontSize: 13,
4387
- fontWeight: et ? 600 : 400,
4388
- backgroundColor: et ? "rgb(12, 67, 173)" : "#fff",
4389
- color: et ? "#fff" : "#666",
4388
+ fontWeight: tt ? 600 : 400,
4389
+ backgroundColor: tt ? "rgb(12, 67, 173)" : "#fff",
4390
+ color: tt ? "#fff" : "#666",
4390
4391
  border: "none",
4391
4392
  cursor: "pointer",
4392
4393
  fontFamily: "system-ui, sans-serif"
@@ -4404,7 +4405,7 @@ let __tla = (async () => {
4404
4405
  },
4405
4406
  children: i("button", {
4406
4407
  onClick: async () => {
4407
- const v = await Ke();
4408
+ const v = await Ue();
4408
4409
  if (!v) return;
4409
4410
  const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), W = (R, ge) => {
4410
4411
  const G = document.createElement("a");
@@ -4434,13 +4435,13 @@ let __tla = (async () => {
4434
4435
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4435
4436
  },
4436
4437
  children: i("button", {
4437
- onClick: () => zn((v) => !v),
4438
+ onClick: () => kn((v) => !v),
4438
4439
  style: {
4439
4440
  padding: "6px 14px",
4440
4441
  fontSize: 13,
4441
- fontWeight: Be ? 600 : 400,
4442
- backgroundColor: Be ? "#e65100" : "#fff",
4443
- color: Be ? "#fff" : "#666",
4442
+ fontWeight: Re ? 600 : 400,
4443
+ backgroundColor: Re ? "#e65100" : "#fff",
4444
+ color: Re ? "#fff" : "#666",
4444
4445
  border: "none",
4445
4446
  cursor: "pointer",
4446
4447
  fontFamily: "system-ui, sans-serif"
@@ -4450,17 +4451,53 @@ let __tla = (async () => {
4450
4451
  })
4451
4452
  ]
4452
4453
  }),
4453
- n && ie && i(Po, {
4454
+ n && ie && i(_o, {
4454
4455
  wasAutoScaled: ae,
4455
4456
  onDismiss: () => J(false)
4456
4457
  }),
4457
- n && we && ee && i(Io, {
4458
+ n && we && ee && i(Do, {
4458
4459
  isDoubleShell: Y,
4459
4460
  onDismiss: () => oe(false)
4460
4461
  })
4461
4462
  ]
4462
4463
  }),
4463
- L("div", {
4464
+ Ie && F("div", {
4465
+ style: {
4466
+ position: "absolute",
4467
+ inset: 0,
4468
+ backgroundColor: "rgba(255,255,255,0.85)",
4469
+ display: "flex",
4470
+ flexDirection: "column",
4471
+ alignItems: "center",
4472
+ justifyContent: "center",
4473
+ zIndex: 50
4474
+ },
4475
+ children: [
4476
+ i("div", {
4477
+ style: {
4478
+ width: 32,
4479
+ height: 32,
4480
+ border: "3px solid #e0e0e0",
4481
+ borderTopColor: "rgb(12, 67, 173)",
4482
+ borderRadius: "50%",
4483
+ animation: "gm-spin 0.8s linear infinite"
4484
+ }
4485
+ }),
4486
+ i("p", {
4487
+ style: {
4488
+ marginTop: 12,
4489
+ fontSize: 14,
4490
+ color: "#555",
4491
+ fontFamily: "system-ui, sans-serif"
4492
+ },
4493
+ children: "Generating screenshots and preparing data\u2026"
4494
+ }),
4495
+ i("style", {
4496
+ children: "@keyframes gm-spin { to { transform: rotate(360deg) } }"
4497
+ })
4498
+ ]
4499
+ }),
4500
+ F("div", {
4464
4501
  style: {
4465
4502
  padding: "12px 24px",
4466
4503
  backgroundColor: "#fff",
@@ -4473,7 +4510,7 @@ let __tla = (async () => {
4473
4510
  },
4474
4511
  children: [
4475
4512
  n && !ee && T.length >= 2 && i("button", {
4476
- onClick: En,
4513
+ onClick: On,
4477
4514
  style: {
4478
4515
  padding: "6px 16px",
4479
4516
  borderRadius: 4,
@@ -4489,35 +4526,37 @@ let __tla = (async () => {
4489
4526
  },
4490
4527
  children: "Next \xBB"
4491
4528
  }),
4492
- ee && Ot && ($n ? i("button", {
4493
- onClick: () => Mt("continue"),
4529
+ ee && $t && (Vn ? i("button", {
4530
+ disabled: Ie,
4531
+ onClick: () => zt("continue"),
4494
4532
  style: {
4495
4533
  padding: "6px 16px",
4496
4534
  borderRadius: 4,
4497
4535
  fontSize: 14,
4498
4536
  fontWeight: 500,
4499
- backgroundColor: "rgb(12, 67, 173)",
4537
+ backgroundColor: Ie ? "#9e9e9e" : "rgb(12, 67, 173)",
4500
4538
  border: "none",
4501
4539
  color: "#fff",
4502
- cursor: "pointer",
4540
+ cursor: Ie ? "not-allowed" : "pointer",
4503
4541
  fontFamily: "system-ui, sans-serif",
4504
4542
  letterSpacing: "0.4px",
4505
4543
  lineHeight: "36px"
4506
4544
  },
4507
4545
  children: "Continue"
4508
- }) : L(Te, {
4546
+ }) : F(Oe, {
4509
4547
  children: [
4510
4548
  i("button", {
4511
- onClick: () => Mt("use_form_measurements"),
4549
+ disabled: Ie,
4550
+ onClick: () => zt("use_form_measurements"),
4512
4551
  style: {
4513
4552
  padding: "6px 16px",
4514
4553
  borderRadius: 4,
4515
4554
  fontSize: 14,
4516
4555
  fontWeight: 500,
4517
- backgroundColor: "rgb(12, 67, 173)",
4556
+ backgroundColor: Ie ? "#9e9e9e" : "rgb(12, 67, 173)",
4518
4557
  border: "none",
4519
4558
  color: "#fff",
4520
- cursor: "pointer",
4559
+ cursor: Ie ? "not-allowed" : "pointer",
4521
4560
  fontFamily: "system-ui, sans-serif",
4522
4561
  letterSpacing: "0.4px",
4523
4562
  lineHeight: "36px"
@@ -4525,16 +4564,17 @@ let __tla = (async () => {
4525
4564
  children: "Set to Measurements"
4526
4565
  }),
4527
4566
  i("button", {
4528
- onClick: () => Mt("use_scan"),
4567
+ disabled: Ie,
4568
+ onClick: () => zt("use_scan"),
4529
4569
  style: {
4530
4570
  padding: "6px 16px",
4531
4571
  borderRadius: 4,
4532
4572
  fontSize: 14,
4533
4573
  fontWeight: 500,
4534
- backgroundColor: "#fff",
4574
+ backgroundColor: Ie ? "#e0e0e0" : "#fff",
4535
4575
  border: "1px solid #bdbdbd",
4536
- color: "#333",
4537
- cursor: "pointer",
4576
+ color: Ie ? "#999" : "#333",
4577
+ cursor: Ie ? "not-allowed" : "pointer",
4538
4578
  fontFamily: "system-ui, sans-serif",
4539
4579
  letterSpacing: "0.4px",
4540
4580
  lineHeight: "36px"
@@ -4547,7 +4587,7 @@ let __tla = (async () => {
4547
4587
  })
4548
4588
  ]
4549
4589
  }),
4550
- s && yt.length > 0 && L("div", {
4590
+ s && bt.length > 0 && F("div", {
4551
4591
  style: {
4552
4592
  height: 120,
4553
4593
  flexShrink: 0,
@@ -4560,7 +4600,7 @@ let __tla = (async () => {
4560
4600
  flexDirection: "column"
4561
4601
  },
4562
4602
  children: [
4563
- L("div", {
4603
+ F("div", {
4564
4604
  style: {
4565
4605
  display: "flex",
4566
4606
  alignItems: "center",
@@ -4580,21 +4620,21 @@ let __tla = (async () => {
4580
4620
  },
4581
4621
  children: "GALILEO DEBUG"
4582
4622
  }),
4583
- L("div", {
4623
+ F("div", {
4584
4624
  style: {
4585
4625
  display: "flex",
4586
4626
  gap: 8,
4587
4627
  alignItems: "center"
4588
4628
  },
4589
4629
  children: [
4590
- L("span", {
4630
+ F("span", {
4591
4631
  style: {
4592
4632
  color: "#484f58",
4593
4633
  fontSize: 9
4594
4634
  },
4595
4635
  children: [
4596
4636
  "WASM ",
4597
- $e.current ? "v2" : "N/A",
4637
+ He.current ? "v2" : "N/A",
4598
4638
  " | ",
4599
4639
  T.length,
4600
4640
  " pts | ",
@@ -4605,7 +4645,7 @@ let __tla = (async () => {
4605
4645
  ]
4606
4646
  }),
4607
4647
  i("button", {
4608
- onClick: () => Ht([]),
4648
+ onClick: () => jt([]),
4609
4649
  style: {
4610
4650
  background: "none",
4611
4651
  border: "1px solid #30363d",
@@ -4622,14 +4662,14 @@ let __tla = (async () => {
4622
4662
  ]
4623
4663
  }),
4624
4664
  i("div", {
4625
- ref: tt,
4665
+ ref: nt,
4626
4666
  style: {
4627
4667
  flex: 1,
4628
4668
  overflowY: "auto",
4629
4669
  padding: "4px 10px",
4630
4670
  lineHeight: 1.6
4631
4671
  },
4632
- children: yt.map((v, _) => {
4672
+ children: bt.map((v, _) => {
4633
4673
  const W = v.includes("ERROR") || v.includes("failed"), R = v.includes("warning") || v.includes("WARN"), ge = v.includes("PIPELINE:"), G = v.includes("STATE:");
4634
4674
  return i("div", {
4635
4675
  style: {
@@ -4644,25 +4684,25 @@ let __tla = (async () => {
4644
4684
  })
4645
4685
  ]
4646
4686
  }),
4647
- ee && Tt && w && i(Oo, {
4687
+ ee && Ot && w && i(Ho, {
4648
4688
  amputationType: w,
4649
- spacingInches: F,
4689
+ spacingInches: L,
4650
4690
  scanMeasurements: V,
4651
- scanFrontalHeight: Qe,
4652
- onSave: Tn,
4653
- onSkip: On
4691
+ scanFrontalHeight: qe,
4692
+ onSave: $n,
4693
+ onSkip: Hn
4654
4694
  })
4655
4695
  ]
4656
4696
  });
4657
4697
  };
4658
- function nr({ screenshotFnRef: e }) {
4698
+ function rr({ screenshotFnRef: e }) {
4659
4699
  return ne(() => {
4660
4700
  e.current = null;
4661
4701
  }, [
4662
4702
  e
4663
4703
  ]), null;
4664
4704
  }
4665
- Sn = function(e) {
4705
+ Cn = function(e) {
4666
4706
  const r = e === "AK" ? 2 : 1, t = [];
4667
4707
  for (let o = 2; o >= 1; o -= r) t.push(`${o}_above`);
4668
4708
  t.push("at_ref");
@@ -4681,40 +4721,40 @@ let __tla = (async () => {
4681
4721
  ]) t.push(`${o}_below`);
4682
4722
  return t;
4683
4723
  };
4684
- lt = function(e, r) {
4685
- const t = Sn(r), o = {};
4724
+ at = function(e, r) {
4725
+ const t = Cn(r), o = {};
4686
4726
  for (let l = 0; l < Math.min(e.length, t.length); l++) {
4687
4727
  const s = e[l];
4688
4728
  s != null && !isNaN(s) && (o[t[l]] = s);
4689
4729
  }
4690
4730
  return o;
4691
4731
  };
4692
- or = function(e, r) {
4732
+ ir = function(e, r) {
4693
4733
  if (!e) return;
4694
- const o = Sn(r).map((l) => {
4734
+ const o = Cn(r).map((l) => {
4695
4735
  const s = e[l];
4696
4736
  return s ?? void 0;
4697
4737
  });
4698
4738
  if (!o.every((l) => l == null)) return o;
4699
4739
  };
4700
- hr = ({ request: e, onComplete: r, wasmModule: t }) => {
4701
- const o = j(() => or(e.form_measurements, e.spacing_type), [
4740
+ mr = ({ request: e, onComplete: r, wasmModule: t }) => {
4741
+ const o = j(() => ir(e.form_measurements, e.spacing_type), [
4702
4742
  e.form_measurements,
4703
4743
  e.spacing_type
4704
4744
  ]), l = (s) => {
4705
4745
  var _a, _b;
4706
- const c = s.scanMeasurements.map((f) => +(f.modifiedValue ?? f.originalValue).toFixed(1)), a = lt(c, e.spacing_type);
4746
+ const c = s.scanMeasurements.map((f) => +(f.modifiedValue ?? f.originalValue).toFixed(1)), a = at(c, e.spacing_type);
4707
4747
  let n, h;
4708
4748
  if (s.formMeasurements) {
4709
- n = lt(s.formMeasurements, e.spacing_type);
4749
+ n = at(s.formMeasurements, e.spacing_type);
4710
4750
  const f = s.scanMeasurements.map((m, x) => {
4711
4751
  var _a2;
4712
4752
  const S = (_a2 = s.formMeasurements) == null ? void 0 : _a2[x];
4713
4753
  return S == null || isNaN(S) ? null : +((m.modifiedValue ?? m.originalValue) - S).toFixed(1);
4714
4754
  });
4715
- h = lt(f, e.spacing_type);
4755
+ h = at(f, e.spacing_type);
4716
4756
  }
4717
- const d = s.userEnteredMeasurements ? lt(s.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, u = s.decision === "use_scan" || s.decision === "continue", p = u ? a : d ?? n ?? a, g = u ? +s.frontalHeight.toFixed(1) : +(((_a = s.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? s.frontalHeight).toFixed(1), M = {
4757
+ const d = s.userEnteredMeasurements ? at(s.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, u = s.decision === "use_scan" || s.decision === "continue", p = u ? a : d ?? n ?? a, g = u ? +s.frontalHeight.toFixed(1) : +(((_a = s.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? s.frontalHeight).toFixed(1), M = {
4718
4758
  spacing_type: e.spacing_type,
4719
4759
  source_unit: "mm",
4720
4760
  file_format: s.fileFormat,
@@ -4746,8 +4786,8 @@ let __tla = (async () => {
4746
4786
  height: "100%",
4747
4787
  display: "flex"
4748
4788
  },
4749
- children: i(tr, {
4750
- config: to,
4789
+ children: i(or, {
4790
+ config: oo,
4751
4791
  spacingType: e.spacing_type,
4752
4792
  scanUrl: e.scan_url,
4753
4793
  formMeasurements: o,
@@ -4758,9 +4798,9 @@ let __tla = (async () => {
4758
4798
  };
4759
4799
  })();
4760
4800
  export {
4761
- hr as G,
4801
+ mr as G,
4762
4802
  __tla,
4763
- lt as a,
4764
- or as c,
4765
- Sn as g
4803
+ at as a,
4804
+ ir as c,
4805
+ Cn as g
4766
4806
  };