@solid-labs/fab-one-widget 1.0.10 → 1.0.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 F, jsx as i, Fragment as Be } from "react/jsx-runtime";
2
- import { createContext as oo, Component as ro, useCallback as J, useMemo as j, useState as W, memo as io, useEffect as q, useRef as se, forwardRef as so, createElement as en } from "react";
3
- import { useFrame as cn, useThree as dn, Canvas as lo } from "@react-three/fiber";
4
- import { Html as He, Line as ce, OrbitControls as fn } from "@react-three/drei";
1
+ import { jsxs as F, jsx as i, Fragment as Ee } from "react/jsx-runtime";
2
+ import { createContext as co, Component as fo, useCallback as J, useMemo as j, useState as W, memo as uo, useEffect as q, useRef as le, forwardRef as po, createElement as fn } from "react";
3
+ import { useFrame as yn, useThree as wn, Canvas as ho } from "@react-three/fiber";
4
+ import { Html as je, Line as de, OrbitControls as Sn } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as ut, Vector3 as z, Box3 as un, Line3 as pn, Raycaster as ao } from "three";
7
- import { create as co } from "zustand";
8
- import { OBJLoader as hn } from "three/examples/jsm/loaders/OBJLoader.js";
9
- import { STLLoader as fo } from "three/examples/jsm/loaders/STLLoader.js";
10
- import { MeshBVH as pt } from "three-mesh-bvh";
11
- let kr, ct, mr, zn;
6
+ import { Plane as xt, Vector3 as z, Box3 as vn, Line3 as Cn, Raycaster as go } from "three";
7
+ import { create as mo } from "zustand";
8
+ import { OBJLoader as zn } from "three/examples/jsm/loaders/OBJLoader.js";
9
+ import { STLLoader as xo } from "three/examples/jsm/loaders/STLLoader.js";
10
+ import { MeshBVH as bt } from "three-mesh-bvh";
11
+ let _r, ht, vr, Rn;
12
12
  let __tla = (async () => {
13
- const uo = {
13
+ const bo = {
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
- }, po = {
22
+ }, yo = {
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
- }, ho = oo(uo), Bt = co((t, r) => ({
31
+ }, wo = co(bo), Ht = mo((t, 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
- })), go = 0.45, ht = 3, Rt = 1e-3, dt = 25.4, mo = [
67
+ })), So = 0.45, yt = 3, Ot = 1e-3, gt = 25.4, vo = [
68
68
  0.25,
69
69
  -0.25,
70
70
  0.5,
71
71
  -0.5
72
72
  ];
73
- function xo(t) {
73
+ function Co(t) {
74
74
  var _a;
75
75
  const r = t.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,68 +90,68 @@ let __tla = (async () => {
90
90
  colors: new Float32Array(s)
91
91
  } : null;
92
92
  }
93
- function bo(t, r, n, o) {
93
+ function zo(t, r, n, o) {
94
94
  const s = t.getAttribute("position"), a = s.count, c = new Float32Array(a * 3), l = r.length / 3;
95
95
  let e = 1 / 0, m = 1 / 0, d = 1 / 0, f = -1 / 0, u = -1 / 0, x = -1 / 0;
96
96
  for (let D = 0; D < l; D++) {
97
- const E = r[D * 3] * o, V = r[D * 3 + 1] * o, G = r[D * 3 + 2] * o;
98
- E < e && (e = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), G < d && (d = G), G > x && (x = G);
97
+ const E = r[D * 3] * o, V = r[D * 3 + 1] * o, X = r[D * 3 + 2] * o;
98
+ E < e && (e = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), X < d && (d = X), X > x && (x = X);
99
99
  }
100
- const S = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, A = u - m + 1e-6, P = x - d + 1e-6, v = b * 0.5, k = A * 0.5, w = P * 0.5, M = Math.min(128, Math.max(16, Math.round(Math.cbrt(l)))), h = b / M, C = A / M, L = P / M, I = /* @__PURE__ */ new Map();
100
+ const S = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, A = u - m + 1e-6, L = x - d + 1e-6, v = b * 0.5, k = A * 0.5, w = L * 0.5, M = Math.min(128, Math.max(16, Math.round(Math.cbrt(l)))), h = b / M, C = A / M, P = L / M, I = /* @__PURE__ */ new Map();
101
101
  for (let D = 0; D < l; D++) {
102
- const E = r[D * 3] * o - S, V = r[D * 3 + 1] * o - p, G = r[D * 3 + 2] * o - g, Q = Math.min(M - 1, Math.max(0, Math.floor((E + v) / h))), xe = Math.min(M - 1, Math.max(0, Math.floor((V + k) / C))), le = Math.min(M - 1, Math.max(0, Math.floor((G + w) / L))), de = Q * M * M + xe * M + le;
103
- let re = I.get(de);
104
- re || (re = [], I.set(de, re)), re.push(D);
102
+ const E = r[D * 3] * o - S, V = r[D * 3 + 1] * o - p, X = r[D * 3 + 2] * o - g, Q = Math.min(M - 1, Math.max(0, Math.floor((E + v) / h))), be = Math.min(M - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(M - 1, Math.max(0, Math.floor((X + w) / P))), fe = Q * M * M + be * M + ae;
103
+ let re = I.get(fe);
104
+ re || (re = [], I.set(fe, re)), re.push(D);
105
105
  }
106
106
  for (let D = 0; D < a; D++) {
107
- const E = s.getX(D), V = s.getY(D), G = s.getZ(D), Q = Math.min(M - 1, Math.max(0, Math.floor((E + v) / h))), xe = Math.min(M - 1, Math.max(0, Math.floor((V + k) / C))), le = Math.min(M - 1, Math.max(0, Math.floor((G + w) / L)));
108
- let de = 1 / 0, re = 0;
109
- for (let ee = 0; ee <= M && de > 0; ee++) {
110
- for (let X = -ee; X <= ee; X++) for (let fe = -ee; fe <= ee; fe++) for (let Z = -ee; Z <= ee; Z++) {
111
- if (ee > 0 && Math.abs(X) < ee && Math.abs(fe) < ee && Math.abs(Z) < ee) continue;
112
- const ue = Q + X, ge = xe + fe, pe = le + Z;
113
- if (ue < 0 || ue >= M || ge < 0 || ge >= M || pe < 0 || pe >= M) continue;
114
- const H = I.get(ue * M * M + ge * M + pe);
107
+ const E = s.getX(D), V = s.getY(D), X = s.getZ(D), Q = Math.min(M - 1, Math.max(0, Math.floor((E + v) / h))), be = Math.min(M - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(M - 1, Math.max(0, Math.floor((X + w) / P)));
108
+ let fe = 1 / 0, re = 0;
109
+ for (let ee = 0; ee <= M && fe > 0; ee++) {
110
+ for (let G = -ee; G <= ee; G++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
111
+ if (ee > 0 && Math.abs(G) < ee && Math.abs(ue) < ee && Math.abs(Z) < ee) continue;
112
+ const pe = Q + G, me = be + ue, he = ae + Z;
113
+ if (pe < 0 || pe >= M || me < 0 || me >= M || he < 0 || he >= M) continue;
114
+ const H = I.get(pe * M * M + me * M + he);
115
115
  if (H) for (const ne of H) {
116
- const me = r[ne * 3] * o - S, ye = r[ne * 3 + 1] * o - p, be = r[ne * 3 + 2] * o - g, oe = (E - me) ** 2 + (V - ye) ** 2 + (G - be) ** 2;
117
- oe < de && (de = oe, re = ne);
116
+ const xe = r[ne * 3] * o - S, we = r[ne * 3 + 1] * o - p, ye = r[ne * 3 + 2] * o - g, oe = (E - xe) ** 2 + (V - we) ** 2 + (X - ye) ** 2;
117
+ oe < fe && (fe = oe, re = ne);
118
118
  }
119
119
  }
120
- if (de < 1 / 0) break;
120
+ if (fe < 1 / 0) break;
121
121
  }
122
122
  c[D * 3] = n[re * 3], c[D * 3 + 1] = n[re * 3 + 1], c[D * 3 + 2] = n[re * 3 + 2];
123
123
  }
124
124
  t.setAttribute("color", new O.Float32BufferAttribute(c, 3));
125
125
  }
126
- const tn = {
126
+ const un = {
127
127
  debug: 0,
128
128
  info: 1,
129
129
  warn: 2,
130
130
  error: 3
131
131
  };
132
- let gn = "warn", mn = null;
133
- const ae = {
132
+ let Mn = "warn", An = null;
133
+ const ce = {
134
134
  setLevel(t) {
135
- gn = t;
135
+ Mn = t;
136
136
  },
137
137
  setHandler(t) {
138
- mn = t;
138
+ An = t;
139
139
  },
140
140
  debug(t, r, n) {
141
- lt("debug", t, r, n);
141
+ ut("debug", t, r, n);
142
142
  },
143
143
  info(t, r, n) {
144
- lt("info", t, r, n);
144
+ ut("info", t, r, n);
145
145
  },
146
146
  warn(t, r, n) {
147
- lt("warn", t, r, n);
147
+ ut("warn", t, r, n);
148
148
  },
149
149
  error(t, r, n) {
150
- lt("error", t, r, n);
150
+ ut("error", t, r, n);
151
151
  }
152
152
  };
153
- function lt(t, r, n, o) {
154
- if (tn[t] < tn[gn]) return;
153
+ function ut(t, r, n, o) {
154
+ if (un[t] < un[Mn]) return;
155
155
  const s = `[${r}]`, a = o !== void 0 ? [
156
156
  s,
157
157
  n,
@@ -174,9 +174,9 @@ let __tla = (async () => {
174
174
  console.error(...a);
175
175
  break;
176
176
  }
177
- mn == null ? void 0 : mn(t, r, n, o);
177
+ An == null ? void 0 : An(t, r, n, o);
178
178
  }
179
- function ft(t) {
179
+ function mt(t) {
180
180
  const r = t.getAttribute("position"), n = new Float32Array(r.array), o = t.getIndex();
181
181
  if (o) return {
182
182
  positions: n,
@@ -189,32 +189,32 @@ let __tla = (async () => {
189
189
  indices: a
190
190
  };
191
191
  }
192
- function xn(t, r) {
192
+ function kn(t, r) {
193
193
  const n = new O.BufferGeometry();
194
194
  return n.setAttribute("position", new O.Float32BufferAttribute(t, 3)), n.setIndex(new O.BufferAttribute(r, 1)), n.computeVertexNormals(), n;
195
195
  }
196
- async function yo(t, r, n) {
196
+ async function Mo(t, r, n) {
197
197
  try {
198
- const o = xo(t);
198
+ const o = Co(t);
199
199
  n == null ? void 0 : n("Parsing mesh...");
200
- const a = new hn().parse(t);
200
+ const a = new zn().parse(t);
201
201
  let c = null;
202
202
  if (a.traverse((b) => {
203
203
  b.isMesh && !c && (c = b.geometry);
204
204
  }), !c) return null;
205
- const { positions: l, indices: e } = ft(c);
206
- if (l.length < 9 || e.length < 3) return ae.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
207
- for (let b = 0; b < Math.min(l.length, 300); b++) if (!isFinite(l[b])) return ae.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
205
+ const { positions: l, indices: e } = mt(c);
206
+ if (l.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
207
+ for (let b = 0; b < Math.min(l.length, 300); b++) if (!isFinite(l[b])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
208
208
  const m = l.length / 3;
209
- for (let b = 0; b < Math.min(e.length, 300); b++) if (e[b] >= m) return ae.error("wasm", `Out-of-bounds index: ${e[b]} >= ${m}`), null;
209
+ for (let b = 0; b < Math.min(e.length, 300); b++) if (e[b] >= m) return ce.error("wasm", `Out-of-bounds index: ${e[b]} >= ${m}`), null;
210
210
  n == null ? void 0 : n("Processing mesh (WASM)...");
211
211
  const d = r.preprocess_mesh(l, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), x = d.unit_converted(), S = d.detected_unit(), p = d.log();
212
- if (ae.debug("wasm", "preprocess result", p), f.length === 0) return null;
212
+ if (ce.debug("wasm", "preprocess result", p), f.length === 0) return null;
213
213
  n == null ? void 0 : n("Building geometry...");
214
- const g = xn(f, u);
214
+ const g = kn(f, u);
215
215
  if (o) {
216
216
  const b = x ? 1e3 : 1;
217
- bo(g, o.positions, o.colors, b);
217
+ zo(g, o.positions, o.colors, b);
218
218
  }
219
219
  return {
220
220
  geometry: g,
@@ -223,18 +223,18 @@ let __tla = (async () => {
223
223
  detectedUnit: S
224
224
  };
225
225
  } catch (o) {
226
- return ae.error("wasm", "Processing failed", o), null;
226
+ return ce.error("wasm", "Processing failed", o), null;
227
227
  }
228
228
  }
229
- function wo(t) {
230
- const n = new hn().parse(t);
229
+ function Ao(t) {
230
+ const n = new zn().parse(t);
231
231
  let o = null;
232
232
  return n.traverse((s) => {
233
233
  s.isMesh && !o && (o = s.geometry);
234
234
  }), o;
235
235
  }
236
- async function _t(t) {
237
- const r = await t.arrayBuffer(), s = new fo().parse(r).getAttribute("position");
236
+ async function Et(t) {
237
+ const r = await t.arrayBuffer(), s = new xo().parse(r).getAttribute("position");
238
238
  if (!s || s.count === 0) throw new Error("Empty STL geometry");
239
239
  const a = [];
240
240
  for (let c = 0; c < s.count; c++) a.push(`v ${s.getX(c)} ${s.getY(c)} ${s.getZ(c)}`);
@@ -242,25 +242,25 @@ let __tla = (async () => {
242
242
  return a.join(`
243
243
  `);
244
244
  }
245
- function So(t, r) {
245
+ function ko(t, r) {
246
246
  const n = 1 / r;
247
247
  return `${Math.round(t.x * n)}_${Math.round(t.y * n)}_${Math.round(t.z * n)}`;
248
248
  }
249
- function vo(t, r) {
249
+ function Fo(t, r) {
250
250
  if (!t.length) return [];
251
251
  const n = [];
252
252
  for (const o of t) (n.length === 0 || n[n.length - 1].distanceTo(o) > r) && n.push(o.clone());
253
253
  return n.length > 2 && n[0].distanceTo(n[n.length - 1]) > r && n.push(n[0].clone()), n;
254
254
  }
255
- function Ye(t) {
255
+ function Xe(t) {
256
256
  let r = 0;
257
257
  for (let n = 0; n < t.length - 1; n++) r += t[n].distanceTo(t[n + 1]);
258
258
  return r;
259
259
  }
260
- function bn(t, r = 1e-3, n = false) {
260
+ function Fn(t, r = 1e-3, n = false) {
261
261
  if (!t.length) return [];
262
262
  const o = /* @__PURE__ */ new Map(), s = (f) => {
263
- const u = So(f, r);
263
+ const u = ko(f, r);
264
264
  let x = o.get(u);
265
265
  return x || (x = f.clone(), o.set(u, x)), x;
266
266
  }, a = t.map((f) => ({
@@ -285,13 +285,13 @@ let __tla = (async () => {
285
285
  a.splice(p, 1), x = true;
286
286
  }
287
287
  }
288
- const S = vo(u, r);
288
+ const S = Fo(u, r);
289
289
  S.length > 1 && c.push(S);
290
290
  }
291
291
  if (!c.length) return [];
292
292
  if (n) {
293
- c.sort((x, S) => Ye(S) - Ye(x));
294
- const f = Ye(c[0]), u = c.filter((x) => Ye(x) >= f * 0.3);
293
+ c.sort((x, S) => Xe(S) - Xe(x));
294
+ const f = Xe(c[0]), u = c.filter((x) => Xe(x) >= f * 0.3);
295
295
  return u[u.length - 1] ?? c[0];
296
296
  }
297
297
  const l = c.filter((f) => f.length >= 3 && f[0].distanceTo(f[f.length - 1]) < r * 10), e = l.length > 0 ? l : c;
@@ -306,8 +306,8 @@ let __tla = (async () => {
306
306
  }
307
307
  return m;
308
308
  }
309
- function nn(t, r, n, o = false) {
310
- const s = new ut(new z(0, 1, 0), -n), a = [], c = new un();
309
+ function pn(t, r, n, o = false) {
310
+ const s = new xt(new z(0, 1, 0), -n), a = [], c = new vn();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
312
  const l = {
313
313
  linePoints: [],
@@ -315,7 +315,7 @@ let __tla = (async () => {
315
315
  rightmostPoint: new z(0, n, 0)
316
316
  };
317
317
  if (!s.intersectsBox(c)) return l;
318
- const e = new pn(), m = new z();
318
+ const e = new Cn(), m = new z();
319
319
  t.shapecast({
320
320
  intersectsBounds: (p) => s.intersectsBox(p),
321
321
  intersectsTriangle: (p) => {
@@ -326,12 +326,12 @@ let __tla = (async () => {
326
326
  });
327
327
  }
328
328
  });
329
- const d = bn(a, Rt, o);
329
+ const d = Fn(a, Ot, o);
330
330
  if (d.length < 2) return l;
331
- const f = Ye(d);
331
+ const f = Xe(d);
332
332
  let u = -1 / 0, x = new z(0, n, 0);
333
333
  for (const p of d) p.x > u && (u = p.x, x = p.clone());
334
- const S = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Rt * 10;
334
+ const S = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Ot * 10;
335
335
  return {
336
336
  linePoints: d,
337
337
  lineLength: f,
@@ -339,22 +339,22 @@ let __tla = (async () => {
339
339
  isClosed: S
340
340
  };
341
341
  }
342
- function $e(t, r, n, o = false) {
343
- const s = nn(t, r, n, o);
342
+ function He(t, r, n, o = false) {
343
+ const s = pn(t, r, n, o);
344
344
  if (s.isClosed && s.linePoints.length >= 3) return s;
345
- ae.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
345
+ ce.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
346
346
  let a = s;
347
- for (const c of mo) {
348
- const l = nn(t, r, n + c, o);
349
- if (l.isClosed && l.linePoints.length >= 3) return ae.debug("slice", `y=${n.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${l.linePoints.length}, len=${l.lineLength.toFixed(1)}mm)`), l;
347
+ for (const c of vo) {
348
+ const l = pn(t, r, n + c, o);
349
+ if (l.isClosed && l.linePoints.length >= 3) return ce.debug("slice", `y=${n.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${l.linePoints.length}, len=${l.lineLength.toFixed(1)}mm)`), l;
350
350
  l.linePoints.length > a.linePoints.length && (a = l);
351
351
  }
352
- return ae.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
352
+ return ce.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
353
353
  }
354
- function Co(t, r, n, o) {
355
- const s = new ut().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new un();
354
+ function Po(t, r, n, o) {
355
+ const s = new xt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new vn();
356
356
  if (a.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(a)) return 0;
357
- const c = [], l = new pn(), e = new z();
357
+ const c = [], l = new Cn(), e = new z();
358
358
  t.shapecast({
359
359
  intersectsBounds: (d) => s.intersectsBox(d),
360
360
  intersectsTriangle: (d) => {
@@ -365,15 +365,15 @@ let __tla = (async () => {
365
365
  });
366
366
  }
367
367
  });
368
- const m = bn(c, Rt);
369
- return Ye(m);
368
+ const m = Fn(c, Ot);
369
+ return Xe(m);
370
370
  }
371
- function Wt(t) {
372
- return new pt(t, {
373
- maxLeafTris: ht
371
+ function $t(t) {
372
+ return new bt(t, {
373
+ maxLeafTris: yt
374
374
  });
375
375
  }
376
- function zo(t, r, n, o) {
376
+ function Lo(t, r, n, o) {
377
377
  const s = t.getIndex(), a = s ? s.count / 3 : 0;
378
378
  if (a < 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 l = new pt(t, {
392
- maxLeafTris: ht
393
- }), e = $e(l, t, r);
391
+ const l = new bt(t, {
392
+ maxLeafTris: yt
393
+ }), e = He(l, t, r);
394
394
  if (e.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 = $e(l, t, m);
403
+ const d = He(l, t, m);
404
404
  if (e.lineLength > 0 && d.lineLength > 0) {
405
405
  const u = e.lineLength / d.lineLength;
406
406
  if (u < 0.5) return {
@@ -410,7 +410,7 @@ let __tla = (async () => {
410
410
  }
411
411
  const f = r - o * 2;
412
412
  if (f > n) {
413
- const u = $e(l, t, f);
413
+ const u = He(l, t, f);
414
414
  if (d.lineLength > 0 && u.lineLength > 0) {
415
415
  const x = d.lineLength / u.lineLength;
416
416
  if (x < 0.5) return {
@@ -425,7 +425,7 @@ let __tla = (async () => {
425
425
  };
426
426
  }
427
427
  const Fe = "pipeline";
428
- function Mo(t, r, n, o) {
428
+ function Io(t, r, n, o) {
429
429
  var _a, _b, _c, _d;
430
430
  const s = t.geometry.clone(), a = r.map((l) => ({
431
431
  ...l
@@ -434,19 +434,19 @@ let __tla = (async () => {
434
434
  let l = t.geometry, e = a.map((H) => new z(H.position.x, H.position.y, H.position.z));
435
435
  const m = e[0], d = e[1];
436
436
  if (!c) {
437
- o.onStatus("Aligning mesh (JS fallback)..."), ae.warn(Fe, "WASM not available, using JS fallback alignment");
438
- const H = new z(0, 1, 0), ne = new z().subVectors(d, m).normalize(), me = ne.dot(H), ye = new z().crossVectors(ne, H);
439
- if (ye.length() > 1e-4) {
440
- ye.normalize();
441
- const Y = new O.Quaternion().setFromAxisAngle(ye, Math.acos(Math.min(1, Math.max(-1, me))));
442
- l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(Y)), e = e.map((Le) => Le.clone().applyQuaternion(Y));
437
+ o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(Fe, "WASM not available, using JS fallback alignment");
438
+ const H = new z(0, 1, 0), ne = new z().subVectors(d, m).normalize(), xe = ne.dot(H), we = new z().crossVectors(ne, H);
439
+ if (we.length() > 1e-4) {
440
+ we.normalize();
441
+ const Y = new O.Quaternion().setFromAxisAngle(we, Math.acos(Math.min(1, Math.max(-1, xe))));
442
+ l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(Y)), e = e.map((Pe) => Pe.clone().applyQuaternion(Y));
443
443
  }
444
444
  if (e[0].y > e[1].y) {
445
445
  const Y = new O.Quaternion().setFromAxisAngle(new z(1, 0, 0), Math.PI);
446
- l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(Y)), e = e.map((Le) => Le.clone().applyQuaternion(Y));
446
+ l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(Y)), e = e.map((Pe) => Pe.clone().applyQuaternion(Y));
447
447
  }
448
- const be = e[0].clone();
449
- l.translate(-be.x, -be.y, -be.z), e = e.map((Y) => new z(Y.x - be.x, Y.y - be.y, Y.z - be.z)), l.computeVertexNormals(), l.computeBoundingBox();
448
+ const ye = e[0].clone();
449
+ l.translate(-ye.x, -ye.y, -ye.z), e = e.map((Y) => new z(Y.x - ye.x, Y.y - ye.y, Y.z - ye.z)), l.computeVertexNormals(), l.computeBoundingBox();
450
450
  const oe = new z(e[0].x, e[0].y, e[0].z);
451
451
  e.push(oe), o.addLandmarkPoint({
452
452
  faceIndex: -1,
@@ -469,12 +469,12 @@ let __tla = (async () => {
469
469
  x: Y.x,
470
470
  y: Y.y,
471
471
  z: Y.z
472
- }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * dt);
472
+ }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * gt);
473
473
  const N = new z();
474
474
  l.computeBoundingBox(), l.boundingBox.getSize(N), o.setModelSize(Math.max(N.x, N.y, N.z)), s.dispose();
475
475
  return;
476
476
  }
477
- const { positions: f, indices: u } = ft(l), x = new Float32Array([
477
+ const { positions: f, indices: u } = mt(l), x = new Float32Array([
478
478
  m.x,
479
479
  m.y,
480
480
  m.z
@@ -485,31 +485,31 @@ let __tla = (async () => {
485
485
  ]);
486
486
  o.onStatus("Detecting shell type...");
487
487
  const p = c.detect_shell(f, u, S, 40), g = p.is_double_shell(), b = p.surface_normal();
488
- ae.info(Fe, `Shell: ${g ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, g), o.onStatus("Finding cross-section plane...");
488
+ ce.info(Fe, `Shell: ${g ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, g), o.onStatus("Finding cross-section plane...");
489
489
  const A = new Float32Array([
490
490
  b[0],
491
491
  b[1],
492
492
  b[2]
493
- ]), P = c.find_min_cross_section(f, u, S, A, 10), v = P.plane_normal();
494
- ae.info(Fe, "Cross-section found", P.details()), o.onStatus("Aligning mesh...");
493
+ ]), L = c.find_min_cross_section(f, u, S, A, 10), v = L.plane_normal();
494
+ ce.info(Fe, "Cross-section found", L.details()), o.onStatus("Aligning mesh...");
495
495
  const k = new Float32Array([
496
496
  v[0],
497
497
  v[1],
498
498
  v[2]
499
499
  ]), w = c.align_to_origin(f, x, S, k);
500
500
  let M = w.positions(), h = w.mpt(), C = w.origin();
501
- const L = w.transform();
502
- ae.info(Fe, "Alignment complete", w.details());
501
+ const P = w.transform();
502
+ ce.info(Fe, "Alignment complete", w.details());
503
503
  const I = [
504
- L[3],
505
- L[4],
506
- L[5],
507
- L[6],
508
- L[7],
509
- L[8],
510
- L[9],
511
- L[10],
512
- L[11]
504
+ P[3],
505
+ P[4],
506
+ P[5],
507
+ P[6],
508
+ P[7],
509
+ P[8],
510
+ P[9],
511
+ P[10],
512
+ P[11]
513
513
  ], D = new Float32Array([
514
514
  I[0] * v[0] + I[1] * v[1] + I[2] * v[2],
515
515
  I[3] * v[0] + I[4] * v[1] + I[5] * v[2],
@@ -517,34 +517,34 @@ let __tla = (async () => {
517
517
  ]);
518
518
  o.onStatus("Generating measurement points...");
519
519
  const E = c.subdivide_origin_to_plane(new Float32Array(C), new Float32Array(h), D);
520
- ae.debug(Fe, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
521
- const V = E.points(), G = E.count(), Q = 2, xe = 1, le = [];
522
- for (let H = Q; H < G - xe; H++) le.push(V[H * 3 + 1]);
520
+ ce.debug(Fe, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
521
+ const V = E.points(), X = E.count(), Q = 2, be = 1, ae = [];
522
+ for (let H = Q; H < X - be; H++) ae.push(V[H * 3 + 1]);
523
523
  o.onStatus("Computing cross-sections...");
524
- let de = [];
525
- if (le.length >= 2) {
526
- const ne = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(M, u, new Float32Array(le), 10);
527
- ae.debug(Fe, "Batch (subdivision)", ne.details());
528
- const me = ne.all_loop_points(), ye = ne.offsets(), be = ne.circumferences();
529
- for (let oe = 0; oe < ye.length - 1; oe++) {
530
- const N = ye[oe], Y = ye[oe + 1];
531
- if (Y <= N || be[oe] <= 0) continue;
532
- const Le = (Y - N) / 3;
533
- if (Le < 3) continue;
534
- let ke = 0, je = 0, ie = 0;
535
- for (let Ae = N; Ae < Y; Ae += 3) ke += me[Ae], je += me[Ae + 1], ie += me[Ae + 2];
536
- de.push(ke / Le, je / Le, ie / Le);
524
+ let fe = [];
525
+ if (ae.length >= 2) {
526
+ const ne = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(M, u, new Float32Array(ae), 10);
527
+ ce.debug(Fe, "Batch (subdivision)", ne.details());
528
+ const xe = ne.all_loop_points(), we = ne.offsets(), ye = ne.circumferences();
529
+ for (let oe = 0; oe < we.length - 1; oe++) {
530
+ const N = we[oe], Y = we[oe + 1];
531
+ if (Y <= N || ye[oe] <= 0) continue;
532
+ const Pe = (Y - N) / 3;
533
+ if (Pe < 3) continue;
534
+ let ke = 0, Ve = 0, ie = 0;
535
+ for (let Ae = N; Ae < Y; Ae += 3) ke += xe[Ae], Ve += xe[Ae + 1], ie += xe[Ae + 2];
536
+ fe.push(ke / Pe, Ve / Pe, ie / Pe);
537
537
  }
538
538
  }
539
- if (de.length >= 6) {
539
+ if (fe.length >= 6) {
540
540
  o.onStatus("Refining alignment...");
541
- const H = c.refine_alignment(new Float32Array(de), M, new Float32Array(C), new Float32Array(h));
542
- ae.info(Fe, "Refinement complete", H.details()), M = H.positions(), h = H.mpt(), C = H.origin();
541
+ const H = c.refine_alignment(new Float32Array(fe), M, new Float32Array(C), new Float32Array(h));
542
+ ce.info(Fe, "Refinement complete", H.details()), M = H.positions(), h = H.mpt(), C = H.origin();
543
543
  }
544
- const re = l.getAttribute("color"), ee = xn(M, u);
544
+ const re = l.getAttribute("color"), ee = kn(M, u);
545
545
  re && ee.setAttribute("color", re), l.dispose(), l = ee, t.geometry = l, l.computeVertexNormals(), l.computeBoundingBox(), e[0] = new z(C[0], C[1], C[2]), e[1] = new z(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
546
- const X = new z(e[0].x, e[0].y, e[0].z);
547
- e.push(X), o.addLandmarkPoint({
546
+ const G = new z(e[0].x, e[0].y, e[0].z);
547
+ e.push(G), o.addLandmarkPoint({
548
548
  faceIndex: -1,
549
549
  vertexIndices: [
550
550
  0,
@@ -552,9 +552,9 @@ let __tla = (async () => {
552
552
  2
553
553
  ],
554
554
  position: {
555
- x: X.x,
556
- y: X.y,
557
- z: X.z
555
+ x: G.x,
556
+ y: G.y,
557
+ z: G.z
558
558
  },
559
559
  barycentricCoords: {
560
560
  u: 0.33,
@@ -566,41 +566,41 @@ let __tla = (async () => {
566
566
  y: H.y,
567
567
  z: H.z
568
568
  }))), o.setAligned(true);
569
- const fe = l.boundingBox, Z = new z();
570
- fe.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * dt), o.onStatus("Computing final measurements...");
569
+ const ue = l.boundingBox, Z = new z();
570
+ ue.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * gt), o.onStatus("Computing final measurements...");
571
571
  {
572
- const H = ft(l), ne = e[1].y, me = e[0].y;
573
- let ye = 1 / 0, be = -1 / 0;
572
+ const H = mt(l), ne = e[1].y, xe = e[0].y;
573
+ let we = 1 / 0, ye = -1 / 0;
574
574
  const oe = H.positions;
575
- for (let ie = 1; ie < oe.length; ie += 3) oe[ie] < ye && (ye = oe[ie]), oe[ie] > be && (be = oe[ie]);
575
+ for (let ie = 1; ie < oe.length; ie += 3) oe[ie] < we && (we = oe[ie]), oe[ie] > ye && (ye = oe[ie]);
576
576
  const N = 25.4, Y = [];
577
577
  Y.push(ne);
578
578
  for (let ie = 1; ie <= 2; ie++) {
579
579
  const Ae = ne + ie * N;
580
- Ae < be - 1 && Y.push(Ae);
580
+ Ae < ye - 1 && Y.push(Ae);
581
581
  }
582
- for (let ie = ne - N; ie > me; ie -= N) Y.push(ie);
583
- Y.sort((ie, Ae) => ie - Ae), ae.info(Fe, `Horizontal slices: ${Y.length} Y planes, range ${(_b = Y[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = Y[Y.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
582
+ for (let ie = ne - N; ie > xe; ie -= N) Y.push(ie);
583
+ Y.sort((ie, Ae) => ie - Ae), ce.info(Fe, `Horizontal slices: ${Y.length} Y planes, range ${(_b = Y[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = Y[Y.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
584
584
  const ke = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(H.positions, H.indices, new Float32Array(Y), 10);
585
- ae.info(Fe, `Horizontal slices (${g ? "inner" : "outer"}): ${ke.count()}/${Y.length} valid`), ae.debug(Fe, "Slice details", ke.details());
586
- const je = {
585
+ ce.info(Fe, `Horizontal slices (${g ? "inner" : "outer"}): ${ke.count()}/${Y.length} valid`), ce.debug(Fe, "Slice details", ke.details());
586
+ const Ve = {
587
587
  yValues: Y,
588
588
  circumferences: Array.from(ke.circumferences()),
589
589
  allLoopPoints: new Float32Array(ke.all_loop_points()),
590
590
  offsets: new Uint32Array(ke.offsets()),
591
591
  mptY: ne,
592
- originY: me
592
+ originY: xe
593
593
  };
594
- (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, je);
594
+ (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ve);
595
595
  }
596
596
  o.onStatus("Validating results...");
597
- const ue = e[1].y, ge = e[0].y, pe = zo(l, ue, ge, n);
598
- pe.valid || ae.warn(Fe, `Validation: ${pe.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
597
+ const pe = e[1].y, me = e[0].y, he = Lo(l, pe, me, n);
598
+ he.valid || ce.warn(Fe, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
599
599
  } catch (l) {
600
- ae.error(Fe, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
600
+ ce.error(Fe, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
601
601
  }
602
602
  }
603
- class Ao extends ro {
603
+ class _o extends fo {
604
604
  constructor() {
605
605
  super(...arguments), this.state = {
606
606
  error: null
@@ -667,7 +667,7 @@ let __tla = (async () => {
667
667
  }) : this.props.children;
668
668
  }
669
669
  }
670
- const ko = ({ message: t, onDismiss: r }) => F("div", {
670
+ const Do = ({ message: t, onDismiss: r }) => F("div", {
671
671
  style: {
672
672
  position: "absolute",
673
673
  top: 16,
@@ -720,7 +720,7 @@ let __tla = (async () => {
720
720
  children: "x"
721
721
  })
722
722
  ]
723
- }), on = ({ message: t }) => F("div", {
723
+ }), hn = ({ message: t }) => 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 Fo(t, r, n, o) {
761
+ function Ro(t, r, n, o) {
762
762
  const s = new z().subVectors(n, r), a = new z().subVectors(o, r), c = new z().subVectors(t, r), l = s.dot(s), e = s.dot(a), m = s.dot(c), d = a.dot(a), f = a.dot(c), u = 1 / (l * d - e * e), x = (d * m - e * f) * u, S = (l * f - e * m) * u;
763
763
  return {
764
764
  u: 1 - x - S,
@@ -766,8 +766,8 @@ let __tla = (async () => {
766
766
  w: S
767
767
  };
768
768
  }
769
- const Lo = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: a = false }) => {
770
- const { addLandmarkPoint: c, landmarkPoints: l } = Bt(), e = J((x) => {
769
+ const Wo = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: a = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: l } = Ht(), e = J((x) => {
771
771
  if (l.length >= r) return;
772
772
  x.stopPropagation();
773
773
  const S = x.intersections[0], p = S == null ? void 0 : S.faceIndex;
@@ -783,9 +783,9 @@ let __tla = (async () => {
783
783
  p * 3 + 1,
784
784
  p * 3 + 2
785
785
  ];
786
- const P = g.getAttribute("position"), v = new z().fromBufferAttribute(P, A[0]), k = new z().fromBufferAttribute(P, A[1]), w = new z().fromBufferAttribute(P, A[2]);
786
+ const L = g.getAttribute("position"), v = new z().fromBufferAttribute(L, A[0]), k = new z().fromBufferAttribute(L, A[1]), w = new z().fromBufferAttribute(L, A[2]);
787
787
  v.applyMatrix4(t.matrixWorld), k.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
788
- const M = S.point, h = Fo(M, v, k, w), C = {
788
+ const M = S.point, h = Ro(M, v, k, w), C = {
789
789
  faceIndex: p,
790
790
  vertexIndices: A,
791
791
  position: {
@@ -826,7 +826,7 @@ let __tla = (async () => {
826
826
  material: u,
827
827
  renderOrder: a ? 0 : void 0
828
828
  });
829
- }, Po = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
829
+ }, Bo = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
830
830
  const [a, c] = W(false);
831
831
  return F("mesh", {
832
832
  position: [
@@ -847,7 +847,7 @@ let __tla = (async () => {
847
847
  i("meshBasicMaterial", {
848
848
  color: o
849
849
  }),
850
- a && i(He, {
850
+ a && i(je, {
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
- }, Io = ({ modelSize: t, labels: r }) => {
872
- const { landmarkPoints: n } = Bt(), o = t * 0.02, s = [
871
+ }, Eo = ({ modelSize: t, labels: r }) => {
872
+ const { landmarkPoints: n } = Ht(), o = t * 0.02, s = [
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(Be, {
882
- children: n.map((l, e) => i(Po, {
881
+ return i(Ee, {
882
+ children: n.map((l, e) => i(Bo, {
883
883
  point: l,
884
884
  index: e,
885
885
  markerSize: o,
@@ -888,28 +888,28 @@ let __tla = (async () => {
888
888
  }, e))
889
889
  });
890
890
  };
891
- function yn(t) {
892
- return j(() => t ? new pt(t, {
893
- maxLeafTris: ht
891
+ function Pn(t) {
892
+ return j(() => t ? new bt(t, {
893
+ maxLeafTris: yt
894
894
  }) : null, [
895
895
  t
896
896
  ]);
897
897
  }
898
- const rn = (t, r) => {
898
+ const gn = (t, r) => {
899
899
  const n = Math.abs(t - r);
900
900
  return n <= 7 ? "#8BC34A" : n <= 20 ? "#FFC107" : "#FF5722";
901
- }, sn = new O.Color("#8BC34A"), ln = new O.Color("#FFC107"), _o = new O.Color("#FF5722"), Do = (t) => {
902
- if (t <= 7) return sn.clone();
901
+ }, mn = new O.Color("#8BC34A"), xn = new O.Color("#FFC107"), To = new O.Color("#FF5722"), Oo = (t) => {
902
+ if (t <= 7) return mn.clone();
903
903
  if (t <= 20) {
904
904
  const n = (t - 7) / 13;
905
- return sn.clone().lerp(ln, n);
905
+ return mn.clone().lerp(xn, n);
906
906
  }
907
907
  const r = Math.min((t - 20) / 20, 1);
908
- return ln.clone().lerp(_o, r);
909
- }, Ro = (t, r) => {
908
+ return xn.clone().lerp(To, r);
909
+ }, $o = (t, r) => {
910
910
  const n = t.length, o = new Float32Array(n * 2 * 3), s = new Float32Array(n * 2 * 3), a = [];
911
911
  for (let e = 0; e < n; e++) {
912
- const m = t[e], d = r[e], f = m.distanceTo(d), u = Do(f);
912
+ const m = t[e], d = r[e], f = m.distanceTo(d), u = Oo(f);
913
913
  if (o[e * 6] = m.x, o[e * 6 + 1] = m.y, o[e * 6 + 2] = m.z, s[e * 6] = u.r, s[e * 6 + 1] = u.g, s[e * 6 + 2] = u.b, o[e * 6 + 3] = d.x, o[e * 6 + 4] = d.y, o[e * 6 + 5] = d.z, s[e * 6 + 3] = u.r, s[e * 6 + 4] = u.g, s[e * 6 + 5] = u.b, e < n - 1) {
914
914
  const x = e * 2, S = x + 1, p = (e + 1) * 2, g = p + 1;
915
915
  a.push(x, S, p, S, g, p);
@@ -926,8 +926,8 @@ let __tla = (async () => {
926
926
  depthWrite: false
927
927
  });
928
928
  return new O.Mesh(c, l);
929
- }, Wo = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: a, displayUnit: c = "mm", useInnerSurface: l = false, formValue: e, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
930
- const u = j(() => d && f != null ? null : $e(t, r, n, l), [
929
+ }, Ho = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: a, displayUnit: c = "mm", useInnerSurface: l = false, formValue: e, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
930
+ const u = j(() => d && f != null ? null : He(t, r, n, l), [
931
931
  t,
932
932
  r,
933
933
  n,
@@ -936,13 +936,13 @@ let __tla = (async () => {
936
936
  f
937
937
  ]), x = d ?? (u == null ? void 0 : u.linePoints) ?? [], S = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = j(() => {
938
938
  if (e == null || e === 0 || S <= 0 || x.length < 2) return null;
939
- const P = e / S, v = x.reduce((w, M) => w + M.x, 0) / x.length, k = x.reduce((w, M) => w + M.z, 0) / x.length;
940
- return x.map((w) => new z(v + (w.x - v) * P, w.y, k + (w.z - k) * P));
939
+ const L = e / S, v = x.reduce((w, M) => w + M.x, 0) / x.length, k = x.reduce((w, M) => w + M.z, 0) / x.length;
940
+ return x.map((w) => new z(v + (w.x - v) * L, w.y, k + (w.z - k) * L));
941
941
  }, [
942
942
  x,
943
943
  S,
944
944
  e
945
- ]), g = j(() => !p || x.length < 2 ? null : Ro(x, p), [
945
+ ]), g = j(() => !p || x.length < 2 ? null : $o(x, p), [
946
946
  x,
947
947
  p
948
948
  ]);
@@ -951,16 +951,16 @@ let __tla = (async () => {
951
951
  }, [
952
952
  g
953
953
  ]);
954
- const b = se(null), A = j(() => {
955
- const P = new O.BufferGeometry();
956
- P.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
954
+ const b = le(null), A = j(() => {
955
+ const L = new O.BufferGeometry();
956
+ L.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
957
957
  const v = 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(P, v);
963
+ return new O.Line(L, v);
964
964
  }, []);
965
965
  return q(() => () => {
966
966
  A.geometry.dispose(), A.material.dispose();
@@ -976,10 +976,10 @@ let __tla = (async () => {
976
976
  S,
977
977
  n,
978
978
  a
979
- ]), cn(({ camera: P }) => {
979
+ ]), yn(({ camera: L }) => {
980
980
  if (!b.current || x.length < 2) return;
981
981
  const v = new z();
982
- P.getWorldDirection(v);
982
+ L.getWorldDirection(v);
983
983
  const k = new z(v.x, 0, v.z);
984
984
  if (k.lengthSq() < 1e-8) return;
985
985
  k.normalize();
@@ -989,14 +989,14 @@ let __tla = (async () => {
989
989
  const E = w.x * D.x + w.z * D.z;
990
990
  E > M && (M = E, h = D);
991
991
  }
992
- const C = s * 0.35, L = new z(h.x + w.x * C, n, h.z + w.z * C);
993
- b.current.position.copy(L);
992
+ const C = s * 0.35, P = new z(h.x + w.x * C, n, h.z + w.z * C);
993
+ b.current.position.copy(P);
994
994
  const I = A.geometry.getAttribute("position");
995
- I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1, L.x, L.y, L.z), I.needsUpdate = true;
995
+ I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1, P.x, P.y, P.z), I.needsUpdate = true;
996
996
  }), x.length < 2 ? null : F("group", {
997
997
  renderOrder: 10,
998
998
  children: [
999
- i(ce, {
999
+ i(de, {
1000
1000
  points: x,
1001
1001
  color: o,
1002
1002
  lineWidth: m,
@@ -1009,9 +1009,9 @@ let __tla = (async () => {
1009
1009
  object: g,
1010
1010
  renderOrder: 10
1011
1011
  }),
1012
- p && e != null && e !== 0 && i(ce, {
1012
+ p && e != null && e !== 0 && i(de, {
1013
1013
  points: p,
1014
- color: rn(S, e),
1014
+ color: gn(S, e),
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: b,
1031
- children: i(He, {
1031
+ children: i(je, {
1032
1032
  zIndexRange: [
1033
1033
  100,
1034
1034
  0
@@ -1078,7 +1078,7 @@ let __tla = (async () => {
1078
1078
  ]
1079
1079
  }),
1080
1080
  e != null && e !== 0 && S > 0 && (() => {
1081
- const P = S - e, v = P > 0.5 ? "\u25B2" : P < -0.5 ? "\u25BC" : "", k = rn(S, e);
1081
+ const L = S - e, v = L > 0.5 ? "\u25B2" : L < -0.5 ? "\u25BC" : "", k = gn(S, e);
1082
1082
  return F("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
@@ -1106,8 +1106,8 @@ let __tla = (async () => {
1106
1106
  fontWeight: 600
1107
1107
  },
1108
1108
  children: [
1109
- P > 0 ? "+" : "",
1110
- c === "inch" ? (P / 25.4).toFixed(2) : P.toFixed(1)
1109
+ L > 0 ? "+" : "",
1110
+ c === "inch" ? (L / 25.4).toFixed(2) : L.toFixed(1)
1111
1111
  ]
1112
1112
  }),
1113
1113
  F("span", {
@@ -1130,8 +1130,8 @@ let __tla = (async () => {
1130
1130
  })
1131
1131
  ]
1132
1132
  });
1133
- }, Bo = io(Wo), Eo = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: a, reverseOrder: c = false, displayUnit: l = "mm", useInnerSurface: e = false, formMeasurements: m, originY: d, wasmSlices: f }) => {
1134
- const u = se(/* @__PURE__ */ new Map()), x = t.geometry, S = yn(x), p = j(() => {
1133
+ }, jo = uo(Ho), Vo = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: a, reverseOrder: c = false, displayUnit: l = "mm", useInnerSurface: e = false, formMeasurements: m, originY: d, wasmSlices: f }) => {
1134
+ const u = le(/* @__PURE__ */ new Map()), x = t.geometry, S = Pn(x), p = j(() => {
1135
1135
  if (f) {
1136
1136
  let M = [
1137
1137
  ...f.yValues
@@ -1139,8 +1139,8 @@ let __tla = (async () => {
1139
1139
  if (o > 25.4 + 0.1) {
1140
1140
  const h = f.mptY;
1141
1141
  M = M.filter((C) => {
1142
- const L = Math.abs(C - h);
1143
- return L < 0.5 || Math.abs(Math.round(L / o) * o - L) < 0.5;
1142
+ const P = Math.abs(C - h);
1143
+ return P < 0.5 || Math.abs(Math.round(P / o) * o - P) < 0.5;
1144
1144
  });
1145
1145
  }
1146
1146
  return c ? M.sort((h, C) => C - h) : M.sort((h, C) => h - C), M;
@@ -1159,10 +1159,10 @@ let __tla = (async () => {
1159
1159
  if (!f) return null;
1160
1160
  const k = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: M, yValues: h } = f;
1161
1161
  for (let C = 0; C < M.length - 1; C++) {
1162
- const L = M[C], I = M[C + 1];
1163
- if (I <= L) continue;
1162
+ const P = M[C], I = M[C + 1];
1163
+ if (I <= P) continue;
1164
1164
  const D = [];
1165
- for (let E = L; E < I; E += 3) D.push(new z(w[E], w[E + 1], w[E + 2]));
1165
+ for (let E = P; E < I; E += 3) D.push(new z(w[E], w[E + 1], w[E + 2]));
1166
1166
  D.length >= 3 && k.set(h[C], D);
1167
1167
  }
1168
1168
  return k;
@@ -1195,7 +1195,7 @@ let __tla = (async () => {
1195
1195
  ]);
1196
1196
  const A = [
1197
1197
  "#5B9BD5"
1198
- ], P = s * go, v = J((k) => {
1198
+ ], L = s * So, v = J((k) => {
1199
1199
  if (b) return;
1200
1200
  u.current.set(k.yPosition, k);
1201
1201
  const w = Array.from(u.current.values()).sort((M, h) => c ? h.yPosition - M.yPosition : M.yPosition - h.yPosition);
@@ -1205,13 +1205,13 @@ let __tla = (async () => {
1205
1205
  c,
1206
1206
  b
1207
1207
  ]);
1208
- return S ? i(Be, {
1209
- children: p.map((k, w) => i(Bo, {
1208
+ return S ? i(Ee, {
1209
+ children: p.map((k, w) => i(jo, {
1210
1210
  bvh: S,
1211
1211
  geometry: x,
1212
1212
  yPosition: k,
1213
1213
  color: d != null && Math.abs(k - d) < o * 0.5 ? "#44ff44" : A[w % A.length],
1214
- labelX: P,
1214
+ labelX: L,
1215
1215
  onDataChange: v,
1216
1216
  displayUnit: l,
1217
1217
  useInnerSurface: e,
@@ -1221,15 +1221,15 @@ let __tla = (async () => {
1221
1221
  wasmCircumference: b == null ? void 0 : b.get(k)
1222
1222
  }, k))
1223
1223
  }) : null;
1224
- }, To = (t, r) => {
1224
+ }, No = (t, r) => {
1225
1225
  const n = Math.abs(t - r);
1226
1226
  return n <= 7 ? "#4caf50" : n <= 15 ? "#ff9800" : "#f44336";
1227
- }, Oo = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: a }) => {
1227
+ }, Yo = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: a }) => {
1228
1228
  var _a;
1229
1229
  const c = t.geometry;
1230
1230
  c.computeBoundingBox();
1231
- const l = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - l, m = n * 0.4, d = n * 0.03, f = se(null);
1232
- cn(({ camera: w }) => {
1231
+ const l = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - l, m = n * 0.4, d = n * 0.03, f = le(null);
1232
+ yn(({ camera: w }) => {
1233
1233
  if (!f.current) return;
1234
1234
  const M = new z();
1235
1235
  w.getWorldDirection(M);
@@ -1238,14 +1238,14 @@ let __tla = (async () => {
1238
1238
  h.normalize();
1239
1239
  const C = new z().crossVectors(new z(0, 1, 0), h).normalize();
1240
1240
  f.current.position.set(C.x * m, 0, C.z * m);
1241
- const L = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
- f.current.rotation.y = Math.atan2(L, I);
1241
+ const P = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
+ f.current.rotation.y = Math.atan2(P, I);
1243
1243
  });
1244
- const u = new z(0, r, 0), x = new z(0, l, 0), S = new z(0, (r + l) / 2, 0), p = new z(-d, r, 0), g = new z(d, r, 0), b = new z(-d, l, 0), A = new z(d, l, 0), P = a != null && a > 0, v = P ? e - a : 0, k = P ? To(e, a) : "#fff";
1244
+ const u = new z(0, r, 0), x = new z(0, l, 0), S = new z(0, (r + l) / 2, 0), p = new z(-d, r, 0), g = new z(d, r, 0), b = new z(-d, l, 0), A = new z(d, l, 0), L = a != null && a > 0, v = L ? e - a : 0, k = L ? No(e, a) : "#fff";
1245
1245
  return F("group", {
1246
1246
  ref: f,
1247
1247
  children: [
1248
- i(ce, {
1248
+ i(de, {
1249
1249
  points: [
1250
1250
  u,
1251
1251
  x
@@ -1253,7 +1253,7 @@ let __tla = (async () => {
1253
1253
  color: "#888888",
1254
1254
  lineWidth: 1.5
1255
1255
  }),
1256
- i(ce, {
1256
+ i(de, {
1257
1257
  points: [
1258
1258
  p,
1259
1259
  g
@@ -1261,7 +1261,7 @@ let __tla = (async () => {
1261
1261
  color: "#888888",
1262
1262
  lineWidth: 1.5
1263
1263
  }),
1264
- i(ce, {
1264
+ i(de, {
1265
1265
  points: [
1266
1266
  b,
1267
1267
  A
@@ -1271,7 +1271,7 @@ let __tla = (async () => {
1271
1271
  }),
1272
1272
  i("mesh", {
1273
1273
  position: S,
1274
- children: i(He, {
1274
+ children: i(je, {
1275
1275
  center: true,
1276
1276
  style: {
1277
1277
  pointerEvents: "none"
@@ -1295,7 +1295,7 @@ let __tla = (async () => {
1295
1295
  style: {
1296
1296
  padding: "4px 8px",
1297
1297
  backgroundColor: "rgba(0, 0, 0, 0.75)",
1298
- borderRadius: P ? "4px 4px 0 0" : 4,
1298
+ borderRadius: L ? "4px 4px 0 0" : 4,
1299
1299
  color: "#fff",
1300
1300
  fontSize: 16,
1301
1301
  fontFamily: "monospace",
@@ -1308,7 +1308,7 @@ let __tla = (async () => {
1308
1308
  o === "inch" ? "in" : "mm"
1309
1309
  ]
1310
1310
  }),
1311
- P && F("div", {
1311
+ L && F("div", {
1312
1312
  style: {
1313
1313
  display: "flex",
1314
1314
  alignItems: "center",
@@ -1360,19 +1360,19 @@ let __tla = (async () => {
1360
1360
  })
1361
1361
  ]
1362
1362
  });
1363
- }, $o = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: a, landmarkCount: c = 0, measurementGeometry: l, resetCameraToFrontRef: e }) => {
1364
- const { set: m, size: d, camera: f, invalidate: u } = dn(), x = se(false), S = se(s), p = se(new z()), g = se(null), b = se(c), A = se(r), P = se(n), v = se(l), k = se(0), w = J(() => {
1363
+ }, Xo = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: a, landmarkCount: c = 0, measurementGeometry: l, resetCameraToFrontRef: e }) => {
1364
+ const { set: m, size: d, camera: f, invalidate: u } = wn(), x = le(false), S = le(s), p = le(new z()), g = le(null), b = le(c), A = le(r), L = le(n), v = le(l), k = le(0), w = J(() => {
1365
1365
  if (!o || t <= 0) return null;
1366
1366
  const h = l ?? o.geometry;
1367
1367
  h.computeBoundingBox();
1368
- const C = h.boundingBox, L = new z();
1369
- C.getCenter(L);
1368
+ const C = h.boundingBox, P = new z();
1369
+ C.getCenter(P);
1370
1370
  const I = new z();
1371
1371
  C.getSize(I), p.current.copy(I);
1372
- const D = d.width / d.height, E = Math.max(I.y, I.x / D) * 1.6, V = E * D, G = L.y - I.y * 0.05;
1373
- k.current = G;
1372
+ const D = d.width / d.height, E = Math.max(I.y, I.x / D) * 1.6, V = E * D, X = P.y - I.y * 0.05;
1373
+ k.current = X;
1374
1374
  const Q = new O.OrthographicCamera(-V / 2, V / 2, E / 2, -E / 2, 0.1, t * 10);
1375
- return Q.position.set(0, G, t * 2), Q.lookAt(0, G, 0), Q;
1375
+ return Q.position.set(0, X, t * 2), Q.lookAt(0, X, 0), Q;
1376
1376
  }, [
1377
1377
  o,
1378
1378
  t,
@@ -1395,8 +1395,8 @@ let __tla = (async () => {
1395
1395
  u
1396
1396
  ]);
1397
1397
  const M = J((h) => {
1398
- const C = h.position.clone(), L = C.length(), I = Math.atan2(C.x, C.z), D = Math.acos(C.y / L), V = I + 0.02;
1399
- h.position.set(L * Math.sin(D) * Math.sin(V), L * Math.cos(D), L * Math.sin(D) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
1398
+ const C = h.position.clone(), P = C.length(), I = Math.atan2(C.x, C.z), D = Math.acos(C.y / P), V = I + 0.02;
1399
+ h.position.set(P * Math.sin(D) * Math.sin(V), P * Math.cos(D), P * Math.sin(D) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
1400
1400
  }, [
1401
1401
  u
1402
1402
  ]);
@@ -1423,8 +1423,8 @@ let __tla = (async () => {
1423
1423
  f,
1424
1424
  M
1425
1425
  ]), q(() => {
1426
- const h = A.current !== r, C = P.current !== n, L = !v.current && !!l;
1427
- if (A.current = r, P.current = n, v.current = l, !h && !C && !L || !r || s !== "3D") return;
1426
+ const h = A.current !== r, C = L.current !== n, P = !v.current && !!l;
1427
+ if (A.current = r, L.current = n, v.current = l, !h && !C && !P || !r || s !== "3D") return;
1428
1428
  const I = w();
1429
1429
  I && m({
1430
1430
  camera: I
@@ -1442,23 +1442,23 @@ let __tla = (async () => {
1442
1442
  if (S.current = s, !(!r || !o || t <= 0)) {
1443
1443
  if (s === "2D" && a != null) {
1444
1444
  g.current = f;
1445
- const C = o.geometry, L = C.getAttribute("position"), I = L.array, D = t * 0.15;
1446
- let E = 1 / 0, V = -1 / 0, G = 1 / 0, Q = -1 / 0, xe = false;
1447
- for (let pe = 0; pe < L.count; pe++) if (Math.abs(I[pe * 3 + 1] - a) < D) {
1448
- const H = I[pe * 3], ne = I[pe * 3 + 2];
1449
- H < E && (E = H), H > V && (V = H), ne < G && (G = ne), ne > Q && (Q = ne), xe = true;
1445
+ const C = o.geometry, P = C.getAttribute("position"), I = P.array, D = t * 0.15;
1446
+ let E = 1 / 0, V = -1 / 0, X = 1 / 0, Q = -1 / 0, be = false;
1447
+ for (let he = 0; he < P.count; he++) if (Math.abs(I[he * 3 + 1] - a) < D) {
1448
+ const H = I[he * 3], ne = I[he * 3 + 2];
1449
+ H < E && (E = H), H > V && (V = H), ne < X && (X = ne), ne > Q && (Q = ne), be = true;
1450
1450
  }
1451
- if (!xe) {
1451
+ if (!be) {
1452
1452
  C.computeBoundingBox();
1453
- const pe = C.boundingBox;
1454
- E = pe.min.x, V = pe.max.x, G = pe.min.z, Q = pe.max.z;
1453
+ const he = C.boundingBox;
1454
+ E = he.min.x, V = he.max.x, X = he.min.z, Q = he.max.z;
1455
1455
  }
1456
- const le = (E + V) / 2, de = (G + Q) / 2, re = d.width / d.height, ee = 1.4, X = (V - E) * ee, fe = (Q - G) * ee;
1457
- let Z, ue;
1458
- X / fe > re ? (Z = X, ue = X / re) : (ue = fe, Z = fe * re);
1459
- const ge = new O.OrthographicCamera(-Z / 2, Z / 2, ue / 2, -ue / 2, 0.1, t * 10);
1460
- ge.position.set(le, a + t * 2, de), ge.up.set(0, 0, -1), ge.lookAt(le, a, de), m({
1461
- camera: ge
1456
+ const ae = (E + V) / 2, fe = (X + Q) / 2, re = d.width / d.height, ee = 1.4, G = (V - E) * ee, ue = (Q - X) * ee;
1457
+ let Z, pe;
1458
+ G / ue > re ? (Z = G, pe = G / re) : (pe = ue, Z = ue * re);
1459
+ const me = new O.OrthographicCamera(-Z / 2, Z / 2, pe / 2, -pe / 2, 0.1, t * 10);
1460
+ me.position.set(ae, a + t * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, a, fe), m({
1461
+ camera: me
1462
1462
  });
1463
1463
  } else if (h === "2D") if (g.current) m({
1464
1464
  camera: g.current
@@ -1485,22 +1485,22 @@ let __tla = (async () => {
1485
1485
  const h = f;
1486
1486
  if (s === "2D") {
1487
1487
  if (!o || a == null) return;
1488
- const C = o.geometry, L = C.getAttribute("position"), I = L.array, D = t * 0.15;
1489
- let E = 1 / 0, V = -1 / 0, G = 1 / 0, Q = -1 / 0, xe = false;
1490
- for (let Z = 0; Z < L.count; Z++) if (Math.abs(I[Z * 3 + 1] - a) < D) {
1491
- const ue = I[Z * 3], ge = I[Z * 3 + 2];
1492
- ue < E && (E = ue), ue > V && (V = ue), ge < G && (G = ge), ge > Q && (Q = ge), xe = true;
1488
+ const C = o.geometry, P = C.getAttribute("position"), I = P.array, D = t * 0.15;
1489
+ let E = 1 / 0, V = -1 / 0, X = 1 / 0, Q = -1 / 0, be = false;
1490
+ for (let Z = 0; Z < P.count; Z++) if (Math.abs(I[Z * 3 + 1] - a) < D) {
1491
+ const pe = I[Z * 3], me = I[Z * 3 + 2];
1492
+ pe < E && (E = pe), pe > V && (V = pe), me < X && (X = me), me > Q && (Q = me), be = true;
1493
1493
  }
1494
- if (!xe) {
1494
+ if (!be) {
1495
1495
  C.computeBoundingBox();
1496
1496
  const Z = C.boundingBox;
1497
- E = Z.min.x, V = Z.max.x, G = Z.min.z, Q = Z.max.z;
1497
+ E = Z.min.x, V = Z.max.x, X = Z.min.z, Q = Z.max.z;
1498
1498
  }
1499
- const le = d.width / d.height, de = 1.4, re = (V - E) * de, ee = (Q - G) * de;
1500
- let X, fe;
1501
- re / ee > le ? (X = re, fe = re / le) : (fe = ee, X = ee * le), h.left = -X / 2, h.right = X / 2, h.top = fe / 2, h.bottom = -fe / 2;
1499
+ const ae = d.width / d.height, fe = 1.4, re = (V - E) * fe, ee = (Q - X) * fe;
1500
+ let G, ue;
1501
+ re / ee > ae ? (G = re, ue = re / ae) : (ue = ee, G = ee * ae), h.left = -G / 2, h.right = G / 2, h.top = ue / 2, h.bottom = -ue / 2;
1502
1502
  } else {
1503
- const C = p.current, L = d.width / d.height, I = Math.max(C.y, C.x / L) * 1.6, D = I * L;
1503
+ const C = p.current, P = d.width / d.height, I = Math.max(C.y, C.x / P) * 1.6, D = I * P;
1504
1504
  h.left = -D / 2, h.right = D / 2, h.top = I / 2, h.bottom = -I / 2;
1505
1505
  }
1506
1506
  h.updateProjectionMatrix();
@@ -1512,12 +1512,12 @@ let __tla = (async () => {
1512
1512
  s,
1513
1513
  o
1514
1514
  ]), null;
1515
- }, Ho = ({ mesh: t, isDragging: r }) => {
1515
+ }, Go = ({ mesh: t, isDragging: r }) => {
1516
1516
  var _a;
1517
1517
  const n = t.geometry;
1518
1518
  n.computeBoundingBox();
1519
1519
  const o = new z();
1520
- return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(fn, {
1520
+ return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(Sn, {
1521
1521
  enableDamping: false,
1522
1522
  enablePan: false,
1523
1523
  minPolarAngle: Math.PI * 0.15,
@@ -1531,7 +1531,7 @@ let __tla = (async () => {
1531
1531
  o.z
1532
1532
  ]
1533
1533
  });
1534
- }, jo = ({ wasAutoScaled: t, onDismiss: r }) => F("div", {
1534
+ }, Zo = ({ wasAutoScaled: t, onDismiss: r }) => F("div", {
1535
1535
  style: {
1536
1536
  position: "absolute",
1537
1537
  bottom: 16,
@@ -1572,7 +1572,7 @@ let __tla = (async () => {
1572
1572
  children: "X"
1573
1573
  })
1574
1574
  ]
1575
- }), Vo = ({ isDoubleShell: t, onDismiss: r }) => F("div", {
1575
+ }), Ko = ({ isDoubleShell: t, onDismiss: r }) => F("div", {
1576
1576
  style: {
1577
1577
  position: "absolute",
1578
1578
  bottom: 68,
@@ -1613,7 +1613,7 @@ let __tla = (async () => {
1613
1613
  children: "X"
1614
1614
  })
1615
1615
  ]
1616
- }), No = ({ steps: t, currentStep: r, accentColor: n = "rgb(12, 67, 173)" }) => i("div", {
1616
+ }), qo = ({ steps: t, currentStep: r, accentColor: n = "rgb(12, 67, 173)" }) => i("div", {
1617
1617
  style: {
1618
1618
  backgroundColor: "#fff",
1619
1619
  borderBottom: "1px solid #e0e0e0",
@@ -1677,19 +1677,19 @@ let __tla = (async () => {
1677
1677
  ]
1678
1678
  }, o.number);
1679
1679
  })
1680
- }), Yo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
1681
- const c = t.geometry, l = j(() => new pt(c, {
1682
- maxLeafTris: ht
1680
+ }), Uo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
1681
+ const c = t.geometry, l = j(() => new bt(c, {
1682
+ maxLeafTris: yt
1683
1683
  }), [
1684
1684
  c
1685
- ]), e = j(() => $e(l, c, n), [
1685
+ ]), e = j(() => He(l, c, n), [
1686
1686
  l,
1687
1687
  c,
1688
1688
  n
1689
- ]), m = j(() => new ut(new z(0, -1, 0), r), [
1689
+ ]), m = j(() => new xt(new z(0, -1, 0), r), [
1690
1690
  r
1691
1691
  ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = j(() => {
1692
- let g = null, b = null, A = 0, P = 0;
1692
+ let g = null, b = null, A = 0, L = 0;
1693
1693
  if (e.linePoints.length >= 2) {
1694
1694
  let v = e.linePoints[0], k = e.linePoints[0], w = e.linePoints[0], M = e.linePoints[0];
1695
1695
  for (const h of e.linePoints) h.x < v.x && (v = h), h.x > k.x && (k = h), h.z < w.z && (w = h), h.z > M.z && (M = h);
@@ -1699,19 +1699,19 @@ let __tla = (async () => {
1699
1699
  ], b = [
1700
1700
  new z(w.x, n, w.z),
1701
1701
  new z(M.x, n, M.z)
1702
- ], A = g[0].distanceTo(g[1]), P = b[0].distanceTo(b[1]);
1702
+ ], A = g[0].distanceTo(g[1]), L = b[0].distanceTo(b[1]);
1703
1703
  }
1704
1704
  return {
1705
1705
  mlLine: g,
1706
1706
  apLine: b,
1707
1707
  mlWidth: A,
1708
- apWidth: P
1708
+ apWidth: L
1709
1709
  };
1710
1710
  }, [
1711
1711
  e,
1712
1712
  n
1713
1713
  ]), S = (g) => a === "inch" ? (g / 25.4).toFixed(2) : g.toFixed(1), p = a === "inch" ? "in" : "mm";
1714
- return F(Be, {
1714
+ return F(Ee, {
1715
1715
  children: [
1716
1716
  i("mesh", {
1717
1717
  geometry: t.geometry,
@@ -1726,7 +1726,7 @@ let __tla = (async () => {
1726
1726
  ]
1727
1727
  })
1728
1728
  }),
1729
- e.linePoints.length >= 2 && i(ce, {
1729
+ e.linePoints.length >= 2 && i(de, {
1730
1730
  points: e.linePoints,
1731
1731
  color: "#00ff00",
1732
1732
  lineWidth: 3,
@@ -1734,9 +1734,9 @@ let __tla = (async () => {
1734
1734
  depthWrite: false,
1735
1735
  transparent: true
1736
1736
  }),
1737
- d && F(Be, {
1737
+ d && F(Ee, {
1738
1738
  children: [
1739
- i(ce, {
1739
+ i(de, {
1740
1740
  points: d,
1741
1741
  color: "#ff8800",
1742
1742
  lineWidth: 2,
@@ -1744,7 +1744,7 @@ let __tla = (async () => {
1744
1744
  depthWrite: false,
1745
1745
  transparent: true
1746
1746
  }),
1747
- i(He, {
1747
+ i(je, {
1748
1748
  position: [
1749
1749
  d[0].x,
1750
1750
  n,
@@ -1778,9 +1778,9 @@ let __tla = (async () => {
1778
1778
  })
1779
1779
  ]
1780
1780
  }),
1781
- f && F(Be, {
1781
+ f && F(Ee, {
1782
1782
  children: [
1783
- i(ce, {
1783
+ i(de, {
1784
1784
  points: f,
1785
1785
  color: "#ff00ff",
1786
1786
  lineWidth: 2,
@@ -1788,7 +1788,7 @@ let __tla = (async () => {
1788
1788
  depthWrite: false,
1789
1789
  transparent: true
1790
1790
  }),
1791
- i(He, {
1791
+ i(je, {
1792
1792
  position: [
1793
1793
  Math.max(f[0].x, f[1].x) + o * 0.02,
1794
1794
  n,
@@ -1824,20 +1824,20 @@ let __tla = (async () => {
1824
1824
  })
1825
1825
  ]
1826
1826
  });
1827
- }, Go = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: a, color: c, hoverColor: l, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
1828
- const [u, x] = W(false), [S, p] = W(false), { camera: g, gl: b } = dn(), A = se(0), P = t.geometry, v = yn(P), k = j(() => v ? $e(v, P, r) : {
1827
+ }, Jo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: a, color: c, hoverColor: l, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
1828
+ const [u, x] = W(false), [S, p] = W(false), { camera: g, gl: b } = wn(), A = le(0), L = t.geometry, v = Pn(L), k = j(() => v ? He(v, L, r) : {
1829
1829
  linePoints: [],
1830
1830
  lineLength: 0,
1831
1831
  rightmostPoint: new z()
1832
1832
  }, [
1833
1833
  v,
1834
- P,
1834
+ L,
1835
1835
  r
1836
1836
  ]), w = J((I, D) => {
1837
- const E = b.domElement.getBoundingClientRect(), V = (I - E.left) / E.width * 2 - 1, G = -((D - E.top) / E.height) * 2 + 1, Q = new ao();
1838
- Q.setFromCamera(new O.Vector2(V, G), g);
1839
- const xe = new ut(new z(0, 0, 1), 0), le = new z();
1840
- return Q.ray.intersectPlane(xe, le), le ? le.y : r;
1837
+ const E = b.domElement.getBoundingClientRect(), V = (I - E.left) / E.width * 2 - 1, X = -((D - E.top) / E.height) * 2 + 1, Q = new go();
1838
+ Q.setFromCamera(new O.Vector2(V, X), g);
1839
+ const be = new xt(new z(0, 0, 1), 0), ae = new z();
1840
+ return Q.ray.intersectPlane(be, ae), ae ? ae.y : r;
1841
1841
  }, [
1842
1842
  g,
1843
1843
  b,
@@ -1866,13 +1866,13 @@ let __tla = (async () => {
1866
1866
  f
1867
1867
  ]);
1868
1868
  if (k.linePoints.length < 2) return null;
1869
- const L = u ? e : S ? l : c;
1869
+ const P = u ? e : S ? l : c;
1870
1870
  return F("group", {
1871
1871
  renderOrder: 10,
1872
1872
  children: [
1873
- i(ce, {
1873
+ i(de, {
1874
1874
  points: k.linePoints,
1875
- color: L,
1875
+ color: P,
1876
1876
  lineWidth: u ? 6 : S ? 5 : 4,
1877
1877
  depthTest: false,
1878
1878
  depthWrite: false,
@@ -1894,14 +1894,14 @@ let __tla = (async () => {
1894
1894
  r,
1895
1895
  0
1896
1896
  ],
1897
- children: i(He, {
1897
+ children: i(je, {
1898
1898
  center: true,
1899
1899
  children: i("div", {
1900
1900
  style: {
1901
1901
  padding: "4px 8px",
1902
1902
  backgroundColor: "rgba(0, 0, 0, 0.8)",
1903
1903
  borderRadius: 4,
1904
- color: L,
1904
+ color: P,
1905
1905
  fontSize: 11,
1906
1906
  whiteSpace: "nowrap",
1907
1907
  pointerEvents: "none"
@@ -1913,17 +1913,17 @@ let __tla = (async () => {
1913
1913
  ]
1914
1914
  });
1915
1915
  };
1916
- function Xo(t, r) {
1916
+ function Qo(t, r) {
1917
1917
  if (t == null) return {};
1918
1918
  var n = {}, o = Object.keys(t), s, a;
1919
1919
  for (a = 0; a < o.length; a++) s = o[a], !(r.indexOf(s) >= 0) && (n[s] = t[s]);
1920
1920
  return n;
1921
1921
  }
1922
- var Zo = [
1922
+ var er = [
1923
1923
  "color"
1924
- ], Ko = so(function(t, r) {
1925
- var n = t.color, o = n === void 0 ? "currentColor" : n, s = Xo(t, Zo);
1926
- return en("svg", Object.assign({
1924
+ ], tr = po(function(t, r) {
1925
+ var n = t.color, o = n === void 0 ? "currentColor" : n, s = Qo(t, er);
1926
+ return fn("svg", Object.assign({
1927
1927
  width: "15",
1928
1928
  height: "15",
1929
1929
  viewBox: "0 0 15 15",
@@ -1931,20 +1931,20 @@ let __tla = (async () => {
1931
1931
  xmlns: "http://www.w3.org/2000/svg"
1932
1932
  }, s, {
1933
1933
  ref: r
1934
- }), en("path", {
1934
+ }), fn("path", {
1935
1935
  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",
1936
1936
  fill: o,
1937
1937
  fillRule: "evenodd",
1938
1938
  clipRule: "evenodd"
1939
1939
  }));
1940
1940
  });
1941
- const qo = [
1941
+ const nr = [
1942
1942
  "Scan doesn't load properly",
1943
1943
  "Takes too long",
1944
1944
  "I don't want to",
1945
1945
  "I want a second opinion",
1946
1946
  "I measured from IT"
1947
- ], at = {
1947
+ ], pt = {
1948
1948
  padding: "8px 20px",
1949
1949
  borderRadius: 4,
1950
1950
  fontSize: 14,
@@ -1953,7 +1953,7 @@ let __tla = (async () => {
1953
1953
  fontFamily: "system-ui, sans-serif",
1954
1954
  letterSpacing: "0.4px",
1955
1955
  lineHeight: "36px"
1956
- }, Uo = {
1956
+ }, or = {
1957
1957
  width: "100%",
1958
1958
  padding: "10px 12px",
1959
1959
  fontSize: 15,
@@ -1962,7 +1962,7 @@ let __tla = (async () => {
1962
1962
  outline: "none",
1963
1963
  boxSizing: "border-box",
1964
1964
  fontFamily: "system-ui, sans-serif"
1965
- }, wn = ({ onSkip: t, onCancel: r }) => {
1965
+ }, Ln = ({ onSkip: t, onCancel: r }) => {
1966
1966
  const [n, o] = W("confirm"), [s, a] = W(null), [c, l] = W(""), e = J(() => {
1967
1967
  o("reasons");
1968
1968
  }, []), m = J(() => {
@@ -2031,7 +2031,7 @@ let __tla = (async () => {
2031
2031
  },
2032
2032
  children: [
2033
2033
  [
2034
- ...qo,
2034
+ ...nr,
2035
2035
  "Other"
2036
2036
  ].map((u) => F("label", {
2037
2037
  style: {
@@ -2078,7 +2078,7 @@ let __tla = (async () => {
2078
2078
  u.key === "Enter" && f();
2079
2079
  },
2080
2080
  style: {
2081
- ...Uo,
2081
+ ...or,
2082
2082
  marginTop: 8,
2083
2083
  marginLeft: 40,
2084
2084
  width: "calc(100% - 40px)",
@@ -2099,7 +2099,7 @@ let __tla = (async () => {
2099
2099
  i("button", {
2100
2100
  onClick: m,
2101
2101
  style: {
2102
- ...at,
2102
+ ...pt,
2103
2103
  backgroundColor: "#fff",
2104
2104
  border: "1px solid #ddd",
2105
2105
  color: "#666"
@@ -2110,7 +2110,7 @@ let __tla = (async () => {
2110
2110
  onClick: f,
2111
2111
  disabled: !d,
2112
2112
  style: {
2113
- ...at,
2113
+ ...pt,
2114
2114
  backgroundColor: d ? "rgb(12, 67, 173)" : "#e0e0e0",
2115
2115
  border: "none",
2116
2116
  color: d ? "#fff" : "#9e9e9e",
@@ -2171,7 +2171,7 @@ let __tla = (async () => {
2171
2171
  i("button", {
2172
2172
  onClick: r,
2173
2173
  style: {
2174
- ...at,
2174
+ ...pt,
2175
2175
  backgroundColor: "#fff",
2176
2176
  border: "1px solid #bdbdbd",
2177
2177
  color: "#333"
@@ -2181,7 +2181,7 @@ let __tla = (async () => {
2181
2181
  i("button", {
2182
2182
  onClick: e,
2183
2183
  style: {
2184
- ...at,
2184
+ ...pt,
2185
2185
  backgroundColor: "rgb(12, 67, 173)",
2186
2186
  border: "none",
2187
2187
  color: "#fff"
@@ -2193,7 +2193,7 @@ let __tla = (async () => {
2193
2193
  ]
2194
2194
  })
2195
2195
  });
2196
- }, Dt = {
2196
+ }, Tt = {
2197
2197
  padding: "8px 20px",
2198
2198
  borderRadius: 4,
2199
2199
  fontSize: 14,
@@ -2202,7 +2202,7 @@ let __tla = (async () => {
2202
2202
  fontFamily: "system-ui, sans-serif",
2203
2203
  letterSpacing: "0.4px",
2204
2204
  lineHeight: "36px"
2205
- }, an = {
2205
+ }, bn = {
2206
2206
  width: "100%",
2207
2207
  padding: "10px 12px",
2208
2208
  fontSize: 15,
@@ -2211,7 +2211,7 @@ let __tla = (async () => {
2211
2211
  outline: "none",
2212
2212
  boxSizing: "border-box",
2213
2213
  fontFamily: "system-ui, sans-serif"
2214
- }, Jo = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2214
+ }, rr = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2215
2215
  const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, x = j(() => {
2216
2216
  const h = [];
2217
2217
  for (let C = 2; C >= 1; C -= f) h.push(`${C}\u2033 above ${d}`);
@@ -2225,10 +2225,10 @@ let __tla = (async () => {
2225
2225
  ]), [S, p] = W(() => {
2226
2226
  if (!e) return {};
2227
2227
  const h = {};
2228
- return x.forEach((C, L) => {
2229
- e[L] != null && e[L] !== 0 && (h[C] = e[L].toFixed(1));
2228
+ return x.forEach((C, P) => {
2229
+ e[P] != null && e[P] !== 0 && (h[C] = e[P].toFixed(1));
2230
2230
  }), h;
2231
- }), [g, b] = W(m && m > 0 ? m.toFixed(1) : ""), [A, P] = W(false), v = j(() => x.map((h) => {
2231
+ }), [g, b] = W(m && m > 0 ? m.toFixed(1) : ""), [A, L] = W(false), v = j(() => x.map((h) => {
2232
2232
  const C = S[h];
2233
2233
  return C != null && C !== "" && !isNaN(parseFloat(C)) ? parseFloat(C) : 0;
2234
2234
  }), [
@@ -2248,7 +2248,7 @@ let __tla = (async () => {
2248
2248
  l
2249
2249
  ]);
2250
2250
  const k = j(() => {
2251
- const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((L) => L !== 0);
2251
+ const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((P) => P !== 0);
2252
2252
  return h || C;
2253
2253
  }, [
2254
2254
  v,
@@ -2267,8 +2267,8 @@ let __tla = (async () => {
2267
2267
  s
2268
2268
  ]), M = J(() => {
2269
2269
  const h = {};
2270
- x.forEach((C, L) => {
2271
- const I = n[L];
2270
+ x.forEach((C, P) => {
2271
+ const I = n[P];
2272
2272
  if (I) {
2273
2273
  const D = I.modifiedValue ?? I.originalValue;
2274
2274
  h[C] = D.toFixed(1);
@@ -2288,9 +2288,9 @@ let __tla = (async () => {
2288
2288
  fontFamily: "system-ui, sans-serif"
2289
2289
  },
2290
2290
  children: [
2291
- A && i(wn, {
2291
+ A && i(Ln, {
2292
2292
  onSkip: a,
2293
- onCancel: () => P(false)
2293
+ onCancel: () => L(false)
2294
2294
  }),
2295
2295
  F("div", {
2296
2296
  style: {
@@ -2327,7 +2327,7 @@ let __tla = (async () => {
2327
2327
  i("button", {
2328
2328
  onClick: M,
2329
2329
  style: {
2330
- ...Dt,
2330
+ ...Tt,
2331
2331
  backgroundColor: "#fff",
2332
2332
  border: "2px solid rgb(12, 67, 173)",
2333
2333
  color: "rgb(12, 67, 173)",
@@ -2345,7 +2345,7 @@ let __tla = (async () => {
2345
2345
  gap: 4
2346
2346
  },
2347
2347
  children: [
2348
- i(Ko, {
2348
+ i(tr, {
2349
2349
  style: {
2350
2350
  width: 14,
2351
2351
  height: 14
@@ -2403,12 +2403,12 @@ let __tla = (async () => {
2403
2403
  type: "number",
2404
2404
  step: "0.1",
2405
2405
  value: S[h] ?? "",
2406
- onChange: (L) => p((I) => ({
2406
+ onChange: (P) => p((I) => ({
2407
2407
  ...I,
2408
- [h]: L.target.value
2408
+ [h]: P.target.value
2409
2409
  })),
2410
2410
  style: {
2411
- ...an,
2411
+ ...bn,
2412
2412
  padding: "6px 8px",
2413
2413
  fontSize: 13,
2414
2414
  borderColor: S[h] ? "rgb(12, 67, 173)" : "#ccc",
@@ -2451,7 +2451,7 @@ let __tla = (async () => {
2451
2451
  value: g,
2452
2452
  onChange: (h) => b(h.target.value),
2453
2453
  style: {
2454
- ...an,
2454
+ ...bn,
2455
2455
  padding: "6px 8px",
2456
2456
  fontSize: 13,
2457
2457
  borderColor: g ? "rgb(12, 67, 173)" : "#ccc",
@@ -2478,7 +2478,7 @@ let __tla = (async () => {
2478
2478
  onClick: w,
2479
2479
  disabled: !k,
2480
2480
  style: {
2481
- ...Dt,
2481
+ ...Tt,
2482
2482
  backgroundColor: k ? "rgb(12, 67, 173)" : "#e0e0e0",
2483
2483
  border: "none",
2484
2484
  color: k ? "#fff" : "#9e9e9e",
@@ -2490,9 +2490,9 @@ let __tla = (async () => {
2490
2490
  children: "Save Measurements"
2491
2491
  }),
2492
2492
  i("button", {
2493
- onClick: () => P(true),
2493
+ onClick: () => L(true),
2494
2494
  style: {
2495
- ...Dt,
2495
+ ...Tt,
2496
2496
  backgroundColor: "#fff",
2497
2497
  border: "1px solid #bdbdbd",
2498
2498
  color: "#666",
@@ -2507,18 +2507,18 @@ let __tla = (async () => {
2507
2507
  ]
2508
2508
  });
2509
2509
  };
2510
- function Sn(t, r, n) {
2510
+ function In(t, r, n) {
2511
2511
  const o = t.getAttribute("position"), s = n - r;
2512
2512
  if (s < 1) return null;
2513
2513
  const a = 30, c = s / a, l = [];
2514
2514
  for (let g = 0; g < a; g++) {
2515
2515
  const b = r + g * c, A = r + (g + 1) * c;
2516
- let P = 0, v = 0, k = 0, w = 0;
2516
+ let L = 0, v = 0, k = 0, w = 0;
2517
2517
  for (let M = 0; M < o.count; M++) {
2518
2518
  const h = o.getY(M);
2519
- h >= b && h < A && (P += o.getX(M), v += h, k += o.getZ(M), w++);
2519
+ h >= b && h < A && (L += o.getX(M), v += h, k += o.getZ(M), w++);
2520
2520
  }
2521
- w > 20 && l.push(new z(P / w, v / w, k / w));
2521
+ w > 20 && l.push(new z(L / w, v / w, k / w));
2522
2522
  }
2523
2523
  if (l.length < 5) return null;
2524
2524
  const e = new z();
@@ -2526,18 +2526,18 @@ let __tla = (async () => {
2526
2526
  e.divideScalar(l.length);
2527
2527
  let m = 0, d = 0, f = 0, u = 0, x = 0, S = 0;
2528
2528
  for (const g of l) {
2529
- const b = g.x - e.x, A = g.y - e.y, P = g.z - e.z;
2530
- m += b * b, d += b * A, f += b * P, u += A * A, x += A * P, S += P * P;
2529
+ const b = g.x - e.x, A = g.y - e.y, L = g.z - e.z;
2530
+ m += b * b, d += b * A, f += b * L, u += A * A, x += A * L, S += L * L;
2531
2531
  }
2532
2532
  let p = new z(0.01, 1, 0.01).normalize();
2533
2533
  for (let g = 0; g < 30; g++) {
2534
- const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, P = f * p.x + x * p.y + S * p.z, v = new z(b, A, P), k = v.length();
2534
+ const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, L = f * p.x + x * p.y + S * p.z, v = new z(b, A, L), k = v.length();
2535
2535
  if (k < 1e-10 || (v.divideScalar(k), p.distanceTo(v) < 1e-8)) break;
2536
2536
  p = v;
2537
2537
  }
2538
2538
  return p.y < 0 && p.negate(), p;
2539
2539
  }
2540
- const Qo = {
2540
+ const ir = {
2541
2541
  pcaAxes: true,
2542
2542
  obb: true,
2543
2543
  obbAxis: true,
@@ -2547,12 +2547,12 @@ let __tla = (async () => {
2547
2547
  landmarkAxis: true,
2548
2548
  iterativePCA: false,
2549
2549
  fullRegionPCA: true
2550
- }, er = [
2550
+ }, sr = [
2551
2551
  "#ff4444",
2552
2552
  "#44cc44",
2553
2553
  "#4488ff"
2554
2554
  ];
2555
- function vn(t) {
2555
+ function _n(t) {
2556
2556
  const r = t.getAttribute("position"), n = r.count, o = new z();
2557
2557
  for (let p = 0; p < n; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
2558
2558
  o.divideScalar(n);
@@ -2582,7 +2582,7 @@ let __tla = (async () => {
2582
2582
  for (let p = 0; p < 3; p++) {
2583
2583
  let g = new z(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), b = 0;
2584
2584
  for (let A = 0; A < 100; A++) {
2585
- const P = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, v = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, k = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new z(P, v, k);
2585
+ const L = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, v = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, k = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new z(L, v, k);
2586
2586
  if (b = w.length(), b < 1e-12) break;
2587
2587
  if (w.divideScalar(b), g.distanceTo(w) < 1e-10) {
2588
2588
  g = w;
@@ -2591,7 +2591,7 @@ let __tla = (async () => {
2591
2591
  g = w;
2592
2592
  }
2593
2593
  d.push(g.clone()), f.push(b);
2594
- for (let A = 0; A < 3; A++) for (let P = 0; P < 3; P++) {
2594
+ for (let A = 0; A < 3; A++) for (let L = 0; L < 3; L++) {
2595
2595
  const v = [
2596
2596
  g.x,
2597
2597
  g.y,
@@ -2600,8 +2600,8 @@ let __tla = (async () => {
2600
2600
  g.x,
2601
2601
  g.y,
2602
2602
  g.z
2603
- ][P];
2604
- u[A][P] -= b * v * k;
2603
+ ][L];
2604
+ u[A][L] -= b * v * k;
2605
2605
  }
2606
2606
  }
2607
2607
  const x = new z();
@@ -2615,8 +2615,8 @@ let __tla = (async () => {
2615
2615
  for (let p = 0; p < 3; p++) {
2616
2616
  let g = 1 / 0, b = -1 / 0;
2617
2617
  const A = d[p];
2618
- for (let P = 0; P < n; P++) {
2619
- const v = r.getX(P) - x.x, k = r.getY(P) - x.y, w = r.getZ(P) - x.z, M = v * A.x + k * A.y + w * A.z;
2618
+ for (let L = 0; L < n; L++) {
2619
+ const v = r.getX(L) - x.x, k = r.getY(L) - x.y, w = r.getZ(L) - x.z, M = v * A.x + k * A.y + w * A.z;
2620
2620
  M < g && (g = M), M > b && (b = M);
2621
2621
  }
2622
2622
  S[p] = (b - g) / 2;
@@ -2628,22 +2628,22 @@ let __tla = (async () => {
2628
2628
  halfExtents: S
2629
2629
  };
2630
2630
  }
2631
- function tr({ pca: t }) {
2631
+ function lr({ pca: t }) {
2632
2632
  return i("group", {
2633
2633
  children: t.axes.map((r, n) => {
2634
2634
  const o = t.center.clone().addScaledVector(r, t.halfExtents[n]), s = t.center.clone().addScaledVector(r, -t.halfExtents[n]);
2635
- return i(ce, {
2635
+ return i(de, {
2636
2636
  points: [
2637
2637
  s,
2638
2638
  o
2639
2639
  ],
2640
- color: er[n],
2640
+ color: sr[n],
2641
2641
  lineWidth: 2
2642
2642
  }, n);
2643
2643
  })
2644
2644
  });
2645
2645
  }
2646
- function nr({ pca: t }) {
2646
+ function ar({ pca: t }) {
2647
2647
  const r = j(() => {
2648
2648
  const { center: n, axes: o, halfExtents: s } = t, a = [];
2649
2649
  for (let l = -1; l <= 1; l += 2) for (let e = -1; e <= 1; e += 2) for (let m = -1; m <= 1; m += 2) a.push(n.clone().addScaledVector(o[0], l * s[0]).addScaledVector(o[1], e * s[1]).addScaledVector(o[2], m * s[2]));
@@ -2704,7 +2704,7 @@ let __tla = (async () => {
2704
2704
  t
2705
2705
  ]);
2706
2706
  return i("group", {
2707
- children: r.map((n, o) => i(ce, {
2707
+ children: r.map((n, o) => i(de, {
2708
2708
  points: n,
2709
2709
  color: "#ffaa00",
2710
2710
  lineWidth: 1,
@@ -2713,7 +2713,7 @@ let __tla = (async () => {
2713
2713
  }, o))
2714
2714
  });
2715
2715
  }
2716
- function or({ redPoint: t, greenPoint: r }) {
2716
+ function cr({ redPoint: t, greenPoint: r }) {
2717
2717
  const n = j(() => new z().subVectors(r, t).normalize(), [
2718
2718
  t,
2719
2719
  r
@@ -2725,7 +2725,7 @@ let __tla = (async () => {
2725
2725
  ]), s = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2726
2726
  return F("group", {
2727
2727
  children: [
2728
- i(ce, {
2728
+ i(de, {
2729
2729
  points: [
2730
2730
  t,
2731
2731
  r
@@ -2766,13 +2766,13 @@ let __tla = (async () => {
2766
2766
  ]
2767
2767
  });
2768
2768
  }
2769
- function rr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2769
+ function dr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2770
2770
  const a = o * 0.15, c = j(() => {
2771
2771
  const l = [];
2772
2772
  let e = n - 10;
2773
2773
  const m = new z(0, 1, 0);
2774
2774
  for (; e > r; ) {
2775
- const d = Math.min(e, n), f = Math.max(e, n), u = Sn(t, d, f);
2775
+ const d = Math.min(e, n), f = Math.max(e, n), u = In(t, d, f);
2776
2776
  if (u) {
2777
2777
  const x = u.dot(m), S = Math.acos(Math.min(1, Math.abs(x))) * 180 / Math.PI;
2778
2778
  l.push({
@@ -2795,7 +2795,7 @@ let __tla = (async () => {
2795
2795
  const m = (l.regionMin + l.regionMax) / 2, d = new z(0, m, 0), f = d.clone().addScaledVector(l.axis, a), u = d.clone().addScaledVector(l.axis, -a), x = e / Math.max(1, c.length - 1), S = l.angleDeg < 0.5 ? `hsl(${120 - x * 120}, 80%, 60%)` : `hsl(${40 - l.angleDeg * 2}, 90%, 55%)`;
2796
2796
  return F("group", {
2797
2797
  children: [
2798
- i(ce, {
2798
+ i(de, {
2799
2799
  points: [
2800
2800
  u,
2801
2801
  f
@@ -2805,7 +2805,7 @@ let __tla = (async () => {
2805
2805
  transparent: true,
2806
2806
  opacity: 0.7
2807
2807
  }),
2808
- i(ce, {
2808
+ i(de, {
2809
2809
  points: [
2810
2810
  new z(-a * 0.3, l.regionMin, 0),
2811
2811
  new z(a * 0.3, l.regionMin, 0)
@@ -2820,9 +2820,9 @@ let __tla = (async () => {
2820
2820
  })
2821
2821
  });
2822
2822
  }
2823
- function ir({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2823
+ function fr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2824
2824
  const s = j(() => {
2825
- const f = Sn(t, r, n);
2825
+ const f = In(t, r, n);
2826
2826
  if (!f) return null;
2827
2827
  const u = f.dot(new z(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2828
2828
  return {
@@ -2837,7 +2837,7 @@ let __tla = (async () => {
2837
2837
  if (!s) return null;
2838
2838
  const a = (r + n) / 2, c = new z(0, a, 0), l = o * 0.4, e = c.clone().addScaledVector(s.axis, l), m = c.clone().addScaledVector(s.axis, -l), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2839
2839
  return i("group", {
2840
- children: i(ce, {
2840
+ children: i(de, {
2841
2841
  points: [
2842
2842
  m,
2843
2843
  e
@@ -2850,9 +2850,9 @@ let __tla = (async () => {
2850
2850
  })
2851
2851
  });
2852
2852
  }
2853
- function sr({ pca: t, modelSize: r }) {
2853
+ function ur({ pca: t, modelSize: r }) {
2854
2854
  const n = t.axes[0], o = r * 0.6, s = t.center.clone().addScaledVector(n, o), a = t.center.clone().addScaledVector(n, -o);
2855
- return i(ce, {
2855
+ return i(de, {
2856
2856
  points: [
2857
2857
  a,
2858
2858
  s
@@ -2864,18 +2864,18 @@ let __tla = (async () => {
2864
2864
  gapSize: 2
2865
2865
  });
2866
2866
  }
2867
- function lr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2867
+ function pr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2868
2868
  const a = j(() => {
2869
- const d = s ?? t, f = Wt(d), u = new z(0, 1, 0), x = 5, p = n + 3 * 25.4, g = [];
2869
+ const d = s ?? t, f = $t(d), u = new z(0, 1, 0), x = 5, p = n + 3 * 25.4, g = [];
2870
2870
  for (let h = r + x; h < p; h += x) {
2871
- const C = Co(f, d, new z(0, h, 0), u);
2871
+ const C = Po(f, d, new z(0, h, 0), u);
2872
2872
  C > 0 && g.push({
2873
2873
  y: h,
2874
2874
  circ: C
2875
2875
  });
2876
2876
  }
2877
2877
  if (g.length < 5) return null;
2878
- const b = n - r, A = r + b * 0.3, P = r + b * 0.7, v = g.filter((h) => h.y >= A && h.y <= P);
2878
+ const b = n - r, A = r + b * 0.3, L = r + b * 0.7, v = g.filter((h) => h.y >= A && h.y <= L);
2879
2879
  if (v.length < 3) return null;
2880
2880
  const k = v.map((h) => h.circ).sort((h, C) => h - C), w = k[Math.floor(k.length / 2)], M = Math.max(...g.map((h) => h.circ));
2881
2881
  return {
@@ -2894,7 +2894,7 @@ let __tla = (async () => {
2894
2894
  children: [
2895
2895
  c.map(({ y: d, circ: f }, u) => {
2896
2896
  const x = f / l, S = x > 1.6 ? "#ff4444" : x > 1.3 ? "#ffcc00" : "#22cc66", p = f * m;
2897
- return i(ce, {
2897
+ return i(de, {
2898
2898
  points: [
2899
2899
  new z(-p, d, 0),
2900
2900
  new z(p, d, 0)
@@ -2907,9 +2907,9 @@ let __tla = (async () => {
2907
2907
  }),
2908
2908
  (() => {
2909
2909
  const d = l * 1.6 * m, f = c[0].y, u = c[c.length - 1].y;
2910
- return F(Be, {
2910
+ return F(Ee, {
2911
2911
  children: [
2912
- i(ce, {
2912
+ i(de, {
2913
2913
  points: [
2914
2914
  new z(-d, f, 0),
2915
2915
  new z(-d, u, 0)
@@ -2922,7 +2922,7 @@ let __tla = (async () => {
2922
2922
  transparent: true,
2923
2923
  opacity: 0.4
2924
2924
  }),
2925
- i(ce, {
2925
+ i(de, {
2926
2926
  points: [
2927
2927
  new z(d, f, 0),
2928
2928
  new z(d, u, 0)
@@ -2941,7 +2941,7 @@ let __tla = (async () => {
2941
2941
  ]
2942
2942
  });
2943
2943
  }
2944
- function ar({ componentDebug: t }) {
2944
+ function hr({ componentDebug: t }) {
2945
2945
  return i("group", {
2946
2946
  children: t.geometries.map((r, n) => {
2947
2947
  const o = t.colors[n] ?? "#888888", s = n === t.innerIdx;
@@ -2975,7 +2975,7 @@ let __tla = (async () => {
2975
2975
  }),
2976
2976
  i("group", {
2977
2977
  position: a,
2978
- children: i(He, {
2978
+ children: i(je, {
2979
2979
  center: true,
2980
2980
  style: {
2981
2981
  pointerEvents: "none"
@@ -3005,7 +3005,7 @@ let __tla = (async () => {
3005
3005
  })
3006
3006
  });
3007
3007
  }
3008
- function cr({ geometry: t, aoData: r }) {
3008
+ function gr({ geometry: t, aoData: r }) {
3009
3009
  const n = j(() => {
3010
3010
  const o = t.toNonIndexed(), s = o.getAttribute("position"), a = r.length, c = s.count, l = new Float32Array(c * 3);
3011
3011
  for (let e = 0; e < a && e * 3 + 2 < c; e++) {
@@ -3034,8 +3034,8 @@ let __tla = (async () => {
3034
3034
  })
3035
3035
  });
3036
3036
  }
3037
- function dr({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
3038
- const l = t.geometry, e = j(() => l.getAttribute("position") ? vn(l) : null, [
3037
+ function mr({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
3038
+ const l = t.geometry, e = j(() => l.getAttribute("position") ? _n(l) : null, [
3039
3039
  l
3040
3040
  ]), m = j(() => !n || n.length < 2 ? null : {
3041
3041
  red: new z(n[1].position.x, n[1].position.y, n[1].position.z),
@@ -3045,24 +3045,24 @@ let __tla = (async () => {
3045
3045
  ]);
3046
3046
  return F("group", {
3047
3047
  children: [
3048
- r.pcaAxes && e && i(tr, {
3048
+ r.pcaAxes && e && i(lr, {
3049
3049
  pca: e
3050
3050
  }),
3051
- r.obb && e && i(nr, {
3051
+ r.obb && e && i(ar, {
3052
3052
  pca: e
3053
3053
  }),
3054
- r.obbAxis && e && i(sr, {
3054
+ r.obbAxis && e && i(ur, {
3055
3055
  pca: e,
3056
3056
  modelSize: e.halfExtents[0] ? Math.max(...e.halfExtents) * 2 : 100
3057
3057
  }),
3058
- r.shellComponents && o && i(ar, {
3058
+ r.shellComponents && o && i(hr, {
3059
3059
  componentDebug: o
3060
3060
  }),
3061
- r.ambientOcclusion && s && s.length > 0 && i(cr, {
3061
+ r.ambientOcclusion && s && s.length > 0 && i(gr, {
3062
3062
  geometry: a ?? l,
3063
3063
  aoData: s
3064
3064
  }),
3065
- r.circumferenceScan && m && i(lr, {
3065
+ r.circumferenceScan && m && i(pr, {
3066
3066
  geometry: l,
3067
3067
  redY: m.red.y,
3068
3068
  greenY: m.green.y,
@@ -3080,17 +3080,17 @@ let __tla = (async () => {
3080
3080
  depthWrite: false
3081
3081
  })
3082
3082
  }),
3083
- r.landmarkAxis && m && i(or, {
3083
+ r.landmarkAxis && m && i(cr, {
3084
3084
  redPoint: m.red,
3085
3085
  greenPoint: m.green
3086
3086
  }),
3087
- r.iterativePCA && m && i(rr, {
3087
+ r.iterativePCA && m && i(dr, {
3088
3088
  geometry: l,
3089
3089
  redY: m.red.y,
3090
3090
  greenY: m.green.y,
3091
3091
  modelSize: (e == null ? void 0 : e.halfExtents[0]) ? Math.max(...e.halfExtents) * 2 : 100
3092
3092
  }),
3093
- r.fullRegionPCA && m && i(ir, {
3093
+ r.fullRegionPCA && m && i(fr, {
3094
3094
  geometry: l,
3095
3095
  redY: m.red.y,
3096
3096
  greenY: m.green.y,
@@ -3099,10 +3099,10 @@ let __tla = (async () => {
3099
3099
  ]
3100
3100
  });
3101
3101
  }
3102
- function fr({ mesh: t }) {
3102
+ function xr({ mesh: t }) {
3103
3103
  const r = t.geometry, n = j(() => {
3104
3104
  if (!r.getAttribute("position")) return null;
3105
- const a = vn(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3105
+ const a = _n(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3106
3106
  return {
3107
3107
  axis: c,
3108
3108
  center: a.center,
@@ -3113,7 +3113,7 @@ let __tla = (async () => {
3113
3113
  ]);
3114
3114
  if (!n) return null;
3115
3115
  const o = n.center.clone().addScaledVector(n.axis, n.halfLen), s = n.center.clone().addScaledVector(n.axis, -n.halfLen);
3116
- return i(ce, {
3116
+ return i(de, {
3117
3117
  points: [
3118
3118
  s,
3119
3119
  o
@@ -3129,7 +3129,7 @@ let __tla = (async () => {
3129
3129
  renderOrder: 999
3130
3130
  });
3131
3131
  }
3132
- const Cn = [
3132
+ const Dn = [
3133
3133
  {
3134
3134
  key: "pcaAxes",
3135
3135
  label: "PCA Axes (full mesh)",
@@ -3185,10 +3185,10 @@ let __tla = (async () => {
3185
3185
  color: "#00ffff",
3186
3186
  group: "Alignment"
3187
3187
  }
3188
- ], ur = [
3189
- ...new Set(Cn.map((t) => t.group))
3188
+ ], br = [
3189
+ ...new Set(Dn.map((t) => t.group))
3190
3190
  ];
3191
- function pr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3191
+ function yr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3192
3192
  return F("div", {
3193
3193
  style: {
3194
3194
  position: "absolute",
@@ -3217,8 +3217,8 @@ let __tla = (async () => {
3217
3217
  },
3218
3218
  children: "Debug Layers"
3219
3219
  }),
3220
- ur.map((o) => {
3221
- const s = Cn.filter((a) => a.group === o && !(a.hideWhenDoubleShell && n));
3220
+ br.map((o) => {
3221
+ const s = Dn.filter((a) => a.group === o && !(a.hideWhenDoubleShell && n));
3222
3222
  return s.length === 0 ? null : F("div", {
3223
3223
  children: [
3224
3224
  i("div", {
@@ -3278,111 +3278,131 @@ let __tla = (async () => {
3278
3278
  ]
3279
3279
  });
3280
3280
  }
3281
- const hr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
3282
- const [e, m] = W(null), [d, f] = W(0), [u, x] = W(false), [S, p] = W(false), [g, b] = W(""), [A, P] = W("3D"), [v, k] = W(r === "AK" ? 2 : 1), [w, M] = W(false), [h, C] = W(null), [L, I] = W(r ?? null), [D, E] = W("mm"), [V, G] = W(false), [Q, xe] = W(""), [le, de] = W(false), [re, ee] = W(false), [X, fe] = W(false), [Z, ue] = W(false), [ge, pe] = W(null), [H, ne] = W(null), [me, ye] = W(null), [be, oe] = W(false), [N, Y] = W([]), [Le, ke] = W(null), [je, ie] = W(null), [Ae, gt] = W(null), [mt, Et] = W(null), [Mn, Tt] = W(false), [xt, Ot] = W(null), [bt, Pe] = W(null), [_e, An] = W(false), [$t, kn] = W(Qo), [Ee, Ht] = W("obj"), [we, yt] = W(o), [Ge, wt] = W(true), [Te, Je] = W(false), [Qe, jt] = W(false), [Ce, et] = W(false), [Fn, St] = W(false), [Xe, Ln] = W(null), [Pn, In] = W(void 0), [_n, Dn] = W(void 0), [Vt] = W("#c8c8c8"), [Rn] = W(1), [Re, Wn] = W(false), [vt, Nt] = W([]), tt = se(null), Oe = se(null), nt = se(false), Bn = se(null), Ct = se(null), zt = se(null), Ze = J(async () => {
3283
- if (zt.current) try {
3284
- const y = zt.current, _ = () => {
3281
+ const wr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
3282
+ const [e, m] = W(null), [d, f] = W(0), [u, x] = W(false), [S, p] = W(false), [g, b] = W(""), [A, L] = W("3D"), [v, k] = W(r === "AK" ? 2 : 1), [w, M] = W(false), [h, C] = W(null), [P, I] = W(r ?? null), [D, E] = W("mm"), [V, X] = W(false), [Q, be] = W(""), [ae, fe] = W(false), [re, ee] = W(false), [G, ue] = W(false), [Z, pe] = W(false), [me, he] = W(null), [H, ne] = W(null), [xe, we] = W(null), [ye, oe] = W(false), [N, Y] = W([]), [Pe, ke] = W(null), [Ve, ie] = W(null), [Ae, wt] = W(null), [St, jt] = W(null), [Wn, Vt] = W(false), [vt, Nt] = W(null), [Ct, Le] = W(null), [De, Bn] = W(false), [Yt, En] = W(ir), [Te, Xt] = W("obj"), [Se, zt] = W(o), [Ge, Mt] = W(true), [Oe, tt] = W(false), [nt, Gt] = W(false), [ze, ot] = W(false), [Tn, At] = W(false), [Ze, On] = W(null), [$n, Hn] = W(void 0), [jn, Vn] = W(void 0), [Zt] = W("#c8c8c8"), [Nn] = W(1), [We, Yn] = W(false), [kt, Kt] = W([]), rt = le(null), $e = le(null), it = le(false), Xn = le(null), Ft = le(null), Pt = le(null), Ke = J(async () => {
3283
+ if (Pt.current) try {
3284
+ const y = Pt.current, _ = () => {
3285
3285
  const U = y.querySelector("canvas");
3286
3286
  if (!U) return;
3287
- const $ = y.getBoundingClientRect(), he = U.width, ve = U.height, te = he / $.width, ze = ve / $.height, De = document.createElement("canvas");
3288
- De.width = he, De.height = ve;
3289
- const Me = De.getContext("2d");
3290
- return Me.drawImage(U, 0, 0), y.querySelectorAll("[style*='pointer-events']").forEach((Ie) => {
3291
- const Ut = Ie;
3292
- if (Ut.hasAttribute("data-finalizing-overlay")) return;
3293
- const Jt = Ut.querySelectorAll("div[style*='background']");
3294
- Jt.length !== 0 && Jt.forEach((Lt) => {
3295
- const Ne = Lt.getBoundingClientRect();
3296
- if (Ne.width === 0 || Ne.height === 0) return;
3297
- const Zn = (Ne.left - $.left) * te, Kn = (Ne.top - $.top) * ze, qn = Ne.width * te, Un = Ne.height * ze, Jn = Lt.style.backgroundColor || "rgba(0,0,0,0.75)";
3298
- Me.fillStyle = Jn;
3299
- const Qn = 4 * te;
3300
- Me.beginPath(), Me.roundRect(Zn, Kn, qn, Un, Qn), Me.fill(), Lt.querySelectorAll("span").forEach((Pt) => {
3301
- const st = Pt.getBoundingClientRect();
3302
- if (st.width === 0) return;
3303
- const eo = (st.left - $.left) * te, to = (st.top - $.top) * ze, no = st.height * ze, It = window.getComputedStyle(Pt), Qt = parseFloat(It.fontSize) * ze;
3304
- Me.font = `${It.fontWeight || "normal"} ${Qt}px monospace`, Me.fillStyle = It.color || "#fff", Me.textBaseline = "top", Me.fillText(Pt.textContent || "", eo, to + (no - Qt) / 2);
3305
- });
3287
+ const $ = y.getBoundingClientRect(), ge = U.width, Ce = U.height, te = ge / $.width, Me = Ce / $.height, Re = document.createElement("canvas");
3288
+ Re.width = ge, Re.height = Ce;
3289
+ const se = Re.getContext("2d");
3290
+ return se.drawImage(U, 0, 0), y.querySelectorAll("[style*='pointer-events']").forEach((Ie) => {
3291
+ const nn = Ie;
3292
+ if (nn.hasAttribute("data-finalizing-overlay")) return;
3293
+ const on = nn.querySelectorAll("div[style*='background']");
3294
+ on.length !== 0 && on.forEach((Ye) => {
3295
+ var _a;
3296
+ const _e = Ye.getBoundingClientRect();
3297
+ if (_e.width === 0 || _e.height === 0) return;
3298
+ let Rt = 0, Qe = Ye;
3299
+ for (; Qe && Qe !== y; ) {
3300
+ const ft = (Qe.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3301
+ if (ft) {
3302
+ Rt = parseFloat(ft[1]);
3303
+ break;
3304
+ }
3305
+ Qe = Qe.parentElement;
3306
+ }
3307
+ const rn = (_e.left + _e.width / 2 - $.left) * te, sn = (_e.top + _e.height / 2 - $.top) * Me, ct = Math.abs(Rt) > 1, ln = (ct ? _e.height : _e.width) * te, an = (ct ? _e.width : _e.height) * Me;
3308
+ se.save(), se.translate(rn, sn), ct && se.rotate(Rt * Math.PI / 180);
3309
+ const ro = Ye.style.backgroundColor || "rgba(0,0,0,0.75)";
3310
+ se.fillStyle = ro;
3311
+ const io = 4 * te;
3312
+ se.beginPath(), se.roundRect(-ln / 2, -an / 2, ln, an, io), se.fill();
3313
+ const cn = ((_a = Ye.textContent) == null ? void 0 : _a.trim()) || "";
3314
+ if (cn) {
3315
+ const dt = window.getComputedStyle(Ye), ft = parseFloat(dt.fontSize || "14") * Me;
3316
+ se.font = `${dt.fontWeight || "normal"} ${ft}px monospace`, se.fillStyle = dt.color || "#fff", se.textAlign = "center", se.textBaseline = "middle";
3317
+ const dn = Ye.querySelectorAll("span");
3318
+ dn.length > 0 && !ct ? dn.forEach((Wt) => {
3319
+ const et = Wt.getBoundingClientRect();
3320
+ if (et.width === 0) return;
3321
+ const so = (et.left + et.width / 2 - $.left) * te - rn, lo = (et.top + et.height / 2 - $.top) * Me - sn, Bt = window.getComputedStyle(Wt), ao = parseFloat(Bt.fontSize) * Me;
3322
+ se.font = `${Bt.fontWeight || "normal"} ${ao}px monospace`, se.fillStyle = Bt.color || "#fff", se.fillText(Wt.textContent || "", so, lo);
3323
+ }) : se.fillText(cn, 0, 0);
3324
+ }
3325
+ se.restore();
3306
3326
  });
3307
- }), De.toDataURL("image/png");
3327
+ }), Re.toDataURL("image/png");
3308
3328
  };
3309
- Ct.current && Ct.current(), await new Promise((U) => requestAnimationFrame(() => requestAnimationFrame(U)));
3329
+ Ft.current && Ft.current(), await new Promise((U) => requestAnimationFrame(() => requestAnimationFrame(U)));
3310
3330
  const B = _();
3311
- P("2D"), await new Promise((U) => setTimeout(U, 150)), await new Promise((U) => requestAnimationFrame(() => requestAnimationFrame(U)));
3331
+ L("2D"), await new Promise((U) => setTimeout(U, 150)), await new Promise((U) => requestAnimationFrame(() => requestAnimationFrame(U)));
3312
3332
  const R = _();
3313
- return P("3D"), !B || !R ? void 0 : {
3333
+ return L("3D"), !B || !R ? void 0 : {
3314
3334
  frontal_view_png: B,
3315
3335
  side_view_png: R
3316
3336
  };
3317
3337
  } catch {
3318
3338
  return;
3319
3339
  }
3320
- }, []), Se = J((y) => {
3340
+ }, []), ve = J((y) => {
3321
3341
  const _ = /* @__PURE__ */ new Date(), B = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3322
- Nt((R) => [
3342
+ Kt((R) => [
3323
3343
  ...R.slice(-200),
3324
3344
  `[${B}] ${y}`
3325
3345
  ]);
3326
- }, []), { landmarkPoints: T, clearLandmarkPoints: En, addLandmarkPoint: Yt, removeLandmarkPoint: Gt, updateLandmarkPositions: Xt, setAligned: Zt, isAligned: K, setCut: Kt, isCut: Mt, reset: ot } = Bt();
3346
+ }, []), { landmarkPoints: T, clearLandmarkPoints: Gn, addLandmarkPoint: qt, removeLandmarkPoint: Ut, updateLandmarkPositions: Jt, setAligned: Qt, isAligned: K, setCut: en, isCut: Lt, reset: st } = Ht();
3327
3347
  q(() => {
3328
- ot();
3348
+ st();
3329
3349
  }, [
3330
- ot
3350
+ st
3331
3351
  ]);
3332
- const rt = v * dt;
3352
+ const lt = v * gt;
3333
3353
  q(() => {
3334
3354
  if (!a || T.length === 0) return;
3335
3355
  const y = T[T.length - 1];
3336
- Se(`LANDMARK[${T.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3356
+ ve(`LANDMARK[${T.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3337
3357
  }, [
3338
3358
  T.length,
3339
3359
  a,
3340
- Se
3360
+ ve
3341
3361
  ]), q(() => {
3342
- a && K && Se("STATE: mesh aligned");
3362
+ a && K && ve("STATE: mesh aligned");
3343
3363
  }, [
3344
3364
  K,
3345
3365
  a,
3346
- Se
3366
+ ve
3347
3367
  ]), q(() => {
3348
- a && Mt && Se("STATE: mesh cut");
3368
+ a && Lt && ve("STATE: mesh cut");
3349
3369
  }, [
3350
- Mt,
3370
+ Lt,
3351
3371
  a,
3352
- Se
3372
+ ve
3353
3373
  ]), q(() => {
3354
- tt.current && (tt.current.scrollTop = tt.current.scrollHeight);
3374
+ rt.current && (rt.current.scrollTop = rt.current.scrollHeight);
3355
3375
  }, [
3356
- vt
3376
+ kt
3357
3377
  ]);
3358
- const Ve = j(() => me ? new O.Mesh(me) : null, [
3359
- me
3378
+ const Ne = j(() => xe ? new O.Mesh(xe) : null, [
3379
+ xe
3360
3380
  ]);
3361
3381
  q(() => {
3362
- o && yt(o);
3382
+ o && zt(o);
3363
3383
  }, [
3364
3384
  o
3365
3385
  ]), q(() => {
3366
- o || yt(void 0);
3386
+ o || zt(void 0);
3367
3387
  }, [
3368
3388
  v
3369
3389
  ]);
3370
- const it = se(false);
3390
+ const at = le(false);
3371
3391
  q(() => {
3372
- if (!K || N.length === 0 || it.current || !c) return;
3373
- it.current = true;
3392
+ if (!K || N.length === 0 || at.current || !c) return;
3393
+ at.current = true;
3374
3394
  const y = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3375
3395
  c("dimensions_calculated", {
3376
- spacing_type: L,
3396
+ spacing_type: P,
3377
3397
  source_unit: "mm",
3378
- file_format: Ee,
3398
+ file_format: Te,
3379
3399
  measurement_source: "scan_derived",
3380
- is_double_wall: X,
3400
+ is_double_wall: G,
3381
3401
  is_unit_converted: false,
3382
- form_measurements: (we == null ? void 0 : we.filter((_) => _ != null)) ?? null,
3402
+ form_measurements: (Se == null ? void 0 : Se.filter((_) => _ != null)) ?? null,
3383
3403
  scan_measurements: N.map((_) => +(_.modifiedValue ?? _.originalValue).toFixed(1)),
3384
- measurement_variance: we ? N.map((_, B) => {
3385
- const R = we[B];
3404
+ measurement_variance: Se ? N.map((_, B) => {
3405
+ const R = Se[B];
3386
3406
  return R == null ? null : +((_.modifiedValue ?? _.originalValue) - R).toFixed(1);
3387
3407
  }) : null,
3388
3408
  frontal_height: y !== null ? +y.toFixed(1) : null
@@ -3391,72 +3411,72 @@ let __tla = (async () => {
3391
3411
  K,
3392
3412
  N
3393
3413
  ]), q(() => {
3394
- l !== void 0 && (Oe.current = l), l !== void 0 && Wn(true);
3414
+ l !== void 0 && ($e.current = l), l !== void 0 && Yn(true);
3395
3415
  }, [
3396
3416
  l
3397
3417
  ]);
3398
- const Ke = J((y, _) => {
3418
+ const qe = J((y, _) => {
3399
3419
  y.computeBoundingBox();
3400
3420
  const B = y.boundingBox, R = new z();
3401
3421
  B.getCenter(R), y.translate(-R.x, -R.y, -R.z), y.computeBoundingBox();
3402
3422
  const U = y.boundingBox, $ = new z();
3403
3423
  U.getSize($), f(Math.max($.x, $.y, $.z));
3404
- const he = new O.Mesh(y, new O.MeshStandardMaterial({
3424
+ const ge = new O.Mesh(y, new O.MeshStandardMaterial({
3405
3425
  color: 8947848,
3406
3426
  side: O.DoubleSide
3407
3427
  }));
3408
- m(he), de(_), ee(true), ue(false), nt.current = false;
3409
- }, []), We = J(async (y, _) => {
3410
- Pe(null);
3428
+ m(ge), fe(_), ee(true), pe(false), it.current = false;
3429
+ }, []), Be = J(async (y, _) => {
3430
+ Le(null);
3411
3431
  const B = _.toLowerCase(), R = B.endsWith(".stl");
3412
3432
  if (!B.endsWith(".obj") && !R) {
3413
- Pe("Unsupported file format. Please use OBJ or STL.");
3433
+ Le("Unsupported file format. Please use OBJ or STL.");
3414
3434
  return;
3415
3435
  }
3416
- Ht(R ? "stl" : "obj"), p(true), b("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3436
+ Xt(R ? "stl" : "obj"), p(true), b("Processing file..."), ve(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3417
3437
  try {
3418
3438
  let $;
3419
3439
  if (R) if (b("Converting STL..."), y instanceof ArrayBuffer) {
3420
3440
  const te = new Blob([
3421
3441
  y
3422
- ]), ze = new File([
3442
+ ]), Me = new File([
3423
3443
  te
3424
3444
  ], _);
3425
- $ = await _t(ze);
3445
+ $ = await Et(Me);
3426
3446
  } else {
3427
3447
  const te = new Blob([
3428
3448
  y
3429
- ]), ze = new File([
3449
+ ]), Me = new File([
3430
3450
  te
3431
3451
  ], _);
3432
- $ = await _t(ze);
3452
+ $ = await Et(Me);
3433
3453
  }
3434
3454
  else $ = typeof y == "string" ? y : new TextDecoder().decode(y);
3435
- const he = performance.now(), ve = Oe.current ? await yo($, Oe.current, (te) => {
3436
- b(te), Se(`PREPROCESS: ${te}`);
3455
+ const ge = performance.now(), Ce = $e.current ? await Mo($, $e.current, (te) => {
3456
+ b(te), ve(`PREPROCESS: ${te}`);
3437
3457
  }) : null;
3438
- if (ve) Se(`PREPROCESS: done in ${(performance.now() - he).toFixed(0)}ms \u2014 unit=${ve.detectedUnit}, scaled=${ve.wasScaled}`), t.showAmputationModal && !r ? (C(ve), M(true)) : Ke(ve.geometry, ve.wasScaled);
3458
+ if (Ce) ve(`PREPROCESS: done in ${(performance.now() - ge).toFixed(0)}ms \u2014 unit=${Ce.detectedUnit}, scaled=${Ce.wasScaled}`), t.showAmputationModal && !r ? (C(Ce), M(true)) : qe(Ce.geometry, Ce.wasScaled);
3439
3459
  else {
3440
3460
  b("Using fallback loader...");
3441
- const te = wo($);
3461
+ const te = Ao($);
3442
3462
  te ? t.showAmputationModal && !r ? (C({
3443
3463
  geometry: te,
3444
3464
  wasScaled: false
3445
- }), M(true)) : Ke(te, false) : Pe("Failed to parse the mesh.");
3465
+ }), M(true)) : qe(te, false) : Le("Failed to parse the mesh.");
3446
3466
  }
3447
3467
  } catch ($) {
3448
- Pe($ instanceof Error ? $.message : "Failed to process the mesh file.");
3468
+ Le($ instanceof Error ? $.message : "Failed to process the mesh file.");
3449
3469
  } finally {
3450
3470
  p(false), b("");
3451
3471
  }
3452
3472
  }, [
3453
- Re,
3473
+ We,
3454
3474
  t.showAmputationModal,
3455
3475
  r,
3456
- Ke
3476
+ qe
3457
3477
  ]);
3458
3478
  q(() => {
3459
- if (!n || !Re) return;
3479
+ if (!n || !We) return;
3460
3480
  (async () => {
3461
3481
  p(true), b("Loading scan...");
3462
3482
  try {
@@ -3465,79 +3485,79 @@ let __tla = (async () => {
3465
3485
  const R = new URL(n).pathname.split("/").pop() || "scan.obj";
3466
3486
  if (R.toLowerCase().endsWith(".stl")) {
3467
3487
  const $ = await _.arrayBuffer();
3468
- await We($, R);
3488
+ await Be($, R);
3469
3489
  } else {
3470
3490
  const $ = await _.text();
3471
- await We($, R);
3491
+ await Be($, R);
3472
3492
  }
3473
3493
  } catch (_) {
3474
- Pe(_ instanceof Error ? _.message : "Failed to load scan from URL."), p(false), b("");
3494
+ Le(_ instanceof Error ? _.message : "Failed to load scan from URL."), p(false), b("");
3475
3495
  }
3476
3496
  })();
3477
3497
  }, [
3478
3498
  n,
3479
- Re
3499
+ We
3480
3500
  ]);
3481
- const Tn = J((y) => {
3501
+ const Zn = J((y) => {
3482
3502
  y.preventDefault(), x(true);
3483
- }, []), On = J((y) => {
3503
+ }, []), Kn = J((y) => {
3484
3504
  y.preventDefault(), x(false);
3485
- }, []), $n = J(async (y) => {
3486
- if (y.preventDefault(), x(false), !Re) {
3487
- Pe("WASM module is still loading. Please wait.");
3505
+ }, []), qn = J(async (y) => {
3506
+ if (y.preventDefault(), x(false), !We) {
3507
+ Le("WASM module is still loading. Please wait.");
3488
3508
  return;
3489
3509
  }
3490
3510
  const _ = y.dataTransfer.files[0];
3491
3511
  if (!_) return;
3492
3512
  const B = _.name.toLowerCase();
3493
3513
  if (!B.endsWith(".obj") && !B.endsWith(".stl")) {
3494
- Pe("Please drop an OBJ or STL file.");
3514
+ Le("Please drop an OBJ or STL file.");
3495
3515
  return;
3496
3516
  }
3497
3517
  if (B.endsWith(".stl")) {
3498
- Ht("stl"), p(true), b("Converting STL...");
3518
+ Xt("stl"), p(true), b("Converting STL...");
3499
3519
  try {
3500
- const R = await _t(_);
3501
- await We(R, _.name.replace(/\.stl$/i, ".obj"));
3520
+ const R = await Et(_);
3521
+ await Be(R, _.name.replace(/\.stl$/i, ".obj"));
3502
3522
  } catch (R) {
3503
- Pe(R instanceof Error ? R.message : "Failed to process STL file."), p(false), b("");
3523
+ Le(R instanceof Error ? R.message : "Failed to process STL file."), p(false), b("");
3504
3524
  }
3505
3525
  } else {
3506
3526
  const R = await _.text();
3507
- await We(R, _.name);
3527
+ await Be(R, _.name);
3508
3528
  }
3509
3529
  }, [
3510
- Re,
3511
- We
3512
- ]), Hn = J((y) => {
3513
- I(y), k(y === "AK" ? 2 : 1), M(false), h && (Ke(h.geometry, h.wasScaled), C(null)), c == null ? void 0 : c("file_loaded", {
3530
+ We,
3531
+ Be
3532
+ ]), Un = J((y) => {
3533
+ I(y), k(y === "AK" ? 2 : 1), M(false), h && (qe(h.geometry, h.wasScaled), C(null)), c == null ? void 0 : c("file_loaded", {
3514
3534
  spacing_type: y,
3515
- file_format: Ee,
3535
+ file_format: Te,
3516
3536
  is_double_wall: false
3517
3537
  });
3518
3538
  }, [
3519
3539
  h,
3520
- Ke,
3540
+ qe,
3521
3541
  c,
3522
- Ee
3542
+ Te
3523
3543
  ]);
3524
3544
  q(() => {
3525
- if (!e || T.length !== 1 || !Oe.current || nt.current) return;
3526
- nt.current = true;
3527
- const y = T[0], _ = Oe.current, B = e.geometry, { positions: R, indices: U } = ft(B), $ = new Float32Array([
3545
+ if (!e || T.length !== 1 || !$e.current || it.current) return;
3546
+ it.current = true;
3547
+ const y = T[0], _ = $e.current, B = e.geometry, { positions: R, indices: U } = mt(B), $ = new Float32Array([
3528
3548
  y.position.x,
3529
3549
  y.position.y,
3530
3550
  y.position.z
3531
- ]), he = _.detect_shell(R, U, $, 40), ve = he.details(), te = he.is_double_shell();
3532
- Se(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${ve}`), te && (fe(true), oe(true), Se(`SHELL_DETECT: double shell, thickness=${he.thickness().toFixed(1)}mm`));
3551
+ ]), ge = _.detect_shell(R, U, $, 40), Ce = ge.details(), te = ge.is_double_shell();
3552
+ ve(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${Ce}`), te && (ue(true), oe(true), ve(`SHELL_DETECT: double shell, thickness=${ge.thickness().toFixed(1)}mm`));
3533
3553
  }, [
3534
3554
  e,
3535
3555
  T,
3536
- Se
3556
+ ve
3537
3557
  ]);
3538
- const jn = J(() => {
3558
+ const Jn = J(() => {
3539
3559
  if (!e || T.length < 2) return;
3540
- G(true), xe("Please wait..."), Se("PIPELINE: starting processing pipeline...");
3560
+ X(true), be("Please wait..."), ve("PIPELINE: starting processing pipeline...");
3541
3561
  const y = performance.now();
3542
3562
  setTimeout(() => {
3543
3563
  const _ = [
@@ -3545,76 +3565,76 @@ let __tla = (async () => {
3545
3565
  T[0],
3546
3566
  ...T.slice(2)
3547
3567
  ];
3548
- Mo(e, _, dt, {
3568
+ Io(e, _, gt, {
3549
3569
  onStatus: (B) => {
3550
- xe(B), Se(`PIPELINE: ${B}`);
3570
+ be(B), ve(`PIPELINE: ${B}`);
3551
3571
  },
3552
- addLandmarkPoint: Yt,
3553
- removeLandmarkPoint: Gt,
3572
+ addLandmarkPoint: qt,
3573
+ removeLandmarkPoint: Ut,
3554
3574
  updateLandmarkPositions: (B) => {
3555
3575
  const R = [
3556
3576
  B[1],
3557
3577
  B[0],
3558
3578
  ...B.slice(2)
3559
3579
  ];
3560
- Xt(R);
3580
+ Jt(R);
3561
3581
  },
3562
- setAligned: Zt,
3563
- setCut: Kt,
3582
+ setAligned: Qt,
3583
+ setCut: en,
3564
3584
  setModelSize: f,
3565
- setOriginalEndY: Et,
3585
+ setOriginalEndY: jt,
3566
3586
  setAdjustedStartY: ie,
3567
- setAdjustedEndY: gt,
3568
- setError: Pe,
3587
+ setAdjustedEndY: wt,
3588
+ setError: Le,
3569
3589
  setDoubleShell: (B) => {
3570
- fe(B), oe(true);
3590
+ ue(B), oe(true);
3571
3591
  },
3572
3592
  setAoData: (B, R) => {
3573
- pe(B), ne(R ?? null);
3593
+ he(B), ne(R ?? null);
3574
3594
  },
3575
- setInnerShellExtracted: ue,
3576
- setMeasurementGeometry: ye,
3595
+ setInnerShellExtracted: pe,
3596
+ setMeasurementGeometry: we,
3577
3597
  setWasmSlices: ke,
3578
- wasmModule: Oe.current ?? void 0
3579
- }), Se(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), it.current = false, G(false);
3598
+ wasmModule: $e.current ?? void 0
3599
+ }), ve(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), at.current = false, X(false);
3580
3600
  }, 50);
3581
3601
  }, [
3582
3602
  e,
3583
3603
  T,
3584
- Xt,
3585
- Zt,
3586
- Yt,
3587
- Gt,
3588
- Kt,
3604
+ Jt,
3605
+ Qt,
3606
+ qt,
3607
+ Ut,
3608
+ en,
3589
3609
  Z
3590
- ]), At = se(false), Vn = J(async () => {
3591
- if (ot(), Y([]), ke(null), ye(null), ie(null), gt(null), Ot(null), Et(null), Je(false), jt(false), wt(true), fe(false), ue(false), nt.current = false, At.current = false, it.current = false, P("3D"), n && Re) {
3610
+ ]), It = le(false), Qn = J(async () => {
3611
+ if (st(), Y([]), ke(null), we(null), ie(null), wt(null), Nt(null), jt(null), tt(false), Gt(false), Mt(true), ue(false), pe(false), it.current = false, It.current = false, at.current = false, L("3D"), n && We) {
3592
3612
  m(null);
3593
3613
  try {
3594
3614
  const y = await fetch(n);
3595
3615
  if (!y.ok) throw new Error(`Failed to download scan: ${y.status}`);
3596
3616
  const B = new URL(n).pathname.split("/").pop() || "scan.obj";
3597
- B.toLowerCase().endsWith(".stl") ? await We(await y.arrayBuffer(), B) : await We(await y.text(), B);
3617
+ B.toLowerCase().endsWith(".stl") ? await Be(await y.arrayBuffer(), B) : await Be(await y.text(), B);
3598
3618
  } catch (y) {
3599
- Pe(y instanceof Error ? y.message : "Failed to reload scan.");
3619
+ Le(y instanceof Error ? y.message : "Failed to reload scan.");
3600
3620
  }
3601
3621
  }
3602
3622
  }, [
3603
3623
  n,
3604
- Re,
3605
3624
  We,
3606
- ot
3625
+ Be,
3626
+ st
3607
3627
  ]);
3608
3628
  q(() => {
3609
- K && N.length > 0 && !At.current && (At.current = true, Je(true));
3629
+ K && N.length > 0 && !It.current && (It.current = true, tt(true));
3610
3630
  }, [
3611
3631
  K,
3612
3632
  N.length
3613
3633
  ]);
3614
- const qe = j(() => {
3634
+ const Ue = j(() => {
3615
3635
  var _a;
3616
3636
  if (!e || T.length < 3) return 0;
3617
- if (X) return Math.abs(T[0].position.y - T[2].position.y);
3637
+ if (G) return Math.abs(T[0].position.y - T[2].position.y);
3618
3638
  const y = e.geometry;
3619
3639
  y.computeBoundingBox();
3620
3640
  const _ = ((_a = y.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
@@ -3622,25 +3642,25 @@ let __tla = (async () => {
3622
3642
  }, [
3623
3643
  e,
3624
3644
  T,
3625
- X
3626
- ]), Nn = J((y) => {
3627
- Ln(y), yt(y.circumferences), wt(true), jt(true);
3628
- }, []), qt = J(async (y) => {
3645
+ G
3646
+ ]), eo = J((y) => {
3647
+ On(y), zt(y.circumferences), Mt(true), Gt(true);
3648
+ }, []), tn = J(async (y) => {
3629
3649
  if (!s) return;
3630
- Je(false), St(false), et(true);
3631
- const _ = e ? await Ze().catch(() => {
3650
+ tt(false), At(false), ot(true);
3651
+ const _ = e ? await Ke().catch(() => {
3632
3652
  }) : void 0;
3633
3653
  try {
3634
3654
  s({
3635
- spacingType: L ?? "BK",
3655
+ spacingType: P ?? "BK",
3636
3656
  sourceUnit: "mm",
3637
- fileFormat: Ee,
3657
+ fileFormat: Te,
3638
3658
  measurementSource: "form_provided",
3639
- isDoubleWall: X,
3659
+ isDoubleWall: G,
3640
3660
  isUnitConverted: false,
3641
- formMeasurements: we,
3661
+ formMeasurements: Se,
3642
3662
  scanMeasurements: N,
3643
- frontalHeight: qe,
3663
+ frontalHeight: Ue,
3644
3664
  transverseML: 0,
3645
3665
  transverseAP: 0,
3646
3666
  scanUrl: n,
@@ -3649,106 +3669,106 @@ let __tla = (async () => {
3649
3669
  screenshots: _
3650
3670
  });
3651
3671
  } finally {
3652
- et(false);
3672
+ ot(false);
3653
3673
  }
3654
3674
  }, [
3655
3675
  s,
3656
3676
  e,
3657
- L,
3658
- Ee,
3659
- X,
3660
- we,
3677
+ P,
3678
+ Te,
3679
+ G,
3680
+ Se,
3661
3681
  N,
3662
- qe,
3682
+ Ue,
3663
3683
  n,
3664
- Ze
3665
- ]), kt = se(null);
3684
+ Ke
3685
+ ]), _t = le(null);
3666
3686
  q(() => {
3667
3687
  if (!e || !K) {
3668
- kt.current = null;
3688
+ _t.current = null;
3669
3689
  return;
3670
3690
  }
3671
- const y = (Ve ?? e).geometry;
3672
- kt.current = Wt(y);
3691
+ const y = (Ne ?? e).geometry;
3692
+ _t.current = $t(y);
3673
3693
  }, [
3674
3694
  e,
3675
3695
  K,
3676
- Ve
3696
+ Ne
3677
3697
  ]);
3678
- const Ft = J(async (y) => {
3679
- if (!s || !e || N.length === 0 || !L) return;
3680
- et(true);
3681
- const _ = await Ze().catch(() => {
3698
+ const Dt = J(async (y) => {
3699
+ if (!s || !e || N.length === 0 || !P) return;
3700
+ ot(true);
3701
+ const _ = await Ke().catch(() => {
3682
3702
  });
3683
3703
  try {
3684
3704
  let B = 0, R = 0;
3685
3705
  if (T.length >= 2) {
3686
- const U = (Ve ?? e).geometry, he = T[0].position.y;
3706
+ const U = (Ne ?? e).geometry, ge = T[0].position.y;
3687
3707
  try {
3688
- const ve = kt.current ?? Wt(U), te = $e(ve, U, he);
3708
+ const Ce = _t.current ?? $t(U), te = He(Ce, U, ge);
3689
3709
  if (te.linePoints.length >= 2) {
3690
- let ze = te.linePoints[0], De = te.linePoints[0], Me = te.linePoints[0], Ue = te.linePoints[0];
3691
- for (const Ie of te.linePoints) Ie.x < ze.x && (ze = Ie), Ie.x > De.x && (De = Ie), Ie.z < Me.z && (Me = Ie), Ie.z > Ue.z && (Ue = Ie);
3692
- B = new z(ze.x, he, ze.z).distanceTo(new z(De.x, he, De.z)), R = new z(Me.x, he, Me.z).distanceTo(new z(Ue.x, he, Ue.z));
3710
+ let Me = te.linePoints[0], Re = te.linePoints[0], se = te.linePoints[0], Je = te.linePoints[0];
3711
+ for (const Ie of te.linePoints) Ie.x < Me.x && (Me = Ie), Ie.x > Re.x && (Re = Ie), Ie.z < se.z && (se = Ie), Ie.z > Je.z && (Je = Ie);
3712
+ B = new z(Me.x, ge, Me.z).distanceTo(new z(Re.x, ge, Re.z)), R = new z(se.x, ge, se.z).distanceTo(new z(Je.x, ge, Je.z));
3693
3713
  }
3694
3714
  } catch {
3695
3715
  }
3696
3716
  }
3697
3717
  s({
3698
- spacingType: L,
3718
+ spacingType: P,
3699
3719
  sourceUnit: "mm",
3700
- fileFormat: Ee,
3720
+ fileFormat: Te,
3701
3721
  measurementSource: y === "use_form_measurements" ? "form_provided" : "scan_derived",
3702
- isDoubleWall: X,
3722
+ isDoubleWall: G,
3703
3723
  isUnitConverted: false,
3704
- formMeasurements: we,
3724
+ formMeasurements: Se,
3705
3725
  scanMeasurements: N,
3706
- frontalHeight: (Xe == null ? void 0 : Xe.frontalHeight) ?? qe,
3726
+ frontalHeight: (Ze == null ? void 0 : Ze.frontalHeight) ?? Ue,
3707
3727
  transverseML: B,
3708
3728
  transverseAP: R,
3709
3729
  scanUrl: n,
3710
3730
  decision: y,
3711
- userEnteredMeasurements: Xe ?? void 0,
3731
+ userEnteredMeasurements: Ze ?? void 0,
3712
3732
  screenshots: _
3713
3733
  });
3714
3734
  } finally {
3715
- et(false);
3735
+ ot(false);
3716
3736
  }
3717
3737
  }, [
3718
3738
  s,
3719
3739
  e,
3720
- Ve,
3740
+ Ne,
3721
3741
  N,
3722
- L,
3742
+ P,
3723
3743
  T,
3724
- Ee,
3725
- X,
3726
- we,
3744
+ Te,
3745
+ G,
3746
+ Se,
3727
3747
  n,
3728
- Xe,
3729
- qe,
3730
- Ze
3731
- ]), Yn = j(() => {
3732
- if (!we || N.length === 0) return false;
3733
- const y = Math.min(we.length, N.length);
3748
+ Ze,
3749
+ Ue,
3750
+ Ke
3751
+ ]), to = j(() => {
3752
+ if (!Se || N.length === 0) return false;
3753
+ const y = Math.min(Se.length, N.length);
3734
3754
  if (y === 0) return false;
3735
3755
  for (let _ = 0; _ < y; _++) {
3736
- const B = we[_], R = N[_];
3756
+ const B = Se[_], R = N[_];
3737
3757
  if (!R || B == null || B === 0) continue;
3738
3758
  const U = R.modifiedValue ?? R.originalValue;
3739
3759
  if (Math.abs(U - B) > 7) return false;
3740
3760
  }
3741
3761
  return true;
3742
3762
  }, [
3743
- we,
3763
+ Se,
3744
3764
  N
3745
- ]), Gn = Qe ? 5 : K && Te || K ? 4 : e ? T.length === 0 ? 2 : 3 : 1, Xn = [
3765
+ ]), no = nt ? 5 : K && Oe || K ? 4 : e ? T.length === 0 ? 2 : 3 : 1, oo = [
3746
3766
  {
3747
3767
  label: "Load File",
3748
3768
  number: 1
3749
3769
  },
3750
3770
  {
3751
- label: L === "AK" ? "Set IT" : "Set MPT",
3771
+ label: P === "AK" ? "Set IT" : "Set MPT",
3752
3772
  number: 2
3753
3773
  },
3754
3774
  {
@@ -3764,7 +3784,7 @@ let __tla = (async () => {
3764
3784
  number: 5
3765
3785
  }
3766
3786
  ];
3767
- return F(ho.Provider, {
3787
+ return F(wo.Provider, {
3768
3788
  value: t,
3769
3789
  children: [
3770
3790
  F("div", {
@@ -3796,9 +3816,9 @@ let __tla = (async () => {
3796
3816
  }
3797
3817
  })
3798
3818
  }),
3799
- i(No, {
3800
- steps: Xn,
3801
- currentStep: Gn
3819
+ i(qo, {
3820
+ steps: oo,
3821
+ currentStep: no
3802
3822
  }),
3803
3823
  F("div", {
3804
3824
  style: {
@@ -3816,37 +3836,37 @@ let __tla = (async () => {
3816
3836
  minHeight: 0
3817
3837
  },
3818
3838
  children: [
3819
- K && Te && L && i("div", {
3839
+ K && Oe && P && i("div", {
3820
3840
  style: {
3821
3841
  width: 340,
3822
3842
  flexShrink: 0,
3823
3843
  borderRight: "1px solid #e0e0e0",
3824
3844
  overflow: "hidden"
3825
3845
  },
3826
- children: i(Jo, {
3827
- amputationType: L,
3846
+ children: i(rr, {
3847
+ amputationType: P,
3828
3848
  spacingInches: v,
3829
3849
  scanMeasurements: N,
3830
- scanFrontalHeight: qe,
3831
- onSave: Nn,
3832
- onSkip: qt,
3833
- onFormChange: In,
3834
- onHeightChange: Dn,
3835
- initialValues: we,
3836
- initialFrontalHeight: Xe == null ? void 0 : Xe.frontalHeight
3850
+ scanFrontalHeight: Ue,
3851
+ onSave: eo,
3852
+ onSkip: tn,
3853
+ onFormChange: Hn,
3854
+ onHeightChange: Vn,
3855
+ initialValues: Se,
3856
+ initialFrontalHeight: Ze == null ? void 0 : Ze.frontalHeight
3837
3857
  })
3838
3858
  }),
3839
3859
  F("div", {
3840
- ref: zt,
3860
+ ref: Pt,
3841
3861
  style: {
3842
3862
  flex: 1,
3843
3863
  position: "relative",
3844
3864
  minHeight: 0,
3845
3865
  overflow: "hidden"
3846
3866
  },
3847
- onDragOver: t.showDragDrop ? Tn : void 0,
3848
- onDragLeave: t.showDragDrop ? On : void 0,
3849
- onDrop: t.showDragDrop ? $n : void 0,
3867
+ onDragOver: t.showDragDrop ? Zn : void 0,
3868
+ onDragLeave: t.showDragDrop ? Kn : void 0,
3869
+ onDrop: t.showDragDrop ? qn : void 0,
3850
3870
  children: [
3851
3871
  t.showDragDrop && !e && !S && i("div", {
3852
3872
  style: {
@@ -3859,7 +3879,7 @@ let __tla = (async () => {
3859
3879
  justifyContent: "center",
3860
3880
  pointerEvents: "none"
3861
3881
  },
3862
- children: Re ? i("div", {
3882
+ children: We ? i("div", {
3863
3883
  style: {
3864
3884
  fontSize: 18,
3865
3885
  color: "#aaa",
@@ -3897,7 +3917,7 @@ let __tla = (async () => {
3897
3917
  ]
3898
3918
  })
3899
3919
  }),
3900
- !t.showDragDrop && !e && !S && !bt && i("div", {
3920
+ !t.showDragDrop && !e && !S && !Ct && i("div", {
3901
3921
  style: {
3902
3922
  position: "absolute",
3903
3923
  inset: 0,
@@ -3964,7 +3984,7 @@ let __tla = (async () => {
3964
3984
  }
3965
3985
  }),
3966
3986
  "Click mesh to set ",
3967
- L === "AK" ? "IT" : "MPT"
3987
+ P === "AK" ? "IT" : "MPT"
3968
3988
  ]
3969
3989
  }),
3970
3990
  e && !K && T.length === 1 && F("div", {
@@ -3998,15 +4018,15 @@ let __tla = (async () => {
3998
4018
  "Click mesh to set Origin"
3999
4019
  ]
4000
4020
  }),
4001
- S && i(on, {
4021
+ S && i(hn, {
4002
4022
  message: g || "Processing mesh..."
4003
4023
  }),
4004
- V && i(on, {
4024
+ V && i(hn, {
4005
4025
  message: Q
4006
4026
  }),
4007
- bt && i(ko, {
4008
- message: bt,
4009
- onDismiss: () => Pe(null)
4027
+ Ct && i(Do, {
4028
+ message: Ct,
4029
+ onDismiss: () => Le(null)
4010
4030
  }),
4011
4031
  t.showAmputationModal && w && i("div", {
4012
4032
  style: {
@@ -4069,15 +4089,15 @@ let __tla = (async () => {
4069
4089
  border: "2px solid",
4070
4090
  borderRadius: 4,
4071
4091
  cursor: "pointer",
4072
- borderColor: L === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4073
- backgroundColor: L === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4092
+ borderColor: P === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4093
+ backgroundColor: P === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4074
4094
  transition: "border-color 0.15s, background-color 0.15s"
4075
4095
  },
4076
4096
  children: [
4077
4097
  i("input", {
4078
4098
  type: "radio",
4079
4099
  name: "ampType",
4080
- checked: L === y,
4100
+ checked: P === y,
4081
4101
  onChange: () => I(y),
4082
4102
  style: {
4083
4103
  accentColor: "rgb(12, 67, 173)",
@@ -4139,17 +4159,17 @@ let __tla = (async () => {
4139
4159
  children: "Cancel"
4140
4160
  }),
4141
4161
  i("button", {
4142
- onClick: () => L && Hn(L),
4143
- disabled: !L,
4162
+ onClick: () => P && Un(P),
4163
+ disabled: !P,
4144
4164
  style: {
4145
4165
  padding: "6px 16px",
4146
4166
  borderRadius: 4,
4147
4167
  fontSize: 14,
4148
4168
  fontWeight: 500,
4149
- backgroundColor: L ? "rgb(12, 67, 173)" : "#e0e0e0",
4169
+ backgroundColor: P ? "rgb(12, 67, 173)" : "#e0e0e0",
4150
4170
  border: "none",
4151
- color: L ? "#fff" : "#9e9e9e",
4152
- cursor: L ? "pointer" : "not-allowed",
4171
+ color: P ? "#fff" : "#9e9e9e",
4172
+ cursor: P ? "pointer" : "not-allowed",
4153
4173
  fontFamily: "system-ui, sans-serif",
4154
4174
  lineHeight: "36px",
4155
4175
  letterSpacing: "0.4px"
@@ -4171,8 +4191,8 @@ let __tla = (async () => {
4171
4191
  zIndex: 10
4172
4192
  }
4173
4193
  }),
4174
- i(Ao, {
4175
- children: F(lo, {
4194
+ i(_o, {
4195
+ children: F(ho, {
4176
4196
  camera: {
4177
4197
  position: [
4178
4198
  0,
@@ -4182,14 +4202,14 @@ let __tla = (async () => {
4182
4202
  },
4183
4203
  style: {
4184
4204
  display: e ? "block" : "none",
4185
- backgroundColor: _e ? "#070611" : void 0
4205
+ backgroundColor: De ? "#070611" : void 0
4186
4206
  },
4187
4207
  gl: {
4188
4208
  localClippingEnabled: true,
4189
4209
  preserveDrawingBuffer: true
4190
4210
  },
4191
4211
  scene: {
4192
- background: _e ? new O.Color("#070611") : null
4212
+ background: De ? new O.Color("#070611") : null
4193
4213
  },
4194
4214
  children: [
4195
4215
  i("ambientLight", {
@@ -4219,114 +4239,114 @@ let __tla = (async () => {
4219
4239
  ],
4220
4240
  intensity: 0.2
4221
4241
  }),
4222
- e && A === "3D" && i(Lo, {
4242
+ e && A === "3D" && i(Wo, {
4223
4243
  mesh: e,
4224
4244
  maxPoints: 2,
4225
- meshColor: Vt,
4226
- meshOpacity: _e ? 0.3 : Rn,
4245
+ meshColor: Zt,
4246
+ meshOpacity: De ? 0.3 : Nn,
4227
4247
  frontFaceOnly: Z,
4228
- doubleShellTransparency: X && K
4248
+ doubleShellTransparency: G && K
4229
4249
  }),
4230
- e && A === "3D" && i(Io, {
4250
+ e && A === "3D" && i(Eo, {
4231
4251
  modelSize: d,
4232
4252
  labels: [
4233
- L === "AK" ? "IT" : "MPT",
4253
+ P === "AK" ? "IT" : "MPT",
4234
4254
  "Origin",
4235
4255
  "Cut Plane"
4236
4256
  ]
4237
4257
  }),
4238
- i($o, {
4258
+ i(Xo, {
4239
4259
  modelSize: d,
4240
4260
  isAligned: K,
4241
- isCut: Mt,
4261
+ isCut: Lt,
4242
4262
  mesh: e,
4243
4263
  viewMode: A,
4244
- sliceY: K && T.length >= 2 ? Ae ?? mt ?? T[0].position.y : void 0,
4264
+ sliceY: K && T.length >= 2 ? Ae ?? St ?? T[0].position.y : void 0,
4245
4265
  landmarkCount: T.length,
4246
- measurementGeometry: me,
4247
- resetCameraToFrontRef: Ct
4266
+ measurementGeometry: xe,
4267
+ resetCameraToFrontRef: Ft
4248
4268
  }),
4249
- !K && i(fn, {
4269
+ !K && i(Sn, {
4250
4270
  enableDamping: false
4251
4271
  }),
4252
- K && N.length > 0 && e && A === "3D" && i(Ho, {
4272
+ K && N.length > 0 && e && A === "3D" && i(Go, {
4253
4273
  mesh: e,
4254
- isDragging: Mn
4274
+ isDragging: Wn
4255
4275
  }),
4256
4276
  e && K && T.length >= 3 && (() => {
4257
4277
  const _ = e.geometry.getIndex();
4258
4278
  if (!_ || _.count < 30) return null;
4259
- const B = T[2], R = T[0], U = je ?? B.position.y, $ = Ae ?? mt ?? R.position.y;
4260
- return A === "2D" ? i(Yo, {
4261
- mesh: Ve ?? e,
4279
+ const B = T[2], R = T[0], U = Ve ?? B.position.y, $ = Ae ?? St ?? R.position.y;
4280
+ return A === "2D" ? i(Uo, {
4281
+ mesh: Ne ?? e,
4262
4282
  upperY: $,
4263
4283
  originY: R.position.y,
4264
4284
  modelSize: d,
4265
- meshColor: Vt,
4285
+ meshColor: Zt,
4266
4286
  displayUnit: D
4267
- }) : F(Be, {
4287
+ }) : F(Ee, {
4268
4288
  children: [
4269
- i(Eo, {
4270
- mesh: Ve ?? e,
4289
+ i(Vo, {
4290
+ mesh: Ne ?? e,
4271
4291
  startY: U,
4272
4292
  endY: $,
4273
- spacing: rt,
4293
+ spacing: lt,
4274
4294
  modelSize: d,
4275
4295
  onMeasurementsChange: Y,
4276
4296
  reverseOrder: true,
4277
4297
  displayUnit: D,
4278
- useInnerSurface: X && !Z,
4279
- formMeasurements: Te ? Pn ?? we : Ge ? we : void 0,
4280
- originY: xt ?? R.position.y,
4281
- wasmSlices: Le
4298
+ useInnerSurface: G && !Z,
4299
+ formMeasurements: Oe ? $n ?? Se : Ge ? Se : void 0,
4300
+ originY: vt ?? R.position.y,
4301
+ wasmSlices: Pe
4282
4302
  }),
4283
- i(Oo, {
4303
+ i(Yo, {
4284
4304
  mesh: e,
4285
- greenY: xt ?? R.position.y,
4305
+ greenY: vt ?? R.position.y,
4286
4306
  modelSize: d,
4287
4307
  displayUnit: D,
4288
- bottomY: X ? B.position.y : void 0,
4289
- formHeight: Te ? _n : Ge ? Xe == null ? void 0 : Xe.frontalHeight : void 0
4308
+ bottomY: G ? B.position.y : void 0,
4309
+ formHeight: Oe ? jn : Ge ? Ze == null ? void 0 : Ze.frontalHeight : void 0
4290
4310
  }),
4291
- i(Go, {
4311
+ i(Jo, {
4292
4312
  mesh: e,
4293
- yPosition: xt ?? R.position.y,
4294
- onYChange: (he) => {
4295
- Ot(he), ke(null);
4296
- const ve = he - R.position.y;
4297
- gt((mt ?? R.position.y + rt * 2) + ve);
4313
+ yPosition: vt ?? R.position.y,
4314
+ onYChange: (ge) => {
4315
+ Nt(ge), ke(null);
4316
+ const Ce = ge - R.position.y;
4317
+ wt((St ?? R.position.y + lt * 2) + Ce);
4298
4318
  },
4299
- minY: R.position.y - rt,
4300
- maxY: R.position.y + rt,
4319
+ minY: R.position.y - lt,
4320
+ maxY: R.position.y + lt,
4301
4321
  modelSize: d,
4302
4322
  color: "#44ff44",
4303
4323
  hoverColor: "#88ff88",
4304
4324
  dragColor: "#ffffff",
4305
- label: L === "AK" ? "IT" : "MPT",
4306
- onDragStart: () => Tt(true),
4307
- onDragEnd: () => Tt(false)
4325
+ label: P === "AK" ? "IT" : "MPT",
4326
+ onDragStart: () => Vt(true),
4327
+ onDragEnd: () => Vt(false)
4308
4328
  })
4309
4329
  ]
4310
4330
  });
4311
4331
  })(),
4312
- e && K && A === "3D" && _e && i(fr, {
4332
+ e && K && A === "3D" && De && i(xr, {
4313
4333
  mesh: e
4314
4334
  }),
4315
- e && t.showDebug && _e && A === "3D" && i(dr, {
4335
+ e && t.showDebug && De && A === "3D" && i(mr, {
4316
4336
  mesh: e,
4317
4337
  modelSize: d,
4318
- layers: $t,
4338
+ layers: Yt,
4319
4339
  landmarkPoints: T,
4320
4340
  componentDebug: null,
4321
- aoData: ge,
4341
+ aoData: me,
4322
4342
  aoGeometry: H,
4323
- measurementGeometry: me
4343
+ measurementGeometry: xe
4324
4344
  }),
4325
- i(gr, {
4326
- screenshotFnRef: Bn,
4345
+ i(Sr, {
4346
+ screenshotFnRef: Xn,
4327
4347
  mesh: e,
4328
4348
  modelSize: d,
4329
- measurementGeometry: me
4349
+ measurementGeometry: xe
4330
4350
  })
4331
4351
  ]
4332
4352
  })
@@ -4359,7 +4379,7 @@ let __tla = (async () => {
4359
4379
  children: "Start Over"
4360
4380
  }),
4361
4381
  !K && T.length >= 1 && i("button", {
4362
- onClick: En,
4382
+ onClick: Gn,
4363
4383
  style: {
4364
4384
  padding: "6px 16px",
4365
4385
  borderRadius: 4,
@@ -4375,8 +4395,8 @@ let __tla = (async () => {
4375
4395
  },
4376
4396
  children: "Reset Points"
4377
4397
  }),
4378
- K && !Qe && i("button", {
4379
- onClick: Vn,
4398
+ K && !nt && i("button", {
4399
+ onClick: Qn,
4380
4400
  style: {
4381
4401
  padding: "6px 16px",
4382
4402
  borderRadius: 4,
@@ -4394,13 +4414,13 @@ let __tla = (async () => {
4394
4414
  })
4395
4415
  ]
4396
4416
  }),
4397
- t.showDebug && _e && e && A === "3D" && i(pr, {
4398
- layers: $t,
4399
- onToggleLayer: (y) => kn((_) => ({
4417
+ t.showDebug && De && e && A === "3D" && i(yr, {
4418
+ layers: Yt,
4419
+ onToggleLayer: (y) => En((_) => ({
4400
4420
  ..._,
4401
4421
  [y]: !_[y]
4402
4422
  })),
4403
- isDoubleShell: X
4423
+ isDoubleShell: G
4404
4424
  }),
4405
4425
  K && N.length > 0 && F("div", {
4406
4426
  style: {
@@ -4422,7 +4442,7 @@ let __tla = (async () => {
4422
4442
  },
4423
4443
  children: [
4424
4444
  i("button", {
4425
- onClick: () => P("3D"),
4445
+ onClick: () => L("3D"),
4426
4446
  style: {
4427
4447
  padding: "6px 14px",
4428
4448
  fontSize: 13,
@@ -4436,7 +4456,7 @@ let __tla = (async () => {
4436
4456
  children: "Orbital"
4437
4457
  }),
4438
4458
  i("button", {
4439
- onClick: () => P("2D"),
4459
+ onClick: () => L("2D"),
4440
4460
  style: {
4441
4461
  padding: "6px 14px",
4442
4462
  fontSize: 13,
@@ -4532,7 +4552,7 @@ let __tla = (async () => {
4532
4552
  })
4533
4553
  ]
4534
4554
  }),
4535
- A === "3D" && we && i("div", {
4555
+ A === "3D" && Se && i("div", {
4536
4556
  style: {
4537
4557
  display: "flex",
4538
4558
  borderRadius: 6,
@@ -4541,7 +4561,7 @@ let __tla = (async () => {
4541
4561
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4542
4562
  },
4543
4563
  children: i("button", {
4544
- onClick: () => wt((y) => !y),
4564
+ onClick: () => Mt((y) => !y),
4545
4565
  style: {
4546
4566
  padding: "6px 14px",
4547
4567
  fontSize: 13,
@@ -4565,7 +4585,7 @@ let __tla = (async () => {
4565
4585
  },
4566
4586
  children: i("button", {
4567
4587
  onClick: async () => {
4568
- const y = await Ze();
4588
+ const y = await Ke();
4569
4589
  if (!y) return;
4570
4590
  const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), B = (R, U) => {
4571
4591
  const $ = document.createElement("a");
@@ -4595,13 +4615,13 @@ let __tla = (async () => {
4595
4615
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4596
4616
  },
4597
4617
  children: i("button", {
4598
- onClick: () => An((y) => !y),
4618
+ onClick: () => Bn((y) => !y),
4599
4619
  style: {
4600
4620
  padding: "6px 14px",
4601
4621
  fontSize: 13,
4602
- fontWeight: _e ? 600 : 400,
4603
- backgroundColor: _e ? "#e65100" : "#fff",
4604
- color: _e ? "#fff" : "#666",
4622
+ fontWeight: De ? 600 : 400,
4623
+ backgroundColor: De ? "#e65100" : "#fff",
4624
+ color: De ? "#fff" : "#666",
4605
4625
  border: "none",
4606
4626
  cursor: "pointer",
4607
4627
  fontFamily: "system-ui, sans-serif"
@@ -4611,19 +4631,19 @@ let __tla = (async () => {
4611
4631
  })
4612
4632
  ]
4613
4633
  }),
4614
- e && re && i(jo, {
4615
- wasAutoScaled: le,
4634
+ e && re && i(Zo, {
4635
+ wasAutoScaled: ae,
4616
4636
  onDismiss: () => ee(false)
4617
4637
  }),
4618
- e && be && K && i(Vo, {
4619
- isDoubleShell: X,
4638
+ e && ye && K && i(Ko, {
4639
+ isDoubleShell: G,
4620
4640
  onDismiss: () => oe(false)
4621
4641
  })
4622
4642
  ]
4623
4643
  })
4624
4644
  ]
4625
4645
  }),
4626
- Ce && F("div", {
4646
+ ze && F("div", {
4627
4647
  "data-finalizing-overlay": true,
4628
4648
  style: {
4629
4649
  position: "absolute",
@@ -4672,9 +4692,9 @@ let __tla = (async () => {
4672
4692
  flexShrink: 0
4673
4693
  },
4674
4694
  children: [
4675
- !Te && s && i("button", {
4676
- disabled: Ce,
4677
- onClick: () => St(true),
4695
+ !Oe && s && i("button", {
4696
+ disabled: ze,
4697
+ onClick: () => At(true),
4678
4698
  style: {
4679
4699
  padding: "6px 16px",
4680
4700
  borderRadius: 4,
@@ -4682,15 +4702,15 @@ let __tla = (async () => {
4682
4702
  fontWeight: 500,
4683
4703
  backgroundColor: "#fff",
4684
4704
  border: "1px solid #bdbdbd",
4685
- color: Ce ? "#999" : "#666",
4686
- cursor: Ce ? "not-allowed" : "pointer",
4705
+ color: ze ? "#999" : "#666",
4706
+ cursor: ze ? "not-allowed" : "pointer",
4687
4707
  fontFamily: "system-ui, sans-serif",
4688
4708
  letterSpacing: "0.4px",
4689
4709
  lineHeight: "36px"
4690
4710
  },
4691
4711
  children: "Have Galileo Check My Measurements"
4692
4712
  }),
4693
- Te && i("div", {}),
4713
+ Oe && i("div", {}),
4694
4714
  F("div", {
4695
4715
  style: {
4696
4716
  display: "flex",
@@ -4698,7 +4718,7 @@ let __tla = (async () => {
4698
4718
  },
4699
4719
  children: [
4700
4720
  e && !K && T.length >= 2 && i("button", {
4701
- onClick: jn,
4721
+ onClick: Jn,
4702
4722
  style: {
4703
4723
  padding: "6px 16px",
4704
4724
  borderRadius: 4,
@@ -4714,8 +4734,8 @@ let __tla = (async () => {
4714
4734
  },
4715
4735
  children: "Next \xBB"
4716
4736
  }),
4717
- K && Qe && !Te && i("button", {
4718
- onClick: () => Je(true),
4737
+ K && nt && !Oe && i("button", {
4738
+ onClick: () => tt(true),
4719
4739
  style: {
4720
4740
  padding: "6px 16px",
4721
4741
  borderRadius: 4,
@@ -4731,37 +4751,37 @@ let __tla = (async () => {
4731
4751
  },
4732
4752
  children: "Edit Measurements"
4733
4753
  }),
4734
- K && Qe && (Yn ? i("button", {
4735
- disabled: Ce,
4736
- onClick: () => Ft("continue"),
4754
+ K && nt && (to ? i("button", {
4755
+ disabled: ze,
4756
+ onClick: () => Dt("continue"),
4737
4757
  style: {
4738
4758
  padding: "6px 16px",
4739
4759
  borderRadius: 4,
4740
4760
  fontSize: 14,
4741
4761
  fontWeight: 500,
4742
- backgroundColor: Ce ? "#9e9e9e" : "rgb(12, 67, 173)",
4762
+ backgroundColor: ze ? "#9e9e9e" : "rgb(12, 67, 173)",
4743
4763
  border: "none",
4744
4764
  color: "#fff",
4745
- cursor: Ce ? "not-allowed" : "pointer",
4765
+ cursor: ze ? "not-allowed" : "pointer",
4746
4766
  fontFamily: "system-ui, sans-serif",
4747
4767
  letterSpacing: "0.4px",
4748
4768
  lineHeight: "36px"
4749
4769
  },
4750
4770
  children: "Continue"
4751
- }) : F(Be, {
4771
+ }) : F(Ee, {
4752
4772
  children: [
4753
4773
  i("button", {
4754
- disabled: Ce,
4755
- onClick: () => Ft("use_form_measurements"),
4774
+ disabled: ze,
4775
+ onClick: () => Dt("use_form_measurements"),
4756
4776
  style: {
4757
4777
  padding: "6px 16px",
4758
4778
  borderRadius: 4,
4759
4779
  fontSize: 14,
4760
4780
  fontWeight: 500,
4761
- backgroundColor: Ce ? "#9e9e9e" : "rgb(12, 67, 173)",
4781
+ backgroundColor: ze ? "#9e9e9e" : "rgb(12, 67, 173)",
4762
4782
  border: "none",
4763
4783
  color: "#fff",
4764
- cursor: Ce ? "not-allowed" : "pointer",
4784
+ cursor: ze ? "not-allowed" : "pointer",
4765
4785
  fontFamily: "system-ui, sans-serif",
4766
4786
  letterSpacing: "0.4px",
4767
4787
  lineHeight: "36px"
@@ -4769,17 +4789,17 @@ let __tla = (async () => {
4769
4789
  children: "Set to Measurements"
4770
4790
  }),
4771
4791
  i("button", {
4772
- disabled: Ce,
4773
- onClick: () => Ft("use_scan"),
4792
+ disabled: ze,
4793
+ onClick: () => Dt("use_scan"),
4774
4794
  style: {
4775
4795
  padding: "6px 16px",
4776
4796
  borderRadius: 4,
4777
4797
  fontSize: 14,
4778
4798
  fontWeight: 500,
4779
- backgroundColor: Ce ? "#e0e0e0" : "#fff",
4799
+ backgroundColor: ze ? "#e0e0e0" : "#fff",
4780
4800
  border: "1px solid #bdbdbd",
4781
- color: Ce ? "#999" : "#333",
4782
- cursor: Ce ? "not-allowed" : "pointer",
4801
+ color: ze ? "#999" : "#333",
4802
+ cursor: ze ? "not-allowed" : "pointer",
4783
4803
  fontFamily: "system-ui, sans-serif",
4784
4804
  letterSpacing: "0.4px",
4785
4805
  lineHeight: "36px"
@@ -4794,7 +4814,7 @@ let __tla = (async () => {
4794
4814
  })
4795
4815
  ]
4796
4816
  }),
4797
- a && vt.length > 0 && F("div", {
4817
+ a && kt.length > 0 && F("div", {
4798
4818
  style: {
4799
4819
  height: 120,
4800
4820
  flexShrink: 0,
@@ -4841,7 +4861,7 @@ let __tla = (async () => {
4841
4861
  },
4842
4862
  children: [
4843
4863
  "WASM ",
4844
- Oe.current ? "v2" : "N/A",
4864
+ $e.current ? "v2" : "N/A",
4845
4865
  " | ",
4846
4866
  T.length,
4847
4867
  " pts | ",
@@ -4852,7 +4872,7 @@ let __tla = (async () => {
4852
4872
  ]
4853
4873
  }),
4854
4874
  i("button", {
4855
- onClick: () => Nt([]),
4875
+ onClick: () => Kt([]),
4856
4876
  style: {
4857
4877
  background: "none",
4858
4878
  border: "1px solid #30363d",
@@ -4869,14 +4889,14 @@ let __tla = (async () => {
4869
4889
  ]
4870
4890
  }),
4871
4891
  i("div", {
4872
- ref: tt,
4892
+ ref: rt,
4873
4893
  style: {
4874
4894
  flex: 1,
4875
4895
  overflowY: "auto",
4876
4896
  padding: "4px 10px",
4877
4897
  lineHeight: 1.6
4878
4898
  },
4879
- children: vt.map((y, _) => {
4899
+ children: kt.map((y, _) => {
4880
4900
  const B = y.includes("ERROR") || y.includes("failed"), R = y.includes("warning") || y.includes("WARN"), U = y.includes("PIPELINE:"), $ = y.includes("STATE:");
4881
4901
  return i("div", {
4882
4902
  style: {
@@ -4891,21 +4911,21 @@ let __tla = (async () => {
4891
4911
  })
4892
4912
  ]
4893
4913
  }),
4894
- Fn && i(wn, {
4895
- onSkip: qt,
4896
- onCancel: () => St(false)
4914
+ Tn && i(Ln, {
4915
+ onSkip: tn,
4916
+ onCancel: () => At(false)
4897
4917
  })
4898
4918
  ]
4899
4919
  });
4900
4920
  };
4901
- function gr({ screenshotFnRef: t }) {
4921
+ function Sr({ screenshotFnRef: t }) {
4902
4922
  return q(() => {
4903
4923
  t.current = null;
4904
4924
  }, [
4905
4925
  t
4906
4926
  ]), null;
4907
4927
  }
4908
- zn = function(t) {
4928
+ Rn = function(t) {
4909
4929
  const r = t === "AK" ? 2 : 1, n = [];
4910
4930
  for (let o = 2; o >= 1; o -= r) n.push(`${o}_above`);
4911
4931
  n.push("at_ref");
@@ -4924,23 +4944,23 @@ let __tla = (async () => {
4924
4944
  ]) n.push(`${o}_below`);
4925
4945
  return n;
4926
4946
  };
4927
- ct = function(t, r) {
4928
- const n = zn(r), o = {};
4947
+ ht = function(t, r) {
4948
+ const n = Rn(r), o = {};
4929
4949
  for (let s = 0; s < Math.min(t.length, n.length); s++) {
4930
4950
  const a = t[s];
4931
4951
  a != null && !isNaN(a) && (o[n[s]] = a);
4932
4952
  }
4933
4953
  return o;
4934
4954
  };
4935
- mr = function(t, r) {
4955
+ vr = function(t, r) {
4936
4956
  if (!t) return;
4937
- const o = zn(r).map((s) => {
4957
+ const o = Rn(r).map((s) => {
4938
4958
  const a = t[s];
4939
4959
  return a ?? void 0;
4940
4960
  });
4941
4961
  if (!o.every((s) => s == null)) return o;
4942
4962
  };
4943
- kr = ({ request: t, onComplete: r, wasmModule: n }) => {
4963
+ _r = ({ request: t, onComplete: r, wasmModule: n }) => {
4944
4964
  const [o, s] = W(null);
4945
4965
  q(() => {
4946
4966
  if (n != null) return;
@@ -4962,23 +4982,23 @@ let __tla = (async () => {
4962
4982
  }, [
4963
4983
  n
4964
4984
  ]);
4965
- const a = n !== void 0 ? n : o ?? void 0, c = j(() => mr(t.form_measurements, t.spacing_type), [
4985
+ const a = n !== void 0 ? n : o ?? void 0, c = j(() => vr(t.form_measurements, t.spacing_type), [
4966
4986
  t.form_measurements,
4967
4987
  t.spacing_type
4968
4988
  ]), l = (e) => {
4969
4989
  var _a, _b;
4970
- const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = ct(m, t.spacing_type);
4990
+ const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = ht(m, t.spacing_type);
4971
4991
  let f, u;
4972
4992
  if (e.formMeasurements) {
4973
- f = ct(e.formMeasurements, t.spacing_type);
4974
- const A = e.scanMeasurements.map((P, v) => {
4993
+ f = ht(e.formMeasurements, t.spacing_type);
4994
+ const A = e.scanMeasurements.map((L, v) => {
4975
4995
  var _a2;
4976
4996
  const k = (_a2 = e.formMeasurements) == null ? void 0 : _a2[v];
4977
- return k == null || isNaN(k) ? null : +((P.modifiedValue ?? P.originalValue) - k).toFixed(1);
4997
+ return k == null || isNaN(k) ? null : +((L.modifiedValue ?? L.originalValue) - k).toFixed(1);
4978
4998
  });
4979
- u = ct(A, t.spacing_type);
4999
+ u = ht(A, t.spacing_type);
4980
5000
  }
4981
- const x = e.userEnteredMeasurements ? ct(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, S = e.decision === "use_scan" || e.decision === "continue", p = S ? d : x ?? f ?? d, g = S ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1), b = {
5001
+ const x = e.userEnteredMeasurements ? ht(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, S = e.decision === "use_scan" || e.decision === "continue", p = S ? d : x ?? f ?? d, g = S ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1), b = {
4982
5002
  spacing_type: t.spacing_type,
4983
5003
  source_unit: "mm",
4984
5004
  file_format: e.fileFormat,
@@ -5010,8 +5030,8 @@ let __tla = (async () => {
5010
5030
  height: "100%",
5011
5031
  display: "flex"
5012
5032
  },
5013
- children: i(hr, {
5014
- config: po,
5033
+ children: i(wr, {
5034
+ config: yo,
5015
5035
  spacingType: t.spacing_type,
5016
5036
  scanUrl: t.scan_url,
5017
5037
  formMeasurements: c,
@@ -5022,9 +5042,9 @@ let __tla = (async () => {
5022
5042
  };
5023
5043
  })();
5024
5044
  export {
5025
- kr as G,
5045
+ _r as G,
5026
5046
  __tla,
5027
- ct as a,
5028
- mr as c,
5029
- zn as g
5047
+ ht as a,
5048
+ vr as c,
5049
+ Rn as g
5030
5050
  };