@solid-labs/fab-one-widget 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- import { jsxs as P, jsx as i, Fragment as Te } from "react/jsx-runtime";
2
- import { createContext as Yn, Component as Xn, useCallback as re, useMemo as j, useState as W, memo as Gn, useEffect as ne, useRef as le, forwardRef as Zn, createElement as Jt } from "react";
3
- import { useFrame as rn, useThree as sn, Canvas as Kn } from "@react-three/fiber";
4
- import { Html as Ye, Line as de, OrbitControls as ln } from "@react-three/drei";
1
+ import { jsxs as L, jsx as i, Fragment as Te } from "react/jsx-runtime";
2
+ import { createContext as Xn, Component as Gn, useCallback as re, useMemo as j, useState as E, memo as Zn, useEffect as ne, useRef as le, forwardRef as Kn, createElement as Qt } from "react";
3
+ import { useFrame as sn, useThree as ln, Canvas as Un } from "@react-three/fiber";
4
+ import { Html as Ye, Line as de, OrbitControls as an } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as dt, Vector3 as M, Box3 as an, Line3 as cn, Raycaster as Un } from "three";
7
- import { create as Jn } from "zustand";
8
- import { OBJLoader as dn } from "three/examples/jsm/loaders/OBJLoader.js";
9
- import { STLLoader as Qn } from "three/examples/jsm/loaders/STLLoader.js";
6
+ import { Plane as dt, Vector3 as C, Box3 as cn, Line3 as dn, Raycaster as Jn } from "three";
7
+ import { create as Qn } from "zustand";
8
+ import { OBJLoader as fn } from "three/examples/jsm/loaders/OBJLoader.js";
9
+ import { STLLoader as qn } from "three/examples/jsm/loaders/STLLoader.js";
10
10
  import { MeshBVH as ft } from "three-mesh-bvh";
