@solid-labs/fab-one-widget 1.1.14 → 1.1.15

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,5 +1,5 @@
1
- import { jsxs as y, jsx as i, Fragment as _e } from "react/jsx-runtime";
2
- import { createContext as Wo, Component as $o, useCallback as de, useMemo as te, useState as $, memo as Bo, useEffect as Z, useRef as fe, forwardRef as To, createElement as Fn } from "react";
1
+ import { jsxs as y, jsx as l, Fragment as Re } from "react/jsx-runtime";
2
+ import { createContext as $o, Component as Wo, useCallback as de, useMemo as te, useState as W, memo as Bo, useEffect as Z, useRef as fe, forwardRef as To, createElement as Fn } from "react";
3
3
  import { useFrame as On, useThree as Hn, Canvas as Oo } from "@react-three/fiber";
4
4
  import { Html as Xe, Line as ve, OrbitControls as Nn } from "@react-three/drei";
5
5
  import * as U from "three";
@@ -10,9 +10,9 @@ import { STLLoader as Xn } from "three/examples/jsm/loaders/STLLoader.js";
10
10
  import { unzipSync as Vo } from "three/examples/jsm/libs/fflate.module.js";
11
11
  import { PLYLoader as jo } from "three/examples/jsm/loaders/PLYLoader.js";
12
12
  import { MeshBVH as zt } from "three-mesh-bvh";
13
- let bi, vt, oi, no, en;
13
+ let wi, St, ii, no, en;
14
14
  let __tla = (async () => {
15
- let Go, Xo, Yo, Ko, Zo, kt, Ut, St, Uo;
15
+ let Go, Xo, Yo, Ko, Zo, kt, Ut, Ct, Uo;
16
16
  Go = {
17
17
  showDragDrop: true,
18
18
  showStartOver: true,
@@ -33,7 +33,7 @@ let __tla = (async () => {
33
33
  showToolbar: false,
34
34
  showSaveButton: false
35
35
  };
36
- Yo = Wo(Go);
36
+ Yo = $o(Go);
37
37
  en = No((e, o) => ({
38
38
  landmarkPoints: [],
39
39
  isAligned: false,
@@ -45,7 +45,7 @@ let __tla = (async () => {
45
45
  ]
46
46
  }),
47
47
  removeLandmarkPoint: (t) => e((n) => ({
48
- landmarkPoints: n.landmarkPoints.filter((s, l) => l !== t)
48
+ landmarkPoints: n.landmarkPoints.filter((s, i) => i !== t)
49
49
  })),
50
50
  undoLastLandmarkPoint: () => e((t) => ({
51
51
  landmarkPoints: t.landmarkPoints.slice(0, -1)
@@ -56,9 +56,9 @@ let __tla = (async () => {
56
56
  isCut: false
57
57
  }),
58
58
  updateLandmarkPositions: (t) => e((n) => ({
59
- landmarkPoints: n.landmarkPoints.map((s, l) => ({
59
+ landmarkPoints: n.landmarkPoints.map((s, i) => ({
60
60
  ...s,
61
- position: t[l] ?? s.position
61
+ position: t[i] ?? s.position
62
62
  }))
63
63
  })),
64
64
  setAligned: (t) => e({
@@ -74,11 +74,11 @@ let __tla = (async () => {
74
74
  isCut: false
75
75
  })
76
76
  }));
77
- Ko = "1.1.14";
77
+ Ko = "1.1.15";
78
78
  Zo = 0.45;
79
79
  kt = 3;
80
80
  Ut = 1e-3;
81
- St = 25.4;
81
+ Ct = 25.4;
82
82
  Uo = [
83
83
  0.25,
84
84
  -0.25,
@@ -91,35 +91,35 @@ let __tla = (async () => {
91
91
  if (!o || !((_a = o[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
92
92
  const t = e.split(`
93
93
  `), n = [], s = [];
94
- let l = false;
94
+ let i = false;
95
95
  for (const d of t) if (d.startsWith("v ")) {
96
96
  const a = d.trim().split(/\s+/);
97
97
  if (a.length >= 7) {
98
98
  n.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3]));
99
99
  let r = parseFloat(a[4]), c = parseFloat(a[5]), u = parseFloat(a[6]);
100
- (r > 1 || c > 1 || u > 1) && (r /= 255, c /= 255, u /= 255), s.push(r, c, u), l = true;
100
+ (r > 1 || c > 1 || u > 1) && (r /= 255, c /= 255, u /= 255), s.push(r, c, u), i = true;
101
101
  } else a.length >= 4 && (n.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), s.push(0, 0, 0));
102
102
  }
103
- return l ? {
103
+ return i ? {
104
104
  positions: new Float32Array(n),
105
105
  colors: new Float32Array(s)
106
106
  } : null;
107
107
  }
108
108
  function Jo(e, o, t, n) {
109
- const s = e.getAttribute("position"), l = s.count, d = new Float32Array(l * 3), a = o.length / 3;
109
+ const s = e.getAttribute("position"), i = s.count, d = new Float32Array(i * 3), a = o.length / 3;
110
110
  let r = 1 / 0, c = 1 / 0, u = 1 / 0, p = -1 / 0, f = -1 / 0, h = -1 / 0;
111
111
  for (let I = 0; I < a; I++) {
112
- const _ = o[I * 3] * n, B = o[I * 3 + 1] * n, X = o[I * 3 + 2] * n;
113
- _ < r && (r = _), _ > p && (p = _), B < c && (c = B), B > f && (f = B), X < u && (u = X), X > h && (h = X);
112
+ const D = o[I * 3] * n, B = o[I * 3 + 1] * n, X = o[I * 3 + 2] * n;
113
+ D < r && (r = D), D > p && (p = D), B < c && (c = B), B > f && (f = B), X < u && (u = X), X > h && (h = X);
114
114
  }
115
- const w = (r + p) * 0.5, g = (c + f) * 0.5, b = (u + h) * 0.5, A = p - r + 1e-6, v = f - c + 1e-6, x = h - u + 1e-6, F = A * 0.5, S = v * 0.5, C = x * 0.5, M = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), E = A / M, W = v / M, N = x / M, P = /* @__PURE__ */ new Map();
115
+ const w = (r + p) * 0.5, g = (c + f) * 0.5, b = (u + h) * 0.5, A = p - r + 1e-6, v = f - c + 1e-6, x = h - u + 1e-6, F = A * 0.5, S = v * 0.5, C = x * 0.5, M = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), E = A / M, $ = v / M, N = x / M, P = /* @__PURE__ */ new Map();
116
116
  for (let I = 0; I < a; I++) {
117
- const _ = o[I * 3] * n - w, B = o[I * 3 + 1] * n - g, X = o[I * 3 + 2] * n - b, oe = Math.min(M - 1, Math.max(0, Math.floor((_ + F) / E))), ce = Math.min(M - 1, Math.max(0, Math.floor((B + S) / W))), se = Math.min(M - 1, Math.max(0, Math.floor((X + C) / N))), J = oe * M * M + ce * M + se;
117
+ const D = o[I * 3] * n - w, B = o[I * 3 + 1] * n - g, X = o[I * 3 + 2] * n - b, oe = Math.min(M - 1, Math.max(0, Math.floor((D + F) / E))), ce = Math.min(M - 1, Math.max(0, Math.floor((B + S) / $))), se = Math.min(M - 1, Math.max(0, Math.floor((X + C) / N))), J = oe * M * M + ce * M + se;
118
118
  let ae = P.get(J);
119
119
  ae || (ae = [], P.set(J, ae)), ae.push(I);
120
120
  }
121
- for (let I = 0; I < l; I++) {
122
- const _ = s.getX(I), B = s.getY(I), X = s.getZ(I), oe = Math.min(M - 1, Math.max(0, Math.floor((_ + F) / E))), ce = Math.min(M - 1, Math.max(0, Math.floor((B + S) / W))), se = Math.min(M - 1, Math.max(0, Math.floor((X + C) / N)));
121
+ for (let I = 0; I < i; I++) {
122
+ const D = s.getX(I), B = s.getY(I), X = s.getZ(I), oe = Math.min(M - 1, Math.max(0, Math.floor((D + F) / E))), ce = Math.min(M - 1, Math.max(0, Math.floor((B + S) / $))), se = Math.min(M - 1, Math.max(0, Math.floor((X + C) / N)));
123
123
  let J = 1 / 0, ae = 0;
124
124
  for (let q = 0; q <= M && J > 0; q++) {
125
125
  for (let ge = -q; ge <= q; ge++) for (let re = -q; re <= q; re++) for (let R = -q; R <= q; R++) {
@@ -128,7 +128,7 @@ let __tla = (async () => {
128
128
  if (H < 0 || H >= M || ne < 0 || ne >= M || Q < 0 || Q >= M) continue;
129
129
  const j = P.get(H * M * M + ne * M + Q);
130
130
  if (j) for (const K of j) {
131
- const ue = o[K * 3] * n - w, ie = o[K * 3 + 1] * n - g, pe = o[K * 3 + 2] * n - b, he = (_ - ue) ** 2 + (B - ie) ** 2 + (X - pe) ** 2;
131
+ const ue = o[K * 3] * n - w, ie = o[K * 3 + 1] * n - g, pe = o[K * 3 + 2] * n - b, he = (D - ue) ** 2 + (B - ie) ** 2 + (X - pe) ** 2;
132
132
  he < J && (J = he, ae = K);
133
133
  }
134
134
  }
@@ -153,21 +153,21 @@ let __tla = (async () => {
153
153
  Kn = e;
154
154
  },
155
155
  debug(e, o, t) {
156
- yt("debug", e, o, t);
156
+ wt("debug", e, o, t);
157
157
  },
158
158
  info(e, o, t) {
159
- yt("info", e, o, t);
159
+ wt("info", e, o, t);
160
160
  },
161
161
  warn(e, o, t) {
162
- yt("warn", e, o, t);
162
+ wt("warn", e, o, t);
163
163
  },
164
164
  error(e, o, t) {
165
- yt("error", e, o, t);
165
+ wt("error", e, o, t);
166
166
  }
167
167
  };
168
- function yt(e, o, t, n) {
168
+ function wt(e, o, t, n) {
169
169
  if (Ln[e] < Ln[Yn]) return;
170
- const s = `[${o}]`, l = n !== void 0 ? [
170
+ const s = `[${o}]`, i = n !== void 0 ? [
171
171
  s,
172
172
  t,
173
173
  n
@@ -177,23 +177,23 @@ let __tla = (async () => {
177
177
  ];
178
178
  switch (e) {
179
179
  case "debug":
180
- console.debug(...l);
180
+ console.debug(...i);
181
181
  break;
182
182
  case "info":
183
- console.log(...l);
183
+ console.log(...i);
184
184
  break;
185
185
  case "warn":
186
- console.warn(...l);
186
+ console.warn(...i);
187
187
  break;
188
188
  case "error":
189
- console.error(...l);
189
+ console.error(...i);
190
190
  break;
191
191
  }
192
192
  Kn == null ? void 0 : Kn(e, o, t, n);
193
193
  }
194
- const Ct = "[fab-one]";
195
- function Ee(e, o) {
196
- console.log(Ct, e);
194
+ const Ye = "[fab-one]";
195
+ function Fe(e, o) {
196
+ console.log(Ye, e);
197
197
  }
198
198
  function Qo() {
199
199
  try {
@@ -210,26 +210,48 @@ let __tla = (async () => {
210
210
  }
211
211
  function er(e) {
212
212
  const o = typeof window < "u" && window.__THREE__ !== void 0 && window.__THREE__ !== U.REVISION;
213
- Ee(`widget version: ${Ko}`), Ee(`three.js revision: ${U.REVISION}` + (typeof window < "u" ? ` (window.__THREE__=${window.__THREE__ ?? "unset"})` : "")), o && console.error(Ct, `MULTIPLE three.js instances detected. The host app bundles a different three.js revision (${window.__THREE__}) than the widget (${U.REVISION}). This corrupts geometry/BVH and renders broken meshes. Dedupe three.js to a single copy.`), Ee(`wasm module: ${e ? "loaded" : "MISSING (JS fallback \u2014 no weld/hole-fill)"}`), e || console.warn(Ct, "WASM module not available. The widget will fall back to the raw OBJ loader, which skips welding and hole-filling and can render low-poly/broken. Check that geo_wasm_bg.wasm is served (correct path + 'application/wasm' MIME, not blocked by CSP).");
213
+ Fe(`widget version: ${Ko}`), Fe(`three.js revision: ${U.REVISION}` + (typeof window < "u" ? ` (window.__THREE__=${window.__THREE__ ?? "unset"})` : "")), o && console.error(Ye, `MULTIPLE three.js instances detected. The host app bundles a different three.js revision (${window.__THREE__}) than the widget (${U.REVISION}). This corrupts geometry/BVH and renders broken meshes. Dedupe three.js to a single copy.`), Fe(`wasm module: ${e ? "loaded" : "MISSING (JS fallback \u2014 no weld/hole-fill)"}`), e || console.warn(Ye, "WASM module not available. The widget will fall back to the raw OBJ loader, which skips welding and hole-filling and can render low-poly/broken. Check that geo_wasm_bg.wasm is served (correct path + 'application/wasm' MIME, not blocked by CSP).");
214
214
  const n = Qo();
215
- if (Ee(`webgl: ${n ? `${n.renderer} | ${n.version}` : "UNAVAILABLE"}`), typeof navigator < "u") {
215
+ if (Fe(`webgl: ${n ? `${n.renderer} | ${n.version}` : "UNAVAILABLE"}`), typeof navigator < "u") {
216
216
  const s = navigator;
217
- Ee(`browser: ${s.userAgent}`), Ee(`device: cores=${s.hardwareConcurrency ?? "?"} memoryGB=${s.deviceMemory ?? "?"} dpr=${typeof window < "u" ? window.devicePixelRatio : "?"}`);
217
+ Fe(`browser: ${s.userAgent}`), Fe(`device: cores=${s.hardwareConcurrency ?? "?"} memoryGB=${s.deviceMemory ?? "?"} dpr=${typeof window < "u" ? window.devicePixelRatio : "?"}`);
218
218
  }
219
219
  }
220
- function Dn(e, o, t) {
221
- Ee(`mesh @ ${e}: vertices=${o} triangles=${t}`);
220
+ function _n(e, o, t) {
221
+ Fe(`mesh @ ${e}: vertices=${o} triangles=${t}`);
222
222
  }
223
223
  function tr(e) {
224
- let o = 1 / 0, t = 1 / 0, n = 1 / 0, s = -1 / 0, l = -1 / 0, d = -1 / 0;
224
+ let o = 1 / 0, t = 1 / 0, n = 1 / 0, s = -1 / 0, i = -1 / 0, d = -1 / 0;
225
225
  for (let u = 0; u < e.length; u += 3) {
226
226
  const p = e[u], f = e[u + 1], h = e[u + 2];
227
- p < o && (o = p), p > s && (s = p), f < t && (t = f), f > l && (l = f), h < n && (n = h), h > d && (d = h);
227
+ p < o && (o = p), p > s && (s = p), f < t && (t = f), f > i && (i = f), h < n && (n = h), h > d && (d = h);
228
228
  }
229
229
  const a = (u) => u.toFixed(1);
230
- Ee(`abs bounds: x[${a(o)}, ${a(s)}] y[${a(t)}, ${a(l)}] z[${a(n)}, ${a(d)}]`);
231
- const r = Math.max(Math.abs(o), Math.abs(s), Math.abs(t), Math.abs(l), Math.abs(n), Math.abs(d)), c = r * Math.pow(2, -23);
232
- Ee(`origin offset: max|coord|=${a(r)}mm \u2192 float32 resolution \u2248 ${c.toFixed(4)}mm`), c > 0.05 && console.warn(Ct, `Scan is positioned far from origin (max|coord|=${a(r)}mm). float32 resolution there is only ~${c.toFixed(3)}mm, which collapses fine geometry during welding. Re-export the scan centered on the origin to fix this.`);
230
+ Fe(`abs bounds: x[${a(o)}, ${a(s)}] y[${a(t)}, ${a(i)}] z[${a(n)}, ${a(d)}]`);
231
+ const r = Math.max(Math.abs(o), Math.abs(s), Math.abs(t), Math.abs(i), Math.abs(n), Math.abs(d)), c = r * Math.pow(2, -23);
232
+ Fe(`origin offset: max|coord|=${a(r)}mm \u2192 float32 resolution \u2248 ${c.toFixed(4)}mm`), c > 0.05 && console.warn(Ye, `Scan is positioned far from origin (max|coord|=${a(r)}mm). float32 resolution there is only ~${c.toFixed(3)}mm, which collapses fine geometry during welding. Re-export the scan centered on the origin to fix this.`);
233
+ }
234
+ function nr(e) {
235
+ const o = e.length / 3, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
236
+ for (let i = 0; i < e.length; i += 3) t.add(`${e[i]},${e[i + 1]},${e[i + 2]}`), n.add(e[i]);
237
+ Fe(`distinct vertices: ${t.size} of ${o} (distinct X values: ${n.size})`);
238
+ const s = [];
239
+ for (let i = 0; i < Math.min(e.length, 18); i += 3) s.push(`(${e[i]}, ${e[i + 1]}, ${e[i + 2]})`);
240
+ Fe(`first vertices: ${s.join(" ")}`), o > 5e3 && t.size < o * 0.01 && console.warn(Ye, `Mesh has ${o} vertices but only ${t.size} distinct positions. The geometry was quantized upstream (look at 'first vertices' above for low-decimal values). Pass full-precision coordinates to the widget, or send coordinates in millimeters rather than meters.`);
241
+ }
242
+ function or(e) {
243
+ const o = e;
244
+ if (!o || typeof o.preprocess_mesh != "function") return true;
245
+ const t = 81, n = new Float32Array(t * 3);
246
+ for (let i = 0; i < t; i++) n[i * 3] = i * 2, n[i * 3 + 1] = i % 2 * 5, n[i * 3 + 2] = 0;
247
+ const s = new Uint32Array((t - 2) * 3);
248
+ for (let i = 0; i < t - 2; i++) s[i * 3] = i, s[i * 3 + 1] = i + 1, s[i * 3 + 2] = i + 2;
249
+ try {
250
+ const d = o.preprocess_mesh(n, s, 10, 100, 1e-4, 500).positions().length / 3;
251
+ return d < t * 0.5 ? (console.error(Ye, `WASM ABI mismatch: an ${t}-vertex probe collapsed to ${d} vertices. The loaded geo_wasm_bg.wasm is a STALE build whose parameters don't match this JavaScript bundle, so the weld tolerance is misread (~100mm) and every scan collapses to a low-poly blob. Redeploy geo_wasm_bg.wasm so it matches the widget bundle (cache-bust the served asset).`), false) : (Fe(`wasm ABI check: OK (${t}-vertex probe \u2192 ${d} vertices)`), true);
252
+ } catch (i) {
253
+ return console.warn(Ye, "WASM ABI check could not run", i), true;
254
+ }
233
255
  }
234
256
  function At(e) {
235
257
  const o = e.getAttribute("position"), t = new Float32Array(o.array), n = e.getIndex();
@@ -237,28 +259,28 @@ let __tla = (async () => {
237
259
  positions: t,
238
260
  indices: new Uint32Array(n.array)
239
261
  };
240
- const s = t.length / 3, l = new Uint32Array(s);
241
- for (let d = 0; d < s; d++) l[d] = d;
262
+ const s = t.length / 3, i = new Uint32Array(s);
263
+ for (let d = 0; d < s; d++) i[d] = d;
242
264
  return {
243
265
  positions: t,
244
- indices: l
266
+ indices: i
245
267
  };
246
268
  }
247
269
  function Zn(e, o) {
248
270
  const t = new U.BufferGeometry();
249
271
  return t.setAttribute("position", new U.Float32BufferAttribute(e, 3)), t.setIndex(new U.BufferAttribute(o, 1)), t.computeVertexNormals(), t;
250
272
  }
251
- async function nr(e, o, t) {
273
+ async function rr(e, o, t) {
252
274
  try {
253
275
  const n = qo(e);
254
276
  t == null ? void 0 : t("Parsing mesh...");
255
- const l = new Gn().parse(e);
277
+ const i = new Gn().parse(e);
256
278
  let d = null;
257
- if (l.traverse((x) => {
279
+ if (i.traverse((x) => {
258
280
  x.isMesh && !d && (d = x.geometry);
259
281
  }), !d) return null;
260
282
  const { positions: a, indices: r } = At(d);
261
- if (Dn("pre-wasm (parsed)", a.length / 3, r.length / 3), tr(a), a.length < 9 || r.length < 3) return xe.warn("wasm", `Mesh too small: positions=${a.length} indices=${r.length}`), null;
283
+ if (_n("pre-wasm (parsed)", a.length / 3, r.length / 3), tr(a), nr(a), a.length < 9 || r.length < 3) return xe.warn("wasm", `Mesh too small: positions=${a.length} indices=${r.length}`), null;
262
284
  for (let x = 0; x < Math.min(a.length, 300); x++) if (!isFinite(a[x])) return xe.error("wasm", `Invalid position data: NaN/Infinity at index ${x}`), null;
263
285
  const c = a.length / 3;
264
286
  for (let x = 0; x < Math.min(r.length, 300); x++) if (r[x] >= c) return xe.error("wasm", `Out-of-bounds index: ${r[x]} >= ${c}`), null;
@@ -266,7 +288,7 @@ let __tla = (async () => {
266
288
  const u = o.preprocess_mesh(a, r, 10, 100, 1e-4, 500), p = u.positions(), f = u.indices(), h = u.unit_converted(), w = u.detected_unit(), g = u.log();
267
289
  xe.debug("wasm", "preprocess result", g);
268
290
  const b = r.length / 3, A = f.length / 3;
269
- if (Dn("post-wasm (welded)", p.length / 3, A), Ee(`wasm preprocess: unit=${w} scaled=${h} | log: ${g}`), b > 0 && A < b * 0.5 && console.warn("[fab-one]", `Triangle count dropped >50% during weld (${b} -> ${A}). Likely unit misdetection or coordinate-precision collapse \u2014 this is what 'low-poly/broken' looks like.`), p.length === 0) return null;
291
+ if (_n("post-wasm (welded)", p.length / 3, A), Fe(`wasm preprocess: unit=${w} scaled=${h} | log: ${g}`), b > 0 && A < b * 0.5 && console.warn("[fab-one]", `Triangle count dropped >50% during weld (${b} -> ${A}). Likely unit misdetection or coordinate-precision collapse \u2014 this is what 'low-poly/broken' looks like.`), p.length === 0) return null;
270
292
  t == null ? void 0 : t("Building geometry...");
271
293
  const v = Zn(p, f);
272
294
  if (n) {
@@ -283,14 +305,14 @@ let __tla = (async () => {
283
305
  return xe.error("wasm", "Processing failed", n), null;
284
306
  }
285
307
  }
286
- function or(e) {
308
+ function ir(e) {
287
309
  const t = new Gn().parse(e);
288
310
  let n = null;
289
311
  return t.traverse((s) => {
290
312
  s.isMesh && !n && (n = s.geometry);
291
313
  }), n;
292
314
  }
293
- function rr(e) {
315
+ function sr(e) {
294
316
  if (e.byteLength < 84) return false;
295
317
  const t = new DataView(e).getUint32(80, true);
296
318
  return e.byteLength === 84 + t * 50;
@@ -306,16 +328,16 @@ let __tla = (async () => {
306
328
  return t.join(`
307
329
  `);
308
330
  }
309
- async function _n(e) {
310
- const o = await e.arrayBuffer(), t = rr(o), n = new TextDecoder().decode(o.slice(0, 5)), l = new Xn().parse(o), d = l.getAttribute("position"), a = d ? d.count / 3 : 0;
311
- return Ee(`STL parsed: ${(o.byteLength / 1024).toFixed(0)}KB, format=${t ? "binary" : "ascii"}, header="${n}", triangles=${a}`), t && n.toLowerCase() === "solid" && console.warn("[fab-one]", "Binary STL with 'solid' header \u2014 known STLLoader edge case; verify geometry parsed correctly."), qt(l);
331
+ async function Dn(e) {
332
+ const o = await e.arrayBuffer(), t = sr(o), n = new TextDecoder().decode(o.slice(0, 5)), i = new Xn().parse(o), d = i.getAttribute("position"), a = d ? d.count / 3 : 0;
333
+ return Fe(`STL parsed: ${(o.byteLength / 1024).toFixed(0)}KB, format=${t ? "binary" : "ascii"}, header="${n}", triangles=${a}`), t && n.toLowerCase() === "solid" && console.warn("[fab-one]", "Binary STL with 'solid' header \u2014 known STLLoader edge case; verify geometry parsed correctly."), qt(i);
312
334
  }
313
335
  const Jt = "aop";
314
- async function ir(e) {
336
+ async function lr(e) {
315
337
  const o = await e.arrayBuffer(), t = new Uint8Array(o);
316
- return t.length > 3 && t[0] === 80 && t[1] === 75 && (t[2] === 3 || t[2] === 5 || t[2] === 7) ? sr(t) : (xe.warn(Jt, "AOP payload is not a ZIP container \u2014 sniffing as a bare mesh"), Un(t, e.name));
338
+ return t.length > 3 && t[0] === 80 && t[1] === 75 && (t[2] === 3 || t[2] === 5 || t[2] === 7) ? ar(t) : (xe.warn(Jt, "AOP payload is not a ZIP container \u2014 sniffing as a bare mesh"), Un(t, e.name));
317
339
  }
318
- function sr(e) {
340
+ function ar(e) {
319
341
  let o;
320
342
  try {
321
343
  o = Vo(e);
@@ -330,8 +352,8 @@ let __tla = (async () => {
330
352
  ".stl"
331
353
  ];
332
354
  for (const s of n) {
333
- const l = t.find((d) => d.toLowerCase().endsWith(s) && o[d] && o[d].length > 0);
334
- if (l) return xe.debug(Jt, `Using mesh entry "${l}" from AOP archive`), Un(o[l], l);
355
+ const i = t.find((d) => d.toLowerCase().endsWith(s) && o[d] && o[d].length > 0);
356
+ if (i) return xe.debug(Jt, `Using mesh entry "${i}" from AOP archive`), Un(o[i], i);
335
357
  }
336
358
  throw new Error(`No mesh found inside the .aop file (looked for .obj/.ply/.stl). Archive contained: ${t.join(", ") || "no files"}`);
337
359
  }
@@ -343,20 +365,20 @@ let __tla = (async () => {
343
365
  const d = new jo().parse(s);
344
366
  return qt(d);
345
367
  }
346
- const l = new Xn().parse(s);
347
- return qt(l);
368
+ const i = new Xn().parse(s);
369
+ return qt(i);
348
370
  }
349
- function lr(e, o) {
371
+ function cr(e, o) {
350
372
  const t = 1 / o;
351
373
  return `${Math.round(e.x * t)}_${Math.round(e.y * t)}_${Math.round(e.z * t)}`;
352
374
  }
353
- function ar(e, o) {
375
+ function dr(e, o) {
354
376
  if (!e.length) return [];
355
377
  const t = [];
356
378
  for (const n of e) (t.length === 0 || t[t.length - 1].distanceTo(n) > o) && t.push(n.clone());
357
379
  return t.length > 2 && t[0].distanceTo(t[t.length - 1]) > o && t.push(t[0].clone()), t;
358
380
  }
359
- function qe(e) {
381
+ function Je(e) {
360
382
  let o = 0;
361
383
  for (let t = 0; t < e.length - 1; t++) o += e[t].distanceTo(e[t + 1]);
362
384
  return o;
@@ -364,38 +386,38 @@ let __tla = (async () => {
364
386
  function qn(e, o = 1e-3, t = false) {
365
387
  if (!e.length) return [];
366
388
  const n = /* @__PURE__ */ new Map(), s = (p) => {
367
- const f = lr(p, o);
389
+ const f = cr(p, o);
368
390
  let h = n.get(f);
369
391
  return h || (h = p.clone(), n.set(f, h)), h;
370
- }, l = e.map((p) => ({
392
+ }, i = e.map((p) => ({
371
393
  a: s(p.a),
372
394
  b: s(p.b)
373
395
  })), d = [];
374
- for (; l.length; ) {
375
- const p = l.pop(), f = [
396
+ for (; i.length; ) {
397
+ const p = i.pop(), f = [
376
398
  p.a,
377
399
  p.b
378
400
  ];
379
401
  let h = true;
380
402
  for (; h; ) {
381
403
  h = false;
382
- for (let g = l.length - 1; g >= 0; g--) {
383
- const { a: b, b: A } = l[g];
404
+ for (let g = i.length - 1; g >= 0; g--) {
405
+ const { a: b, b: A } = i[g];
384
406
  if (b.equals(f[f.length - 1])) f.push(A);
385
407
  else if (A.equals(f[f.length - 1])) f.push(b);
386
408
  else if (b.equals(f[0])) f.unshift(A);
387
409
  else if (A.equals(f[0])) f.unshift(b);
388
410
  else continue;
389
- l.splice(g, 1), h = true;
411
+ i.splice(g, 1), h = true;
390
412
  }
391
413
  }
392
- const w = ar(f, o);
414
+ const w = dr(f, o);
393
415
  w.length > 1 && d.push(w);
394
416
  }
395
417
  if (!d.length) return [];
396
418
  if (t) {
397
- d.sort((h, w) => qe(w) - qe(h));
398
- const p = qe(d[0]), f = d.filter((h) => qe(h) >= p * 0.3);
419
+ d.sort((h, w) => Je(w) - Je(h));
420
+ const p = Je(d[0]), f = d.filter((h) => Je(h) >= p * 0.3);
399
421
  return f[f.length - 1] ?? d[0];
400
422
  }
401
423
  const a = d.filter((p) => p.length >= 3 && p[0].distanceTo(p[p.length - 1]) < o * 10), r = a.length > 0 ? a : d;
@@ -411,7 +433,7 @@ let __tla = (async () => {
411
433
  return c;
412
434
  }
413
435
  function Rn(e, o, t, n = false) {
414
- const s = new Mt(new k(0, 1, 0), -t), l = [], d = new Vn();
436
+ const s = new Mt(new k(0, 1, 0), -t), i = [], d = new Vn();
415
437
  d.setFromBufferAttribute(o.getAttribute("position"));
416
438
  const a = {
417
439
  linePoints: [],
@@ -424,15 +446,15 @@ let __tla = (async () => {
424
446
  intersectsBounds: (g) => s.intersectsBox(g),
425
447
  intersectsTriangle: (g) => {
426
448
  const b = [];
427
- r.set(g.a, g.b), s.intersectLine(r, c) && b.push(c.clone()), r.set(g.b, g.c), s.intersectLine(r, c) && b.push(c.clone()), r.set(g.c, g.a), s.intersectLine(r, c) && b.push(c.clone()), b.length === 2 && l.push({
449
+ r.set(g.a, g.b), s.intersectLine(r, c) && b.push(c.clone()), r.set(g.b, g.c), s.intersectLine(r, c) && b.push(c.clone()), r.set(g.c, g.a), s.intersectLine(r, c) && b.push(c.clone()), b.length === 2 && i.push({
428
450
  a: b[0],
429
451
  b: b[1]
430
452
  });
431
453
  }
432
454
  });
433
- const u = qn(l, Ut, n);
455
+ const u = qn(i, Ut, n);
434
456
  if (u.length < 2) return a;
435
- const p = qe(u);
457
+ const p = Je(u);
436
458
  let f = -1 / 0, h = new k(0, t, 0);
437
459
  for (const g of u) g.x > f && (f = g.x, h = g.clone());
438
460
  const w = u.length > 2 && u[0].distanceTo(u[u.length - 1]) < Ut * 10;
@@ -447,17 +469,17 @@ let __tla = (async () => {
447
469
  const s = Rn(e, o, t, n);
448
470
  if (s.isClosed && s.linePoints.length >= 3) return s;
449
471
  xe.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
450
- let l = s;
472
+ let i = s;
451
473
  for (const d of Uo) {
452
474
  const a = Rn(e, o, t + d, n);
453
475
  if (a.isClosed && a.linePoints.length >= 3) return xe.debug("slice", `y=${t.toFixed(2)} recovered with offset ${d > 0 ? "+" : ""}${d}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
454
- a.linePoints.length > l.linePoints.length && (l = a);
476
+ a.linePoints.length > i.linePoints.length && (i = a);
455
477
  }
456
- return xe.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${l.linePoints.length}, closed=${l.isClosed})`), l;
478
+ return xe.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${i.linePoints.length}, closed=${i.isClosed})`), i;
457
479
  }
458
- function cr(e, o, t, n) {
459
- const s = new Mt().setFromNormalAndCoplanarPoint(n.clone().normalize(), t), l = new Vn();
460
- if (l.setFromBufferAttribute(o.getAttribute("position")), !s.intersectsBox(l)) return 0;
480
+ function fr(e, o, t, n) {
481
+ const s = new Mt().setFromNormalAndCoplanarPoint(n.clone().normalize(), t), i = new Vn();
482
+ if (i.setFromBufferAttribute(o.getAttribute("position")), !s.intersectsBox(i)) return 0;
461
483
  const d = [], a = new jn(), r = new k();
462
484
  e.shapecast({
463
485
  intersectsBounds: (u) => s.intersectsBox(u),
@@ -470,18 +492,18 @@ let __tla = (async () => {
470
492
  }
471
493
  });
472
494
  const c = qn(d, Ut);
473
- return qe(c);
495
+ return Je(c);
474
496
  }
475
497
  function Qt(e) {
476
498
  return new zt(e, {
477
499
  maxLeafTris: kt
478
500
  });
479
501
  }
480
- function dr(e, o, t, n) {
481
- const s = e.getIndex(), l = s ? s.count / 3 : 0;
482
- if (l < 10) return {
502
+ function ur(e, o, t, n) {
503
+ const s = e.getIndex(), i = s ? s.count / 3 : 0;
504
+ if (i < 10) return {
483
505
  valid: false,
484
- reason: `Geometry is empty or degenerate (${l} faces)`
506
+ reason: `Geometry is empty or degenerate (${i} faces)`
485
507
  };
486
508
  const d = o - t;
487
509
  if (d < 4) return {
@@ -529,13 +551,13 @@ let __tla = (async () => {
529
551
  };
530
552
  }
531
553
  const De = "pipeline";
532
- function fr(e, o, t, n) {
554
+ function pr(e, o, t, n) {
533
555
  var _a, _b, _c, _d;
534
- const s = e.geometry.clone(), l = o.map((a) => ({
556
+ const s = e.geometry.clone(), i = o.map((a) => ({
535
557
  ...a
536
558
  })), d = n.wasmModule;
537
559
  try {
538
- let a = e.geometry, r = l.map((j) => new k(j.position.x, j.position.y, j.position.z));
560
+ let a = e.geometry, r = i.map((j) => new k(j.position.x, j.position.y, j.position.z));
539
561
  const c = r[0], u = r[1];
540
562
  if (!d) {
541
563
  n.onStatus("Aligning mesh (JS fallback)..."), xe.warn(De, "WASM not available, using JS fallback alignment");
@@ -543,11 +565,11 @@ let __tla = (async () => {
543
565
  if (ie.length() > 1e-4) {
544
566
  ie.normalize();
545
567
  const T = new U.Quaternion().setFromAxisAngle(ie, Math.acos(Math.min(1, Math.max(-1, ue))));
546
- a.applyMatrix4(new U.Matrix4().makeRotationFromQuaternion(T)), r = r.map((Le) => Le.clone().applyQuaternion(T));
568
+ a.applyMatrix4(new U.Matrix4().makeRotationFromQuaternion(T)), r = r.map((_e) => _e.clone().applyQuaternion(T));
547
569
  }
548
570
  if (r[0].y > r[1].y) {
549
571
  const T = new U.Quaternion().setFromAxisAngle(new k(1, 0, 0), Math.PI);
550
- a.applyMatrix4(new U.Matrix4().makeRotationFromQuaternion(T)), r = r.map((Le) => Le.clone().applyQuaternion(T));
572
+ a.applyMatrix4(new U.Matrix4().makeRotationFromQuaternion(T)), r = r.map((_e) => _e.clone().applyQuaternion(T));
551
573
  }
552
574
  const pe = r[0].clone();
553
575
  a.translate(-pe.x, -pe.y, -pe.z), r = r.map((T) => new k(T.x - pe.x, T.y - pe.y, T.z - pe.z)), a.computeVertexNormals(), a.computeBoundingBox();
@@ -573,7 +595,7 @@ let __tla = (async () => {
573
595
  x: T.x,
574
596
  y: T.y,
575
597
  z: T.z
576
- }))), n.setAligned(true), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * St);
598
+ }))), n.setAligned(true), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * Ct);
577
599
  const Se = new k();
578
600
  a.computeBoundingBox(), a.boundingBox.getSize(Se), n.setModelSize(Math.max(Se.x, Se.y, Se.z)), s.dispose();
579
601
  return;
@@ -601,7 +623,7 @@ let __tla = (async () => {
601
623
  F[1],
602
624
  F[2]
603
625
  ]), C = d.align_to_origin(p, h, w, S);
604
- let M = C.positions(), E = C.mpt(), W = C.origin();
626
+ let M = C.positions(), E = C.mpt(), $ = C.origin();
605
627
  const N = C.transform();
606
628
  xe.info(De, "Alignment complete", C.details());
607
629
  const P = [
@@ -620,9 +642,9 @@ let __tla = (async () => {
620
642
  P[6] * F[0] + P[7] * F[1] + P[8] * F[2]
621
643
  ]);
622
644
  n.onStatus("Generating measurement points...");
623
- const _ = d.subdivide_origin_to_plane(new Float32Array(W), new Float32Array(E), I);
624
- xe.debug(De, `Subdivide: ${_.count()} pts, spacing=${_.spacing().toFixed(1)}mm`);
625
- const B = _.points(), X = _.count(), oe = 2, ce = 1, se = [];
645
+ const D = d.subdivide_origin_to_plane(new Float32Array($), new Float32Array(E), I);
646
+ xe.debug(De, `Subdivide: ${D.count()} pts, spacing=${D.spacing().toFixed(1)}mm`);
647
+ const B = D.points(), X = D.count(), oe = 2, ce = 1, se = [];
626
648
  for (let j = oe; j < X - ce; j++) se.push(B[j * 3 + 1]);
627
649
  n.onStatus("Computing cross-sections...");
628
650
  let J = [];
@@ -633,20 +655,20 @@ let __tla = (async () => {
633
655
  for (let he = 0; he < ie.length - 1; he++) {
634
656
  const Se = ie[he], T = ie[he + 1];
635
657
  if (T <= Se || pe[he] <= 0) continue;
636
- const Le = (T - Se) / 3;
637
- if (Le < 3) continue;
638
- let Pe = 0, We = 0, ye = 0;
639
- for (let Fe = Se; Fe < T; Fe += 3) Pe += ue[Fe], We += ue[Fe + 1], ye += ue[Fe + 2];
640
- J.push(Pe / Le, We / Le, ye / Le);
658
+ const _e = (T - Se) / 3;
659
+ if (_e < 3) continue;
660
+ let Pe = 0, $e = 0, ye = 0;
661
+ for (let Le = Se; Le < T; Le += 3) Pe += ue[Le], $e += ue[Le + 1], ye += ue[Le + 2];
662
+ J.push(Pe / _e, $e / _e, ye / _e);
641
663
  }
642
664
  }
643
665
  if (J.length >= 6) {
644
666
  n.onStatus("Refining alignment...");
645
- const j = d.refine_alignment(new Float32Array(J), M, new Float32Array(W), new Float32Array(E));
646
- xe.info(De, "Refinement complete", j.details()), M = j.positions(), E = j.mpt(), W = j.origin();
667
+ const j = d.refine_alignment(new Float32Array(J), M, new Float32Array($), new Float32Array(E));
668
+ xe.info(De, "Refinement complete", j.details()), M = j.positions(), E = j.mpt(), $ = j.origin();
647
669
  }
648
670
  const ae = a.getAttribute("color"), q = Zn(M, f);
649
- ae && q.setAttribute("color", ae), a.dispose(), a = q, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), r[0] = new k(W[0], W[1], W[2]), r[1] = new k(E[0], E[1], E[2]), n.onStatus("Setting blue point...");
671
+ ae && q.setAttribute("color", ae), a.dispose(), a = q, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), r[0] = new k($[0], $[1], $[2]), r[1] = new k(E[0], E[1], E[2]), n.onStatus("Setting blue point...");
650
672
  const ge = new k(r[0].x, r[0].y, r[0].z);
651
673
  r.push(ge), n.addLandmarkPoint({
652
674
  faceIndex: -1,
@@ -671,7 +693,7 @@ let __tla = (async () => {
671
693
  z: j.z
672
694
  }))), n.setAligned(true);
673
695
  const re = a.boundingBox, R = new k();
674
- re.getSize(R), n.setModelSize(Math.max(R.x, R.y, R.z)), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * St), n.onStatus("Computing final measurements...");
696
+ re.getSize(R), n.setModelSize(Math.max(R.x, R.y, R.z)), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(r[1].y + 2 * Ct), n.onStatus("Computing final measurements...");
675
697
  {
676
698
  const j = At(a), K = r[1].y, ue = r[0].y;
677
699
  let ie = 1 / 0, pe = -1 / 0;
@@ -680,14 +702,14 @@ let __tla = (async () => {
680
702
  const Se = 25.4, T = [];
681
703
  T.push(K);
682
704
  for (let ye = 1; ye <= 2; ye++) {
683
- const Fe = K + ye * Se;
684
- Fe < pe - 1 && T.push(Fe);
705
+ const Le = K + ye * Se;
706
+ Le < pe - 1 && T.push(Le);
685
707
  }
686
708
  for (let ye = K - Se; ye > ue; ye -= Se) T.push(ye);
687
- T.sort((ye, Fe) => ye - Fe), xe.info(De, `Horizontal slices: ${T.length} Y planes, range ${(_b = T[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = T[T.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
709
+ T.sort((ye, Le) => ye - Le), xe.info(De, `Horizontal slices: ${T.length} Y planes, range ${(_b = T[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = T[T.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
688
710
  const Pe = (b ? d.batch_cross_sections_y_inner.bind(d) : d.batch_cross_sections_y.bind(d))(j.positions, j.indices, new Float32Array(T), 10);
689
711
  xe.info(De, `Horizontal slices (${b ? "inner" : "outer"}): ${Pe.count()}/${T.length} valid`), xe.debug(De, "Slice details", Pe.details());
690
- const We = {
712
+ const $e = {
691
713
  yValues: T,
692
714
  circumferences: Array.from(Pe.circumferences()),
693
715
  allLoopPoints: new Float32Array(Pe.all_loop_points()),
@@ -695,16 +717,16 @@ let __tla = (async () => {
695
717
  mptY: K,
696
718
  originY: ue
697
719
  };
698
- (_d = n.setWasmSlices) == null ? void 0 : _d.call(n, We);
720
+ (_d = n.setWasmSlices) == null ? void 0 : _d.call(n, $e);
699
721
  }
700
722
  n.onStatus("Validating results...");
701
- const H = r[1].y, ne = r[0].y, Q = dr(a, H, ne, t);
723
+ const H = r[1].y, ne = r[0].y, Q = ur(a, H, ne, t);
702
724
  Q.valid || xe.warn(De, `Validation: ${Q.reason}`), n.setClippedReferenceGeometry ? (s.computeVertexNormals(), n.setClippedReferenceGeometry(s)) : s.dispose();
703
725
  } catch (a) {
704
726
  xe.error(De, "Processing failed", a), n.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
705
727
  }
706
728
  }
707
- class ur extends $o {
729
+ class hr extends Wo {
708
730
  constructor() {
709
731
  super(...arguments), this.state = {
710
732
  error: null
@@ -735,7 +757,7 @@ let __tla = (async () => {
735
757
  fontFamily: "system-ui, sans-serif"
736
758
  },
737
759
  children: [
738
- i("div", {
760
+ l("div", {
739
761
  style: {
740
762
  fontSize: 16,
741
763
  fontWeight: 600,
@@ -744,7 +766,7 @@ let __tla = (async () => {
744
766
  },
745
767
  children: "Something went wrong"
746
768
  }),
747
- i("div", {
769
+ l("div", {
748
770
  style: {
749
771
  fontSize: 13,
750
772
  color: "#666",
@@ -753,7 +775,7 @@ let __tla = (async () => {
753
775
  },
754
776
  children: this.state.error.message
755
777
  }),
756
- i("button", {
778
+ l("button", {
757
779
  onClick: this.reset,
758
780
  style: {
759
781
  padding: "8px 20px",
@@ -771,7 +793,7 @@ let __tla = (async () => {
771
793
  }) : this.props.children;
772
794
  }
773
795
  }
774
- const pr = ({ message: e, onDismiss: o }) => y("div", {
796
+ const gr = ({ message: e, onDismiss: o }) => y("div", {
775
797
  style: {
776
798
  position: "absolute",
777
799
  top: 16,
@@ -793,14 +815,14 @@ let __tla = (async () => {
793
815
  flex: 1
794
816
  },
795
817
  children: [
796
- i("div", {
818
+ l("div", {
797
819
  style: {
798
820
  fontWeight: "bold",
799
821
  marginBottom: 4
800
822
  },
801
823
  children: "Error"
802
824
  }),
803
- i("div", {
825
+ l("div", {
804
826
  style: {
805
827
  fontSize: 12,
806
828
  opacity: 0.9
@@ -809,7 +831,7 @@ let __tla = (async () => {
809
831
  })
810
832
  ]
811
833
  }),
812
- i("button", {
834
+ l("button", {
813
835
  onClick: o,
814
836
  style: {
815
837
  background: "none",
@@ -839,7 +861,7 @@ let __tla = (async () => {
839
861
  zIndex: 100
840
862
  },
841
863
  children: [
842
- i("div", {
864
+ l("div", {
843
865
  style: {
844
866
  width: 48,
845
867
  height: 48,
@@ -849,7 +871,7 @@ let __tla = (async () => {
849
871
  animation: "spin 1s linear infinite"
850
872
  }
851
873
  }),
852
- e && i("div", {
874
+ e && l("div", {
853
875
  style: {
854
876
  marginTop: 16,
855
877
  color: "#fff",
@@ -857,20 +879,20 @@ let __tla = (async () => {
857
879
  },
858
880
  children: e
859
881
  }),
860
- i("style", {
882
+ l("style", {
861
883
  children: "@keyframes spin { to { transform: rotate(360deg); } }"
862
884
  })
863
885
  ]
864
886
  });
865
- function hr(e, o, t, n) {
866
- const s = new k().subVectors(t, o), l = new k().subVectors(n, o), d = new k().subVectors(e, o), a = s.dot(s), r = s.dot(l), c = s.dot(d), u = l.dot(l), p = l.dot(d), f = 1 / (a * u - r * r), h = (u * c - r * p) * f, w = (a * p - r * c) * f;
887
+ function mr(e, o, t, n) {
888
+ const s = new k().subVectors(t, o), i = new k().subVectors(n, o), d = new k().subVectors(e, o), a = s.dot(s), r = s.dot(i), c = s.dot(d), u = i.dot(i), p = i.dot(d), f = 1 / (a * u - r * r), h = (u * c - r * p) * f, w = (a * p - r * c) * f;
867
889
  return {
868
890
  u: 1 - h - w,
869
891
  v: h,
870
892
  w
871
893
  };
872
894
  }
873
- const gr = ({ mesh: e, maxPoints: o = 2, meshColor: t = "#c8c8c8", meshOpacity: n = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
895
+ const xr = ({ mesh: e, maxPoints: o = 2, meshColor: t = "#c8c8c8", meshOpacity: n = 1, frontFaceOnly: s = false, doubleShellTransparency: i = false }) => {
874
896
  const { addLandmarkPoint: d, landmarkPoints: a } = en(), r = de((h) => {
875
897
  if (a.length >= o) return;
876
898
  h.stopPropagation();
@@ -889,7 +911,7 @@ let __tla = (async () => {
889
911
  ];
890
912
  const x = b.getAttribute("position"), F = new k().fromBufferAttribute(x, v[0]), S = new k().fromBufferAttribute(x, v[1]), C = new k().fromBufferAttribute(x, v[2]);
891
913
  F.applyMatrix4(e.matrixWorld), S.applyMatrix4(e.matrixWorld), C.applyMatrix4(e.matrixWorld);
892
- const M = w.point, E = hr(M, F, S, C), W = {
914
+ const M = w.point, E = mr(M, F, S, C), $ = {
893
915
  faceIndex: g,
894
916
  vertexIndices: v,
895
917
  position: {
@@ -899,7 +921,7 @@ let __tla = (async () => {
899
921
  },
900
922
  barycentricCoords: E
901
923
  };
902
- d(W);
924
+ d($);
903
925
  }, [
904
926
  e,
905
927
  d,
@@ -907,14 +929,14 @@ let __tla = (async () => {
907
929
  o
908
930
  ]), c = te(() => !!e.geometry.getAttribute("color"), [
909
931
  e
910
- ]), u = l ? Math.min(n, 0.65) : n, p = u < 1, f = te(() => new U.MeshStandardMaterial({
932
+ ]), u = i ? Math.min(n, 0.65) : n, p = u < 1, f = te(() => new U.MeshStandardMaterial({
911
933
  color: c ? "#ffffff" : t,
912
934
  side: s ? U.FrontSide : U.DoubleSide,
913
935
  roughness: 0.6,
914
936
  metalness: 0.1,
915
937
  transparent: p,
916
938
  opacity: u,
917
- depthWrite: !l,
939
+ depthWrite: !i,
918
940
  vertexColors: c
919
941
  }), [
920
942
  t,
@@ -922,16 +944,16 @@ let __tla = (async () => {
922
944
  p,
923
945
  c,
924
946
  s,
925
- l
947
+ i
926
948
  ]);
927
- return i("primitive", {
949
+ return l("primitive", {
928
950
  object: e,
929
951
  onClick: r,
930
952
  material: f,
931
- renderOrder: l ? 0 : void 0
953
+ renderOrder: i ? 0 : void 0
932
954
  });
933
- }, mr = ({ point: e, index: o, markerSize: t, color: n, label: s }) => {
934
- const [l, d] = $(false);
955
+ }, br = ({ point: e, index: o, markerSize: t, color: n, label: s }) => {
956
+ const [i, d] = W(false);
935
957
  return y("mesh", {
936
958
  position: [
937
959
  e.position.x,
@@ -941,22 +963,22 @@ let __tla = (async () => {
941
963
  onPointerOver: () => d(true),
942
964
  onPointerOut: () => d(false),
943
965
  children: [
944
- i("sphereGeometry", {
966
+ l("sphereGeometry", {
945
967
  args: [
946
968
  t,
947
969
  16,
948
970
  16
949
971
  ]
950
972
  }),
951
- i("meshBasicMaterial", {
973
+ l("meshBasicMaterial", {
952
974
  color: n
953
975
  }),
954
- l && i(Xe, {
976
+ i && l(Xe, {
955
977
  center: true,
956
978
  style: {
957
979
  pointerEvents: "none"
958
980
  },
959
- children: i("div", {
981
+ children: l("div", {
960
982
  style: {
961
983
  padding: "3px 8px",
962
984
  backgroundColor: "rgba(0, 0, 0, 0.75)",
@@ -972,7 +994,7 @@ let __tla = (async () => {
972
994
  })
973
995
  ]
974
996
  }, o);
975
- }, xr = ({ modelSize: e, labels: o }) => {
997
+ }, yr = ({ modelSize: e, labels: o }) => {
976
998
  const { landmarkPoints: t } = en(), n = e * 0.02, s = [
977
999
  "#44ff44",
978
1000
  "#ff4444",
@@ -982,8 +1004,8 @@ let __tla = (async () => {
982
1004
  "Distal Most Point",
983
1005
  "Cut Plane"
984
1006
  ];
985
- return i(_e, {
986
- children: t.map((a, r) => i(mr, {
1007
+ return l(Re, {
1008
+ children: t.map((a, r) => l(br, {
987
1009
  point: a,
988
1010
  index: r,
989
1011
  markerSize: n,
@@ -1002,25 +1024,25 @@ let __tla = (async () => {
1002
1024
  const In = (e, o) => {
1003
1025
  const t = Math.abs(e - o);
1004
1026
  return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
1005
- }, Wn = new U.Color("#8BC34A"), $n = new U.Color("#FFC107"), br = new U.Color("#FF5722"), yr = (e) => {
1006
- if (e <= 7) return Wn.clone();
1027
+ }, $n = new U.Color("#8BC34A"), Wn = new U.Color("#FFC107"), wr = new U.Color("#FF5722"), vr = (e) => {
1028
+ if (e <= 7) return $n.clone();
1007
1029
  if (e <= 20) {
1008
1030
  const t = (e - 7) / 13;
1009
- return Wn.clone().lerp($n, t);
1031
+ return $n.clone().lerp(Wn, t);
1010
1032
  }
1011
1033
  const o = Math.min((e - 20) / 20, 1);
1012
- return $n.clone().lerp(br, o);
1013
- }, wr = (e, o) => {
1014
- const t = e.length, n = new Float32Array(t * 2 * 3), s = new Float32Array(t * 2 * 3), l = [];
1034
+ return Wn.clone().lerp(wr, o);
1035
+ }, Sr = (e, o) => {
1036
+ const t = e.length, n = new Float32Array(t * 2 * 3), s = new Float32Array(t * 2 * 3), i = [];
1015
1037
  for (let r = 0; r < t; r++) {
1016
- const c = e[r], u = o[r], p = c.distanceTo(u), f = yr(p);
1038
+ const c = e[r], u = o[r], p = c.distanceTo(u), f = vr(p);
1017
1039
  if (n[r * 6] = c.x, n[r * 6 + 1] = c.y, n[r * 6 + 2] = c.z, s[r * 6] = f.r, s[r * 6 + 1] = f.g, s[r * 6 + 2] = f.b, n[r * 6 + 3] = u.x, n[r * 6 + 4] = u.y, n[r * 6 + 5] = u.z, s[r * 6 + 3] = f.r, s[r * 6 + 4] = f.g, s[r * 6 + 5] = f.b, r < t - 1) {
1018
1040
  const h = r * 2, w = h + 1, g = (r + 1) * 2, b = g + 1;
1019
- l.push(h, w, g, w, b, g);
1041
+ i.push(h, w, g, w, b, g);
1020
1042
  }
1021
1043
  }
1022
1044
  const d = new U.BufferGeometry();
1023
- d.setAttribute("position", new U.Float32BufferAttribute(n, 3)), d.setAttribute("color", new U.Float32BufferAttribute(s, 3)), d.setIndex(l);
1045
+ d.setAttribute("position", new U.Float32BufferAttribute(n, 3)), d.setAttribute("color", new U.Float32BufferAttribute(s, 3)), d.setIndex(i);
1024
1046
  const a = new U.MeshBasicMaterial({
1025
1047
  vertexColors: true,
1026
1048
  transparent: true,
@@ -1030,7 +1052,7 @@ let __tla = (async () => {
1030
1052
  depthWrite: false
1031
1053
  });
1032
1054
  return new U.Mesh(d, a);
1033
- }, vr = ({ bvh: e, geometry: o, yPosition: t, color: n = "#00ff00", labelX: s, onDataChange: l, displayUnit: d = "cm", useInnerSurface: a = false, formValue: r, lineWidth: c = 1.5, wasmLoopPoints: u, wasmCircumference: p }) => {
1055
+ }, Cr = ({ bvh: e, geometry: o, yPosition: t, color: n = "#00ff00", labelX: s, onDataChange: i, displayUnit: d = "cm", useInnerSurface: a = false, formValue: r, lineWidth: c = 1.5, wasmLoopPoints: u, wasmCircumference: p }) => {
1034
1056
  const f = te(() => u && p != null ? null : Ge(e, o, t, a), [
1035
1057
  e,
1036
1058
  o,
@@ -1046,7 +1068,7 @@ let __tla = (async () => {
1046
1068
  h,
1047
1069
  w,
1048
1070
  r
1049
- ]), b = te(() => !g || h.length < 2 ? null : wr(h, g), [
1071
+ ]), b = te(() => !g || h.length < 2 ? null : Sr(h, g), [
1050
1072
  h,
1051
1073
  g
1052
1074
  ]);
@@ -1071,7 +1093,7 @@ let __tla = (async () => {
1071
1093
  }, [
1072
1094
  v
1073
1095
  ]), Z(() => {
1074
- w > 0 && (l == null ? void 0 : l({
1096
+ w > 0 && (i == null ? void 0 : i({
1075
1097
  yPosition: t,
1076
1098
  originalValue: w,
1077
1099
  modifiedValue: null
@@ -1079,7 +1101,7 @@ let __tla = (async () => {
1079
1101
  }, [
1080
1102
  w,
1081
1103
  t,
1082
- l
1104
+ i
1083
1105
  ]), On(({ camera: x }) => {
1084
1106
  if (!A.current || h.length < 2) return;
1085
1107
  const F = new k();
@@ -1090,17 +1112,17 @@ let __tla = (async () => {
1090
1112
  const C = new k().crossVectors(S, new k(0, 1, 0)).normalize();
1091
1113
  let M = -1 / 0, E = h[0];
1092
1114
  for (const I of h) {
1093
- const _ = C.x * I.x + C.z * I.z;
1094
- _ > M && (M = _, E = I);
1115
+ const D = C.x * I.x + C.z * I.z;
1116
+ D > M && (M = D, E = I);
1095
1117
  }
1096
- const W = s * 0.35, N = new k(E.x + C.x * W, t, E.z + C.z * W);
1118
+ const $ = s * 0.35, N = new k(E.x + C.x * $, t, E.z + C.z * $);
1097
1119
  A.current.position.copy(N);
1098
1120
  const P = v.geometry.getAttribute("position");
1099
1121
  P.setXYZ(0, E.x, E.y, E.z), P.setXYZ(1, N.x, N.y, N.z), P.needsUpdate = true;
1100
1122
  }), h.length < 2 ? null : y("group", {
1101
1123
  renderOrder: 10,
1102
1124
  children: [
1103
- i(ve, {
1125
+ l(ve, {
1104
1126
  points: h,
1105
1127
  color: n,
1106
1128
  lineWidth: c,
@@ -1109,11 +1131,11 @@ let __tla = (async () => {
1109
1131
  transparent: true,
1110
1132
  renderOrder: 10
1111
1133
  }),
1112
- b && i("primitive", {
1134
+ b && l("primitive", {
1113
1135
  object: b,
1114
1136
  renderOrder: 10
1115
1137
  }),
1116
- g && r != null && r !== 0 && i(ve, {
1138
+ g && r != null && r !== 0 && l(ve, {
1117
1139
  points: g,
1118
1140
  color: In(w, r),
1119
1141
  lineWidth: 2.5,
@@ -1126,13 +1148,13 @@ let __tla = (async () => {
1126
1148
  opacity: 0.8,
1127
1149
  renderOrder: 10
1128
1150
  }),
1129
- i("primitive", {
1151
+ l("primitive", {
1130
1152
  object: v,
1131
1153
  renderOrder: 10
1132
1154
  }),
1133
- i("group", {
1155
+ l("group", {
1134
1156
  ref: A,
1135
- children: i(Xe, {
1157
+ children: l(Xe, {
1136
1158
  zIndexRange: [
1137
1159
  100,
1138
1160
  0
@@ -1161,7 +1183,7 @@ let __tla = (async () => {
1161
1183
  borderRadius: r != null && r !== 0 ? "4px 0 0 4px" : 4
1162
1184
  },
1163
1185
  children: [
1164
- i("span", {
1186
+ l("span", {
1165
1187
  style: {
1166
1188
  fontSize: 14,
1167
1189
  color: "#fff",
@@ -1171,7 +1193,7 @@ let __tla = (async () => {
1171
1193
  },
1172
1194
  children: d === "inch" ? (w / 25.4).toFixed(2) : (w / 10).toFixed(1)
1173
1195
  }),
1174
- i("span", {
1196
+ l("span", {
1175
1197
  style: {
1176
1198
  fontSize: 11,
1177
1199
  color: "rgba(255,255,255,0.6)",
@@ -1194,7 +1216,7 @@ let __tla = (async () => {
1194
1216
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1195
1217
  },
1196
1218
  children: [
1197
- F && i("span", {
1219
+ F && l("span", {
1198
1220
  style: {
1199
1221
  fontSize: 10,
1200
1222
  color: S,
@@ -1234,7 +1256,7 @@ let __tla = (async () => {
1234
1256
  })
1235
1257
  ]
1236
1258
  });
1237
- }, Sr = Bo(vr), Cr = ({ mesh: e, startY: o, endY: t, spacing: n, modelSize: s, onMeasurementsChange: l, reverseOrder: d = false, displayUnit: a = "cm", useInnerSurface: r = false, formMeasurements: c, originY: u, wasmSlices: p }) => {
1259
+ }, Ar = Bo(Cr), Mr = ({ mesh: e, startY: o, endY: t, spacing: n, modelSize: s, onMeasurementsChange: i, reverseOrder: d = false, displayUnit: a = "cm", useInnerSurface: r = false, formMeasurements: c, originY: u, wasmSlices: p }) => {
1238
1260
  const f = fe(/* @__PURE__ */ new Map()), h = e.geometry, w = Jn(h), g = te(() => {
1239
1261
  if (p) {
1240
1262
  let M = [
@@ -1242,12 +1264,12 @@ let __tla = (async () => {
1242
1264
  ];
1243
1265
  if (n > 25.4 + 0.1) {
1244
1266
  const E = p.mptY;
1245
- M = M.filter((W) => {
1246
- const N = Math.abs(W - E);
1267
+ M = M.filter(($) => {
1268
+ const N = Math.abs($ - E);
1247
1269
  return N < 0.5 || Math.abs(Math.round(N / n) * n - N) < 0.5;
1248
1270
  });
1249
1271
  }
1250
- return d ? M.sort((E, W) => W - E) : M.sort((E, W) => E - W), M;
1272
+ return d ? M.sort((E, $) => $ - E) : M.sort((E, $) => E - $), M;
1251
1273
  }
1252
1274
  const S = [];
1253
1275
  if (d) for (let C = t; C >= o; C -= n) S.push(C);
@@ -1262,12 +1284,12 @@ let __tla = (async () => {
1262
1284
  ]), b = te(() => {
1263
1285
  if (!p) return null;
1264
1286
  const S = /* @__PURE__ */ new Map(), { allLoopPoints: C, offsets: M, yValues: E } = p;
1265
- for (let W = 0; W < M.length - 1; W++) {
1266
- const N = M[W], P = M[W + 1];
1287
+ for (let $ = 0; $ < M.length - 1; $++) {
1288
+ const N = M[$], P = M[$ + 1];
1267
1289
  if (P <= N) continue;
1268
1290
  const I = [];
1269
- for (let _ = N; _ < P; _ += 3) I.push(new k(C[_], C[_ + 1], C[_ + 2]));
1270
- I.length >= 3 && S.set(E[W], I);
1291
+ for (let D = N; D < P; D += 3) I.push(new k(C[D], C[D + 1], C[D + 2]));
1292
+ I.length >= 3 && S.set(E[$], I);
1271
1293
  }
1272
1294
  return S;
1273
1295
  }, [
@@ -1285,17 +1307,17 @@ let __tla = (async () => {
1285
1307
  }, [
1286
1308
  g
1287
1309
  ]), Z(() => {
1288
- if (!A || !l) return;
1310
+ if (!A || !i) return;
1289
1311
  const S = g.filter((C) => (A.get(C) ?? 0) > 0).map((C) => ({
1290
1312
  yPosition: C,
1291
1313
  originalValue: A.get(C) ?? 0,
1292
1314
  modifiedValue: null
1293
1315
  }));
1294
- l(S);
1316
+ i(S);
1295
1317
  }, [
1296
1318
  A,
1297
1319
  g,
1298
- l
1320
+ i
1299
1321
  ]);
1300
1322
  const v = [
1301
1323
  "#5B9BD5"
@@ -1303,14 +1325,14 @@ let __tla = (async () => {
1303
1325
  if (A) return;
1304
1326
  f.current.set(S.yPosition, S);
1305
1327
  const C = Array.from(f.current.values()).sort((M, E) => d ? E.yPosition - M.yPosition : M.yPosition - E.yPosition);
1306
- l == null ? void 0 : l(C);
1328
+ i == null ? void 0 : i(C);
1307
1329
  }, [
1308
- l,
1330
+ i,
1309
1331
  d,
1310
1332
  A
1311
1333
  ]);
1312
- return w ? i(_e, {
1313
- children: g.map((S, C) => i(Sr, {
1334
+ return w ? l(Re, {
1335
+ children: g.map((S, C) => l(Ar, {
1314
1336
  bvh: w,
1315
1337
  geometry: h,
1316
1338
  yPosition: S,
@@ -1325,10 +1347,10 @@ let __tla = (async () => {
1325
1347
  wasmCircumference: A == null ? void 0 : A.get(S)
1326
1348
  }, S))
1327
1349
  }) : null;
1328
- }, Ar = (e, o) => {
1350
+ }, zr = (e, o) => {
1329
1351
  const t = Math.abs(e - o);
1330
1352
  return t <= 7 ? "#4caf50" : t <= 15 ? "#ff9800" : "#f44336";
1331
- }, Mr = ({ mesh: e, greenY: o, modelSize: t, displayUnit: n = "cm", bottomY: s, formHeight: l }) => {
1353
+ }, kr = ({ mesh: e, greenY: o, modelSize: t, displayUnit: n = "cm", bottomY: s, formHeight: i }) => {
1332
1354
  var _a;
1333
1355
  const d = e.geometry;
1334
1356
  d.computeBoundingBox();
@@ -1340,16 +1362,16 @@ let __tla = (async () => {
1340
1362
  const E = new k(M.x, 0, M.z);
1341
1363
  if (E.lengthSq() < 1e-8) return;
1342
1364
  E.normalize();
1343
- const W = new k().crossVectors(new k(0, 1, 0), E).normalize();
1344
- p.current.position.set(W.x * c, 0, W.z * c);
1365
+ const $ = new k().crossVectors(new k(0, 1, 0), E).normalize();
1366
+ p.current.position.set($.x * c, 0, $.z * c);
1345
1367
  const N = C.position.x - p.current.position.x, P = C.position.z - p.current.position.z;
1346
1368
  p.current.rotation.y = Math.atan2(N, P);
1347
1369
  });
1348
- const f = new k(0, o, 0), h = new k(0, a, 0), w = new k(0, (o + a) / 2, 0), g = new k(-u, o, 0), b = new k(u, o, 0), A = new k(-u, a, 0), v = new k(u, a, 0), x = l != null && l > 0, F = x ? r - l : 0, S = x ? Ar(r, l) : "#fff";
1370
+ const f = new k(0, o, 0), h = new k(0, a, 0), w = new k(0, (o + a) / 2, 0), g = new k(-u, o, 0), b = new k(u, o, 0), A = new k(-u, a, 0), v = new k(u, a, 0), x = i != null && i > 0, F = x ? r - i : 0, S = x ? zr(r, i) : "#fff";
1349
1371
  return y("group", {
1350
1372
  ref: p,
1351
1373
  children: [
1352
- i(ve, {
1374
+ l(ve, {
1353
1375
  points: [
1354
1376
  f,
1355
1377
  h
@@ -1357,7 +1379,7 @@ let __tla = (async () => {
1357
1379
  color: "#888888",
1358
1380
  lineWidth: 1.5
1359
1381
  }),
1360
- i(ve, {
1382
+ l(ve, {
1361
1383
  points: [
1362
1384
  g,
1363
1385
  b
@@ -1365,7 +1387,7 @@ let __tla = (async () => {
1365
1387
  color: "#888888",
1366
1388
  lineWidth: 1.5
1367
1389
  }),
1368
- i(ve, {
1390
+ l(ve, {
1369
1391
  points: [
1370
1392
  A,
1371
1393
  v
@@ -1373,9 +1395,9 @@ let __tla = (async () => {
1373
1395
  color: "#888888",
1374
1396
  lineWidth: 1.5
1375
1397
  }),
1376
- i("mesh", {
1398
+ l("mesh", {
1377
1399
  position: w,
1378
- children: i(Xe, {
1400
+ children: l(Xe, {
1379
1401
  center: true,
1380
1402
  style: {
1381
1403
  pointerEvents: "none"
@@ -1425,7 +1447,7 @@ let __tla = (async () => {
1425
1447
  pointerEvents: "none"
1426
1448
  },
1427
1449
  children: [
1428
- Math.abs(F) > 0.5 && i("span", {
1450
+ Math.abs(F) > 0.5 && l("span", {
1429
1451
  style: {
1430
1452
  fontSize: 10,
1431
1453
  color: S,
@@ -1453,7 +1475,7 @@ let __tla = (async () => {
1453
1475
  },
1454
1476
  children: [
1455
1477
  "from ",
1456
- n === "inch" ? (l / 25.4).toFixed(2) : (l / 10).toFixed(1)
1478
+ n === "inch" ? (i / 25.4).toFixed(2) : (i / 10).toFixed(1)
1457
1479
  ]
1458
1480
  })
1459
1481
  ]
@@ -1464,16 +1486,16 @@ let __tla = (async () => {
1464
1486
  })
1465
1487
  ]
1466
1488
  });
1467
- }, zr = ({ modelSize: e, isAligned: o, isCut: t, mesh: n, viewMode: s, sliceY: l, landmarkCount: d = 0, measurementGeometry: a, fitYMin: r, fitYMax: c, resetCameraToFrontRef: u }) => {
1489
+ }, Pr = ({ modelSize: e, isAligned: o, isCut: t, mesh: n, viewMode: s, sliceY: i, landmarkCount: d = 0, measurementGeometry: a, fitYMin: r, fitYMax: c, resetCameraToFrontRef: u }) => {
1468
1490
  const { set: p, size: f, camera: h, invalidate: w } = Hn(), g = fe(false), b = fe(s), A = fe(new k()), v = fe(null), x = fe(d), F = fe(o), S = fe(t), C = fe(a), M = fe({
1469
1491
  min: r,
1470
1492
  max: c
1471
- }), E = fe(0), W = de(() => {
1493
+ }), E = fe(0), $ = de(() => {
1472
1494
  if (!n || e <= 0) return null;
1473
1495
  const P = a ?? n.geometry;
1474
1496
  P.computeBoundingBox();
1475
- const I = P.boundingBox, _ = new k();
1476
- I.getCenter(_);
1497
+ const I = P.boundingBox, D = new k();
1498
+ I.getCenter(D);
1477
1499
  const B = new k();
1478
1500
  I.getSize(B);
1479
1501
  const X = r != null && c != null && c > r;
@@ -1488,11 +1510,11 @@ let __tla = (async () => {
1488
1510
  const T = ne[he * 3];
1489
1511
  T < j && (j = T), T > K && (K = T), pe = true;
1490
1512
  }
1491
- pe && (_.set((j + K) / 2, (ue + ie) / 2, 0), B.set(K - j, ie - ue, 0));
1513
+ pe && (D.set((j + K) / 2, (ue + ie) / 2, 0), B.set(K - j, ie - ue, 0));
1492
1514
  }
1493
1515
  }
1494
1516
  A.current.copy(B);
1495
- const oe = f.width / f.height, ce = 1.35, se = X ? 1.15 : 1.6, J = Math.max(B.y * se, B.x * ce / oe), ae = J * oe, q = _.y - B.y * 0.05;
1517
+ const oe = f.width / f.height, ce = 1.35, se = X ? 1.15 : 1.6, J = Math.max(B.y * se, B.x * ce / oe), ae = J * oe, q = D.y - B.y * 0.05;
1496
1518
  E.current = q;
1497
1519
  const ge = new U.OrthographicCamera(-ae / 2, ae / 2, J / 2, -J / 2, 0.1, e * 10);
1498
1520
  return ge.position.set(0, q, e * 2), ge.lookAt(0, q, 0), ge;
@@ -1506,7 +1528,7 @@ let __tla = (async () => {
1506
1528
  ]);
1507
1529
  Z(() => {
1508
1530
  if (u) return u.current = () => {
1509
- const P = W();
1531
+ const P = $();
1510
1532
  P && (p({
1511
1533
  camera: P
1512
1534
  }), w());
@@ -1515,13 +1537,13 @@ let __tla = (async () => {
1515
1537
  };
1516
1538
  }, [
1517
1539
  u,
1518
- W,
1540
+ $,
1519
1541
  p,
1520
1542
  w
1521
1543
  ]);
1522
1544
  const N = de((P) => {
1523
- const I = P.position.clone(), _ = I.length(), B = Math.atan2(I.x, I.z), X = Math.acos(I.y / _), ce = B + 0.02;
1524
- P.position.set(_ * Math.sin(X) * Math.sin(ce), _ * Math.cos(X), _ * Math.sin(X) * Math.cos(ce)), P.lookAt(0, 0, 0), P.updateMatrixWorld(true), w();
1545
+ const I = P.position.clone(), D = I.length(), B = Math.atan2(I.x, I.z), X = Math.acos(I.y / D), ce = B + 0.02;
1546
+ P.position.set(D * Math.sin(X) * Math.sin(ce), D * Math.cos(X), D * Math.sin(X) * Math.cos(ce)), P.lookAt(0, 0, 0), P.updateMatrixWorld(true), w();
1525
1547
  }, [
1526
1548
  w
1527
1549
  ]);
@@ -1548,12 +1570,12 @@ let __tla = (async () => {
1548
1570
  h,
1549
1571
  N
1550
1572
  ]), Z(() => {
1551
- const P = F.current !== o, I = S.current !== t, _ = !C.current && !!a, B = (M.current.min == null || M.current.max == null) && r != null && c != null;
1573
+ const P = F.current !== o, I = S.current !== t, D = !C.current && !!a, B = (M.current.min == null || M.current.max == null) && r != null && c != null;
1552
1574
  if (F.current = o, S.current = t, C.current = a, M.current = {
1553
1575
  min: r,
1554
1576
  max: c
1555
- }, !P && !I && !_ && !B || !o || s !== "3D") return;
1556
- const X = W();
1577
+ }, !P && !I && !D && !B || !o || s !== "3D") return;
1578
+ const X = $();
1557
1579
  X && p({
1558
1580
  camera: X
1559
1581
  });
@@ -1564,17 +1586,17 @@ let __tla = (async () => {
1564
1586
  a,
1565
1587
  r,
1566
1588
  c,
1567
- W,
1589
+ $,
1568
1590
  p
1569
1591
  ]), Z(() => {
1570
1592
  if (b.current === s) return;
1571
1593
  const P = b.current;
1572
1594
  if (b.current = s, !(!o || !n || e <= 0)) {
1573
- if (s === "2D" && l != null) {
1595
+ if (s === "2D" && i != null) {
1574
1596
  v.current = h;
1575
- const I = n.geometry, _ = I.getAttribute("position"), B = _.array, X = e * 0.15;
1597
+ const I = n.geometry, D = I.getAttribute("position"), B = D.array, X = e * 0.15;
1576
1598
  let oe = 1 / 0, ce = -1 / 0, se = 1 / 0, J = -1 / 0, ae = false;
1577
- for (let ue = 0; ue < _.count; ue++) if (Math.abs(B[ue * 3 + 1] - l) < X) {
1599
+ for (let ue = 0; ue < D.count; ue++) if (Math.abs(B[ue * 3 + 1] - i) < X) {
1578
1600
  const ie = B[ue * 3], pe = B[ue * 3 + 2];
1579
1601
  ie < oe && (oe = ie), ie > ce && (ce = ie), pe < se && (se = pe), pe > J && (J = pe), ae = true;
1580
1602
  }
@@ -1587,14 +1609,14 @@ let __tla = (async () => {
1587
1609
  let Q, j;
1588
1610
  H / ne > re ? (Q = H, j = H / re) : (j = ne, Q = ne * re);
1589
1611
  const K = new U.OrthographicCamera(-Q / 2, Q / 2, j / 2, -j / 2, 0.1, e * 10);
1590
- K.position.set(q, l + e * 2, ge), K.up.set(0, 0, -1), K.lookAt(q, l, ge), p({
1612
+ K.position.set(q, i + e * 2, ge), K.up.set(0, 0, -1), K.lookAt(q, i, ge), p({
1591
1613
  camera: K
1592
1614
  });
1593
1615
  } else if (P === "2D") if (v.current) p({
1594
1616
  camera: v.current
1595
1617
  }), v.current = null;
1596
1618
  else {
1597
- const I = W();
1619
+ const I = $();
1598
1620
  I && p({
1599
1621
  camera: I
1600
1622
  });
@@ -1602,22 +1624,22 @@ let __tla = (async () => {
1602
1624
  }
1603
1625
  }, [
1604
1626
  s,
1605
- l,
1627
+ i,
1606
1628
  o,
1607
1629
  n,
1608
1630
  e,
1609
1631
  f,
1610
1632
  p,
1611
1633
  h,
1612
- W
1634
+ $
1613
1635
  ]), Z(() => {
1614
1636
  if (!o || !h || !h.isOrthographicCamera) return;
1615
1637
  const P = h;
1616
1638
  if (s === "2D") {
1617
- if (!n || l == null) return;
1618
- const I = n.geometry, _ = I.getAttribute("position"), B = _.array, X = e * 0.15;
1639
+ if (!n || i == null) return;
1640
+ const I = n.geometry, D = I.getAttribute("position"), B = D.array, X = e * 0.15;
1619
1641
  let oe = 1 / 0, ce = -1 / 0, se = 1 / 0, J = -1 / 0, ae = false;
1620
- for (let Q = 0; Q < _.count; Q++) if (Math.abs(B[Q * 3 + 1] - l) < X) {
1642
+ for (let Q = 0; Q < D.count; Q++) if (Math.abs(B[Q * 3 + 1] - i) < X) {
1621
1643
  const j = B[Q * 3], K = B[Q * 3 + 2];
1622
1644
  j < oe && (oe = j), j > ce && (ce = j), K < se && (se = K), K > J && (J = K), ae = true;
1623
1645
  }
@@ -1630,7 +1652,7 @@ let __tla = (async () => {
1630
1652
  let H, ne;
1631
1653
  re / R > q ? (H = re, ne = re / q) : (ne = R, H = R * q), P.left = -H / 2, P.right = H / 2, P.top = ne / 2, P.bottom = -ne / 2;
1632
1654
  } else {
1633
- const I = A.current, _ = f.width / f.height, B = Math.max(I.y, I.x / _) * 1.6, X = B * _;
1655
+ const I = A.current, D = f.width / f.height, B = Math.max(I.y, I.x / D) * 1.6, X = B * D;
1634
1656
  P.left = -X / 2, P.right = X / 2, P.top = B / 2, P.bottom = -B / 2;
1635
1657
  }
1636
1658
  P.updateProjectionMatrix();
@@ -1642,12 +1664,12 @@ let __tla = (async () => {
1642
1664
  s,
1643
1665
  n
1644
1666
  ]), null;
1645
- }, kr = ({ mesh: e, isDragging: o }) => {
1667
+ }, Fr = ({ mesh: e, isDragging: o }) => {
1646
1668
  var _a;
1647
1669
  const t = e.geometry;
1648
1670
  t.computeBoundingBox();
1649
1671
  const n = new k();
1650
- return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(n), i(Nn, {
1672
+ return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(n), l(Nn, {
1651
1673
  enableDamping: false,
1652
1674
  enablePan: false,
1653
1675
  minPolarAngle: Math.PI * 0.15,
@@ -1661,12 +1683,12 @@ let __tla = (async () => {
1661
1683
  n.z
1662
1684
  ]
1663
1685
  });
1664
- }, Pr = {
1686
+ }, Lr = {
1665
1687
  meter: "Scan units detected as meters \u2014 auto-scaled to millimeters",
1666
1688
  cm: "Scan units detected as centimeters \u2014 auto-scaled to millimeters",
1667
1689
  mm: "Scan units detected as millimeters"
1668
- }, Fr = ({ detectedUnit: e, onDismiss: o }) => {
1669
- const t = e === "meter" || e === "cm", n = Pr[e] ?? "Scan units could not be determined";
1690
+ }, _r = ({ detectedUnit: e, onDismiss: o }) => {
1691
+ const t = e === "meter" || e === "cm", n = Lr[e] ?? "Scan units could not be determined";
1670
1692
  return y("div", {
1671
1693
  style: {
1672
1694
  position: "absolute",
@@ -1684,7 +1706,7 @@ let __tla = (async () => {
1684
1706
  fontFamily: "system-ui, sans-serif"
1685
1707
  },
1686
1708
  children: [
1687
- i("span", {
1709
+ l("span", {
1688
1710
  style: {
1689
1711
  fontSize: 13,
1690
1712
  color: "#fff",
@@ -1692,7 +1714,7 @@ let __tla = (async () => {
1692
1714
  },
1693
1715
  children: n
1694
1716
  }),
1695
- i("button", {
1717
+ l("button", {
1696
1718
  onClick: o,
1697
1719
  style: {
1698
1720
  background: "none",
@@ -1709,7 +1731,7 @@ let __tla = (async () => {
1709
1731
  })
1710
1732
  ]
1711
1733
  });
1712
- }, Lr = ({ isDoubleShell: e, onDismiss: o }) => (Z(() => {
1734
+ }, Dr = ({ isDoubleShell: e, onDismiss: o }) => (Z(() => {
1713
1735
  const t = setTimeout(o, 1e4);
1714
1736
  return () => clearTimeout(t);
1715
1737
  }, []), y("div", {
@@ -1729,7 +1751,7 @@ let __tla = (async () => {
1729
1751
  fontFamily: "system-ui, sans-serif"
1730
1752
  },
1731
1753
  children: [
1732
- i("span", {
1754
+ l("span", {
1733
1755
  style: {
1734
1756
  fontSize: 13,
1735
1757
  color: "#fff",
@@ -1737,7 +1759,7 @@ let __tla = (async () => {
1737
1759
  },
1738
1760
  children: e ? "Double shell scan detected" : "Single shell scan detected"
1739
1761
  }),
1740
- i("button", {
1762
+ l("button", {
1741
1763
  onClick: o,
1742
1764
  style: {
1743
1765
  background: "none",
@@ -1756,7 +1778,7 @@ let __tla = (async () => {
1756
1778
  })), Bn = (e, o) => {
1757
1779
  const t = Math.abs(e - o);
1758
1780
  return t <= 7 ? "#4caf50" : t <= 15 ? "#ff9800" : "#f44336";
1759
- }, Dr = ({ mesh: e, upperY: o, originY: t, modelSize: n, meshColor: s = "#c8c8c8", displayUnit: l = "cm", formML: d, formAP: a }) => {
1781
+ }, Rr = ({ mesh: e, upperY: o, originY: t, modelSize: n, meshColor: s = "#c8c8c8", displayUnit: i = "cm", formML: d, formAP: a }) => {
1760
1782
  const r = e.geometry, c = te(() => new zt(r, {
1761
1783
  maxLeafTris: kt
1762
1784
  }), [
@@ -1770,14 +1792,14 @@ let __tla = (async () => {
1770
1792
  ]), { mlLine: f, apLine: h, mlWidth: w, apWidth: g } = te(() => {
1771
1793
  let v = null, x = null, F = 0, S = 0;
1772
1794
  if (u.linePoints.length >= 2) {
1773
- let C = u.linePoints[0], M = u.linePoints[0], E = u.linePoints[0], W = u.linePoints[0];
1774
- for (const N of u.linePoints) N.x < C.x && (C = N), N.x > M.x && (M = N), N.z < E.z && (E = N), N.z > W.z && (W = N);
1795
+ let C = u.linePoints[0], M = u.linePoints[0], E = u.linePoints[0], $ = u.linePoints[0];
1796
+ for (const N of u.linePoints) N.x < C.x && (C = N), N.x > M.x && (M = N), N.z < E.z && (E = N), N.z > $.z && ($ = N);
1775
1797
  v = [
1776
1798
  new k(C.x, t, C.z),
1777
1799
  new k(M.x, t, M.z)
1778
1800
  ], x = [
1779
1801
  new k(E.x, t, E.z),
1780
- new k(W.x, t, W.z)
1802
+ new k($.x, t, $.z)
1781
1803
  ], F = v[0].distanceTo(v[1]), S = x[0].distanceTo(x[1]);
1782
1804
  }
1783
1805
  return {
@@ -1789,12 +1811,12 @@ let __tla = (async () => {
1789
1811
  }, [
1790
1812
  u,
1791
1813
  t
1792
- ]), b = (v) => l === "inch" ? (v / 25.4).toFixed(2) : (v / 10).toFixed(1), A = l === "inch" ? "in" : "cm";
1793
- return y(_e, {
1814
+ ]), b = (v) => i === "inch" ? (v / 25.4).toFixed(2) : (v / 10).toFixed(1), A = i === "inch" ? "in" : "cm";
1815
+ return y(Re, {
1794
1816
  children: [
1795
- i("mesh", {
1817
+ l("mesh", {
1796
1818
  geometry: e.geometry,
1797
- children: i("meshStandardMaterial", {
1819
+ children: l("meshStandardMaterial", {
1798
1820
  color: s,
1799
1821
  side: U.DoubleSide,
1800
1822
  transparent: true,
@@ -1805,7 +1827,7 @@ let __tla = (async () => {
1805
1827
  ]
1806
1828
  })
1807
1829
  }),
1808
- u.linePoints.length >= 2 && i(ve, {
1830
+ u.linePoints.length >= 2 && l(ve, {
1809
1831
  points: u.linePoints,
1810
1832
  color: "#00ff00",
1811
1833
  lineWidth: 3,
@@ -1813,9 +1835,9 @@ let __tla = (async () => {
1813
1835
  depthWrite: false,
1814
1836
  transparent: true
1815
1837
  }),
1816
- f && y(_e, {
1838
+ f && y(Re, {
1817
1839
  children: [
1818
- i(ve, {
1840
+ l(ve, {
1819
1841
  points: f,
1820
1842
  color: "#ff8800",
1821
1843
  lineWidth: 2,
@@ -1823,7 +1845,7 @@ let __tla = (async () => {
1823
1845
  depthWrite: false,
1824
1846
  transparent: true
1825
1847
  }),
1826
- i(Xe, {
1848
+ l(Xe, {
1827
1849
  position: [
1828
1850
  f[0].x,
1829
1851
  t,
@@ -1841,7 +1863,7 @@ let __tla = (async () => {
1841
1863
  whiteSpace: "nowrap"
1842
1864
  },
1843
1865
  children: [
1844
- i("div", {
1866
+ l("div", {
1845
1867
  style: {
1846
1868
  padding: "2px 6px",
1847
1869
  backgroundColor: "rgba(0,0,0,0.75)",
@@ -1874,7 +1896,7 @@ let __tla = (async () => {
1874
1896
  borderTop: "1px solid rgba(255,255,255,0.12)"
1875
1897
  },
1876
1898
  children: [
1877
- F && i("span", {
1899
+ F && l("span", {
1878
1900
  style: {
1879
1901
  fontSize: 9,
1880
1902
  color: x,
@@ -1891,7 +1913,7 @@ let __tla = (async () => {
1891
1913
  },
1892
1914
  children: [
1893
1915
  v > 0 ? "+" : "",
1894
- l === "inch" ? (v / 25.4).toFixed(2) : (v / 10).toFixed(1)
1916
+ i === "inch" ? (v / 25.4).toFixed(2) : (v / 10).toFixed(1)
1895
1917
  ]
1896
1918
  }),
1897
1919
  y("span", {
@@ -1902,7 +1924,7 @@ let __tla = (async () => {
1902
1924
  },
1903
1925
  children: [
1904
1926
  "from ",
1905
- l === "inch" ? (d / 25.4).toFixed(2) : (d / 10).toFixed(1)
1927
+ i === "inch" ? (d / 25.4).toFixed(2) : (d / 10).toFixed(1)
1906
1928
  ]
1907
1929
  })
1908
1930
  ]
@@ -1913,9 +1935,9 @@ let __tla = (async () => {
1913
1935
  })
1914
1936
  ]
1915
1937
  }),
1916
- h && y(_e, {
1938
+ h && y(Re, {
1917
1939
  children: [
1918
- i(ve, {
1940
+ l(ve, {
1919
1941
  points: h,
1920
1942
  color: "#ff00ff",
1921
1943
  lineWidth: 2,
@@ -1923,7 +1945,7 @@ let __tla = (async () => {
1923
1945
  depthWrite: false,
1924
1946
  transparent: true
1925
1947
  }),
1926
- i(Xe, {
1948
+ l(Xe, {
1927
1949
  position: [
1928
1950
  Math.max(h[0].x, h[1].x) + n * 0.02,
1929
1951
  t,
@@ -1941,7 +1963,7 @@ let __tla = (async () => {
1941
1963
  whiteSpace: "nowrap"
1942
1964
  },
1943
1965
  children: [
1944
- i("div", {
1966
+ l("div", {
1945
1967
  style: {
1946
1968
  padding: "2px 6px",
1947
1969
  backgroundColor: "rgba(0,0,0,0.75)",
@@ -1974,7 +1996,7 @@ let __tla = (async () => {
1974
1996
  borderTop: "1px solid rgba(255,255,255,0.12)"
1975
1997
  },
1976
1998
  children: [
1977
- F && i("span", {
1999
+ F && l("span", {
1978
2000
  style: {
1979
2001
  fontSize: 9,
1980
2002
  color: x,
@@ -1991,7 +2013,7 @@ let __tla = (async () => {
1991
2013
  },
1992
2014
  children: [
1993
2015
  v > 0 ? "+" : "",
1994
- l === "inch" ? (v / 25.4).toFixed(2) : (v / 10).toFixed(1)
2016
+ i === "inch" ? (v / 25.4).toFixed(2) : (v / 10).toFixed(1)
1995
2017
  ]
1996
2018
  }),
1997
2019
  y("span", {
@@ -2002,7 +2024,7 @@ let __tla = (async () => {
2002
2024
  },
2003
2025
  children: [
2004
2026
  "from ",
2005
- l === "inch" ? (a / 25.4).toFixed(2) : (a / 10).toFixed(1)
2027
+ i === "inch" ? (a / 25.4).toFixed(2) : (a / 10).toFixed(1)
2006
2028
  ]
2007
2029
  })
2008
2030
  ]
@@ -2015,8 +2037,8 @@ let __tla = (async () => {
2015
2037
  })
2016
2038
  ]
2017
2039
  });
2018
- }, _r = ({ mesh: e, yPosition: o, onYChange: t, minY: n, maxY: s, modelSize: l, color: d, hoverColor: a, dragColor: r, label: c, onDragStart: u, onDragEnd: p }) => {
2019
- const [f, h] = $(false), [w, g] = $(false), { camera: b, gl: A } = Hn(), v = fe(0), x = fe(null), F = e.geometry, S = Jn(F), C = te(() => S ? Ge(S, F, o) : {
2040
+ }, Er = ({ mesh: e, yPosition: o, onYChange: t, minY: n, maxY: s, modelSize: i, color: d, hoverColor: a, dragColor: r, label: c, onDragStart: u, onDragEnd: p }) => {
2041
+ const [f, h] = W(false), [w, g] = W(false), { camera: b, gl: A } = Hn(), v = fe(0), x = fe(null), F = e.geometry, S = Jn(F), C = te(() => S ? Ge(S, F, o) : {
2020
2042
  linePoints: [],
2021
2043
  lineLength: 0,
2022
2044
  rightmostPoint: new k()
@@ -2024,36 +2046,36 @@ let __tla = (async () => {
2024
2046
  S,
2025
2047
  F,
2026
2048
  o
2027
- ]), M = de((_, B, X) => {
2028
- const oe = A.domElement.getBoundingClientRect(), ce = (_ - oe.left) / oe.width * 2 - 1, se = -((B - oe.top) / oe.height) * 2 + 1, J = new Ho();
2049
+ ]), M = de((D, B, X) => {
2050
+ const oe = A.domElement.getBoundingClientRect(), ce = (D - oe.left) / oe.width * 2 - 1, se = -((B - oe.top) / oe.height) * 2 + 1, J = new Ho();
2029
2051
  J.setFromCamera(new U.Vector2(ce, se), b);
2030
2052
  const ae = new k();
2031
2053
  return J.ray.intersectPlane(X, ae) ? ae.y : null;
2032
2054
  }, [
2033
2055
  b,
2034
2056
  A
2035
- ]), E = de((_) => {
2057
+ ]), E = de((D) => {
2036
2058
  const B = new k();
2037
2059
  b.getWorldDirection(B), B.y = 0, B.lengthSq() < 1e-6 && B.set(0, 0, 1), B.normalize();
2038
2060
  const X = B.multiplyScalar(-1);
2039
- return new Mt().setFromNormalAndCoplanarPoint(X, new k(0, _, 0));
2061
+ return new Mt().setFromNormalAndCoplanarPoint(X, new k(0, D, 0));
2040
2062
  }, [
2041
2063
  b
2042
- ]), W = de((_) => {
2043
- _.stopPropagation(), h(true), A.domElement.style.cursor = "ns-resize";
2064
+ ]), $ = de((D) => {
2065
+ D.stopPropagation(), h(true), A.domElement.style.cursor = "ns-resize";
2044
2066
  const B = E(o);
2045
2067
  x.current = B;
2046
- const X = M(_.clientX, _.clientY, B);
2047
- v.current = X != null ? o - X : 0, _.target.setPointerCapture(_.pointerId), u == null ? void 0 : u();
2068
+ const X = M(D.clientX, D.clientY, B);
2069
+ v.current = X != null ? o - X : 0, D.target.setPointerCapture(D.pointerId), u == null ? void 0 : u();
2048
2070
  }, [
2049
2071
  o,
2050
2072
  A,
2051
2073
  E,
2052
2074
  M,
2053
2075
  u
2054
- ]), N = de((_) => {
2076
+ ]), N = de((D) => {
2055
2077
  if (!f || !x.current) return;
2056
- const B = M(_.clientX, _.clientY, x.current);
2078
+ const B = M(D.clientX, D.clientY, x.current);
2057
2079
  if (B == null) return;
2058
2080
  let X = B + v.current;
2059
2081
  X = Math.max(n, Math.min(s, X)), t(X);
@@ -2063,8 +2085,8 @@ let __tla = (async () => {
2063
2085
  t,
2064
2086
  n,
2065
2087
  s
2066
- ]), P = de((_) => {
2067
- h(false), A.domElement.style.cursor = "auto", x.current = null, _.target.releasePointerCapture(_.pointerId), p == null ? void 0 : p();
2088
+ ]), P = de((D) => {
2089
+ h(false), A.domElement.style.cursor = "auto", x.current = null, D.target.releasePointerCapture(D.pointerId), p == null ? void 0 : p();
2068
2090
  }, [
2069
2091
  A,
2070
2092
  p
@@ -2074,7 +2096,7 @@ let __tla = (async () => {
2074
2096
  return y("group", {
2075
2097
  renderOrder: 10,
2076
2098
  children: [
2077
- i(ve, {
2099
+ l(ve, {
2078
2100
  points: C.linePoints,
2079
2101
  color: I,
2080
2102
  lineWidth: f ? 6 : w ? 5 : 4,
@@ -2082,7 +2104,7 @@ let __tla = (async () => {
2082
2104
  depthWrite: false,
2083
2105
  transparent: true,
2084
2106
  renderOrder: 10,
2085
- onPointerDown: W,
2107
+ onPointerDown: $,
2086
2108
  onPointerMove: N,
2087
2109
  onPointerUp: P,
2088
2110
  onPointerEnter: () => {
@@ -2092,15 +2114,15 @@ let __tla = (async () => {
2092
2114
  f || (g(false), A.domElement.style.cursor = "auto");
2093
2115
  }
2094
2116
  }),
2095
- (w || f) && i("mesh", {
2117
+ (w || f) && l("mesh", {
2096
2118
  position: [
2097
- C.rightmostPoint.x + l * 0.15,
2119
+ C.rightmostPoint.x + i * 0.15,
2098
2120
  o,
2099
2121
  0
2100
2122
  ],
2101
- children: i(Xe, {
2123
+ children: l(Xe, {
2102
2124
  center: true,
2103
- children: i("div", {
2125
+ children: l("div", {
2104
2126
  style: {
2105
2127
  padding: "4px 8px",
2106
2128
  backgroundColor: "rgba(0, 0, 0, 0.8)",
@@ -2117,16 +2139,16 @@ let __tla = (async () => {
2117
2139
  ]
2118
2140
  });
2119
2141
  };
2120
- function Rr(e, o) {
2142
+ function Ir(e, o) {
2121
2143
  if (e == null) return {};
2122
- var t = {}, n = Object.keys(e), s, l;
2123
- for (l = 0; l < n.length; l++) s = n[l], !(o.indexOf(s) >= 0) && (t[s] = e[s]);
2144
+ var t = {}, n = Object.keys(e), s, i;
2145
+ for (i = 0; i < n.length; i++) s = n[i], !(o.indexOf(s) >= 0) && (t[s] = e[s]);
2124
2146
  return t;
2125
2147
  }
2126
- var Er = [
2148
+ var $r = [
2127
2149
  "color"
2128
- ], Ir = To(function(e, o) {
2129
- var t = e.color, n = t === void 0 ? "currentColor" : t, s = Rr(e, Er);
2150
+ ], Wr = To(function(e, o) {
2151
+ var t = e.color, n = t === void 0 ? "currentColor" : t, s = Ir(e, $r);
2130
2152
  return Fn("svg", Object.assign({
2131
2153
  width: "15",
2132
2154
  height: "15",
@@ -2151,7 +2173,7 @@ let __tla = (async () => {
2151
2173
  fontFamily: "system-ui, sans-serif",
2152
2174
  letterSpacing: "0.4px",
2153
2175
  lineHeight: "36px"
2154
- }, Ue = {
2176
+ }, qe = {
2155
2177
  width: "100%",
2156
2178
  padding: "10px 12px",
2157
2179
  fontSize: 15,
@@ -2160,7 +2182,7 @@ let __tla = (async () => {
2160
2182
  outline: "none",
2161
2183
  boxSizing: "border-box",
2162
2184
  fontFamily: "system-ui, sans-serif"
2163
- }, Wr = ({ amputationType: e, spacingInches: o, scanMeasurements: t, scanFrontalHeight: n, scanTransverseML: s = 0, scanTransverseAP: l = 0, onSave: d, onSkip: a, onFormChange: r, onHeightChange: c, onTransverseMLChange: u, onTransverseAPChange: p, initialValues: f, initialFrontalHeight: h }) => {
2185
+ }, Br = ({ amputationType: e, spacingInches: o, scanMeasurements: t, scanFrontalHeight: n, scanTransverseML: s = 0, scanTransverseAP: i = 0, onSave: d, onSkip: a, onFormChange: r, onHeightChange: c, onTransverseMLChange: u, onTransverseAPChange: p, initialValues: f, initialFrontalHeight: h }) => {
2164
2186
  const w = e === "AK" ? "Perineum" : "MPT", g = o, b = e === "AK" ? 18 : 9, A = te(() => {
2165
2187
  const R = [];
2166
2188
  if (e !== "AK") for (let H = 2; H >= 1; H -= g) R.push(`${H}\u2033 above ${w}`);
@@ -2183,13 +2205,13 @@ let __tla = (async () => {
2183
2205
  ]), [
2184
2206
  e,
2185
2207
  w
2186
- ]), [x, F] = $(() => {
2208
+ ]), [x, F] = W(() => {
2187
2209
  if (!f) return {};
2188
2210
  const R = {};
2189
2211
  return A.forEach((H, ne) => {
2190
2212
  f[ne] != null && f[ne] !== 0 && (R[H] = (f[ne] / 10).toFixed(1));
2191
2213
  }), R;
2192
- }), [S, C] = $(h && h > 0 ? (h / 10).toFixed(1) : ""), [M, E] = $(""), [W, N] = $(""), [P, I] = $(""), [_, B] = $(""), X = e === "AK" ? "Perineum to Distal (Axial)" : "MPT to Distal (Axial)", oe = e === "AK" ? "M/L at Perineum" : "M/L at MPT", ce = e === "AK" ? "A/P at Perineum" : "A/P at MPT", se = te(() => A.map((R) => {
2214
+ }), [S, C] = W(h && h > 0 ? (h / 10).toFixed(1) : ""), [M, E] = W(""), [$, N] = W(""), [P, I] = W(""), [D, B] = W(""), X = e === "AK" ? "Perineum to Distal (Axial)" : "MPT to Distal (Axial)", oe = e === "AK" ? "M/L at Perineum" : "M/L at MPT", ce = e === "AK" ? "A/P at Perineum" : "A/P at MPT", se = te(() => A.map((R) => {
2193
2215
  const H = x[R];
2194
2216
  return H != null && H !== "" && !isNaN(parseFloat(H)) ? parseFloat(H) * 10 : 0;
2195
2217
  }), [
@@ -2208,7 +2230,7 @@ let __tla = (async () => {
2208
2230
  S,
2209
2231
  c
2210
2232
  ]);
2211
- const J = e === "AK" ? M : P, ae = e === "AK" ? W : _;
2233
+ const J = e === "AK" ? M : P, ae = e === "AK" ? $ : D;
2212
2234
  Z(() => {
2213
2235
  const R = J !== "" && !isNaN(parseFloat(J)) ? parseFloat(J) * 10 : void 0;
2214
2236
  u == null ? void 0 : u(R);
@@ -2241,18 +2263,18 @@ let __tla = (async () => {
2241
2263
  circumferences: se,
2242
2264
  frontalHeight: H,
2243
2265
  perineumML: e === "AK" ? R(M) : void 0,
2244
- perineumAP: e === "AK" ? R(W) : void 0,
2266
+ perineumAP: e === "AK" ? R($) : void 0,
2245
2267
  mptML: e === "BK" ? R(P) : void 0,
2246
- mptAP: e === "BK" ? R(_) : void 0
2268
+ mptAP: e === "BK" ? R(D) : void 0
2247
2269
  });
2248
2270
  }, [
2249
2271
  q,
2250
2272
  se,
2251
2273
  S,
2252
2274
  M,
2253
- W,
2275
+ $,
2254
2276
  P,
2255
- _,
2277
+ D,
2256
2278
  e,
2257
2279
  d
2258
2280
  ]), re = de(() => {
@@ -2267,8 +2289,8 @@ let __tla = (async () => {
2267
2289
  const H = (s / 10).toFixed(1);
2268
2290
  e === "AK" ? E(H) : I(H);
2269
2291
  }
2270
- if (l > 0) {
2271
- const H = (l / 10).toFixed(1);
2292
+ if (i > 0) {
2293
+ const H = (i / 10).toFixed(1);
2272
2294
  e === "AK" ? N(H) : B(H);
2273
2295
  }
2274
2296
  }, [
@@ -2276,7 +2298,7 @@ let __tla = (async () => {
2276
2298
  t,
2277
2299
  n,
2278
2300
  s,
2279
- l,
2301
+ i,
2280
2302
  e
2281
2303
  ]);
2282
2304
  return y("div", {
@@ -2312,7 +2334,7 @@ let __tla = (async () => {
2312
2334
  2,
2313
2335
  3,
2314
2336
  4
2315
- ].map((R) => i("div", {
2337
+ ].map((R) => l("div", {
2316
2338
  style: {
2317
2339
  height: 4,
2318
2340
  flex: 1,
@@ -2321,7 +2343,7 @@ let __tla = (async () => {
2321
2343
  backgroundColor: "rgb(12, 67, 173)"
2322
2344
  }
2323
2345
  }, R)),
2324
- i("div", {
2346
+ l("div", {
2325
2347
  style: {
2326
2348
  fontSize: 11,
2327
2349
  fontWeight: 500,
@@ -2340,7 +2362,7 @@ let __tla = (async () => {
2340
2362
  gap: 10
2341
2363
  },
2342
2364
  children: [
2343
- i("div", {
2365
+ l("div", {
2344
2366
  style: {
2345
2367
  width: 12,
2346
2368
  height: 12,
@@ -2376,7 +2398,7 @@ let __tla = (async () => {
2376
2398
  g,
2377
2399
  "\u2033",
2378
2400
  " spacing. ",
2379
- i("span", {
2401
+ l("span", {
2380
2402
  style: {
2381
2403
  color: "#e53935"
2382
2404
  },
@@ -2394,13 +2416,13 @@ let __tla = (async () => {
2394
2416
  },
2395
2417
  children: [
2396
2418
  "No hand measurements? Tap ",
2397
- i("strong", {
2419
+ l("strong", {
2398
2420
  children: "Pull from Scan"
2399
2421
  }),
2400
2422
  " to prefill from the 3D scan."
2401
2423
  ]
2402
2424
  }),
2403
- i("button", {
2425
+ l("button", {
2404
2426
  onClick: re,
2405
2427
  style: {
2406
2428
  ...Tn,
@@ -2420,7 +2442,7 @@ let __tla = (async () => {
2420
2442
  gap: 4
2421
2443
  },
2422
2444
  children: [
2423
- i(Ir, {
2445
+ l(Wr, {
2424
2446
  style: {
2425
2447
  width: 14,
2426
2448
  height: 14
@@ -2441,7 +2463,7 @@ let __tla = (async () => {
2441
2463
  WebkitOverflowScrolling: "touch"
2442
2464
  },
2443
2465
  children: [
2444
- i("div", {
2466
+ l("div", {
2445
2467
  style: {
2446
2468
  fontSize: 13,
2447
2469
  fontWeight: 600,
@@ -2450,7 +2472,7 @@ let __tla = (async () => {
2450
2472
  },
2451
2473
  children: "Circumferences"
2452
2474
  }),
2453
- i("div", {
2475
+ l("div", {
2454
2476
  style: {
2455
2477
  display: "grid",
2456
2478
  gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
@@ -2480,7 +2502,7 @@ let __tla = (async () => {
2480
2502
  title: R,
2481
2503
  children: [
2482
2504
  R,
2483
- ne && i("span", {
2505
+ ne && l("span", {
2484
2506
  style: {
2485
2507
  color: "#e53935",
2486
2508
  marginLeft: 2
@@ -2489,7 +2511,7 @@ let __tla = (async () => {
2489
2511
  })
2490
2512
  ]
2491
2513
  }),
2492
- i("input", {
2514
+ l("input", {
2493
2515
  type: "number",
2494
2516
  step: "0.1",
2495
2517
  value: x[R] ?? "",
@@ -2498,7 +2520,7 @@ let __tla = (async () => {
2498
2520
  [R]: j.target.value
2499
2521
  })),
2500
2522
  style: {
2501
- ...Ue,
2523
+ ...qe,
2502
2524
  padding: "6px 8px",
2503
2525
  fontSize: 13,
2504
2526
  borderColor: Q ? "rgb(12, 67, 173)" : "#ccc",
@@ -2510,7 +2532,7 @@ let __tla = (async () => {
2510
2532
  }, H);
2511
2533
  })
2512
2534
  }),
2513
- i("div", {
2535
+ l("div", {
2514
2536
  style: {
2515
2537
  fontSize: 13,
2516
2538
  fontWeight: 600,
@@ -2547,7 +2569,7 @@ let __tla = (async () => {
2547
2569
  title: X,
2548
2570
  children: [
2549
2571
  X,
2550
- i("span", {
2572
+ l("span", {
2551
2573
  style: {
2552
2574
  color: "#e53935",
2553
2575
  marginLeft: 2
@@ -2556,13 +2578,13 @@ let __tla = (async () => {
2556
2578
  })
2557
2579
  ]
2558
2580
  }),
2559
- i("input", {
2581
+ l("input", {
2560
2582
  type: "number",
2561
2583
  step: "0.1",
2562
2584
  value: S,
2563
2585
  onChange: (R) => C(R.target.value),
2564
2586
  style: {
2565
- ...Ue,
2587
+ ...qe,
2566
2588
  padding: "6px 8px",
2567
2589
  fontSize: 13,
2568
2590
  borderColor: S ? "rgb(12, 67, 173)" : "#ccc",
@@ -2572,7 +2594,7 @@ let __tla = (async () => {
2572
2594
  })
2573
2595
  ]
2574
2596
  }),
2575
- e === "AK" ? y(_e, {
2597
+ e === "AK" ? y(Re, {
2576
2598
  children: [
2577
2599
  y("div", {
2578
2600
  style: {
@@ -2582,7 +2604,7 @@ let __tla = (async () => {
2582
2604
  minWidth: 0
2583
2605
  },
2584
2606
  children: [
2585
- i("label", {
2607
+ l("label", {
2586
2608
  style: {
2587
2609
  fontSize: 11,
2588
2610
  fontWeight: 500,
@@ -2595,13 +2617,13 @@ let __tla = (async () => {
2595
2617
  title: oe,
2596
2618
  children: oe
2597
2619
  }),
2598
- i("input", {
2620
+ l("input", {
2599
2621
  type: "number",
2600
2622
  step: "0.1",
2601
2623
  value: M,
2602
2624
  onChange: (R) => E(R.target.value),
2603
2625
  style: {
2604
- ...Ue,
2626
+ ...qe,
2605
2627
  padding: "6px 8px",
2606
2628
  fontSize: 13,
2607
2629
  borderColor: M ? "rgb(12, 67, 173)" : "#ccc",
@@ -2619,7 +2641,7 @@ let __tla = (async () => {
2619
2641
  minWidth: 0
2620
2642
  },
2621
2643
  children: [
2622
- i("label", {
2644
+ l("label", {
2623
2645
  style: {
2624
2646
  fontSize: 11,
2625
2647
  fontWeight: 500,
@@ -2632,16 +2654,16 @@ let __tla = (async () => {
2632
2654
  title: ce,
2633
2655
  children: ce
2634
2656
  }),
2635
- i("input", {
2657
+ l("input", {
2636
2658
  type: "number",
2637
2659
  step: "0.1",
2638
- value: W,
2660
+ value: $,
2639
2661
  onChange: (R) => N(R.target.value),
2640
2662
  style: {
2641
- ...Ue,
2663
+ ...qe,
2642
2664
  padding: "6px 8px",
2643
2665
  fontSize: 13,
2644
- borderColor: W ? "rgb(12, 67, 173)" : "#ccc",
2666
+ borderColor: $ ? "rgb(12, 67, 173)" : "#ccc",
2645
2667
  borderWidth: 1
2646
2668
  },
2647
2669
  placeholder: "0.0"
@@ -2649,7 +2671,7 @@ let __tla = (async () => {
2649
2671
  ]
2650
2672
  })
2651
2673
  ]
2652
- }) : y(_e, {
2674
+ }) : y(Re, {
2653
2675
  children: [
2654
2676
  y("div", {
2655
2677
  style: {
@@ -2659,7 +2681,7 @@ let __tla = (async () => {
2659
2681
  minWidth: 0
2660
2682
  },
2661
2683
  children: [
2662
- i("label", {
2684
+ l("label", {
2663
2685
  style: {
2664
2686
  fontSize: 11,
2665
2687
  fontWeight: 500,
@@ -2672,13 +2694,13 @@ let __tla = (async () => {
2672
2694
  title: oe,
2673
2695
  children: oe
2674
2696
  }),
2675
- i("input", {
2697
+ l("input", {
2676
2698
  type: "number",
2677
2699
  step: "0.1",
2678
2700
  value: P,
2679
2701
  onChange: (R) => I(R.target.value),
2680
2702
  style: {
2681
- ...Ue,
2703
+ ...qe,
2682
2704
  padding: "6px 8px",
2683
2705
  fontSize: 13,
2684
2706
  borderColor: P ? "rgb(12, 67, 173)" : "#ccc",
@@ -2696,7 +2718,7 @@ let __tla = (async () => {
2696
2718
  minWidth: 0
2697
2719
  },
2698
2720
  children: [
2699
- i("label", {
2721
+ l("label", {
2700
2722
  style: {
2701
2723
  fontSize: 11,
2702
2724
  fontWeight: 500,
@@ -2709,16 +2731,16 @@ let __tla = (async () => {
2709
2731
  title: ce,
2710
2732
  children: ce
2711
2733
  }),
2712
- i("input", {
2734
+ l("input", {
2713
2735
  type: "number",
2714
2736
  step: "0.1",
2715
- value: _,
2737
+ value: D,
2716
2738
  onChange: (R) => B(R.target.value),
2717
2739
  style: {
2718
- ...Ue,
2740
+ ...qe,
2719
2741
  padding: "6px 8px",
2720
2742
  fontSize: 13,
2721
- borderColor: _ ? "rgb(12, 67, 173)" : "#ccc",
2743
+ borderColor: D ? "rgb(12, 67, 173)" : "#ccc",
2722
2744
  borderWidth: 1
2723
2745
  },
2724
2746
  placeholder: "0.0"
@@ -2731,7 +2753,7 @@ let __tla = (async () => {
2731
2753
  })
2732
2754
  ]
2733
2755
  }),
2734
- i("div", {
2756
+ l("div", {
2735
2757
  style: {
2736
2758
  padding: "12px 20px",
2737
2759
  backgroundColor: "#fff",
@@ -2741,7 +2763,7 @@ let __tla = (async () => {
2741
2763
  gap: 8,
2742
2764
  flexShrink: 0
2743
2765
  },
2744
- children: i("button", {
2766
+ children: l("button", {
2745
2767
  onClick: ge,
2746
2768
  disabled: !q,
2747
2769
  style: {
@@ -2759,13 +2781,13 @@ let __tla = (async () => {
2759
2781
  })
2760
2782
  ]
2761
2783
  });
2762
- }, $r = [
2784
+ }, Tr = [
2763
2785
  "Scan doesn't load properly",
2764
2786
  "Modified CAD",
2765
2787
  "I don't want to",
2766
2788
  "I want a second opinion",
2767
2789
  "I measured from Perineum"
2768
- ], wt = {
2790
+ ], vt = {
2769
2791
  padding: "8px 20px",
2770
2792
  borderRadius: 4,
2771
2793
  fontSize: 14,
@@ -2774,7 +2796,7 @@ let __tla = (async () => {
2774
2796
  fontFamily: "system-ui, sans-serif",
2775
2797
  letterSpacing: "0.4px",
2776
2798
  lineHeight: "36px"
2777
- }, Br = {
2799
+ }, Or = {
2778
2800
  width: "100%",
2779
2801
  padding: "10px 12px",
2780
2802
  fontSize: 15,
@@ -2783,11 +2805,11 @@ let __tla = (async () => {
2783
2805
  outline: "none",
2784
2806
  boxSizing: "border-box",
2785
2807
  fontFamily: "system-ui, sans-serif"
2786
- }, Tr = ({ onSkip: e, onCancel: o }) => {
2787
- const [t, n] = $("confirm"), [s, l] = $(null), [d, a] = $(""), r = de(() => {
2808
+ }, Hr = ({ onSkip: e, onCancel: o }) => {
2809
+ const [t, n] = W("confirm"), [s, i] = W(null), [d, a] = W(""), r = de(() => {
2788
2810
  n("reasons");
2789
2811
  }, []), c = de(() => {
2790
- t === "reasons" ? (n("confirm"), l(null), a("")) : o();
2812
+ t === "reasons" ? (n("confirm"), i(null), a("")) : o();
2791
2813
  }, [
2792
2814
  t,
2793
2815
  o
@@ -2799,7 +2821,7 @@ let __tla = (async () => {
2799
2821
  d,
2800
2822
  e
2801
2823
  ]);
2802
- return t === "reasons" ? i("div", {
2824
+ return t === "reasons" ? l("div", {
2803
2825
  style: {
2804
2826
  position: "fixed",
2805
2827
  inset: 0,
@@ -2825,7 +2847,7 @@ let __tla = (async () => {
2825
2847
  padding: "24px 24px 0"
2826
2848
  },
2827
2849
  children: [
2828
- i("div", {
2850
+ l("div", {
2829
2851
  style: {
2830
2852
  fontSize: 18,
2831
2853
  fontWeight: 600,
@@ -2834,7 +2856,7 @@ let __tla = (async () => {
2834
2856
  },
2835
2857
  children: "Why are you skipping?"
2836
2858
  }),
2837
- i("div", {
2859
+ l("div", {
2838
2860
  style: {
2839
2861
  fontSize: 13,
2840
2862
  color: "rgba(0,0,0,0.5)"
@@ -2852,7 +2874,7 @@ let __tla = (async () => {
2852
2874
  },
2853
2875
  children: [
2854
2876
  [
2855
- ...$r,
2877
+ ...Tr,
2856
2878
  "Other"
2857
2879
  ].map((f) => y("label", {
2858
2880
  style: {
@@ -2865,12 +2887,12 @@ let __tla = (async () => {
2865
2887
  backgroundColor: s === f ? "rgba(12, 67, 173, 0.06)" : "transparent"
2866
2888
  },
2867
2889
  children: [
2868
- i("input", {
2890
+ l("input", {
2869
2891
  type: "radio",
2870
2892
  name: "skip-reason",
2871
2893
  checked: s === f,
2872
2894
  onChange: () => {
2873
- l(f), f !== "Other" && a("");
2895
+ i(f), f !== "Other" && a("");
2874
2896
  },
2875
2897
  style: {
2876
2898
  accentColor: "rgb(12, 67, 173)",
@@ -2880,7 +2902,7 @@ let __tla = (async () => {
2880
2902
  flexShrink: 0
2881
2903
  }
2882
2904
  }),
2883
- i("span", {
2905
+ l("span", {
2884
2906
  style: {
2885
2907
  fontSize: 14,
2886
2908
  color: "#333"
@@ -2889,7 +2911,7 @@ let __tla = (async () => {
2889
2911
  })
2890
2912
  ]
2891
2913
  }, f)),
2892
- s === "Other" && i("input", {
2914
+ s === "Other" && l("input", {
2893
2915
  autoFocus: true,
2894
2916
  type: "text",
2895
2917
  placeholder: "Please describe...",
@@ -2899,7 +2921,7 @@ let __tla = (async () => {
2899
2921
  f.key === "Enter" && p();
2900
2922
  },
2901
2923
  style: {
2902
- ...Br,
2924
+ ...Or,
2903
2925
  marginTop: 8,
2904
2926
  marginLeft: 40,
2905
2927
  width: "calc(100% - 40px)",
@@ -2917,21 +2939,21 @@ let __tla = (async () => {
2917
2939
  borderTop: "1px solid #eee"
2918
2940
  },
2919
2941
  children: [
2920
- i("button", {
2942
+ l("button", {
2921
2943
  onClick: c,
2922
2944
  style: {
2923
- ...wt,
2945
+ ...vt,
2924
2946
  backgroundColor: "#fff",
2925
2947
  border: "1px solid #ddd",
2926
2948
  color: "#666"
2927
2949
  },
2928
2950
  children: "Cancel"
2929
2951
  }),
2930
- i("button", {
2952
+ l("button", {
2931
2953
  onClick: p,
2932
2954
  disabled: !u,
2933
2955
  style: {
2934
- ...wt,
2956
+ ...vt,
2935
2957
  backgroundColor: u ? "rgb(12, 67, 173)" : "#e0e0e0",
2936
2958
  border: "none",
2937
2959
  color: u ? "#fff" : "#9e9e9e",
@@ -2943,7 +2965,7 @@ let __tla = (async () => {
2943
2965
  })
2944
2966
  ]
2945
2967
  })
2946
- }) : i("div", {
2968
+ }) : l("div", {
2947
2969
  style: {
2948
2970
  position: "fixed",
2949
2971
  inset: 0,
@@ -2965,7 +2987,7 @@ let __tla = (async () => {
2965
2987
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
2966
2988
  },
2967
2989
  children: [
2968
- i("div", {
2990
+ l("div", {
2969
2991
  style: {
2970
2992
  fontSize: 20,
2971
2993
  fontWeight: 600,
@@ -2974,7 +2996,7 @@ let __tla = (async () => {
2974
2996
  },
2975
2997
  children: "Skip Scan Comparison?"
2976
2998
  }),
2977
- i("div", {
2999
+ l("div", {
2978
3000
  style: {
2979
3001
  fontSize: 14,
2980
3002
  color: "rgba(0,0,0,0.54)",
@@ -2989,20 +3011,20 @@ let __tla = (async () => {
2989
3011
  gap: 8
2990
3012
  },
2991
3013
  children: [
2992
- i("button", {
3014
+ l("button", {
2993
3015
  onClick: o,
2994
3016
  style: {
2995
- ...wt,
3017
+ ...vt,
2996
3018
  backgroundColor: "#fff",
2997
3019
  border: "1px solid #bdbdbd",
2998
3020
  color: "#333"
2999
3021
  },
3000
3022
  children: "Cancel"
3001
3023
  }),
3002
- i("button", {
3024
+ l("button", {
3003
3025
  onClick: r,
3004
3026
  style: {
3005
- ...wt,
3027
+ ...vt,
3006
3028
  backgroundColor: "rgb(12, 67, 173)",
3007
3029
  border: "none",
3008
3030
  color: "#fff"
@@ -3018,8 +3040,8 @@ let __tla = (async () => {
3018
3040
  function Qn(e, o, t) {
3019
3041
  const n = e.getAttribute("position"), s = t - o;
3020
3042
  if (s < 1) return null;
3021
- const l = 30, d = s / l, a = [];
3022
- for (let b = 0; b < l; b++) {
3043
+ const i = 30, d = s / i, a = [];
3044
+ for (let b = 0; b < i; b++) {
3023
3045
  const A = o + b * d, v = o + (b + 1) * d;
3024
3046
  let x = 0, F = 0, S = 0, C = 0;
3025
3047
  for (let M = 0; M < n.count; M++) {
@@ -3045,7 +3067,7 @@ let __tla = (async () => {
3045
3067
  }
3046
3068
  return g.y < 0 && g.negate(), g;
3047
3069
  }
3048
- const Or = {
3070
+ const Nr = {
3049
3071
  pcaAxes: true,
3050
3072
  obb: true,
3051
3073
  obbAxis: true,
@@ -3055,7 +3077,7 @@ let __tla = (async () => {
3055
3077
  landmarkAxis: true,
3056
3078
  iterativePCA: false,
3057
3079
  fullRegionPCA: true
3058
- }, Hr = [
3080
+ }, Vr = [
3059
3081
  "#ff4444",
3060
3082
  "#44cc44",
3061
3083
  "#4488ff"
@@ -3064,20 +3086,20 @@ let __tla = (async () => {
3064
3086
  const o = e.getAttribute("position"), t = o.count, n = new k();
3065
3087
  for (let g = 0; g < t; g++) n.x += o.getX(g), n.y += o.getY(g), n.z += o.getZ(g);
3066
3088
  n.divideScalar(t);
3067
- let s = 0, l = 0, d = 0, a = 0, r = 0, c = 0;
3089
+ let s = 0, i = 0, d = 0, a = 0, r = 0, c = 0;
3068
3090
  for (let g = 0; g < t; g++) {
3069
3091
  const b = o.getX(g) - n.x, A = o.getY(g) - n.y, v = o.getZ(g) - n.z;
3070
- s += b * b, l += b * A, d += b * v, a += A * A, r += A * v, c += v * v;
3092
+ s += b * b, i += b * A, d += b * v, a += A * A, r += A * v, c += v * v;
3071
3093
  }
3072
- s /= t, l /= t, d /= t, a /= t, r /= t, c /= t;
3094
+ s /= t, i /= t, d /= t, a /= t, r /= t, c /= t;
3073
3095
  const u = [], p = [], f = [
3074
3096
  [
3075
3097
  s,
3076
- l,
3098
+ i,
3077
3099
  d
3078
3100
  ],
3079
3101
  [
3080
- l,
3102
+ i,
3081
3103
  a,
3082
3104
  r
3083
3105
  ],
@@ -3136,25 +3158,25 @@ let __tla = (async () => {
3136
3158
  halfExtents: w
3137
3159
  };
3138
3160
  }
3139
- function Nr({ pca: e }) {
3140
- return i("group", {
3161
+ function jr({ pca: e }) {
3162
+ return l("group", {
3141
3163
  children: e.axes.map((o, t) => {
3142
3164
  const n = e.center.clone().addScaledVector(o, e.halfExtents[t]), s = e.center.clone().addScaledVector(o, -e.halfExtents[t]);
3143
- return i(ve, {
3165
+ return l(ve, {
3144
3166
  points: [
3145
3167
  s,
3146
3168
  n
3147
3169
  ],
3148
- color: Hr[t],
3170
+ color: Vr[t],
3149
3171
  lineWidth: 2
3150
3172
  }, t);
3151
3173
  })
3152
3174
  });
3153
3175
  }
3154
- function Vr({ pca: e }) {
3176
+ function Gr({ pca: e }) {
3155
3177
  const o = te(() => {
3156
- const { center: t, axes: n, halfExtents: s } = e, l = [];
3157
- for (let a = -1; a <= 1; a += 2) for (let r = -1; r <= 1; r += 2) for (let c = -1; c <= 1; c += 2) l.push(t.clone().addScaledVector(n[0], a * s[0]).addScaledVector(n[1], r * s[1]).addScaledVector(n[2], c * s[2]));
3178
+ const { center: t, axes: n, halfExtents: s } = e, i = [];
3179
+ for (let a = -1; a <= 1; a += 2) for (let r = -1; r <= 1; r += 2) for (let c = -1; c <= 1; c += 2) i.push(t.clone().addScaledVector(n[0], a * s[0]).addScaledVector(n[1], r * s[1]).addScaledVector(n[2], c * s[2]));
3158
3180
  return [
3159
3181
  [
3160
3182
  0,
@@ -3205,14 +3227,14 @@ let __tla = (async () => {
3205
3227
  7
3206
3228
  ]
3207
3229
  ].map(([a, r]) => [
3208
- l[a],
3209
- l[r]
3230
+ i[a],
3231
+ i[r]
3210
3232
  ]);
3211
3233
  }, [
3212
3234
  e
3213
3235
  ]);
3214
- return i("group", {
3215
- children: o.map((t, n) => i(ve, {
3236
+ return l("group", {
3237
+ children: o.map((t, n) => l(ve, {
3216
3238
  points: t,
3217
3239
  color: "#ffaa00",
3218
3240
  lineWidth: 1,
@@ -3221,19 +3243,19 @@ let __tla = (async () => {
3221
3243
  }, n))
3222
3244
  });
3223
3245
  }
3224
- function jr({ redPoint: e, greenPoint: o }) {
3246
+ function Xr({ redPoint: e, greenPoint: o }) {
3225
3247
  const t = te(() => new k().subVectors(o, e).normalize(), [
3226
3248
  e,
3227
3249
  o
3228
3250
  ]), n = te(() => {
3229
- const l = t.dot(new k(0, 1, 0));
3230
- return Math.acos(Math.min(1, Math.abs(l))) * 180 / Math.PI;
3251
+ const i = t.dot(new k(0, 1, 0));
3252
+ return Math.acos(Math.min(1, Math.abs(i))) * 180 / Math.PI;
3231
3253
  }, [
3232
3254
  t
3233
3255
  ]), s = n < 1 ? "#44ff44" : n < 5 ? "#ffcc00" : "#ff4444";
3234
3256
  return y("group", {
3235
3257
  children: [
3236
- i(ve, {
3258
+ l(ve, {
3237
3259
  points: [
3238
3260
  e,
3239
3261
  o
@@ -3244,14 +3266,14 @@ let __tla = (async () => {
3244
3266
  y("mesh", {
3245
3267
  position: e,
3246
3268
  children: [
3247
- i("sphereGeometry", {
3269
+ l("sphereGeometry", {
3248
3270
  args: [
3249
3271
  1.5,
3250
3272
  8,
3251
3273
  8
3252
3274
  ]
3253
3275
  }),
3254
- i("meshBasicMaterial", {
3276
+ l("meshBasicMaterial", {
3255
3277
  color: "#ff4444"
3256
3278
  })
3257
3279
  ]
@@ -3259,14 +3281,14 @@ let __tla = (async () => {
3259
3281
  y("mesh", {
3260
3282
  position: o,
3261
3283
  children: [
3262
- i("sphereGeometry", {
3284
+ l("sphereGeometry", {
3263
3285
  args: [
3264
3286
  1.5,
3265
3287
  8,
3266
3288
  8
3267
3289
  ]
3268
3290
  }),
3269
- i("meshBasicMaterial", {
3291
+ l("meshBasicMaterial", {
3270
3292
  color: "#44ff44"
3271
3293
  })
3272
3294
  ]
@@ -3274,8 +3296,8 @@ let __tla = (async () => {
3274
3296
  ]
3275
3297
  });
3276
3298
  }
3277
- function Gr({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3278
- const l = n * 0.15, d = te(() => {
3299
+ function Yr({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3300
+ const i = n * 0.15, d = te(() => {
3279
3301
  const a = [];
3280
3302
  let r = t - 10;
3281
3303
  const c = new k(0, 1, 0);
@@ -3298,12 +3320,12 @@ let __tla = (async () => {
3298
3320
  o,
3299
3321
  t
3300
3322
  ]);
3301
- return i("group", {
3323
+ return l("group", {
3302
3324
  children: d.map((a, r) => {
3303
- const c = (a.regionMin + a.regionMax) / 2, u = new k(0, c, 0), p = u.clone().addScaledVector(a.axis, l), f = u.clone().addScaledVector(a.axis, -l), h = r / Math.max(1, d.length - 1), w = a.angleDeg < 0.5 ? `hsl(${120 - h * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
3325
+ const c = (a.regionMin + a.regionMax) / 2, u = new k(0, c, 0), p = u.clone().addScaledVector(a.axis, i), f = u.clone().addScaledVector(a.axis, -i), h = r / Math.max(1, d.length - 1), w = a.angleDeg < 0.5 ? `hsl(${120 - h * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
3304
3326
  return y("group", {
3305
3327
  children: [
3306
- i(ve, {
3328
+ l(ve, {
3307
3329
  points: [
3308
3330
  f,
3309
3331
  p
@@ -3313,10 +3335,10 @@ let __tla = (async () => {
3313
3335
  transparent: true,
3314
3336
  opacity: 0.7
3315
3337
  }),
3316
- i(ve, {
3338
+ l(ve, {
3317
3339
  points: [
3318
- new k(-l * 0.3, a.regionMin, 0),
3319
- new k(l * 0.3, a.regionMin, 0)
3340
+ new k(-i * 0.3, a.regionMin, 0),
3341
+ new k(i * 0.3, a.regionMin, 0)
3320
3342
  ],
3321
3343
  color: w,
3322
3344
  lineWidth: 0.5,
@@ -3328,7 +3350,7 @@ let __tla = (async () => {
3328
3350
  })
3329
3351
  });
3330
3352
  }
3331
- function Xr({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3353
+ function Kr({ geometry: e, redY: o, greenY: t, modelSize: n }) {
3332
3354
  const s = te(() => {
3333
3355
  const p = Qn(e, o, t);
3334
3356
  if (!p) return null;
@@ -3343,9 +3365,9 @@ let __tla = (async () => {
3343
3365
  t
3344
3366
  ]);
3345
3367
  if (!s) return null;
3346
- const l = (o + t) / 2, d = new k(0, l, 0), a = n * 0.4, r = d.clone().addScaledVector(s.axis, a), c = d.clone().addScaledVector(s.axis, -a), u = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
3347
- return i("group", {
3348
- children: i(ve, {
3368
+ const i = (o + t) / 2, d = new k(0, i, 0), a = n * 0.4, r = d.clone().addScaledVector(s.axis, a), c = d.clone().addScaledVector(s.axis, -a), u = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
3369
+ return l("group", {
3370
+ children: l(ve, {
3349
3371
  points: [
3350
3372
  c,
3351
3373
  r
@@ -3358,11 +3380,11 @@ let __tla = (async () => {
3358
3380
  })
3359
3381
  });
3360
3382
  }
3361
- function Yr({ pca: e, modelSize: o }) {
3362
- const t = e.axes[0], n = o * 0.6, s = e.center.clone().addScaledVector(t, n), l = e.center.clone().addScaledVector(t, -n);
3363
- return i(ve, {
3383
+ function Zr({ pca: e, modelSize: o }) {
3384
+ const t = e.axes[0], n = o * 0.6, s = e.center.clone().addScaledVector(t, n), i = e.center.clone().addScaledVector(t, -n);
3385
+ return l(ve, {
3364
3386
  points: [
3365
- l,
3387
+ i,
3366
3388
  s
3367
3389
  ],
3368
3390
  color: "#ff8800",
@@ -3372,20 +3394,20 @@ let __tla = (async () => {
3372
3394
  gapSize: 2
3373
3395
  });
3374
3396
  }
3375
- function Kr({ geometry: e, redY: o, greenY: t, modelSize: n, measurementGeometry: s }) {
3376
- const l = te(() => {
3397
+ function Ur({ geometry: e, redY: o, greenY: t, modelSize: n, measurementGeometry: s }) {
3398
+ const i = te(() => {
3377
3399
  const u = s ?? e, p = Qt(u), f = new k(0, 1, 0), h = 5, g = t + 3 * 25.4, b = [];
3378
3400
  for (let E = o + h; E < g; E += h) {
3379
- const W = cr(p, u, new k(0, E, 0), f);
3380
- W > 0 && b.push({
3401
+ const $ = fr(p, u, new k(0, E, 0), f);
3402
+ $ > 0 && b.push({
3381
3403
  y: E,
3382
- circ: W
3404
+ circ: $
3383
3405
  });
3384
3406
  }
3385
3407
  if (b.length < 5) return null;
3386
3408
  const A = t - o, v = o + A * 0.3, x = o + A * 0.7, F = b.filter((E) => E.y >= v && E.y <= x);
3387
3409
  if (F.length < 3) return null;
3388
- const S = F.map((E) => E.circ).sort((E, W) => E - W), C = S[Math.floor(S.length / 2)], M = Math.max(...b.map((E) => E.circ));
3410
+ const S = F.map((E) => E.circ).sort((E, $) => E - $), C = S[Math.floor(S.length / 2)], M = Math.max(...b.map((E) => E.circ));
3389
3411
  return {
3390
3412
  circumferences: b,
3391
3413
  baseline: C,
@@ -3396,13 +3418,13 @@ let __tla = (async () => {
3396
3418
  o,
3397
3419
  t
3398
3420
  ]);
3399
- if (!l) return null;
3400
- const { circumferences: d, baseline: a, maxCirc: r } = l, c = n * 0.3 / r;
3421
+ if (!i) return null;
3422
+ const { circumferences: d, baseline: a, maxCirc: r } = i, c = n * 0.3 / r;
3401
3423
  return y("group", {
3402
3424
  children: [
3403
3425
  d.map(({ y: u, circ: p }, f) => {
3404
3426
  const h = p / a, w = h > 1.6 ? "#ff4444" : h > 1.3 ? "#ffcc00" : "#22cc66", g = p * c;
3405
- return i(ve, {
3427
+ return l(ve, {
3406
3428
  points: [
3407
3429
  new k(-g, u, 0),
3408
3430
  new k(g, u, 0)
@@ -3415,9 +3437,9 @@ let __tla = (async () => {
3415
3437
  }),
3416
3438
  (() => {
3417
3439
  const u = a * 1.6 * c, p = d[0].y, f = d[d.length - 1].y;
3418
- return y(_e, {
3440
+ return y(Re, {
3419
3441
  children: [
3420
- i(ve, {
3442
+ l(ve, {
3421
3443
  points: [
3422
3444
  new k(-u, p, 0),
3423
3445
  new k(-u, f, 0)
@@ -3430,7 +3452,7 @@ let __tla = (async () => {
3430
3452
  transparent: true,
3431
3453
  opacity: 0.4
3432
3454
  }),
3433
- i(ve, {
3455
+ l(ve, {
3434
3456
  points: [
3435
3457
  new k(u, p, 0),
3436
3458
  new k(u, f, 0)
@@ -3449,18 +3471,18 @@ let __tla = (async () => {
3449
3471
  ]
3450
3472
  });
3451
3473
  }
3452
- function Zr({ componentDebug: e }) {
3453
- return i("group", {
3474
+ function qr({ componentDebug: e }) {
3475
+ return l("group", {
3454
3476
  children: e.geometries.map((o, t) => {
3455
3477
  const n = e.colors[t] ?? "#888888", s = t === e.innerIdx;
3456
3478
  o.computeBoundingBox();
3457
- const l = new k();
3458
- return o.boundingBox.getCenter(l), y("group", {
3479
+ const i = new k();
3480
+ return o.boundingBox.getCenter(i), y("group", {
3459
3481
  children: [
3460
- i("mesh", {
3482
+ l("mesh", {
3461
3483
  geometry: o,
3462
3484
  renderOrder: s ? 2 : 1,
3463
- children: i("meshStandardMaterial", {
3485
+ children: l("meshStandardMaterial", {
3464
3486
  color: n,
3465
3487
  transparent: true,
3466
3488
  opacity: s ? 0.5 : 0.2,
@@ -3471,24 +3493,24 @@ let __tla = (async () => {
3471
3493
  polygonOffsetUnits: 1
3472
3494
  })
3473
3495
  }),
3474
- i("mesh", {
3496
+ l("mesh", {
3475
3497
  geometry: o,
3476
3498
  renderOrder: s ? 2 : 1,
3477
- children: i("meshBasicMaterial", {
3499
+ children: l("meshBasicMaterial", {
3478
3500
  color: n,
3479
3501
  wireframe: true,
3480
3502
  transparent: true,
3481
3503
  opacity: s ? 0.4 : 0.15
3482
3504
  })
3483
3505
  }),
3484
- i("group", {
3485
- position: l,
3486
- children: i(Xe, {
3506
+ l("group", {
3507
+ position: i,
3508
+ children: l(Xe, {
3487
3509
  center: true,
3488
3510
  style: {
3489
3511
  pointerEvents: "none"
3490
3512
  },
3491
- children: i("div", {
3513
+ children: l("div", {
3492
3514
  style: {
3493
3515
  padding: "2px 8px",
3494
3516
  backgroundColor: "rgba(0,0,0,0.8)",
@@ -3496,7 +3518,7 @@ let __tla = (async () => {
3496
3518
  border: `1px solid ${n}`,
3497
3519
  whiteSpace: "nowrap"
3498
3520
  },
3499
- children: i("span", {
3521
+ children: l("span", {
3500
3522
  style: {
3501
3523
  fontSize: 11,
3502
3524
  color: n,
@@ -3513,10 +3535,10 @@ let __tla = (async () => {
3513
3535
  })
3514
3536
  });
3515
3537
  }
3516
- function Ur({ geometry: e, aoData: o }) {
3538
+ function Jr({ geometry: e, aoData: o }) {
3517
3539
  const t = te(() => {
3518
- const n = e.toNonIndexed(), s = n.getAttribute("position"), l = o.length, d = s.count, a = new Float32Array(d * 3);
3519
- for (let r = 0; r < l && r * 3 + 2 < d; r++) {
3540
+ const n = e.toNonIndexed(), s = n.getAttribute("position"), i = o.length, d = s.count, a = new Float32Array(d * 3);
3541
+ for (let r = 0; r < i && r * 3 + 2 < d; r++) {
3520
3542
  const c = o[r], u = c, p = c < 0.5 ? 0.8 - c * 1.2 : 0.2 * (1 - c), f = 1 - c;
3521
3543
  for (let h = 0; h < 3; h++) {
3522
3544
  const w = (r * 3 + h) * 3;
@@ -3530,10 +3552,10 @@ let __tla = (async () => {
3530
3552
  ]);
3531
3553
  return te(() => () => t.dispose(), [
3532
3554
  t
3533
- ]), i("mesh", {
3555
+ ]), l("mesh", {
3534
3556
  geometry: t,
3535
3557
  renderOrder: 3,
3536
- children: i("meshBasicMaterial", {
3558
+ children: l("meshBasicMaterial", {
3537
3559
  vertexColors: true,
3538
3560
  transparent: true,
3539
3561
  opacity: 0.85,
@@ -3542,7 +3564,7 @@ let __tla = (async () => {
3542
3564
  })
3543
3565
  });
3544
3566
  }
3545
- function qr({ mesh: e, layers: o, landmarkPoints: t, componentDebug: n, aoData: s, aoGeometry: l, measurementGeometry: d }) {
3567
+ function Qr({ mesh: e, layers: o, landmarkPoints: t, componentDebug: n, aoData: s, aoGeometry: i, measurementGeometry: d }) {
3546
3568
  const a = e.geometry, r = te(() => a.getAttribute("position") ? eo(a) : null, [
3547
3569
  a
3548
3570
  ]), c = te(() => !t || t.length < 2 ? null : {
@@ -3553,34 +3575,34 @@ let __tla = (async () => {
3553
3575
  ]);
3554
3576
  return y("group", {
3555
3577
  children: [
3556
- o.pcaAxes && r && i(Nr, {
3578
+ o.pcaAxes && r && l(jr, {
3557
3579
  pca: r
3558
3580
  }),
3559
- o.obb && r && i(Vr, {
3581
+ o.obb && r && l(Gr, {
3560
3582
  pca: r
3561
3583
  }),
3562
- o.obbAxis && r && i(Yr, {
3584
+ o.obbAxis && r && l(Zr, {
3563
3585
  pca: r,
3564
3586
  modelSize: r.halfExtents[0] ? Math.max(...r.halfExtents) * 2 : 100
3565
3587
  }),
3566
- o.shellComponents && n && i(Zr, {
3588
+ o.shellComponents && n && l(qr, {
3567
3589
  componentDebug: n
3568
3590
  }),
3569
- o.ambientOcclusion && s && s.length > 0 && i(Ur, {
3570
- geometry: l ?? a,
3591
+ o.ambientOcclusion && s && s.length > 0 && l(Jr, {
3592
+ geometry: i ?? a,
3571
3593
  aoData: s
3572
3594
  }),
3573
- o.circumferenceScan && c && i(Kr, {
3595
+ o.circumferenceScan && c && l(Ur, {
3574
3596
  geometry: a,
3575
3597
  redY: c.red.y,
3576
3598
  greenY: c.green.y,
3577
3599
  modelSize: (r == null ? void 0 : r.halfExtents[0]) ? Math.max(...r.halfExtents) * 2 : 100,
3578
3600
  measurementGeometry: d
3579
3601
  }),
3580
- d && i("mesh", {
3602
+ d && l("mesh", {
3581
3603
  geometry: d,
3582
3604
  renderOrder: 5,
3583
- children: i("meshBasicMaterial", {
3605
+ children: l("meshBasicMaterial", {
3584
3606
  color: "#00ccff",
3585
3607
  wireframe: true,
3586
3608
  transparent: true,
@@ -3588,17 +3610,17 @@ let __tla = (async () => {
3588
3610
  depthWrite: false
3589
3611
  })
3590
3612
  }),
3591
- o.landmarkAxis && c && i(jr, {
3613
+ o.landmarkAxis && c && l(Xr, {
3592
3614
  redPoint: c.red,
3593
3615
  greenPoint: c.green
3594
3616
  }),
3595
- o.iterativePCA && c && i(Gr, {
3617
+ o.iterativePCA && c && l(Yr, {
3596
3618
  geometry: a,
3597
3619
  redY: c.red.y,
3598
3620
  greenY: c.green.y,
3599
3621
  modelSize: (r == null ? void 0 : r.halfExtents[0]) ? Math.max(...r.halfExtents) * 2 : 100
3600
3622
  }),
3601
- o.fullRegionPCA && c && i(Xr, {
3623
+ o.fullRegionPCA && c && l(Kr, {
3602
3624
  geometry: a,
3603
3625
  redY: c.red.y,
3604
3626
  greenY: c.green.y,
@@ -3607,13 +3629,13 @@ let __tla = (async () => {
3607
3629
  ]
3608
3630
  });
3609
3631
  }
3610
- function Jr({ mesh: e }) {
3632
+ function ei({ mesh: e }) {
3611
3633
  const o = e.geometry, t = te(() => {
3612
3634
  if (!o.getAttribute("position")) return null;
3613
- const l = eo(o), d = l.axes[0], a = l.halfExtents[0] * 1.3;
3635
+ const i = eo(o), d = i.axes[0], a = i.halfExtents[0] * 1.3;
3614
3636
  return {
3615
3637
  axis: d,
3616
- center: l.center,
3638
+ center: i.center,
3617
3639
  halfLen: a
3618
3640
  };
3619
3641
  }, [
@@ -3621,7 +3643,7 @@ let __tla = (async () => {
3621
3643
  ]);
3622
3644
  if (!t) return null;
3623
3645
  const n = t.center.clone().addScaledVector(t.axis, t.halfLen), s = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3624
- return i(ve, {
3646
+ return l(ve, {
3625
3647
  points: [
3626
3648
  s,
3627
3649
  n
@@ -3693,10 +3715,10 @@ let __tla = (async () => {
3693
3715
  color: "#00ffff",
3694
3716
  group: "Alignment"
3695
3717
  }
3696
- ], Qr = [
3718
+ ], ti = [
3697
3719
  ...new Set(to.map((e) => e.group))
3698
3720
  ];
3699
- function ei({ layers: e, onToggleLayer: o, isDoubleShell: t }) {
3721
+ function ni({ layers: e, onToggleLayer: o, isDoubleShell: t }) {
3700
3722
  return y("div", {
3701
3723
  style: {
3702
3724
  position: "absolute",
@@ -3714,7 +3736,7 @@ let __tla = (async () => {
3714
3736
  backdropFilter: "blur(8px)"
3715
3737
  },
3716
3738
  children: [
3717
- i("div", {
3739
+ l("div", {
3718
3740
  style: {
3719
3741
  fontSize: 10,
3720
3742
  fontWeight: 600,
@@ -3725,11 +3747,11 @@ let __tla = (async () => {
3725
3747
  },
3726
3748
  children: "Debug Layers"
3727
3749
  }),
3728
- Qr.map((n) => {
3729
- const s = to.filter((l) => l.group === n && !(l.hideWhenDoubleShell && t));
3750
+ ti.map((n) => {
3751
+ const s = to.filter((i) => i.group === n && !(i.hideWhenDoubleShell && t));
3730
3752
  return s.length === 0 ? null : y("div", {
3731
3753
  children: [
3732
- i("div", {
3754
+ l("div", {
3733
3755
  style: {
3734
3756
  fontSize: 9,
3735
3757
  fontWeight: 600,
@@ -3741,7 +3763,7 @@ let __tla = (async () => {
3741
3763
  },
3742
3764
  children: n
3743
3765
  }),
3744
- s.map(({ key: l, label: d, color: a }) => y("label", {
3766
+ s.map(({ key: i, label: d, color: a }) => y("label", {
3745
3767
  style: {
3746
3768
  display: "flex",
3747
3769
  alignItems: "center",
@@ -3751,10 +3773,10 @@ let __tla = (async () => {
3751
3773
  userSelect: "none"
3752
3774
  },
3753
3775
  children: [
3754
- i("input", {
3776
+ l("input", {
3755
3777
  type: "checkbox",
3756
- checked: e[l],
3757
- onChange: () => o(l),
3778
+ checked: e[i],
3779
+ onChange: () => o(i),
3758
3780
  style: {
3759
3781
  accentColor: a,
3760
3782
  width: 14,
@@ -3762,32 +3784,32 @@ let __tla = (async () => {
3762
3784
  cursor: "pointer"
3763
3785
  }
3764
3786
  }),
3765
- i("span", {
3787
+ l("span", {
3766
3788
  style: {
3767
3789
  width: 8,
3768
3790
  height: 8,
3769
3791
  borderRadius: "50%",
3770
3792
  backgroundColor: a,
3771
- opacity: e[l] ? 1 : 0.3,
3793
+ opacity: e[i] ? 1 : 0.3,
3772
3794
  flexShrink: 0
3773
3795
  }
3774
3796
  }),
3775
- i("span", {
3797
+ l("span", {
3776
3798
  style: {
3777
- opacity: e[l] ? 1 : 0.5
3799
+ opacity: e[i] ? 1 : 0.5
3778
3800
  },
3779
3801
  children: d
3780
3802
  })
3781
3803
  ]
3782
- }, l))
3804
+ }, i))
3783
3805
  ]
3784
3806
  }, n);
3785
3807
  })
3786
3808
  ]
3787
3809
  });
3788
3810
  }
3789
- const ti = ({ config: e, spacingType: o, scanUrl: t, formMeasurements: n, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: d, wasmModule: a, autoProcessOnTwoPoints: r = false }) => {
3790
- const [c, u] = $(null), [p, f] = $(0), [h, w] = $(false), [g, b] = $(false), [A, v] = $(""), [x, F] = $("3D"), [S, C] = $(o === "AK" ? 2 : 1), [M, E] = $(false), [W, N] = $(null), [P, I] = $(o ?? null), [_, B] = $("cm"), [X, oe] = $(false), [ce, se] = $(""), [J, ae] = $("mm"), [q, ge] = $(false), [re, R] = $(false), [H, ne] = $(false), [Q, j] = $(null), [K, ue] = $(null), [ie, pe] = $(null), [he, Se] = $(false), [T, Le] = $([]), [Pe, We] = $(null), [ye, Fe] = $(null), [Pt, Ft] = $(null), [it, tn] = $(null), [oo, nn] = $(false), [st, on] = $(null), [Lt, Re] = $(null), [$e, ro] = $(false), [rn, io] = $(Or), [He, sn] = $("obj"), [ke, Dt] = $(n), [Ne, _t] = $(true), [Ye, Je] = $(false), [Rt, ln] = $(false), [lt, at] = $(false), Ke = fe(false), [so, an] = $(false), [Et, cn] = $(() => {
3811
+ const oi = ({ config: e, spacingType: o, scanUrl: t, formMeasurements: n, onComplete: s, isDebugUser: i = false, onAnalyticsEvent: d, wasmModule: a, autoProcessOnTwoPoints: r = false }) => {
3812
+ const [c, u] = W(null), [p, f] = W(0), [h, w] = W(false), [g, b] = W(false), [A, v] = W(""), [x, F] = W("3D"), [S, C] = W(o === "AK" ? 2 : 1), [M, E] = W(false), [$, N] = W(null), [P, I] = W(o ?? null), [D, B] = W("cm"), [X, oe] = W(false), [ce, se] = W(""), [J, ae] = W("mm"), [q, ge] = W(false), [re, R] = W(false), [H, ne] = W(false), [Q, j] = W(null), [K, ue] = W(null), [ie, pe] = W(null), [he, Se] = W(false), [T, _e] = W([]), [Pe, $e] = W(null), [ye, Le] = W(null), [Pt, Ft] = W(null), [st, tn] = W(null), [oo, nn] = W(false), [lt, on] = W(null), [Lt, Ee] = W(null), [We, ro] = W(false), [rn, io] = W(Nr), [He, sn] = W("obj"), [ke, _t] = W(n), [Ne, Dt] = W(true), [Ke, Qe] = W(false), [Rt, ln] = W(false), [at, ct] = W(false), Ze = fe(false), [so, an] = W(false), [Et, cn] = W(() => {
3791
3813
  try {
3792
3814
  return localStorage.getItem("gm_helpTipDismissed") !== "1";
3793
3815
  } catch {
@@ -3813,64 +3835,64 @@ let __tla = (async () => {
3813
3835
  }, [
3814
3836
  q
3815
3837
  ]);
3816
- const It = fe(null), [Ve, lo] = $(0);
3838
+ const It = fe(null), [Ve, lo] = W(0);
3817
3839
  Z(() => {
3818
3840
  if (!It.current) return;
3819
3841
  const m = new ResizeObserver((z) => {
3820
- for (const D of z) lo(D.contentRect.width);
3842
+ for (const _ of z) lo(_.contentRect.width);
3821
3843
  });
3822
3844
  return m.observe(It.current), () => m.disconnect();
3823
3845
  }, []);
3824
- const [Ce, ao] = $(null), [co, fo] = $(void 0), [uo, po] = $(void 0), [ho, go] = $(void 0), [mo, xo] = $(void 0), [dn] = $("#c8c8c8"), [bo] = $(1), [Te, yo] = $(false), [Wt, fn] = $([]), ct = fe(null), je = fe(null), un = fe(false), dt = fe(false), wo = fe(null), $t = fe(null), Bt = fe(null), Qe = de(async (m) => {
3846
+ const [Ce, ao] = W(null), [co, fo] = W(void 0), [uo, po] = W(void 0), [ho, go] = W(void 0), [mo, xo] = W(void 0), [dn] = W("#c8c8c8"), [bo] = W(1), [Te, yo] = W(false), [$t, fn] = W([]), dt = fe(null), je = fe(null), un = fe(false), ft = fe(false), wo = fe(null), Wt = fe(null), Bt = fe(null), et = de(async (m) => {
3825
3847
  if (!Bt.current) return;
3826
3848
  const z = (m == null ? void 0 : m.restoreView) ?? true;
3827
3849
  try {
3828
- const D = Bt.current, L = () => {
3829
- const O = D.querySelector("canvas");
3850
+ const _ = Bt.current, L = () => {
3851
+ const O = _.querySelector("canvas");
3830
3852
  if (!O) return;
3831
- const ee = D.getBoundingClientRect(), me = O.width, be = O.height, Me = me / ee.width, nt = be / ee.height, gt = document.createElement("canvas");
3832
- gt.width = me, gt.height = be;
3833
- const ze = gt.getContext("2d");
3834
- return ze.drawImage(O, 0, 0), D.querySelectorAll("[style*='pointer-events']").forEach((Lo) => {
3853
+ const ee = _.getBoundingClientRect(), me = O.width, be = O.height, Me = me / ee.width, ot = be / ee.height, mt = document.createElement("canvas");
3854
+ mt.width = me, mt.height = be;
3855
+ const ze = mt.getContext("2d");
3856
+ return ze.drawImage(O, 0, 0), _.querySelectorAll("[style*='pointer-events']").forEach((Lo) => {
3835
3857
  const vn = Lo;
3836
3858
  if (vn.hasAttribute("data-finalizing-overlay")) return;
3837
3859
  const Sn = vn.querySelectorAll("div[style*='background']");
3838
- Sn.length !== 0 && Sn.forEach((Ze) => {
3860
+ Sn.length !== 0 && Sn.forEach((Ue) => {
3839
3861
  var _a;
3840
- const Ie = Ze.getBoundingClientRect();
3862
+ const Ie = Ue.getBoundingClientRect();
3841
3863
  if (Ie.width === 0 || Ie.height === 0) return;
3842
- let Yt = 0, ot = Ze;
3843
- for (; ot && ot !== D; ) {
3844
- const bt = (ot.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3845
- if (bt) {
3846
- Yt = parseFloat(bt[1]);
3864
+ let Yt = 0, rt = Ue;
3865
+ for (; rt && rt !== _; ) {
3866
+ const yt = (rt.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3867
+ if (yt) {
3868
+ Yt = parseFloat(yt[1]);
3847
3869
  break;
3848
3870
  }
3849
- ot = ot.parentElement;
3871
+ rt = rt.parentElement;
3850
3872
  }
3851
- const Cn = (Ie.left + Ie.width / 2 - ee.left) * Me, An = (Ie.top + Ie.height / 2 - ee.top) * nt, mt = Math.abs(Yt) > 1, Mn = (mt ? Ie.height : Ie.width) * Me, zn = (mt ? Ie.width : Ie.height) * nt;
3852
- ze.save(), ze.translate(Cn, An), mt && ze.rotate(Yt * Math.PI / 180);
3853
- const Do = Ze.style.backgroundColor || "rgba(0,0,0,0.75)";
3854
- ze.fillStyle = Do;
3855
- const _o = 4 * Me;
3856
- ze.beginPath(), ze.roundRect(-Mn / 2, -zn / 2, Mn, zn, _o), ze.fill();
3857
- const kn = ((_a = Ze.textContent) == null ? void 0 : _a.trim()) || "";
3873
+ const Cn = (Ie.left + Ie.width / 2 - ee.left) * Me, An = (Ie.top + Ie.height / 2 - ee.top) * ot, xt = Math.abs(Yt) > 1, Mn = (xt ? Ie.height : Ie.width) * Me, zn = (xt ? Ie.width : Ie.height) * ot;
3874
+ ze.save(), ze.translate(Cn, An), xt && ze.rotate(Yt * Math.PI / 180);
3875
+ const _o = Ue.style.backgroundColor || "rgba(0,0,0,0.75)";
3876
+ ze.fillStyle = _o;
3877
+ const Do = 4 * Me;
3878
+ ze.beginPath(), ze.roundRect(-Mn / 2, -zn / 2, Mn, zn, Do), ze.fill();
3879
+ const kn = ((_a = Ue.textContent) == null ? void 0 : _a.trim()) || "";
3858
3880
  if (kn) {
3859
- const xt = window.getComputedStyle(Ze), bt = parseFloat(xt.fontSize || "14") * nt;
3860
- ze.font = `${xt.fontWeight || "normal"} ${bt}px monospace`, ze.fillStyle = xt.color || "#fff", ze.textAlign = "center", ze.textBaseline = "middle";
3861
- const Pn = Ze.querySelectorAll("span");
3862
- Pn.length > 0 && !mt ? Pn.forEach((Kt) => {
3863
- const rt = Kt.getBoundingClientRect();
3864
- if (rt.width === 0) return;
3865
- const Ro = (rt.left + rt.width / 2 - ee.left) * Me - Cn, Eo = (rt.top + rt.height / 2 - ee.top) * nt - An, Zt = window.getComputedStyle(Kt), Io = parseFloat(Zt.fontSize) * nt;
3881
+ const bt = window.getComputedStyle(Ue), yt = parseFloat(bt.fontSize || "14") * ot;
3882
+ ze.font = `${bt.fontWeight || "normal"} ${yt}px monospace`, ze.fillStyle = bt.color || "#fff", ze.textAlign = "center", ze.textBaseline = "middle";
3883
+ const Pn = Ue.querySelectorAll("span");
3884
+ Pn.length > 0 && !xt ? Pn.forEach((Kt) => {
3885
+ const it = Kt.getBoundingClientRect();
3886
+ if (it.width === 0) return;
3887
+ const Ro = (it.left + it.width / 2 - ee.left) * Me - Cn, Eo = (it.top + it.height / 2 - ee.top) * ot - An, Zt = window.getComputedStyle(Kt), Io = parseFloat(Zt.fontSize) * ot;
3866
3888
  ze.font = `${Zt.fontWeight || "normal"} ${Io}px monospace`, ze.fillStyle = Zt.color || "#fff", ze.fillText(Kt.textContent || "", Ro, Eo);
3867
3889
  }) : ze.fillText(kn, 0, 0);
3868
3890
  }
3869
3891
  ze.restore();
3870
3892
  });
3871
- }), gt.toDataURL("image/png");
3893
+ }), mt.toDataURL("image/png");
3872
3894
  };
3873
- $t.current && $t.current(), await new Promise((O) => requestAnimationFrame(() => requestAnimationFrame(O)));
3895
+ Wt.current && Wt.current(), await new Promise((O) => requestAnimationFrame(() => requestAnimationFrame(O)));
3874
3896
  const Y = L();
3875
3897
  F("2D"), await new Promise((O) => setTimeout(O, 150)), await new Promise((O) => requestAnimationFrame(() => requestAnimationFrame(O)));
3876
3898
  const G = L();
@@ -3882,38 +3904,38 @@ let __tla = (async () => {
3882
3904
  return;
3883
3905
  }
3884
3906
  }, []), Ae = de((m) => {
3885
- const z = /* @__PURE__ */ new Date(), D = `${String(z.getHours()).padStart(2, "0")}:${String(z.getMinutes()).padStart(2, "0")}:${String(z.getSeconds()).padStart(2, "0")}.${String(z.getMilliseconds()).padStart(3, "0")}`;
3907
+ const z = /* @__PURE__ */ new Date(), _ = `${String(z.getHours()).padStart(2, "0")}:${String(z.getMinutes()).padStart(2, "0")}:${String(z.getSeconds()).padStart(2, "0")}.${String(z.getMilliseconds()).padStart(3, "0")}`;
3886
3908
  fn((L) => [
3887
3909
  ...L.slice(-200),
3888
- `[${D}] ${m}`
3910
+ `[${_}] ${m}`
3889
3911
  ]);
3890
- }, []), { landmarkPoints: V, clearLandmarkPoints: vo, addLandmarkPoint: pn, removeLandmarkPoint: hn, undoLastLandmarkPoint: Tt, updateLandmarkPositions: ft, setAligned: gn, isAligned: le, setCut: mn, isCut: Ot, reset: ut } = en();
3912
+ }, []), { landmarkPoints: V, clearLandmarkPoints: vo, addLandmarkPoint: pn, removeLandmarkPoint: hn, undoLastLandmarkPoint: Tt, updateLandmarkPositions: ut, setAligned: gn, isAligned: le, setCut: mn, isCut: Ot, reset: pt } = en();
3891
3913
  Z(() => {
3892
- ut();
3914
+ pt();
3893
3915
  }, [
3894
- ut
3916
+ pt
3895
3917
  ]);
3896
- const pt = S * St;
3918
+ const ht = S * Ct;
3897
3919
  Z(() => {
3898
- if (!l || V.length === 0) return;
3920
+ if (!i || V.length === 0) return;
3899
3921
  const m = V[V.length - 1];
3900
3922
  Ae(`LANDMARK[${V.length - 1}]: placed at (${m.position.x.toFixed(1)}, ${m.position.y.toFixed(1)}, ${m.position.z.toFixed(1)}) face=${m.faceIndex}`);
3901
3923
  }, [
3902
3924
  V.length,
3903
- l,
3925
+ i,
3904
3926
  Ae
3905
3927
  ]), Z(() => {
3906
- l && le && Ae("STATE: mesh aligned");
3928
+ i && le && Ae("STATE: mesh aligned");
3907
3929
  }, [
3908
3930
  le,
3909
- l,
3931
+ i,
3910
3932
  Ae
3911
3933
  ]), Z(() => {
3912
3934
  const m = (z) => {
3913
3935
  var _a;
3914
3936
  if (z.key !== "z" && z.key !== "Z" || !(z.ctrlKey || z.metaKey) || z.shiftKey || z.altKey) return;
3915
- const D = ((_a = z.composedPath) == null ? void 0 : _a.call(z)[0]) ?? z.target, L = D == null ? void 0 : D.tagName;
3916
- L === "INPUT" || L === "TEXTAREA" || (D == null ? void 0 : D.isContentEditable) || !c || le || V.length === 0 || (z.preventDefault(), Tt(), Ae(`UNDO: removed landmark point ${V.length - 1}`));
3937
+ const _ = ((_a = z.composedPath) == null ? void 0 : _a.call(z)[0]) ?? z.target, L = _ == null ? void 0 : _.tagName;
3938
+ L === "INPUT" || L === "TEXTAREA" || (_ == null ? void 0 : _.isContentEditable) || !c || le || V.length === 0 || (z.preventDefault(), Tt(), Ae(`UNDO: removed landmark point ${V.length - 1}`));
3917
3939
  };
3918
3940
  return document.addEventListener("keydown", m, true), () => document.removeEventListener("keydown", m, true);
3919
3941
  }, [
@@ -3923,10 +3945,10 @@ let __tla = (async () => {
3923
3945
  Tt,
3924
3946
  Ae
3925
3947
  ]), Z(() => {
3926
- l && Ot && Ae("STATE: mesh cut");
3948
+ i && Ot && Ae("STATE: mesh cut");
3927
3949
  }, [
3928
3950
  Ot,
3929
- l,
3951
+ i,
3930
3952
  Ae
3931
3953
  ]);
3932
3954
  const So = de(() => {
@@ -3951,16 +3973,16 @@ let __tla = (async () => {
3951
3973
  O.needsUpdate = true;
3952
3974
  }
3953
3975
  return Y.computeVertexNormals(), Y.computeBoundingBox(), Y.computeBoundingSphere(), Y;
3954
- }, z = m(c.geometry), D = new U.Mesh(z, c.material);
3955
- if (u(D), ie && pe(m(ie)), K && ue(m(K)), Pe) {
3976
+ }, z = m(c.geometry), _ = new U.Mesh(z, c.material);
3977
+ if (u(_), ie && pe(m(ie)), K && ue(m(K)), Pe) {
3956
3978
  const L = new Float32Array(Pe.allLoopPoints);
3957
3979
  for (let Y = 0; Y < L.length; Y += 3) L[Y] = -L[Y];
3958
- We({
3980
+ $e({
3959
3981
  ...Pe,
3960
3982
  allLoopPoints: L
3961
3983
  });
3962
3984
  }
3963
- V.length > 0 && ft(V.map((L) => ({
3985
+ V.length > 0 && ut(V.map((L) => ({
3964
3986
  x: -L.position.x,
3965
3987
  y: L.position.y,
3966
3988
  z: L.position.z
@@ -3971,13 +3993,13 @@ let __tla = (async () => {
3971
3993
  K,
3972
3994
  Pe,
3973
3995
  V,
3974
- ft,
3996
+ ut,
3975
3997
  Ae
3976
3998
  ]);
3977
3999
  Z(() => {
3978
- ct.current && (ct.current.scrollTop = ct.current.scrollHeight);
4000
+ dt.current && (dt.current.scrollTop = dt.current.scrollHeight);
3979
4001
  }, [
3980
- Wt
4002
+ $t
3981
4003
  ]);
3982
4004
  const Oe = te(() => ie ? new U.Mesh(ie) : null, [
3983
4005
  ie
@@ -3995,22 +4017,22 @@ let __tla = (async () => {
3995
4017
  }, [
3996
4018
  K
3997
4019
  ]), Z(() => () => {
3998
- W && W.geometry.dispose();
4020
+ $ && $.geometry.dispose();
3999
4021
  }, [
4000
- W
4022
+ $
4001
4023
  ]), Z(() => {
4002
- n && Dt(n);
4024
+ n && _t(n);
4003
4025
  }, [
4004
4026
  n
4005
4027
  ]), Z(() => {
4006
- n || Dt(void 0);
4028
+ n || _t(void 0);
4007
4029
  }, [
4008
4030
  S
4009
4031
  ]);
4010
- const ht = fe(false);
4032
+ const gt = fe(false);
4011
4033
  Z(() => {
4012
- if (!le || T.length === 0 || ht.current || !d) return;
4013
- ht.current = true;
4034
+ if (!le || T.length === 0 || gt.current || !d) return;
4035
+ gt.current = true;
4014
4036
  const m = V.length >= 3 ? Math.abs(V[2].position.y - V[0].position.y) : null;
4015
4037
  d("dimensions_calculated", {
4016
4038
  spacing_type: P,
@@ -4021,8 +4043,8 @@ let __tla = (async () => {
4021
4043
  is_unit_converted: false,
4022
4044
  form_measurements: (ke == null ? void 0 : ke.filter((z) => z != null)) ?? null,
4023
4045
  scan_measurements: T.map((z) => +(z.modifiedValue ?? z.originalValue).toFixed(1)),
4024
- measurement_variance: ke ? T.map((z, D) => {
4025
- const L = ke[D];
4046
+ measurement_variance: ke ? T.map((z, _) => {
4047
+ const L = ke[_];
4026
4048
  return L == null ? null : +((z.modifiedValue ?? z.originalValue) - L).toFixed(1);
4027
4049
  }) : null,
4028
4050
  frontal_height: m !== null ? +m.toFixed(1) : null
@@ -4031,26 +4053,26 @@ let __tla = (async () => {
4031
4053
  le,
4032
4054
  T
4033
4055
  ]), Z(() => {
4034
- a !== void 0 && (je.current = a, un.current || (un.current = true, er(a))), a !== void 0 && yo(true);
4056
+ a !== void 0 && (je.current = a, un.current || (un.current = true, er(a), a && or(a))), a !== void 0 && yo(true);
4035
4057
  }, [
4036
4058
  a
4037
4059
  ]);
4038
- const et = de((m, z) => {
4060
+ const tt = de((m, z) => {
4039
4061
  m.computeBoundingBox();
4040
- const D = m.boundingBox, L = new k();
4041
- D.getCenter(L), m.translate(-L.x, -L.y, -L.z), m.computeBoundingBox();
4062
+ const _ = m.boundingBox, L = new k();
4063
+ _.getCenter(L), m.translate(-L.x, -L.y, -L.z), m.computeBoundingBox();
4042
4064
  const Y = m.boundingBox, G = new k();
4043
4065
  Y.getSize(G), f(Math.max(G.x, G.y, G.z));
4044
4066
  const O = new U.Mesh(m, new U.MeshStandardMaterial({
4045
4067
  color: 8947848,
4046
4068
  side: U.DoubleSide
4047
4069
  }));
4048
- u(O), ae(z), ge(true), ne(false), dt.current = false;
4070
+ u(O), ae(z), ge(true), ne(false), ft.current = false;
4049
4071
  }, []), Be = de(async (m, z) => {
4050
- Re(null);
4051
- const D = z.toLowerCase(), L = D.endsWith(".stl"), Y = D.endsWith(".obj"), G = D.endsWith(".aop");
4072
+ Ee(null);
4073
+ const _ = z.toLowerCase(), L = _.endsWith(".stl"), Y = _.endsWith(".obj"), G = _.endsWith(".aop");
4052
4074
  if (!Y && !L && !G) {
4053
- Re("Unsupported file format. Please use OBJ, STL, or AOP.");
4075
+ Ee("Unsupported file format. Please use OBJ, STL, or AOP.");
4054
4076
  return;
4055
4077
  }
4056
4078
  sn(L ? "stl" : G ? "aop" : "obj"), b(true), v("Processing file..."), Ae(`FILE_LOAD: ${z} (${L ? "STL" : G ? "AOP" : "OBJ"})`);
@@ -4063,7 +4085,7 @@ let __tla = (async () => {
4063
4085
  ]), Me = new File([
4064
4086
  be
4065
4087
  ], z);
4066
- O = await _n(Me);
4088
+ O = await Dn(Me);
4067
4089
  } else if (G) {
4068
4090
  v("Extracting AOP...");
4069
4091
  const be = new Blob([
@@ -4071,22 +4093,22 @@ let __tla = (async () => {
4071
4093
  ]), Me = new File([
4072
4094
  be
4073
4095
  ], z);
4074
- O = await ir(Me);
4096
+ O = await lr(Me);
4075
4097
  } else O = typeof m == "string" ? m : new TextDecoder().decode(m);
4076
- const ee = performance.now(), me = je.current ? await nr(O, je.current, (be) => {
4098
+ const ee = performance.now(), me = je.current ? await rr(O, je.current, (be) => {
4077
4099
  v(be), Ae(`PREPROCESS: ${be}`);
4078
4100
  }) : null;
4079
- if (me) Ae(`PREPROCESS: done in ${(performance.now() - ee).toFixed(0)}ms \u2014 unit=${me.detectedUnit}, scaled=${me.wasScaled}`), e.showAmputationModal && !o ? (N(me), E(true)) : et(me.geometry, me.detectedUnit);
4101
+ if (me) Ae(`PREPROCESS: done in ${(performance.now() - ee).toFixed(0)}ms \u2014 unit=${me.detectedUnit}, scaled=${me.wasScaled}`), e.showAmputationModal && !o ? (N(me), E(true)) : tt(me.geometry, me.detectedUnit);
4080
4102
  else {
4081
4103
  console.warn("[fab-one]", "WASM processing returned no result \u2014 using raw OBJ fallback (no weld/hole-fill). Mesh may render low-poly/broken."), v("Using fallback loader...");
4082
- const be = or(O);
4104
+ const be = ir(O);
4083
4105
  be ? e.showAmputationModal && !o ? (N({
4084
4106
  geometry: be,
4085
4107
  detectedUnit: "mm"
4086
- }), E(true)) : et(be, "mm") : Re("Failed to parse the mesh.");
4108
+ }), E(true)) : tt(be, "mm") : Ee("Failed to parse the mesh.");
4087
4109
  }
4088
4110
  } catch (O) {
4089
- Re(O instanceof Error ? O.message : "Failed to process the mesh file.");
4111
+ Ee(O instanceof Error ? O.message : "Failed to process the mesh file.");
4090
4112
  } finally {
4091
4113
  b(false), v("");
4092
4114
  }
@@ -4094,7 +4116,7 @@ let __tla = (async () => {
4094
4116
  Te,
4095
4117
  e.showAmputationModal,
4096
4118
  o,
4097
- et
4119
+ tt
4098
4120
  ]);
4099
4121
  Z(() => {
4100
4122
  if (!t || !Te) return;
@@ -4112,7 +4134,7 @@ let __tla = (async () => {
4112
4134
  await Be(O, L);
4113
4135
  }
4114
4136
  } catch (z) {
4115
- Re(z instanceof Error ? z.message : "Failed to load scan from URL."), b(false), v("");
4137
+ Ee(z instanceof Error ? z.message : "Failed to load scan from URL."), b(false), v("");
4116
4138
  }
4117
4139
  })();
4118
4140
  }, [
@@ -4125,24 +4147,24 @@ let __tla = (async () => {
4125
4147
  m.preventDefault(), w(false);
4126
4148
  }, []), Mo = de(async (m) => {
4127
4149
  if (m.preventDefault(), w(false), !Te) {
4128
- Re("WASM module is still loading. Please wait.");
4150
+ Ee("WASM module is still loading. Please wait.");
4129
4151
  return;
4130
4152
  }
4131
4153
  const z = m.dataTransfer.files[0];
4132
4154
  if (!z) return;
4133
- const D = z.name.toLowerCase();
4134
- if (!D.endsWith(".obj") && !D.endsWith(".stl") && !D.endsWith(".aop")) {
4135
- Re("Please drop an OBJ, STL, or AOP file.");
4155
+ const _ = z.name.toLowerCase();
4156
+ if (!_.endsWith(".obj") && !_.endsWith(".stl") && !_.endsWith(".aop")) {
4157
+ Ee("Please drop an OBJ, STL, or AOP file.");
4136
4158
  return;
4137
4159
  }
4138
- if (D.endsWith(".aop")) await Be(await z.arrayBuffer(), z.name);
4139
- else if (D.endsWith(".stl")) {
4160
+ if (_.endsWith(".aop")) await Be(await z.arrayBuffer(), z.name);
4161
+ else if (_.endsWith(".stl")) {
4140
4162
  sn("stl"), b(true), v("Converting STL...");
4141
4163
  try {
4142
- const L = await _n(z);
4164
+ const L = await Dn(z);
4143
4165
  await Be(L, z.name.replace(/\.stl$/i, ".obj"));
4144
4166
  } catch (L) {
4145
- Re(L instanceof Error ? L.message : "Failed to process STL file."), b(false), v("");
4167
+ Ee(L instanceof Error ? L.message : "Failed to process STL file."), b(false), v("");
4146
4168
  }
4147
4169
  } else {
4148
4170
  const L = await z.text();
@@ -4152,21 +4174,21 @@ let __tla = (async () => {
4152
4174
  Te,
4153
4175
  Be
4154
4176
  ]), zo = de((m) => {
4155
- I(m), C(m === "AK" ? 2 : 1), E(false), W && (et(W.geometry, W.detectedUnit), N(null)), d == null ? void 0 : d("file_loaded", {
4177
+ I(m), C(m === "AK" ? 2 : 1), E(false), $ && (tt($.geometry, $.detectedUnit), N(null)), d == null ? void 0 : d("file_loaded", {
4156
4178
  spacing_type: m,
4157
4179
  file_format: He,
4158
4180
  is_double_wall: false
4159
4181
  });
4160
4182
  }, [
4161
- W,
4162
- et,
4183
+ $,
4184
+ tt,
4163
4185
  d,
4164
4186
  He
4165
4187
  ]);
4166
4188
  Z(() => {
4167
- if (!c || V.length !== 1 || !je.current || dt.current) return;
4168
- dt.current = true;
4169
- const m = V[0], z = je.current, D = c.geometry, { positions: L, indices: Y } = At(D), G = new Float32Array([
4189
+ if (!c || V.length !== 1 || !je.current || ft.current) return;
4190
+ ft.current = true;
4191
+ const m = V[0], z = je.current, _ = c.geometry, { positions: L, indices: Y } = At(_), G = new Float32Array([
4170
4192
  m.position.x,
4171
4193
  m.position.y,
4172
4194
  m.position.z
@@ -4187,43 +4209,43 @@ let __tla = (async () => {
4187
4209
  V[0],
4188
4210
  ...V.slice(2)
4189
4211
  ];
4190
- fr(c, z, St, {
4191
- onStatus: (D) => {
4192
- se(D), Ae(`PIPELINE: ${D}`);
4212
+ pr(c, z, Ct, {
4213
+ onStatus: (_) => {
4214
+ se(_), Ae(`PIPELINE: ${_}`);
4193
4215
  },
4194
4216
  addLandmarkPoint: pn,
4195
4217
  removeLandmarkPoint: hn,
4196
- updateLandmarkPositions: (D) => {
4218
+ updateLandmarkPositions: (_) => {
4197
4219
  const L = [
4198
- D[1],
4199
- D[0],
4200
- ...D.slice(2)
4220
+ _[1],
4221
+ _[0],
4222
+ ..._.slice(2)
4201
4223
  ];
4202
- ft(L);
4224
+ ut(L);
4203
4225
  },
4204
4226
  setAligned: gn,
4205
4227
  setCut: mn,
4206
4228
  setModelSize: f,
4207
4229
  setOriginalEndY: tn,
4208
- setAdjustedStartY: Fe,
4230
+ setAdjustedStartY: Le,
4209
4231
  setAdjustedEndY: Ft,
4210
- setError: Re,
4211
- setDoubleShell: (D) => {
4212
- R(D), Se(true);
4232
+ setError: Ee,
4233
+ setDoubleShell: (_) => {
4234
+ R(_), Se(true);
4213
4235
  },
4214
- setAoData: (D, L) => {
4215
- j(D), ue(L ?? null);
4236
+ setAoData: (_, L) => {
4237
+ j(_), ue(L ?? null);
4216
4238
  },
4217
4239
  setInnerShellExtracted: ne,
4218
4240
  setMeasurementGeometry: pe,
4219
- setWasmSlices: We,
4241
+ setWasmSlices: $e,
4220
4242
  wasmModule: je.current ?? void 0
4221
- }), Ae(`PIPELINE: completed in ${(performance.now() - m).toFixed(0)}ms`), ht.current = false, oe(false);
4243
+ }), Ae(`PIPELINE: completed in ${(performance.now() - m).toFixed(0)}ms`), gt.current = false, oe(false);
4222
4244
  }, 50);
4223
4245
  }, [
4224
4246
  c,
4225
4247
  V,
4226
- ft,
4248
+ ut,
4227
4249
  gn,
4228
4250
  pn,
4229
4251
  hn,
@@ -4245,25 +4267,25 @@ let __tla = (async () => {
4245
4267
  V.length
4246
4268
  ]);
4247
4269
  const Vt = fe(false), ko = de(async () => {
4248
- if (ut(), Le([]), We(null), pe(null), Fe(null), Ft(null), on(null), tn(null), Je(false), ln(false), _t(true), R(false), ne(false), dt.current = false, Vt.current = false, ht.current = false, F("3D"), t && Te) {
4270
+ if (pt(), _e([]), $e(null), pe(null), Le(null), Ft(null), on(null), tn(null), Qe(false), ln(false), Dt(true), R(false), ne(false), ft.current = false, Vt.current = false, gt.current = false, F("3D"), t && Te) {
4249
4271
  u(null);
4250
4272
  try {
4251
4273
  const m = await fetch(t);
4252
4274
  if (!m.ok) throw new Error(`Failed to download scan: ${m.status}`);
4253
- const D = new URL(t).pathname.split("/").pop() || "scan.obj", L = D.toLowerCase();
4254
- L.endsWith(".stl") || L.endsWith(".aop") ? await Be(await m.arrayBuffer(), D) : await Be(await m.text(), D);
4275
+ const _ = new URL(t).pathname.split("/").pop() || "scan.obj", L = _.toLowerCase();
4276
+ L.endsWith(".stl") || L.endsWith(".aop") ? await Be(await m.arrayBuffer(), _) : await Be(await m.text(), _);
4255
4277
  } catch (m) {
4256
- Re(m instanceof Error ? m.message : "Failed to reload scan.");
4278
+ Ee(m instanceof Error ? m.message : "Failed to reload scan.");
4257
4279
  }
4258
4280
  }
4259
4281
  }, [
4260
4282
  t,
4261
4283
  Te,
4262
4284
  Be,
4263
- ut
4285
+ pt
4264
4286
  ]);
4265
4287
  Z(() => {
4266
- le && T.length > 0 && !Vt.current && (Vt.current = true, Je(true));
4288
+ le && T.length > 0 && !Vt.current && (Vt.current = true, Qe(true));
4267
4289
  }, [
4268
4290
  le,
4269
4291
  T.length
@@ -4274,7 +4296,7 @@ let __tla = (async () => {
4274
4296
  scanTransverseAP: 0
4275
4297
  };
4276
4298
  try {
4277
- const m = (Oe ?? c).geometry, z = V[0].position.y, D = Qt(m), L = Ge(D, m, z);
4299
+ const m = (Oe ?? c).geometry, z = V[0].position.y, _ = Qt(m), L = Ge(_, m, z);
4278
4300
  if (L.linePoints.length < 2) return {
4279
4301
  scanTransverseML: 0,
4280
4302
  scanTransverseAP: 0
@@ -4297,27 +4319,27 @@ let __tla = (async () => {
4297
4319
  Oe,
4298
4320
  le,
4299
4321
  V
4300
- ]), tt = te(() => {
4322
+ ]), nt = te(() => {
4301
4323
  var _a;
4302
4324
  if (!c || V.length < 1) return 0;
4303
4325
  const m = c.geometry;
4304
4326
  m.computeBoundingBox();
4305
- const z = ((_a = m.boundingBox) == null ? void 0 : _a.min.y) ?? 0, D = V[0].position.y;
4327
+ const z = ((_a = m.boundingBox) == null ? void 0 : _a.min.y) ?? 0, _ = V[0].position.y;
4306
4328
  if (re && V.length >= 3) {
4307
- const L = Math.abs(D - V[2].position.y);
4329
+ const L = Math.abs(_ - V[2].position.y);
4308
4330
  if (L > 0.5) return L;
4309
4331
  }
4310
- return Math.abs(D - z);
4332
+ return Math.abs(_ - z);
4311
4333
  }, [
4312
4334
  c,
4313
4335
  V,
4314
4336
  re
4315
4337
  ]), Po = de((m) => {
4316
- ao(m), Dt(m.circumferences), _t(true), ln(true), Je(false);
4338
+ ao(m), _t(m.circumferences), Dt(true), ln(true), Qe(false);
4317
4339
  }, []), we = (m) => m == null ? m : +(m / 10).toFixed(2), xn = de(async (m) => {
4318
- if (!s || Ke.current) return;
4319
- Ke.current = true, Je(false), an(false), at(true), await new Promise((D) => requestAnimationFrame(() => requestAnimationFrame(() => D())));
4320
- const z = c ? await Qe({
4340
+ if (!s || Ze.current) return;
4341
+ Ze.current = true, Qe(false), an(false), ct(true), await new Promise((_) => requestAnimationFrame(() => requestAnimationFrame(() => _())));
4342
+ const z = c ? await et({
4321
4343
  restoreView: false
4322
4344
  }).catch(() => {
4323
4345
  }) : void 0;
@@ -4329,13 +4351,13 @@ let __tla = (async () => {
4329
4351
  measurementSource: "form_provided",
4330
4352
  isDoubleWall: re,
4331
4353
  isUnitConverted: false,
4332
- formMeasurements: ke == null ? void 0 : ke.map((D) => we(D)),
4333
- scanMeasurements: T.map((D) => ({
4334
- yPosition: D.yPosition,
4335
- originalValue: we(D.originalValue),
4336
- modifiedValue: D.modifiedValue == null ? null : we(D.modifiedValue)
4354
+ formMeasurements: ke == null ? void 0 : ke.map((_) => we(_)),
4355
+ scanMeasurements: T.map((_) => ({
4356
+ yPosition: _.yPosition,
4357
+ originalValue: we(_.originalValue),
4358
+ modifiedValue: _.modifiedValue == null ? null : we(_.modifiedValue)
4337
4359
  })),
4338
- frontalHeight: we(tt),
4360
+ frontalHeight: we(nt),
4339
4361
  transverseML: 0,
4340
4362
  transverseAP: 0,
4341
4363
  scanUrl: t,
@@ -4345,7 +4367,7 @@ let __tla = (async () => {
4345
4367
  alignedGeometry: c == null ? void 0 : c.geometry
4346
4368
  });
4347
4369
  } finally {
4348
- Ke.current = false, at(false);
4370
+ Ze.current = false, ct(false);
4349
4371
  }
4350
4372
  }, [
4351
4373
  s,
@@ -4355,9 +4377,9 @@ let __tla = (async () => {
4355
4377
  re,
4356
4378
  ke,
4357
4379
  T,
4358
- tt,
4380
+ nt,
4359
4381
  t,
4360
- Qe
4382
+ et
4361
4383
  ]), bn = fe(null);
4362
4384
  Z(() => {
4363
4385
  if (!c || !le) {
@@ -4372,14 +4394,14 @@ let __tla = (async () => {
4372
4394
  Oe
4373
4395
  ]);
4374
4396
  const Xt = de(async (m) => {
4375
- if (!s || !c || T.length === 0 || !P || Ke.current) return;
4376
- Ke.current = true, at(true), await new Promise((D) => requestAnimationFrame(() => requestAnimationFrame(() => D())));
4377
- const z = await Qe({
4397
+ if (!s || !c || T.length === 0 || !P || Ze.current) return;
4398
+ Ze.current = true, ct(true), await new Promise((_) => requestAnimationFrame(() => requestAnimationFrame(() => _())));
4399
+ const z = await et({
4378
4400
  restoreView: false
4379
4401
  }).catch(() => {
4380
4402
  });
4381
4403
  try {
4382
- const D = jt, L = Gt, Y = Ce ? {
4404
+ const _ = jt, L = Gt, Y = Ce ? {
4383
4405
  circumferences: Ce.circumferences.map((G) => we(G)),
4384
4406
  frontalHeight: we(Ce.frontalHeight),
4385
4407
  perineumML: we(Ce.perineumML),
@@ -4400,8 +4422,8 @@ let __tla = (async () => {
4400
4422
  originalValue: we(G.originalValue),
4401
4423
  modifiedValue: G.modifiedValue == null ? null : we(G.modifiedValue)
4402
4424
  })),
4403
- frontalHeight: we((Ce == null ? void 0 : Ce.frontalHeight) ?? tt),
4404
- transverseML: we(D),
4425
+ frontalHeight: we((Ce == null ? void 0 : Ce.frontalHeight) ?? nt),
4426
+ transverseML: we(_),
4405
4427
  transverseAP: we(L),
4406
4428
  perineumML: we(Ce == null ? void 0 : Ce.perineumML),
4407
4429
  perineumAP: we(Ce == null ? void 0 : Ce.perineumAP),
@@ -4414,7 +4436,7 @@ let __tla = (async () => {
4414
4436
  alignedGeometry: (Oe ?? c).geometry
4415
4437
  });
4416
4438
  } finally {
4417
- Ke.current = false, at(false);
4439
+ Ze.current = false, ct(false);
4418
4440
  }
4419
4441
  }, [
4420
4442
  s,
@@ -4428,19 +4450,19 @@ let __tla = (async () => {
4428
4450
  ke,
4429
4451
  t,
4430
4452
  Ce,
4431
- tt,
4453
+ nt,
4432
4454
  jt,
4433
4455
  Gt,
4434
- Qe
4456
+ et
4435
4457
  ]), Fo = te(() => {
4436
4458
  if (!ke || T.length === 0) return false;
4437
4459
  const m = Math.min(ke.length, T.length);
4438
4460
  if (m === 0) return false;
4439
4461
  for (let z = 0; z < m; z++) {
4440
- const D = ke[z], L = T[z];
4441
- if (!L || D == null || D === 0) continue;
4462
+ const _ = ke[z], L = T[z];
4463
+ if (!L || _ == null || _ === 0) continue;
4442
4464
  const Y = L.modifiedValue ?? L.originalValue;
4443
- if (Math.abs(Y - D) > 7) return false;
4465
+ if (Math.abs(Y - _) > 7) return false;
4444
4466
  }
4445
4467
  return true;
4446
4468
  }, [
@@ -4461,7 +4483,7 @@ let __tla = (async () => {
4461
4483
  height: "100%"
4462
4484
  },
4463
4485
  children: [
4464
- e.showToolbar && i("div", {
4486
+ e.showToolbar && l("div", {
4465
4487
  style: {
4466
4488
  height: 83,
4467
4489
  backgroundColor: "#9e9e9e",
@@ -4469,7 +4491,7 @@ let __tla = (async () => {
4469
4491
  position: "relative",
4470
4492
  overflow: "hidden"
4471
4493
  },
4472
- children: i("div", {
4494
+ children: l("div", {
4473
4495
  style: {
4474
4496
  position: "absolute",
4475
4497
  inset: 0,
@@ -4497,7 +4519,7 @@ let __tla = (async () => {
4497
4519
  },
4498
4520
  children: [
4499
4521
  c && !le && (() => {
4500
- const m = V.length === 0 ? 1 : V.length === 1 ? 2 : 3, z = P === "AK" ? "Perineum" : "MPT", D = m === 1 ? `Place Point at ${z}` : m === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", L = m === 1 ? `Click on the model to mark the ${z}.` : m === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", Y = m === 1 ? "#2fbf4a" : m === 2 ? "#e53935" : "#2fbf4a", G = V.length >= 2;
4522
+ const m = V.length === 0 ? 1 : V.length === 1 ? 2 : 3, z = P === "AK" ? "Perineum" : "MPT", _ = m === 1 ? `Place Point at ${z}` : m === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", L = m === 1 ? `Click on the model to mark the ${z}.` : m === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", Y = m === 1 ? "#2fbf4a" : m === 2 ? "#e53935" : "#2fbf4a", G = V.length >= 2;
4501
4523
  return y("div", {
4502
4524
  style: {
4503
4525
  width: yn,
@@ -4511,7 +4533,7 @@ let __tla = (async () => {
4511
4533
  overflow: "auto"
4512
4534
  },
4513
4535
  children: [
4514
- i("style", {
4536
+ l("style", {
4515
4537
  children: "@keyframes gm-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(12, 67, 173, 0.45) } 50% { box-shadow: 0 0 0 6px rgba(12, 67, 173, 0) } }"
4516
4538
  }),
4517
4539
  y("div", {
@@ -4527,7 +4549,7 @@ let __tla = (async () => {
4527
4549
  border: "1px solid rgba(0,0,0,0.06)"
4528
4550
  },
4529
4551
  children: [
4530
- i("button", {
4552
+ l("button", {
4531
4553
  onClick: () => cn((O) => {
4532
4554
  const ee = !O;
4533
4555
  if (!ee) try {
@@ -4579,17 +4601,17 @@ let __tla = (async () => {
4579
4601
  boxShadow: "0 8px 24px rgba(0,0,0,0.28)"
4580
4602
  },
4581
4603
  children: [
4582
- i("div", {
4604
+ l("div", {
4583
4605
  style: {
4584
4606
  fontWeight: 600,
4585
4607
  marginBottom: 4
4586
4608
  },
4587
4609
  children: "How to place points"
4588
4610
  }),
4589
- i("div", {
4611
+ l("div", {
4590
4612
  children: "Drag to orbit the model. Click on the surface to place a point."
4591
4613
  }),
4592
- i("div", {
4614
+ l("div", {
4593
4615
  style: {
4594
4616
  position: "absolute",
4595
4617
  top: -5,
@@ -4615,7 +4637,7 @@ let __tla = (async () => {
4615
4637
  2,
4616
4638
  3,
4617
4639
  4
4618
- ].map((O) => i("div", {
4640
+ ].map((O) => l("div", {
4619
4641
  style: {
4620
4642
  height: 4,
4621
4643
  flex: 1,
@@ -4648,7 +4670,7 @@ let __tla = (async () => {
4648
4670
  paddingRight: 40
4649
4671
  },
4650
4672
  children: [
4651
- i("div", {
4673
+ l("div", {
4652
4674
  style: {
4653
4675
  width: 12,
4654
4676
  height: 12,
@@ -4658,18 +4680,18 @@ let __tla = (async () => {
4658
4680
  boxShadow: `0 0 0 3px ${Y}22`
4659
4681
  }
4660
4682
  }),
4661
- i("div", {
4683
+ l("div", {
4662
4684
  style: {
4663
4685
  fontSize: 17,
4664
4686
  fontWeight: 600,
4665
4687
  color: "rgba(0,0,0,0.88)",
4666
4688
  lineHeight: "22px"
4667
4689
  },
4668
- children: D
4690
+ children: _
4669
4691
  })
4670
4692
  ]
4671
4693
  }),
4672
- i("div", {
4694
+ l("div", {
4673
4695
  style: {
4674
4696
  fontSize: 13,
4675
4697
  color: "rgba(0,0,0,0.6)",
@@ -4677,7 +4699,7 @@ let __tla = (async () => {
4677
4699
  },
4678
4700
  children: L
4679
4701
  }),
4680
- i("button", {
4702
+ l("button", {
4681
4703
  disabled: !G,
4682
4704
  onClick: Ht,
4683
4705
  style: {
@@ -4699,7 +4721,7 @@ let __tla = (async () => {
4699
4721
  })
4700
4722
  ]
4701
4723
  }),
4702
- e.showStartOver && i("button", {
4724
+ e.showStartOver && l("button", {
4703
4725
  onClick: () => window.location.reload(),
4704
4726
  style: {
4705
4727
  marginTop: "auto",
@@ -4717,7 +4739,7 @@ let __tla = (async () => {
4717
4739
  ]
4718
4740
  });
4719
4741
  })(),
4720
- le && Ye && P && i("div", {
4742
+ le && Ke && P && l("div", {
4721
4743
  style: {
4722
4744
  width: yn,
4723
4745
  flexShrink: 0,
@@ -4728,7 +4750,7 @@ let __tla = (async () => {
4728
4750
  minHeight: 0,
4729
4751
  fontFamily: "system-ui, sans-serif"
4730
4752
  },
4731
- children: i("div", {
4753
+ children: l("div", {
4732
4754
  style: {
4733
4755
  flex: 1,
4734
4756
  minHeight: 0,
@@ -4741,11 +4763,11 @@ let __tla = (async () => {
4741
4763
  border: "1px solid rgba(0,0,0,0.06)",
4742
4764
  overflow: "hidden"
4743
4765
  },
4744
- children: i(Wr, {
4766
+ children: l(Br, {
4745
4767
  amputationType: P,
4746
4768
  spacingInches: S,
4747
4769
  scanMeasurements: T,
4748
- scanFrontalHeight: tt,
4770
+ scanFrontalHeight: nt,
4749
4771
  scanTransverseML: jt,
4750
4772
  scanTransverseAP: Gt,
4751
4773
  onSave: Po,
@@ -4771,7 +4793,7 @@ let __tla = (async () => {
4771
4793
  onDragLeave: e.showDragDrop ? Ao : void 0,
4772
4794
  onDrop: e.showDragDrop ? Mo : void 0,
4773
4795
  children: [
4774
- e.showDragDrop && !c && !g && i("div", {
4796
+ e.showDragDrop && !c && !g && l("div", {
4775
4797
  style: {
4776
4798
  position: "absolute",
4777
4799
  inset: 16,
@@ -4782,7 +4804,7 @@ let __tla = (async () => {
4782
4804
  justifyContent: "center",
4783
4805
  pointerEvents: "none"
4784
4806
  },
4785
- children: Te ? i("div", {
4807
+ children: Te ? l("div", {
4786
4808
  style: {
4787
4809
  fontSize: 18,
4788
4810
  color: "#aaa",
@@ -4795,7 +4817,7 @@ let __tla = (async () => {
4795
4817
  textAlign: "center"
4796
4818
  },
4797
4819
  children: [
4798
- i("div", {
4820
+ l("div", {
4799
4821
  style: {
4800
4822
  width: 32,
4801
4823
  height: 32,
@@ -4806,7 +4828,7 @@ let __tla = (async () => {
4806
4828
  margin: "0 auto 12px"
4807
4829
  }
4808
4830
  }),
4809
- i("div", {
4831
+ l("div", {
4810
4832
  style: {
4811
4833
  fontSize: 16,
4812
4834
  color: "#999",
@@ -4814,13 +4836,13 @@ let __tla = (async () => {
4814
4836
  },
4815
4837
  children: "Loading WASM module..."
4816
4838
  }),
4817
- i("style", {
4839
+ l("style", {
4818
4840
  children: "@keyframes spin { to { transform: rotate(360deg); } }"
4819
4841
  })
4820
4842
  ]
4821
4843
  })
4822
4844
  }),
4823
- !e.showDragDrop && !c && !g && !Lt && i("div", {
4845
+ !e.showDragDrop && !c && !g && !Lt && l("div", {
4824
4846
  style: {
4825
4847
  position: "absolute",
4826
4848
  inset: 0,
@@ -4833,7 +4855,7 @@ let __tla = (async () => {
4833
4855
  textAlign: "center"
4834
4856
  },
4835
4857
  children: [
4836
- i("div", {
4858
+ l("div", {
4837
4859
  style: {
4838
4860
  width: 32,
4839
4861
  height: 32,
@@ -4844,7 +4866,7 @@ let __tla = (async () => {
4844
4866
  margin: "0 auto 12px"
4845
4867
  }
4846
4868
  }),
4847
- i("div", {
4869
+ l("div", {
4848
4870
  style: {
4849
4871
  fontSize: 16,
4850
4872
  color: "#999",
@@ -4852,23 +4874,23 @@ let __tla = (async () => {
4852
4874
  },
4853
4875
  children: "Loading scan..."
4854
4876
  }),
4855
- i("style", {
4877
+ l("style", {
4856
4878
  children: "@keyframes spin { to { transform: rotate(360deg); } }"
4857
4879
  })
4858
4880
  ]
4859
4881
  })
4860
4882
  }),
4861
- g && i(En, {
4883
+ g && l(En, {
4862
4884
  message: A || "Processing mesh..."
4863
4885
  }),
4864
- X && i(En, {
4886
+ X && l(En, {
4865
4887
  message: ce
4866
4888
  }),
4867
- Lt && i(pr, {
4889
+ Lt && l(gr, {
4868
4890
  message: Lt,
4869
- onDismiss: () => Re(null)
4891
+ onDismiss: () => Ee(null)
4870
4892
  }),
4871
- e.showAmputationModal && M && i("div", {
4893
+ e.showAmputationModal && M && l("div", {
4872
4894
  style: {
4873
4895
  position: "absolute",
4874
4896
  inset: 0,
@@ -4894,7 +4916,7 @@ let __tla = (async () => {
4894
4916
  padding: "24px 24px 20px"
4895
4917
  },
4896
4918
  children: [
4897
- i("div", {
4919
+ l("div", {
4898
4920
  style: {
4899
4921
  fontSize: 20,
4900
4922
  fontWeight: 500,
@@ -4903,7 +4925,7 @@ let __tla = (async () => {
4903
4925
  },
4904
4926
  children: "Select Spacing Type"
4905
4927
  }),
4906
- i("div", {
4928
+ l("div", {
4907
4929
  style: {
4908
4930
  fontSize: 14,
4909
4931
  color: "rgba(0,0,0,0.54)",
@@ -4911,7 +4933,7 @@ let __tla = (async () => {
4911
4933
  },
4912
4934
  children: "Choose the measurement spacing for this scan"
4913
4935
  }),
4914
- i("div", {
4936
+ l("div", {
4915
4937
  style: {
4916
4938
  display: "flex",
4917
4939
  gap: 16
@@ -4934,7 +4956,7 @@ let __tla = (async () => {
4934
4956
  transition: "border-color 0.15s, background-color 0.15s"
4935
4957
  },
4936
4958
  children: [
4937
- i("input", {
4959
+ l("input", {
4938
4960
  type: "radio",
4939
4961
  name: "ampType",
4940
4962
  checked: P === m,
@@ -4946,7 +4968,7 @@ let __tla = (async () => {
4946
4968
  height: 18
4947
4969
  }
4948
4970
  }),
4949
- i("span", {
4971
+ l("span", {
4950
4972
  style: {
4951
4973
  fontSize: 18,
4952
4974
  fontWeight: 600,
@@ -4979,7 +5001,7 @@ let __tla = (async () => {
4979
5001
  borderTop: "1px solid #e0e0e0"
4980
5002
  },
4981
5003
  children: [
4982
- i("button", {
5004
+ l("button", {
4983
5005
  onClick: () => {
4984
5006
  E(false), N(null);
4985
5007
  },
@@ -4998,7 +5020,7 @@ let __tla = (async () => {
4998
5020
  },
4999
5021
  children: "Cancel"
5000
5022
  }),
5001
- i("button", {
5023
+ l("button", {
5002
5024
  onClick: () => P && zo(P),
5003
5025
  disabled: !P,
5004
5026
  style: {
@@ -5021,7 +5043,7 @@ let __tla = (async () => {
5021
5043
  ]
5022
5044
  })
5023
5045
  }),
5024
- e.showDragDrop && h && i("div", {
5046
+ e.showDragDrop && h && l("div", {
5025
5047
  style: {
5026
5048
  position: "absolute",
5027
5049
  inset: 0,
@@ -5031,7 +5053,7 @@ let __tla = (async () => {
5031
5053
  zIndex: 10
5032
5054
  }
5033
5055
  }),
5034
- i(ur, {
5056
+ l(hr, {
5035
5057
  children: y(Oo, {
5036
5058
  camera: {
5037
5059
  position: [
@@ -5042,20 +5064,20 @@ let __tla = (async () => {
5042
5064
  },
5043
5065
  style: {
5044
5066
  display: c ? "block" : "none",
5045
- backgroundColor: $e ? "#070611" : void 0
5067
+ backgroundColor: We ? "#070611" : void 0
5046
5068
  },
5047
5069
  gl: {
5048
5070
  localClippingEnabled: true,
5049
5071
  preserveDrawingBuffer: true
5050
5072
  },
5051
5073
  scene: {
5052
- background: $e ? new U.Color("#070611") : null
5074
+ background: We ? new U.Color("#070611") : null
5053
5075
  },
5054
5076
  children: [
5055
- i("ambientLight", {
5077
+ l("ambientLight", {
5056
5078
  intensity: 0.4
5057
5079
  }),
5058
- i("directionalLight", {
5080
+ l("directionalLight", {
5059
5081
  position: [
5060
5082
  10,
5061
5083
  10,
@@ -5063,7 +5085,7 @@ let __tla = (async () => {
5063
5085
  ],
5064
5086
  intensity: 1.2
5065
5087
  }),
5066
- i("directionalLight", {
5088
+ l("directionalLight", {
5067
5089
  position: [
5068
5090
  -5,
5069
5091
  5,
@@ -5071,7 +5093,7 @@ let __tla = (async () => {
5071
5093
  ],
5072
5094
  intensity: 0.4
5073
5095
  }),
5074
- i("directionalLight", {
5096
+ l("directionalLight", {
5075
5097
  position: [
5076
5098
  0,
5077
5099
  -10,
@@ -5079,15 +5101,15 @@ let __tla = (async () => {
5079
5101
  ],
5080
5102
  intensity: 0.2
5081
5103
  }),
5082
- c && x === "3D" && i(gr, {
5104
+ c && x === "3D" && l(xr, {
5083
5105
  mesh: c,
5084
5106
  maxPoints: 2,
5085
5107
  meshColor: dn,
5086
- meshOpacity: $e ? 0.3 : bo,
5108
+ meshOpacity: We ? 0.3 : bo,
5087
5109
  frontFaceOnly: H,
5088
5110
  doubleShellTransparency: re && le
5089
5111
  }),
5090
- c && x === "3D" && i(xr, {
5112
+ c && x === "3D" && l(yr, {
5091
5113
  modelSize: p,
5092
5114
  labels: [
5093
5115
  P === "AK" ? "Perineum" : "MPT",
@@ -5095,77 +5117,77 @@ let __tla = (async () => {
5095
5117
  "Cut Plane"
5096
5118
  ]
5097
5119
  }),
5098
- i(zr, {
5120
+ l(Pr, {
5099
5121
  modelSize: p,
5100
5122
  isAligned: le,
5101
5123
  isCut: Ot,
5102
5124
  mesh: c,
5103
5125
  viewMode: x,
5104
- sliceY: le && V.length >= 2 ? Pt ?? it ?? V[0].position.y : void 0,
5126
+ sliceY: le && V.length >= 2 ? Pt ?? st ?? V[0].position.y : void 0,
5105
5127
  landmarkCount: V.length,
5106
5128
  measurementGeometry: ie,
5107
- fitYMin: le && V.length >= 2 ? Pt ?? it ?? void 0 : void 0,
5108
- fitYMax: le && V.length >= 2 ? st ?? V[0].position.y : void 0,
5109
- resetCameraToFrontRef: $t
5129
+ fitYMin: le && V.length >= 2 ? Pt ?? st ?? void 0 : void 0,
5130
+ fitYMax: le && V.length >= 2 ? lt ?? V[0].position.y : void 0,
5131
+ resetCameraToFrontRef: Wt
5110
5132
  }),
5111
- !le && i(Nn, {
5133
+ !le && l(Nn, {
5112
5134
  enableDamping: false
5113
5135
  }),
5114
- le && T.length > 0 && c && x === "3D" && i(kr, {
5136
+ le && T.length > 0 && c && x === "3D" && l(Fr, {
5115
5137
  mesh: c,
5116
5138
  isDragging: oo
5117
5139
  }),
5118
5140
  c && le && V.length >= 3 && (() => {
5119
5141
  const z = c.geometry.getIndex();
5120
5142
  if (!z || z.count < 30) return null;
5121
- const D = V[2], L = V[0], Y = ye ?? D.position.y, G = Pt ?? it ?? L.position.y;
5143
+ const _ = V[2], L = V[0], Y = ye ?? _.position.y, G = Pt ?? st ?? L.position.y;
5122
5144
  if (x === "2D") {
5123
- const O = Ye ? ho : Ne ? P === "AK" ? Ce == null ? void 0 : Ce.perineumML : Ce == null ? void 0 : Ce.mptML : void 0, ee = Ye ? mo : Ne ? P === "AK" ? Ce == null ? void 0 : Ce.perineumAP : Ce == null ? void 0 : Ce.mptAP : void 0;
5124
- return i(Dr, {
5145
+ const O = Ke ? ho : Ne ? P === "AK" ? Ce == null ? void 0 : Ce.perineumML : Ce == null ? void 0 : Ce.mptML : void 0, ee = Ke ? mo : Ne ? P === "AK" ? Ce == null ? void 0 : Ce.perineumAP : Ce == null ? void 0 : Ce.mptAP : void 0;
5146
+ return l(Rr, {
5125
5147
  mesh: Oe ?? c,
5126
5148
  upperY: G,
5127
5149
  originY: L.position.y,
5128
5150
  modelSize: p,
5129
5151
  meshColor: dn,
5130
- displayUnit: _,
5152
+ displayUnit: D,
5131
5153
  formML: O,
5132
5154
  formAP: ee
5133
5155
  });
5134
5156
  }
5135
- return y(_e, {
5157
+ return y(Re, {
5136
5158
  children: [
5137
- i(Cr, {
5159
+ l(Mr, {
5138
5160
  mesh: Oe ?? c,
5139
5161
  startY: Y,
5140
5162
  endY: G,
5141
- spacing: pt,
5163
+ spacing: ht,
5142
5164
  modelSize: p,
5143
- onMeasurementsChange: Le,
5165
+ onMeasurementsChange: _e,
5144
5166
  reverseOrder: true,
5145
- displayUnit: _,
5167
+ displayUnit: D,
5146
5168
  useInnerSurface: re && !H,
5147
- formMeasurements: Ye ? co ?? ke : Ne ? ke : void 0,
5148
- originY: st ?? L.position.y,
5169
+ formMeasurements: Ke ? co ?? ke : Ne ? ke : void 0,
5170
+ originY: lt ?? L.position.y,
5149
5171
  wasmSlices: Pe
5150
5172
  }),
5151
- i(Mr, {
5173
+ l(kr, {
5152
5174
  mesh: c,
5153
- greenY: st ?? L.position.y,
5175
+ greenY: lt ?? L.position.y,
5154
5176
  modelSize: p,
5155
- displayUnit: _,
5156
- bottomY: re ? D.position.y : void 0,
5157
- formHeight: Ye ? uo : Ne ? Ce == null ? void 0 : Ce.frontalHeight : void 0
5177
+ displayUnit: D,
5178
+ bottomY: re ? _.position.y : void 0,
5179
+ formHeight: Ke ? uo : Ne ? Ce == null ? void 0 : Ce.frontalHeight : void 0
5158
5180
  }),
5159
- i(_r, {
5181
+ l(Er, {
5160
5182
  mesh: c,
5161
- yPosition: st ?? L.position.y,
5183
+ yPosition: lt ?? L.position.y,
5162
5184
  onYChange: (O) => {
5163
- on(O), We(null);
5185
+ on(O), $e(null);
5164
5186
  const ee = O - L.position.y;
5165
- Ft((it ?? L.position.y + pt * 2) + ee);
5187
+ Ft((st ?? L.position.y + ht * 2) + ee);
5166
5188
  },
5167
- minY: L.position.y - pt,
5168
- maxY: L.position.y + pt,
5189
+ minY: L.position.y - ht,
5190
+ maxY: L.position.y + ht,
5169
5191
  modelSize: p,
5170
5192
  color: "#44ff44",
5171
5193
  hoverColor: "#88ff88",
@@ -5177,10 +5199,10 @@ let __tla = (async () => {
5177
5199
  ]
5178
5200
  });
5179
5201
  })(),
5180
- c && le && x === "3D" && $e && i(Jr, {
5202
+ c && le && x === "3D" && We && l(ei, {
5181
5203
  mesh: c
5182
5204
  }),
5183
- c && e.showDebug && $e && x === "3D" && i(qr, {
5205
+ c && e.showDebug && We && x === "3D" && l(Qr, {
5184
5206
  mesh: c,
5185
5207
  modelSize: p,
5186
5208
  layers: rn,
@@ -5190,7 +5212,7 @@ let __tla = (async () => {
5190
5212
  aoGeometry: K,
5191
5213
  measurementGeometry: ie
5192
5214
  }),
5193
- i(ni, {
5215
+ l(ri, {
5194
5216
  screenshotFnRef: wo,
5195
5217
  mesh: c,
5196
5218
  modelSize: p,
@@ -5209,7 +5231,7 @@ let __tla = (async () => {
5209
5231
  gap: 8
5210
5232
  },
5211
5233
  children: [
5212
- e.showStartOver && le && i("button", {
5234
+ e.showStartOver && le && l("button", {
5213
5235
  onClick: () => window.location.reload(),
5214
5236
  style: {
5215
5237
  padding: "6px 16px",
@@ -5226,9 +5248,9 @@ let __tla = (async () => {
5226
5248
  },
5227
5249
  children: "Start Over"
5228
5250
  }),
5229
- !le && V.length >= 1 && y(_e, {
5251
+ !le && V.length >= 1 && y(Re, {
5230
5252
  children: [
5231
- i("button", {
5253
+ l("button", {
5232
5254
  onClick: () => Tt(),
5233
5255
  title: "Undo last point (Ctrl+Z)",
5234
5256
  style: {
@@ -5246,7 +5268,7 @@ let __tla = (async () => {
5246
5268
  },
5247
5269
  children: "Undo Point"
5248
5270
  }),
5249
- i("button", {
5271
+ l("button", {
5250
5272
  onClick: vo,
5251
5273
  style: {
5252
5274
  padding: "6px 16px",
@@ -5265,9 +5287,9 @@ let __tla = (async () => {
5265
5287
  })
5266
5288
  ]
5267
5289
  }),
5268
- le && !Rt && y(_e, {
5290
+ le && !Rt && y(Re, {
5269
5291
  children: [
5270
- i("button", {
5292
+ l("button", {
5271
5293
  onClick: ko,
5272
5294
  style: {
5273
5295
  padding: "6px 16px",
@@ -5284,7 +5306,7 @@ let __tla = (async () => {
5284
5306
  },
5285
5307
  children: "Reset Points"
5286
5308
  }),
5287
- i("button", {
5309
+ l("button", {
5288
5310
  onClick: So,
5289
5311
  title: "Mirror scan across the vertical axis (use if the scan came in flipped). Alignment will reset so you can re-place landmarks.",
5290
5312
  style: {
@@ -5306,7 +5328,7 @@ let __tla = (async () => {
5306
5328
  })
5307
5329
  ]
5308
5330
  }),
5309
- e.showDebug && $e && c && x === "3D" && i(ei, {
5331
+ e.showDebug && We && c && x === "3D" && l(ni, {
5310
5332
  layers: rn,
5311
5333
  onToggleLayer: (m) => io((z) => ({
5312
5334
  ...z,
@@ -5333,7 +5355,7 @@ let __tla = (async () => {
5333
5355
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5334
5356
  },
5335
5357
  children: [
5336
- i("button", {
5358
+ l("button", {
5337
5359
  onClick: () => F("3D"),
5338
5360
  style: {
5339
5361
  padding: "6px 14px",
@@ -5347,7 +5369,7 @@ let __tla = (async () => {
5347
5369
  },
5348
5370
  children: "Orbital"
5349
5371
  }),
5350
- i("button", {
5372
+ l("button", {
5351
5373
  onClick: () => F("2D"),
5352
5374
  style: {
5353
5375
  padding: "6px 14px",
@@ -5373,28 +5395,28 @@ let __tla = (async () => {
5373
5395
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5374
5396
  },
5375
5397
  children: [
5376
- i("button", {
5398
+ l("button", {
5377
5399
  onClick: () => B("cm"),
5378
5400
  style: {
5379
5401
  padding: "6px 14px",
5380
5402
  fontSize: 13,
5381
- fontWeight: _ === "cm" ? 600 : 400,
5382
- backgroundColor: _ === "cm" ? "rgb(12, 67, 173)" : "#fff",
5383
- color: _ === "cm" ? "#fff" : "#666",
5403
+ fontWeight: D === "cm" ? 600 : 400,
5404
+ backgroundColor: D === "cm" ? "rgb(12, 67, 173)" : "#fff",
5405
+ color: D === "cm" ? "#fff" : "#666",
5384
5406
  border: "none",
5385
5407
  cursor: "pointer",
5386
5408
  fontFamily: "system-ui, sans-serif"
5387
5409
  },
5388
5410
  children: "cm"
5389
5411
  }),
5390
- i("button", {
5412
+ l("button", {
5391
5413
  onClick: () => B("inch"),
5392
5414
  style: {
5393
5415
  padding: "6px 14px",
5394
5416
  fontSize: 13,
5395
- fontWeight: _ === "inch" ? 600 : 400,
5396
- backgroundColor: _ === "inch" ? "rgb(12, 67, 173)" : "#fff",
5397
- color: _ === "inch" ? "#fff" : "#666",
5417
+ fontWeight: D === "inch" ? 600 : 400,
5418
+ backgroundColor: D === "inch" ? "rgb(12, 67, 173)" : "#fff",
5419
+ color: D === "inch" ? "#fff" : "#666",
5398
5420
  border: "none",
5399
5421
  borderLeft: "1px solid #ccc",
5400
5422
  cursor: "pointer",
@@ -5413,7 +5435,7 @@ let __tla = (async () => {
5413
5435
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5414
5436
  },
5415
5437
  children: [
5416
- i("button", {
5438
+ l("button", {
5417
5439
  onClick: () => C(1),
5418
5440
  style: {
5419
5441
  padding: "6px 14px",
@@ -5427,7 +5449,7 @@ let __tla = (async () => {
5427
5449
  },
5428
5450
  children: '1"'
5429
5451
  }),
5430
- i("button", {
5452
+ l("button", {
5431
5453
  onClick: () => C(2),
5432
5454
  style: {
5433
5455
  padding: "6px 14px",
@@ -5444,7 +5466,7 @@ let __tla = (async () => {
5444
5466
  })
5445
5467
  ]
5446
5468
  }),
5447
- x === "3D" && ke && i("div", {
5469
+ x === "3D" && ke && l("div", {
5448
5470
  style: {
5449
5471
  display: "flex",
5450
5472
  borderRadius: 6,
@@ -5452,8 +5474,8 @@ let __tla = (async () => {
5452
5474
  border: "1px solid #ccc",
5453
5475
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5454
5476
  },
5455
- children: i("button", {
5456
- onClick: () => _t((m) => !m),
5477
+ children: l("button", {
5478
+ onClick: () => Dt((m) => !m),
5457
5479
  style: {
5458
5480
  padding: "6px 14px",
5459
5481
  fontSize: 13,
@@ -5467,7 +5489,7 @@ let __tla = (async () => {
5467
5489
  children: "Measurement Overlay"
5468
5490
  })
5469
5491
  }),
5470
- e.showSaveButton && i("div", {
5492
+ e.showSaveButton && l("div", {
5471
5493
  style: {
5472
5494
  display: "flex",
5473
5495
  borderRadius: 6,
@@ -5475,15 +5497,15 @@ let __tla = (async () => {
5475
5497
  border: "1px solid #ccc",
5476
5498
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5477
5499
  },
5478
- children: i("button", {
5500
+ children: l("button", {
5479
5501
  onClick: async () => {
5480
- const m = await Qe();
5502
+ const m = await et();
5481
5503
  if (!m) return;
5482
- const z = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), D = (L, Y) => {
5504
+ const z = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), _ = (L, Y) => {
5483
5505
  const G = document.createElement("a");
5484
5506
  G.href = L, G.download = Y, G.click();
5485
5507
  };
5486
- D(m.frontal_view_png, `measurements_front_${z}.png`), await new Promise((L) => setTimeout(L, 300)), D(m.side_view_png, `measurements_transverse_${z}.png`);
5508
+ _(m.frontal_view_png, `measurements_front_${z}.png`), await new Promise((L) => setTimeout(L, 300)), _(m.side_view_png, `measurements_transverse_${z}.png`);
5487
5509
  },
5488
5510
  style: {
5489
5511
  padding: "6px 14px",
@@ -5498,7 +5520,7 @@ let __tla = (async () => {
5498
5520
  children: "Save"
5499
5521
  })
5500
5522
  }),
5501
- e.showDebug && l && i("div", {
5523
+ e.showDebug && i && l("div", {
5502
5524
  style: {
5503
5525
  display: "flex",
5504
5526
  borderRadius: 6,
@@ -5506,14 +5528,14 @@ let __tla = (async () => {
5506
5528
  border: "1px solid #ccc",
5507
5529
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5508
5530
  },
5509
- children: i("button", {
5531
+ children: l("button", {
5510
5532
  onClick: () => ro((m) => !m),
5511
5533
  style: {
5512
5534
  padding: "6px 14px",
5513
5535
  fontSize: 13,
5514
- fontWeight: $e ? 600 : 400,
5515
- backgroundColor: $e ? "#e65100" : "#fff",
5516
- color: $e ? "#fff" : "#666",
5536
+ fontWeight: We ? 600 : 400,
5537
+ backgroundColor: We ? "#e65100" : "#fff",
5538
+ color: We ? "#fff" : "#666",
5517
5539
  border: "none",
5518
5540
  cursor: "pointer",
5519
5541
  fontFamily: "system-ui, sans-serif"
@@ -5523,15 +5545,15 @@ let __tla = (async () => {
5523
5545
  })
5524
5546
  ]
5525
5547
  }),
5526
- c && q && i(Fr, {
5548
+ c && q && l(_r, {
5527
5549
  detectedUnit: J,
5528
5550
  onDismiss: () => ge(false)
5529
5551
  }),
5530
- c && he && le && i(Lr, {
5552
+ c && he && le && l(Dr, {
5531
5553
  isDoubleShell: re,
5532
5554
  onDismiss: () => Se(false)
5533
5555
  }),
5534
- s && le && i("div", {
5556
+ s && le && l("div", {
5535
5557
  className: "gm-action-row-container",
5536
5558
  style: {
5537
5559
  position: "absolute",
@@ -5552,7 +5574,7 @@ let __tla = (async () => {
5552
5574
  pointerEvents: "none"
5553
5575
  },
5554
5576
  children: [
5555
- i("style", {
5577
+ l("style", {
5556
5578
  children: `
5557
5579
  .gm-btn { pointer-events: auto; padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; font-family: system-ui, sans-serif; letter-spacing: 0.3px; cursor: pointer; transition: background-color 150ms, box-shadow 150ms, transform 80ms, color 150ms, border-color 150ms; line-height: 1.2; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
5558
5580
  .gm-btn:active:not(:disabled) { transform: translateY(1px); }
@@ -5581,27 +5603,27 @@ let __tla = (async () => {
5581
5603
  y("div", {
5582
5604
  className: "gm-btn-group",
5583
5605
  children: [
5584
- Rt && !Ye && i("button", {
5606
+ Rt && !Ke && l("button", {
5585
5607
  className: "gm-btn gm-btn-secondary",
5586
- onClick: () => Je(true),
5608
+ onClick: () => Qe(true),
5587
5609
  children: "Edit Measurements"
5588
5610
  }),
5589
- Rt && (Fo ? i("button", {
5611
+ Rt && (Fo ? l("button", {
5590
5612
  className: "gm-btn gm-btn-primary",
5591
- disabled: lt,
5613
+ disabled: at,
5592
5614
  onClick: () => Xt("continue"),
5593
5615
  children: "Continue \u2192"
5594
- }) : y(_e, {
5616
+ }) : y(Re, {
5595
5617
  children: [
5596
- i("button", {
5618
+ l("button", {
5597
5619
  className: "gm-btn gm-btn-primary",
5598
- disabled: lt,
5620
+ disabled: at,
5599
5621
  onClick: () => Xt("use_scan"),
5600
5622
  children: "Go with Scan"
5601
5623
  }),
5602
- i("button", {
5624
+ l("button", {
5603
5625
  className: "gm-btn gm-btn-primary",
5604
- disabled: lt,
5626
+ disabled: at,
5605
5627
  onClick: () => Xt("use_form_measurements"),
5606
5628
  children: "Go with Measurements"
5607
5629
  })
@@ -5616,7 +5638,7 @@ let __tla = (async () => {
5616
5638
  })
5617
5639
  ]
5618
5640
  }),
5619
- lt && y("div", {
5641
+ at && y("div", {
5620
5642
  "data-finalizing-overlay": true,
5621
5643
  style: {
5622
5644
  position: "absolute",
@@ -5629,7 +5651,7 @@ let __tla = (async () => {
5629
5651
  zIndex: 50
5630
5652
  },
5631
5653
  children: [
5632
- i("div", {
5654
+ l("div", {
5633
5655
  style: {
5634
5656
  width: 32,
5635
5657
  height: 32,
@@ -5639,7 +5661,7 @@ let __tla = (async () => {
5639
5661
  animation: "gm-spin 0.8s linear infinite"
5640
5662
  }
5641
5663
  }),
5642
- i("p", {
5664
+ l("p", {
5643
5665
  style: {
5644
5666
  marginTop: 12,
5645
5667
  fontSize: 14,
@@ -5648,14 +5670,14 @@ let __tla = (async () => {
5648
5670
  },
5649
5671
  children: "Generating screenshots and preparing data\u2026"
5650
5672
  }),
5651
- i("style", {
5673
+ l("style", {
5652
5674
  children: "@keyframes gm-spin { to { transform: rotate(360deg) } }"
5653
5675
  })
5654
5676
  ]
5655
5677
  })
5656
5678
  ]
5657
5679
  }),
5658
- l && Wt.length > 0 && y("div", {
5680
+ i && $t.length > 0 && y("div", {
5659
5681
  style: {
5660
5682
  height: 120,
5661
5683
  flexShrink: 0,
@@ -5679,7 +5701,7 @@ let __tla = (async () => {
5679
5701
  flexShrink: 0
5680
5702
  },
5681
5703
  children: [
5682
- i("span", {
5704
+ l("span", {
5683
5705
  style: {
5684
5706
  color: "#58a6ff",
5685
5707
  fontSize: 10,
@@ -5712,7 +5734,7 @@ let __tla = (async () => {
5712
5734
  " slices"
5713
5735
  ]
5714
5736
  }),
5715
- i("button", {
5737
+ l("button", {
5716
5738
  onClick: () => fn([]),
5717
5739
  style: {
5718
5740
  background: "none",
@@ -5729,19 +5751,19 @@ let __tla = (async () => {
5729
5751
  })
5730
5752
  ]
5731
5753
  }),
5732
- i("div", {
5733
- ref: ct,
5754
+ l("div", {
5755
+ ref: dt,
5734
5756
  style: {
5735
5757
  flex: 1,
5736
5758
  overflowY: "auto",
5737
5759
  padding: "4px 10px",
5738
5760
  lineHeight: 1.6
5739
5761
  },
5740
- children: Wt.map((m, z) => {
5741
- const D = m.includes("ERROR") || m.includes("failed"), L = m.includes("warning") || m.includes("WARN"), Y = m.includes("PIPELINE:"), G = m.includes("STATE:");
5742
- return i("div", {
5762
+ children: $t.map((m, z) => {
5763
+ const _ = m.includes("ERROR") || m.includes("failed"), L = m.includes("warning") || m.includes("WARN"), Y = m.includes("PIPELINE:"), G = m.includes("STATE:");
5764
+ return l("div", {
5743
5765
  style: {
5744
- color: D ? "#f85149" : L ? "#d29922" : Y ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
5766
+ color: _ ? "#f85149" : L ? "#d29922" : Y ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
5745
5767
  whiteSpace: "pre"
5746
5768
  },
5747
5769
  children: m
@@ -5752,14 +5774,14 @@ let __tla = (async () => {
5752
5774
  })
5753
5775
  ]
5754
5776
  }),
5755
- so && i(Tr, {
5777
+ so && l(Hr, {
5756
5778
  onSkip: xn,
5757
5779
  onCancel: () => an(false)
5758
5780
  })
5759
5781
  ]
5760
5782
  });
5761
5783
  };
5762
- function ni({ screenshotFnRef: e }) {
5784
+ function ri({ screenshotFnRef: e }) {
5763
5785
  return Z(() => {
5764
5786
  e.current = null;
5765
5787
  }, [
@@ -5785,44 +5807,44 @@ let __tla = (async () => {
5785
5807
  ]) t.push(`${n}_below`);
5786
5808
  return t;
5787
5809
  };
5788
- vt = function(e, o) {
5810
+ St = function(e, o) {
5789
5811
  const t = no(o), n = {};
5790
5812
  for (let s = 0; s < Math.min(e.length, t.length); s++) {
5791
- const l = e[s];
5792
- l != null && !isNaN(l) && (n[t[s]] = l);
5813
+ const i = e[s];
5814
+ i != null && !isNaN(i) && (n[t[s]] = i);
5793
5815
  }
5794
5816
  return n;
5795
5817
  };
5796
- oi = function(e, o) {
5818
+ ii = function(e, o) {
5797
5819
  if (!e) return;
5798
5820
  const n = no(o).map((s) => {
5799
- const l = e[s];
5800
- return l ?? void 0;
5821
+ const i = e[s];
5822
+ return i ?? void 0;
5801
5823
  });
5802
5824
  if (!n.every((s) => s == null)) return n;
5803
5825
  };
5804
- function ri(e) {
5826
+ function si(e) {
5805
5827
  const o = e.getAttribute("position");
5806
5828
  if (!o) return "";
5807
5829
  const t = [
5808
5830
  "# Galileo processed mesh"
5809
5831
  ];
5810
- for (let l = 0; l < o.count; l++) t.push(`v ${o.getX(l)} ${o.getY(l)} ${o.getZ(l)}`);
5832
+ for (let i = 0; i < o.count; i++) t.push(`v ${o.getX(i)} ${o.getY(i)} ${o.getZ(i)}`);
5811
5833
  const n = e.getAttribute("normal");
5812
- if (n) for (let l = 0; l < n.count; l++) t.push(`vn ${n.getX(l)} ${n.getY(l)} ${n.getZ(l)}`);
5834
+ if (n) for (let i = 0; i < n.count; i++) t.push(`vn ${n.getX(i)} ${n.getY(i)} ${n.getZ(i)}`);
5813
5835
  const s = e.getIndex();
5814
- if (s) for (let l = 0; l < s.count; l += 3) {
5815
- const d = s.getX(l) + 1, a = s.getX(l + 1) + 1, r = s.getX(l + 2) + 1;
5836
+ if (s) for (let i = 0; i < s.count; i += 3) {
5837
+ const d = s.getX(i) + 1, a = s.getX(i + 1) + 1, r = s.getX(i + 2) + 1;
5816
5838
  n ? t.push(`f ${d}//${d} ${a}//${a} ${r}//${r}`) : t.push(`f ${d} ${a} ${r}`);
5817
5839
  }
5818
- else for (let l = 0; l < o.count; l += 3) {
5819
- const d = l + 1, a = l + 2, r = l + 3;
5840
+ else for (let i = 0; i < o.count; i += 3) {
5841
+ const d = i + 1, a = i + 2, r = i + 3;
5820
5842
  n ? t.push(`f ${d}//${d} ${a}//${a} ${r}//${r}`) : t.push(`f ${d} ${a} ${r}`);
5821
5843
  }
5822
5844
  return t.join(`
5823
5845
  `);
5824
5846
  }
5825
- async function ii(e, o) {
5847
+ async function li(e, o) {
5826
5848
  for (let t = 0; t < 3; t++) try {
5827
5849
  const n = await fetch(e, {
5828
5850
  method: "PUT",
@@ -5861,8 +5883,8 @@ let __tla = (async () => {
5861
5883
  error: "Upload failed after 3 attempts"
5862
5884
  };
5863
5885
  }
5864
- bi = ({ request: e, onComplete: o, wasmModule: t }) => {
5865
- const [n, s] = $(null);
5886
+ wi = ({ request: e, onComplete: o, wasmModule: t }) => {
5887
+ const [n, s] = W(null);
5866
5888
  Z(() => {
5867
5889
  if (t != null) return;
5868
5890
  let r = false;
@@ -5883,23 +5905,23 @@ let __tla = (async () => {
5883
5905
  }, [
5884
5906
  t
5885
5907
  ]);
5886
- const l = t !== void 0 ? t : n ?? void 0, d = te(() => oi(e.form_measurements, e.spacing_type), [
5908
+ const i = t !== void 0 ? t : n ?? void 0, d = te(() => ii(e.form_measurements, e.spacing_type), [
5887
5909
  e.form_measurements,
5888
5910
  e.spacing_type
5889
5911
  ]), a = async (r) => {
5890
5912
  var _a, _b;
5891
- const c = r.scanMeasurements.map((x) => +(x.modifiedValue ?? x.originalValue).toFixed(1)), u = vt(c, e.spacing_type);
5913
+ const c = r.scanMeasurements.map((x) => +(x.modifiedValue ?? x.originalValue).toFixed(1)), u = St(c, e.spacing_type);
5892
5914
  let p, f;
5893
5915
  if (r.formMeasurements) {
5894
- p = vt(r.formMeasurements, e.spacing_type);
5916
+ p = St(r.formMeasurements, e.spacing_type);
5895
5917
  const x = r.scanMeasurements.map((F, S) => {
5896
5918
  var _a2;
5897
5919
  const C = (_a2 = r.formMeasurements) == null ? void 0 : _a2[S];
5898
5920
  return C == null || isNaN(C) ? null : +((F.modifiedValue ?? F.originalValue) - C).toFixed(1);
5899
5921
  });
5900
- f = vt(x, e.spacing_type);
5922
+ f = St(x, e.spacing_type);
5901
5923
  }
5902
- const h = r.userEnteredMeasurements ? vt(r.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, w = r.decision === "use_scan" || r.decision === "continue", g = w ? u : h ?? p ?? u, b = w ? +r.frontalHeight.toFixed(1) : +(((_a = r.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? r.frontalHeight).toFixed(1);
5924
+ const h = r.userEnteredMeasurements ? St(r.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, w = r.decision === "use_scan" || r.decision === "continue", g = w ? u : h ?? p ?? u, b = w ? +r.frontalHeight.toFixed(1) : +(((_a = r.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? r.frontalHeight).toFixed(1);
5903
5925
  let A;
5904
5926
  if (e.upload_url) if (!r.alignedGeometry) A = {
5905
5927
  success: false,
@@ -5907,9 +5929,9 @@ let __tla = (async () => {
5907
5929
  message: "No aligned geometry available \u2014 mesh processing may not have completed."
5908
5930
  };
5909
5931
  else try {
5910
- const x = ri(r.alignedGeometry), F = new Blob([
5932
+ const x = si(r.alignedGeometry), F = new Blob([
5911
5933
  x
5912
- ]), S = await ii(e.upload_url, F);
5934
+ ]), S = await li(e.upload_url, F);
5913
5935
  A = {
5914
5936
  ...S,
5915
5937
  url: e.upload_url,
@@ -5954,28 +5976,28 @@ let __tla = (async () => {
5954
5976
  };
5955
5977
  o == null ? void 0 : o(v);
5956
5978
  };
5957
- return i("div", {
5979
+ return l("div", {
5958
5980
  style: {
5959
5981
  width: "100%",
5960
5982
  height: "100%",
5961
5983
  display: "flex"
5962
5984
  },
5963
- children: i(ti, {
5985
+ children: l(oi, {
5964
5986
  config: Xo,
5965
5987
  spacingType: e.spacing_type,
5966
5988
  scanUrl: e.scan_url,
5967
5989
  formMeasurements: d,
5968
5990
  onComplete: a,
5969
- wasmModule: l
5991
+ wasmModule: i
5970
5992
  })
5971
5993
  });
5972
5994
  };
5973
5995
  })();
5974
5996
  export {
5975
- bi as G,
5997
+ wi as G,
5976
5998
  __tla,
5977
- vt as a,
5978
- oi as c,
5999
+ St as a,
6000
+ ii as c,
5979
6001
  no as g,
5980
6002
  en as u
5981
6003
  };