11
- let pr, lt, nr, wn;
11
+ let hr, lt, or, Sn;
12
12
  let __tla = (async () => {
13
- const qn = {
13
+ const eo = {
14
14
  showDragDrop: true,
15
15
  showStartOver: true,
16
16
  showDebug: true,
@@ -19,7 +19,7 @@ let __tla = (async () => {
19
19
  showNavigation: true,
20
20
  showToolbar: false,
21
21
  showSaveButton: true
22
- }, eo = {
22
+ }, to = {
23
23
  showDragDrop: false,
24
24
  showStartOver: false,
25
25
  showDebug: false,
@@ -28,7 +28,7 @@ let __tla = (async () => {
28
28
  showNavigation: false,
29
29
  showToolbar: false,
30
30
  showSaveButton: false
31
- }, to = Yn(qn), It = Jn((e, r) => ({
31
+ }, no = Xn(eo), It = Qn((e, r) => ({
32
32
  landmarkPoints: [],
33
33
  isAligned: false,
34
34
  isCut: false,
@@ -39,7 +39,7 @@ let __tla = (async () => {
39
39
  ]
40
40
  }),
41
41
  removeLandmarkPoint: (t) => e((o) => ({
42
- landmarkPoints: o.landmarkPoints.filter((s, d) => d !== t)
42
+ landmarkPoints: o.landmarkPoints.filter((l, s) => s !== t)
43
43
  })),
44
44
  clearLandmarkPoints: () => e({
45
45
  landmarkPoints: [],
@@ -47,9 +47,9 @@ let __tla = (async () => {
47
47
  isCut: false
48
48
  }),
49
49
  updateLandmarkPositions: (t) => e((o) => ({
50
- landmarkPoints: o.landmarkPoints.map((s, d) => ({
51
- ...s,
52
- position: t[d] ?? s.position
50
+ landmarkPoints: o.landmarkPoints.map((l, s) => ({
51
+ ...l,
52
+ position: t[s] ?? l.position
53
53
  }))
54
54
  })),
55
55
  setAligned: (t) => e({
@@ -58,79 +58,84 @@ let __tla = (async () => {
58
58
  setCut: (t) => e({
59
59
  isCut: t
60
60
  }),
61
- isSelectionComplete: () => r().landmarkPoints.length === 3
62
- })), no = 0.45, ut = 3, Pt = 1e-3, at = 25.4, oo = [
61
+ isSelectionComplete: () => r().landmarkPoints.length === 3,
62
+ reset: () => e({
63
+ landmarkPoints: [],
64
+ isAligned: false,
65
+ isCut: false
66
+ })
67
+ })), oo = 0.45, ut = 3, Pt = 1e-3, at = 25.4, ro = [
63
68
  0.25,
64
69
  -0.25,
65
70
  0.5,
66
71
  -0.5
67
72
  ];
68
- function ro(e) {
73
+ function io(e) {
69
74
  var _a;
70
75
  const r = e.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
71
76
  if (!r || !((_a = r[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
72
77
  const t = e.split(`
73
- `), o = [], s = [];
74
- let d = false;
78
+ `), o = [], l = [];
79
+ let s = false;
75
80
  for (const c of t) if (c.startsWith("v ")) {
76
81
  const a = c.trim().split(/\s+/);
77
82
  if (a.length >= 7) {
78
83
  o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3]));
79
- let n = parseFloat(a[4]), h = parseFloat(a[5]), l = parseFloat(a[6]);
80
- (n > 1 || h > 1 || l > 1) && (n /= 255, h /= 255, l /= 255), s.push(n, h, l), d = true;
81
- } else a.length >= 4 && (o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), s.push(0, 0, 0));
84
+ let n = parseFloat(a[4]), h = parseFloat(a[5]), d = parseFloat(a[6]);
85
+ (n > 1 || h > 1 || d > 1) && (n /= 255, h /= 255, d /= 255), l.push(n, h, d), s = true;
86
+ } else a.length >= 4 && (o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), l.push(0, 0, 0));
82
87
  }
83
- return d ? {
88
+ return s ? {
84
89
  positions: new Float32Array(o),
85
- colors: new Float32Array(s)
90
+ colors: new Float32Array(l)
86
91
  } : null;
87
92
  }
88
- function io(e, r, t, o) {
89
- const s = e.getAttribute("position"), d = s.count, c = new Float32Array(d * 3), a = r.length / 3;
90
- let n = 1 / 0, h = 1 / 0, l = 1 / 0, f = -1 / 0, p = -1 / 0, g = -1 / 0;
91
- for (let F = 0; F < a; F++) {
92
- const B = r[F * 3] * o, $ = r[F * 3 + 1] * o, N = r[F * 3 + 2] * o;
93
- B < n && (n = B), B > f && (f = B), $ < h && (h = $), $ > p && (p = $), N < l && (l = N), N > g && (g = N);
93
+ function so(e, r, t, o) {
94
+ const l = e.getAttribute("position"), s = l.count, c = new Float32Array(s * 3), a = r.length / 3;
95
+ let n = 1 / 0, h = 1 / 0, d = 1 / 0, u = -1 / 0, p = -1 / 0, g = -1 / 0;
96
+ for (let k = 0; k < a; k++) {
97
+ const B = r[k * 3] * o, $ = r[k * 3 + 1] * o, N = r[k * 3 + 2] * o;
98
+ B < n && (n = B), B > u && (u = B), $ < h && (h = $), $ > p && (p = $), N < d && (d = N), N > g && (g = N);
94
99
  }
95
- const z = (n + f) * 0.5, u = (h + p) * 0.5, m = (l + g) * 0.5, x = f - n + 1e-6, S = p - h + 1e-6, I = g - l + 1e-6, A = x * 0.5, L = S * 0.5, y = I * 0.5, v = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), b = x / v, D = S / v, w = I / v, k = /* @__PURE__ */ new Map();
96
- for (let F = 0; F < a; F++) {
97
- const B = r[F * 3] * o - z, $ = r[F * 3 + 1] * o - u, N = r[F * 3 + 2] * o - m, U = Math.min(v - 1, Math.max(0, Math.floor((B + A) / b))), be = Math.min(v - 1, Math.max(0, Math.floor(($ + L) / D))), ae = Math.min(v - 1, Math.max(0, Math.floor((N + y) / w))), fe = U * v * v + be * v + ae;
98
- let ie = k.get(fe);
99
- ie || (ie = [], k.set(fe, ie)), ie.push(F);
100
+ const M = (n + u) * 0.5, f = (h + p) * 0.5, m = (d + g) * 0.5, x = u - n + 1e-6, S = p - h + 1e-6, I = g - d + 1e-6, F = x * 0.5, P = S * 0.5, b = I * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), y = x / z, D = S / z, w = I / z, A = /* @__PURE__ */ new Map();
101
+ for (let k = 0; k < a; k++) {
102
+ const B = r[k * 3] * o - M, $ = r[k * 3 + 1] * o - f, N = r[k * 3 + 2] * o - m, U = Math.min(z - 1, Math.max(0, Math.floor((B + F) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w))), fe = U * z * z + be * z + ae;
103
+ let ie = A.get(fe);
104
+ ie || (ie = [], A.set(fe, ie)), ie.push(k);
100
105
  }
101
- for (let F = 0; F < d; F++) {
102
- const B = s.getX(F), $ = s.getY(F), N = s.getZ(F), U = Math.min(v - 1, Math.max(0, Math.floor((B + A) / b))), be = Math.min(v - 1, Math.max(0, Math.floor(($ + L) / D))), ae = Math.min(v - 1, Math.max(0, Math.floor((N + y) / w)));
106
+ for (let k = 0; k < s; k++) {
107
+ const B = l.getX(k), $ = l.getY(k), N = l.getZ(k), U = Math.min(z - 1, Math.max(0, Math.floor((B + F) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w)));
103
108
  let fe = 1 / 0, ie = 0;
104
- for (let J = 0; J <= v && fe > 0; J++) {
109
+ for (let J = 0; J <= z && fe > 0; J++) {
105
110
  for (let Y = -J; Y <= J; Y++) for (let pe = -J; pe <= J; pe++) for (let Z = -J; Z <= J; Z++) {
106
111
  if (J > 0 && Math.abs(Y) < J && Math.abs(pe) < J && Math.abs(Z) < J) continue;
107
112
  const he = U + Y, me = be + pe, ue = ae + Z;
108
- if (he < 0 || he >= v || me < 0 || me >= v || ue < 0 || ue >= v) continue;
109
- const H = k.get(he * v * v + me * v + ue);
113
+ if (he < 0 || he >= z || me < 0 || me >= z || ue < 0 || ue >= z) continue;
114
+ const H = A.get(he * z * z + me * z + ue);
110
115
  if (H) for (const q of H) {
111
- const xe = r[q * 3] * o - z, Ce = r[q * 3 + 1] * o - u, we = r[q * 3 + 2] * o - m, oe = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
116
+ const xe = r[q * 3] * o - M, Ce = r[q * 3 + 1] * o - f, we = r[q * 3 + 2] * o - m, oe = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
112
117
  oe < fe && (fe = oe, ie = q);
113
118
  }
114
119
  }
115
120
  if (fe < 1 / 0) break;
116
121
  }
117
- c[F * 3] = t[ie * 3], c[F * 3 + 1] = t[ie * 3 + 1], c[F * 3 + 2] = t[ie * 3 + 2];
122
+ c[k * 3] = t[ie * 3], c[k * 3 + 1] = t[ie * 3 + 1], c[k * 3 + 2] = t[ie * 3 + 2];
118
123
  }
119
124
  e.setAttribute("color", new O.Float32BufferAttribute(c, 3));
120
125
  }
121
- const Qt = {
126
+ const qt = {
122
127
  debug: 0,
123
128
  info: 1,
124
129
  warn: 2,
125
130
  error: 3
126
131
  };
127
- let fn = "warn", un = null;
132
+ let un = "warn", pn = null;
128
133
  const ce = {
129
134
  setLevel(e) {
130
- fn = e;
135
+ un = e;
131
136
  },
132
137
  setHandler(e) {
133
- un = e;
138
+ pn = e;
134
139
  },
135
140
  debug(e, r, t) {
136
141
  st("debug", e, r, t);
@@ -146,30 +151,30 @@ let __tla = (async () => {
146
151
  }
147
152
  };
148
153
  function st(e, r, t, o) {
149
- if (Qt[e] < Qt[fn]) return;
150
- const s = `[${r}]`, d = o !== void 0 ? [
151
- s,
154
+ if (qt[e] < qt[un]) return;
155
+ const l = `[${r}]`, s = o !== void 0 ? [
156
+ l,
152
157
  t,
153
158
  o
154
159
  ] : [
155
- s,
160
+ l,
156
161
  t
157
162
  ];
158
163
  switch (e) {
159
164
  case "debug":
160
- console.debug(...d);
165
+ console.debug(...s);
161
166
  break;
162
167
  case "info":
163
- console.log(...d);
168
+ console.log(...s);
164
169
  break;
165
170
  case "warn":
166
- console.warn(...d);
171
+ console.warn(...s);
167
172
  break;
168
173
  case "error":
169
- console.error(...d);
174
+ console.error(...s);
170
175
  break;
171
176
  }
172
- un == null ? void 0 : un(e, r, t, o);
177
+ pn == null ? void 0 : pn(e, r, t, o);
173
178
  }
174
179
  function ct(e) {
175
180
  const r = e.getAttribute("position"), t = new Float32Array(r.array), o = e.getIndex();
@@ -177,24 +182,24 @@ let __tla = (async () => {
177
182
  positions: t,
178
183
  indices: new Uint32Array(o.array)
179
184
  };
180
- const s = t.length / 3, d = new Uint32Array(s);
181
- for (let c = 0; c < s; c++) d[c] = c;
185
+ const l = t.length / 3, s = new Uint32Array(l);
186
+ for (let c = 0; c < l; c++) s[c] = c;
182
187
  return {
183
188
  positions: t,
184
- indices: d
189
+ indices: s
185
190
  };
186
191
  }
187
- function pn(e, r) {
192
+ function hn(e, r) {
188
193
  const t = new O.BufferGeometry();
189
194
  return t.setAttribute("position", new O.Float32BufferAttribute(e, 3)), t.setIndex(new O.BufferAttribute(r, 1)), t.computeVertexNormals(), t;
190
195
  }
191
- async function so(e, r, t) {
196
+ async function lo(e, r, t) {
192
197
  try {
193
- const o = ro(e);
198
+ const o = io(e);
194
199
  t == null ? void 0 : t("Parsing mesh...");
195
- const d = new dn().parse(e);
200
+ const s = new fn().parse(e);
196
201
  let c = null;
197
- if (d.traverse((x) => {
202
+ if (s.traverse((x) => {
198
203
  x.isMesh && !c && (c = x.geometry);
199
204
  }), !c) return null;
200
205
  const { positions: a, indices: n } = ct(c);
@@ -203,45 +208,45 @@ let __tla = (async () => {
203
208
  const h = a.length / 3;
204
209
  for (let x = 0; x < Math.min(n.length, 300); x++) if (n[x] >= h) return ce.error("wasm", `Out-of-bounds index: ${n[x]} >= ${h}`), null;
205
210
  t == null ? void 0 : t("Processing mesh (WASM)...");
206
- const l = r.preprocess_mesh(a, n, 10, 1e-4, 500), f = l.positions(), p = l.indices(), g = l.unit_converted(), z = l.detected_unit(), u = l.log();
207
- if (ce.debug("wasm", "preprocess result", u), f.length === 0) return null;
211
+ const d = r.preprocess_mesh(a, n, 10, 1e-4, 500), u = d.positions(), p = d.indices(), g = d.unit_converted(), M = d.detected_unit(), f = d.log();
212
+ if (ce.debug("wasm", "preprocess result", f), u.length === 0) return null;
208
213
  t == null ? void 0 : t("Building geometry...");
209
- const m = pn(f, p);
214
+ const m = hn(u, p);
210
215
  if (o) {
211
216
  const x = g ? 1e3 : 1;
212
- io(m, o.positions, o.colors, x);
217
+ so(m, o.positions, o.colors, x);
213
218
  }
214
219
  return {
215
220
  geometry: m,
216
221
  wasScaled: g,
217
222
  unitConverted: g,
218
- detectedUnit: z
223
+ detectedUnit: M
219
224
  };
220
225
  } catch (o) {
221
226
  return ce.error("wasm", "Processing failed", o), null;
222
227
  }
223
228
  }
224
- function lo(e) {
225
- const t = new dn().parse(e);
229
+ function ao(e) {
230
+ const t = new fn().parse(e);
226
231
  let o = null;
227
- return t.traverse((s) => {
228
- s.isMesh && !o && (o = s.geometry);
232
+ return t.traverse((l) => {
233
+ l.isMesh && !o && (o = l.geometry);
229
234
  }), o;
230
235
  }
231
236
  async function Ft(e) {
232
- const r = await e.arrayBuffer(), s = new Qn().parse(r).getAttribute("position");
233
- if (!s || s.count === 0) throw new Error("Empty STL geometry");
234
- const d = [];
235
- for (let c = 0; c < s.count; c++) d.push(`v ${s.getX(c)} ${s.getY(c)} ${s.getZ(c)}`);
236
- for (let c = 0; c < s.count; c += 3) d.push(`f ${c + 1} ${c + 2} ${c + 3}`);
237
- return d.join(`
237
+ const r = await e.arrayBuffer(), l = new qn().parse(r).getAttribute("position");
238
+ if (!l || l.count === 0) throw new Error("Empty STL geometry");
239
+ const s = [];
240
+ for (let c = 0; c < l.count; c++) s.push(`v ${l.getX(c)} ${l.getY(c)} ${l.getZ(c)}`);
241
+ for (let c = 0; c < l.count; c += 3) s.push(`f ${c + 1} ${c + 2} ${c + 3}`);
242
+ return s.join(`
238
243
  `);
239
244
  }
240
- function ao(e, r) {
245
+ function co(e, r) {
241
246
  const t = 1 / r;
242
247
  return `${Math.round(e.x * t)}_${Math.round(e.y * t)}_${Math.round(e.z * t)}`;
243
248
  }
244
- function co(e, r) {
249
+ function fo(e, r) {
245
250
  if (!e.length) return [];
246
251
  const t = [];
247
252
  for (const o of e) (t.length === 0 || t[t.length - 1].distanceTo(o) > r) && t.push(o.clone());
@@ -252,127 +257,127 @@ let __tla = (async () => {
252
257
  for (let t = 0; t < e.length - 1; t++) r += e[t].distanceTo(e[t + 1]);
253
258
  return r;
254
259
  }
255
- function hn(e, r = 1e-3, t = false) {
260
+ function gn(e, r = 1e-3, t = false) {
256
261
  if (!e.length) return [];
257
- const o = /* @__PURE__ */ new Map(), s = (f) => {
258
- const p = ao(f, r);
262
+ const o = /* @__PURE__ */ new Map(), l = (u) => {
263
+ const p = co(u, r);
259
264
  let g = o.get(p);
260
- return g || (g = f.clone(), o.set(p, g)), g;
261
- }, d = e.map((f) => ({
262
- a: s(f.a),
263
- b: s(f.b)
265
+ return g || (g = u.clone(), o.set(p, g)), g;
266
+ }, s = e.map((u) => ({
267
+ a: l(u.a),
268
+ b: l(u.b)
264
269
  })), c = [];
265
- for (; d.length; ) {
266
- const f = d.pop(), p = [
267
- f.a,
268
- f.b
270
+ for (; s.length; ) {
271
+ const u = s.pop(), p = [
272
+ u.a,
273
+ u.b
269
274
  ];
270
275
  let g = true;
271
276
  for (; g; ) {
272
277
  g = false;
273
- for (let u = d.length - 1; u >= 0; u--) {
274
- const { a: m, b: x } = d[u];
278
+ for (let f = s.length - 1; f >= 0; f--) {
279
+ const { a: m, b: x } = s[f];
275
280
  if (m.equals(p[p.length - 1])) p.push(x);
276
281
  else if (x.equals(p[p.length - 1])) p.push(m);
277
282
  else if (m.equals(p[0])) p.unshift(x);
278
283
  else if (x.equals(p[0])) p.unshift(m);
279
284
  else continue;
280
- d.splice(u, 1), g = true;
285
+ s.splice(f, 1), g = true;
281
286
  }
282
287
  }
283
- const z = co(p, r);
284
- z.length > 1 && c.push(z);
288
+ const M = fo(p, r);
289
+ M.length > 1 && c.push(M);
285
290
  }
286
291
  if (!c.length) return [];
287
292
  if (t) {
288
- c.sort((g, z) => Ze(z) - Ze(g));
289
- const f = Ze(c[0]), p = c.filter((g) => Ze(g) >= f * 0.3);
293
+ c.sort((g, M) => Ze(M) - Ze(g));
294
+ const u = Ze(c[0]), p = c.filter((g) => Ze(g) >= u * 0.3);
290
295
  return p[p.length - 1] ?? c[0];
291
296
  }
292
- const a = c.filter((f) => f.length >= 3 && f[0].distanceTo(f[f.length - 1]) < r * 10), n = a.length > 0 ? a : c;
297
+ const a = c.filter((u) => u.length >= 3 && u[0].distanceTo(u[u.length - 1]) < r * 10), n = a.length > 0 ? a : c;
293
298
  if (n.length === 1) return n[0];
294
- let h = n[0], l = 1 / 0;
295
- for (const f of n) {
299
+ let h = n[0], d = 1 / 0;
300
+ for (const u of n) {
296
301
  let p = 0, g = 0;
297
- for (const u of f) p += u.x, g += u.z;
298
- p /= f.length, g /= f.length;
299
- const z = Math.sqrt(p * p + g * g);
300
- z < l && (l = z, h = f);
302
+ for (const f of u) p += f.x, g += f.z;
303
+ p /= u.length, g /= u.length;
304
+ const M = Math.sqrt(p * p + g * g);
305
+ M < d && (d = M, h = u);
301
306
  }
302
307
  return h;
303
308
  }
304
- function qt(e, r, t, o = false) {
305
- const s = new dt(new M(0, 1, 0), -t), d = [], c = new an();
309
+ function en(e, r, t, o = false) {
310
+ const l = new dt(new C(0, 1, 0), -t), s = [], c = new cn();
306
311
  c.setFromBufferAttribute(r.getAttribute("position"));
307
312
  const a = {
308
313
  linePoints: [],
309
314
  lineLength: 0,
310
- rightmostPoint: new M(0, t, 0)
315
+ rightmostPoint: new C(0, t, 0)
311
316
  };
312
- if (!s.intersectsBox(c)) return a;
313
- const n = new cn(), h = new M();
317
+ if (!l.intersectsBox(c)) return a;
318
+ const n = new dn(), h = new C();
314
319
  e.shapecast({
315
- intersectsBounds: (u) => s.intersectsBox(u),
316
- intersectsTriangle: (u) => {
320
+ intersectsBounds: (f) => l.intersectsBox(f),
321
+ intersectsTriangle: (f) => {
317
322
  const m = [];
318
- n.set(u.a, u.b), s.intersectLine(n, h) && m.push(h.clone()), n.set(u.b, u.c), s.intersectLine(n, h) && m.push(h.clone()), n.set(u.c, u.a), s.intersectLine(n, h) && m.push(h.clone()), m.length === 2 && d.push({
323
+ n.set(f.a, f.b), l.intersectLine(n, h) && m.push(h.clone()), n.set(f.b, f.c), l.intersectLine(n, h) && m.push(h.clone()), n.set(f.c, f.a), l.intersectLine(n, h) && m.push(h.clone()), m.length === 2 && s.push({
319
324
  a: m[0],
320
325
  b: m[1]
321
326
  });
322
327
  }
323
328
  });
324
- const l = hn(d, Pt, o);
325
- if (l.length < 2) return a;
326
- const f = Ze(l);
327
- let p = -1 / 0, g = new M(0, t, 0);
328
- for (const u of l) u.x > p && (p = u.x, g = u.clone());
329
- const z = l.length > 2 && l[0].distanceTo(l[l.length - 1]) < Pt * 10;
329
+ const d = gn(s, Pt, o);
330
+ if (d.length < 2) return a;
331
+ const u = Ze(d);
332
+ let p = -1 / 0, g = new C(0, t, 0);
333
+ for (const f of d) f.x > p && (p = f.x, g = f.clone());
334
+ const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Pt * 10;
330
335
  return {
331
- linePoints: l,
332
- lineLength: f,
336
+ linePoints: d,
337
+ lineLength: u,
333
338
  rightmostPoint: g,
334
- isClosed: z
339
+ isClosed: M
335
340
  };
336
341
  }
337
342
  function Ne(e, r, t, o = false) {
338
- const s = qt(e, r, t, o);
339
- if (s.isClosed && s.linePoints.length >= 3) return s;
340
- ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
341
- let d = s;
342
- for (const c of oo) {
343
- const a = qt(e, r, t + c, o);
343
+ const l = en(e, r, t, o);
344
+ if (l.isClosed && l.linePoints.length >= 3) return l;
345
+ ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${l.linePoints.length}, closed=${l.isClosed}), retrying...`);
346
+ let s = l;
347
+ for (const c of ro) {
348
+ const a = en(e, r, t + c, o);
344
349
  if (a.isClosed && a.linePoints.length >= 3) return ce.debug("slice", `y=${t.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
345
- a.linePoints.length > d.linePoints.length && (d = a);
350
+ a.linePoints.length > s.linePoints.length && (s = a);
346
351
  }
347
- return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${d.linePoints.length}, closed=${d.isClosed})`), d;
352
+ return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${s.linePoints.length}, closed=${s.isClosed})`), s;
348
353
  }
349
- function fo(e, r, t, o) {
350
- const s = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), d = new an();
351
- if (d.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(d)) return 0;
352
- const c = [], a = new cn(), n = new M();
354
+ function uo(e, r, t, o) {
355
+ const l = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new cn();
356
+ if (s.setFromBufferAttribute(r.getAttribute("position")), !l.intersectsBox(s)) return 0;
357
+ const c = [], a = new dn(), n = new C();
353
358
  e.shapecast({
354
- intersectsBounds: (l) => s.intersectsBox(l),
355
- intersectsTriangle: (l) => {
356
- const f = [];
357
- a.set(l.a, l.b), s.intersectLine(a, n) && f.push(n.clone()), a.set(l.b, l.c), s.intersectLine(a, n) && f.push(n.clone()), a.set(l.c, l.a), s.intersectLine(a, n) && f.push(n.clone()), f.length === 2 && c.push({
358
- a: f[0],
359
- b: f[1]
359
+ intersectsBounds: (d) => l.intersectsBox(d),
360
+ intersectsTriangle: (d) => {
361
+ const u = [];
362
+ a.set(d.a, d.b), l.intersectLine(a, n) && u.push(n.clone()), a.set(d.b, d.c), l.intersectLine(a, n) && u.push(n.clone()), a.set(d.c, d.a), l.intersectLine(a, n) && u.push(n.clone()), u.length === 2 && c.push({
363
+ a: u[0],
364
+ b: u[1]
360
365
  });
361
366
  }
362
367
  });
363
- const h = hn(c, Pt);
368
+ const h = gn(c, Pt);
364
369
  return Ze(h);
365
370
  }
366
- function gn(e) {
371
+ function mn(e) {
367
372
  return new ft(e, {
368
373
  maxLeafTris: ut
369
374
  });
370
375
  }
371
- function uo(e, r, t, o) {
372
- const s = e.getIndex(), d = s ? s.count / 3 : 0;
373
- if (d < 10) return {
376
+ function po(e, r, t, o) {
377
+ const l = e.getIndex(), s = l ? l.count / 3 : 0;
378
+ if (s < 10) return {
374
379
  valid: false,
375
- reason: `Geometry is empty or degenerate (${d} faces)`
380
+ reason: `Geometry is empty or degenerate (${s} faces)`
376
381
  };
377
382
  const c = r - t;
378
383
  if (c < 4) return {
@@ -395,19 +400,19 @@ let __tla = (async () => {
395
400
  valid: true,
396
401
  reason: ""
397
402
  };
398
- const l = Ne(a, e, h);
399
- if (n.lineLength > 0 && l.lineLength > 0) {
400
- const p = n.lineLength / l.lineLength;
403
+ const d = Ne(a, e, h);
404
+ if (n.lineLength > 0 && d.lineLength > 0) {
405
+ const p = n.lineLength / d.lineLength;
401
406
  if (p < 0.5) return {
402
407
  valid: false,
403
408
  reason: `First circumference is too small relative to second (ratio ${p.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
404
409
  };
405
410
  }
406
- const f = r - o * 2;
407
- if (f > t) {
408
- const p = Ne(a, e, f);
409
- if (l.lineLength > 0 && p.lineLength > 0) {
410
- const g = l.lineLength / p.lineLength;
411
+ const u = r - o * 2;
412
+ if (u > t) {
413
+ const p = Ne(a, e, u);
414
+ if (d.lineLength > 0 && p.lineLength > 0) {
415
+ const g = d.lineLength / p.lineLength;
411
416
  if (g < 0.5) return {
412
417
  valid: false,
413
418
  reason: `Second circumference is too small relative to third (ratio ${g.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
@@ -420,29 +425,29 @@ let __tla = (async () => {
420
425
  };
421
426
  }
422
427
  const Fe = "pipeline";
423
- function po(e, r, t, o) {
428
+ function ho(e, r, t, o) {
424
429
  var _a, _b, _c, _d;
425
- const s = e.geometry.clone(), d = r.map((a) => ({
430
+ const l = e.geometry.clone(), s = r.map((a) => ({
426
431
  ...a
427
432
  })), c = o.wasmModule;
428
433
  try {
429
- let a = e.geometry, n = d.map((H) => new M(H.position.x, H.position.y, H.position.z));
430
- const h = n[0], l = n[1];
434
+ let a = e.geometry, n = s.map((H) => new C(H.position.x, H.position.y, H.position.z));
435
+ const h = n[0], d = n[1];
431
436
  if (!c) {
432
437
  o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(Fe, "WASM not available, using JS fallback alignment");
433
- const H = new M(0, 1, 0), q = new M().subVectors(l, h).normalize(), xe = q.dot(H), Ce = new M().crossVectors(q, H);
438
+ const H = new C(0, 1, 0), q = new C().subVectors(d, h).normalize(), xe = q.dot(H), Ce = new C().crossVectors(q, H);
434
439
  if (Ce.length() > 1e-4) {
435
440
  Ce.normalize();
436
441
  const X = new O.Quaternion().setFromAxisAngle(Ce, Math.acos(Math.min(1, Math.max(-1, xe))));
437
442
  a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((Le) => Le.clone().applyQuaternion(X));
438
443
  }
439
444
  if (n[0].y > n[1].y) {
440
- const X = new O.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
445
+ const X = new O.Quaternion().setFromAxisAngle(new C(1, 0, 0), Math.PI);
441
446
  a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((Le) => Le.clone().applyQuaternion(X));
442
447
  }
443
448
  const we = n[0].clone();
444
- a.translate(-we.x, -we.y, -we.z), n = n.map((X) => new M(X.x - we.x, X.y - we.y, X.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
445
- const oe = new M(n[0].x, n[0].y, n[0].z);
449
+ a.translate(-we.x, -we.y, -we.z), n = n.map((X) => new C(X.x - we.x, X.y - we.y, X.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
450
+ const oe = new C(n[0].x, n[0].y, n[0].z);
446
451
  n.push(oe), o.addLandmarkPoint({
447
452
  faceIndex: -1,
448
453
  vertexIndices: [
@@ -465,37 +470,37 @@ let __tla = (async () => {
465
470
  y: X.y,
466
471
  z: X.z
467
472
  }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * at);
468
- const V = new M();
469
- a.computeBoundingBox(), a.boundingBox.getSize(V), o.setModelSize(Math.max(V.x, V.y, V.z)), s.dispose();
473
+ const V = new C();
474
+ a.computeBoundingBox(), a.boundingBox.getSize(V), o.setModelSize(Math.max(V.x, V.y, V.z)), l.dispose();
470
475
  return;
471
476
  }
472
- const { positions: f, indices: p } = ct(a), g = new Float32Array([
477
+ const { positions: u, indices: p } = ct(a), g = new Float32Array([
473
478
  h.x,
474
479
  h.y,
475
480
  h.z
476
- ]), z = new Float32Array([
477
- l.x,
478
- l.y,
479
- l.z
481
+ ]), M = new Float32Array([
482
+ d.x,
483
+ d.y,
484
+ d.z
480
485
  ]);
481
486
  o.onStatus("Detecting shell type...");
482
- const u = c.detect_shell(f, p, z, 40), m = u.is_double_shell(), x = u.surface_normal();
483
- ce.info(Fe, `Shell: ${m ? "DOUBLE" : "SINGLE"}`, u.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, m), o.onStatus("Finding cross-section plane...");
487
+ const f = c.detect_shell(u, p, M, 40), m = f.is_double_shell(), x = f.surface_normal();
488
+ ce.info(Fe, `Shell: ${m ? "DOUBLE" : "SINGLE"}`, f.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, m), o.onStatus("Finding cross-section plane...");
484
489
  const S = new Float32Array([
485
490
  x[0],
486
491
  x[1],
487
492
  x[2]
488
- ]), I = c.find_min_cross_section(f, p, z, S, 10), A = I.plane_normal();
493
+ ]), I = c.find_min_cross_section(u, p, M, S, 10), F = I.plane_normal();
489
494
  ce.info(Fe, "Cross-section found", I.details()), o.onStatus("Aligning mesh...");
490
- const L = new Float32Array([
491
- A[0],
492
- A[1],
493
- A[2]
494
- ]), y = c.align_to_origin(f, g, z, L);
495
- let v = y.positions(), b = y.mpt(), D = y.origin();
496
- const w = y.transform();
497
- ce.info(Fe, "Alignment complete", y.details());
498
- const k = [
495
+ const P = new Float32Array([
496
+ F[0],
497
+ F[1],
498
+ F[2]
499
+ ]), b = c.align_to_origin(u, g, M, P);
500
+ let z = b.positions(), y = b.mpt(), D = b.origin();
501
+ const w = b.transform();
502
+ ce.info(Fe, "Alignment complete", b.details());
503
+ const A = [
499
504
  w[3],
500
505
  w[4],
501
506
  w[5],
@@ -505,20 +510,20 @@ let __tla = (async () => {
505
510
  w[9],
506
511
  w[10],
507
512
  w[11]
508
- ], F = new Float32Array([
509
- k[0] * A[0] + k[1] * A[1] + k[2] * A[2],
510
- k[3] * A[0] + k[4] * A[1] + k[5] * A[2],
511
- k[6] * A[0] + k[7] * A[1] + k[8] * A[2]
513
+ ], k = new Float32Array([
514
+ A[0] * F[0] + A[1] * F[1] + A[2] * F[2],
515
+ A[3] * F[0] + A[4] * F[1] + A[5] * F[2],
516
+ A[6] * F[0] + A[7] * F[1] + A[8] * F[2]
512
517
  ]);
513
518
  o.onStatus("Generating measurement points...");
514
- const B = c.subdivide_origin_to_plane(new Float32Array(D), new Float32Array(b), F);
519
+ const B = c.subdivide_origin_to_plane(new Float32Array(D), new Float32Array(y), k);
515
520
  ce.debug(Fe, `Subdivide: ${B.count()} pts, spacing=${B.spacing().toFixed(1)}mm`);
516
521
  const $ = B.points(), N = B.count(), U = 2, be = 1, ae = [];
517
522
  for (let H = U; H < N - be; H++) ae.push($[H * 3 + 1]);
518
523
  o.onStatus("Computing cross-sections...");
519
524
  let fe = [];
520
525
  if (ae.length >= 2) {
521
- const q = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(v, p, new Float32Array(ae), 10);
526
+ const q = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, p, new Float32Array(ae), 10);
522
527
  ce.debug(Fe, "Batch (subdivision)", q.details());
523
528
  const xe = q.all_loop_points(), Ce = q.offsets(), we = q.circumferences();
524
529
  for (let oe = 0; oe < Ce.length - 1; oe++) {
@@ -533,12 +538,12 @@ let __tla = (async () => {
533
538
  }
534
539
  if (fe.length >= 6) {
535
540
  o.onStatus("Refining alignment...");
536
- const H = c.refine_alignment(new Float32Array(fe), v, new Float32Array(D), new Float32Array(b));
537
- ce.info(Fe, "Refinement complete", H.details()), v = H.positions(), b = H.mpt(), D = H.origin();
541
+ const H = c.refine_alignment(new Float32Array(fe), z, new Float32Array(D), new Float32Array(y));
542
+ ce.info(Fe, "Refinement complete", H.details()), z = H.positions(), y = H.mpt(), D = H.origin();
538
543
  }
539
- const ie = a.getAttribute("color"), J = pn(v, p);
540
- ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new M(D[0], D[1], D[2]), n[1] = new M(b[0], b[1], b[2]), o.onStatus("Setting blue point...");
541
- const Y = new M(n[0].x, n[0].y, n[0].z);
544
+ const ie = a.getAttribute("color"), J = hn(z, p);
545
+ ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new C(D[0], D[1], D[2]), n[1] = new C(y[0], y[1], y[2]), o.onStatus("Setting blue point...");
546
+ const Y = new C(n[0].x, n[0].y, n[0].z);
542
547
  n.push(Y), o.addLandmarkPoint({
543
548
  faceIndex: -1,
544
549
  vertexIndices: [
@@ -561,7 +566,7 @@ let __tla = (async () => {
561
566
  y: H.y,
562
567
  z: H.z
563
568
  }))), o.setAligned(true);
564
- const pe = a.boundingBox, Z = new M();
569
+ const pe = a.boundingBox, Z = new C();
565
570
  pe.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * at), o.onStatus("Computing final measurements...");
566
571
  {
567
572
  const H = ct(a), q = n[1].y, xe = n[0].y;
@@ -589,13 +594,13 @@ let __tla = (async () => {
589
594
  (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Xe);
590
595
  }
591
596
  o.onStatus("Validating results...");
592
- const he = n[1].y, me = n[0].y, ue = uo(a, he, me, t);
593
- ue.valid || ce.warn(Fe, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
597
+ const he = n[1].y, me = n[0].y, ue = po(a, he, me, t);
598
+ ue.valid || ce.warn(Fe, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (l.computeVertexNormals(), o.setClippedReferenceGeometry(l)) : l.dispose();
594
599
  } catch (a) {
595
- ce.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
600
+ ce.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), l.dispose();
596
601
  }
597
602
  }
598
- class ho extends Xn {
603
+ class go extends Gn {
599
604
  constructor() {
600
605
  super(...arguments), this.state = {
601
606
  error: null
@@ -614,7 +619,7 @@ let __tla = (async () => {
614
619
  console.error("[ErrorBoundary] Caught error:", r, t.componentStack);
615
620
  }
616
621
  render() {
617
- return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : P("div", {
622
+ return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : L("div", {
618
623
  style: {
619
624
  display: "flex",
620
625
  flexDirection: "column",
@@ -662,7 +667,7 @@ let __tla = (async () => {
662
667
  }) : this.props.children;
663
668
  }
664
669
  }
665
- const go = ({ message: e, onDismiss: r }) => P("div", {
670
+ const mo = ({ message: e, onDismiss: r }) => L("div", {
666
671
  style: {
667
672
  position: "absolute",
668
673
  top: 16,
@@ -679,7 +684,7 @@ let __tla = (async () => {
679
684
  gap: 12
680
685
  },
681
686
  children: [
682
- P("div", {
687
+ L("div", {
683
688
  style: {
684
689
  flex: 1
685
690
  },
@@ -715,7 +720,7 @@ let __tla = (async () => {
715
720
  children: "x"
716
721
  })
717
722
  ]
718
- }), en = ({ message: e }) => P("div", {
723
+ }), tn = ({ message: e }) => L("div", {
719
724
  style: {
720
725
  position: "absolute",
721
726
  top: 0,
@@ -753,42 +758,42 @@ let __tla = (async () => {
753
758
  })
754
759
  ]
755
760
  });
756
- function mo(e, r, t, o) {
757
- const s = new M().subVectors(t, r), d = new M().subVectors(o, r), c = new M().subVectors(e, r), a = s.dot(s), n = s.dot(d), h = s.dot(c), l = d.dot(d), f = d.dot(c), p = 1 / (a * l - n * n), g = (l * h - n * f) * p, z = (a * f - n * h) * p;
761
+ function xo(e, r, t, o) {
762
+ const l = new C().subVectors(t, r), s = new C().subVectors(o, r), c = new C().subVectors(e, r), a = l.dot(l), n = l.dot(s), h = l.dot(c), d = s.dot(s), u = s.dot(c), p = 1 / (a * d - n * n), g = (d * h - n * u) * p, M = (a * u - n * h) * p;
758
763
  return {
759
- u: 1 - g - z,
764
+ u: 1 - g - M,
760
765
  v: g,
761
- w: z
766
+ w: M
762
767
  };
763
768
  }
764
- const xo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: d = false }) => {
769
+ const yo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
765
770
  const { addLandmarkPoint: c, landmarkPoints: a } = It(), n = re((g) => {
766
771
  if (a.length >= r) return;
767
772
  g.stopPropagation();
768
- const z = g.intersections[0], u = z == null ? void 0 : z.faceIndex;
769
- if (!z || u == null) return;
773
+ const M = g.intersections[0], f = M == null ? void 0 : M.faceIndex;
774
+ if (!M || f == null) return;
770
775
  const m = e.geometry, x = m.index;
771
776
  let S;
772
777
  x ? S = [
773
- x.getX(u * 3),
774
- x.getX(u * 3 + 1),
775
- x.getX(u * 3 + 2)
778
+ x.getX(f * 3),
779
+ x.getX(f * 3 + 1),
780
+ x.getX(f * 3 + 2)
776
781
  ] : S = [
777
- u * 3,
778
- u * 3 + 1,
779
- u * 3 + 2
782
+ f * 3,
783
+ f * 3 + 1,
784
+ f * 3 + 2
780
785
  ];
781
- const I = m.getAttribute("position"), A = new M().fromBufferAttribute(I, S[0]), L = new M().fromBufferAttribute(I, S[1]), y = new M().fromBufferAttribute(I, S[2]);
782
- A.applyMatrix4(e.matrixWorld), L.applyMatrix4(e.matrixWorld), y.applyMatrix4(e.matrixWorld);
783
- const v = z.point, b = mo(v, A, L, y), D = {
784
- faceIndex: u,
786
+ const I = m.getAttribute("position"), F = new C().fromBufferAttribute(I, S[0]), P = new C().fromBufferAttribute(I, S[1]), b = new C().fromBufferAttribute(I, S[2]);
787
+ F.applyMatrix4(e.matrixWorld), P.applyMatrix4(e.matrixWorld), b.applyMatrix4(e.matrixWorld);
788
+ const z = M.point, y = xo(z, F, P, b), D = {
789
+ faceIndex: f,
785
790
  vertexIndices: S,
786
791
  position: {
787
- x: v.x,
788
- y: v.y,
789
- z: v.z
792
+ x: z.x,
793
+ y: z.y,
794
+ z: z.z
790
795
  },
791
- barycentricCoords: b
796
+ barycentricCoords: y
792
797
  };
793
798
  c(D);
794
799
  }, [
@@ -798,32 +803,32 @@ let __tla = (async () => {
798
803
  r
799
804
  ]), h = j(() => !!e.geometry.getAttribute("color"), [
800
805
  e
801
- ]), l = d ? Math.min(o, 0.65) : o, f = l < 1, p = j(() => new O.MeshStandardMaterial({
806
+ ]), d = s ? Math.min(o, 0.65) : o, u = d < 1, p = j(() => new O.MeshStandardMaterial({
802
807
  color: h ? "#ffffff" : t,
803
- side: s ? O.FrontSide : O.DoubleSide,
808
+ side: l ? O.FrontSide : O.DoubleSide,
804
809
  roughness: 0.6,
805
810
  metalness: 0.1,
806
- transparent: f,
807
- opacity: l,
808
- depthWrite: !d,
811
+ transparent: u,
812
+ opacity: d,
813
+ depthWrite: !s,
809
814
  vertexColors: h
810
815
  }), [
811
816
  t,
812
- l,
813
- f,
817
+ d,
818
+ u,
814
819
  h,
815
- s,
816
- d
820
+ l,
821
+ s
817
822
  ]);
818
823
  return i("primitive", {
819
824
  object: e,
820
825
  onClick: n,
821
826
  material: p,
822
- renderOrder: d ? 0 : void 0
827
+ renderOrder: s ? 0 : void 0
823
828
  });
824
- }, yo = ({ point: e, index: r, markerSize: t, color: o, label: s }) => {
825
- const [d, c] = W(false);
826
- return P("mesh", {
829
+ }, bo = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
830
+ const [s, c] = E(false);
831
+ return L("mesh", {
827
832
  position: [
828
833
  e.position.x,
829
834
  e.position.y,
@@ -842,7 +847,7 @@ let __tla = (async () => {
842
847
  i("meshBasicMaterial", {
843
848
  color: o
844
849
  }),
845
- d && i(Ye, {
850
+ s && i(Ye, {
846
851
  center: true,
847
852
  style: {
848
853
  pointerEvents: "none"
@@ -858,13 +863,13 @@ let __tla = (async () => {
858
863
  whiteSpace: "nowrap",
859
864
  transform: "translateY(-24px)"
860
865
  },
861
- children: s
866
+ children: l
862
867
  })
863
868
  })
864
869
  ]
865
870
  }, r);
866
- }, bo = ({ modelSize: e, labels: r }) => {
867
- const { landmarkPoints: t } = It(), o = e * 0.02, s = [
871
+ }, wo = ({ modelSize: e, labels: r }) => {
872
+ const { landmarkPoints: t } = It(), o = e * 0.02, l = [
868
873
  "#44ff44",
869
874
  "#ff4444",
870
875
  "#4444ff"
@@ -874,44 +879,44 @@ let __tla = (async () => {
874
879
  "Cut Plane"
875
880
  ];
876
881
  return i(Te, {
877
- children: t.map((a, n) => i(yo, {
882
+ children: t.map((a, n) => i(bo, {
878
883
  point: a,
879
884
  index: n,
880
885
  markerSize: o,
881
- color: s[n],
886
+ color: l[n],
882
887
  label: c[n]
883
888
  }, n))
884
889
  });
885
890
  };
886
- function mn(e) {
891
+ function xn(e) {
887
892
  return j(() => e ? new ft(e, {
888
893
  maxLeafTris: ut
889
894
  }) : null, [
890
895
  e
891
896
  ]);
892
897
  }
893
- const tn = (e, r) => {
898
+ const nn = (e, r) => {
894
899
  const t = Math.abs(e - r);
895
900
  return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
896
- }, nn = new O.Color("#8BC34A"), on = new O.Color("#FFC107"), wo = new O.Color("#FF5722"), So = (e) => {
897
- if (e <= 7) return nn.clone();
901
+ }, on = new O.Color("#8BC34A"), rn = new O.Color("#FFC107"), So = new O.Color("#FF5722"), vo = (e) => {
902
+ if (e <= 7) return on.clone();
898
903
  if (e <= 20) {
899
904
  const t = (e - 7) / 13;
900
- return nn.clone().lerp(on, t);
905
+ return on.clone().lerp(rn, t);
901
906
  }
902
907
  const r = Math.min((e - 20) / 20, 1);
903
- return on.clone().lerp(wo, r);
904
- }, vo = (e, r) => {
905
- const t = e.length, o = new Float32Array(t * 2 * 3), s = new Float32Array(t * 2 * 3), d = [];
908
+ return rn.clone().lerp(So, r);
909
+ }, Co = (e, r) => {
910
+ const t = e.length, o = new Float32Array(t * 2 * 3), l = new Float32Array(t * 2 * 3), s = [];
906
911
  for (let n = 0; n < t; n++) {
907
- const h = e[n], l = r[n], f = h.distanceTo(l), p = So(f);
908
- if (o[n * 6] = h.x, o[n * 6 + 1] = h.y, o[n * 6 + 2] = h.z, s[n * 6] = p.r, s[n * 6 + 1] = p.g, s[n * 6 + 2] = p.b, o[n * 6 + 3] = l.x, o[n * 6 + 4] = l.y, o[n * 6 + 5] = l.z, s[n * 6 + 3] = p.r, s[n * 6 + 4] = p.g, s[n * 6 + 5] = p.b, n < t - 1) {
909
- const g = n * 2, z = g + 1, u = (n + 1) * 2, m = u + 1;
910
- d.push(g, z, u, z, m, u);
912
+ const h = e[n], d = r[n], u = h.distanceTo(d), p = vo(u);
913
+ if (o[n * 6] = h.x, o[n * 6 + 1] = h.y, o[n * 6 + 2] = h.z, l[n * 6] = p.r, l[n * 6 + 1] = p.g, l[n * 6 + 2] = p.b, o[n * 6 + 3] = d.x, o[n * 6 + 4] = d.y, o[n * 6 + 5] = d.z, l[n * 6 + 3] = p.r, l[n * 6 + 4] = p.g, l[n * 6 + 5] = p.b, n < t - 1) {
914
+ const g = n * 2, M = g + 1, f = (n + 1) * 2, m = f + 1;
915
+ s.push(g, M, f, M, m, f);
911
916
  }
912
917
  }
913
918
  const c = new O.BufferGeometry();
914
- c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(s, 3)), c.setIndex(d);
919
+ c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(l, 3)), c.setIndex(s);
915
920
  const a = new O.MeshBasicMaterial({
916
921
  vertexColors: true,
917
922
  transparent: true,
@@ -921,25 +926,25 @@ let __tla = (async () => {
921
926
  depthWrite: false
922
927
  });
923
928
  return new O.Mesh(c, a);
924
- }, Co = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: s, onDataChange: d, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: l, wasmCircumference: f }) => {
925
- const p = j(() => l && f != null ? null : Ne(e, r, t, a), [
929
+ }, Mo = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: d, wasmCircumference: u }) => {
930
+ const p = j(() => d && u != null ? null : Ne(e, r, t, a), [
926
931
  e,
927
932
  r,
928
933
  t,
929
934
  a,
930
- l,
931
- f
932
- ]), g = l ?? (p == null ? void 0 : p.linePoints) ?? [], z = f ?? (p == null ? void 0 : p.lineLength) ?? 0, u = j(() => {
933
- if (n == null || z <= 0 || g.length < 2) return null;
934
- const I = n / z, A = g.reduce((y, v) => y + v.x, 0) / g.length, L = g.reduce((y, v) => y + v.z, 0) / g.length;
935
- return g.map((y) => new M(A + (y.x - A) * I, y.y, L + (y.z - L) * I));
935
+ d,
936
+ u
937
+ ]), g = d ?? (p == null ? void 0 : p.linePoints) ?? [], M = u ?? (p == null ? void 0 : p.lineLength) ?? 0, f = j(() => {
938
+ if (n == null || M <= 0 || g.length < 2) return null;
939
+ const I = n / M, F = g.reduce((b, z) => b + z.x, 0) / g.length, P = g.reduce((b, z) => b + z.z, 0) / g.length;
940
+ return g.map((b) => new C(F + (b.x - F) * I, b.y, P + (b.z - P) * I));
936
941
  }, [
937
942
  g,
938
- z,
943
+ M,
939
944
  n
940
- ]), m = j(() => !u || g.length < 2 ? null : vo(g, u), [
945
+ ]), m = j(() => !f || g.length < 2 ? null : Co(g, f), [
941
946
  g,
942
- u
947
+ f
943
948
  ]);
944
949
  ne(() => () => {
945
950
  m && (m.geometry.dispose(), m.material.dispose());
@@ -949,46 +954,46 @@ let __tla = (async () => {
949
954
  const x = le(null), S = j(() => {
950
955
  const I = new O.BufferGeometry();
951
956
  I.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
952
- const A = new O.LineBasicMaterial({
957
+ const F = new O.LineBasicMaterial({
953
958
  color: 6710886,
954
959
  depthTest: false,
955
960
  depthWrite: false,
956
961
  transparent: true
957
962
  });
958
- return new O.Line(I, A);
963
+ return new O.Line(I, F);
959
964
  }, []);
960
965
  return ne(() => () => {
961
966
  S.geometry.dispose(), S.material.dispose();
962
967
  }, [
963
968
  S
964
969
  ]), ne(() => {
965
- z > 0 && (d == null ? void 0 : d({
970
+ M > 0 && (s == null ? void 0 : s({
966
971
  yPosition: t,
967
- originalValue: z,
972
+ originalValue: M,
968
973
  modifiedValue: null
969
974
  }));
970
975
  }, [
971
- z,
976
+ M,
972
977
  t,
973
- d
974
- ]), rn(({ camera: I }) => {
978
+ s
979
+ ]), sn(({ camera: I }) => {
975
980
  if (!x.current || g.length < 2) return;
976
- const A = new M();
977
- I.getWorldDirection(A);
978
- const L = new M(A.x, 0, A.z);
979
- if (L.lengthSq() < 1e-8) return;
980
- L.normalize();
981
- const y = new M().crossVectors(L, new M(0, 1, 0)).normalize();
982
- let v = -1 / 0, b = g[0];
983
- for (const F of g) {
984
- const B = y.x * F.x + y.z * F.z;
985
- B > v && (v = B, b = F);
981
+ const F = new C();
982
+ I.getWorldDirection(F);
983
+ const P = new C(F.x, 0, F.z);
984
+ if (P.lengthSq() < 1e-8) return;
985
+ P.normalize();
986
+ const b = new C().crossVectors(P, new C(0, 1, 0)).normalize();
987
+ let z = -1 / 0, y = g[0];
988
+ for (const k of g) {
989
+ const B = b.x * k.x + b.z * k.z;
990
+ B > z && (z = B, y = k);
986
991
  }
987
- const D = s * 0.35, w = new M(b.x + y.x * D, t, b.z + y.z * D);
992
+ const D = l * 0.35, w = new C(y.x + b.x * D, t, y.z + b.z * D);
988
993
  x.current.position.copy(w);
989
- const k = S.geometry.getAttribute("position");
990
- k.setXYZ(0, b.x, b.y, b.z), k.setXYZ(1, w.x, w.y, w.z), k.needsUpdate = true;
991
- }), g.length < 2 ? null : P("group", {
994
+ const A = S.geometry.getAttribute("position");
995
+ A.setXYZ(0, y.x, y.y, y.z), A.setXYZ(1, w.x, w.y, w.z), A.needsUpdate = true;
996
+ }), g.length < 2 ? null : L("group", {
992
997
  renderOrder: 10,
993
998
  children: [
994
999
  i(de, {
@@ -1004,9 +1009,9 @@ let __tla = (async () => {
1004
1009
  object: m,
1005
1010
  renderOrder: 10
1006
1011
  }),
1007
- u && n != null && i(de, {
1008
- points: u,
1009
- color: tn(z, n),
1012
+ f && n != null && i(de, {
1013
+ points: f,
1014
+ color: nn(M, n),
1010
1015
  lineWidth: 2.5,
1011
1016
  dashed: true,
1012
1017
  dashSize: 2,
@@ -1032,7 +1037,7 @@ let __tla = (async () => {
1032
1037
  pointerEvents: "none",
1033
1038
  transform: "translateY(-50%)"
1034
1039
  },
1035
- children: P("div", {
1040
+ children: L("div", {
1036
1041
  style: {
1037
1042
  display: "flex",
1038
1043
  alignItems: "stretch",
@@ -1042,7 +1047,7 @@ let __tla = (async () => {
1042
1047
  whiteSpace: "nowrap"
1043
1048
  },
1044
1049
  children: [
1045
- P("div", {
1050
+ L("div", {
1046
1051
  style: {
1047
1052
  display: "flex",
1048
1053
  alignItems: "center",
@@ -1060,7 +1065,7 @@ let __tla = (async () => {
1060
1065
  minWidth: 52,
1061
1066
  textAlign: "right"
1062
1067
  },
1063
- children: c === "inch" ? (z / 25.4).toFixed(2) : z.toFixed(1)
1068
+ children: c === "inch" ? (M / 25.4).toFixed(2) : M.toFixed(1)
1064
1069
  }),
1065
1070
  i("span", {
1066
1071
  style: {
@@ -1072,9 +1077,9 @@ let __tla = (async () => {
1072
1077
  })
1073
1078
  ]
1074
1079
  }),
1075
- n != null && z > 0 && (() => {
1076
- const I = z - n, A = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", L = tn(z, n);
1077
- return P("div", {
1080
+ n != null && M > 0 && (() => {
1081
+ const I = M - n, F = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", P = nn(M, n);
1082
+ return L("div", {
1078
1083
  style: {
1079
1084
  display: "flex",
1080
1085
  alignItems: "center",
@@ -1085,18 +1090,18 @@ let __tla = (async () => {
1085
1090
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1086
1091
  },
1087
1092
  children: [
1088
- A && i("span", {
1093
+ F && i("span", {
1089
1094
  style: {
1090
1095
  fontSize: 10,
1091
- color: L,
1096
+ color: P,
1092
1097
  lineHeight: 1
1093
1098
  },
1094
- children: A
1099
+ children: F
1095
1100
  }),
1096
- P("span", {
1101
+ L("span", {
1097
1102
  style: {
1098
1103
  fontSize: 13,
1099
- color: L,
1104
+ color: P,
1100
1105
  fontFamily: "monospace",
1101
1106
  fontWeight: 600
1102
1107
  },
@@ -1105,7 +1110,7 @@ let __tla = (async () => {
1105
1110
  c === "inch" ? (I / 25.4).toFixed(2) : I.toFixed(1)
1106
1111
  ]
1107
1112
  }),
1108
- P("span", {
1113
+ L("span", {
1109
1114
  style: {
1110
1115
  fontSize: 11,
1111
1116
  color: "rgba(255,255,255,0.4)",
@@ -1125,121 +1130,121 @@ let __tla = (async () => {
1125
1130
  })
1126
1131
  ]
1127
1132
  });
1128
- }, Mo = Gn(Co), zo = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: s, onMeasurementsChange: d, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: l, wasmSlices: f }) => {
1129
- const p = le(/* @__PURE__ */ new Map()), g = e.geometry, z = mn(g), u = j(() => {
1130
- if (f) {
1131
- let v = [
1132
- ...f.yValues
1133
+ }, zo = Zn(Mo), Ao = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: d, wasmSlices: u }) => {
1134
+ const p = le(/* @__PURE__ */ new Map()), g = e.geometry, M = xn(g), f = j(() => {
1135
+ if (u) {
1136
+ let z = [
1137
+ ...u.yValues
1133
1138
  ];
1134
1139
  if (o > 25.4 + 0.1) {
1135
- const b = f.mptY;
1136
- v = v.filter((D) => {
1137
- const w = Math.abs(D - b);
1140
+ const y = u.mptY;
1141
+ z = z.filter((D) => {
1142
+ const w = Math.abs(D - y);
1138
1143
  return w < 0.5 || Math.abs(Math.round(w / o) * o - w) < 0.5;
1139
1144
  });
1140
1145
  }
1141
- return c ? v.sort((b, D) => D - b) : v.sort((b, D) => b - D), v;
1146
+ return c ? z.sort((y, D) => D - y) : z.sort((y, D) => y - D), z;
1142
1147
  }
1143
- const L = [];
1144
- if (c) for (let y = t; y >= r; y -= o) L.push(y);
1145
- else for (let y = r; y <= t; y += o) L.push(y);
1146
- return L;
1148
+ const P = [];
1149
+ if (c) for (let b = t; b >= r; b -= o) P.push(b);
1150
+ else for (let b = r; b <= t; b += o) P.push(b);
1151
+ return P;
1147
1152
  }, [
1148
1153
  r,
1149
1154
  t,
1150
1155
  o,
1151
1156
  c,
1152
- f
1157
+ u
1153
1158
  ]), m = j(() => {
1154
- if (!f) return null;
1155
- const L = /* @__PURE__ */ new Map(), { allLoopPoints: y, offsets: v, yValues: b } = f;
1156
- for (let D = 0; D < v.length - 1; D++) {
1157
- const w = v[D], k = v[D + 1];
1158
- if (k <= w) continue;
1159
- const F = [];
1160
- for (let B = w; B < k; B += 3) F.push(new M(y[B], y[B + 1], y[B + 2]));
1161
- F.length >= 3 && L.set(b[D], F);
1159
+ if (!u) return null;
1160
+ const P = /* @__PURE__ */ new Map(), { allLoopPoints: b, offsets: z, yValues: y } = u;
1161
+ for (let D = 0; D < z.length - 1; D++) {
1162
+ const w = z[D], A = z[D + 1];
1163
+ if (A <= w) continue;
1164
+ const k = [];
1165
+ for (let B = w; B < A; B += 3) k.push(new C(b[B], b[B + 1], b[B + 2]));
1166
+ k.length >= 3 && P.set(y[D], k);
1162
1167
  }
1163
- return L;
1168
+ return P;
1164
1169
  }, [
1165
- f
1170
+ u
1166
1171
  ]), x = j(() => {
1167
- if (!f) return null;
1168
- const L = /* @__PURE__ */ new Map();
1169
- for (let y = 0; y < f.yValues.length; y++) L.set(f.yValues[y], f.circumferences[y]);
1170
- return L;
1172
+ if (!u) return null;
1173
+ const P = /* @__PURE__ */ new Map();
1174
+ for (let b = 0; b < u.yValues.length; b++) P.set(u.yValues[b], u.circumferences[b]);
1175
+ return P;
1171
1176
  }, [
1172
- f
1177
+ u
1173
1178
  ]);
1174
1179
  ne(() => {
1175
1180
  p.current.clear();
1176
1181
  }, [
1177
- u
1182
+ f
1178
1183
  ]), ne(() => {
1179
- if (!x || !d) return;
1180
- const L = u.filter((y) => (x.get(y) ?? 0) > 0).map((y) => ({
1181
- yPosition: y,
1182
- originalValue: x.get(y) ?? 0,
1184
+ if (!x || !s) return;
1185
+ const P = f.filter((b) => (x.get(b) ?? 0) > 0).map((b) => ({
1186
+ yPosition: b,
1187
+ originalValue: x.get(b) ?? 0,
1183
1188
  modifiedValue: null
1184
1189
  }));
1185
- d(L);
1190
+ s(P);
1186
1191
  }, [
1187
1192
  x,
1188
- u,
1189
- d
1193
+ f,
1194
+ s
1190
1195
  ]);
1191
1196
  const S = [
1192
1197
  "#5B9BD5"
1193
- ], I = s * no, A = re((L) => {
1198
+ ], I = l * oo, F = re((P) => {
1194
1199
  if (x) return;
1195
- p.current.set(L.yPosition, L);
1196
- const y = Array.from(p.current.values()).sort((v, b) => c ? b.yPosition - v.yPosition : v.yPosition - b.yPosition);
1197
- d == null ? void 0 : d(y);
1200
+ p.current.set(P.yPosition, P);
1201
+ const b = Array.from(p.current.values()).sort((z, y) => c ? y.yPosition - z.yPosition : z.yPosition - y.yPosition);
1202
+ s == null ? void 0 : s(b);
1198
1203
  }, [
1199
- d,
1204
+ s,
1200
1205
  c,
1201
1206
  x
1202
1207
  ]);
1203
- return z ? i(Te, {
1204
- children: u.map((L, y) => i(Mo, {
1205
- bvh: z,
1208
+ return M ? i(Te, {
1209
+ children: f.map((P, b) => i(zo, {
1210
+ bvh: M,
1206
1211
  geometry: g,
1207
- yPosition: L,
1208
- color: l != null && Math.abs(L - l) < o * 0.5 ? "#44ff44" : S[y % S.length],
1212
+ yPosition: P,
1213
+ color: d != null && Math.abs(P - d) < o * 0.5 ? "#44ff44" : S[b % S.length],
1209
1214
  labelX: I,
1210
- onDataChange: A,
1215
+ onDataChange: F,
1211
1216
  displayUnit: a,
1212
1217
  useInnerSurface: n,
1213
- formValue: h == null ? void 0 : h[y],
1214
- lineWidth: l != null && Math.abs(L - l) < o * 0.5 ? 4 : 1.5,
1215
- wasmLoopPoints: m == null ? void 0 : m.get(L),
1216
- wasmCircumference: x == null ? void 0 : x.get(L)
1217
- }, L))
1218
+ formValue: h == null ? void 0 : h[b],
1219
+ lineWidth: d != null && Math.abs(P - d) < o * 0.5 ? 4 : 1.5,
1220
+ wasmLoopPoints: m == null ? void 0 : m.get(P),
1221
+ wasmCircumference: x == null ? void 0 : x.get(P)
1222
+ }, P))
1218
1223
  }) : null;
1219
- }, Ao = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: s }) => {
1224
+ }, ko = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
1220
1225
  var _a;
1221
- const d = e.geometry;
1222
- d.computeBoundingBox();
1223
- const c = s ?? ((_a = d.boundingBox) == null ? void 0 : _a.min.y) ?? 0, a = r - c, n = t * 0.4, h = t * 0.03, l = le(null);
1224
- rn(({ camera: S }) => {
1225
- if (!l.current) return;
1226
- const I = new M();
1226
+ const s = e.geometry;
1227
+ s.computeBoundingBox();
1228
+ const c = l ?? ((_a = s.boundingBox) == null ? void 0 : _a.min.y) ?? 0, a = r - c, n = t * 0.4, h = t * 0.03, d = le(null);
1229
+ sn(({ camera: S }) => {
1230
+ if (!d.current) return;
1231
+ const I = new C();
1227
1232
  S.getWorldDirection(I);
1228
- const A = new M(I.x, 0, I.z);
1229
- if (A.lengthSq() < 1e-8) return;
1230
- A.normalize();
1231
- const L = new M().crossVectors(new M(0, 1, 0), A).normalize();
1232
- l.current.position.set(L.x * n, 0, L.z * n);
1233
- const y = S.position.x - l.current.position.x, v = S.position.z - l.current.position.z;
1234
- l.current.rotation.y = Math.atan2(y, v);
1233
+ const F = new C(I.x, 0, I.z);
1234
+ if (F.lengthSq() < 1e-8) return;
1235
+ F.normalize();
1236
+ const P = new C().crossVectors(new C(0, 1, 0), F).normalize();
1237
+ d.current.position.set(P.x * n, 0, P.z * n);
1238
+ const b = S.position.x - d.current.position.x, z = S.position.z - d.current.position.z;
1239
+ d.current.rotation.y = Math.atan2(b, z);
1235
1240
  });
1236
- const f = new M(0, r, 0), p = new M(0, c, 0), g = new M(0, (r + c) / 2, 0), z = new M(-h, r, 0), u = new M(h, r, 0), m = new M(-h, c, 0), x = new M(h, c, 0);
1237
- return P("group", {
1238
- ref: l,
1241
+ const u = new C(0, r, 0), p = new C(0, c, 0), g = new C(0, (r + c) / 2, 0), M = new C(-h, r, 0), f = new C(h, r, 0), m = new C(-h, c, 0), x = new C(h, c, 0);
1242
+ return L("group", {
1243
+ ref: d,
1239
1244
  children: [
1240
1245
  i(de, {
1241
1246
  points: [
1242
- f,
1247
+ u,
1243
1248
  p
1244
1249
  ],
1245
1250
  color: "#888888",
@@ -1247,8 +1252,8 @@ let __tla = (async () => {
1247
1252
  }),
1248
1253
  i(de, {
1249
1254
  points: [
1250
- z,
1251
- u
1255
+ M,
1256
+ f
1252
1257
  ],
1253
1258
  color: "#888888",
1254
1259
  lineWidth: 1.5
@@ -1272,7 +1277,7 @@ let __tla = (async () => {
1272
1277
  0,
1273
1278
  0
1274
1279
  ],
1275
- children: P("div", {
1280
+ children: L("div", {
1276
1281
  style: {
1277
1282
  padding: "4px 8px",
1278
1283
  backgroundColor: "rgba(0, 0, 0, 0.7)",
@@ -1295,92 +1300,92 @@ let __tla = (async () => {
1295
1300
  })
1296
1301
  ]
1297
1302
  });
1298
- }, ko = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: s, sliceY: d, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1299
- const { set: h, size: l, camera: f, invalidate: p } = sn(), g = le(false), z = le(s), u = le(new M()), m = le(null), x = le(c), S = le(r), I = le(t), A = le(a), L = le(0), y = re(() => {
1303
+ }, Fo = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1304
+ const { set: h, size: d, camera: u, invalidate: p } = ln(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), F = le(a), P = le(0), b = re(() => {
1300
1305
  if (!o || e <= 0) return null;
1301
- const b = a ?? o.geometry;
1302
- b.computeBoundingBox();
1303
- const D = b.boundingBox, w = new M();
1306
+ const y = a ?? o.geometry;
1307
+ y.computeBoundingBox();
1308
+ const D = y.boundingBox, w = new C();
1304
1309
  D.getCenter(w);
1305
- const k = new M();
1306
- D.getSize(k), u.current.copy(k);
1307
- const F = l.width / l.height, B = Math.max(k.y, k.x / F) * 1.6, $ = B * F, N = w.y - k.y * 0.05;
1308
- L.current = N;
1310
+ const A = new C();
1311
+ D.getSize(A), f.current.copy(A);
1312
+ const k = d.width / d.height, B = Math.max(A.y, A.x / k) * 1.6, $ = B * k, N = w.y - A.y * 0.05;
1313
+ P.current = N;
1309
1314
  const U = new O.OrthographicCamera(-$ / 2, $ / 2, B / 2, -B / 2, 0.1, e * 10);
1310
1315
  return U.position.set(0, N, e * 2), U.lookAt(0, N, 0), U;
1311
1316
  }, [
1312
1317
  o,
1313
1318
  e,
1314
- l,
1319
+ d,
1315
1320
  a
1316
1321
  ]);
1317
1322
  ne(() => {
1318
1323
  if (n) return n.current = () => {
1319
- const b = y();
1320
- b && (h({
1321
- camera: b
1324
+ const y = b();
1325
+ y && (h({
1326
+ camera: y
1322
1327
  }), p());
1323
1328
  }, () => {
1324
1329
  n && (n.current = null);
1325
1330
  };
1326
1331
  }, [
1327
1332
  n,
1328
- y,
1333
+ b,
1329
1334
  h,
1330
1335
  p
1331
1336
  ]);
1332
- const v = re((b) => {
1333
- const D = b.position.clone(), w = D.length(), k = Math.atan2(D.x, D.z), F = Math.acos(D.y / w), $ = k + 0.02;
1334
- b.position.set(w * Math.sin(F) * Math.sin($), w * Math.cos(F), w * Math.sin(F) * Math.cos($)), b.lookAt(0, 0, 0), b.updateMatrixWorld(true), p();
1337
+ const z = re((y) => {
1338
+ const D = y.position.clone(), w = D.length(), A = Math.atan2(D.x, D.z), k = Math.acos(D.y / w), $ = A + 0.02;
1339
+ y.position.set(w * Math.sin(k) * Math.sin($), w * Math.cos(k), w * Math.sin(k) * Math.cos($)), y.lookAt(0, 0, 0), y.updateMatrixWorld(true), p();
1335
1340
  }, [
1336
1341
  p
1337
1342
  ]);
1338
1343
  return ne(() => {
1339
1344
  if (e > 0 && !g.current && !r) {
1340
1345
  g.current = true;
1341
- const b = new O.PerspectiveCamera(50, l.width / l.height, 0.1, e * 10);
1342
- b.position.set(e * 0.3, e * 0.2, e * 1.5), b.lookAt(0, 0, 0), h({
1343
- camera: b
1344
- }), requestAnimationFrame(() => v(b));
1346
+ const y = new O.PerspectiveCamera(50, d.width / d.height, 0.1, e * 10);
1347
+ y.position.set(e * 0.3, e * 0.2, e * 1.5), y.lookAt(0, 0, 0), h({
1348
+ camera: y
1349
+ }), requestAnimationFrame(() => z(y));
1345
1350
  }
1346
1351
  }, [
1347
1352
  e,
1348
- l,
1353
+ d,
1349
1354
  h,
1350
1355
  r,
1351
- v
1356
+ z
1352
1357
  ]), ne(() => {
1353
- const b = x.current;
1354
- x.current = c, b === 0 && c === 1 && !r && requestAnimationFrame(() => v(f));
1358
+ const y = x.current;
1359
+ x.current = c, y === 0 && c === 1 && !r && requestAnimationFrame(() => z(u));
1355
1360
  }, [
1356
1361
  c,
1357
1362
  r,
1358
- f,
1359
- v
1363
+ u,
1364
+ z
1360
1365
  ]), ne(() => {
1361
- const b = S.current !== r, D = I.current !== t, w = !A.current && !!a;
1362
- if (S.current = r, I.current = t, A.current = a, !b && !D && !w || !r || s !== "3D") return;
1363
- const k = y();
1364
- k && h({
1365
- camera: k
1366
+ const y = S.current !== r, D = I.current !== t, w = !F.current && !!a;
1367
+ if (S.current = r, I.current = t, F.current = a, !y && !D && !w || !r || l !== "3D") return;
1368
+ const A = b();
1369
+ A && h({
1370
+ camera: A
1366
1371
  });
1367
1372
  }, [
1368
1373
  r,
1369
1374
  t,
1370
- s,
1375
+ l,
1371
1376
  a,
1372
- y,
1377
+ b,
1373
1378
  h
1374
1379
  ]), ne(() => {
1375
- if (z.current === s) return;
1376
- const b = z.current;
1377
- if (z.current = s, !(!r || !o || e <= 0)) {
1378
- if (s === "2D" && d != null) {
1379
- m.current = f;
1380
- const D = o.geometry, w = D.getAttribute("position"), k = w.array, F = e * 0.15;
1380
+ if (M.current === l) return;
1381
+ const y = M.current;
1382
+ if (M.current = l, !(!r || !o || e <= 0)) {
1383
+ if (l === "2D" && s != null) {
1384
+ m.current = u;
1385
+ const D = o.geometry, w = D.getAttribute("position"), A = w.array, k = e * 0.15;
1381
1386
  let B = 1 / 0, $ = -1 / 0, N = 1 / 0, U = -1 / 0, be = false;
1382
- for (let ue = 0; ue < w.count; ue++) if (Math.abs(k[ue * 3 + 1] - d) < F) {
1383
- const H = k[ue * 3], q = k[ue * 3 + 2];
1387
+ for (let ue = 0; ue < w.count; ue++) if (Math.abs(A[ue * 3 + 1] - s) < k) {
1388
+ const H = A[ue * 3], q = A[ue * 3 + 2];
1384
1389
  H < B && (B = H), H > $ && ($ = H), q < N && (N = q), q > U && (U = q), be = true;
1385
1390
  }
1386
1391
  if (!be) {
@@ -1388,42 +1393,42 @@ let __tla = (async () => {
1388
1393
  const ue = D.boundingBox;
1389
1394
  B = ue.min.x, $ = ue.max.x, N = ue.min.z, U = ue.max.z;
1390
1395
  }
1391
- const ae = (B + $) / 2, fe = (N + U) / 2, ie = l.width / l.height, J = 1.4, Y = ($ - B) * J, pe = (U - N) * J;
1396
+ const ae = (B + $) / 2, fe = (N + U) / 2, ie = d.width / d.height, J = 1.4, Y = ($ - B) * J, pe = (U - N) * J;
1392
1397
  let Z, he;
1393
1398
  Y / pe > ie ? (Z = Y, he = Y / ie) : (he = pe, Z = pe * ie);
1394
1399
  const me = new O.OrthographicCamera(-Z / 2, Z / 2, he / 2, -he / 2, 0.1, e * 10);
1395
- me.position.set(ae, d + e * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, d, fe), h({
1400
+ me.position.set(ae, s + e * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, s, fe), h({
1396
1401
  camera: me
1397
1402
  });
1398
- } else if (b === "2D") if (m.current) h({
1403
+ } else if (y === "2D") if (m.current) h({
1399
1404
  camera: m.current
1400
1405
  }), m.current = null;
1401
1406
  else {
1402
- const D = y();
1407
+ const D = b();
1403
1408
  D && h({
1404
1409
  camera: D
1405
1410
  });
1406
1411
  }
1407
1412
  }
1408
1413
  }, [
1414
+ l,
1409
1415
  s,
1410
- d,
1411
1416
  r,
1412
1417
  o,
1413
1418
  e,
1414
- l,
1419
+ d,
1415
1420
  h,
1416
- f,
1417
- y
1421
+ u,
1422
+ b
1418
1423
  ]), ne(() => {
1419
- if (!r || !f || !f.isOrthographicCamera) return;
1420
- const b = f;
1421
- if (s === "2D") {
1422
- if (!o || d == null) return;
1423
- const D = o.geometry, w = D.getAttribute("position"), k = w.array, F = e * 0.15;
1424
+ if (!r || !u || !u.isOrthographicCamera) return;
1425
+ const y = u;
1426
+ if (l === "2D") {
1427
+ if (!o || s == null) return;
1428
+ const D = o.geometry, w = D.getAttribute("position"), A = w.array, k = e * 0.15;
1424
1429
  let B = 1 / 0, $ = -1 / 0, N = 1 / 0, U = -1 / 0, be = false;
1425
- for (let Z = 0; Z < w.count; Z++) if (Math.abs(k[Z * 3 + 1] - d) < F) {
1426
- const he = k[Z * 3], me = k[Z * 3 + 2];
1430
+ for (let Z = 0; Z < w.count; Z++) if (Math.abs(A[Z * 3 + 1] - s) < k) {
1431
+ const he = A[Z * 3], me = A[Z * 3 + 2];
1427
1432
  he < B && (B = he), he > $ && ($ = he), me < N && (N = me), me > U && (U = me), be = true;
1428
1433
  }
1429
1434
  if (!be) {
@@ -1431,28 +1436,28 @@ let __tla = (async () => {
1431
1436
  const Z = D.boundingBox;
1432
1437
  B = Z.min.x, $ = Z.max.x, N = Z.min.z, U = Z.max.z;
1433
1438
  }
1434
- const ae = l.width / l.height, fe = 1.4, ie = ($ - B) * fe, J = (U - N) * fe;
1439
+ const ae = d.width / d.height, fe = 1.4, ie = ($ - B) * fe, J = (U - N) * fe;
1435
1440
  let Y, pe;
1436
- ie / J > ae ? (Y = ie, pe = ie / ae) : (pe = J, Y = J * ae), b.left = -Y / 2, b.right = Y / 2, b.top = pe / 2, b.bottom = -pe / 2;
1441
+ ie / J > ae ? (Y = ie, pe = ie / ae) : (pe = J, Y = J * ae), y.left = -Y / 2, y.right = Y / 2, y.top = pe / 2, y.bottom = -pe / 2;
1437
1442
  } else {
1438
- const D = u.current, w = l.width / l.height, k = Math.max(D.y, D.x / w) * 1.6, F = k * w;
1439
- b.left = -F / 2, b.right = F / 2, b.top = k / 2, b.bottom = -k / 2;
1443
+ const D = f.current, w = d.width / d.height, A = Math.max(D.y, D.x / w) * 1.6, k = A * w;
1444
+ y.left = -k / 2, y.right = k / 2, y.top = A / 2, y.bottom = -A / 2;
1440
1445
  }
1441
- b.updateProjectionMatrix();
1446
+ y.updateProjectionMatrix();
1442
1447
  }, [
1443
- l.width,
1444
- l.height,
1448
+ d.width,
1449
+ d.height,
1445
1450
  r,
1446
- f,
1447
- s,
1451
+ u,
1452
+ l,
1448
1453
  o
1449
1454
  ]), null;
1450
- }, Fo = ({ mesh: e, isDragging: r }) => {
1455
+ }, Lo = ({ mesh: e, isDragging: r }) => {
1451
1456
  var _a;
1452
1457
  const t = e.geometry;
1453
1458
  t.computeBoundingBox();
1454
- const o = new M();
1455
- return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(ln, {
1459
+ const o = new C();
1460
+ return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(an, {
1456
1461
  enableDamping: false,
1457
1462
  enablePan: false,
1458
1463
  minPolarAngle: Math.PI * 0.15,
@@ -1466,7 +1471,7 @@ let __tla = (async () => {
1466
1471
  o.z
1467
1472
  ]
1468
1473
  });
1469
- }, Lo = ({ wasAutoScaled: e, onDismiss: r }) => P("div", {
1474
+ }, Po = ({ wasAutoScaled: e, onDismiss: r }) => L("div", {
1470
1475
  style: {
1471
1476
  position: "absolute",
1472
1477
  bottom: 16,
@@ -1507,7 +1512,7 @@ let __tla = (async () => {
1507
1512
  children: "X"
1508
1513
  })
1509
1514
  ]
1510
- }), Po = ({ isDoubleShell: e, onDismiss: r }) => P("div", {
1515
+ }), Io = ({ isDoubleShell: e, onDismiss: r }) => L("div", {
1511
1516
  style: {
1512
1517
  position: "absolute",
1513
1518
  bottom: 68,
@@ -1548,7 +1553,7 @@ let __tla = (async () => {
1548
1553
  children: "X"
1549
1554
  })
1550
1555
  ]
1551
- }), Io = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1556
+ }), _o = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1552
1557
  style: {
1553
1558
  backgroundColor: "#fff",
1554
1559
  borderBottom: "1px solid #e0e0e0",
@@ -1557,14 +1562,14 @@ let __tla = (async () => {
1557
1562
  padding: "24px 24px",
1558
1563
  flexShrink: 0
1559
1564
  },
1560
- children: e.map((o, s) => {
1561
- const d = o.number < r, c = o.number === r;
1562
- return P("div", {
1565
+ children: e.map((o, l) => {
1566
+ const s = o.number < r, c = o.number === r;
1567
+ return L("div", {
1563
1568
  style: {
1564
1569
  display: "contents"
1565
1570
  },
1566
1571
  children: [
1567
- P("div", {
1572
+ L("div", {
1568
1573
  style: {
1569
1574
  display: "flex",
1570
1575
  alignItems: "center",
@@ -1579,7 +1584,7 @@ let __tla = (async () => {
1579
1584
  width: 24,
1580
1585
  height: 24,
1581
1586
  borderRadius: "50%",
1582
- backgroundColor: d || c ? t : "rgba(0, 0, 0, 0.38)",
1587
+ backgroundColor: s || c ? t : "rgba(0, 0, 0, 0.38)",
1583
1588
  color: "#fff",
1584
1589
  display: "flex",
1585
1590
  alignItems: "center",
@@ -1588,7 +1593,7 @@ let __tla = (async () => {
1588
1593
  fontFamily: "system-ui, sans-serif",
1589
1594
  flexShrink: 0
1590
1595
  },
1591
- children: d ? "\u2713" : o.number
1596
+ children: s ? "\u2713" : o.number
1592
1597
  }),
1593
1598
  i("div", {
1594
1599
  style: {
@@ -1602,7 +1607,7 @@ let __tla = (async () => {
1602
1607
  })
1603
1608
  ]
1604
1609
  }),
1605
- s < e.length - 1 && i("div", {
1610
+ l < e.length - 1 && i("div", {
1606
1611
  style: {
1607
1612
  flex: "auto",
1608
1613
  borderTop: "1px solid #bdbdbd",
@@ -1612,7 +1617,7 @@ let __tla = (async () => {
1612
1617
  ]
1613
1618
  }, o.number);
1614
1619
  })
1615
- }), _o = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: d = "mm" }) => {
1620
+ }), Do = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1616
1621
  const c = e.geometry, a = j(() => new ft(c, {
1617
1622
  maxLeafTris: ut
1618
1623
  }), [
@@ -1621,19 +1626,19 @@ let __tla = (async () => {
1621
1626
  a,
1622
1627
  c,
1623
1628
  t
1624
- ]), h = j(() => new dt(new M(0, -1, 0), r), [
1629
+ ]), h = j(() => new dt(new C(0, -1, 0), r), [
1625
1630
  r
1626
- ]), { mlLine: l, apLine: f, mlWidth: p, apWidth: g } = j(() => {
1631
+ ]), { mlLine: d, apLine: u, mlWidth: p, apWidth: g } = j(() => {
1627
1632
  let m = null, x = null, S = 0, I = 0;
1628
1633
  if (n.linePoints.length >= 2) {
1629
- let A = n.linePoints[0], L = n.linePoints[0], y = n.linePoints[0], v = n.linePoints[0];
1630
- for (const b of n.linePoints) b.x < A.x && (A = b), b.x > L.x && (L = b), b.z < y.z && (y = b), b.z > v.z && (v = b);
1634
+ let F = n.linePoints[0], P = n.linePoints[0], b = n.linePoints[0], z = n.linePoints[0];
1635
+ for (const y of n.linePoints) y.x < F.x && (F = y), y.x > P.x && (P = y), y.z < b.z && (b = y), y.z > z.z && (z = y);
1631
1636
  m = [
1632
- new M(A.x, t, A.z),
1633
- new M(L.x, t, L.z)
1637
+ new C(F.x, t, F.z),
1638
+ new C(P.x, t, P.z)
1634
1639
  ], x = [
1635
- new M(y.x, t, y.z),
1636
- new M(v.x, t, v.z)
1640
+ new C(b.x, t, b.z),
1641
+ new C(z.x, t, z.z)
1637
1642
  ], S = m[0].distanceTo(m[1]), I = x[0].distanceTo(x[1]);
1638
1643
  }
1639
1644
  return {
@@ -1645,13 +1650,13 @@ let __tla = (async () => {
1645
1650
  }, [
1646
1651
  n,
1647
1652
  t
1648
- ]), z = (m) => d === "inch" ? (m / 25.4).toFixed(2) : m.toFixed(1), u = d === "inch" ? "in" : "mm";
1649
- return P(Te, {
1653
+ ]), M = (m) => s === "inch" ? (m / 25.4).toFixed(2) : m.toFixed(1), f = s === "inch" ? "in" : "mm";
1654
+ return L(Te, {
1650
1655
  children: [
1651
1656
  i("mesh", {
1652
1657
  geometry: e.geometry,
1653
1658
  children: i("meshStandardMaterial", {
1654
- color: s,
1659
+ color: l,
1655
1660
  side: O.DoubleSide,
1656
1661
  transparent: true,
1657
1662
  opacity: 0.15,
@@ -1669,10 +1674,10 @@ let __tla = (async () => {
1669
1674
  depthWrite: false,
1670
1675
  transparent: true
1671
1676
  }),
1672
- l && P(Te, {
1677
+ d && L(Te, {
1673
1678
  children: [
1674
1679
  i(de, {
1675
- points: l,
1680
+ points: d,
1676
1681
  color: "#ff8800",
1677
1682
  lineWidth: 2,
1678
1683
  depthTest: false,
@@ -1681,9 +1686,9 @@ let __tla = (async () => {
1681
1686
  }),
1682
1687
  i(Ye, {
1683
1688
  position: [
1684
- l[0].x,
1689
+ d[0].x,
1685
1690
  t,
1686
- l[0].z - o * 0.02
1691
+ d[0].z - o * 0.02
1687
1692
  ],
1688
1693
  center: true,
1689
1694
  style: {
@@ -1696,7 +1701,7 @@ let __tla = (async () => {
1696
1701
  backgroundColor: "rgba(0,0,0,0.75)",
1697
1702
  borderRadius: 3
1698
1703
  },
1699
- children: P("span", {
1704
+ children: L("span", {
1700
1705
  style: {
1701
1706
  fontSize: 12,
1702
1707
  color: "#ff8800",
@@ -1704,19 +1709,19 @@ let __tla = (async () => {
1704
1709
  },
1705
1710
  children: [
1706
1711
  "ML ",
1707
- z(p),
1712
+ M(p),
1708
1713
  " ",
1709
- u
1714
+ f
1710
1715
  ]
1711
1716
  })
1712
1717
  })
1713
1718
  })
1714
1719
  ]
1715
1720
  }),
1716
- f && P(Te, {
1721
+ u && L(Te, {
1717
1722
  children: [
1718
1723
  i(de, {
1719
- points: f,
1724
+ points: u,
1720
1725
  color: "#ff00ff",
1721
1726
  lineWidth: 2,
1722
1727
  depthTest: false,
@@ -1725,9 +1730,9 @@ let __tla = (async () => {
1725
1730
  }),
1726
1731
  i(Ye, {
1727
1732
  position: [
1728
- Math.max(f[0].x, f[1].x) + o * 0.02,
1733
+ Math.max(u[0].x, u[1].x) + o * 0.02,
1729
1734
  t,
1730
- f[0].z > f[1].z ? f[0].z : f[1].z
1735
+ u[0].z > u[1].z ? u[0].z : u[1].z
1731
1736
  ],
1732
1737
  center: true,
1733
1738
  style: {
@@ -1740,7 +1745,7 @@ let __tla = (async () => {
1740
1745
  backgroundColor: "rgba(0,0,0,0.75)",
1741
1746
  borderRadius: 3
1742
1747
  },
1743
- children: P("span", {
1748
+ children: L("span", {
1744
1749
  style: {
1745
1750
  fontSize: 12,
1746
1751
  color: "#ff00ff",
@@ -1748,9 +1753,9 @@ let __tla = (async () => {
1748
1753
  },
1749
1754
  children: [
1750
1755
  "AP ",
1751
- z(g),
1756
+ M(g),
1752
1757
  " ",
1753
- u
1758
+ f
1754
1759
  ]
1755
1760
  })
1756
1761
  })
@@ -1759,73 +1764,73 @@ let __tla = (async () => {
1759
1764
  })
1760
1765
  ]
1761
1766
  });
1762
- }, Do = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: s, modelSize: d, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: l, onDragEnd: f }) => {
1763
- const [p, g] = W(false), [z, u] = W(false), { camera: m, gl: x } = sn(), S = le(0), I = e.geometry, A = mn(I), L = j(() => A ? Ne(A, I, r) : {
1767
+ }, Bo = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
1768
+ const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = ln(), S = le(0), I = e.geometry, F = xn(I), P = j(() => F ? Ne(F, I, r) : {
1764
1769
  linePoints: [],
1765
1770
  lineLength: 0,
1766
- rightmostPoint: new M()
1771
+ rightmostPoint: new C()
1767
1772
  }, [
1768
- A,
1773
+ F,
1769
1774
  I,
1770
1775
  r
1771
- ]), y = re((k, F) => {
1772
- const B = x.domElement.getBoundingClientRect(), $ = (k - B.left) / B.width * 2 - 1, N = -((F - B.top) / B.height) * 2 + 1, U = new Un();
1776
+ ]), b = re((A, k) => {
1777
+ const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new Jn();
1773
1778
  U.setFromCamera(new O.Vector2($, N), m);
1774
- const be = new dt(new M(0, 0, 1), 0), ae = new M();
1779
+ const be = new dt(new C(0, 0, 1), 0), ae = new C();
1775
1780
  return U.ray.intersectPlane(be, ae), ae ? ae.y : r;
1776
1781
  }, [
1777
1782
  m,
1778
1783
  x,
1779
1784
  r
1780
- ]), v = re((k) => {
1781
- k.stopPropagation(), g(true), x.domElement.style.cursor = "ns-resize", S.current = r - y(k.clientX, k.clientY), k.target.setPointerCapture(k.pointerId), l == null ? void 0 : l();
1785
+ ]), z = re((A) => {
1786
+ A.stopPropagation(), g(true), x.domElement.style.cursor = "ns-resize", S.current = r - b(A.clientX, A.clientY), A.target.setPointerCapture(A.pointerId), d == null ? void 0 : d();
1782
1787
  }, [
1783
1788
  r,
1784
1789
  x,
1785
- y,
1786
- l
1787
- ]), b = re((k) => {
1790
+ b,
1791
+ d
1792
+ ]), y = re((A) => {
1788
1793
  if (!p) return;
1789
- let F = y(k.clientX, k.clientY) + S.current;
1790
- F = Math.max(o, Math.min(s, F)), t(F);
1794
+ let k = b(A.clientX, A.clientY) + S.current;
1795
+ k = Math.max(o, Math.min(l, k)), t(k);
1791
1796
  }, [
1792
1797
  p,
1793
- y,
1798
+ b,
1794
1799
  t,
1795
1800
  o,
1796
- s
1797
- ]), D = re((k) => {
1798
- g(false), x.domElement.style.cursor = "auto", k.target.releasePointerCapture(k.pointerId), f == null ? void 0 : f();
1801
+ l
1802
+ ]), D = re((A) => {
1803
+ g(false), x.domElement.style.cursor = "auto", A.target.releasePointerCapture(A.pointerId), u == null ? void 0 : u();
1799
1804
  }, [
1800
1805
  x,
1801
- f
1806
+ u
1802
1807
  ]);
1803
- if (L.linePoints.length < 2) return null;
1804
- const w = p ? n : z ? a : c;
1805
- return P("group", {
1808
+ if (P.linePoints.length < 2) return null;
1809
+ const w = p ? n : M ? a : c;
1810
+ return L("group", {
1806
1811
  renderOrder: 10,
1807
1812
  children: [
1808
1813
  i(de, {
1809
- points: L.linePoints,
1814
+ points: P.linePoints,
1810
1815
  color: w,
1811
- lineWidth: p ? 6 : z ? 5 : 4,
1816
+ lineWidth: p ? 6 : M ? 5 : 4,
1812
1817
  depthTest: false,
1813
1818
  depthWrite: false,
1814
1819
  transparent: true,
1815
1820
  renderOrder: 10,
1816
- onPointerDown: v,
1817
- onPointerMove: b,
1821
+ onPointerDown: z,
1822
+ onPointerMove: y,
1818
1823
  onPointerUp: D,
1819
1824
  onPointerEnter: () => {
1820
- u(true), x.domElement.style.cursor = "ns-resize";
1825
+ f(true), x.domElement.style.cursor = "ns-resize";
1821
1826
  },
1822
1827
  onPointerLeave: () => {
1823
- p || (u(false), x.domElement.style.cursor = "auto");
1828
+ p || (f(false), x.domElement.style.cursor = "auto");
1824
1829
  }
1825
1830
  }),
1826
- (z || p) && i("mesh", {
1831
+ (M || p) && i("mesh", {
1827
1832
  position: [
1828
- L.rightmostPoint.x + d * 0.15,
1833
+ P.rightmostPoint.x + s * 0.15,
1829
1834
  r,
1830
1835
  0
1831
1836
  ],
@@ -1848,32 +1853,32 @@ let __tla = (async () => {
1848
1853
  ]
1849
1854
  });
1850
1855
  };
1851
- function Bo(e, r) {
1856
+ function Ro(e, r) {
1852
1857
  if (e == null) return {};
1853
- var t = {}, o = Object.keys(e), s, d;
1854
- for (d = 0; d < o.length; d++) s = o[d], !(r.indexOf(s) >= 0) && (t[s] = e[s]);
1858
+ var t = {}, o = Object.keys(e), l, s;
1859
+ for (s = 0; s < o.length; s++) l = o[s], !(r.indexOf(l) >= 0) && (t[l] = e[l]);
1855
1860
  return t;
1856
1861
  }
1857
- var Ro = [
1862
+ var Wo = [
1858
1863
  "color"
1859
- ], Wo = Zn(function(e, r) {
1860
- var t = e.color, o = t === void 0 ? "currentColor" : t, s = Bo(e, Ro);
1861
- return Jt("svg", Object.assign({
1864
+ ], Eo = Kn(function(e, r) {
1865
+ var t = e.color, o = t === void 0 ? "currentColor" : t, l = Ro(e, Wo);
1866
+ return Qt("svg", Object.assign({
1862
1867
  width: "15",
1863
1868
  height: "15",
1864
1869
  viewBox: "0 0 15 15",
1865
1870
  fill: "none",
1866
1871
  xmlns: "http://www.w3.org/2000/svg"
1867
- }, s, {
1872
+ }, l, {
1868
1873
  ref: r
1869
- }), Jt("path", {
1874
+ }), Qt("path", {
1870
1875
  d: "M7.5 2C7.77614 2 8 2.22386 8 2.5L8 11.2929L11.1464 8.14645C11.3417 7.95118 11.6583 7.95118 11.8536 8.14645C12.0488 8.34171 12.0488 8.65829 11.8536 8.85355L7.85355 12.8536C7.75979 12.9473 7.63261 13 7.5 13C7.36739 13 7.24021 12.9473 7.14645 12.8536L3.14645 8.85355C2.95118 8.65829 2.95118 8.34171 3.14645 8.14645C3.34171 7.95118 3.65829 7.95118 3.85355 8.14645L7 11.2929L7 2.5C7 2.22386 7.22386 2 7.5 2Z",
1871
1876
  fill: o,
1872
1877
  fillRule: "evenodd",
1873
1878
  clipRule: "evenodd"
1874
1879
  }));
1875
1880
  });
1876
- const Eo = [
1881
+ const To = [
1877
1882
  "Scan doesn't load properly",
1878
1883
  "Takes too long",
1879
1884
  "I don't want to",
@@ -1897,62 +1902,62 @@ let __tla = (async () => {
1897
1902
  outline: "none",
1898
1903
  boxSizing: "border-box",
1899
1904
  fontFamily: "system-ui, sans-serif"
1900
- }, To = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: s, onSkip: d }) => {
1905
+ }, Oo = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s }) => {
1901
1906
  const c = e === "AK" ? "IT" : "MPT", a = r, n = e === "AK" ? 18 : 9, h = j(() => {
1902
1907
  const w = [];
1903
- for (let k = 2; k >= 1; k -= a) w.push(`${k}\u2033 above ${c}`);
1908
+ for (let A = 2; A >= 1; A -= a) w.push(`${A}\u2033 above ${c}`);
1904
1909
  w.push(`At ${c}`);
1905
- for (let k = a; k <= n; k += a) w.push(`${k}\u2033 below ${c}`);
1910
+ for (let A = a; A <= n; A += a) w.push(`${A}\u2033 below ${c}`);
1906
1911
  return w;
1907
1912
  }, [
1908
1913
  a,
1909
1914
  c,
1910
1915
  n
1911
- ]), [l, f] = W({}), [p, g] = W(""), [z, u] = W(false), [m, x] = W(false), [S, I] = W(null), [A, L] = W(""), y = j(() => {
1912
- const w = p !== "" && !isNaN(parseFloat(p)), k = h.some((F) => {
1913
- const B = l[F];
1916
+ ]), [d, u] = E({}), [p, g] = E(""), [M, f] = E(false), [m, x] = E(false), [S, I] = E(null), [F, P] = E(""), b = j(() => {
1917
+ const w = p !== "" && !isNaN(parseFloat(p)), A = h.some((k) => {
1918
+ const B = d[k];
1914
1919
  return B != null && B !== "" && !isNaN(parseFloat(B));
1915
1920
  });
1916
- return w || k;
1921
+ return w || A;
1917
1922
  }, [
1918
- l,
1923
+ d,
1919
1924
  p,
1920
1925
  h
1921
- ]), v = re(() => {
1922
- if (!y) return;
1923
- const w = h.map((F) => {
1924
- const B = l[F];
1926
+ ]), z = re(() => {
1927
+ if (!b) return;
1928
+ const w = h.map((k) => {
1929
+ const B = d[k];
1925
1930
  return B != null && B !== "" && !isNaN(parseFloat(B)) ? parseFloat(B) : 0;
1926
- }), k = p !== "" && !isNaN(parseFloat(p)) ? parseFloat(p) : 0;
1927
- s({
1931
+ }), A = p !== "" && !isNaN(parseFloat(p)) ? parseFloat(p) : 0;
1932
+ l({
1928
1933
  circumferences: w,
1929
- frontalHeight: k
1934
+ frontalHeight: A
1930
1935
  });
1931
1936
  }, [
1932
- y,
1937
+ b,
1933
1938
  h,
1934
- l,
1939
+ d,
1935
1940
  p,
1936
- s
1937
- ]), b = re(() => {
1941
+ l
1942
+ ]), y = re(() => {
1938
1943
  const w = {};
1939
- h.forEach((k, F) => {
1940
- const B = t[F];
1944
+ h.forEach((A, k) => {
1945
+ const B = t[k];
1941
1946
  if (B) {
1942
1947
  const $ = B.modifiedValue ?? B.originalValue;
1943
- w[k] = $.toFixed(1);
1948
+ w[A] = $.toFixed(1);
1944
1949
  }
1945
- }), f(w), o > 0 && g(o.toFixed(1));
1950
+ }), u(w), o > 0 && g(o.toFixed(1));
1946
1951
  }, [
1947
1952
  h,
1948
1953
  t,
1949
1954
  o
1950
1955
  ]), D = re(() => {
1951
- u(false), x(true);
1956
+ f(false), x(true);
1952
1957
  }, []);
1953
1958
  if (m) {
1954
- const w = S != null && (S !== "Other" || A.trim() !== ""), k = () => {
1955
- w && d(S === "Other" ? `Other: ${A.trim()}` : S);
1959
+ const w = S != null && (S !== "Other" || F.trim() !== ""), A = () => {
1960
+ w && s(S === "Other" ? `Other: ${F.trim()}` : S);
1956
1961
  };
1957
1962
  return i("div", {
1958
1963
  style: {
@@ -1967,7 +1972,7 @@ let __tla = (async () => {
1967
1972
  zIndex: 9999,
1968
1973
  fontFamily: "system-ui, sans-serif"
1969
1974
  },
1970
- children: P("div", {
1975
+ children: L("div", {
1971
1976
  style: {
1972
1977
  backgroundColor: "#fff",
1973
1978
  borderRadius: 12,
@@ -1975,7 +1980,7 @@ let __tla = (async () => {
1975
1980
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
1976
1981
  },
1977
1982
  children: [
1978
- P("div", {
1983
+ L("div", {
1979
1984
  style: {
1980
1985
  padding: "24px 24px 0"
1981
1986
  },
@@ -1998,7 +2003,7 @@ let __tla = (async () => {
1998
2003
  })
1999
2004
  ]
2000
2005
  }),
2001
- P("div", {
2006
+ L("div", {
2002
2007
  style: {
2003
2008
  padding: "20px 24px",
2004
2009
  display: "flex",
@@ -2007,9 +2012,9 @@ let __tla = (async () => {
2007
2012
  },
2008
2013
  children: [
2009
2014
  [
2010
- ...Eo,
2015
+ ...To,
2011
2016
  "Other"
2012
- ].map((F) => P("label", {
2017
+ ].map((k) => L("label", {
2013
2018
  style: {
2014
2019
  display: "flex",
2015
2020
  alignItems: "center",
@@ -2017,15 +2022,15 @@ let __tla = (async () => {
2017
2022
  padding: "10px 12px",
2018
2023
  borderRadius: 6,
2019
2024
  cursor: "pointer",
2020
- backgroundColor: S === F ? "rgba(12, 67, 173, 0.06)" : "transparent"
2025
+ backgroundColor: S === k ? "rgba(12, 67, 173, 0.06)" : "transparent"
2021
2026
  },
2022
2027
  children: [
2023
2028
  i("input", {
2024
2029
  type: "radio",
2025
2030
  name: "skip-reason",
2026
- checked: S === F,
2031
+ checked: S === k,
2027
2032
  onChange: () => {
2028
- I(F), F !== "Other" && L("");
2033
+ I(k), k !== "Other" && P("");
2029
2034
  },
2030
2035
  style: {
2031
2036
  accentColor: "rgb(12, 67, 173)",
@@ -2040,18 +2045,18 @@ let __tla = (async () => {
2040
2045
  fontSize: 14,
2041
2046
  color: "#333"
2042
2047
  },
2043
- children: F
2048
+ children: k
2044
2049
  })
2045
2050
  ]
2046
- }, F)),
2051
+ }, k)),
2047
2052
  S === "Other" && i("input", {
2048
2053
  autoFocus: true,
2049
2054
  type: "text",
2050
2055
  placeholder: "Please describe...",
2051
- value: A,
2052
- onChange: (F) => L(F.target.value),
2053
- onKeyDown: (F) => {
2054
- F.key === "Enter" && k();
2056
+ value: F,
2057
+ onChange: (k) => P(k.target.value),
2058
+ onKeyDown: (k) => {
2059
+ k.key === "Enter" && A();
2055
2060
  },
2056
2061
  style: {
2057
2062
  ...Lt,
@@ -2063,7 +2068,7 @@ let __tla = (async () => {
2063
2068
  })
2064
2069
  ]
2065
2070
  }),
2066
- P("div", {
2071
+ L("div", {
2067
2072
  style: {
2068
2073
  display: "flex",
2069
2074
  justifyContent: "flex-end",
@@ -2074,7 +2079,7 @@ let __tla = (async () => {
2074
2079
  children: [
2075
2080
  i("button", {
2076
2081
  onClick: () => {
2077
- x(false), I(null), L("");
2082
+ x(false), I(null), P("");
2078
2083
  },
2079
2084
  style: {
2080
2085
  ...je,
@@ -2085,7 +2090,7 @@ let __tla = (async () => {
2085
2090
  children: "Cancel"
2086
2091
  }),
2087
2092
  i("button", {
2088
- onClick: k,
2093
+ onClick: A,
2089
2094
  disabled: !w,
2090
2095
  style: {
2091
2096
  ...je,
@@ -2102,7 +2107,7 @@ let __tla = (async () => {
2102
2107
  })
2103
2108
  });
2104
2109
  }
2105
- return z ? i("div", {
2110
+ return M ? i("div", {
2106
2111
  style: {
2107
2112
  position: "fixed",
2108
2113
  inset: 0,
@@ -2115,7 +2120,7 @@ let __tla = (async () => {
2115
2120
  zIndex: 9999,
2116
2121
  fontFamily: "system-ui, sans-serif"
2117
2122
  },
2118
- children: P("div", {
2123
+ children: L("div", {
2119
2124
  style: {
2120
2125
  backgroundColor: "#fff",
2121
2126
  borderRadius: 8,
@@ -2141,7 +2146,7 @@ let __tla = (async () => {
2141
2146
  },
2142
2147
  children: "Your measurements will be submitted without comparing to the scan. Are you sure?"
2143
2148
  }),
2144
- P("div", {
2149
+ L("div", {
2145
2150
  style: {
2146
2151
  display: "flex",
2147
2152
  justifyContent: "flex-end",
@@ -2149,7 +2154,7 @@ let __tla = (async () => {
2149
2154
  },
2150
2155
  children: [
2151
2156
  i("button", {
2152
- onClick: () => u(false),
2157
+ onClick: () => f(false),
2153
2158
  style: {
2154
2159
  ...je,
2155
2160
  backgroundColor: "#fff",
@@ -2172,7 +2177,7 @@ let __tla = (async () => {
2172
2177
  })
2173
2178
  ]
2174
2179
  })
2175
- }) : P("div", {
2180
+ }) : L("div", {
2176
2181
  style: {
2177
2182
  position: "fixed",
2178
2183
  inset: 0,
@@ -2190,7 +2195,7 @@ let __tla = (async () => {
2190
2195
  borderBottom: "1px solid #e0e0e0",
2191
2196
  flexShrink: 0
2192
2197
  },
2193
- children: P("div", {
2198
+ children: L("div", {
2194
2199
  style: {
2195
2200
  display: "flex",
2196
2201
  alignItems: "center",
@@ -2199,9 +2204,9 @@ let __tla = (async () => {
2199
2204
  gap: 12
2200
2205
  },
2201
2206
  children: [
2202
- P("div", {
2207
+ L("div", {
2203
2208
  children: [
2204
- P("div", {
2209
+ L("div", {
2205
2210
  style: {
2206
2211
  fontSize: 22,
2207
2212
  fontWeight: 600,
@@ -2212,7 +2217,7 @@ let __tla = (async () => {
2212
2217
  " Measurements"
2213
2218
  ]
2214
2219
  }),
2215
- P("div", {
2220
+ L("div", {
2216
2221
  style: {
2217
2222
  fontSize: 13,
2218
2223
  color: "rgba(0,0,0,0.54)",
@@ -2228,7 +2233,7 @@ let __tla = (async () => {
2228
2233
  ]
2229
2234
  }),
2230
2235
  i("button", {
2231
- onClick: b,
2236
+ onClick: y,
2232
2237
  style: {
2233
2238
  ...je,
2234
2239
  backgroundColor: "#fff",
@@ -2238,7 +2243,7 @@ let __tla = (async () => {
2238
2243
  padding: "6px 16px",
2239
2244
  fontSize: 13
2240
2245
  },
2241
- children: P("span", {
2246
+ children: L("span", {
2242
2247
  style: {
2243
2248
  marginRight: 8,
2244
2249
  display: "flex",
@@ -2246,7 +2251,7 @@ let __tla = (async () => {
2246
2251
  gap: 4
2247
2252
  },
2248
2253
  children: [
2249
- i(Wo, {
2254
+ i(Eo, {
2250
2255
  style: {
2251
2256
  width: 16,
2252
2257
  height: 16
@@ -2259,7 +2264,7 @@ let __tla = (async () => {
2259
2264
  ]
2260
2265
  })
2261
2266
  }),
2262
- P("div", {
2267
+ L("div", {
2263
2268
  style: {
2264
2269
  flex: 1,
2265
2270
  minHeight: 0,
@@ -2284,9 +2289,9 @@ let __tla = (async () => {
2284
2289
  gap: "12px 20px",
2285
2290
  marginBottom: 28
2286
2291
  },
2287
- children: h.map((w, k) => P("div", {
2292
+ children: h.map((w, A) => L("div", {
2288
2293
  children: [
2289
- P("label", {
2294
+ L("label", {
2290
2295
  style: {
2291
2296
  display: "block",
2292
2297
  fontSize: 12,
@@ -2308,21 +2313,21 @@ let __tla = (async () => {
2308
2313
  i("input", {
2309
2314
  type: "number",
2310
2315
  step: "0.1",
2311
- value: l[w] ?? "",
2312
- onChange: (F) => f((B) => ({
2316
+ value: d[w] ?? "",
2317
+ onChange: (k) => u((B) => ({
2313
2318
  ...B,
2314
- [w]: F.target.value
2319
+ [w]: k.target.value
2315
2320
  })),
2316
2321
  style: {
2317
2322
  ...Lt,
2318
2323
  padding: "8px 10px",
2319
2324
  fontSize: 14,
2320
- borderColor: l[w] ? "rgb(12, 67, 173)" : "#ccc"
2325
+ borderColor: d[w] ? "rgb(12, 67, 173)" : "#ccc"
2321
2326
  },
2322
2327
  placeholder: "0.0"
2323
2328
  })
2324
2329
  ]
2325
- }, k))
2330
+ }, A))
2326
2331
  }),
2327
2332
  i("div", {
2328
2333
  style: {
@@ -2339,9 +2344,9 @@ let __tla = (async () => {
2339
2344
  gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
2340
2345
  gap: "12px 20px"
2341
2346
  },
2342
- children: P("div", {
2347
+ children: L("div", {
2343
2348
  children: [
2344
- P("label", {
2349
+ L("label", {
2345
2350
  style: {
2346
2351
  display: "block",
2347
2352
  fontSize: 12,
@@ -2377,7 +2382,7 @@ let __tla = (async () => {
2377
2382
  })
2378
2383
  ]
2379
2384
  }),
2380
- P("div", {
2385
+ L("div", {
2381
2386
  style: {
2382
2387
  padding: "12px 24px",
2383
2388
  backgroundColor: "#fff",
@@ -2391,7 +2396,7 @@ let __tla = (async () => {
2391
2396
  },
2392
2397
  children: [
2393
2398
  i("button", {
2394
- onClick: () => u(true),
2399
+ onClick: () => f(true),
2395
2400
  style: {
2396
2401
  ...je,
2397
2402
  backgroundColor: "#fff",
@@ -2403,14 +2408,14 @@ let __tla = (async () => {
2403
2408
  children: "Have Galileo Check My Measurements"
2404
2409
  }),
2405
2410
  i("button", {
2406
- onClick: v,
2407
- disabled: !y,
2411
+ onClick: z,
2412
+ disabled: !b,
2408
2413
  style: {
2409
2414
  ...je,
2410
- backgroundColor: y ? "rgb(12, 67, 173)" : "#e0e0e0",
2415
+ backgroundColor: b ? "rgb(12, 67, 173)" : "#e0e0e0",
2411
2416
  border: "none",
2412
- color: y ? "#fff" : "#9e9e9e",
2413
- cursor: y ? "pointer" : "not-allowed",
2417
+ color: b ? "#fff" : "#9e9e9e",
2418
+ cursor: b ? "pointer" : "not-allowed",
2414
2419
  padding: "6px 16px",
2415
2420
  fontSize: 13
2416
2421
  },
@@ -2421,37 +2426,37 @@ let __tla = (async () => {
2421
2426
  ]
2422
2427
  });
2423
2428
  };
2424
- function xn(e, r, t) {
2425
- const o = e.getAttribute("position"), s = t - r;
2426
- if (s < 1) return null;
2427
- const d = 30, c = s / d, a = [];
2428
- for (let m = 0; m < d; m++) {
2429
+ function yn(e, r, t) {
2430
+ const o = e.getAttribute("position"), l = t - r;
2431
+ if (l < 1) return null;
2432
+ const s = 30, c = l / s, a = [];
2433
+ for (let m = 0; m < s; m++) {
2429
2434
  const x = r + m * c, S = r + (m + 1) * c;
2430
- let I = 0, A = 0, L = 0, y = 0;
2431
- for (let v = 0; v < o.count; v++) {
2432
- const b = o.getY(v);
2433
- b >= x && b < S && (I += o.getX(v), A += b, L += o.getZ(v), y++);
2435
+ let I = 0, F = 0, P = 0, b = 0;
2436
+ for (let z = 0; z < o.count; z++) {
2437
+ const y = o.getY(z);
2438
+ y >= x && y < S && (I += o.getX(z), F += y, P += o.getZ(z), b++);
2434
2439
  }
2435
- y > 20 && a.push(new M(I / y, A / y, L / y));
2440
+ b > 20 && a.push(new C(I / b, F / b, P / b));
2436
2441
  }
2437
2442
  if (a.length < 5) return null;
2438
- const n = new M();
2443
+ const n = new C();
2439
2444
  for (const m of a) n.add(m);
2440
2445
  n.divideScalar(a.length);
2441
- let h = 0, l = 0, f = 0, p = 0, g = 0, z = 0;
2446
+ let h = 0, d = 0, u = 0, p = 0, g = 0, M = 0;
2442
2447
  for (const m of a) {
2443
2448
  const x = m.x - n.x, S = m.y - n.y, I = m.z - n.z;
2444
- h += x * x, l += x * S, f += x * I, p += S * S, g += S * I, z += I * I;
2449
+ h += x * x, d += x * S, u += x * I, p += S * S, g += S * I, M += I * I;
2445
2450
  }
2446
- let u = new M(0.01, 1, 0.01).normalize();
2451
+ let f = new C(0.01, 1, 0.01).normalize();
2447
2452
  for (let m = 0; m < 30; m++) {
2448
- const x = h * u.x + l * u.y + f * u.z, S = l * u.x + p * u.y + g * u.z, I = f * u.x + g * u.y + z * u.z, A = new M(x, S, I), L = A.length();
2449
- if (L < 1e-10 || (A.divideScalar(L), u.distanceTo(A) < 1e-8)) break;
2450
- u = A;
2453
+ const x = h * f.x + d * f.y + u * f.z, S = d * f.x + p * f.y + g * f.z, I = u * f.x + g * f.y + M * f.z, F = new C(x, S, I), P = F.length();
2454
+ if (P < 1e-10 || (F.divideScalar(P), f.distanceTo(F) < 1e-8)) break;
2455
+ f = F;
2451
2456
  }
2452
- return u.y < 0 && u.negate(), u;
2457
+ return f.y < 0 && f.negate(), f;
2453
2458
  }
2454
- const Oo = {
2459
+ const $o = {
2455
2460
  pcaAxes: true,
2456
2461
  obb: true,
2457
2462
  obbAxis: true,
@@ -2461,29 +2466,29 @@ let __tla = (async () => {
2461
2466
  landmarkAxis: true,
2462
2467
  iterativePCA: false,
2463
2468
  fullRegionPCA: true
2464
- }, $o = [
2469
+ }, Ho = [
2465
2470
  "#ff4444",
2466
2471
  "#44cc44",
2467
2472
  "#4488ff"
2468
2473
  ];
2469
- function yn(e) {
2470
- const r = e.getAttribute("position"), t = r.count, o = new M();
2471
- for (let u = 0; u < t; u++) o.x += r.getX(u), o.y += r.getY(u), o.z += r.getZ(u);
2474
+ function bn(e) {
2475
+ const r = e.getAttribute("position"), t = r.count, o = new C();
2476
+ for (let f = 0; f < t; f++) o.x += r.getX(f), o.y += r.getY(f), o.z += r.getZ(f);
2472
2477
  o.divideScalar(t);
2473
- let s = 0, d = 0, c = 0, a = 0, n = 0, h = 0;
2474
- for (let u = 0; u < t; u++) {
2475
- const m = r.getX(u) - o.x, x = r.getY(u) - o.y, S = r.getZ(u) - o.z;
2476
- s += m * m, d += m * x, c += m * S, a += x * x, n += x * S, h += S * S;
2478
+ let l = 0, s = 0, c = 0, a = 0, n = 0, h = 0;
2479
+ for (let f = 0; f < t; f++) {
2480
+ const m = r.getX(f) - o.x, x = r.getY(f) - o.y, S = r.getZ(f) - o.z;
2481
+ l += m * m, s += m * x, c += m * S, a += x * x, n += x * S, h += S * S;
2477
2482
  }
2478
- s /= t, d /= t, c /= t, a /= t, n /= t, h /= t;
2479
- const l = [], f = [], p = [
2483
+ l /= t, s /= t, c /= t, a /= t, n /= t, h /= t;
2484
+ const d = [], u = [], p = [
2480
2485
  [
2486
+ l,
2481
2487
  s,
2482
- d,
2483
2488
  c
2484
2489
  ],
2485
2490
  [
2486
- d,
2491
+ s,
2487
2492
  a,
2488
2493
  n
2489
2494
  ],
@@ -2493,74 +2498,74 @@ let __tla = (async () => {
2493
2498
  h
2494
2499
  ]
2495
2500
  ];
2496
- for (let u = 0; u < 3; u++) {
2497
- let m = new M(1 + u * 0.1, 1 - u * 0.1, 0.5 + u * 0.3).normalize(), x = 0;
2501
+ for (let f = 0; f < 3; f++) {
2502
+ let m = new C(1 + f * 0.1, 1 - f * 0.1, 0.5 + f * 0.3).normalize(), x = 0;
2498
2503
  for (let S = 0; S < 100; S++) {
2499
- const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, A = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, L = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, y = new M(I, A, L);
2500
- if (x = y.length(), x < 1e-12) break;
2501
- if (y.divideScalar(x), m.distanceTo(y) < 1e-10) {
2502
- m = y;
2504
+ const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, F = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, P = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, b = new C(I, F, P);
2505
+ if (x = b.length(), x < 1e-12) break;
2506
+ if (b.divideScalar(x), m.distanceTo(b) < 1e-10) {
2507
+ m = b;
2503
2508
  break;
2504
2509
  }
2505
- m = y;
2510
+ m = b;
2506
2511
  }
2507
- l.push(m.clone()), f.push(x);
2512
+ d.push(m.clone()), u.push(x);
2508
2513
  for (let S = 0; S < 3; S++) for (let I = 0; I < 3; I++) {
2509
- const A = [
2514
+ const F = [
2510
2515
  m.x,
2511
2516
  m.y,
2512
2517
  m.z
2513
- ][S], L = [
2518
+ ][S], P = [
2514
2519
  m.x,
2515
2520
  m.y,
2516
2521
  m.z
2517
2522
  ][I];
2518
- p[S][I] -= x * A * L;
2523
+ p[S][I] -= x * F * P;
2519
2524
  }
2520
2525
  }
2521
- const g = new M();
2522
- for (let u = 0; u < t; u++) g.x += r.getX(u), g.y += r.getY(u), g.z += r.getZ(u);
2526
+ const g = new C();
2527
+ for (let f = 0; f < t; f++) g.x += r.getX(f), g.y += r.getY(f), g.z += r.getZ(f);
2523
2528
  g.divideScalar(t);
2524
- const z = [
2529
+ const M = [
2525
2530
  0,
2526
2531
  0,
2527
2532
  0
2528
2533
  ];
2529
- for (let u = 0; u < 3; u++) {
2534
+ for (let f = 0; f < 3; f++) {
2530
2535
  let m = 1 / 0, x = -1 / 0;
2531
- const S = l[u];
2536
+ const S = d[f];
2532
2537
  for (let I = 0; I < t; I++) {
2533
- const A = r.getX(I) - g.x, L = r.getY(I) - g.y, y = r.getZ(I) - g.z, v = A * S.x + L * S.y + y * S.z;
2534
- v < m && (m = v), v > x && (x = v);
2538
+ const F = r.getX(I) - g.x, P = r.getY(I) - g.y, b = r.getZ(I) - g.z, z = F * S.x + P * S.y + b * S.z;
2539
+ z < m && (m = z), z > x && (x = z);
2535
2540
  }
2536
- z[u] = (x - m) / 2;
2541
+ M[f] = (x - m) / 2;
2537
2542
  }
2538
2543
  return {
2539
- axes: l,
2540
- eigenvalues: f,
2544
+ axes: d,
2545
+ eigenvalues: u,
2541
2546
  center: g,
2542
- halfExtents: z
2547
+ halfExtents: M
2543
2548
  };
2544
2549
  }
2545
- function Ho({ pca: e }) {
2550
+ function Vo({ pca: e }) {
2546
2551
  return i("group", {
2547
2552
  children: e.axes.map((r, t) => {
2548
- const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), s = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
2553
+ const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), l = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
2549
2554
  return i(de, {
2550
2555
  points: [
2551
- s,
2556
+ l,
2552
2557
  o
2553
2558
  ],
2554
- color: $o[t],
2559
+ color: Ho[t],
2555
2560
  lineWidth: 2
2556
2561
  }, t);
2557
2562
  })
2558
2563
  });
2559
2564
  }
2560
- function Vo({ pca: e }) {
2565
+ function jo({ pca: e }) {
2561
2566
  const r = j(() => {
2562
- const { center: t, axes: o, halfExtents: s } = e, d = [];
2563
- for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let h = -1; h <= 1; h += 2) d.push(t.clone().addScaledVector(o[0], a * s[0]).addScaledVector(o[1], n * s[1]).addScaledVector(o[2], h * s[2]));
2567
+ const { center: t, axes: o, halfExtents: l } = e, s = [];
2568
+ for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let h = -1; h <= 1; h += 2) s.push(t.clone().addScaledVector(o[0], a * l[0]).addScaledVector(o[1], n * l[1]).addScaledVector(o[2], h * l[2]));
2564
2569
  return [
2565
2570
  [
2566
2571
  0,
@@ -2611,8 +2616,8 @@ let __tla = (async () => {
2611
2616
  7
2612
2617
  ]
2613
2618
  ].map(([a, n]) => [
2614
- d[a],
2615
- d[n]
2619
+ s[a],
2620
+ s[n]
2616
2621
  ]);
2617
2622
  }, [
2618
2623
  e
@@ -2627,27 +2632,27 @@ let __tla = (async () => {
2627
2632
  }, o))
2628
2633
  });
2629
2634
  }
2630
- function jo({ redPoint: e, greenPoint: r }) {
2631
- const t = j(() => new M().subVectors(r, e).normalize(), [
2635
+ function No({ redPoint: e, greenPoint: r }) {
2636
+ const t = j(() => new C().subVectors(r, e).normalize(), [
2632
2637
  e,
2633
2638
  r
2634
2639
  ]), o = j(() => {
2635
- const d = t.dot(new M(0, 1, 0));
2636
- return Math.acos(Math.min(1, Math.abs(d))) * 180 / Math.PI;
2640
+ const s = t.dot(new C(0, 1, 0));
2641
+ return Math.acos(Math.min(1, Math.abs(s))) * 180 / Math.PI;
2637
2642
  }, [
2638
2643
  t
2639
- ]), s = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2640
- return P("group", {
2644
+ ]), l = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2645
+ return L("group", {
2641
2646
  children: [
2642
2647
  i(de, {
2643
2648
  points: [
2644
2649
  e,
2645
2650
  r
2646
2651
  ],
2647
- color: s,
2652
+ color: l,
2648
2653
  lineWidth: 3
2649
2654
  }),
2650
- P("mesh", {
2655
+ L("mesh", {
2651
2656
  position: e,
2652
2657
  children: [
2653
2658
  i("sphereGeometry", {
@@ -2662,7 +2667,7 @@ let __tla = (async () => {
2662
2667
  })
2663
2668
  ]
2664
2669
  }),
2665
- P("mesh", {
2670
+ L("mesh", {
2666
2671
  position: r,
2667
2672
  children: [
2668
2673
  i("sphereGeometry", {
@@ -2680,20 +2685,20 @@ let __tla = (async () => {
2680
2685
  ]
2681
2686
  });
2682
2687
  }
2683
- function No({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2684
- const d = o * 0.15, c = j(() => {
2688
+ function Yo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2689
+ const s = o * 0.15, c = j(() => {
2685
2690
  const a = [];
2686
2691
  let n = t - 10;
2687
- const h = new M(0, 1, 0);
2692
+ const h = new C(0, 1, 0);
2688
2693
  for (; n > r; ) {
2689
- const l = Math.min(n, t), f = Math.max(n, t), p = xn(e, l, f);
2694
+ const d = Math.min(n, t), u = Math.max(n, t), p = yn(e, d, u);
2690
2695
  if (p) {
2691
- const g = p.dot(h), z = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2696
+ const g = p.dot(h), M = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2692
2697
  a.push({
2693
2698
  axis: p,
2694
- regionMin: l,
2695
- regionMax: f,
2696
- angleDeg: z
2699
+ regionMin: d,
2700
+ regionMax: u,
2701
+ angleDeg: M
2697
2702
  });
2698
2703
  }
2699
2704
  n -= 10;
@@ -2706,25 +2711,25 @@ let __tla = (async () => {
2706
2711
  ]);
2707
2712
  return i("group", {
2708
2713
  children: c.map((a, n) => {
2709
- const h = (a.regionMin + a.regionMax) / 2, l = new M(0, h, 0), f = l.clone().addScaledVector(a.axis, d), p = l.clone().addScaledVector(a.axis, -d), g = n / Math.max(1, c.length - 1), z = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2710
- return P("group", {
2714
+ const h = (a.regionMin + a.regionMax) / 2, d = new C(0, h, 0), u = d.clone().addScaledVector(a.axis, s), p = d.clone().addScaledVector(a.axis, -s), g = n / Math.max(1, c.length - 1), M = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2715
+ return L("group", {
2711
2716
  children: [
2712
2717
  i(de, {
2713
2718
  points: [
2714
2719
  p,
2715
- f
2720
+ u
2716
2721
  ],
2717
- color: z,
2722
+ color: M,
2718
2723
  lineWidth: 1.5,
2719
2724
  transparent: true,
2720
2725
  opacity: 0.7
2721
2726
  }),
2722
2727
  i(de, {
2723
2728
  points: [
2724
- new M(-d * 0.3, a.regionMin, 0),
2725
- new M(d * 0.3, a.regionMin, 0)
2729
+ new C(-s * 0.3, a.regionMin, 0),
2730
+ new C(s * 0.3, a.regionMin, 0)
2726
2731
  ],
2727
- color: z,
2732
+ color: M,
2728
2733
  lineWidth: 0.5,
2729
2734
  transparent: true,
2730
2735
  opacity: 0.3
@@ -2734,13 +2739,13 @@ let __tla = (async () => {
2734
2739
  })
2735
2740
  });
2736
2741
  }
2737
- function Yo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2738
- const s = j(() => {
2739
- const f = xn(e, r, t);
2740
- if (!f) return null;
2741
- const p = f.dot(new M(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(p))) * 180 / Math.PI;
2742
+ function Xo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2743
+ const l = j(() => {
2744
+ const u = yn(e, r, t);
2745
+ if (!u) return null;
2746
+ const p = u.dot(new C(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(p))) * 180 / Math.PI;
2742
2747
  return {
2743
- axis: f,
2748
+ axis: u,
2744
2749
  angleDeg: g
2745
2750
  };
2746
2751
  }, [
@@ -2748,15 +2753,15 @@ let __tla = (async () => {
2748
2753
  r,
2749
2754
  t
2750
2755
  ]);
2751
- if (!s) return null;
2752
- const d = (r + t) / 2, c = new M(0, d, 0), a = o * 0.4, n = c.clone().addScaledVector(s.axis, a), h = c.clone().addScaledVector(s.axis, -a), l = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2756
+ if (!l) return null;
2757
+ const s = (r + t) / 2, c = new C(0, s, 0), a = o * 0.4, n = c.clone().addScaledVector(l.axis, a), h = c.clone().addScaledVector(l.axis, -a), d = l.angleDeg < 0.5 ? "#00ffff" : l.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2753
2758
  return i("group", {
2754
2759
  children: i(de, {
2755
2760
  points: [
2756
2761
  h,
2757
2762
  n
2758
2763
  ],
2759
- color: l,
2764
+ color: d,
2760
2765
  lineWidth: 3,
2761
2766
  dashed: true,
2762
2767
  dashSize: 3,
@@ -2764,12 +2769,12 @@ let __tla = (async () => {
2764
2769
  })
2765
2770
  });
2766
2771
  }
2767
- function Xo({ pca: e, modelSize: r }) {
2768
- const t = e.axes[0], o = r * 0.6, s = e.center.clone().addScaledVector(t, o), d = e.center.clone().addScaledVector(t, -o);
2772
+ function Go({ pca: e, modelSize: r }) {
2773
+ const t = e.axes[0], o = r * 0.6, l = e.center.clone().addScaledVector(t, o), s = e.center.clone().addScaledVector(t, -o);
2769
2774
  return i(de, {
2770
2775
  points: [
2771
- d,
2772
- s
2776
+ s,
2777
+ l
2773
2778
  ],
2774
2779
  color: "#ff8800",
2775
2780
  lineWidth: 2,
@@ -2778,55 +2783,55 @@ let __tla = (async () => {
2778
2783
  gapSize: 2
2779
2784
  });
2780
2785
  }
2781
- function Go({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: s }) {
2782
- const d = j(() => {
2783
- const l = s ?? e, f = gn(l), p = new M(0, 1, 0), g = 5, u = t + 3 * 25.4, m = [];
2784
- for (let b = r + g; b < u; b += g) {
2785
- const D = fo(f, l, new M(0, b, 0), p);
2786
+ function Zo({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2787
+ const s = j(() => {
2788
+ const d = l ?? e, u = mn(d), p = new C(0, 1, 0), g = 5, f = t + 3 * 25.4, m = [];
2789
+ for (let y = r + g; y < f; y += g) {
2790
+ const D = uo(u, d, new C(0, y, 0), p);
2786
2791
  D > 0 && m.push({
2787
- y: b,
2792
+ y,
2788
2793
  circ: D
2789
2794
  });
2790
2795
  }
2791
2796
  if (m.length < 5) return null;
2792
- const x = t - r, S = r + x * 0.3, I = r + x * 0.7, A = m.filter((b) => b.y >= S && b.y <= I);
2793
- if (A.length < 3) return null;
2794
- const L = A.map((b) => b.circ).sort((b, D) => b - D), y = L[Math.floor(L.length / 2)], v = Math.max(...m.map((b) => b.circ));
2797
+ const x = t - r, S = r + x * 0.3, I = r + x * 0.7, F = m.filter((y) => y.y >= S && y.y <= I);
2798
+ if (F.length < 3) return null;
2799
+ const P = F.map((y) => y.circ).sort((y, D) => y - D), b = P[Math.floor(P.length / 2)], z = Math.max(...m.map((y) => y.circ));
2795
2800
  return {
2796
2801
  circumferences: m,
2797
- baseline: y,
2798
- maxCirc: v
2802
+ baseline: b,
2803
+ maxCirc: z
2799
2804
  };
2800
2805
  }, [
2801
2806
  e,
2802
2807
  r,
2803
2808
  t
2804
2809
  ]);
2805
- if (!d) return null;
2806
- const { circumferences: c, baseline: a, maxCirc: n } = d, h = o * 0.3 / n;
2807
- return P("group", {
2810
+ if (!s) return null;
2811
+ const { circumferences: c, baseline: a, maxCirc: n } = s, h = o * 0.3 / n;
2812
+ return L("group", {
2808
2813
  children: [
2809
- c.map(({ y: l, circ: f }, p) => {
2810
- const g = f / a, z = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", u = f * h;
2814
+ c.map(({ y: d, circ: u }, p) => {
2815
+ const g = u / a, M = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", f = u * h;
2811
2816
  return i(de, {
2812
2817
  points: [
2813
- new M(-u, l, 0),
2814
- new M(u, l, 0)
2818
+ new C(-f, d, 0),
2819
+ new C(f, d, 0)
2815
2820
  ],
2816
- color: z,
2821
+ color: M,
2817
2822
  lineWidth: 1.5,
2818
2823
  transparent: true,
2819
2824
  opacity: 0.6
2820
2825
  }, p);
2821
2826
  }),
2822
2827
  (() => {
2823
- const l = a * 1.6 * h, f = c[0].y, p = c[c.length - 1].y;
2824
- return P(Te, {
2828
+ const d = a * 1.6 * h, u = c[0].y, p = c[c.length - 1].y;
2829
+ return L(Te, {
2825
2830
  children: [
2826
2831
  i(de, {
2827
2832
  points: [
2828
- new M(-l, f, 0),
2829
- new M(-l, p, 0)
2833
+ new C(-d, u, 0),
2834
+ new C(-d, p, 0)
2830
2835
  ],
2831
2836
  color: "#ff4444",
2832
2837
  lineWidth: 1,
@@ -2838,8 +2843,8 @@ let __tla = (async () => {
2838
2843
  }),
2839
2844
  i(de, {
2840
2845
  points: [
2841
- new M(l, f, 0),
2842
- new M(l, p, 0)
2846
+ new C(d, u, 0),
2847
+ new C(d, p, 0)
2843
2848
  ],
2844
2849
  color: "#ff4444",
2845
2850
  lineWidth: 1,
@@ -2855,21 +2860,21 @@ let __tla = (async () => {
2855
2860
  ]
2856
2861
  });
2857
2862
  }
2858
- function Zo({ componentDebug: e }) {
2863
+ function Ko({ componentDebug: e }) {
2859
2864
  return i("group", {
2860
2865
  children: e.geometries.map((r, t) => {
2861
- const o = e.colors[t] ?? "#888888", s = t === e.innerIdx;
2866
+ const o = e.colors[t] ?? "#888888", l = t === e.innerIdx;
2862
2867
  r.computeBoundingBox();
2863
- const d = new M();
2864
- return r.boundingBox.getCenter(d), P("group", {
2868
+ const s = new C();
2869
+ return r.boundingBox.getCenter(s), L("group", {
2865
2870
  children: [
2866
2871
  i("mesh", {
2867
2872
  geometry: r,
2868
- renderOrder: s ? 2 : 1,
2873
+ renderOrder: l ? 2 : 1,
2869
2874
  children: i("meshStandardMaterial", {
2870
2875
  color: o,
2871
2876
  transparent: true,
2872
- opacity: s ? 0.5 : 0.2,
2877
+ opacity: l ? 0.5 : 0.2,
2873
2878
  side: O.DoubleSide,
2874
2879
  depthWrite: false,
2875
2880
  polygonOffset: true,
@@ -2879,16 +2884,16 @@ let __tla = (async () => {
2879
2884
  }),
2880
2885
  i("mesh", {
2881
2886
  geometry: r,
2882
- renderOrder: s ? 2 : 1,
2887
+ renderOrder: l ? 2 : 1,
2883
2888
  children: i("meshBasicMaterial", {
2884
2889
  color: o,
2885
2890
  wireframe: true,
2886
2891
  transparent: true,
2887
- opacity: s ? 0.4 : 0.15
2892
+ opacity: l ? 0.4 : 0.15
2888
2893
  })
2889
2894
  }),
2890
2895
  i("group", {
2891
- position: d,
2896
+ position: s,
2892
2897
  children: i(Ye, {
2893
2898
  center: true,
2894
2899
  style: {
@@ -2907,7 +2912,7 @@ let __tla = (async () => {
2907
2912
  fontSize: 11,
2908
2913
  color: o,
2909
2914
  fontFamily: "monospace",
2910
- fontWeight: s ? 700 : 400
2915
+ fontWeight: l ? 700 : 400
2911
2916
  },
2912
2917
  children: e.labels[t]
2913
2918
  })
@@ -2919,14 +2924,14 @@ let __tla = (async () => {
2919
2924
  })
2920
2925
  });
2921
2926
  }
2922
- function Ko({ geometry: e, aoData: r }) {
2927
+ function Uo({ geometry: e, aoData: r }) {
2923
2928
  const t = j(() => {
2924
- const o = e.toNonIndexed(), s = o.getAttribute("position"), d = r.length, c = s.count, a = new Float32Array(c * 3);
2925
- for (let n = 0; n < d && n * 3 + 2 < c; n++) {
2926
- const h = r[n], l = h, f = h < 0.5 ? 0.8 - h * 1.2 : 0.2 * (1 - h), p = 1 - h;
2929
+ const o = e.toNonIndexed(), l = o.getAttribute("position"), s = r.length, c = l.count, a = new Float32Array(c * 3);
2930
+ for (let n = 0; n < s && n * 3 + 2 < c; n++) {
2931
+ const h = r[n], d = h, u = h < 0.5 ? 0.8 - h * 1.2 : 0.2 * (1 - h), p = 1 - h;
2927
2932
  for (let g = 0; g < 3; g++) {
2928
- const z = (n * 3 + g) * 3;
2929
- a[z] = l, a[z + 1] = f, a[z + 2] = p;
2933
+ const M = (n * 3 + g) * 3;
2934
+ a[M] = d, a[M + 1] = u, a[M + 2] = p;
2930
2935
  }
2931
2936
  }
2932
2937
  return o.setAttribute("color", new O.Float32BufferAttribute(a, 3)), o;
@@ -2948,35 +2953,35 @@ let __tla = (async () => {
2948
2953
  })
2949
2954
  });
2950
2955
  }
2951
- function Uo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: s, aoGeometry: d, measurementGeometry: c }) {
2952
- const a = e.geometry, n = j(() => a.getAttribute("position") ? yn(a) : null, [
2956
+ function Jo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
2957
+ const a = e.geometry, n = j(() => a.getAttribute("position") ? bn(a) : null, [
2953
2958
  a
2954
2959
  ]), h = j(() => !t || t.length < 2 ? null : {
2955
- red: new M(t[1].position.x, t[1].position.y, t[1].position.z),
2956
- green: new M(t[0].position.x, t[0].position.y, t[0].position.z)
2960
+ red: new C(t[1].position.x, t[1].position.y, t[1].position.z),
2961
+ green: new C(t[0].position.x, t[0].position.y, t[0].position.z)
2957
2962
  }, [
2958
2963
  t
2959
2964
  ]);
2960
- return P("group", {
2965
+ return L("group", {
2961
2966
  children: [
2962
- r.pcaAxes && n && i(Ho, {
2967
+ r.pcaAxes && n && i(Vo, {
2963
2968
  pca: n
2964
2969
  }),
2965
- r.obb && n && i(Vo, {
2970
+ r.obb && n && i(jo, {
2966
2971
  pca: n
2967
2972
  }),
2968
- r.obbAxis && n && i(Xo, {
2973
+ r.obbAxis && n && i(Go, {
2969
2974
  pca: n,
2970
2975
  modelSize: n.halfExtents[0] ? Math.max(...n.halfExtents) * 2 : 100
2971
2976
  }),
2972
- r.shellComponents && o && i(Zo, {
2977
+ r.shellComponents && o && i(Ko, {
2973
2978
  componentDebug: o
2974
2979
  }),
2975
- r.ambientOcclusion && s && s.length > 0 && i(Ko, {
2976
- geometry: d ?? a,
2977
- aoData: s
2980
+ r.ambientOcclusion && l && l.length > 0 && i(Uo, {
2981
+ geometry: s ?? a,
2982
+ aoData: l
2978
2983
  }),
2979
- r.circumferenceScan && h && i(Go, {
2984
+ r.circumferenceScan && h && i(Zo, {
2980
2985
  geometry: a,
2981
2986
  redY: h.red.y,
2982
2987
  greenY: h.green.y,
@@ -2994,17 +2999,17 @@ let __tla = (async () => {
2994
2999
  depthWrite: false
2995
3000
  })
2996
3001
  }),
2997
- r.landmarkAxis && h && i(jo, {
3002
+ r.landmarkAxis && h && i(No, {
2998
3003
  redPoint: h.red,
2999
3004
  greenPoint: h.green
3000
3005
  }),
3001
- r.iterativePCA && h && i(No, {
3006
+ r.iterativePCA && h && i(Yo, {
3002
3007
  geometry: a,
3003
3008
  redY: h.red.y,
3004
3009
  greenY: h.green.y,
3005
3010
  modelSize: (n == null ? void 0 : n.halfExtents[0]) ? Math.max(...n.halfExtents) * 2 : 100
3006
3011
  }),
3007
- r.fullRegionPCA && h && i(Yo, {
3012
+ r.fullRegionPCA && h && i(Xo, {
3008
3013
  geometry: a,
3009
3014
  redY: h.red.y,
3010
3015
  greenY: h.green.y,
@@ -3013,23 +3018,23 @@ let __tla = (async () => {
3013
3018
  ]
3014
3019
  });
3015
3020
  }
3016
- function Jo({ mesh: e }) {
3021
+ function Qo({ mesh: e }) {
3017
3022
  const r = e.geometry, t = j(() => {
3018
3023
  if (!r.getAttribute("position")) return null;
3019
- const d = yn(r), c = d.axes[0], a = d.halfExtents[0] * 1.3;
3024
+ const s = bn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3020
3025
  return {
3021
3026
  axis: c,
3022
- center: d.center,
3027
+ center: s.center,
3023
3028
  halfLen: a
3024
3029
  };
3025
3030
  }, [
3026
3031
  r
3027
3032
  ]);
3028
3033
  if (!t) return null;
3029
- const o = t.center.clone().addScaledVector(t.axis, t.halfLen), s = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3034
+ const o = t.center.clone().addScaledVector(t.axis, t.halfLen), l = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3030
3035
  return i(de, {
3031
3036
  points: [
3032
- s,
3037
+ l,
3033
3038
  o
3034
3039
  ],
3035
3040
  color: "#666",
@@ -3043,7 +3048,7 @@ let __tla = (async () => {
3043
3048
  renderOrder: 999
3044
3049
  });
3045
3050
  }
3046
- const bn = [
3051
+ const wn = [
3047
3052
  {
3048
3053
  key: "pcaAxes",
3049
3054
  label: "PCA Axes (full mesh)",
@@ -3099,11 +3104,11 @@ let __tla = (async () => {
3099
3104
  color: "#00ffff",
3100
3105
  group: "Alignment"
3101
3106
  }
3102
- ], Qo = [
3103
- ...new Set(bn.map((e) => e.group))
3107
+ ], qo = [
3108
+ ...new Set(wn.map((e) => e.group))
3104
3109
  ];
3105
- function qo({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3106
- return P("div", {
3110
+ function er({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3111
+ return L("div", {
3107
3112
  style: {
3108
3113
  position: "absolute",
3109
3114
  top: 16,
@@ -3131,9 +3136,9 @@ let __tla = (async () => {
3131
3136
  },
3132
3137
  children: "Debug Layers"
3133
3138
  }),
3134
- Qo.map((o) => {
3135
- const s = bn.filter((d) => d.group === o && !(d.hideWhenDoubleShell && t));
3136
- return s.length === 0 ? null : P("div", {
3139
+ qo.map((o) => {
3140
+ const l = wn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3141
+ return l.length === 0 ? null : L("div", {
3137
3142
  children: [
3138
3143
  i("div", {
3139
3144
  style: {
@@ -3147,7 +3152,7 @@ let __tla = (async () => {
3147
3152
  },
3148
3153
  children: o
3149
3154
  }),
3150
- s.map(({ key: d, label: c, color: a }) => P("label", {
3155
+ l.map(({ key: s, label: c, color: a }) => L("label", {
3151
3156
  style: {
3152
3157
  display: "flex",
3153
3158
  alignItems: "center",
@@ -3159,8 +3164,8 @@ let __tla = (async () => {
3159
3164
  children: [
3160
3165
  i("input", {
3161
3166
  type: "checkbox",
3162
- checked: e[d],
3163
- onChange: () => r(d),
3167
+ checked: e[s],
3168
+ onChange: () => r(s),
3164
3169
  style: {
3165
3170
  accentColor: a,
3166
3171
  width: 14,
@@ -3174,32 +3179,32 @@ let __tla = (async () => {
3174
3179
  height: 8,
3175
3180
  borderRadius: "50%",
3176
3181
  backgroundColor: a,
3177
- opacity: e[d] ? 1 : 0.3,
3182
+ opacity: e[s] ? 1 : 0.3,
3178
3183
  flexShrink: 0
3179
3184
  }
3180
3185
  }),
3181
3186
  i("span", {
3182
3187
  style: {
3183
- opacity: e[d] ? 1 : 0.5
3188
+ opacity: e[s] ? 1 : 0.5
3184
3189
  },
3185
3190
  children: c
3186
3191
  })
3187
3192
  ]
3188
- }, d))
3193
+ }, s))
3189
3194
  ]
3190
3195
  }, o);
3191
3196
  })
3192
3197
  ]
3193
3198
  });
3194
3199
  }
3195
- const er = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: s, isDebugUser: d = false, onAnalyticsEvent: c, wasmModule: a }) => {
3196
- const [n, h] = W(null), [l, f] = W(0), [p, g] = W(false), [z, u] = W(false), [m, x] = W(""), [S, I] = W("3D"), [A, L] = W(r === "AK" ? 2 : 1), [y, v] = W(false), [b, D] = W(null), [w, k] = W(r ?? null), [F, B] = W("mm"), [$, N] = W(false), [U, be] = W(""), [ae, fe] = W(false), [ie, J] = W(false), [Y, pe] = W(false), [Z, he] = W(false), [me, ue] = W(null), [H, q] = W(null), [xe, Ce] = W(null), [we, oe] = W(false), [V, X] = W([]), [Le, Pe] = W(null), [Xe, se] = W(null), [ze, _t] = W(null), [pt, Sn] = W(null), [vn, Dt] = W(false), [Bt, Cn] = W(null), [ht, Ie] = W(null), [Be, Mn] = W(false), [Rt, zn] = W(Oo), [Oe, Wt] = W("obj"), [Ae, gt] = W(o), [et, Et] = W(true), [Tt, mt] = W(false), [Ot, An] = W(false), [xt, kn] = W(null), [$t] = W("#c8c8c8"), [Fn] = W(1), [Ge, Ln] = W(false), [yt, Ht] = W([]), tt = le(null), $e = le(null), bt = le(false), Pn = le(null), wt = le(null), St = le(null), Ke = re(async () => {
3200
+ const tr = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3201
+ const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [F, P] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, fe] = E(false), [ie, J] = E(false), [Y, pe] = E(false), [Z, he] = E(false), [me, ue] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, oe] = E(false), [V, X] = E([]), [Le, Pe] = E(null), [Xe, se] = E(null), [ze, _t] = E(null), [pt, vn] = E(null), [Cn, Dt] = E(false), [Bt, Mn] = E(null), [ht, Ie] = E(null), [Be, zn] = E(false), [Rt, An] = E($o), [Oe, Wt] = E("obj"), [Ae, gt] = E(o), [et, Et] = E(true), [Tt, mt] = E(false), [Ot, kn] = E(false), [xt, Fn] = E(null), [$t] = E("#c8c8c8"), [Ln] = E(1), [Ge, Pn] = E(false), [yt, Ht] = E([]), tt = le(null), $e = le(null), bt = le(false), In = le(null), wt = le(null), St = le(null), Ke = re(async () => {
3197
3202
  if (St.current) try {
3198
- const C = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = St.current, E = 2, R = async (K = false) => {
3199
- const te = await C(_, {
3203
+ const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = St.current, W = 2, R = async (K = false) => {
3204
+ const te = await v(_, {
3200
3205
  backgroundColor: null,
3201
3206
  useCORS: true,
3202
- scale: E,
3207
+ scale: W,
3203
3208
  ignoreElements: (rt) => {
3204
3209
  var _a;
3205
3210
  return ((_a = rt.style) == null ? void 0 : _a.zIndex) === "10";
@@ -3210,10 +3215,10 @@ let __tla = (async () => {
3210
3215
  const _e = te.getContext("2d").getImageData(0, 0, te.width, te.height).data;
3211
3216
  let De = te.width, We = te.height, qe = 0, it = 0;
3212
3217
  for (let He = 0; He < te.height; He++) for (let Ve = 0; Ve < te.width; Ve++) {
3213
- const Nn = (He * te.width + Ve) * 4;
3214
- _e[Nn + 3] > 20 && (Ve < De && (De = Ve), Ve > qe && (qe = Ve), He < We && (We = He), He > it && (it = He));
3218
+ const Yn = (He * te.width + Ve) * 4;
3219
+ _e[Yn + 3] > 20 && (Ve < De && (De = Ve), Ve > qe && (qe = Ve), He < We && (We = He), He > it && (it = He));
3215
3220
  }
3216
- qe <= De && (De = 0, We = 0, qe = te.width, it = te.height), ve = De / E, Me = We / E, ye = qe / E, Ee = it / E;
3221
+ qe <= De && (De = 0, We = 0, qe = te.width, it = te.height), ve = De / W, Me = We / W, ye = qe / W, Ee = it / W;
3217
3222
  } else {
3218
3223
  const rt = _.querySelectorAll("[style*='pointer-events: none']");
3219
3224
  ve = 1 / 0, Me = 1 / 0, ye = -1 / 0, Ee = -1 / 0, rt.forEach((kt) => {
@@ -3223,10 +3228,10 @@ let __tla = (async () => {
3223
3228
  De < ve && (ve = De), We < Me && (Me = We), De + _e.width > ye && (ye = De + _e.width), We + _e.height > Ee && (Ee = We + _e.height);
3224
3229
  }), ve === 1 / 0 && (ve = 0, Me = 0, ye = ke, Ee = Re);
3225
3230
  }
3226
- const Kt = Math.max(ke, Re) * 0.03, Ut = Math.max(ke, Re) * 0.06;
3227
- ve = Math.max(0, ve - Kt), Me = Math.max(0, Me - Ut), ye = Math.min(ke, ye + Kt), Ee = Math.min(Re, Ee + Ut);
3228
- const zt = (ye - ve) * E, At = (Ee - Me) * E, Vn = Math.max(0, ve * E), jn = Math.max(0, Me * E), ot = document.createElement("canvas");
3229
- return ot.width = Math.round(zt), ot.height = Math.round(At), ot.getContext("2d").drawImage(te, Math.round(Vn), Math.round(jn), Math.round(zt), Math.round(At), 0, 0, Math.round(zt), Math.round(At)), ot.toDataURL("image/png");
3231
+ const Ut = Math.max(ke, Re) * 0.03, Jt = Math.max(ke, Re) * 0.06;
3232
+ ve = Math.max(0, ve - Ut), Me = Math.max(0, Me - Jt), ye = Math.min(ke, ye + Ut), Ee = Math.min(Re, Ee + Jt);
3233
+ const zt = (ye - ve) * W, At = (Ee - Me) * W, jn = Math.max(0, ve * W), Nn = Math.max(0, Me * W), ot = document.createElement("canvas");
3234
+ return ot.width = Math.round(zt), ot.height = Math.round(At), ot.getContext("2d").drawImage(te, Math.round(jn), Math.round(Nn), Math.round(zt), Math.round(At), 0, 0, Math.round(zt), Math.round(At)), ot.toDataURL("image/png");
3230
3235
  };
3231
3236
  wt.current && wt.current(), await new Promise((K) => setTimeout(K, 200)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
3232
3237
  const ge = await R();
@@ -3239,39 +3244,45 @@ let __tla = (async () => {
3239
3244
  } catch {
3240
3245
  return;
3241
3246
  }
3242
- }, []), Se = re((C) => {
3243
- const _ = /* @__PURE__ */ new Date(), E = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3247
+ }, []), Se = re((v) => {
3248
+ const _ = /* @__PURE__ */ new Date(), W = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3244
3249
  Ht((R) => [
3245
3250
  ...R.slice(-200),
3246
- `[${E}] ${C}`
3251
+ `[${W}] ${v}`
3247
3252
  ]);
3248
- }, []), { landmarkPoints: T, clearLandmarkPoints: In, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt } = It(), nt = A * at;
3253
+ }, []), { landmarkPoints: T, clearLandmarkPoints: _n, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt, reset: Gt } = It();
3254
+ ne(() => {
3255
+ Gt();
3256
+ }, [
3257
+ Gt
3258
+ ]);
3259
+ const nt = F * at;
3249
3260
  ne(() => {
3250
- if (!d || T.length === 0) return;
3251
- const C = T[T.length - 1];
3252
- Se(`LANDMARK[${T.length - 1}]: placed at (${C.position.x.toFixed(1)}, ${C.position.y.toFixed(1)}, ${C.position.z.toFixed(1)}) face=${C.faceIndex}`);
3261
+ if (!s || T.length === 0) return;
3262
+ const v = T[T.length - 1];
3263
+ Se(`LANDMARK[${T.length - 1}]: placed at (${v.position.x.toFixed(1)}, ${v.position.y.toFixed(1)}, ${v.position.z.toFixed(1)}) face=${v.faceIndex}`);
3253
3264
  }, [
3254
3265
  T.length,
3255
- d,
3266
+ s,
3256
3267
  Se
3257
3268
  ]), ne(() => {
3258
- d && ee && Se("STATE: mesh aligned");
3269
+ s && ee && Se("STATE: mesh aligned");
3259
3270
  }, [
3260
3271
  ee,
3261
- d,
3272
+ s,
3262
3273
  Se
3263
3274
  ]), ne(() => {
3264
- d && vt && Se("STATE: mesh cut");
3275
+ s && vt && Se("STATE: mesh cut");
3265
3276
  }, [
3266
3277
  vt,
3267
- d,
3278
+ s,
3268
3279
  Se
3269
3280
  ]), ne(() => {
3270
3281
  tt.current && (tt.current.scrollTop = tt.current.scrollHeight);
3271
3282
  }, [
3272
3283
  yt
3273
3284
  ]);
3274
- const Gt = j(() => xe ? new O.Mesh(xe) : null, [
3285
+ const Zt = j(() => xe ? new O.Mesh(xe) : null, [
3275
3286
  xe
3276
3287
  ]);
3277
3288
  ne(() => {
@@ -3281,13 +3292,13 @@ let __tla = (async () => {
3281
3292
  ]), ne(() => {
3282
3293
  o || gt(void 0);
3283
3294
  }, [
3284
- A
3295
+ F
3285
3296
  ]);
3286
3297
  const Ct = le(false);
3287
3298
  ne(() => {
3288
3299
  if (!ee || V.length === 0 || Ct.current || !c) return;
3289
3300
  Ct.current = true;
3290
- const C = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3301
+ const v = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3291
3302
  c("dimensions_calculated", {
3292
3303
  spacing_type: w,
3293
3304
  source_unit: "mm",
@@ -3297,73 +3308,73 @@ let __tla = (async () => {
3297
3308
  is_unit_converted: false,
3298
3309
  form_measurements: (Ae == null ? void 0 : Ae.filter((_) => _ != null)) ?? null,
3299
3310
  scan_measurements: V.map((_) => +(_.modifiedValue ?? _.originalValue).toFixed(1)),
3300
- measurement_variance: Ae ? V.map((_, E) => {
3301
- const R = Ae[E];
3311
+ measurement_variance: Ae ? V.map((_, W) => {
3312
+ const R = Ae[W];
3302
3313
  return R == null ? null : +((_.modifiedValue ?? _.originalValue) - R).toFixed(1);
3303
3314
  }) : null,
3304
- frontal_height: C !== null ? +C.toFixed(1) : null
3315
+ frontal_height: v !== null ? +v.toFixed(1) : null
3305
3316
  });
3306
3317
  }, [
3307
3318
  ee,
3308
3319
  V
3309
3320
  ]), ne(() => {
3310
- a !== void 0 && ($e.current = a), Ln(true);
3321
+ a !== void 0 && ($e.current = a), Pn(true);
3311
3322
  }, [
3312
3323
  a
3313
3324
  ]);
3314
- const Ue = re((C, _) => {
3315
- C.computeBoundingBox();
3316
- const E = C.boundingBox, R = new M();
3317
- E.getCenter(R), C.translate(-R.x, -R.y, -R.z), C.computeBoundingBox();
3318
- const ge = C.boundingBox, G = new M();
3319
- ge.getSize(G), f(Math.max(G.x, G.y, G.z));
3320
- const K = new O.Mesh(C, new O.MeshStandardMaterial({
3325
+ const Ue = re((v, _) => {
3326
+ v.computeBoundingBox();
3327
+ const W = v.boundingBox, R = new C();
3328
+ W.getCenter(R), v.translate(-R.x, -R.y, -R.z), v.computeBoundingBox();
3329
+ const ge = v.boundingBox, G = new C();
3330
+ ge.getSize(G), u(Math.max(G.x, G.y, G.z));
3331
+ const K = new O.Mesh(v, new O.MeshStandardMaterial({
3321
3332
  color: 8947848,
3322
3333
  side: O.DoubleSide
3323
3334
  }));
3324
3335
  h(K), fe(_), J(true), he(false), bt.current = false;
3325
- }, []), Je = re(async (C, _) => {
3336
+ }, []), Je = re(async (v, _) => {
3326
3337
  Ie(null);
3327
- const E = _.toLowerCase(), R = E.endsWith(".stl");
3328
- if (!E.endsWith(".obj") && !R) {
3338
+ const W = _.toLowerCase(), R = W.endsWith(".stl");
3339
+ if (!W.endsWith(".obj") && !R) {
3329
3340
  Ie("Unsupported file format. Please use OBJ or STL.");
3330
3341
  return;
3331
3342
  }
3332
- Wt(R ? "stl" : "obj"), u(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3343
+ Wt(R ? "stl" : "obj"), f(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3333
3344
  try {
3334
3345
  let G;
3335
- if (R) if (x("Converting STL..."), C instanceof ArrayBuffer) {
3346
+ if (R) if (x("Converting STL..."), v instanceof ArrayBuffer) {
3336
3347
  const Q = new Blob([
3337
- C
3348
+ v
3338
3349
  ]), ke = new File([
3339
3350
  Q
3340
3351
  ], _);
3341
3352
  G = await Ft(ke);
3342
3353
  } else {
3343
3354
  const Q = new Blob([
3344
- C
3355
+ v
3345
3356
  ]), ke = new File([
3346
3357
  Q
3347
3358
  ], _);
3348
3359
  G = await Ft(ke);
3349
3360
  }
3350
- else G = typeof C == "string" ? C : new TextDecoder().decode(C);
3351
- const K = performance.now(), te = $e.current ? await so(G, $e.current, (Q) => {
3361
+ else G = typeof v == "string" ? v : new TextDecoder().decode(v);
3362
+ const K = performance.now(), te = $e.current ? await lo(G, $e.current, (Q) => {
3352
3363
  x(Q), Se(`PREPROCESS: ${Q}`);
3353
3364
  }) : null;
3354
- if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), v(true)) : Ue(te.geometry, te.wasScaled);
3365
+ if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), z(true)) : Ue(te.geometry, te.wasScaled);
3355
3366
  else {
3356
3367
  x("Using fallback loader...");
3357
- const Q = lo(G);
3368
+ const Q = ao(G);
3358
3369
  Q ? e.showAmputationModal && !r ? (D({
3359
3370
  geometry: Q,
3360
3371
  wasScaled: false
3361
- }), v(true)) : Ue(Q, false) : Ie("Failed to parse the mesh.");
3372
+ }), z(true)) : Ue(Q, false) : Ie("Failed to parse the mesh.");
3362
3373
  }
3363
3374
  } catch (G) {
3364
3375
  Ie(G instanceof Error ? G.message : "Failed to process the mesh file.");
3365
3376
  } finally {
3366
- u(false), x("");
3377
+ f(false), x("");
3367
3378
  }
3368
3379
  }, [
3369
3380
  Ge,
@@ -3374,7 +3385,7 @@ let __tla = (async () => {
3374
3385
  ne(() => {
3375
3386
  if (!t || !Ge) return;
3376
3387
  (async () => {
3377
- u(true), x("Loading scan...");
3388
+ f(true), x("Loading scan...");
3378
3389
  try {
3379
3390
  const _ = await fetch(t);
3380
3391
  if (!_.ok) throw new Error(`Failed to download scan: ${_.status}`);
@@ -3387,36 +3398,36 @@ let __tla = (async () => {
3387
3398
  await Je(G, R);
3388
3399
  }
3389
3400
  } catch (_) {
3390
- Ie(_ instanceof Error ? _.message : "Failed to load scan from URL."), u(false), x("");
3401
+ Ie(_ instanceof Error ? _.message : "Failed to load scan from URL."), f(false), x("");
3391
3402
  }
3392
3403
  })();
3393
3404
  }, [
3394
3405
  t,
3395
3406
  Ge
3396
3407
  ]);
3397
- const _n = re((C) => {
3398
- C.preventDefault(), g(true);
3399
- }, []), Dn = re((C) => {
3400
- C.preventDefault(), g(false);
3401
- }, []), Bn = re(async (C) => {
3402
- if (C.preventDefault(), g(false), !Ge) {
3408
+ const Dn = re((v) => {
3409
+ v.preventDefault(), g(true);
3410
+ }, []), Bn = re((v) => {
3411
+ v.preventDefault(), g(false);
3412
+ }, []), Rn = re(async (v) => {
3413
+ if (v.preventDefault(), g(false), !Ge) {
3403
3414
  Ie("WASM module is still loading. Please wait.");
3404
3415
  return;
3405
3416
  }
3406
- const _ = C.dataTransfer.files[0];
3417
+ const _ = v.dataTransfer.files[0];
3407
3418
  if (!_) return;
3408
- const E = _.name.toLowerCase();
3409
- if (!E.endsWith(".obj") && !E.endsWith(".stl")) {
3419
+ const W = _.name.toLowerCase();
3420
+ if (!W.endsWith(".obj") && !W.endsWith(".stl")) {
3410
3421
  Ie("Please drop an OBJ or STL file.");
3411
3422
  return;
3412
3423
  }
3413
- if (E.endsWith(".stl")) {
3414
- Wt("stl"), u(true), x("Converting STL...");
3424
+ if (W.endsWith(".stl")) {
3425
+ Wt("stl"), f(true), x("Converting STL...");
3415
3426
  try {
3416
3427
  const R = await Ft(_);
3417
3428
  await Je(R, _.name.replace(/\.stl$/i, ".obj"));
3418
3429
  } catch (R) {
3419
- Ie(R instanceof Error ? R.message : "Failed to process STL file."), u(false), x("");
3430
+ Ie(R instanceof Error ? R.message : "Failed to process STL file."), f(false), x("");
3420
3431
  }
3421
3432
  } else {
3422
3433
  const R = await _.text();
@@ -3425,14 +3436,14 @@ let __tla = (async () => {
3425
3436
  }, [
3426
3437
  Ge,
3427
3438
  Je
3428
- ]), Rn = re((C) => {
3429
- k(C), L(C === "AK" ? 2 : 1), v(false), b && (Ue(b.geometry, b.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3430
- spacing_type: C,
3439
+ ]), Wn = re((v) => {
3440
+ A(v), P(v === "AK" ? 2 : 1), z(false), y && (Ue(y.geometry, y.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3441
+ spacing_type: v,
3431
3442
  file_format: Oe,
3432
3443
  is_double_wall: false
3433
3444
  });
3434
3445
  }, [
3435
- b,
3446
+ y,
3436
3447
  Ue,
3437
3448
  c,
3438
3449
  Oe
@@ -3440,10 +3451,10 @@ let __tla = (async () => {
3440
3451
  ne(() => {
3441
3452
  if (!n || T.length !== 1 || !$e.current || bt.current) return;
3442
3453
  bt.current = true;
3443
- const C = T[0], _ = $e.current, E = n.geometry, { positions: R, indices: ge } = ct(E), G = new Float32Array([
3444
- C.position.x,
3445
- C.position.y,
3446
- C.position.z
3454
+ const v = T[0], _ = $e.current, W = n.geometry, { positions: R, indices: ge } = ct(W), G = new Float32Array([
3455
+ v.position.x,
3456
+ v.position.y,
3457
+ v.position.z
3447
3458
  ]), K = _.detect_shell(R, ge, G, 40), te = K.details(), Q = K.is_double_shell();
3448
3459
  Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (pe(true), oe(true), Se(`SHELL_DETECT: double shell, thickness=${K.thickness().toFixed(1)}mm`));
3449
3460
  }, [
@@ -3451,48 +3462,48 @@ let __tla = (async () => {
3451
3462
  T,
3452
3463
  Se
3453
3464
  ]);
3454
- const Wn = re(() => {
3465
+ const En = re(() => {
3455
3466
  if (!n || T.length < 2) return;
3456
3467
  N(true), be("Please wait..."), Se("PIPELINE: starting processing pipeline...");
3457
- const C = performance.now();
3468
+ const v = performance.now();
3458
3469
  setTimeout(() => {
3459
3470
  const _ = [
3460
3471
  T[1],
3461
3472
  T[0],
3462
3473
  ...T.slice(2)
3463
3474
  ];
3464
- po(n, _, at, {
3465
- onStatus: (E) => {
3466
- be(E), Se(`PIPELINE: ${E}`);
3475
+ ho(n, _, at, {
3476
+ onStatus: (W) => {
3477
+ be(W), Se(`PIPELINE: ${W}`);
3467
3478
  },
3468
3479
  addLandmarkPoint: Vt,
3469
3480
  removeLandmarkPoint: jt,
3470
- updateLandmarkPositions: (E) => {
3481
+ updateLandmarkPositions: (W) => {
3471
3482
  const R = [
3472
- E[1],
3473
- E[0],
3474
- ...E.slice(2)
3483
+ W[1],
3484
+ W[0],
3485
+ ...W.slice(2)
3475
3486
  ];
3476
3487
  Nt(R);
3477
3488
  },
3478
3489
  setAligned: Yt,
3479
3490
  setCut: Xt,
3480
- setModelSize: f,
3481
- setOriginalEndY: Sn,
3491
+ setModelSize: u,
3492
+ setOriginalEndY: vn,
3482
3493
  setAdjustedStartY: se,
3483
3494
  setAdjustedEndY: _t,
3484
3495
  setError: Ie,
3485
- setDoubleShell: (E) => {
3486
- pe(E), oe(true);
3496
+ setDoubleShell: (W) => {
3497
+ pe(W), oe(true);
3487
3498
  },
3488
- setAoData: (E, R) => {
3489
- ue(E), q(R ?? null);
3499
+ setAoData: (W, R) => {
3500
+ ue(W), q(R ?? null);
3490
3501
  },
3491
3502
  setInnerShellExtracted: he,
3492
3503
  setMeasurementGeometry: Ce,
3493
3504
  setWasmSlices: Pe,
3494
3505
  wasmModule: $e.current ?? void 0
3495
- }), Se(`PIPELINE: completed in ${(performance.now() - C).toFixed(0)}ms`), Ct.current = false, N(false);
3506
+ }), Se(`PIPELINE: completed in ${(performance.now() - v).toFixed(0)}ms`), Ct.current = false, N(false);
3496
3507
  }, 50);
3497
3508
  }, [
3498
3509
  n,
@@ -3503,9 +3514,9 @@ let __tla = (async () => {
3503
3514
  jt,
3504
3515
  Xt,
3505
3516
  Z
3506
- ]), Zt = le(false);
3517
+ ]), Kt = le(false);
3507
3518
  ne(() => {
3508
- ee && V.length > 0 && !Zt.current && (Zt.current = true, mt(true));
3519
+ ee && V.length > 0 && !Kt.current && (Kt.current = true, mt(true));
3509
3520
  }, [
3510
3521
  ee,
3511
3522
  V.length
@@ -3514,21 +3525,21 @@ let __tla = (async () => {
3514
3525
  var _a;
3515
3526
  if (!n || T.length < 3) return 0;
3516
3527
  if (Y) return Math.abs(T[0].position.y - T[2].position.y);
3517
- const C = n.geometry;
3518
- C.computeBoundingBox();
3519
- const _ = ((_a = C.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3528
+ const v = n.geometry;
3529
+ v.computeBoundingBox();
3530
+ const _ = ((_a = v.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3520
3531
  return Math.abs(T[0].position.y - _);
3521
3532
  }, [
3522
3533
  n,
3523
3534
  T,
3524
3535
  Y
3525
- ]), En = re((C) => {
3526
- kn(C), gt(C.circumferences), mt(false), Et(true), An(true);
3527
- }, []), Tn = re(async (C) => {
3528
- if (!s || !n || !w) return;
3536
+ ]), Tn = re((v) => {
3537
+ Fn(v), gt(v.circumferences), mt(false), Et(true), kn(true);
3538
+ }, []), On = re(async (v) => {
3539
+ if (!l || !n || !w) return;
3529
3540
  mt(false);
3530
3541
  const _ = await Ke();
3531
- s({
3542
+ l({
3532
3543
  spacingType: w,
3533
3544
  sourceUnit: "mm",
3534
3545
  fileFormat: Oe,
@@ -3542,11 +3553,11 @@ let __tla = (async () => {
3542
3553
  transverseAP: 0,
3543
3554
  scanUrl: t,
3544
3555
  decision: "skip",
3545
- skipReason: C,
3556
+ skipReason: v,
3546
3557
  screenshots: _
3547
3558
  });
3548
3559
  }, [
3549
- s,
3560
+ l,
3550
3561
  n,
3551
3562
  w,
3552
3563
  Oe,
@@ -3556,41 +3567,41 @@ let __tla = (async () => {
3556
3567
  Qe,
3557
3568
  t,
3558
3569
  Ke
3559
- ]), Mt = re(async (C) => {
3560
- if (!s || !n || V.length === 0 || !w) return;
3561
- let _ = 0, E = 0;
3570
+ ]), Mt = re(async (v) => {
3571
+ if (!l || !n || V.length === 0 || !w) return;
3572
+ let _ = 0, W = 0;
3562
3573
  if (T.length >= 2) {
3563
3574
  const ge = n.geometry, K = T[0].position.y;
3564
3575
  try {
3565
- const te = gn(ge), Q = Ne(te, ge, K);
3576
+ const te = mn(ge), Q = Ne(te, ge, K);
3566
3577
  if (Q.linePoints.length >= 2) {
3567
3578
  let ke = Q.linePoints[0], Re = Q.linePoints[0], ve = Q.linePoints[0], Me = Q.linePoints[0];
3568
3579
  for (const ye of Q.linePoints) ye.x < ke.x && (ke = ye), ye.x > Re.x && (Re = ye), ye.z < ve.z && (ve = ye), ye.z > Me.z && (Me = ye);
3569
- _ = new M(ke.x, K, ke.z).distanceTo(new M(Re.x, K, Re.z)), E = new M(ve.x, K, ve.z).distanceTo(new M(Me.x, K, Me.z));
3580
+ _ = new C(ke.x, K, ke.z).distanceTo(new C(Re.x, K, Re.z)), W = new C(ve.x, K, ve.z).distanceTo(new C(Me.x, K, Me.z));
3570
3581
  }
3571
3582
  } catch {
3572
3583
  }
3573
3584
  }
3574
3585
  const R = await Ke();
3575
- s({
3586
+ l({
3576
3587
  spacingType: w,
3577
3588
  sourceUnit: "mm",
3578
3589
  fileFormat: Oe,
3579
- measurementSource: C === "use_form_measurements" ? "form_provided" : "scan_derived",
3590
+ measurementSource: v === "use_form_measurements" ? "form_provided" : "scan_derived",
3580
3591
  isDoubleWall: Y,
3581
3592
  isUnitConverted: false,
3582
3593
  formMeasurements: Ae,
3583
3594
  scanMeasurements: V,
3584
3595
  frontalHeight: (xt == null ? void 0 : xt.frontalHeight) ?? Qe,
3585
3596
  transverseML: _,
3586
- transverseAP: E,
3597
+ transverseAP: W,
3587
3598
  scanUrl: t,
3588
- decision: C,
3599
+ decision: v,
3589
3600
  userEnteredMeasurements: xt ?? void 0,
3590
3601
  screenshots: R
3591
3602
  });
3592
3603
  }, [
3593
- s,
3604
+ l,
3594
3605
  n,
3595
3606
  V,
3596
3607
  w,
@@ -3602,21 +3613,21 @@ let __tla = (async () => {
3602
3613
  xt,
3603
3614
  Qe,
3604
3615
  Ke
3605
- ]), On = j(() => {
3616
+ ]), $n = j(() => {
3606
3617
  if (!Ae || V.length === 0) return false;
3607
- const C = Math.min(Ae.length, V.length);
3608
- if (C === 0) return false;
3609
- for (let _ = 0; _ < C; _++) {
3610
- const E = Ae[_], R = V[_];
3611
- if (!R || E == null || E === 0) continue;
3618
+ const v = Math.min(Ae.length, V.length);
3619
+ if (v === 0) return false;
3620
+ for (let _ = 0; _ < v; _++) {
3621
+ const W = Ae[_], R = V[_];
3622
+ if (!R || W == null || W === 0) continue;
3612
3623
  const ge = R.modifiedValue ?? R.originalValue;
3613
- if (Math.abs(ge - E) > 7) return false;
3624
+ if (Math.abs(ge - W) > 7) return false;
3614
3625
  }
3615
3626
  return true;
3616
3627
  }, [
3617
3628
  Ae,
3618
3629
  V
3619
- ]), $n = Ot ? 5 : ee && Tt || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Hn = [
3630
+ ]), Hn = Ot ? 5 : ee && Tt || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Vn = [
3620
3631
  {
3621
3632
  label: "Load File",
3622
3633
  number: 1
@@ -3638,10 +3649,10 @@ let __tla = (async () => {
3638
3649
  number: 5
3639
3650
  }
3640
3651
  ];
3641
- return P(to.Provider, {
3652
+ return L(no.Provider, {
3642
3653
  value: e,
3643
3654
  children: [
3644
- P("div", {
3655
+ L("div", {
3645
3656
  style: {
3646
3657
  flex: 1,
3647
3658
  display: "flex",
@@ -3670,11 +3681,11 @@ let __tla = (async () => {
3670
3681
  }
3671
3682
  })
3672
3683
  }),
3673
- i(Io, {
3674
- steps: Hn,
3675
- currentStep: $n
3684
+ i(_o, {
3685
+ steps: Vn,
3686
+ currentStep: Hn
3676
3687
  }),
3677
- P("div", {
3688
+ L("div", {
3678
3689
  style: {
3679
3690
  flex: 1,
3680
3691
  display: "flex",
@@ -3682,7 +3693,7 @@ let __tla = (async () => {
3682
3693
  minHeight: 0
3683
3694
  },
3684
3695
  children: [
3685
- P("div", {
3696
+ L("div", {
3686
3697
  ref: St,
3687
3698
  style: {
3688
3699
  flex: 1,
@@ -3690,11 +3701,11 @@ let __tla = (async () => {
3690
3701
  minHeight: 0,
3691
3702
  overflow: "hidden"
3692
3703
  },
3693
- onDragOver: e.showDragDrop ? _n : void 0,
3694
- onDragLeave: e.showDragDrop ? Dn : void 0,
3695
- onDrop: e.showDragDrop ? Bn : void 0,
3704
+ onDragOver: e.showDragDrop ? Dn : void 0,
3705
+ onDragLeave: e.showDragDrop ? Bn : void 0,
3706
+ onDrop: e.showDragDrop ? Rn : void 0,
3696
3707
  children: [
3697
- e.showDragDrop && !n && !z && i("div", {
3708
+ e.showDragDrop && !n && !M && i("div", {
3698
3709
  style: {
3699
3710
  position: "absolute",
3700
3711
  inset: 16,
@@ -3713,7 +3724,7 @@ let __tla = (async () => {
3713
3724
  fontFamily: "system-ui, sans-serif"
3714
3725
  },
3715
3726
  children: "Drag & Drop Files Here"
3716
- }) : P("div", {
3727
+ }) : L("div", {
3717
3728
  style: {
3718
3729
  textAlign: "center"
3719
3730
  },
@@ -3743,7 +3754,7 @@ let __tla = (async () => {
3743
3754
  ]
3744
3755
  })
3745
3756
  }),
3746
- !e.showDragDrop && !n && !z && !ht && i("div", {
3757
+ !e.showDragDrop && !n && !M && !ht && i("div", {
3747
3758
  style: {
3748
3759
  position: "absolute",
3749
3760
  inset: 0,
@@ -3751,7 +3762,7 @@ let __tla = (async () => {
3751
3762
  alignItems: "center",
3752
3763
  justifyContent: "center"
3753
3764
  },
3754
- children: P("div", {
3765
+ children: L("div", {
3755
3766
  style: {
3756
3767
  textAlign: "center"
3757
3768
  },
@@ -3781,7 +3792,7 @@ let __tla = (async () => {
3781
3792
  ]
3782
3793
  })
3783
3794
  }),
3784
- n && !ee && T.length === 0 && P("div", {
3795
+ n && !ee && T.length === 0 && L("div", {
3785
3796
  style: {
3786
3797
  position: "absolute",
3787
3798
  top: 16,
@@ -3813,7 +3824,7 @@ let __tla = (async () => {
3813
3824
  w === "AK" ? "IT" : "MPT"
3814
3825
  ]
3815
3826
  }),
3816
- n && !ee && T.length === 1 && P("div", {
3827
+ n && !ee && T.length === 1 && L("div", {
3817
3828
  style: {
3818
3829
  position: "absolute",
3819
3830
  top: 16,
@@ -3844,17 +3855,17 @@ let __tla = (async () => {
3844
3855
  "Click mesh to set Origin"
3845
3856
  ]
3846
3857
  }),
3847
- z && i(en, {
3858
+ M && i(tn, {
3848
3859
  message: m || "Processing mesh..."
3849
3860
  }),
3850
- $ && i(en, {
3861
+ $ && i(tn, {
3851
3862
  message: U
3852
3863
  }),
3853
- ht && i(go, {
3864
+ ht && i(mo, {
3854
3865
  message: ht,
3855
3866
  onDismiss: () => Ie(null)
3856
3867
  }),
3857
- e.showAmputationModal && y && i("div", {
3868
+ e.showAmputationModal && b && i("div", {
3858
3869
  style: {
3859
3870
  position: "absolute",
3860
3871
  inset: 0,
@@ -3866,7 +3877,7 @@ let __tla = (async () => {
3866
3877
  justifyContent: "center",
3867
3878
  zIndex: 20
3868
3879
  },
3869
- children: P("div", {
3880
+ children: L("div", {
3870
3881
  style: {
3871
3882
  backgroundColor: "#fff",
3872
3883
  borderRadius: 4,
@@ -3875,7 +3886,7 @@ let __tla = (async () => {
3875
3886
  fontFamily: "system-ui, sans-serif"
3876
3887
  },
3877
3888
  children: [
3878
- P("div", {
3889
+ L("div", {
3879
3890
  style: {
3880
3891
  padding: "24px 24px 20px"
3881
3892
  },
@@ -3905,8 +3916,8 @@ let __tla = (async () => {
3905
3916
  children: [
3906
3917
  "AK",
3907
3918
  "BK"
3908
- ].map((C) => P("label", {
3909
- onClick: () => k(C),
3919
+ ].map((v) => L("label", {
3920
+ onClick: () => A(v),
3910
3921
  style: {
3911
3922
  flex: 1,
3912
3923
  display: "flex",
@@ -3915,16 +3926,16 @@ let __tla = (async () => {
3915
3926
  border: "2px solid",
3916
3927
  borderRadius: 4,
3917
3928
  cursor: "pointer",
3918
- borderColor: w === C ? "rgb(12, 67, 173)" : "#e0e0e0",
3919
- backgroundColor: w === C ? "rgba(12, 67, 173, 0.04)" : "#fff",
3929
+ borderColor: w === v ? "rgb(12, 67, 173)" : "#e0e0e0",
3930
+ backgroundColor: w === v ? "rgba(12, 67, 173, 0.04)" : "#fff",
3920
3931
  transition: "border-color 0.15s, background-color 0.15s"
3921
3932
  },
3922
3933
  children: [
3923
3934
  i("input", {
3924
3935
  type: "radio",
3925
3936
  name: "ampType",
3926
- checked: w === C,
3927
- onChange: () => k(C),
3937
+ checked: w === v,
3938
+ onChange: () => A(v),
3928
3939
  style: {
3929
3940
  accentColor: "rgb(12, 67, 173)",
3930
3941
  marginBottom: 12,
@@ -3939,24 +3950,24 @@ let __tla = (async () => {
3939
3950
  color: "rgba(0,0,0,0.87)",
3940
3951
  marginBottom: 4
3941
3952
  },
3942
- children: C
3953
+ children: v
3943
3954
  }),
3944
- P("span", {
3955
+ L("span", {
3945
3956
  style: {
3946
3957
  fontSize: 13,
3947
3958
  color: "rgba(0,0,0,0.54)"
3948
3959
  },
3949
3960
  children: [
3950
- C === "AK" ? "2" : "1",
3961
+ v === "AK" ? "2" : "1",
3951
3962
  "-inch measurement spacing"
3952
3963
  ]
3953
3964
  })
3954
3965
  ]
3955
- }, C))
3966
+ }, v))
3956
3967
  })
3957
3968
  ]
3958
3969
  }),
3959
- P("div", {
3970
+ L("div", {
3960
3971
  style: {
3961
3972
  display: "flex",
3962
3973
  justifyContent: "flex-end",
@@ -3967,7 +3978,7 @@ let __tla = (async () => {
3967
3978
  children: [
3968
3979
  i("button", {
3969
3980
  onClick: () => {
3970
- v(false), D(null);
3981
+ z(false), D(null);
3971
3982
  },
3972
3983
  style: {
3973
3984
  padding: "6px 16px",
@@ -3985,7 +3996,7 @@ let __tla = (async () => {
3985
3996
  children: "Cancel"
3986
3997
  }),
3987
3998
  i("button", {
3988
- onClick: () => w && Rn(w),
3999
+ onClick: () => w && Wn(w),
3989
4000
  disabled: !w,
3990
4001
  style: {
3991
4002
  padding: "6px 16px",
@@ -4017,8 +4028,8 @@ let __tla = (async () => {
4017
4028
  zIndex: 10
4018
4029
  }
4019
4030
  }),
4020
- i(ho, {
4021
- children: P(Kn, {
4031
+ i(go, {
4032
+ children: L(Un, {
4022
4033
  camera: {
4023
4034
  position: [
4024
4035
  0,
@@ -4065,24 +4076,24 @@ let __tla = (async () => {
4065
4076
  ],
4066
4077
  intensity: 0.2
4067
4078
  }),
4068
- n && S === "3D" && i(xo, {
4079
+ n && S === "3D" && i(yo, {
4069
4080
  mesh: n,
4070
4081
  maxPoints: 2,
4071
4082
  meshColor: $t,
4072
- meshOpacity: Be ? 0.3 : Fn,
4083
+ meshOpacity: Be ? 0.3 : Ln,
4073
4084
  frontFaceOnly: Z,
4074
4085
  doubleShellTransparency: Y && ee
4075
4086
  }),
4076
- n && S === "3D" && i(bo, {
4077
- modelSize: l,
4087
+ n && S === "3D" && i(wo, {
4088
+ modelSize: d,
4078
4089
  labels: [
4079
4090
  w === "AK" ? "IT" : "MPT",
4080
4091
  "Origin",
4081
4092
  "Cut Plane"
4082
4093
  ]
4083
4094
  }),
4084
- i(ko, {
4085
- modelSize: l,
4095
+ i(Fo, {
4096
+ modelSize: d,
4086
4097
  isAligned: ee,
4087
4098
  isCut: vt,
4088
4099
  mesh: n,
@@ -4092,58 +4103,58 @@ let __tla = (async () => {
4092
4103
  measurementGeometry: xe,
4093
4104
  resetCameraToFrontRef: wt
4094
4105
  }),
4095
- !ee && i(ln, {
4106
+ !ee && i(an, {
4096
4107
  enableDamping: false
4097
4108
  }),
4098
- ee && V.length > 0 && n && S === "3D" && i(Fo, {
4109
+ ee && V.length > 0 && n && S === "3D" && i(Lo, {
4099
4110
  mesh: n,
4100
- isDragging: vn
4111
+ isDragging: Cn
4101
4112
  }),
4102
4113
  n && ee && T.length >= 3 && (() => {
4103
4114
  const _ = n.geometry.getIndex();
4104
4115
  if (!_ || _.count < 30) return null;
4105
- const E = T[2], R = T[0], ge = Xe ?? E.position.y, G = ze ?? pt ?? R.position.y;
4106
- return S === "2D" ? i(_o, {
4107
- mesh: Gt ?? n,
4116
+ const W = T[2], R = T[0], ge = Xe ?? W.position.y, G = ze ?? pt ?? R.position.y;
4117
+ return S === "2D" ? i(Do, {
4118
+ mesh: Zt ?? n,
4108
4119
  upperY: G,
4109
4120
  originY: R.position.y,
4110
- modelSize: l,
4121
+ modelSize: d,
4111
4122
  meshColor: $t,
4112
- displayUnit: F
4113
- }) : P(Te, {
4123
+ displayUnit: k
4124
+ }) : L(Te, {
4114
4125
  children: [
4115
- i(zo, {
4116
- mesh: Gt ?? n,
4126
+ i(Ao, {
4127
+ mesh: Zt ?? n,
4117
4128
  startY: ge,
4118
4129
  endY: G,
4119
4130
  spacing: nt,
4120
- modelSize: l,
4131
+ modelSize: d,
4121
4132
  onMeasurementsChange: X,
4122
4133
  reverseOrder: true,
4123
- displayUnit: F,
4134
+ displayUnit: k,
4124
4135
  useInnerSurface: Y && !Z,
4125
4136
  formMeasurements: et ? Ae : void 0,
4126
4137
  originY: Bt ?? R.position.y,
4127
4138
  wasmSlices: Le
4128
4139
  }),
4129
- i(Ao, {
4140
+ i(ko, {
4130
4141
  mesh: n,
4131
4142
  greenY: R.position.y,
4132
- modelSize: l,
4133
- displayUnit: F,
4134
- bottomY: Y ? E.position.y : void 0
4143
+ modelSize: d,
4144
+ displayUnit: k,
4145
+ bottomY: Y ? W.position.y : void 0
4135
4146
  }),
4136
- i(Do, {
4147
+ i(Bo, {
4137
4148
  mesh: n,
4138
4149
  yPosition: Bt ?? R.position.y,
4139
4150
  onYChange: (K) => {
4140
- Cn(K), Pe(null);
4151
+ Mn(K), Pe(null);
4141
4152
  const te = K - R.position.y;
4142
4153
  _t((pt ?? R.position.y + nt * 2) + te);
4143
4154
  },
4144
4155
  minY: R.position.y - nt,
4145
4156
  maxY: R.position.y + nt,
4146
- modelSize: l,
4157
+ modelSize: d,
4147
4158
  color: "#44ff44",
4148
4159
  hoverColor: "#88ff88",
4149
4160
  dragColor: "#ffffff",
@@ -4154,12 +4165,12 @@ let __tla = (async () => {
4154
4165
  ]
4155
4166
  });
4156
4167
  })(),
4157
- n && ee && S === "3D" && Be && i(Jo, {
4168
+ n && ee && S === "3D" && Be && i(Qo, {
4158
4169
  mesh: n
4159
4170
  }),
4160
- n && e.showDebug && Be && S === "3D" && i(Uo, {
4171
+ n && e.showDebug && Be && S === "3D" && i(Jo, {
4161
4172
  mesh: n,
4162
- modelSize: l,
4173
+ modelSize: d,
4163
4174
  layers: Rt,
4164
4175
  landmarkPoints: T,
4165
4176
  componentDebug: null,
@@ -4167,16 +4178,16 @@ let __tla = (async () => {
4167
4178
  aoGeometry: H,
4168
4179
  measurementGeometry: xe
4169
4180
  }),
4170
- i(tr, {
4171
- screenshotFnRef: Pn,
4181
+ i(nr, {
4182
+ screenshotFnRef: In,
4172
4183
  mesh: n,
4173
- modelSize: l,
4184
+ modelSize: d,
4174
4185
  measurementGeometry: xe
4175
4186
  })
4176
4187
  ]
4177
4188
  })
4178
4189
  }),
4179
- n && P("div", {
4190
+ n && L("div", {
4180
4191
  style: {
4181
4192
  position: "absolute",
4182
4193
  top: 16,
@@ -4204,7 +4215,7 @@ let __tla = (async () => {
4204
4215
  children: "Start Over"
4205
4216
  }),
4206
4217
  !ee && T.length >= 1 && i("button", {
4207
- onClick: In,
4218
+ onClick: _n,
4208
4219
  style: {
4209
4220
  padding: "6px 16px",
4210
4221
  borderRadius: 4,
@@ -4222,15 +4233,15 @@ let __tla = (async () => {
4222
4233
  })
4223
4234
  ]
4224
4235
  }),
4225
- e.showDebug && Be && n && S === "3D" && i(qo, {
4236
+ e.showDebug && Be && n && S === "3D" && i(er, {
4226
4237
  layers: Rt,
4227
- onToggleLayer: (C) => zn((_) => ({
4238
+ onToggleLayer: (v) => An((_) => ({
4228
4239
  ..._,
4229
- [C]: !_[C]
4240
+ [v]: !_[v]
4230
4241
  })),
4231
4242
  isDoubleShell: Y
4232
4243
  }),
4233
- ee && V.length > 0 && P("div", {
4244
+ ee && V.length > 0 && L("div", {
4234
4245
  style: {
4235
4246
  position: "absolute",
4236
4247
  top: 16,
@@ -4240,7 +4251,7 @@ let __tla = (async () => {
4240
4251
  zIndex: 10
4241
4252
  },
4242
4253
  children: [
4243
- P("div", {
4254
+ L("div", {
4244
4255
  style: {
4245
4256
  display: "flex",
4246
4257
  borderRadius: 6,
@@ -4280,7 +4291,7 @@ let __tla = (async () => {
4280
4291
  })
4281
4292
  ]
4282
4293
  }),
4283
- P("div", {
4294
+ L("div", {
4284
4295
  style: {
4285
4296
  display: "flex",
4286
4297
  borderRadius: 6,
@@ -4294,9 +4305,9 @@ let __tla = (async () => {
4294
4305
  style: {
4295
4306
  padding: "6px 14px",
4296
4307
  fontSize: 13,
4297
- fontWeight: F === "mm" ? 600 : 400,
4298
- backgroundColor: F === "mm" ? "rgb(12, 67, 173)" : "#fff",
4299
- color: F === "mm" ? "#fff" : "#666",
4308
+ fontWeight: k === "mm" ? 600 : 400,
4309
+ backgroundColor: k === "mm" ? "rgb(12, 67, 173)" : "#fff",
4310
+ color: k === "mm" ? "#fff" : "#666",
4300
4311
  border: "none",
4301
4312
  cursor: "pointer",
4302
4313
  fontFamily: "system-ui, sans-serif"
@@ -4308,9 +4319,9 @@ let __tla = (async () => {
4308
4319
  style: {
4309
4320
  padding: "6px 14px",
4310
4321
  fontSize: 13,
4311
- fontWeight: F === "inch" ? 600 : 400,
4312
- backgroundColor: F === "inch" ? "rgb(12, 67, 173)" : "#fff",
4313
- color: F === "inch" ? "#fff" : "#666",
4322
+ fontWeight: k === "inch" ? 600 : 400,
4323
+ backgroundColor: k === "inch" ? "rgb(12, 67, 173)" : "#fff",
4324
+ color: k === "inch" ? "#fff" : "#666",
4314
4325
  border: "none",
4315
4326
  borderLeft: "1px solid #ccc",
4316
4327
  cursor: "pointer",
@@ -4320,7 +4331,7 @@ let __tla = (async () => {
4320
4331
  })
4321
4332
  ]
4322
4333
  }),
4323
- e.showSpacingToggle && S === "3D" && P("div", {
4334
+ e.showSpacingToggle && S === "3D" && L("div", {
4324
4335
  style: {
4325
4336
  display: "flex",
4326
4337
  borderRadius: 6,
@@ -4330,13 +4341,13 @@ let __tla = (async () => {
4330
4341
  },
4331
4342
  children: [
4332
4343
  i("button", {
4333
- onClick: () => L(1),
4344
+ onClick: () => P(1),
4334
4345
  style: {
4335
4346
  padding: "6px 14px",
4336
4347
  fontSize: 13,
4337
- fontWeight: A === 1 ? 600 : 400,
4338
- backgroundColor: A === 1 ? "rgb(12, 67, 173)" : "#fff",
4339
- color: A === 1 ? "#fff" : "#666",
4348
+ fontWeight: F === 1 ? 600 : 400,
4349
+ backgroundColor: F === 1 ? "rgb(12, 67, 173)" : "#fff",
4350
+ color: F === 1 ? "#fff" : "#666",
4340
4351
  border: "none",
4341
4352
  cursor: "pointer",
4342
4353
  fontFamily: "system-ui, sans-serif"
@@ -4344,13 +4355,13 @@ let __tla = (async () => {
4344
4355
  children: '1"'
4345
4356
  }),
4346
4357
  i("button", {
4347
- onClick: () => L(2),
4358
+ onClick: () => P(2),
4348
4359
  style: {
4349
4360
  padding: "6px 14px",
4350
4361
  fontSize: 13,
4351
- fontWeight: A === 2 ? 600 : 400,
4352
- backgroundColor: A === 2 ? "rgb(12, 67, 173)" : "#fff",
4353
- color: A === 2 ? "#fff" : "#666",
4362
+ fontWeight: F === 2 ? 600 : 400,
4363
+ backgroundColor: F === 2 ? "rgb(12, 67, 173)" : "#fff",
4364
+ color: F === 2 ? "#fff" : "#666",
4354
4365
  border: "none",
4355
4366
  borderLeft: "1px solid #ccc",
4356
4367
  cursor: "pointer",
@@ -4369,7 +4380,7 @@ let __tla = (async () => {
4369
4380
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4370
4381
  },
4371
4382
  children: i("button", {
4372
- onClick: () => Et((C) => !C),
4383
+ onClick: () => Et((v) => !v),
4373
4384
  style: {
4374
4385
  padding: "6px 14px",
4375
4386
  fontSize: 13,
@@ -4393,13 +4404,13 @@ let __tla = (async () => {
4393
4404
  },
4394
4405
  children: i("button", {
4395
4406
  onClick: async () => {
4396
- const C = await Ke();
4397
- if (!C) return;
4398
- const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), E = (R, ge) => {
4407
+ const v = await Ke();
4408
+ if (!v) return;
4409
+ const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), W = (R, ge) => {
4399
4410
  const G = document.createElement("a");
4400
4411
  G.href = R, G.download = ge, G.click();
4401
4412
  };
4402
- E(C.frontal_view_png, `measurements_front_${_}.png`), await new Promise((R) => setTimeout(R, 300)), E(C.side_view_png, `measurements_transverse_${_}.png`);
4413
+ W(v.frontal_view_png, `measurements_front_${_}.png`), await new Promise((R) => setTimeout(R, 300)), W(v.side_view_png, `measurements_transverse_${_}.png`);
4403
4414
  },
4404
4415
  style: {
4405
4416
  padding: "6px 14px",
@@ -4414,7 +4425,7 @@ let __tla = (async () => {
4414
4425
  children: "Save"
4415
4426
  })
4416
4427
  }),
4417
- e.showDebug && d && i("div", {
4428
+ e.showDebug && s && i("div", {
4418
4429
  style: {
4419
4430
  display: "flex",
4420
4431
  borderRadius: 6,
@@ -4423,7 +4434,7 @@ let __tla = (async () => {
4423
4434
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4424
4435
  },
4425
4436
  children: i("button", {
4426
- onClick: () => Mn((C) => !C),
4437
+ onClick: () => zn((v) => !v),
4427
4438
  style: {
4428
4439
  padding: "6px 14px",
4429
4440
  fontSize: 13,
@@ -4439,17 +4450,17 @@ let __tla = (async () => {
4439
4450
  })
4440
4451
  ]
4441
4452
  }),
4442
- n && ie && i(Lo, {
4453
+ n && ie && i(Po, {
4443
4454
  wasAutoScaled: ae,
4444
4455
  onDismiss: () => J(false)
4445
4456
  }),
4446
- n && we && ee && i(Po, {
4457
+ n && we && ee && i(Io, {
4447
4458
  isDoubleShell: Y,
4448
4459
  onDismiss: () => oe(false)
4449
4460
  })
4450
4461
  ]
4451
4462
  }),
4452
- P("div", {
4463
+ L("div", {
4453
4464
  style: {
4454
4465
  padding: "12px 24px",
4455
4466
  backgroundColor: "#fff",
@@ -4462,7 +4473,7 @@ let __tla = (async () => {
4462
4473
  },
4463
4474
  children: [
4464
4475
  n && !ee && T.length >= 2 && i("button", {
4465
- onClick: Wn,
4476
+ onClick: En,
4466
4477
  style: {
4467
4478
  padding: "6px 16px",
4468
4479
  borderRadius: 4,
@@ -4478,7 +4489,7 @@ let __tla = (async () => {
4478
4489
  },
4479
4490
  children: "Next \xBB"
4480
4491
  }),
4481
- ee && Ot && (On ? i("button", {
4492
+ ee && Ot && ($n ? i("button", {
4482
4493
  onClick: () => Mt("continue"),
4483
4494
  style: {
4484
4495
  padding: "6px 16px",
@@ -4494,7 +4505,7 @@ let __tla = (async () => {
4494
4505
  lineHeight: "36px"
4495
4506
  },
4496
4507
  children: "Continue"
4497
- }) : P(Te, {
4508
+ }) : L(Te, {
4498
4509
  children: [
4499
4510
  i("button", {
4500
4511
  onClick: () => Mt("use_form_measurements"),
@@ -4536,7 +4547,7 @@ let __tla = (async () => {
4536
4547
  })
4537
4548
  ]
4538
4549
  }),
4539
- d && yt.length > 0 && P("div", {
4550
+ s && yt.length > 0 && L("div", {
4540
4551
  style: {
4541
4552
  height: 120,
4542
4553
  flexShrink: 0,
@@ -4549,7 +4560,7 @@ let __tla = (async () => {
4549
4560
  flexDirection: "column"
4550
4561
  },
4551
4562
  children: [
4552
- P("div", {
4563
+ L("div", {
4553
4564
  style: {
4554
4565
  display: "flex",
4555
4566
  alignItems: "center",
@@ -4569,14 +4580,14 @@ let __tla = (async () => {
4569
4580
  },
4570
4581
  children: "GALILEO DEBUG"
4571
4582
  }),
4572
- P("div", {
4583
+ L("div", {
4573
4584
  style: {
4574
4585
  display: "flex",
4575
4586
  gap: 8,
4576
4587
  alignItems: "center"
4577
4588
  },
4578
4589
  children: [
4579
- P("span", {
4590
+ L("span", {
4580
4591
  style: {
4581
4592
  color: "#484f58",
4582
4593
  fontSize: 9
@@ -4618,14 +4629,14 @@ let __tla = (async () => {
4618
4629
  padding: "4px 10px",
4619
4630
  lineHeight: 1.6
4620
4631
  },
4621
- children: yt.map((C, _) => {
4622
- const E = C.includes("ERROR") || C.includes("failed"), R = C.includes("warning") || C.includes("WARN"), ge = C.includes("PIPELINE:"), G = C.includes("STATE:");
4632
+ children: yt.map((v, _) => {
4633
+ const W = v.includes("ERROR") || v.includes("failed"), R = v.includes("warning") || v.includes("WARN"), ge = v.includes("PIPELINE:"), G = v.includes("STATE:");
4623
4634
  return i("div", {
4624
4635
  style: {
4625
- color: E ? "#f85149" : R ? "#d29922" : ge ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
4636
+ color: W ? "#f85149" : R ? "#d29922" : ge ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
4626
4637
  whiteSpace: "pre"
4627
4638
  },
4628
- children: C
4639
+ children: v
4629
4640
  }, _);
4630
4641
  })
4631
4642
  })
@@ -4633,25 +4644,25 @@ let __tla = (async () => {
4633
4644
  })
4634
4645
  ]
4635
4646
  }),
4636
- ee && Tt && w && i(To, {
4647
+ ee && Tt && w && i(Oo, {
4637
4648
  amputationType: w,
4638
- spacingInches: A,
4649
+ spacingInches: F,
4639
4650
  scanMeasurements: V,
4640
4651
  scanFrontalHeight: Qe,
4641
- onSave: En,
4642
- onSkip: Tn
4652
+ onSave: Tn,
4653
+ onSkip: On
4643
4654
  })
4644
4655
  ]
4645
4656
  });
4646
4657
  };
4647
- function tr({ screenshotFnRef: e }) {
4658
+ function nr({ screenshotFnRef: e }) {
4648
4659
  return ne(() => {
4649
4660
  e.current = null;
4650
4661
  }, [
4651
4662
  e
4652
4663
  ]), null;
4653
4664
  }
4654
- wn = function(e) {
4665
+ Sn = function(e) {
4655
4666
  const r = e === "AK" ? 2 : 1, t = [];
4656
4667
  for (let o = 2; o >= 1; o -= r) t.push(`${o}_above`);
4657
4668
  t.push("at_ref");
@@ -4671,116 +4682,85 @@ let __tla = (async () => {
4671
4682
  return t;
4672
4683
  };
4673
4684
  lt = function(e, r) {
4674
- const t = wn(r), o = {};
4675
- for (let s = 0; s < Math.min(e.length, t.length); s++) {
4676
- const d = e[s];
4677
- d != null && !isNaN(d) && (o[t[s]] = d);
4685
+ const t = Sn(r), o = {};
4686
+ for (let l = 0; l < Math.min(e.length, t.length); l++) {
4687
+ const s = e[l];
4688
+ s != null && !isNaN(s) && (o[t[l]] = s);
4678
4689
  }
4679
4690
  return o;
4680
4691
  };
4681
- nr = function(e, r) {
4692
+ or = function(e, r) {
4682
4693
  if (!e) return;
4683
- const o = wn(r).map((s) => {
4684
- const d = e[s];
4685
- return d ?? void 0;
4694
+ const o = Sn(r).map((l) => {
4695
+ const s = e[l];
4696
+ return s ?? void 0;
4686
4697
  });
4687
- if (!o.every((s) => s == null)) return o;
4698
+ if (!o.every((l) => l == null)) return o;
4688
4699
  };
4689
- pr = ({ request: e, onComplete: r, wasmModule: t }) => {
4690
- const [o, s] = W(null), [d, c] = W(t !== void 0);
4691
- ne(() => {
4692
- if (t !== void 0) {
4693
- c(true);
4694
- return;
4695
- }
4696
- let l = false;
4697
- return import("geo-wasm").then(async (m) => {
4698
- await m.__tla;
4699
- return m;
4700
- }).then(async (f) => {
4701
- await f.default(), l || (s(f), c(true));
4702
- }).catch(() => {
4703
- l || c(true);
4704
- }), () => {
4705
- l = true;
4706
- };
4707
- }, [
4708
- t
4709
- ]);
4710
- const a = t !== void 0 ? t : o, n = j(() => nr(e.form_measurements, e.spacing_type), [
4700
+ hr = ({ request: e, onComplete: r, wasmModule: t }) => {
4701
+ const o = j(() => or(e.form_measurements, e.spacing_type), [
4711
4702
  e.form_measurements,
4712
4703
  e.spacing_type
4713
- ]), h = (l) => {
4704
+ ]), l = (s) => {
4714
4705
  var _a, _b;
4715
- const f = l.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), p = lt(f, e.spacing_type);
4716
- let g, z;
4717
- if (l.formMeasurements) {
4718
- g = lt(l.formMeasurements, e.spacing_type);
4719
- const A = l.scanMeasurements.map((L, y) => {
4706
+ const c = s.scanMeasurements.map((f) => +(f.modifiedValue ?? f.originalValue).toFixed(1)), a = lt(c, e.spacing_type);
4707
+ let n, h;
4708
+ if (s.formMeasurements) {
4709
+ n = lt(s.formMeasurements, e.spacing_type);
4710
+ const f = s.scanMeasurements.map((m, x) => {
4720
4711
  var _a2;
4721
- const v = (_a2 = l.formMeasurements) == null ? void 0 : _a2[y];
4722
- return v == null || isNaN(v) ? null : +((L.modifiedValue ?? L.originalValue) - v).toFixed(1);
4712
+ const S = (_a2 = s.formMeasurements) == null ? void 0 : _a2[x];
4713
+ return S == null || isNaN(S) ? null : +((m.modifiedValue ?? m.originalValue) - S).toFixed(1);
4723
4714
  });
4724
- z = lt(A, e.spacing_type);
4715
+ h = lt(f, e.spacing_type);
4725
4716
  }
4726
- const u = l.userEnteredMeasurements ? lt(l.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, m = l.decision === "use_scan" || l.decision === "continue", x = m ? p : u ?? g ?? p, S = m ? +l.frontalHeight.toFixed(1) : +(((_a = l.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? l.frontalHeight).toFixed(1), I = {
4717
+ const d = s.userEnteredMeasurements ? lt(s.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, u = s.decision === "use_scan" || s.decision === "continue", p = u ? a : d ?? n ?? a, g = u ? +s.frontalHeight.toFixed(1) : +(((_a = s.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? s.frontalHeight).toFixed(1), M = {
4727
4718
  spacing_type: e.spacing_type,
4728
4719
  source_unit: "mm",
4729
- file_format: l.fileFormat,
4730
- measurement_source: l.formMeasurements ? "form_provided" : "scan_derived",
4731
- is_double_wall: l.isDoubleWall,
4720
+ file_format: s.fileFormat,
4721
+ measurement_source: s.formMeasurements ? "form_provided" : "scan_derived",
4722
+ is_double_wall: s.isDoubleWall,
4732
4723
  is_unit_converted: false,
4733
- form_measurements: g,
4734
- scan_measurements: p,
4735
- measurement_variance: z,
4724
+ form_measurements: n,
4725
+ scan_measurements: a,
4726
+ measurement_variance: h,
4736
4727
  scan_url: e.scan_url,
4737
- frontal_height: +l.frontalHeight.toFixed(1),
4738
- transverse_ml: +l.transverseML.toFixed(1),
4739
- transverse_ap: +l.transverseAP.toFixed(1),
4740
- decision: l.decision,
4741
- skip_reason: l.skipReason,
4742
- user_measurements: u,
4743
- user_frontal_height: (_b = l.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
4744
- final_measurements: x,
4745
- final_frontal_height: S,
4746
- final_transverse_ml: +l.transverseML.toFixed(1),
4747
- final_transverse_ap: +l.transverseAP.toFixed(1),
4748
- screenshots: l.screenshots
4728
+ frontal_height: +s.frontalHeight.toFixed(1),
4729
+ transverse_ml: +s.transverseML.toFixed(1),
4730
+ transverse_ap: +s.transverseAP.toFixed(1),
4731
+ decision: s.decision,
4732
+ skip_reason: s.skipReason,
4733
+ user_measurements: d,
4734
+ user_frontal_height: (_b = s.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
4735
+ final_measurements: p,
4736
+ final_frontal_height: g,
4737
+ final_transverse_ml: +s.transverseML.toFixed(1),
4738
+ final_transverse_ap: +s.transverseAP.toFixed(1),
4739
+ screenshots: s.screenshots
4749
4740
  };
4750
- r == null ? void 0 : r(I);
4741
+ r == null ? void 0 : r(M);
4751
4742
  };
4752
- return d ? i("div", {
4743
+ return i("div", {
4753
4744
  style: {
4754
4745
  width: "100%",
4755
4746
  height: "100%",
4756
4747
  display: "flex"
4757
4748
  },
4758
- children: i(er, {
4759
- config: eo,
4749
+ children: i(tr, {
4750
+ config: to,
4760
4751
  spacingType: e.spacing_type,
4761
4752
  scanUrl: e.scan_url,
4762
- formMeasurements: n,
4763
- onComplete: h,
4764
- wasmModule: a
4765
- })
4766
- }) : i("div", {
4767
- style: {
4768
- width: "100%",
4769
- height: "100%",
4770
- display: "flex",
4771
- alignItems: "center",
4772
- justifyContent: "center"
4773
- },
4774
- children: i("span", {
4775
- children: "Initializing..."
4753
+ formMeasurements: o,
4754
+ onComplete: l,
4755
+ wasmModule: t
4776
4756
  })
4777
4757
  });
4778
4758
  };
4779
4759
  })();
4780
4760
  export {
4781
- pr as G,
4761
+ hr as G,
4782
4762
  __tla,
4783
4763
  lt as a,
4784
- nr as c,
4785
- wn as g
4764
+ or as c,
4765
+ Sn as g
4786
4766
  };