@solid-labs/fab-one-widget 1.0.2 → 1.0.4

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,14 +1,14 @@
1
- import { jsxs as k, jsx as i, Fragment as He } from "react/jsx-runtime";
2
- import { createContext as oo, Component as ro, useCallback as J, useMemo as H, useState as B, memo as io, useEffect as Q, useRef as le, forwardRef as so, createElement as sn } from "react";
1
+ import { jsxs as F, jsx as i, Fragment as He } from "react/jsx-runtime";
2
+ import { createContext as oo, Component as ro, useCallback as Q, useMemo as H, useState as B, memo as io, useEffect as K, useRef as le, forwardRef as so, createElement as sn } from "react";
3
3
  import { useFrame as hn, useThree as gn, Canvas as lo } from "@react-three/fiber";
4
4
  import { Html as Ze, Line as de, OrbitControls as mn } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as yt, Vector3 as C, Box3 as xn, Line3 as bn, Raycaster as ao } from "three";
6
+ import { Plane as yt, Vector3 as M, Box3 as xn, Line3 as bn, Raycaster as ao } from "three";
7
7
  import { create as co } from "zustand";
8
8
  import { OBJLoader as yn } from "three/examples/jsm/loaders/OBJLoader.js";
9
9
  import { STLLoader as fo } from "three/examples/jsm/loaders/STLLoader.js";
10
10
  import { MeshBVH as wt } from "three-mesh-bvh";
11
- let Ar, mt, mr, Ln;
11
+ let kr, mt, mr, Ln;
12
12
  let __tla = (async () => {
13
13
  const uo = {
14
14
  showDragDrop: true,
@@ -28,38 +28,38 @@ let __tla = (async () => {
28
28
  showNavigation: false,
29
29
  showToolbar: false,
30
30
  showSaveButton: false
31
- }, ho = oo(uo), Ht = co((e, r) => ({
31
+ }, ho = oo(uo), Ht = co((t, r) => ({
32
32
  landmarkPoints: [],
33
33
  isAligned: false,
34
34
  isCut: false,
35
- addLandmarkPoint: (t) => e((o) => o.landmarkPoints.length >= 3 ? o : {
35
+ addLandmarkPoint: (n) => t((o) => o.landmarkPoints.length >= 3 ? o : {
36
36
  landmarkPoints: [
37
37
  ...o.landmarkPoints,
38
- t
38
+ n
39
39
  ]
40
40
  }),
41
- removeLandmarkPoint: (t) => e((o) => ({
42
- landmarkPoints: o.landmarkPoints.filter((l, s) => s !== t)
41
+ removeLandmarkPoint: (n) => t((o) => ({
42
+ landmarkPoints: o.landmarkPoints.filter((s, a) => a !== n)
43
43
  })),
44
- clearLandmarkPoints: () => e({
44
+ clearLandmarkPoints: () => t({
45
45
  landmarkPoints: [],
46
46
  isAligned: false,
47
47
  isCut: false
48
48
  }),
49
- updateLandmarkPositions: (t) => e((o) => ({
50
- landmarkPoints: o.landmarkPoints.map((l, s) => ({
51
- ...l,
52
- position: t[s] ?? l.position
49
+ updateLandmarkPositions: (n) => t((o) => ({
50
+ landmarkPoints: o.landmarkPoints.map((s, a) => ({
51
+ ...s,
52
+ position: n[a] ?? s.position
53
53
  }))
54
54
  })),
55
- setAligned: (t) => e({
56
- isAligned: t
55
+ setAligned: (n) => t({
56
+ isAligned: n
57
57
  }),
58
- setCut: (t) => e({
59
- isCut: t
58
+ setCut: (n) => t({
59
+ isCut: n
60
60
  }),
61
61
  isSelectionComplete: () => r().landmarkPoints.length === 3,
62
- reset: () => e({
62
+ reset: () => t({
63
63
  landmarkPoints: [],
64
64
  isAligned: false,
65
65
  isCut: false
@@ -70,48 +70,48 @@ let __tla = (async () => {
70
70
  0.5,
71
71
  -0.5
72
72
  ];
73
- function xo(e) {
73
+ function xo(t) {
74
74
  var _a;
75
- const r = e.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
75
+ const r = t.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
76
76
  if (!r || !((_a = r[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
77
- const t = e.split(`
78
- `), o = [], l = [];
79
- let s = false;
80
- for (const c of t) if (c.startsWith("v ")) {
81
- const a = c.trim().split(/\s+/);
82
- if (a.length >= 7) {
83
- o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3]));
84
- let n = parseFloat(a[4]), m = parseFloat(a[5]), d = parseFloat(a[6]);
85
- (n > 1 || m > 1 || d > 1) && (n /= 255, m /= 255, d /= 255), l.push(n, m, d), s = true;
86
- } else a.length >= 4 && (o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), l.push(0, 0, 0));
77
+ const n = t.split(`
78
+ `), o = [], s = [];
79
+ let a = false;
80
+ for (const c of n) if (c.startsWith("v ")) {
81
+ const l = c.trim().split(/\s+/);
82
+ if (l.length >= 7) {
83
+ o.push(parseFloat(l[1]), parseFloat(l[2]), parseFloat(l[3]));
84
+ let e = parseFloat(l[4]), m = parseFloat(l[5]), d = parseFloat(l[6]);
85
+ (e > 1 || m > 1 || d > 1) && (e /= 255, m /= 255, d /= 255), s.push(e, m, d), a = true;
86
+ } else l.length >= 4 && (o.push(parseFloat(l[1]), parseFloat(l[2]), parseFloat(l[3])), s.push(0, 0, 0));
87
87
  }
88
- return s ? {
88
+ return a ? {
89
89
  positions: new Float32Array(o),
90
- colors: new Float32Array(l)
90
+ colors: new Float32Array(s)
91
91
  } : null;
92
92
  }
93
- function bo(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, m = 1 / 0, d = 1 / 0, f = -1 / 0, u = -1 / 0, x = -1 / 0;
96
- for (let _ = 0; _ < a; _++) {
93
+ function bo(t, r, n, o) {
94
+ const s = t.getAttribute("position"), a = s.count, c = new Float32Array(a * 3), l = r.length / 3;
95
+ let e = 1 / 0, m = 1 / 0, d = 1 / 0, f = -1 / 0, u = -1 / 0, x = -1 / 0;
96
+ for (let _ = 0; _ < l; _++) {
97
97
  const E = r[_ * 3] * o, V = r[_ * 3 + 1] * o, Y = r[_ * 3 + 2] * o;
98
- E < n && (n = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), Y < d && (d = Y), Y > x && (x = Y);
98
+ E < e && (e = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), Y < d && (d = Y), Y > x && (x = Y);
99
99
  }
100
- const S = (n + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - n + 1e-6, A = u - m + 1e-6, L = x - d + 1e-6, z = b * 0.5, P = A * 0.5, w = L * 0.5, M = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), h = b / M, v = A / M, F = L / M, I = /* @__PURE__ */ new Map();
101
- for (let _ = 0; _ < a; _++) {
102
- const E = r[_ * 3] * o - S, V = r[_ * 3 + 1] * o - p, Y = r[_ * 3 + 2] * o - g, q = Math.min(M - 1, Math.max(0, Math.floor((E + z) / h))), ye = Math.min(M - 1, Math.max(0, Math.floor((V + P) / v))), ae = Math.min(M - 1, Math.max(0, Math.floor((Y + w) / F))), fe = q * M * M + ye * M + ae;
100
+ const S = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, A = u - m + 1e-6, L = x - d + 1e-6, v = b * 0.5, k = A * 0.5, w = L * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(l)))), h = b / z, C = A / z, P = L / z, I = /* @__PURE__ */ new Map();
101
+ for (let _ = 0; _ < l; _++) {
102
+ const E = r[_ * 3] * o - S, V = r[_ * 3 + 1] * o - p, Y = r[_ * 3 + 2] * o - g, q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) / P))), fe = q * z * z + ye * z + ae;
103
103
  let ie = I.get(fe);
104
104
  ie || (ie = [], I.set(fe, ie)), ie.push(_);
105
105
  }
106
- for (let _ = 0; _ < s; _++) {
107
- const E = l.getX(_), V = l.getY(_), Y = l.getZ(_), q = Math.min(M - 1, Math.max(0, Math.floor((E + z) / h))), ye = Math.min(M - 1, Math.max(0, Math.floor((V + P) / v))), ae = Math.min(M - 1, Math.max(0, Math.floor((Y + w) / F)));
106
+ for (let _ = 0; _ < a; _++) {
107
+ const E = s.getX(_), V = s.getY(_), Y = s.getZ(_), q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) / P)));
108
108
  let fe = 1 / 0, ie = 0;
109
- for (let ee = 0; ee <= M && fe > 0; ee++) {
109
+ for (let ee = 0; ee <= z && fe > 0; ee++) {
110
110
  for (let X = -ee; X <= ee; X++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
111
111
  if (ee > 0 && Math.abs(X) < ee && Math.abs(ue) < ee && Math.abs(Z) < ee) continue;
112
112
  const pe = q + X, me = ye + ue, he = ae + Z;
113
- if (pe < 0 || pe >= M || me < 0 || me >= M || he < 0 || he >= M) continue;
114
- const $ = I.get(pe * M * M + me * M + he);
113
+ if (pe < 0 || pe >= z || me < 0 || me >= z || he < 0 || he >= z) continue;
114
+ const $ = I.get(pe * z * z + me * z + he);
115
115
  if ($) for (const ne of $) {
116
116
  const xe = r[ne * 3] * o - S, Se = r[ne * 3 + 1] * o - p, we = r[ne * 3 + 2] * o - g, re = (E - xe) ** 2 + (V - Se) ** 2 + (Y - we) ** 2;
117
117
  re < fe && (fe = re, ie = ne);
@@ -119,9 +119,9 @@ let __tla = (async () => {
119
119
  }
120
120
  if (fe < 1 / 0) break;
121
121
  }
122
- c[_ * 3] = t[ie * 3], c[_ * 3 + 1] = t[ie * 3 + 1], c[_ * 3 + 2] = t[ie * 3 + 2];
122
+ c[_ * 3] = n[ie * 3], c[_ * 3 + 1] = n[ie * 3 + 1], c[_ * 3 + 2] = n[ie * 3 + 2];
123
123
  }
124
- e.setAttribute("color", new O.Float32BufferAttribute(c, 3));
124
+ t.setAttribute("color", new O.Float32BufferAttribute(c, 3));
125
125
  }
126
126
  const ln = {
127
127
  debug: 0,
@@ -131,86 +131,86 @@ let __tla = (async () => {
131
131
  };
132
132
  let wn = "warn", Sn = null;
133
133
  const ce = {
134
- setLevel(e) {
135
- wn = e;
134
+ setLevel(t) {
135
+ wn = t;
136
136
  },
137
- setHandler(e) {
138
- Sn = e;
137
+ setHandler(t) {
138
+ Sn = t;
139
139
  },
140
- debug(e, r, t) {
141
- ht("debug", e, r, t);
140
+ debug(t, r, n) {
141
+ ht("debug", t, r, n);
142
142
  },
143
- info(e, r, t) {
144
- ht("info", e, r, t);
143
+ info(t, r, n) {
144
+ ht("info", t, r, n);
145
145
  },
146
- warn(e, r, t) {
147
- ht("warn", e, r, t);
146
+ warn(t, r, n) {
147
+ ht("warn", t, r, n);
148
148
  },
149
- error(e, r, t) {
150
- ht("error", e, r, t);
149
+ error(t, r, n) {
150
+ ht("error", t, r, n);
151
151
  }
152
152
  };
153
- function ht(e, r, t, o) {
154
- if (ln[e] < ln[wn]) return;
155
- const l = `[${r}]`, s = o !== void 0 ? [
156
- l,
157
- t,
153
+ function ht(t, r, n, o) {
154
+ if (ln[t] < ln[wn]) return;
155
+ const s = `[${r}]`, a = o !== void 0 ? [
156
+ s,
157
+ n,
158
158
  o
159
159
  ] : [
160
- l,
161
- t
160
+ s,
161
+ n
162
162
  ];
163
- switch (e) {
163
+ switch (t) {
164
164
  case "debug":
165
- console.debug(...s);
165
+ console.debug(...a);
166
166
  break;
167
167
  case "info":
168
- console.log(...s);
168
+ console.log(...a);
169
169
  break;
170
170
  case "warn":
171
- console.warn(...s);
171
+ console.warn(...a);
172
172
  break;
173
173
  case "error":
174
- console.error(...s);
174
+ console.error(...a);
175
175
  break;
176
176
  }
177
- Sn == null ? void 0 : Sn(e, r, t, o);
177
+ Sn == null ? void 0 : Sn(t, r, n, o);
178
178
  }
179
- function bt(e) {
180
- const r = e.getAttribute("position"), t = new Float32Array(r.array), o = e.getIndex();
179
+ function bt(t) {
180
+ const r = t.getAttribute("position"), n = new Float32Array(r.array), o = t.getIndex();
181
181
  if (o) return {
182
- positions: t,
182
+ positions: n,
183
183
  indices: new Uint32Array(o.array)
184
184
  };
185
- const l = t.length / 3, s = new Uint32Array(l);
186
- for (let c = 0; c < l; c++) s[c] = c;
185
+ const s = n.length / 3, a = new Uint32Array(s);
186
+ for (let c = 0; c < s; c++) a[c] = c;
187
187
  return {
188
- positions: t,
189
- indices: s
188
+ positions: n,
189
+ indices: a
190
190
  };
191
191
  }
192
- function vn(e, r) {
193
- const t = new O.BufferGeometry();
194
- return t.setAttribute("position", new O.Float32BufferAttribute(e, 3)), t.setIndex(new O.BufferAttribute(r, 1)), t.computeVertexNormals(), t;
192
+ function vn(t, r) {
193
+ const n = new O.BufferGeometry();
194
+ return n.setAttribute("position", new O.Float32BufferAttribute(t, 3)), n.setIndex(new O.BufferAttribute(r, 1)), n.computeVertexNormals(), n;
195
195
  }
196
- async function yo(e, r, t) {
196
+ async function yo(t, r, n) {
197
197
  try {
198
- const o = xo(e);
199
- t == null ? void 0 : t("Parsing mesh...");
200
- const s = new yn().parse(e);
198
+ const o = xo(t);
199
+ n == null ? void 0 : n("Parsing mesh...");
200
+ const a = new yn().parse(t);
201
201
  let c = null;
202
- if (s.traverse((b) => {
202
+ if (a.traverse((b) => {
203
203
  b.isMesh && !c && (c = b.geometry);
204
204
  }), !c) return null;
205
- const { positions: a, indices: n } = bt(c);
206
- if (a.length < 9 || n.length < 3) return ce.warn("wasm", `Mesh too small: positions=${a.length} indices=${n.length}`), null;
207
- for (let b = 0; b < Math.min(a.length, 300); b++) if (!isFinite(a[b])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
208
- const m = a.length / 3;
209
- for (let b = 0; b < Math.min(n.length, 300); b++) if (n[b] >= m) return ce.error("wasm", `Out-of-bounds index: ${n[b]} >= ${m}`), null;
210
- t == null ? void 0 : t("Processing mesh (WASM)...");
211
- const d = r.preprocess_mesh(a, n, 10, 1e-4, 500), f = d.positions(), u = d.indices(), x = d.unit_converted(), S = d.detected_unit(), p = d.log();
205
+ const { positions: l, indices: e } = bt(c);
206
+ if (l.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
207
+ for (let b = 0; b < Math.min(l.length, 300); b++) if (!isFinite(l[b])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
208
+ const m = l.length / 3;
209
+ for (let b = 0; b < Math.min(e.length, 300); b++) if (e[b] >= m) return ce.error("wasm", `Out-of-bounds index: ${e[b]} >= ${m}`), null;
210
+ n == null ? void 0 : n("Processing mesh (WASM)...");
211
+ const d = r.preprocess_mesh(l, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), x = d.unit_converted(), S = d.detected_unit(), p = d.log();
212
212
  if (ce.debug("wasm", "preprocess result", p), f.length === 0) return null;
213
- t == null ? void 0 : t("Building geometry...");
213
+ n == null ? void 0 : n("Building geometry...");
214
214
  const g = vn(f, u);
215
215
  if (o) {
216
216
  const b = x ? 1e3 : 1;
@@ -226,78 +226,78 @@ let __tla = (async () => {
226
226
  return ce.error("wasm", "Processing failed", o), null;
227
227
  }
228
228
  }
229
- function wo(e) {
230
- const t = new yn().parse(e);
229
+ function wo(t) {
230
+ const n = new yn().parse(t);
231
231
  let o = null;
232
- return t.traverse((l) => {
233
- l.isMesh && !o && (o = l.geometry);
232
+ return n.traverse((s) => {
233
+ s.isMesh && !o && (o = s.geometry);
234
234
  }), o;
235
235
  }
236
- async function Tt(e) {
237
- const r = await e.arrayBuffer(), l = new fo().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(`
236
+ async function Tt(t) {
237
+ const r = await t.arrayBuffer(), s = new fo().parse(r).getAttribute("position");
238
+ if (!s || s.count === 0) throw new Error("Empty STL geometry");
239
+ const a = [];
240
+ for (let c = 0; c < s.count; c++) a.push(`v ${s.getX(c)} ${s.getY(c)} ${s.getZ(c)}`);
241
+ for (let c = 0; c < s.count; c += 3) a.push(`f ${c + 1} ${c + 2} ${c + 3}`);
242
+ return a.join(`
243
243
  `);
244
244
  }
245
- function So(e, r) {
246
- const t = 1 / r;
247
- return `${Math.round(e.x * t)}_${Math.round(e.y * t)}_${Math.round(e.z * t)}`;
245
+ function So(t, r) {
246
+ const n = 1 / r;
247
+ return `${Math.round(t.x * n)}_${Math.round(t.y * n)}_${Math.round(t.z * n)}`;
248
248
  }
249
- function vo(e, r) {
250
- if (!e.length) return [];
251
- const t = [];
252
- for (const o of e) (t.length === 0 || t[t.length - 1].distanceTo(o) > r) && t.push(o.clone());
253
- return t.length > 2 && t[0].distanceTo(t[t.length - 1]) > r && t.push(t[0].clone()), t;
249
+ function vo(t, r) {
250
+ if (!t.length) return [];
251
+ const n = [];
252
+ for (const o of t) (n.length === 0 || n[n.length - 1].distanceTo(o) > r) && n.push(o.clone());
253
+ return n.length > 2 && n[0].distanceTo(n[n.length - 1]) > r && n.push(n[0].clone()), n;
254
254
  }
255
- function Ue(e) {
255
+ function Ue(t) {
256
256
  let r = 0;
257
- for (let t = 0; t < e.length - 1; t++) r += e[t].distanceTo(e[t + 1]);
257
+ for (let n = 0; n < t.length - 1; n++) r += t[n].distanceTo(t[n + 1]);
258
258
  return r;
259
259
  }
260
- function Cn(e, r = 1e-3, t = false) {
261
- if (!e.length) return [];
262
- const o = /* @__PURE__ */ new Map(), l = (f) => {
260
+ function Cn(t, r = 1e-3, n = false) {
261
+ if (!t.length) return [];
262
+ const o = /* @__PURE__ */ new Map(), s = (f) => {
263
263
  const u = So(f, r);
264
264
  let x = o.get(u);
265
265
  return x || (x = f.clone(), o.set(u, x)), x;
266
- }, s = e.map((f) => ({
267
- a: l(f.a),
268
- b: l(f.b)
266
+ }, a = t.map((f) => ({
267
+ a: s(f.a),
268
+ b: s(f.b)
269
269
  })), c = [];
270
- for (; s.length; ) {
271
- const f = s.pop(), u = [
270
+ for (; a.length; ) {
271
+ const f = a.pop(), u = [
272
272
  f.a,
273
273
  f.b
274
274
  ];
275
275
  let x = true;
276
276
  for (; x; ) {
277
277
  x = false;
278
- for (let p = s.length - 1; p >= 0; p--) {
279
- const { a: g, b } = s[p];
278
+ for (let p = a.length - 1; p >= 0; p--) {
279
+ const { a: g, b } = a[p];
280
280
  if (g.equals(u[u.length - 1])) u.push(b);
281
281
  else if (b.equals(u[u.length - 1])) u.push(g);
282
282
  else if (g.equals(u[0])) u.unshift(b);
283
283
  else if (b.equals(u[0])) u.unshift(g);
284
284
  else continue;
285
- s.splice(p, 1), x = true;
285
+ a.splice(p, 1), x = true;
286
286
  }
287
287
  }
288
288
  const S = vo(u, r);
289
289
  S.length > 1 && c.push(S);
290
290
  }
291
291
  if (!c.length) return [];
292
- if (t) {
292
+ if (n) {
293
293
  c.sort((x, S) => Ue(S) - Ue(x));
294
294
  const f = Ue(c[0]), u = c.filter((x) => Ue(x) >= f * 0.3);
295
295
  return u[u.length - 1] ?? c[0];
296
296
  }
297
- const a = c.filter((f) => f.length >= 3 && f[0].distanceTo(f[f.length - 1]) < r * 10), n = a.length > 0 ? a : c;
298
- if (n.length === 1) return n[0];
299
- let m = n[0], d = 1 / 0;
300
- for (const f of n) {
297
+ const l = c.filter((f) => f.length >= 3 && f[0].distanceTo(f[f.length - 1]) < r * 10), e = l.length > 0 ? l : c;
298
+ if (e.length === 1) return e[0];
299
+ let m = e[0], d = 1 / 0;
300
+ for (const f of e) {
301
301
  let u = 0, x = 0;
302
302
  for (const p of f) u += p.x, x += p.z;
303
303
  u /= f.length, x /= f.length;
@@ -306,30 +306,30 @@ let __tla = (async () => {
306
306
  }
307
307
  return m;
308
308
  }
309
- function an(e, r, t, o = false) {
310
- const l = new yt(new C(0, 1, 0), -t), s = [], c = new xn();
309
+ function an(t, r, n, o = false) {
310
+ const s = new yt(new M(0, 1, 0), -n), a = [], c = new xn();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
- const a = {
312
+ const l = {
313
313
  linePoints: [],
314
314
  lineLength: 0,
315
- rightmostPoint: new C(0, t, 0)
315
+ rightmostPoint: new M(0, n, 0)
316
316
  };
317
- if (!l.intersectsBox(c)) return a;
318
- const n = new bn(), m = new C();
319
- e.shapecast({
320
- intersectsBounds: (p) => l.intersectsBox(p),
317
+ if (!s.intersectsBox(c)) return l;
318
+ const e = new bn(), m = new M();
319
+ t.shapecast({
320
+ intersectsBounds: (p) => s.intersectsBox(p),
321
321
  intersectsTriangle: (p) => {
322
322
  const g = [];
323
- n.set(p.a, p.b), l.intersectLine(n, m) && g.push(m.clone()), n.set(p.b, p.c), l.intersectLine(n, m) && g.push(m.clone()), n.set(p.c, p.a), l.intersectLine(n, m) && g.push(m.clone()), g.length === 2 && s.push({
323
+ e.set(p.a, p.b), s.intersectLine(e, m) && g.push(m.clone()), e.set(p.b, p.c), s.intersectLine(e, m) && g.push(m.clone()), e.set(p.c, p.a), s.intersectLine(e, m) && g.push(m.clone()), g.length === 2 && a.push({
324
324
  a: g[0],
325
325
  b: g[1]
326
326
  });
327
327
  }
328
328
  });
329
- const d = Cn(s, $t, o);
330
- if (d.length < 2) return a;
329
+ const d = Cn(a, $t, o);
330
+ if (d.length < 2) return l;
331
331
  const f = Ue(d);
332
- let u = -1 / 0, x = new C(0, t, 0);
332
+ let u = -1 / 0, x = new M(0, n, 0);
333
333
  for (const p of d) p.x > u && (u = p.x, x = p.clone());
334
334
  const S = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < $t * 10;
335
335
  return {
@@ -339,27 +339,27 @@ let __tla = (async () => {
339
339
  isClosed: S
340
340
  };
341
341
  }
342
- function Ge(e, r, t, o = false) {
343
- const l = an(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;
342
+ function Ge(t, r, n, o = false) {
343
+ const s = an(t, r, n, o);
344
+ if (s.isClosed && s.linePoints.length >= 3) return s;
345
+ ce.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
346
+ let a = s;
347
347
  for (const c of mo) {
348
- const a = an(e, r, t + c, o);
349
- if (a.isClosed && a.linePoints.length >= 3) return ce.debug("slice", `y=${t.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
350
- a.linePoints.length > s.linePoints.length && (s = a);
348
+ const l = an(t, r, n + c, o);
349
+ if (l.isClosed && l.linePoints.length >= 3) return ce.debug("slice", `y=${n.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${l.linePoints.length}, len=${l.lineLength.toFixed(1)}mm)`), l;
350
+ l.linePoints.length > a.linePoints.length && (a = l);
351
351
  }
352
- return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${s.linePoints.length}, closed=${s.isClosed})`), s;
352
+ return ce.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
353
353
  }
354
- function Co(e, r, t, o) {
355
- const l = new yt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new xn();
356
- if (s.setFromBufferAttribute(r.getAttribute("position")), !l.intersectsBox(s)) return 0;
357
- const c = [], a = new bn(), n = new C();
358
- e.shapecast({
359
- intersectsBounds: (d) => l.intersectsBox(d),
354
+ function Co(t, r, n, o) {
355
+ const s = new yt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new xn();
356
+ if (a.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(a)) return 0;
357
+ const c = [], l = new bn(), e = new M();
358
+ t.shapecast({
359
+ intersectsBounds: (d) => s.intersectsBox(d),
360
360
  intersectsTriangle: (d) => {
361
361
  const f = [];
362
- a.set(d.a, d.b), l.intersectLine(a, n) && f.push(n.clone()), a.set(d.b, d.c), l.intersectLine(a, n) && f.push(n.clone()), a.set(d.c, d.a), l.intersectLine(a, n) && f.push(n.clone()), f.length === 2 && c.push({
362
+ l.set(d.a, d.b), s.intersectLine(l, e) && f.push(e.clone()), l.set(d.b, d.c), s.intersectLine(l, e) && f.push(e.clone()), l.set(d.c, d.a), s.intersectLine(l, e) && f.push(e.clone()), f.length === 2 && c.push({
363
363
  a: f[0],
364
364
  b: f[1]
365
365
  });
@@ -368,18 +368,18 @@ let __tla = (async () => {
368
368
  const m = Cn(c, $t);
369
369
  return Ue(m);
370
370
  }
371
- function Mn(e) {
372
- return new wt(e, {
371
+ function Mn(t) {
372
+ return new wt(t, {
373
373
  maxLeafTris: St
374
374
  });
375
375
  }
376
- function Mo(e, r, t, o) {
377
- const l = e.getIndex(), s = l ? l.count / 3 : 0;
378
- if (s < 10) return {
376
+ function Mo(t, r, n, o) {
377
+ const s = t.getIndex(), a = s ? s.count / 3 : 0;
378
+ if (a < 10) return {
379
379
  valid: false,
380
- reason: `Geometry is empty or degenerate (${s} faces)`
380
+ reason: `Geometry is empty or degenerate (${a} faces)`
381
381
  };
382
- const c = r - t;
382
+ const c = r - n;
383
383
  if (c < 4) return {
384
384
  valid: false,
385
385
  reason: `Height too small (${c.toFixed(1)}mm < 4mm)`
@@ -388,29 +388,29 @@ let __tla = (async () => {
388
388
  valid: false,
389
389
  reason: `Height too large (${c.toFixed(1)}mm > 1000mm)`
390
390
  };
391
- const a = new wt(e, {
391
+ const l = new wt(t, {
392
392
  maxLeafTris: St
393
- }), n = Ge(a, e, r);
394
- if (n.lineLength === 0) return {
393
+ }), e = Ge(l, t, r);
394
+ if (e.lineLength === 0) return {
395
395
  valid: false,
396
396
  reason: "No circumference at green point \u2014 mesh may be empty at that height"
397
397
  };
398
398
  const m = r - o;
399
- if (m <= t) return {
399
+ if (m <= n) return {
400
400
  valid: true,
401
401
  reason: ""
402
402
  };
403
- const d = Ge(a, e, m);
404
- if (n.lineLength > 0 && d.lineLength > 0) {
405
- const u = n.lineLength / d.lineLength;
403
+ const d = Ge(l, t, m);
404
+ if (e.lineLength > 0 && d.lineLength > 0) {
405
+ const u = e.lineLength / d.lineLength;
406
406
  if (u < 0.5) return {
407
407
  valid: false,
408
408
  reason: `First circumference is too small relative to second (ratio ${u.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
409
409
  };
410
410
  }
411
411
  const f = r - o * 2;
412
- if (f > t) {
413
- const u = Ge(a, e, f);
412
+ if (f > n) {
413
+ const u = Ge(l, t, f);
414
414
  if (d.lineLength > 0 && u.lineLength > 0) {
415
415
  const x = d.lineLength / u.lineLength;
416
416
  if (x < 0.5) return {
@@ -425,30 +425,30 @@ let __tla = (async () => {
425
425
  };
426
426
  }
427
427
  const Le = "pipeline";
428
- function zo(e, r, t, o) {
428
+ function zo(t, r, n, o) {
429
429
  var _a, _b, _c, _d;
430
- const l = e.geometry.clone(), s = r.map((a) => ({
431
- ...a
430
+ const s = t.geometry.clone(), a = r.map((l) => ({
431
+ ...l
432
432
  })), c = o.wasmModule;
433
433
  try {
434
- let a = e.geometry, n = s.map(($) => new C($.position.x, $.position.y, $.position.z));
435
- const m = n[0], d = n[1];
434
+ let l = t.geometry, e = a.map(($) => new M($.position.x, $.position.y, $.position.z));
435
+ const m = e[0], d = e[1];
436
436
  if (!c) {
437
437
  o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(Le, "WASM not available, using JS fallback alignment");
438
- const $ = new C(0, 1, 0), ne = new C().subVectors(d, m).normalize(), xe = ne.dot($), Se = new C().crossVectors(ne, $);
438
+ const $ = new M(0, 1, 0), ne = new M().subVectors(d, m).normalize(), xe = ne.dot($), Se = new M().crossVectors(ne, $);
439
439
  if (Se.length() > 1e-4) {
440
440
  Se.normalize();
441
441
  const N = new O.Quaternion().setFromAxisAngle(Se, Math.acos(Math.min(1, Math.max(-1, xe))));
442
- a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(N)), n = n.map((Ie) => Ie.clone().applyQuaternion(N));
442
+ l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(N)), e = e.map((Ie) => Ie.clone().applyQuaternion(N));
443
443
  }
444
- if (n[0].y > n[1].y) {
445
- const N = new O.Quaternion().setFromAxisAngle(new C(1, 0, 0), Math.PI);
446
- a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(N)), n = n.map((Ie) => Ie.clone().applyQuaternion(N));
444
+ if (e[0].y > e[1].y) {
445
+ const N = new O.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
446
+ l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(N)), e = e.map((Ie) => Ie.clone().applyQuaternion(N));
447
447
  }
448
- const we = n[0].clone();
449
- a.translate(-we.x, -we.y, -we.z), n = n.map((N) => new C(N.x - we.x, N.y - we.y, N.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
450
- const re = new C(n[0].x, n[0].y, n[0].z);
451
- n.push(re), o.addLandmarkPoint({
448
+ const we = e[0].clone();
449
+ l.translate(-we.x, -we.y, -we.z), e = e.map((N) => new M(N.x - we.x, N.y - we.y, N.z - we.z)), l.computeVertexNormals(), l.computeBoundingBox();
450
+ const re = new M(e[0].x, e[0].y, e[0].z);
451
+ e.push(re), o.addLandmarkPoint({
452
452
  faceIndex: -1,
453
453
  vertexIndices: [
454
454
  0,
@@ -465,16 +465,16 @@ let __tla = (async () => {
465
465
  v: 0.33,
466
466
  w: 0.34
467
467
  }
468
- }), o.updateLandmarkPositions(n.map((N) => ({
468
+ }), o.updateLandmarkPositions(e.map((N) => ({
469
469
  x: N.x,
470
470
  y: N.y,
471
471
  z: N.z
472
- }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * xt);
473
- const j = new C();
474
- a.computeBoundingBox(), a.boundingBox.getSize(j), o.setModelSize(Math.max(j.x, j.y, j.z)), l.dispose();
472
+ }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * xt);
473
+ const j = new M();
474
+ l.computeBoundingBox(), l.boundingBox.getSize(j), o.setModelSize(Math.max(j.x, j.y, j.z)), s.dispose();
475
475
  return;
476
476
  }
477
- const { positions: f, indices: u } = bt(a), x = new Float32Array([
477
+ const { positions: f, indices: u } = bt(l), x = new Float32Array([
478
478
  m.x,
479
479
  m.y,
480
480
  m.z
@@ -490,40 +490,40 @@ let __tla = (async () => {
490
490
  b[0],
491
491
  b[1],
492
492
  b[2]
493
- ]), L = c.find_min_cross_section(f, u, S, A, 10), z = L.plane_normal();
493
+ ]), L = c.find_min_cross_section(f, u, S, A, 10), v = L.plane_normal();
494
494
  ce.info(Le, "Cross-section found", L.details()), o.onStatus("Aligning mesh...");
495
- const P = new Float32Array([
496
- z[0],
497
- z[1],
498
- z[2]
499
- ]), w = c.align_to_origin(f, x, S, P);
500
- let M = w.positions(), h = w.mpt(), v = w.origin();
501
- const F = w.transform();
495
+ const k = new Float32Array([
496
+ v[0],
497
+ v[1],
498
+ v[2]
499
+ ]), w = c.align_to_origin(f, x, S, k);
500
+ let z = w.positions(), h = w.mpt(), C = w.origin();
501
+ const P = w.transform();
502
502
  ce.info(Le, "Alignment complete", w.details());
503
503
  const I = [
504
- F[3],
505
- F[4],
506
- F[5],
507
- F[6],
508
- F[7],
509
- F[8],
510
- F[9],
511
- F[10],
512
- F[11]
504
+ P[3],
505
+ P[4],
506
+ P[5],
507
+ P[6],
508
+ P[7],
509
+ P[8],
510
+ P[9],
511
+ P[10],
512
+ P[11]
513
513
  ], _ = new Float32Array([
514
- I[0] * z[0] + I[1] * z[1] + I[2] * z[2],
515
- I[3] * z[0] + I[4] * z[1] + I[5] * z[2],
516
- I[6] * z[0] + I[7] * z[1] + I[8] * z[2]
514
+ I[0] * v[0] + I[1] * v[1] + I[2] * v[2],
515
+ I[3] * v[0] + I[4] * v[1] + I[5] * v[2],
516
+ I[6] * v[0] + I[7] * v[1] + I[8] * v[2]
517
517
  ]);
518
518
  o.onStatus("Generating measurement points...");
519
- const E = c.subdivide_origin_to_plane(new Float32Array(v), new Float32Array(h), _);
519
+ const E = c.subdivide_origin_to_plane(new Float32Array(C), new Float32Array(h), _);
520
520
  ce.debug(Le, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
521
521
  const V = E.points(), Y = E.count(), q = 2, ye = 1, ae = [];
522
522
  for (let $ = q; $ < Y - ye; $++) ae.push(V[$ * 3 + 1]);
523
523
  o.onStatus("Computing cross-sections...");
524
524
  let fe = [];
525
525
  if (ae.length >= 2) {
526
- const ne = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(M, u, new Float32Array(ae), 10);
526
+ const ne = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, u, new Float32Array(ae), 10);
527
527
  ce.debug(Le, "Batch (subdivision)", ne.details());
528
528
  const xe = ne.all_loop_points(), Se = ne.offsets(), we = ne.circumferences();
529
529
  for (let re = 0; re < Se.length - 1; re++) {
@@ -532,19 +532,19 @@ let __tla = (async () => {
532
532
  const Ie = (N - j) / 3;
533
533
  if (Ie < 3) continue;
534
534
  let Pe = 0, Ke = 0, se = 0;
535
- for (let Ae = j; Ae < N; Ae += 3) Pe += xe[Ae], Ke += xe[Ae + 1], se += xe[Ae + 2];
535
+ for (let ke = j; ke < N; ke += 3) Pe += xe[ke], Ke += xe[ke + 1], se += xe[ke + 2];
536
536
  fe.push(Pe / Ie, Ke / Ie, se / Ie);
537
537
  }
538
538
  }
539
539
  if (fe.length >= 6) {
540
540
  o.onStatus("Refining alignment...");
541
- const $ = c.refine_alignment(new Float32Array(fe), M, new Float32Array(v), new Float32Array(h));
542
- ce.info(Le, "Refinement complete", $.details()), M = $.positions(), h = $.mpt(), v = $.origin();
541
+ const $ = c.refine_alignment(new Float32Array(fe), z, new Float32Array(C), new Float32Array(h));
542
+ ce.info(Le, "Refinement complete", $.details()), z = $.positions(), h = $.mpt(), C = $.origin();
543
543
  }
544
- const ie = a.getAttribute("color"), ee = vn(M, u);
545
- ie && ee.setAttribute("color", ie), a.dispose(), a = ee, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new C(v[0], v[1], v[2]), n[1] = new C(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
546
- const X = new C(n[0].x, n[0].y, n[0].z);
547
- n.push(X), o.addLandmarkPoint({
544
+ const ie = l.getAttribute("color"), ee = vn(z, u);
545
+ ie && ee.setAttribute("color", ie), l.dispose(), l = ee, t.geometry = l, l.computeVertexNormals(), l.computeBoundingBox(), e[0] = new M(C[0], C[1], C[2]), e[1] = new M(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
546
+ const X = new M(e[0].x, e[0].y, e[0].z);
547
+ e.push(X), o.addLandmarkPoint({
548
548
  faceIndex: -1,
549
549
  vertexIndices: [
550
550
  0,
@@ -561,26 +561,26 @@ let __tla = (async () => {
561
561
  v: 0.33,
562
562
  w: 0.34
563
563
  }
564
- }), o.updateLandmarkPositions(n.map(($) => ({
564
+ }), o.updateLandmarkPositions(e.map(($) => ({
565
565
  x: $.x,
566
566
  y: $.y,
567
567
  z: $.z
568
568
  }))), o.setAligned(true);
569
- const ue = a.boundingBox, Z = new C();
570
- ue.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * xt), o.onStatus("Computing final measurements...");
569
+ const ue = l.boundingBox, Z = new M();
570
+ ue.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * xt), o.onStatus("Computing final measurements...");
571
571
  {
572
- const $ = bt(a), ne = n[1].y, xe = n[0].y;
572
+ const $ = bt(l), ne = e[1].y, xe = e[0].y;
573
573
  let Se = 1 / 0, we = -1 / 0;
574
574
  const re = $.positions;
575
575
  for (let se = 1; se < re.length; se += 3) re[se] < Se && (Se = re[se]), re[se] > we && (we = re[se]);
576
576
  const j = 25.4, N = [];
577
577
  N.push(ne);
578
578
  for (let se = 1; se <= 2; se++) {
579
- const Ae = ne + se * j;
580
- Ae < we - 1 && N.push(Ae);
579
+ const ke = ne + se * j;
580
+ ke < we - 1 && N.push(ke);
581
581
  }
582
582
  for (let se = ne - j; se > xe; se -= j) N.push(se);
583
- N.sort((se, Ae) => se - Ae), ce.info(Le, `Horizontal slices: ${N.length} Y planes, range ${(_b = N[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = N[N.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
583
+ N.sort((se, ke) => se - ke), ce.info(Le, `Horizontal slices: ${N.length} Y planes, range ${(_b = N[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = N[N.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
584
584
  const Pe = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))($.positions, $.indices, new Float32Array(N), 10);
585
585
  ce.info(Le, `Horizontal slices (${g ? "inner" : "outer"}): ${Pe.count()}/${N.length} valid`), ce.debug(Le, "Slice details", Pe.details());
586
586
  const Ke = {
@@ -594,13 +594,13 @@ let __tla = (async () => {
594
594
  (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ke);
595
595
  }
596
596
  o.onStatus("Validating results...");
597
- const pe = n[1].y, me = n[0].y, he = Mo(a, pe, me, t);
598
- he.valid || ce.warn(Le, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (l.computeVertexNormals(), o.setClippedReferenceGeometry(l)) : l.dispose();
599
- } catch (a) {
600
- ce.error(Le, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), l.dispose();
597
+ const pe = e[1].y, me = e[0].y, he = Mo(l, pe, me, n);
598
+ he.valid || ce.warn(Le, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
599
+ } catch (l) {
600
+ ce.error(Le, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
601
601
  }
602
602
  }
603
- class ko extends ro {
603
+ class Ao extends ro {
604
604
  constructor() {
605
605
  super(...arguments), this.state = {
606
606
  error: null
@@ -615,11 +615,11 @@ let __tla = (async () => {
615
615
  error: r
616
616
  };
617
617
  }
618
- componentDidCatch(r, t) {
619
- console.error("[ErrorBoundary] Caught error:", r, t.componentStack);
618
+ componentDidCatch(r, n) {
619
+ console.error("[ErrorBoundary] Caught error:", r, n.componentStack);
620
620
  }
621
621
  render() {
622
- return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : k("div", {
622
+ return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : F("div", {
623
623
  style: {
624
624
  display: "flex",
625
625
  flexDirection: "column",
@@ -667,7 +667,7 @@ let __tla = (async () => {
667
667
  }) : this.props.children;
668
668
  }
669
669
  }
670
- const Ao = ({ message: e, onDismiss: r }) => k("div", {
670
+ const ko = ({ message: t, onDismiss: r }) => F("div", {
671
671
  style: {
672
672
  position: "absolute",
673
673
  top: 16,
@@ -684,7 +684,7 @@ let __tla = (async () => {
684
684
  gap: 12
685
685
  },
686
686
  children: [
687
- k("div", {
687
+ F("div", {
688
688
  style: {
689
689
  flex: 1
690
690
  },
@@ -701,7 +701,7 @@ let __tla = (async () => {
701
701
  fontSize: 12,
702
702
  opacity: 0.9
703
703
  },
704
- children: e
704
+ children: t
705
705
  })
706
706
  ]
707
707
  }),
@@ -720,7 +720,7 @@ let __tla = (async () => {
720
720
  children: "x"
721
721
  })
722
722
  ]
723
- }), cn = ({ message: e }) => k("div", {
723
+ }), cn = ({ message: t }) => F("div", {
724
724
  style: {
725
725
  position: "absolute",
726
726
  top: 0,
@@ -745,34 +745,34 @@ let __tla = (async () => {
745
745
  animation: "spin 1s linear infinite"
746
746
  }
747
747
  }),
748
- e && i("div", {
748
+ t && i("div", {
749
749
  style: {
750
750
  marginTop: 16,
751
751
  color: "#fff",
752
752
  fontSize: 14
753
753
  },
754
- children: e
754
+ children: t
755
755
  }),
756
756
  i("style", {
757
757
  children: "@keyframes spin { to { transform: rotate(360deg); } }"
758
758
  })
759
759
  ]
760
760
  });
761
- function Fo(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), m = l.dot(c), d = s.dot(s), f = s.dot(c), u = 1 / (a * d - n * n), x = (d * m - n * f) * u, S = (a * f - n * m) * u;
761
+ function Fo(t, r, n, o) {
762
+ const s = new M().subVectors(n, r), a = new M().subVectors(o, r), c = new M().subVectors(t, r), l = s.dot(s), e = s.dot(a), m = s.dot(c), d = a.dot(a), f = a.dot(c), u = 1 / (l * d - e * e), x = (d * m - e * f) * u, S = (l * f - e * m) * u;
763
763
  return {
764
764
  u: 1 - x - S,
765
765
  v: x,
766
766
  w: S
767
767
  };
768
768
  }
769
- const Po = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
770
- const { addLandmarkPoint: c, landmarkPoints: a } = Ht(), n = J((x) => {
771
- if (a.length >= r) return;
769
+ const Po = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: a = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: l } = Ht(), e = Q((x) => {
771
+ if (l.length >= r) return;
772
772
  x.stopPropagation();
773
773
  const S = x.intersections[0], p = S == null ? void 0 : S.faceIndex;
774
774
  if (!S || p == null) return;
775
- const g = e.geometry, b = g.index;
775
+ const g = t.geometry, b = g.index;
776
776
  let A;
777
777
  b ? A = [
778
778
  b.getX(p * 3),
@@ -783,63 +783,63 @@ let __tla = (async () => {
783
783
  p * 3 + 1,
784
784
  p * 3 + 2
785
785
  ];
786
- const L = g.getAttribute("position"), z = new C().fromBufferAttribute(L, A[0]), P = new C().fromBufferAttribute(L, A[1]), w = new C().fromBufferAttribute(L, A[2]);
787
- z.applyMatrix4(e.matrixWorld), P.applyMatrix4(e.matrixWorld), w.applyMatrix4(e.matrixWorld);
788
- const M = S.point, h = Fo(M, z, P, w), v = {
786
+ const L = g.getAttribute("position"), v = new M().fromBufferAttribute(L, A[0]), k = new M().fromBufferAttribute(L, A[1]), w = new M().fromBufferAttribute(L, A[2]);
787
+ v.applyMatrix4(t.matrixWorld), k.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
788
+ const z = S.point, h = Fo(z, v, k, w), C = {
789
789
  faceIndex: p,
790
790
  vertexIndices: A,
791
791
  position: {
792
- x: M.x,
793
- y: M.y,
794
- z: M.z
792
+ x: z.x,
793
+ y: z.y,
794
+ z: z.z
795
795
  },
796
796
  barycentricCoords: h
797
797
  };
798
- c(v);
798
+ c(C);
799
799
  }, [
800
- e,
800
+ t,
801
801
  c,
802
- a.length,
802
+ l.length,
803
803
  r
804
- ]), m = H(() => !!e.geometry.getAttribute("color"), [
805
- e
806
- ]), d = s ? Math.min(o, 0.65) : o, f = d < 1, u = H(() => new O.MeshStandardMaterial({
807
- color: m ? "#ffffff" : t,
808
- side: l ? O.FrontSide : O.DoubleSide,
804
+ ]), m = H(() => !!t.geometry.getAttribute("color"), [
805
+ t
806
+ ]), d = a ? Math.min(o, 0.65) : o, f = d < 1, u = H(() => new O.MeshStandardMaterial({
807
+ color: m ? "#ffffff" : n,
808
+ side: s ? O.FrontSide : O.DoubleSide,
809
809
  roughness: 0.6,
810
810
  metalness: 0.1,
811
811
  transparent: f,
812
812
  opacity: d,
813
- depthWrite: !s,
813
+ depthWrite: !a,
814
814
  vertexColors: m
815
815
  }), [
816
- t,
816
+ n,
817
817
  d,
818
818
  f,
819
819
  m,
820
- l,
821
- s
820
+ s,
821
+ a
822
822
  ]);
823
823
  return i("primitive", {
824
- object: e,
825
- onClick: n,
824
+ object: t,
825
+ onClick: e,
826
826
  material: u,
827
- renderOrder: s ? 0 : void 0
827
+ renderOrder: a ? 0 : void 0
828
828
  });
829
- }, Lo = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
830
- const [s, c] = B(false);
831
- return k("mesh", {
829
+ }, Lo = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
830
+ const [a, c] = B(false);
831
+ return F("mesh", {
832
832
  position: [
833
- e.position.x,
834
- e.position.y,
835
- e.position.z
833
+ t.position.x,
834
+ t.position.y,
835
+ t.position.z
836
836
  ],
837
837
  onPointerOver: () => c(true),
838
838
  onPointerOut: () => c(false),
839
839
  children: [
840
840
  i("sphereGeometry", {
841
841
  args: [
842
- t,
842
+ n,
843
843
  16,
844
844
  16
845
845
  ]
@@ -847,7 +847,7 @@ let __tla = (async () => {
847
847
  i("meshBasicMaterial", {
848
848
  color: o
849
849
  }),
850
- s && i(Ze, {
850
+ a && i(Ze, {
851
851
  center: true,
852
852
  style: {
853
853
  pointerEvents: "none"
@@ -863,13 +863,13 @@ let __tla = (async () => {
863
863
  whiteSpace: "nowrap",
864
864
  transform: "translateY(-24px)"
865
865
  },
866
- children: l
866
+ children: s
867
867
  })
868
868
  })
869
869
  ]
870
870
  }, r);
871
- }, Io = ({ modelSize: e, labels: r }) => {
872
- const { landmarkPoints: t } = Ht(), o = e * 0.02, l = [
871
+ }, Io = ({ modelSize: t, labels: r }) => {
872
+ const { landmarkPoints: n } = Ht(), o = t * 0.02, s = [
873
873
  "#44ff44",
874
874
  "#ff4444",
875
875
  "#4444ff"
@@ -879,45 +879,45 @@ let __tla = (async () => {
879
879
  "Cut Plane"
880
880
  ];
881
881
  return i(He, {
882
- children: t.map((a, n) => i(Lo, {
883
- point: a,
884
- index: n,
882
+ children: n.map((l, e) => i(Lo, {
883
+ point: l,
884
+ index: e,
885
885
  markerSize: o,
886
- color: l[n],
887
- label: c[n]
888
- }, n))
886
+ color: s[e],
887
+ label: c[e]
888
+ }, e))
889
889
  });
890
890
  };
891
- function zn(e) {
892
- return H(() => e ? new wt(e, {
891
+ function zn(t) {
892
+ return H(() => t ? new wt(t, {
893
893
  maxLeafTris: St
894
894
  }) : null, [
895
- e
895
+ t
896
896
  ]);
897
897
  }
898
- const dn = (e, r) => {
899
- const t = Math.abs(e - r);
900
- return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
901
- }, fn = new O.Color("#8BC34A"), un = new O.Color("#FFC107"), Do = new O.Color("#FF5722"), _o = (e) => {
902
- if (e <= 7) return fn.clone();
903
- if (e <= 20) {
904
- const t = (e - 7) / 13;
905
- return fn.clone().lerp(un, t);
898
+ const dn = (t, r) => {
899
+ const n = Math.abs(t - r);
900
+ return n <= 7 ? "#8BC34A" : n <= 20 ? "#FFC107" : "#FF5722";
901
+ }, fn = new O.Color("#8BC34A"), un = new O.Color("#FFC107"), Do = new O.Color("#FF5722"), _o = (t) => {
902
+ if (t <= 7) return fn.clone();
903
+ if (t <= 20) {
904
+ const n = (t - 7) / 13;
905
+ return fn.clone().lerp(un, n);
906
906
  }
907
- const r = Math.min((e - 20) / 20, 1);
907
+ const r = Math.min((t - 20) / 20, 1);
908
908
  return un.clone().lerp(Do, r);
909
- }, Ro = (e, r) => {
910
- const t = e.length, o = new Float32Array(t * 2 * 3), l = new Float32Array(t * 2 * 3), s = [];
911
- for (let n = 0; n < t; n++) {
912
- const m = e[n], d = r[n], f = m.distanceTo(d), u = _o(f);
913
- if (o[n * 6] = m.x, o[n * 6 + 1] = m.y, o[n * 6 + 2] = m.z, l[n * 6] = u.r, l[n * 6 + 1] = u.g, l[n * 6 + 2] = u.b, o[n * 6 + 3] = d.x, o[n * 6 + 4] = d.y, o[n * 6 + 5] = d.z, l[n * 6 + 3] = u.r, l[n * 6 + 4] = u.g, l[n * 6 + 5] = u.b, n < t - 1) {
914
- const x = n * 2, S = x + 1, p = (n + 1) * 2, g = p + 1;
915
- s.push(x, S, p, S, g, p);
909
+ }, Ro = (t, r) => {
910
+ const n = t.length, o = new Float32Array(n * 2 * 3), s = new Float32Array(n * 2 * 3), a = [];
911
+ for (let e = 0; e < n; e++) {
912
+ const m = t[e], d = r[e], f = m.distanceTo(d), u = _o(f);
913
+ if (o[e * 6] = m.x, o[e * 6 + 1] = m.y, o[e * 6 + 2] = m.z, s[e * 6] = u.r, s[e * 6 + 1] = u.g, s[e * 6 + 2] = u.b, o[e * 6 + 3] = d.x, o[e * 6 + 4] = d.y, o[e * 6 + 5] = d.z, s[e * 6 + 3] = u.r, s[e * 6 + 4] = u.g, s[e * 6 + 5] = u.b, e < n - 1) {
914
+ const x = e * 2, S = x + 1, p = (e + 1) * 2, g = p + 1;
915
+ a.push(x, S, p, S, g, p);
916
916
  }
917
917
  }
918
918
  const c = new O.BufferGeometry();
919
- c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(l, 3)), c.setIndex(s);
920
- const a = new O.MeshBasicMaterial({
919
+ c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(s, 3)), c.setIndex(a);
920
+ const l = new O.MeshBasicMaterial({
921
921
  vertexColors: true,
922
922
  transparent: true,
923
923
  opacity: 0.25,
@@ -925,28 +925,28 @@ let __tla = (async () => {
925
925
  depthTest: false,
926
926
  depthWrite: false
927
927
  });
928
- return new O.Mesh(c, a);
929
- }, Wo = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
930
- const u = H(() => d && f != null ? null : Ge(e, r, t, a), [
931
- e,
932
- r,
928
+ return new O.Mesh(c, l);
929
+ }, Wo = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: a, displayUnit: c = "mm", useInnerSurface: l = false, formValue: e, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
930
+ const u = H(() => d && f != null ? null : Ge(t, r, n, l), [
933
931
  t,
934
- a,
932
+ r,
933
+ n,
934
+ l,
935
935
  d,
936
936
  f
937
937
  ]), x = d ?? (u == null ? void 0 : u.linePoints) ?? [], S = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = H(() => {
938
- if (n == null || n === 0 || S <= 0 || x.length < 2) return null;
939
- const L = n / S, z = x.reduce((w, M) => w + M.x, 0) / x.length, P = x.reduce((w, M) => w + M.z, 0) / x.length;
940
- return x.map((w) => new C(z + (w.x - z) * L, w.y, P + (w.z - P) * L));
938
+ if (e == null || e === 0 || S <= 0 || x.length < 2) return null;
939
+ const L = e / S, v = x.reduce((w, z) => w + z.x, 0) / x.length, k = x.reduce((w, z) => w + z.z, 0) / x.length;
940
+ return x.map((w) => new M(v + (w.x - v) * L, w.y, k + (w.z - k) * L));
941
941
  }, [
942
942
  x,
943
943
  S,
944
- n
944
+ e
945
945
  ]), g = H(() => !p || x.length < 2 ? null : Ro(x, p), [
946
946
  x,
947
947
  p
948
948
  ]);
949
- Q(() => () => {
949
+ K(() => () => {
950
950
  g && (g.geometry.dispose(), g.material.dispose());
951
951
  }, [
952
952
  g
@@ -954,46 +954,46 @@ let __tla = (async () => {
954
954
  const b = le(null), A = H(() => {
955
955
  const L = new O.BufferGeometry();
956
956
  L.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
957
- const z = new O.LineBasicMaterial({
957
+ const v = new O.LineBasicMaterial({
958
958
  color: 6710886,
959
959
  depthTest: false,
960
960
  depthWrite: false,
961
961
  transparent: true
962
962
  });
963
- return new O.Line(L, z);
963
+ return new O.Line(L, v);
964
964
  }, []);
965
- return Q(() => () => {
965
+ return K(() => () => {
966
966
  A.geometry.dispose(), A.material.dispose();
967
967
  }, [
968
968
  A
969
- ]), Q(() => {
970
- S > 0 && (s == null ? void 0 : s({
971
- yPosition: t,
969
+ ]), K(() => {
970
+ S > 0 && (a == null ? void 0 : a({
971
+ yPosition: n,
972
972
  originalValue: S,
973
973
  modifiedValue: null
974
974
  }));
975
975
  }, [
976
976
  S,
977
- t,
978
- s
977
+ n,
978
+ a
979
979
  ]), hn(({ camera: L }) => {
980
980
  if (!b.current || x.length < 2) return;
981
- const z = new C();
982
- L.getWorldDirection(z);
983
- const P = new C(z.x, 0, z.z);
984
- if (P.lengthSq() < 1e-8) return;
985
- P.normalize();
986
- const w = new C().crossVectors(P, new C(0, 1, 0)).normalize();
987
- let M = -1 / 0, h = x[0];
981
+ const v = new M();
982
+ L.getWorldDirection(v);
983
+ const k = new M(v.x, 0, v.z);
984
+ if (k.lengthSq() < 1e-8) return;
985
+ k.normalize();
986
+ const w = new M().crossVectors(k, new M(0, 1, 0)).normalize();
987
+ let z = -1 / 0, h = x[0];
988
988
  for (const _ of x) {
989
989
  const E = w.x * _.x + w.z * _.z;
990
- E > M && (M = E, h = _);
990
+ E > z && (z = E, h = _);
991
991
  }
992
- const v = l * 0.35, F = new C(h.x + w.x * v, t, h.z + w.z * v);
993
- b.current.position.copy(F);
992
+ const C = s * 0.35, P = new M(h.x + w.x * C, n, h.z + w.z * C);
993
+ b.current.position.copy(P);
994
994
  const I = A.geometry.getAttribute("position");
995
- I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1, F.x, F.y, F.z), I.needsUpdate = true;
996
- }), x.length < 2 ? null : k("group", {
995
+ I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1, P.x, P.y, P.z), I.needsUpdate = true;
996
+ }), x.length < 2 ? null : F("group", {
997
997
  renderOrder: 10,
998
998
  children: [
999
999
  i(de, {
@@ -1009,9 +1009,9 @@ let __tla = (async () => {
1009
1009
  object: g,
1010
1010
  renderOrder: 10
1011
1011
  }),
1012
- p && n != null && n !== 0 && i(de, {
1012
+ p && e != null && e !== 0 && i(de, {
1013
1013
  points: p,
1014
- color: dn(S, n),
1014
+ color: dn(S, e),
1015
1015
  lineWidth: 2.5,
1016
1016
  dashed: true,
1017
1017
  dashSize: 2,
@@ -1037,7 +1037,7 @@ let __tla = (async () => {
1037
1037
  pointerEvents: "none",
1038
1038
  transform: "translateY(-50%)"
1039
1039
  },
1040
- children: k("div", {
1040
+ children: F("div", {
1041
1041
  style: {
1042
1042
  display: "flex",
1043
1043
  alignItems: "stretch",
@@ -1047,14 +1047,14 @@ let __tla = (async () => {
1047
1047
  whiteSpace: "nowrap"
1048
1048
  },
1049
1049
  children: [
1050
- k("div", {
1050
+ F("div", {
1051
1051
  style: {
1052
1052
  display: "flex",
1053
1053
  alignItems: "center",
1054
1054
  gap: 4,
1055
1055
  padding: "5px 10px",
1056
1056
  backgroundColor: "rgba(0, 0, 0, 0.75)",
1057
- borderRadius: n != null && n !== 0 ? "4px 0 0 4px" : 4
1057
+ borderRadius: e != null && e !== 0 ? "4px 0 0 4px" : 4
1058
1058
  },
1059
1059
  children: [
1060
1060
  i("span", {
@@ -1077,9 +1077,9 @@ let __tla = (async () => {
1077
1077
  })
1078
1078
  ]
1079
1079
  }),
1080
- n != null && n !== 0 && S > 0 && (() => {
1081
- const L = S - n, z = L > 0.5 ? "\u25B2" : L < -0.5 ? "\u25BC" : "", P = dn(S, n);
1082
- return k("div", {
1080
+ e != null && e !== 0 && S > 0 && (() => {
1081
+ const L = S - e, v = L > 0.5 ? "\u25B2" : L < -0.5 ? "\u25BC" : "", k = dn(S, e);
1082
+ return F("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
1085
1085
  alignItems: "center",
@@ -1090,18 +1090,18 @@ let __tla = (async () => {
1090
1090
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1091
1091
  },
1092
1092
  children: [
1093
- z && i("span", {
1093
+ v && i("span", {
1094
1094
  style: {
1095
1095
  fontSize: 10,
1096
- color: P,
1096
+ color: k,
1097
1097
  lineHeight: 1
1098
1098
  },
1099
- children: z
1099
+ children: v
1100
1100
  }),
1101
- k("span", {
1101
+ F("span", {
1102
1102
  style: {
1103
1103
  fontSize: 13,
1104
- color: P,
1104
+ color: k,
1105
1105
  fontFamily: "monospace",
1106
1106
  fontWeight: 600
1107
1107
  },
@@ -1110,7 +1110,7 @@ let __tla = (async () => {
1110
1110
  c === "inch" ? (L / 25.4).toFixed(2) : L.toFixed(1)
1111
1111
  ]
1112
1112
  }),
1113
- k("span", {
1113
+ F("span", {
1114
1114
  style: {
1115
1115
  fontSize: 11,
1116
1116
  color: "rgba(255,255,255,0.4)",
@@ -1118,7 +1118,7 @@ let __tla = (async () => {
1118
1118
  },
1119
1119
  children: [
1120
1120
  "from ",
1121
- c === "inch" ? (n / 25.4).toFixed(2) : n.toFixed(0)
1121
+ c === "inch" ? (e / 25.4).toFixed(2) : e.toFixed(0)
1122
1122
  ]
1123
1123
  })
1124
1124
  ]
@@ -1130,119 +1130,119 @@ let __tla = (async () => {
1130
1130
  })
1131
1131
  ]
1132
1132
  });
1133
- }, Bo = io(Wo), Eo = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: m, originY: d, wasmSlices: f }) => {
1134
- const u = le(/* @__PURE__ */ new Map()), x = e.geometry, S = zn(x), p = H(() => {
1133
+ }, Bo = io(Wo), Eo = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: a, reverseOrder: c = false, displayUnit: l = "mm", useInnerSurface: e = false, formMeasurements: m, originY: d, wasmSlices: f }) => {
1134
+ const u = le(/* @__PURE__ */ new Map()), x = t.geometry, S = zn(x), p = H(() => {
1135
1135
  if (f) {
1136
- let M = [
1136
+ let z = [
1137
1137
  ...f.yValues
1138
1138
  ];
1139
1139
  if (o > 25.4 + 0.1) {
1140
1140
  const h = f.mptY;
1141
- M = M.filter((v) => {
1142
- const F = Math.abs(v - h);
1143
- return F < 0.5 || Math.abs(Math.round(F / o) * o - F) < 0.5;
1141
+ z = z.filter((C) => {
1142
+ const P = Math.abs(C - h);
1143
+ return P < 0.5 || Math.abs(Math.round(P / o) * o - P) < 0.5;
1144
1144
  });
1145
1145
  }
1146
- return c ? M.sort((h, v) => v - h) : M.sort((h, v) => h - v), M;
1146
+ return c ? z.sort((h, C) => C - h) : z.sort((h, C) => h - C), z;
1147
1147
  }
1148
- const P = [];
1149
- if (c) for (let w = t; w >= r; w -= o) P.push(w);
1150
- else for (let w = r; w <= t; w += o) P.push(w);
1151
- return P;
1148
+ const k = [];
1149
+ if (c) for (let w = n; w >= r; w -= o) k.push(w);
1150
+ else for (let w = r; w <= n; w += o) k.push(w);
1151
+ return k;
1152
1152
  }, [
1153
1153
  r,
1154
- t,
1154
+ n,
1155
1155
  o,
1156
1156
  c,
1157
1157
  f
1158
1158
  ]), g = H(() => {
1159
1159
  if (!f) return null;
1160
- const P = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: M, yValues: h } = f;
1161
- for (let v = 0; v < M.length - 1; v++) {
1162
- const F = M[v], I = M[v + 1];
1163
- if (I <= F) continue;
1160
+ const k = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: z, yValues: h } = f;
1161
+ for (let C = 0; C < z.length - 1; C++) {
1162
+ const P = z[C], I = z[C + 1];
1163
+ if (I <= P) continue;
1164
1164
  const _ = [];
1165
- for (let E = F; E < I; E += 3) _.push(new C(w[E], w[E + 1], w[E + 2]));
1166
- _.length >= 3 && P.set(h[v], _);
1165
+ for (let E = P; E < I; E += 3) _.push(new M(w[E], w[E + 1], w[E + 2]));
1166
+ _.length >= 3 && k.set(h[C], _);
1167
1167
  }
1168
- return P;
1168
+ return k;
1169
1169
  }, [
1170
1170
  f
1171
1171
  ]), b = H(() => {
1172
1172
  if (!f) return null;
1173
- const P = /* @__PURE__ */ new Map();
1174
- for (let w = 0; w < f.yValues.length; w++) P.set(f.yValues[w], f.circumferences[w]);
1175
- return P;
1173
+ const k = /* @__PURE__ */ new Map();
1174
+ for (let w = 0; w < f.yValues.length; w++) k.set(f.yValues[w], f.circumferences[w]);
1175
+ return k;
1176
1176
  }, [
1177
1177
  f
1178
1178
  ]);
1179
- Q(() => {
1179
+ K(() => {
1180
1180
  u.current.clear();
1181
1181
  }, [
1182
1182
  p
1183
- ]), Q(() => {
1184
- if (!b || !s) return;
1185
- const P = p.filter((w) => (b.get(w) ?? 0) > 0).map((w) => ({
1183
+ ]), K(() => {
1184
+ if (!b || !a) return;
1185
+ const k = p.filter((w) => (b.get(w) ?? 0) > 0).map((w) => ({
1186
1186
  yPosition: w,
1187
1187
  originalValue: b.get(w) ?? 0,
1188
1188
  modifiedValue: null
1189
1189
  }));
1190
- s(P);
1190
+ a(k);
1191
1191
  }, [
1192
1192
  b,
1193
1193
  p,
1194
- s
1194
+ a
1195
1195
  ]);
1196
1196
  const A = [
1197
1197
  "#5B9BD5"
1198
- ], L = l * go, z = J((P) => {
1198
+ ], L = s * go, v = Q((k) => {
1199
1199
  if (b) return;
1200
- u.current.set(P.yPosition, P);
1201
- const w = Array.from(u.current.values()).sort((M, h) => c ? h.yPosition - M.yPosition : M.yPosition - h.yPosition);
1202
- s == null ? void 0 : s(w);
1200
+ u.current.set(k.yPosition, k);
1201
+ const w = Array.from(u.current.values()).sort((z, h) => c ? h.yPosition - z.yPosition : z.yPosition - h.yPosition);
1202
+ a == null ? void 0 : a(w);
1203
1203
  }, [
1204
- s,
1204
+ a,
1205
1205
  c,
1206
1206
  b
1207
1207
  ]);
1208
1208
  return S ? i(He, {
1209
- children: p.map((P, w) => i(Bo, {
1209
+ children: p.map((k, w) => i(Bo, {
1210
1210
  bvh: S,
1211
1211
  geometry: x,
1212
- yPosition: P,
1213
- color: d != null && Math.abs(P - d) < o * 0.5 ? "#44ff44" : A[w % A.length],
1212
+ yPosition: k,
1213
+ color: d != null && Math.abs(k - d) < o * 0.5 ? "#44ff44" : A[w % A.length],
1214
1214
  labelX: L,
1215
- onDataChange: z,
1216
- displayUnit: a,
1217
- useInnerSurface: n,
1215
+ onDataChange: v,
1216
+ displayUnit: l,
1217
+ useInnerSurface: e,
1218
1218
  formValue: m == null ? void 0 : m[w],
1219
- lineWidth: d != null && Math.abs(P - d) < o * 0.5 ? 4 : 1.5,
1220
- wasmLoopPoints: g == null ? void 0 : g.get(P),
1221
- wasmCircumference: b == null ? void 0 : b.get(P)
1222
- }, P))
1219
+ lineWidth: d != null && Math.abs(k - d) < o * 0.5 ? 4 : 1.5,
1220
+ wasmLoopPoints: g == null ? void 0 : g.get(k),
1221
+ wasmCircumference: b == null ? void 0 : b.get(k)
1222
+ }, k))
1223
1223
  }) : null;
1224
- }, To = (e, r) => {
1225
- const t = Math.abs(e - r);
1226
- return t <= 7 ? "#4caf50" : t <= 15 ? "#ff9800" : "#f44336";
1227
- }, Oo = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l, formHeight: s }) => {
1224
+ }, To = (t, r) => {
1225
+ const n = Math.abs(t - r);
1226
+ return n <= 7 ? "#4caf50" : n <= 15 ? "#ff9800" : "#f44336";
1227
+ }, Oo = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: a }) => {
1228
1228
  var _a;
1229
- const c = e.geometry;
1229
+ const c = t.geometry;
1230
1230
  c.computeBoundingBox();
1231
- const a = l ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, n = r - a, m = t * 0.4, d = t * 0.03, f = le(null);
1231
+ const l = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - l, m = n * 0.4, d = n * 0.03, f = le(null);
1232
1232
  hn(({ camera: w }) => {
1233
1233
  if (!f.current) return;
1234
- const M = new C();
1235
- w.getWorldDirection(M);
1236
- const h = new C(M.x, 0, M.z);
1234
+ const z = new M();
1235
+ w.getWorldDirection(z);
1236
+ const h = new M(z.x, 0, z.z);
1237
1237
  if (h.lengthSq() < 1e-8) return;
1238
1238
  h.normalize();
1239
- const v = new C().crossVectors(new C(0, 1, 0), h).normalize();
1240
- f.current.position.set(v.x * m, 0, v.z * m);
1241
- const F = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
- f.current.rotation.y = Math.atan2(F, I);
1239
+ const C = new M().crossVectors(new M(0, 1, 0), h).normalize();
1240
+ f.current.position.set(C.x * m, 0, C.z * m);
1241
+ const P = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
+ f.current.rotation.y = Math.atan2(P, I);
1243
1243
  });
1244
- const u = new C(0, r, 0), x = new C(0, a, 0), S = new C(0, (r + a) / 2, 0), p = new C(-d, r, 0), g = new C(d, r, 0), b = new C(-d, a, 0), A = new C(d, a, 0), L = s != null && s > 0, z = L ? n - s : 0, P = L ? To(n, s) : "#fff";
1245
- return k("group", {
1244
+ const u = new M(0, r, 0), x = new M(0, l, 0), S = new M(0, (r + l) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0), b = new M(-d, l, 0), A = new M(d, l, 0), L = a != null && a > 0, v = L ? e - a : 0, k = L ? To(e, a) : "#fff";
1245
+ return F("group", {
1246
1246
  ref: f,
1247
1247
  children: [
1248
1248
  i(de, {
@@ -1280,7 +1280,7 @@ let __tla = (async () => {
1280
1280
  0,
1281
1281
  0
1282
1282
  ],
1283
- children: k("div", {
1283
+ children: F("div", {
1284
1284
  style: {
1285
1285
  display: "flex",
1286
1286
  flexDirection: "column",
@@ -1291,7 +1291,7 @@ let __tla = (async () => {
1291
1291
  pointerEvents: "none"
1292
1292
  },
1293
1293
  children: [
1294
- k("div", {
1294
+ F("div", {
1295
1295
  style: {
1296
1296
  padding: "4px 8px",
1297
1297
  backgroundColor: "rgba(0, 0, 0, 0.75)",
@@ -1303,12 +1303,12 @@ let __tla = (async () => {
1303
1303
  pointerEvents: "none"
1304
1304
  },
1305
1305
  children: [
1306
- o === "inch" ? (n / 25.4).toFixed(2) : n.toFixed(1),
1306
+ o === "inch" ? (e / 25.4).toFixed(2) : e.toFixed(1),
1307
1307
  " ",
1308
1308
  o === "inch" ? "in" : "mm"
1309
1309
  ]
1310
1310
  }),
1311
- L && k("div", {
1311
+ L && F("div", {
1312
1312
  style: {
1313
1313
  display: "flex",
1314
1314
  alignItems: "center",
@@ -1321,27 +1321,27 @@ let __tla = (async () => {
1321
1321
  pointerEvents: "none"
1322
1322
  },
1323
1323
  children: [
1324
- Math.abs(z) > 0.5 && i("span", {
1324
+ Math.abs(v) > 0.5 && i("span", {
1325
1325
  style: {
1326
1326
  fontSize: 10,
1327
- color: P,
1327
+ color: k,
1328
1328
  lineHeight: 1
1329
1329
  },
1330
- children: z > 0.5 ? "\u25B2" : "\u25BC"
1330
+ children: v > 0.5 ? "\u25B2" : "\u25BC"
1331
1331
  }),
1332
- k("span", {
1332
+ F("span", {
1333
1333
  style: {
1334
1334
  fontSize: 13,
1335
- color: P,
1335
+ color: k,
1336
1336
  fontFamily: "monospace",
1337
1337
  fontWeight: 600
1338
1338
  },
1339
1339
  children: [
1340
- z > 0 ? "+" : "",
1341
- o === "inch" ? (z / 25.4).toFixed(2) : z.toFixed(1)
1340
+ v > 0 ? "+" : "",
1341
+ o === "inch" ? (v / 25.4).toFixed(2) : v.toFixed(1)
1342
1342
  ]
1343
1343
  }),
1344
- k("span", {
1344
+ F("span", {
1345
1345
  style: {
1346
1346
  fontSize: 11,
1347
1347
  color: "rgba(255,255,255,0.4)",
@@ -1349,7 +1349,7 @@ let __tla = (async () => {
1349
1349
  },
1350
1350
  children: [
1351
1351
  "from ",
1352
- o === "inch" ? (s / 25.4).toFixed(2) : s.toFixed(0)
1352
+ o === "inch" ? (a / 25.4).toFixed(2) : a.toFixed(0)
1353
1353
  ]
1354
1354
  })
1355
1355
  ]
@@ -1360,147 +1360,147 @@ let __tla = (async () => {
1360
1360
  })
1361
1361
  ]
1362
1362
  });
1363
- }, $o = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1364
- const { set: m, size: d, camera: f, invalidate: u } = gn(), x = le(false), S = le(l), p = le(new C()), g = le(null), b = le(c), A = le(r), L = le(t), z = le(a), P = le(0), w = J(() => {
1365
- if (!o || e <= 0) return null;
1366
- const h = a ?? o.geometry;
1363
+ }, $o = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: a, landmarkCount: c = 0, measurementGeometry: l, resetCameraToFrontRef: e }) => {
1364
+ const { set: m, size: d, camera: f, invalidate: u } = gn(), x = le(false), S = le(s), p = le(new M()), g = le(null), b = le(c), A = le(r), L = le(n), v = le(l), k = le(0), w = Q(() => {
1365
+ if (!o || t <= 0) return null;
1366
+ const h = l ?? o.geometry;
1367
1367
  h.computeBoundingBox();
1368
- const v = h.boundingBox, F = new C();
1369
- v.getCenter(F);
1370
- const I = new C();
1371
- v.getSize(I), p.current.copy(I);
1372
- const _ = d.width / d.height, E = Math.max(I.y, I.x / _) * 1.6, V = E * _, Y = F.y - I.y * 0.05;
1373
- P.current = Y;
1374
- const q = new O.OrthographicCamera(-V / 2, V / 2, E / 2, -E / 2, 0.1, e * 10);
1375
- return q.position.set(0, Y, e * 2), q.lookAt(0, Y, 0), q;
1368
+ const C = h.boundingBox, P = new M();
1369
+ C.getCenter(P);
1370
+ const I = new M();
1371
+ C.getSize(I), p.current.copy(I);
1372
+ const _ = d.width / d.height, E = Math.max(I.y, I.x / _) * 1.6, V = E * _, Y = P.y - I.y * 0.05;
1373
+ k.current = Y;
1374
+ const q = new O.OrthographicCamera(-V / 2, V / 2, E / 2, -E / 2, 0.1, t * 10);
1375
+ return q.position.set(0, Y, t * 2), q.lookAt(0, Y, 0), q;
1376
1376
  }, [
1377
1377
  o,
1378
- e,
1378
+ t,
1379
1379
  d,
1380
- a
1380
+ l
1381
1381
  ]);
1382
- Q(() => {
1383
- if (n) return n.current = () => {
1382
+ K(() => {
1383
+ if (e) return e.current = () => {
1384
1384
  const h = w();
1385
1385
  h && (m({
1386
1386
  camera: h
1387
1387
  }), u());
1388
1388
  }, () => {
1389
- n && (n.current = null);
1389
+ e && (e.current = null);
1390
1390
  };
1391
1391
  }, [
1392
- n,
1392
+ e,
1393
1393
  w,
1394
1394
  m,
1395
1395
  u
1396
1396
  ]);
1397
- const M = J((h) => {
1398
- const v = h.position.clone(), F = v.length(), I = Math.atan2(v.x, v.z), _ = Math.acos(v.y / F), V = I + 0.02;
1399
- h.position.set(F * Math.sin(_) * Math.sin(V), F * Math.cos(_), F * Math.sin(_) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
1397
+ const z = Q((h) => {
1398
+ const C = h.position.clone(), P = C.length(), I = Math.atan2(C.x, C.z), _ = Math.acos(C.y / P), V = I + 0.02;
1399
+ h.position.set(P * Math.sin(_) * Math.sin(V), P * Math.cos(_), P * Math.sin(_) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
1400
1400
  }, [
1401
1401
  u
1402
1402
  ]);
1403
- return Q(() => {
1404
- if (e > 0 && !x.current && !r) {
1403
+ return K(() => {
1404
+ if (t > 0 && !x.current && !r) {
1405
1405
  x.current = true;
1406
- const h = new O.PerspectiveCamera(50, d.width / d.height, 0.1, e * 10);
1407
- h.position.set(e * 0.3, e * 0.2, e * 1.5), h.lookAt(0, 0, 0), m({
1406
+ const h = new O.PerspectiveCamera(50, d.width / d.height, 0.1, t * 10);
1407
+ h.position.set(t * 0.3, t * 0.2, t * 1.5), h.lookAt(0, 0, 0), m({
1408
1408
  camera: h
1409
- }), requestAnimationFrame(() => M(h));
1409
+ }), requestAnimationFrame(() => z(h));
1410
1410
  }
1411
1411
  }, [
1412
- e,
1412
+ t,
1413
1413
  d,
1414
1414
  m,
1415
1415
  r,
1416
- M
1417
- ]), Q(() => {
1416
+ z
1417
+ ]), K(() => {
1418
1418
  const h = b.current;
1419
- b.current = c, h === 0 && c === 1 && !r && requestAnimationFrame(() => M(f));
1419
+ b.current = c, h === 0 && c === 1 && !r && requestAnimationFrame(() => z(f));
1420
1420
  }, [
1421
1421
  c,
1422
1422
  r,
1423
1423
  f,
1424
- M
1425
- ]), Q(() => {
1426
- const h = A.current !== r, v = L.current !== t, F = !z.current && !!a;
1427
- if (A.current = r, L.current = t, z.current = a, !h && !v && !F || !r || l !== "3D") return;
1424
+ z
1425
+ ]), K(() => {
1426
+ const h = A.current !== r, C = L.current !== n, P = !v.current && !!l;
1427
+ if (A.current = r, L.current = n, v.current = l, !h && !C && !P || !r || s !== "3D") return;
1428
1428
  const I = w();
1429
1429
  I && m({
1430
1430
  camera: I
1431
1431
  });
1432
1432
  }, [
1433
1433
  r,
1434
- t,
1434
+ n,
1435
+ s,
1435
1436
  l,
1436
- a,
1437
1437
  w,
1438
1438
  m
1439
- ]), Q(() => {
1440
- if (S.current === l) return;
1439
+ ]), K(() => {
1440
+ if (S.current === s) return;
1441
1441
  const h = S.current;
1442
- if (S.current = l, !(!r || !o || e <= 0)) {
1443
- if (l === "2D" && s != null) {
1442
+ if (S.current = s, !(!r || !o || t <= 0)) {
1443
+ if (s === "2D" && a != null) {
1444
1444
  g.current = f;
1445
- const v = o.geometry, F = v.getAttribute("position"), I = F.array, _ = e * 0.15;
1445
+ const C = o.geometry, P = C.getAttribute("position"), I = P.array, _ = t * 0.15;
1446
1446
  let E = 1 / 0, V = -1 / 0, Y = 1 / 0, q = -1 / 0, ye = false;
1447
- for (let he = 0; he < F.count; he++) if (Math.abs(I[he * 3 + 1] - s) < _) {
1447
+ for (let he = 0; he < P.count; he++) if (Math.abs(I[he * 3 + 1] - a) < _) {
1448
1448
  const $ = I[he * 3], ne = I[he * 3 + 2];
1449
1449
  $ < E && (E = $), $ > V && (V = $), ne < Y && (Y = ne), ne > q && (q = ne), ye = true;
1450
1450
  }
1451
1451
  if (!ye) {
1452
- v.computeBoundingBox();
1453
- const he = v.boundingBox;
1452
+ C.computeBoundingBox();
1453
+ const he = C.boundingBox;
1454
1454
  E = he.min.x, V = he.max.x, Y = he.min.z, q = he.max.z;
1455
1455
  }
1456
1456
  const ae = (E + V) / 2, fe = (Y + q) / 2, ie = d.width / d.height, ee = 1.4, X = (V - E) * ee, ue = (q - Y) * ee;
1457
1457
  let Z, pe;
1458
1458
  X / ue > ie ? (Z = X, pe = X / ie) : (pe = ue, Z = ue * ie);
1459
- const me = new O.OrthographicCamera(-Z / 2, Z / 2, pe / 2, -pe / 2, 0.1, e * 10);
1460
- me.position.set(ae, s + e * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, s, fe), m({
1459
+ const me = new O.OrthographicCamera(-Z / 2, Z / 2, pe / 2, -pe / 2, 0.1, t * 10);
1460
+ me.position.set(ae, a + t * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, a, fe), m({
1461
1461
  camera: me
1462
1462
  });
1463
1463
  } else if (h === "2D") if (g.current) m({
1464
1464
  camera: g.current
1465
1465
  }), g.current = null;
1466
1466
  else {
1467
- const v = w();
1468
- v && m({
1469
- camera: v
1467
+ const C = w();
1468
+ C && m({
1469
+ camera: C
1470
1470
  });
1471
1471
  }
1472
1472
  }
1473
1473
  }, [
1474
- l,
1475
1474
  s,
1475
+ a,
1476
1476
  r,
1477
1477
  o,
1478
- e,
1478
+ t,
1479
1479
  d,
1480
1480
  m,
1481
1481
  f,
1482
1482
  w
1483
- ]), Q(() => {
1483
+ ]), K(() => {
1484
1484
  if (!r || !f || !f.isOrthographicCamera) return;
1485
1485
  const h = f;
1486
- if (l === "2D") {
1487
- if (!o || s == null) return;
1488
- const v = o.geometry, F = v.getAttribute("position"), I = F.array, _ = e * 0.15;
1486
+ if (s === "2D") {
1487
+ if (!o || a == null) return;
1488
+ const C = o.geometry, P = C.getAttribute("position"), I = P.array, _ = t * 0.15;
1489
1489
  let E = 1 / 0, V = -1 / 0, Y = 1 / 0, q = -1 / 0, ye = false;
1490
- for (let Z = 0; Z < F.count; Z++) if (Math.abs(I[Z * 3 + 1] - s) < _) {
1490
+ for (let Z = 0; Z < P.count; Z++) if (Math.abs(I[Z * 3 + 1] - a) < _) {
1491
1491
  const pe = I[Z * 3], me = I[Z * 3 + 2];
1492
1492
  pe < E && (E = pe), pe > V && (V = pe), me < Y && (Y = me), me > q && (q = me), ye = true;
1493
1493
  }
1494
1494
  if (!ye) {
1495
- v.computeBoundingBox();
1496
- const Z = v.boundingBox;
1495
+ C.computeBoundingBox();
1496
+ const Z = C.boundingBox;
1497
1497
  E = Z.min.x, V = Z.max.x, Y = Z.min.z, q = Z.max.z;
1498
1498
  }
1499
1499
  const ae = d.width / d.height, fe = 1.4, ie = (V - E) * fe, ee = (q - Y) * fe;
1500
1500
  let X, ue;
1501
1501
  ie / ee > ae ? (X = ie, ue = ie / ae) : (ue = ee, X = ee * ae), h.left = -X / 2, h.right = X / 2, h.top = ue / 2, h.bottom = -ue / 2;
1502
1502
  } else {
1503
- const v = p.current, F = d.width / d.height, I = Math.max(v.y, v.x / F) * 1.6, _ = I * F;
1503
+ const C = p.current, P = d.width / d.height, I = Math.max(C.y, C.x / P) * 1.6, _ = I * P;
1504
1504
  h.left = -_ / 2, h.right = _ / 2, h.top = I / 2, h.bottom = -I / 2;
1505
1505
  }
1506
1506
  h.updateProjectionMatrix();
@@ -1509,15 +1509,15 @@ let __tla = (async () => {
1509
1509
  d.height,
1510
1510
  r,
1511
1511
  f,
1512
- l,
1512
+ s,
1513
1513
  o
1514
1514
  ]), null;
1515
- }, Ho = ({ mesh: e, isDragging: r }) => {
1515
+ }, Ho = ({ mesh: t, isDragging: r }) => {
1516
1516
  var _a;
1517
- const t = e.geometry;
1518
- t.computeBoundingBox();
1519
- const o = new C();
1520
- return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(mn, {
1517
+ const n = t.geometry;
1518
+ n.computeBoundingBox();
1519
+ const o = new M();
1520
+ return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(mn, {
1521
1521
  enableDamping: false,
1522
1522
  enablePan: false,
1523
1523
  minPolarAngle: Math.PI * 0.15,
@@ -1531,7 +1531,7 @@ let __tla = (async () => {
1531
1531
  o.z
1532
1532
  ]
1533
1533
  });
1534
- }, Vo = ({ wasAutoScaled: e, onDismiss: r }) => k("div", {
1534
+ }, Vo = ({ wasAutoScaled: t, onDismiss: r }) => F("div", {
1535
1535
  style: {
1536
1536
  position: "absolute",
1537
1537
  bottom: 16,
@@ -1542,7 +1542,7 @@ let __tla = (async () => {
1542
1542
  gap: 10,
1543
1543
  padding: "10px 14px",
1544
1544
  maxWidth: 320,
1545
- backgroundColor: e ? "rgba(30, 70, 160, 0.92)" : "rgba(40, 40, 40, 0.88)",
1545
+ backgroundColor: t ? "rgba(30, 70, 160, 0.92)" : "rgba(40, 40, 40, 0.88)",
1546
1546
  borderRadius: 8,
1547
1547
  boxShadow: "0 2px 12px rgba(0,0,0,0.15)",
1548
1548
  fontFamily: "system-ui, sans-serif"
@@ -1554,7 +1554,7 @@ let __tla = (async () => {
1554
1554
  color: "#fff",
1555
1555
  lineHeight: "20px"
1556
1556
  },
1557
- children: e ? "Units detected as meters - converted to mm" : "Units detected as mm"
1557
+ children: t ? "Units detected as meters - converted to mm" : "Units detected as mm"
1558
1558
  }),
1559
1559
  i("button", {
1560
1560
  onClick: r,
@@ -1572,7 +1572,7 @@ let __tla = (async () => {
1572
1572
  children: "X"
1573
1573
  })
1574
1574
  ]
1575
- }), jo = ({ isDoubleShell: e, onDismiss: r }) => k("div", {
1575
+ }), jo = ({ isDoubleShell: t, onDismiss: r }) => F("div", {
1576
1576
  style: {
1577
1577
  position: "absolute",
1578
1578
  bottom: 68,
@@ -1583,7 +1583,7 @@ let __tla = (async () => {
1583
1583
  gap: 10,
1584
1584
  padding: "10px 14px",
1585
1585
  maxWidth: 320,
1586
- backgroundColor: e ? "rgba(130, 80, 20, 0.92)" : "rgba(40, 40, 40, 0.88)",
1586
+ backgroundColor: t ? "rgba(130, 80, 20, 0.92)" : "rgba(40, 40, 40, 0.88)",
1587
1587
  borderRadius: 8,
1588
1588
  boxShadow: "0 2px 12px rgba(0,0,0,0.15)",
1589
1589
  fontFamily: "system-ui, sans-serif"
@@ -1595,7 +1595,7 @@ let __tla = (async () => {
1595
1595
  color: "#fff",
1596
1596
  lineHeight: "20px"
1597
1597
  },
1598
- children: e ? "Double shell scan detected" : "Single shell scan detected"
1598
+ children: t ? "Double shell scan detected" : "Single shell scan detected"
1599
1599
  }),
1600
1600
  i("button", {
1601
1601
  onClick: r,
@@ -1613,7 +1613,7 @@ let __tla = (async () => {
1613
1613
  children: "X"
1614
1614
  })
1615
1615
  ]
1616
- }), No = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1616
+ }), No = ({ steps: t, currentStep: r, accentColor: n = "rgb(12, 67, 173)" }) => i("div", {
1617
1617
  style: {
1618
1618
  backgroundColor: "#fff",
1619
1619
  borderBottom: "1px solid #e0e0e0",
@@ -1622,14 +1622,14 @@ let __tla = (async () => {
1622
1622
  padding: "24px 24px",
1623
1623
  flexShrink: 0
1624
1624
  },
1625
- children: e.map((o, l) => {
1626
- const s = o.number < r, c = o.number === r;
1627
- return k("div", {
1625
+ children: t.map((o, s) => {
1626
+ const a = o.number < r, c = o.number === r;
1627
+ return F("div", {
1628
1628
  style: {
1629
1629
  display: "contents"
1630
1630
  },
1631
1631
  children: [
1632
- k("div", {
1632
+ F("div", {
1633
1633
  style: {
1634
1634
  display: "flex",
1635
1635
  alignItems: "center",
@@ -1644,7 +1644,7 @@ let __tla = (async () => {
1644
1644
  width: 24,
1645
1645
  height: 24,
1646
1646
  borderRadius: "50%",
1647
- backgroundColor: s || c ? t : "rgba(0, 0, 0, 0.38)",
1647
+ backgroundColor: a || c ? n : "rgba(0, 0, 0, 0.38)",
1648
1648
  color: "#fff",
1649
1649
  display: "flex",
1650
1650
  alignItems: "center",
@@ -1653,7 +1653,7 @@ let __tla = (async () => {
1653
1653
  fontFamily: "system-ui, sans-serif",
1654
1654
  flexShrink: 0
1655
1655
  },
1656
- children: s ? "\u2713" : o.number
1656
+ children: a ? "\u2713" : o.number
1657
1657
  }),
1658
1658
  i("div", {
1659
1659
  style: {
@@ -1667,7 +1667,7 @@ let __tla = (async () => {
1667
1667
  })
1668
1668
  ]
1669
1669
  }),
1670
- l < e.length - 1 && i("div", {
1670
+ s < t.length - 1 && i("div", {
1671
1671
  style: {
1672
1672
  flex: "auto",
1673
1673
  borderTop: "1px solid #bdbdbd",
@@ -1677,28 +1677,28 @@ let __tla = (async () => {
1677
1677
  ]
1678
1678
  }, o.number);
1679
1679
  })
1680
- }), Yo = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1681
- const c = e.geometry, a = H(() => new wt(c, {
1680
+ }), Yo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
1681
+ const c = t.geometry, l = H(() => new wt(c, {
1682
1682
  maxLeafTris: St
1683
1683
  }), [
1684
1684
  c
1685
- ]), n = H(() => Ge(a, c, t), [
1686
- a,
1685
+ ]), e = H(() => Ge(l, c, n), [
1686
+ l,
1687
1687
  c,
1688
- t
1689
- ]), m = H(() => new yt(new C(0, -1, 0), r), [
1688
+ n
1689
+ ]), m = H(() => new yt(new M(0, -1, 0), r), [
1690
1690
  r
1691
1691
  ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = H(() => {
1692
1692
  let g = null, b = null, A = 0, L = 0;
1693
- if (n.linePoints.length >= 2) {
1694
- let z = n.linePoints[0], P = n.linePoints[0], w = n.linePoints[0], M = n.linePoints[0];
1695
- for (const h of n.linePoints) h.x < z.x && (z = h), h.x > P.x && (P = h), h.z < w.z && (w = h), h.z > M.z && (M = h);
1693
+ if (e.linePoints.length >= 2) {
1694
+ let v = e.linePoints[0], k = e.linePoints[0], w = e.linePoints[0], z = e.linePoints[0];
1695
+ for (const h of e.linePoints) h.x < v.x && (v = h), h.x > k.x && (k = h), h.z < w.z && (w = h), h.z > z.z && (z = h);
1696
1696
  g = [
1697
- new C(z.x, t, z.z),
1698
- new C(P.x, t, P.z)
1697
+ new M(v.x, n, v.z),
1698
+ new M(k.x, n, k.z)
1699
1699
  ], b = [
1700
- new C(w.x, t, w.z),
1701
- new C(M.x, t, M.z)
1700
+ new M(w.x, n, w.z),
1701
+ new M(z.x, n, z.z)
1702
1702
  ], A = g[0].distanceTo(g[1]), L = b[0].distanceTo(b[1]);
1703
1703
  }
1704
1704
  return {
@@ -1708,15 +1708,15 @@ let __tla = (async () => {
1708
1708
  apWidth: L
1709
1709
  };
1710
1710
  }, [
1711
- n,
1712
- t
1713
- ]), S = (g) => s === "inch" ? (g / 25.4).toFixed(2) : g.toFixed(1), p = s === "inch" ? "in" : "mm";
1714
- return k(He, {
1711
+ e,
1712
+ n
1713
+ ]), S = (g) => a === "inch" ? (g / 25.4).toFixed(2) : g.toFixed(1), p = a === "inch" ? "in" : "mm";
1714
+ return F(He, {
1715
1715
  children: [
1716
1716
  i("mesh", {
1717
- geometry: e.geometry,
1717
+ geometry: t.geometry,
1718
1718
  children: i("meshStandardMaterial", {
1719
- color: l,
1719
+ color: s,
1720
1720
  side: O.DoubleSide,
1721
1721
  transparent: true,
1722
1722
  opacity: 0.15,
@@ -1726,15 +1726,15 @@ let __tla = (async () => {
1726
1726
  ]
1727
1727
  })
1728
1728
  }),
1729
- n.linePoints.length >= 2 && i(de, {
1730
- points: n.linePoints,
1729
+ e.linePoints.length >= 2 && i(de, {
1730
+ points: e.linePoints,
1731
1731
  color: "#00ff00",
1732
1732
  lineWidth: 3,
1733
1733
  depthTest: false,
1734
1734
  depthWrite: false,
1735
1735
  transparent: true
1736
1736
  }),
1737
- d && k(He, {
1737
+ d && F(He, {
1738
1738
  children: [
1739
1739
  i(de, {
1740
1740
  points: d,
@@ -1747,7 +1747,7 @@ let __tla = (async () => {
1747
1747
  i(Ze, {
1748
1748
  position: [
1749
1749
  d[0].x,
1750
- t,
1750
+ n,
1751
1751
  d[0].z - o * 0.02
1752
1752
  ],
1753
1753
  center: true,
@@ -1761,7 +1761,7 @@ let __tla = (async () => {
1761
1761
  backgroundColor: "rgba(0,0,0,0.75)",
1762
1762
  borderRadius: 3
1763
1763
  },
1764
- children: k("span", {
1764
+ children: F("span", {
1765
1765
  style: {
1766
1766
  fontSize: 12,
1767
1767
  color: "#ff8800",
@@ -1778,7 +1778,7 @@ let __tla = (async () => {
1778
1778
  })
1779
1779
  ]
1780
1780
  }),
1781
- f && k(He, {
1781
+ f && F(He, {
1782
1782
  children: [
1783
1783
  i(de, {
1784
1784
  points: f,
@@ -1791,7 +1791,7 @@ let __tla = (async () => {
1791
1791
  i(Ze, {
1792
1792
  position: [
1793
1793
  Math.max(f[0].x, f[1].x) + o * 0.02,
1794
- t,
1794
+ n,
1795
1795
  f[0].z > f[1].z ? f[0].z : f[1].z
1796
1796
  ],
1797
1797
  center: true,
@@ -1805,7 +1805,7 @@ let __tla = (async () => {
1805
1805
  backgroundColor: "rgba(0,0,0,0.75)",
1806
1806
  borderRadius: 3
1807
1807
  },
1808
- children: k("span", {
1808
+ children: F("span", {
1809
1809
  style: {
1810
1810
  fontSize: 12,
1811
1811
  color: "#ff00ff",
@@ -1824,63 +1824,63 @@ let __tla = (async () => {
1824
1824
  })
1825
1825
  ]
1826
1826
  });
1827
- }, Xo = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: m, onDragStart: d, onDragEnd: f }) => {
1828
- const [u, x] = B(false), [S, p] = B(false), { camera: g, gl: b } = gn(), A = le(0), L = e.geometry, z = zn(L), P = H(() => z ? Ge(z, L, r) : {
1827
+ }, Xo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: a, color: c, hoverColor: l, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
1828
+ const [u, x] = B(false), [S, p] = B(false), { camera: g, gl: b } = gn(), A = le(0), L = t.geometry, v = zn(L), k = H(() => v ? Ge(v, L, r) : {
1829
1829
  linePoints: [],
1830
1830
  lineLength: 0,
1831
- rightmostPoint: new C()
1831
+ rightmostPoint: new M()
1832
1832
  }, [
1833
- z,
1833
+ v,
1834
1834
  L,
1835
1835
  r
1836
- ]), w = J((I, _) => {
1836
+ ]), w = Q((I, _) => {
1837
1837
  const E = b.domElement.getBoundingClientRect(), V = (I - E.left) / E.width * 2 - 1, Y = -((_ - E.top) / E.height) * 2 + 1, q = new ao();
1838
1838
  q.setFromCamera(new O.Vector2(V, Y), g);
1839
- const ye = new yt(new C(0, 0, 1), 0), ae = new C();
1839
+ const ye = new yt(new M(0, 0, 1), 0), ae = new M();
1840
1840
  return q.ray.intersectPlane(ye, ae), ae ? ae.y : r;
1841
1841
  }, [
1842
1842
  g,
1843
1843
  b,
1844
1844
  r
1845
- ]), M = J((I) => {
1845
+ ]), z = Q((I) => {
1846
1846
  I.stopPropagation(), x(true), b.domElement.style.cursor = "ns-resize", A.current = r - w(I.clientX, I.clientY), I.target.setPointerCapture(I.pointerId), d == null ? void 0 : d();
1847
1847
  }, [
1848
1848
  r,
1849
1849
  b,
1850
1850
  w,
1851
1851
  d
1852
- ]), h = J((I) => {
1852
+ ]), h = Q((I) => {
1853
1853
  if (!u) return;
1854
1854
  let _ = w(I.clientX, I.clientY) + A.current;
1855
- _ = Math.max(o, Math.min(l, _)), t(_);
1855
+ _ = Math.max(o, Math.min(s, _)), n(_);
1856
1856
  }, [
1857
1857
  u,
1858
1858
  w,
1859
- t,
1859
+ n,
1860
1860
  o,
1861
- l
1862
- ]), v = J((I) => {
1861
+ s
1862
+ ]), C = Q((I) => {
1863
1863
  x(false), b.domElement.style.cursor = "auto", I.target.releasePointerCapture(I.pointerId), f == null ? void 0 : f();
1864
1864
  }, [
1865
1865
  b,
1866
1866
  f
1867
1867
  ]);
1868
- if (P.linePoints.length < 2) return null;
1869
- const F = u ? n : S ? a : c;
1870
- return k("group", {
1868
+ if (k.linePoints.length < 2) return null;
1869
+ const P = u ? e : S ? l : c;
1870
+ return F("group", {
1871
1871
  renderOrder: 10,
1872
1872
  children: [
1873
1873
  i(de, {
1874
- points: P.linePoints,
1875
- color: F,
1874
+ points: k.linePoints,
1875
+ color: P,
1876
1876
  lineWidth: u ? 6 : S ? 5 : 4,
1877
1877
  depthTest: false,
1878
1878
  depthWrite: false,
1879
1879
  transparent: true,
1880
1880
  renderOrder: 10,
1881
- onPointerDown: M,
1881
+ onPointerDown: z,
1882
1882
  onPointerMove: h,
1883
- onPointerUp: v,
1883
+ onPointerUp: C,
1884
1884
  onPointerEnter: () => {
1885
1885
  p(true), b.domElement.style.cursor = "ns-resize";
1886
1886
  },
@@ -1890,7 +1890,7 @@ let __tla = (async () => {
1890
1890
  }),
1891
1891
  (S || u) && i("mesh", {
1892
1892
  position: [
1893
- P.rightmostPoint.x + s * 0.15,
1893
+ k.rightmostPoint.x + a * 0.15,
1894
1894
  r,
1895
1895
  0
1896
1896
  ],
@@ -1901,7 +1901,7 @@ let __tla = (async () => {
1901
1901
  padding: "4px 8px",
1902
1902
  backgroundColor: "rgba(0, 0, 0, 0.8)",
1903
1903
  borderRadius: 4,
1904
- color: F,
1904
+ color: P,
1905
1905
  fontSize: 11,
1906
1906
  whiteSpace: "nowrap",
1907
1907
  pointerEvents: "none"
@@ -1913,23 +1913,23 @@ let __tla = (async () => {
1913
1913
  ]
1914
1914
  });
1915
1915
  };
1916
- function Go(e, r) {
1917
- if (e == null) return {};
1918
- var t = {}, o = Object.keys(e), l, s;
1919
- for (s = 0; s < o.length; s++) l = o[s], !(r.indexOf(l) >= 0) && (t[l] = e[l]);
1920
- return t;
1916
+ function Go(t, r) {
1917
+ if (t == null) return {};
1918
+ var n = {}, o = Object.keys(t), s, a;
1919
+ for (a = 0; a < o.length; a++) s = o[a], !(r.indexOf(s) >= 0) && (n[s] = t[s]);
1920
+ return n;
1921
1921
  }
1922
1922
  var Zo = [
1923
1923
  "color"
1924
- ], Ko = so(function(e, r) {
1925
- var t = e.color, o = t === void 0 ? "currentColor" : t, l = Go(e, Zo);
1924
+ ], Ko = so(function(t, r) {
1925
+ var n = t.color, o = n === void 0 ? "currentColor" : n, s = Go(t, Zo);
1926
1926
  return sn("svg", Object.assign({
1927
1927
  width: "15",
1928
1928
  height: "15",
1929
1929
  viewBox: "0 0 15 15",
1930
1930
  fill: "none",
1931
1931
  xmlns: "http://www.w3.org/2000/svg"
1932
- }, l, {
1932
+ }, s, {
1933
1933
  ref: r
1934
1934
  }), sn("path", {
1935
1935
  d: "M7.5 2C7.77614 2 8 2.22386 8 2.5L8 11.2929L11.1464 8.14645C11.3417 7.95118 11.6583 7.95118 11.8536 8.14645C12.0488 8.34171 12.0488 8.65829 11.8536 8.85355L7.85355 12.8536C7.75979 12.9473 7.63261 13 7.5 13C7.36739 13 7.24021 12.9473 7.14645 12.8536L3.14645 8.85355C2.95118 8.65829 2.95118 8.34171 3.14645 8.14645C3.34171 7.95118 3.65829 7.95118 3.85355 8.14645L7 11.2929L7 2.5C7 2.22386 7.22386 2 7.5 2Z",
@@ -1962,23 +1962,23 @@ let __tla = (async () => {
1962
1962
  outline: "none",
1963
1963
  boxSizing: "border-box",
1964
1964
  fontFamily: "system-ui, sans-serif"
1965
- }, kn = ({ onSkip: e, onCancel: r }) => {
1966
- const [t, o] = B("confirm"), [l, s] = B(null), [c, a] = B(""), n = J(() => {
1965
+ }, An = ({ onSkip: t, onCancel: r }) => {
1966
+ const [n, o] = B("confirm"), [s, a] = B(null), [c, l] = B(""), e = Q(() => {
1967
1967
  o("reasons");
1968
- }, []), m = J(() => {
1969
- t === "reasons" ? (o("confirm"), s(null), a("")) : r();
1968
+ }, []), m = Q(() => {
1969
+ n === "reasons" ? (o("confirm"), a(null), l("")) : r();
1970
1970
  }, [
1971
- t,
1971
+ n,
1972
1972
  r
1973
- ]), d = l != null && (l !== "Other" || c.trim() !== ""), f = J(() => {
1974
- !d || !l || e(l === "Other" ? `Other: ${c.trim()}` : l);
1973
+ ]), d = s != null && (s !== "Other" || c.trim() !== ""), f = Q(() => {
1974
+ !d || !s || t(s === "Other" ? `Other: ${c.trim()}` : s);
1975
1975
  }, [
1976
1976
  d,
1977
- l,
1977
+ s,
1978
1978
  c,
1979
- e
1979
+ t
1980
1980
  ]);
1981
- return t === "reasons" ? i("div", {
1981
+ return n === "reasons" ? i("div", {
1982
1982
  style: {
1983
1983
  position: "fixed",
1984
1984
  inset: 0,
@@ -1991,7 +1991,7 @@ let __tla = (async () => {
1991
1991
  zIndex: 9999,
1992
1992
  fontFamily: "system-ui, sans-serif"
1993
1993
  },
1994
- children: k("div", {
1994
+ children: F("div", {
1995
1995
  style: {
1996
1996
  backgroundColor: "#fff",
1997
1997
  borderRadius: 12,
@@ -1999,7 +1999,7 @@ let __tla = (async () => {
1999
1999
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
2000
2000
  },
2001
2001
  children: [
2002
- k("div", {
2002
+ F("div", {
2003
2003
  style: {
2004
2004
  padding: "24px 24px 0"
2005
2005
  },
@@ -2022,7 +2022,7 @@ let __tla = (async () => {
2022
2022
  })
2023
2023
  ]
2024
2024
  }),
2025
- k("div", {
2025
+ F("div", {
2026
2026
  style: {
2027
2027
  padding: "20px 24px",
2028
2028
  display: "flex",
@@ -2033,7 +2033,7 @@ let __tla = (async () => {
2033
2033
  [
2034
2034
  ...Uo,
2035
2035
  "Other"
2036
- ].map((u) => k("label", {
2036
+ ].map((u) => F("label", {
2037
2037
  style: {
2038
2038
  display: "flex",
2039
2039
  alignItems: "center",
@@ -2041,15 +2041,15 @@ let __tla = (async () => {
2041
2041
  padding: "10px 12px",
2042
2042
  borderRadius: 6,
2043
2043
  cursor: "pointer",
2044
- backgroundColor: l === u ? "rgba(12, 67, 173, 0.06)" : "transparent"
2044
+ backgroundColor: s === u ? "rgba(12, 67, 173, 0.06)" : "transparent"
2045
2045
  },
2046
2046
  children: [
2047
2047
  i("input", {
2048
2048
  type: "radio",
2049
2049
  name: "skip-reason",
2050
- checked: l === u,
2050
+ checked: s === u,
2051
2051
  onChange: () => {
2052
- s(u), u !== "Other" && a("");
2052
+ a(u), u !== "Other" && l("");
2053
2053
  },
2054
2054
  style: {
2055
2055
  accentColor: "rgb(12, 67, 173)",
@@ -2068,12 +2068,12 @@ let __tla = (async () => {
2068
2068
  })
2069
2069
  ]
2070
2070
  }, u)),
2071
- l === "Other" && i("input", {
2071
+ s === "Other" && i("input", {
2072
2072
  autoFocus: true,
2073
2073
  type: "text",
2074
2074
  placeholder: "Please describe...",
2075
2075
  value: c,
2076
- onChange: (u) => a(u.target.value),
2076
+ onChange: (u) => l(u.target.value),
2077
2077
  onKeyDown: (u) => {
2078
2078
  u.key === "Enter" && f();
2079
2079
  },
@@ -2087,7 +2087,7 @@ let __tla = (async () => {
2087
2087
  })
2088
2088
  ]
2089
2089
  }),
2090
- k("div", {
2090
+ F("div", {
2091
2091
  style: {
2092
2092
  display: "flex",
2093
2093
  justifyContent: "flex-end",
@@ -2135,7 +2135,7 @@ let __tla = (async () => {
2135
2135
  zIndex: 9999,
2136
2136
  fontFamily: "system-ui, sans-serif"
2137
2137
  },
2138
- children: k("div", {
2138
+ children: F("div", {
2139
2139
  style: {
2140
2140
  backgroundColor: "#fff",
2141
2141
  borderRadius: 8,
@@ -2161,7 +2161,7 @@ let __tla = (async () => {
2161
2161
  },
2162
2162
  children: "Your measurements will be submitted without comparing to the scan. Are you sure?"
2163
2163
  }),
2164
- k("div", {
2164
+ F("div", {
2165
2165
  style: {
2166
2166
  display: "flex",
2167
2167
  justifyContent: "flex-end",
@@ -2179,7 +2179,7 @@ let __tla = (async () => {
2179
2179
  children: "Cancel"
2180
2180
  }),
2181
2181
  i("button", {
2182
- onClick: n,
2182
+ onClick: e,
2183
2183
  style: {
2184
2184
  ...gt,
2185
2185
  backgroundColor: "rgb(12, 67, 173)",
@@ -2211,75 +2211,75 @@ let __tla = (async () => {
2211
2211
  outline: "none",
2212
2212
  boxSizing: "border-box",
2213
2213
  fontFamily: "system-ui, sans-serif"
2214
- }, Qo = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s, onFormChange: c, onHeightChange: a, initialValues: n, initialFrontalHeight: m }) => {
2215
- const d = e === "AK" ? "IT" : "MPT", f = r, u = e === "AK" ? 18 : 9, x = H(() => {
2214
+ }, Qo = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2215
+ const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, x = H(() => {
2216
2216
  const h = [];
2217
- for (let v = 2; v >= 1; v -= f) h.push(`${v}\u2033 above ${d}`);
2217
+ for (let C = 2; C >= 1; C -= f) h.push(`${C}\u2033 above ${d}`);
2218
2218
  h.push(`At ${d}`);
2219
- for (let v = f; v <= u; v += f) h.push(`${v}\u2033 below ${d}`);
2219
+ for (let C = f; C <= u; C += f) h.push(`${C}\u2033 below ${d}`);
2220
2220
  return h;
2221
2221
  }, [
2222
2222
  f,
2223
2223
  d,
2224
2224
  u
2225
2225
  ]), [S, p] = B(() => {
2226
- if (!n) return {};
2226
+ if (!e) return {};
2227
2227
  const h = {};
2228
- return x.forEach((v, F) => {
2229
- n[F] != null && n[F] !== 0 && (h[v] = n[F].toFixed(1));
2228
+ return x.forEach((C, P) => {
2229
+ e[P] != null && e[P] !== 0 && (h[C] = e[P].toFixed(1));
2230
2230
  }), h;
2231
- }), [g, b] = B(m && m > 0 ? m.toFixed(1) : ""), [A, L] = B(false), z = H(() => x.map((h) => {
2232
- const v = S[h];
2233
- return v != null && v !== "" && !isNaN(parseFloat(v)) ? parseFloat(v) : 0;
2231
+ }), [g, b] = B(m && m > 0 ? m.toFixed(1) : ""), [A, L] = B(false), v = H(() => x.map((h) => {
2232
+ const C = S[h];
2233
+ return C != null && C !== "" && !isNaN(parseFloat(C)) ? parseFloat(C) : 0;
2234
2234
  }), [
2235
2235
  x,
2236
2236
  S
2237
2237
  ]);
2238
- Q(() => {
2239
- c == null ? void 0 : c(z);
2238
+ K(() => {
2239
+ c == null ? void 0 : c(v);
2240
2240
  }, [
2241
- z,
2241
+ v,
2242
2242
  c
2243
- ]), Q(() => {
2243
+ ]), K(() => {
2244
2244
  const h = g !== "" && !isNaN(parseFloat(g)) ? parseFloat(g) : void 0;
2245
- a == null ? void 0 : a(h);
2245
+ l == null ? void 0 : l(h);
2246
2246
  }, [
2247
2247
  g,
2248
- a
2248
+ l
2249
2249
  ]);
2250
- const P = H(() => {
2251
- const h = g !== "" && !isNaN(parseFloat(g)), v = z.some((F) => F !== 0);
2252
- return h || v;
2250
+ const k = H(() => {
2251
+ const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((P) => P !== 0);
2252
+ return h || C;
2253
2253
  }, [
2254
- z,
2254
+ v,
2255
2255
  g
2256
- ]), w = J(() => {
2257
- if (!P) return;
2256
+ ]), w = Q(() => {
2257
+ if (!k) return;
2258
2258
  const h = g !== "" && !isNaN(parseFloat(g)) ? parseFloat(g) : 0;
2259
- l({
2260
- circumferences: z,
2259
+ s({
2260
+ circumferences: v,
2261
2261
  frontalHeight: h
2262
2262
  });
2263
2263
  }, [
2264
- P,
2265
- z,
2264
+ k,
2265
+ v,
2266
2266
  g,
2267
- l
2268
- ]), M = J(() => {
2267
+ s
2268
+ ]), z = Q(() => {
2269
2269
  const h = {};
2270
- x.forEach((v, F) => {
2271
- const I = t[F];
2270
+ x.forEach((C, P) => {
2271
+ const I = n[P];
2272
2272
  if (I) {
2273
2273
  const _ = I.modifiedValue ?? I.originalValue;
2274
- h[v] = _.toFixed(1);
2274
+ h[C] = _.toFixed(1);
2275
2275
  }
2276
2276
  }), p(h), o > 0 && b(o.toFixed(1));
2277
2277
  }, [
2278
2278
  x,
2279
- t,
2279
+ n,
2280
2280
  o
2281
2281
  ]);
2282
- return k("div", {
2282
+ return F("div", {
2283
2283
  style: {
2284
2284
  display: "flex",
2285
2285
  flexDirection: "column",
@@ -2288,11 +2288,11 @@ let __tla = (async () => {
2288
2288
  fontFamily: "system-ui, sans-serif"
2289
2289
  },
2290
2290
  children: [
2291
- A && i(kn, {
2292
- onSkip: s,
2291
+ A && i(An, {
2292
+ onSkip: a,
2293
2293
  onCancel: () => L(false)
2294
2294
  }),
2295
- k("div", {
2295
+ F("div", {
2296
2296
  style: {
2297
2297
  padding: "16px 20px 12px",
2298
2298
  backgroundColor: "#fff",
@@ -2300,18 +2300,18 @@ let __tla = (async () => {
2300
2300
  flexShrink: 0
2301
2301
  },
2302
2302
  children: [
2303
- k("div", {
2303
+ F("div", {
2304
2304
  style: {
2305
2305
  fontSize: 18,
2306
2306
  fontWeight: 600,
2307
2307
  color: "rgba(0,0,0,0.87)"
2308
2308
  },
2309
2309
  children: [
2310
- e,
2310
+ t,
2311
2311
  " Measurements"
2312
2312
  ]
2313
2313
  }),
2314
- k("div", {
2314
+ F("div", {
2315
2315
  style: {
2316
2316
  fontSize: 12,
2317
2317
  color: "rgba(0,0,0,0.54)",
@@ -2325,7 +2325,7 @@ let __tla = (async () => {
2325
2325
  ]
2326
2326
  }),
2327
2327
  i("button", {
2328
- onClick: M,
2328
+ onClick: z,
2329
2329
  style: {
2330
2330
  ...Ot,
2331
2331
  backgroundColor: "#fff",
@@ -2337,7 +2337,7 @@ let __tla = (async () => {
2337
2337
  marginTop: 8,
2338
2338
  width: "100%"
2339
2339
  },
2340
- children: k("span", {
2340
+ children: F("span", {
2341
2341
  style: {
2342
2342
  display: "flex",
2343
2343
  alignItems: "center",
@@ -2357,7 +2357,7 @@ let __tla = (async () => {
2357
2357
  })
2358
2358
  ]
2359
2359
  }),
2360
- k("div", {
2360
+ F("div", {
2361
2361
  style: {
2362
2362
  flex: 1,
2363
2363
  minHeight: 0,
@@ -2382,7 +2382,7 @@ let __tla = (async () => {
2382
2382
  gap: 8,
2383
2383
  marginBottom: 20
2384
2384
  },
2385
- children: x.map((h, v) => k("div", {
2385
+ children: x.map((h, C) => F("div", {
2386
2386
  style: {
2387
2387
  display: "flex",
2388
2388
  alignItems: "center",
@@ -2403,9 +2403,9 @@ let __tla = (async () => {
2403
2403
  type: "number",
2404
2404
  step: "0.1",
2405
2405
  value: S[h] ?? "",
2406
- onChange: (F) => p((I) => ({
2406
+ onChange: (P) => p((I) => ({
2407
2407
  ...I,
2408
- [h]: F.target.value
2408
+ [h]: P.target.value
2409
2409
  })),
2410
2410
  style: {
2411
2411
  ...pn,
@@ -2417,7 +2417,7 @@ let __tla = (async () => {
2417
2417
  placeholder: "0.0"
2418
2418
  })
2419
2419
  ]
2420
- }, v))
2420
+ }, C))
2421
2421
  }),
2422
2422
  i("div", {
2423
2423
  style: {
@@ -2428,7 +2428,7 @@ let __tla = (async () => {
2428
2428
  },
2429
2429
  children: "Lengths"
2430
2430
  }),
2431
- k("div", {
2431
+ F("div", {
2432
2432
  style: {
2433
2433
  display: "flex",
2434
2434
  alignItems: "center",
@@ -2463,7 +2463,7 @@ let __tla = (async () => {
2463
2463
  })
2464
2464
  ]
2465
2465
  }),
2466
- k("div", {
2466
+ F("div", {
2467
2467
  style: {
2468
2468
  padding: "12px 20px",
2469
2469
  backgroundColor: "#fff",
@@ -2476,13 +2476,13 @@ let __tla = (async () => {
2476
2476
  children: [
2477
2477
  i("button", {
2478
2478
  onClick: w,
2479
- disabled: !P,
2479
+ disabled: !k,
2480
2480
  style: {
2481
2481
  ...Ot,
2482
- backgroundColor: P ? "rgb(12, 67, 173)" : "#e0e0e0",
2482
+ backgroundColor: k ? "rgb(12, 67, 173)" : "#e0e0e0",
2483
2483
  border: "none",
2484
- color: P ? "#fff" : "#9e9e9e",
2485
- cursor: P ? "pointer" : "not-allowed",
2484
+ color: k ? "#fff" : "#9e9e9e",
2485
+ cursor: k ? "pointer" : "not-allowed",
2486
2486
  padding: "6px 16px",
2487
2487
  fontSize: 13,
2488
2488
  width: "100%"
@@ -2507,33 +2507,33 @@ let __tla = (async () => {
2507
2507
  ]
2508
2508
  });
2509
2509
  };
2510
- function An(e, r, t) {
2511
- const o = e.getAttribute("position"), l = t - r;
2512
- if (l < 1) return null;
2513
- const s = 30, c = l / s, a = [];
2514
- for (let g = 0; g < s; g++) {
2510
+ function kn(t, r, n) {
2511
+ const o = t.getAttribute("position"), s = n - r;
2512
+ if (s < 1) return null;
2513
+ const a = 30, c = s / a, l = [];
2514
+ for (let g = 0; g < a; g++) {
2515
2515
  const b = r + g * c, A = r + (g + 1) * c;
2516
- let L = 0, z = 0, P = 0, w = 0;
2517
- for (let M = 0; M < o.count; M++) {
2518
- const h = o.getY(M);
2519
- h >= b && h < A && (L += o.getX(M), z += h, P += o.getZ(M), w++);
2516
+ let L = 0, v = 0, k = 0, w = 0;
2517
+ for (let z = 0; z < o.count; z++) {
2518
+ const h = o.getY(z);
2519
+ h >= b && h < A && (L += o.getX(z), v += h, k += o.getZ(z), w++);
2520
2520
  }
2521
- w > 20 && a.push(new C(L / w, z / w, P / w));
2521
+ w > 20 && l.push(new M(L / w, v / w, k / w));
2522
2522
  }
2523
- if (a.length < 5) return null;
2524
- const n = new C();
2525
- for (const g of a) n.add(g);
2526
- n.divideScalar(a.length);
2523
+ if (l.length < 5) return null;
2524
+ const e = new M();
2525
+ for (const g of l) e.add(g);
2526
+ e.divideScalar(l.length);
2527
2527
  let m = 0, d = 0, f = 0, u = 0, x = 0, S = 0;
2528
- for (const g of a) {
2529
- const b = g.x - n.x, A = g.y - n.y, L = g.z - n.z;
2528
+ for (const g of l) {
2529
+ const b = g.x - e.x, A = g.y - e.y, L = g.z - e.z;
2530
2530
  m += b * b, d += b * A, f += b * L, u += A * A, x += A * L, S += L * L;
2531
2531
  }
2532
- let p = new C(0.01, 1, 0.01).normalize();
2532
+ let p = new M(0.01, 1, 0.01).normalize();
2533
2533
  for (let g = 0; g < 30; g++) {
2534
- const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, L = f * p.x + x * p.y + S * p.z, z = new C(b, A, L), P = z.length();
2535
- if (P < 1e-10 || (z.divideScalar(P), p.distanceTo(z) < 1e-8)) break;
2536
- p = z;
2534
+ const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, L = f * p.x + x * p.y + S * p.z, v = new M(b, A, L), k = v.length();
2535
+ if (k < 1e-10 || (v.divideScalar(k), p.distanceTo(v) < 1e-8)) break;
2536
+ p = v;
2537
2537
  }
2538
2538
  return p.y < 0 && p.negate(), p;
2539
2539
  }
@@ -2552,37 +2552,37 @@ let __tla = (async () => {
2552
2552
  "#44cc44",
2553
2553
  "#4488ff"
2554
2554
  ];
2555
- function Fn(e) {
2556
- const r = e.getAttribute("position"), t = r.count, o = new C();
2557
- for (let p = 0; p < t; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
2558
- o.divideScalar(t);
2559
- let l = 0, s = 0, c = 0, a = 0, n = 0, m = 0;
2560
- for (let p = 0; p < t; p++) {
2555
+ function Fn(t) {
2556
+ const r = t.getAttribute("position"), n = r.count, o = new M();
2557
+ for (let p = 0; p < n; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
2558
+ o.divideScalar(n);
2559
+ let s = 0, a = 0, c = 0, l = 0, e = 0, m = 0;
2560
+ for (let p = 0; p < n; p++) {
2561
2561
  const g = r.getX(p) - o.x, b = r.getY(p) - o.y, A = r.getZ(p) - o.z;
2562
- l += g * g, s += g * b, c += g * A, a += b * b, n += b * A, m += A * A;
2562
+ s += g * g, a += g * b, c += g * A, l += b * b, e += b * A, m += A * A;
2563
2563
  }
2564
- l /= t, s /= t, c /= t, a /= t, n /= t, m /= t;
2564
+ s /= n, a /= n, c /= n, l /= n, e /= n, m /= n;
2565
2565
  const d = [], f = [], u = [
2566
2566
  [
2567
- l,
2568
2567
  s,
2568
+ a,
2569
2569
  c
2570
2570
  ],
2571
2571
  [
2572
- s,
2573
2572
  a,
2574
- n
2573
+ l,
2574
+ e
2575
2575
  ],
2576
2576
  [
2577
2577
  c,
2578
- n,
2578
+ e,
2579
2579
  m
2580
2580
  ]
2581
2581
  ];
2582
2582
  for (let p = 0; p < 3; p++) {
2583
- let g = new C(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), b = 0;
2583
+ let g = new M(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), b = 0;
2584
2584
  for (let A = 0; A < 100; A++) {
2585
- const L = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, z = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, P = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new C(L, z, P);
2585
+ const L = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, v = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, k = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new M(L, v, k);
2586
2586
  if (b = w.length(), b < 1e-12) break;
2587
2587
  if (w.divideScalar(b), g.distanceTo(w) < 1e-10) {
2588
2588
  g = w;
@@ -2592,21 +2592,21 @@ let __tla = (async () => {
2592
2592
  }
2593
2593
  d.push(g.clone()), f.push(b);
2594
2594
  for (let A = 0; A < 3; A++) for (let L = 0; L < 3; L++) {
2595
- const z = [
2595
+ const v = [
2596
2596
  g.x,
2597
2597
  g.y,
2598
2598
  g.z
2599
- ][A], P = [
2599
+ ][A], k = [
2600
2600
  g.x,
2601
2601
  g.y,
2602
2602
  g.z
2603
2603
  ][L];
2604
- u[A][L] -= b * z * P;
2604
+ u[A][L] -= b * v * k;
2605
2605
  }
2606
2606
  }
2607
- const x = new C();
2608
- for (let p = 0; p < t; p++) x.x += r.getX(p), x.y += r.getY(p), x.z += r.getZ(p);
2609
- x.divideScalar(t);
2607
+ const x = new M();
2608
+ for (let p = 0; p < n; p++) x.x += r.getX(p), x.y += r.getY(p), x.z += r.getZ(p);
2609
+ x.divideScalar(n);
2610
2610
  const S = [
2611
2611
  0,
2612
2612
  0,
@@ -2615,9 +2615,9 @@ let __tla = (async () => {
2615
2615
  for (let p = 0; p < 3; p++) {
2616
2616
  let g = 1 / 0, b = -1 / 0;
2617
2617
  const A = d[p];
2618
- for (let L = 0; L < t; L++) {
2619
- const z = r.getX(L) - x.x, P = r.getY(L) - x.y, w = r.getZ(L) - x.z, M = z * A.x + P * A.y + w * A.z;
2620
- M < g && (g = M), M > b && (b = M);
2618
+ for (let L = 0; L < n; L++) {
2619
+ const v = r.getX(L) - x.x, k = r.getY(L) - x.y, w = r.getZ(L) - x.z, z = v * A.x + k * A.y + w * A.z;
2620
+ z < g && (g = z), z > b && (b = z);
2621
2621
  }
2622
2622
  S[p] = (b - g) / 2;
2623
2623
  }
@@ -2628,25 +2628,25 @@ let __tla = (async () => {
2628
2628
  halfExtents: S
2629
2629
  };
2630
2630
  }
2631
- function tr({ pca: e }) {
2631
+ function tr({ pca: t }) {
2632
2632
  return i("group", {
2633
- children: e.axes.map((r, t) => {
2634
- const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), l = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
2633
+ children: t.axes.map((r, n) => {
2634
+ const o = t.center.clone().addScaledVector(r, t.halfExtents[n]), s = t.center.clone().addScaledVector(r, -t.halfExtents[n]);
2635
2635
  return i(de, {
2636
2636
  points: [
2637
- l,
2637
+ s,
2638
2638
  o
2639
2639
  ],
2640
- color: er[t],
2640
+ color: er[n],
2641
2641
  lineWidth: 2
2642
- }, t);
2642
+ }, n);
2643
2643
  })
2644
2644
  });
2645
2645
  }
2646
- function nr({ pca: e }) {
2646
+ function nr({ pca: t }) {
2647
2647
  const r = H(() => {
2648
- const { center: t, axes: o, halfExtents: l } = e, s = [];
2649
- for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let m = -1; m <= 1; m += 2) s.push(t.clone().addScaledVector(o[0], a * l[0]).addScaledVector(o[1], n * l[1]).addScaledVector(o[2], m * l[2]));
2648
+ const { center: n, axes: o, halfExtents: s } = t, a = [];
2649
+ for (let l = -1; l <= 1; l += 2) for (let e = -1; e <= 1; e += 2) for (let m = -1; m <= 1; m += 2) a.push(n.clone().addScaledVector(o[0], l * s[0]).addScaledVector(o[1], e * s[1]).addScaledVector(o[2], m * s[2]));
2650
2650
  return [
2651
2651
  [
2652
2652
  0,
@@ -2696,16 +2696,16 @@ let __tla = (async () => {
2696
2696
  3,
2697
2697
  7
2698
2698
  ]
2699
- ].map(([a, n]) => [
2700
- s[a],
2701
- s[n]
2699
+ ].map(([l, e]) => [
2700
+ a[l],
2701
+ a[e]
2702
2702
  ]);
2703
2703
  }, [
2704
- e
2704
+ t
2705
2705
  ]);
2706
2706
  return i("group", {
2707
- children: r.map((t, o) => i(de, {
2708
- points: t,
2707
+ children: r.map((n, o) => i(de, {
2708
+ points: n,
2709
2709
  color: "#ffaa00",
2710
2710
  lineWidth: 1,
2711
2711
  transparent: true,
@@ -2713,28 +2713,28 @@ let __tla = (async () => {
2713
2713
  }, o))
2714
2714
  });
2715
2715
  }
2716
- function or({ redPoint: e, greenPoint: r }) {
2717
- const t = H(() => new C().subVectors(r, e).normalize(), [
2718
- e,
2716
+ function or({ redPoint: t, greenPoint: r }) {
2717
+ const n = H(() => new M().subVectors(r, t).normalize(), [
2718
+ t,
2719
2719
  r
2720
2720
  ]), o = H(() => {
2721
- const s = t.dot(new C(0, 1, 0));
2722
- return Math.acos(Math.min(1, Math.abs(s))) * 180 / Math.PI;
2721
+ const a = n.dot(new M(0, 1, 0));
2722
+ return Math.acos(Math.min(1, Math.abs(a))) * 180 / Math.PI;
2723
2723
  }, [
2724
- t
2725
- ]), l = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2726
- return k("group", {
2724
+ n
2725
+ ]), s = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2726
+ return F("group", {
2727
2727
  children: [
2728
2728
  i(de, {
2729
2729
  points: [
2730
- e,
2730
+ t,
2731
2731
  r
2732
2732
  ],
2733
- color: l,
2733
+ color: s,
2734
2734
  lineWidth: 3
2735
2735
  }),
2736
- k("mesh", {
2737
- position: e,
2736
+ F("mesh", {
2737
+ position: t,
2738
2738
  children: [
2739
2739
  i("sphereGeometry", {
2740
2740
  args: [
@@ -2748,7 +2748,7 @@ let __tla = (async () => {
2748
2748
  })
2749
2749
  ]
2750
2750
  }),
2751
- k("mesh", {
2751
+ F("mesh", {
2752
2752
  position: r,
2753
2753
  children: [
2754
2754
  i("sphereGeometry", {
@@ -2766,34 +2766,34 @@ let __tla = (async () => {
2766
2766
  ]
2767
2767
  });
2768
2768
  }
2769
- function rr({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2770
- const s = o * 0.15, c = H(() => {
2771
- const a = [];
2772
- let n = t - 10;
2773
- const m = new C(0, 1, 0);
2774
- for (; n > r; ) {
2775
- const d = Math.min(n, t), f = Math.max(n, t), u = An(e, d, f);
2769
+ function rr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2770
+ const a = o * 0.15, c = H(() => {
2771
+ const l = [];
2772
+ let e = n - 10;
2773
+ const m = new M(0, 1, 0);
2774
+ for (; e > r; ) {
2775
+ const d = Math.min(e, n), f = Math.max(e, n), u = kn(t, d, f);
2776
2776
  if (u) {
2777
2777
  const x = u.dot(m), S = Math.acos(Math.min(1, Math.abs(x))) * 180 / Math.PI;
2778
- a.push({
2778
+ l.push({
2779
2779
  axis: u,
2780
2780
  regionMin: d,
2781
2781
  regionMax: f,
2782
2782
  angleDeg: S
2783
2783
  });
2784
2784
  }
2785
- n -= 10;
2785
+ e -= 10;
2786
2786
  }
2787
- return a;
2787
+ return l;
2788
2788
  }, [
2789
- e,
2789
+ t,
2790
2790
  r,
2791
- t
2791
+ n
2792
2792
  ]);
2793
2793
  return i("group", {
2794
- children: c.map((a, n) => {
2795
- const m = (a.regionMin + a.regionMax) / 2, d = new C(0, m, 0), f = d.clone().addScaledVector(a.axis, s), u = d.clone().addScaledVector(a.axis, -s), x = n / Math.max(1, c.length - 1), S = a.angleDeg < 0.5 ? `hsl(${120 - x * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2796
- return k("group", {
2794
+ children: c.map((l, e) => {
2795
+ const m = (l.regionMin + l.regionMax) / 2, d = new M(0, m, 0), f = d.clone().addScaledVector(l.axis, a), u = d.clone().addScaledVector(l.axis, -a), x = e / Math.max(1, c.length - 1), S = l.angleDeg < 0.5 ? `hsl(${120 - x * 120}, 80%, 60%)` : `hsl(${40 - l.angleDeg * 2}, 90%, 55%)`;
2796
+ return F("group", {
2797
2797
  children: [
2798
2798
  i(de, {
2799
2799
  points: [
@@ -2807,8 +2807,8 @@ let __tla = (async () => {
2807
2807
  }),
2808
2808
  i(de, {
2809
2809
  points: [
2810
- new C(-s * 0.3, a.regionMin, 0),
2811
- new C(s * 0.3, a.regionMin, 0)
2810
+ new M(-a * 0.3, l.regionMin, 0),
2811
+ new M(a * 0.3, l.regionMin, 0)
2812
2812
  ],
2813
2813
  color: S,
2814
2814
  lineWidth: 0.5,
@@ -2816,31 +2816,31 @@ let __tla = (async () => {
2816
2816
  opacity: 0.3
2817
2817
  })
2818
2818
  ]
2819
- }, n);
2819
+ }, e);
2820
2820
  })
2821
2821
  });
2822
2822
  }
2823
- function ir({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2824
- const l = H(() => {
2825
- const f = An(e, r, t);
2823
+ function ir({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2824
+ const s = H(() => {
2825
+ const f = kn(t, r, n);
2826
2826
  if (!f) return null;
2827
- const u = f.dot(new C(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2827
+ const u = f.dot(new M(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2828
2828
  return {
2829
2829
  axis: f,
2830
2830
  angleDeg: x
2831
2831
  };
2832
2832
  }, [
2833
- e,
2833
+ t,
2834
2834
  r,
2835
- t
2835
+ n
2836
2836
  ]);
2837
- if (!l) return null;
2838
- const s = (r + t) / 2, c = new C(0, s, 0), a = o * 0.4, n = c.clone().addScaledVector(l.axis, a), m = c.clone().addScaledVector(l.axis, -a), d = l.angleDeg < 0.5 ? "#00ffff" : l.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2837
+ if (!s) return null;
2838
+ const a = (r + n) / 2, c = new M(0, a, 0), l = o * 0.4, e = c.clone().addScaledVector(s.axis, l), m = c.clone().addScaledVector(s.axis, -l), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2839
2839
  return i("group", {
2840
2840
  children: i(de, {
2841
2841
  points: [
2842
2842
  m,
2843
- n
2843
+ e
2844
2844
  ],
2845
2845
  color: d,
2846
2846
  lineWidth: 3,
@@ -2850,12 +2850,12 @@ let __tla = (async () => {
2850
2850
  })
2851
2851
  });
2852
2852
  }
2853
- function sr({ pca: e, modelSize: r }) {
2854
- const t = e.axes[0], o = r * 0.6, l = e.center.clone().addScaledVector(t, o), s = e.center.clone().addScaledVector(t, -o);
2853
+ function sr({ pca: t, modelSize: r }) {
2854
+ const n = t.axes[0], o = r * 0.6, s = t.center.clone().addScaledVector(n, o), a = t.center.clone().addScaledVector(n, -o);
2855
2855
  return i(de, {
2856
2856
  points: [
2857
- s,
2858
- l
2857
+ a,
2858
+ s
2859
2859
  ],
2860
2860
  color: "#ff8800",
2861
2861
  lineWidth: 2,
@@ -2864,40 +2864,40 @@ let __tla = (async () => {
2864
2864
  gapSize: 2
2865
2865
  });
2866
2866
  }
2867
- function lr({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2868
- const s = H(() => {
2869
- const d = l ?? e, f = Mn(d), u = new C(0, 1, 0), x = 5, p = t + 3 * 25.4, g = [];
2867
+ function lr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2868
+ const a = H(() => {
2869
+ const d = s ?? t, f = Mn(d), u = new M(0, 1, 0), x = 5, p = n + 3 * 25.4, g = [];
2870
2870
  for (let h = r + x; h < p; h += x) {
2871
- const v = Co(f, d, new C(0, h, 0), u);
2872
- v > 0 && g.push({
2871
+ const C = Co(f, d, new M(0, h, 0), u);
2872
+ C > 0 && g.push({
2873
2873
  y: h,
2874
- circ: v
2874
+ circ: C
2875
2875
  });
2876
2876
  }
2877
2877
  if (g.length < 5) return null;
2878
- const b = t - r, A = r + b * 0.3, L = r + b * 0.7, z = g.filter((h) => h.y >= A && h.y <= L);
2879
- if (z.length < 3) return null;
2880
- const P = z.map((h) => h.circ).sort((h, v) => h - v), w = P[Math.floor(P.length / 2)], M = Math.max(...g.map((h) => h.circ));
2878
+ const b = n - r, A = r + b * 0.3, L = r + b * 0.7, v = g.filter((h) => h.y >= A && h.y <= L);
2879
+ if (v.length < 3) return null;
2880
+ const k = v.map((h) => h.circ).sort((h, C) => h - C), w = k[Math.floor(k.length / 2)], z = Math.max(...g.map((h) => h.circ));
2881
2881
  return {
2882
2882
  circumferences: g,
2883
2883
  baseline: w,
2884
- maxCirc: M
2884
+ maxCirc: z
2885
2885
  };
2886
2886
  }, [
2887
- e,
2887
+ t,
2888
2888
  r,
2889
- t
2889
+ n
2890
2890
  ]);
2891
- if (!s) return null;
2892
- const { circumferences: c, baseline: a, maxCirc: n } = s, m = o * 0.3 / n;
2893
- return k("group", {
2891
+ if (!a) return null;
2892
+ const { circumferences: c, baseline: l, maxCirc: e } = a, m = o * 0.3 / e;
2893
+ return F("group", {
2894
2894
  children: [
2895
2895
  c.map(({ y: d, circ: f }, u) => {
2896
- const x = f / a, S = x > 1.6 ? "#ff4444" : x > 1.3 ? "#ffcc00" : "#22cc66", p = f * m;
2896
+ const x = f / l, S = x > 1.6 ? "#ff4444" : x > 1.3 ? "#ffcc00" : "#22cc66", p = f * m;
2897
2897
  return i(de, {
2898
2898
  points: [
2899
- new C(-p, d, 0),
2900
- new C(p, d, 0)
2899
+ new M(-p, d, 0),
2900
+ new M(p, d, 0)
2901
2901
  ],
2902
2902
  color: S,
2903
2903
  lineWidth: 1.5,
@@ -2906,13 +2906,13 @@ let __tla = (async () => {
2906
2906
  }, u);
2907
2907
  }),
2908
2908
  (() => {
2909
- const d = a * 1.6 * m, f = c[0].y, u = c[c.length - 1].y;
2910
- return k(He, {
2909
+ const d = l * 1.6 * m, f = c[0].y, u = c[c.length - 1].y;
2910
+ return F(He, {
2911
2911
  children: [
2912
2912
  i(de, {
2913
2913
  points: [
2914
- new C(-d, f, 0),
2915
- new C(-d, u, 0)
2914
+ new M(-d, f, 0),
2915
+ new M(-d, u, 0)
2916
2916
  ],
2917
2917
  color: "#ff4444",
2918
2918
  lineWidth: 1,
@@ -2924,8 +2924,8 @@ let __tla = (async () => {
2924
2924
  }),
2925
2925
  i(de, {
2926
2926
  points: [
2927
- new C(d, f, 0),
2928
- new C(d, u, 0)
2927
+ new M(d, f, 0),
2928
+ new M(d, u, 0)
2929
2929
  ],
2930
2930
  color: "#ff4444",
2931
2931
  lineWidth: 1,
@@ -2941,21 +2941,21 @@ let __tla = (async () => {
2941
2941
  ]
2942
2942
  });
2943
2943
  }
2944
- function ar({ componentDebug: e }) {
2944
+ function ar({ componentDebug: t }) {
2945
2945
  return i("group", {
2946
- children: e.geometries.map((r, t) => {
2947
- const o = e.colors[t] ?? "#888888", l = t === e.innerIdx;
2946
+ children: t.geometries.map((r, n) => {
2947
+ const o = t.colors[n] ?? "#888888", s = n === t.innerIdx;
2948
2948
  r.computeBoundingBox();
2949
- const s = new C();
2950
- return r.boundingBox.getCenter(s), k("group", {
2949
+ const a = new M();
2950
+ return r.boundingBox.getCenter(a), F("group", {
2951
2951
  children: [
2952
2952
  i("mesh", {
2953
2953
  geometry: r,
2954
- renderOrder: l ? 2 : 1,
2954
+ renderOrder: s ? 2 : 1,
2955
2955
  children: i("meshStandardMaterial", {
2956
2956
  color: o,
2957
2957
  transparent: true,
2958
- opacity: l ? 0.5 : 0.2,
2958
+ opacity: s ? 0.5 : 0.2,
2959
2959
  side: O.DoubleSide,
2960
2960
  depthWrite: false,
2961
2961
  polygonOffset: true,
@@ -2965,16 +2965,16 @@ let __tla = (async () => {
2965
2965
  }),
2966
2966
  i("mesh", {
2967
2967
  geometry: r,
2968
- renderOrder: l ? 2 : 1,
2968
+ renderOrder: s ? 2 : 1,
2969
2969
  children: i("meshBasicMaterial", {
2970
2970
  color: o,
2971
2971
  wireframe: true,
2972
2972
  transparent: true,
2973
- opacity: l ? 0.4 : 0.15
2973
+ opacity: s ? 0.4 : 0.15
2974
2974
  })
2975
2975
  }),
2976
2976
  i("group", {
2977
- position: s,
2977
+ position: a,
2978
2978
  children: i(Ze, {
2979
2979
  center: true,
2980
2980
  style: {
@@ -2993,37 +2993,37 @@ let __tla = (async () => {
2993
2993
  fontSize: 11,
2994
2994
  color: o,
2995
2995
  fontFamily: "monospace",
2996
- fontWeight: l ? 700 : 400
2996
+ fontWeight: s ? 700 : 400
2997
2997
  },
2998
- children: e.labels[t]
2998
+ children: t.labels[n]
2999
2999
  })
3000
3000
  })
3001
3001
  })
3002
3002
  })
3003
3003
  ]
3004
- }, t);
3004
+ }, n);
3005
3005
  })
3006
3006
  });
3007
3007
  }
3008
- function cr({ geometry: e, aoData: r }) {
3009
- const t = H(() => {
3010
- const o = e.toNonIndexed(), l = o.getAttribute("position"), s = r.length, c = l.count, a = new Float32Array(c * 3);
3011
- for (let n = 0; n < s && n * 3 + 2 < c; n++) {
3012
- const m = r[n], d = m, f = m < 0.5 ? 0.8 - m * 1.2 : 0.2 * (1 - m), u = 1 - m;
3008
+ function cr({ geometry: t, aoData: r }) {
3009
+ const n = H(() => {
3010
+ const o = t.toNonIndexed(), s = o.getAttribute("position"), a = r.length, c = s.count, l = new Float32Array(c * 3);
3011
+ for (let e = 0; e < a && e * 3 + 2 < c; e++) {
3012
+ const m = r[e], d = m, f = m < 0.5 ? 0.8 - m * 1.2 : 0.2 * (1 - m), u = 1 - m;
3013
3013
  for (let x = 0; x < 3; x++) {
3014
- const S = (n * 3 + x) * 3;
3015
- a[S] = d, a[S + 1] = f, a[S + 2] = u;
3014
+ const S = (e * 3 + x) * 3;
3015
+ l[S] = d, l[S + 1] = f, l[S + 2] = u;
3016
3016
  }
3017
3017
  }
3018
- return o.setAttribute("color", new O.Float32BufferAttribute(a, 3)), o;
3018
+ return o.setAttribute("color", new O.Float32BufferAttribute(l, 3)), o;
3019
3019
  }, [
3020
- e,
3020
+ t,
3021
3021
  r
3022
3022
  ]);
3023
- return H(() => () => t.dispose(), [
3024
- t
3023
+ return H(() => () => n.dispose(), [
3024
+ n
3025
3025
  ]), i("mesh", {
3026
- geometry: t,
3026
+ geometry: n,
3027
3027
  renderOrder: 3,
3028
3028
  children: i("meshBasicMaterial", {
3029
3029
  vertexColors: true,
@@ -3034,39 +3034,39 @@ let __tla = (async () => {
3034
3034
  })
3035
3035
  });
3036
3036
  }
3037
- function dr({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
3038
- const a = e.geometry, n = H(() => a.getAttribute("position") ? Fn(a) : null, [
3039
- a
3040
- ]), m = H(() => !t || t.length < 2 ? null : {
3041
- red: new C(t[1].position.x, t[1].position.y, t[1].position.z),
3042
- green: new C(t[0].position.x, t[0].position.y, t[0].position.z)
3037
+ function dr({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
3038
+ const l = t.geometry, e = H(() => l.getAttribute("position") ? Fn(l) : null, [
3039
+ l
3040
+ ]), m = H(() => !n || n.length < 2 ? null : {
3041
+ red: new M(n[1].position.x, n[1].position.y, n[1].position.z),
3042
+ green: new M(n[0].position.x, n[0].position.y, n[0].position.z)
3043
3043
  }, [
3044
- t
3044
+ n
3045
3045
  ]);
3046
- return k("group", {
3046
+ return F("group", {
3047
3047
  children: [
3048
- r.pcaAxes && n && i(tr, {
3049
- pca: n
3048
+ r.pcaAxes && e && i(tr, {
3049
+ pca: e
3050
3050
  }),
3051
- r.obb && n && i(nr, {
3052
- pca: n
3051
+ r.obb && e && i(nr, {
3052
+ pca: e
3053
3053
  }),
3054
- r.obbAxis && n && i(sr, {
3055
- pca: n,
3056
- modelSize: n.halfExtents[0] ? Math.max(...n.halfExtents) * 2 : 100
3054
+ r.obbAxis && e && i(sr, {
3055
+ pca: e,
3056
+ modelSize: e.halfExtents[0] ? Math.max(...e.halfExtents) * 2 : 100
3057
3057
  }),
3058
3058
  r.shellComponents && o && i(ar, {
3059
3059
  componentDebug: o
3060
3060
  }),
3061
- r.ambientOcclusion && l && l.length > 0 && i(cr, {
3062
- geometry: s ?? a,
3063
- aoData: l
3061
+ r.ambientOcclusion && s && s.length > 0 && i(cr, {
3062
+ geometry: a ?? l,
3063
+ aoData: s
3064
3064
  }),
3065
3065
  r.circumferenceScan && m && i(lr, {
3066
- geometry: a,
3066
+ geometry: l,
3067
3067
  redY: m.red.y,
3068
3068
  greenY: m.green.y,
3069
- modelSize: (n == null ? void 0 : n.halfExtents[0]) ? Math.max(...n.halfExtents) * 2 : 100,
3069
+ modelSize: (e == null ? void 0 : e.halfExtents[0]) ? Math.max(...e.halfExtents) * 2 : 100,
3070
3070
  measurementGeometry: c
3071
3071
  }),
3072
3072
  c && i("mesh", {
@@ -3085,37 +3085,37 @@ let __tla = (async () => {
3085
3085
  greenPoint: m.green
3086
3086
  }),
3087
3087
  r.iterativePCA && m && i(rr, {
3088
- geometry: a,
3088
+ geometry: l,
3089
3089
  redY: m.red.y,
3090
3090
  greenY: m.green.y,
3091
- modelSize: (n == null ? void 0 : n.halfExtents[0]) ? Math.max(...n.halfExtents) * 2 : 100
3091
+ modelSize: (e == null ? void 0 : e.halfExtents[0]) ? Math.max(...e.halfExtents) * 2 : 100
3092
3092
  }),
3093
3093
  r.fullRegionPCA && m && i(ir, {
3094
- geometry: a,
3094
+ geometry: l,
3095
3095
  redY: m.red.y,
3096
3096
  greenY: m.green.y,
3097
- modelSize: (n == null ? void 0 : n.halfExtents[0]) ? Math.max(...n.halfExtents) * 2 : 100
3097
+ modelSize: (e == null ? void 0 : e.halfExtents[0]) ? Math.max(...e.halfExtents) * 2 : 100
3098
3098
  })
3099
3099
  ]
3100
3100
  });
3101
3101
  }
3102
- function fr({ mesh: e }) {
3103
- const r = e.geometry, t = H(() => {
3102
+ function fr({ mesh: t }) {
3103
+ const r = t.geometry, n = H(() => {
3104
3104
  if (!r.getAttribute("position")) return null;
3105
- const s = Fn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3105
+ const a = Fn(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3106
3106
  return {
3107
3107
  axis: c,
3108
- center: s.center,
3109
- halfLen: a
3108
+ center: a.center,
3109
+ halfLen: l
3110
3110
  };
3111
3111
  }, [
3112
3112
  r
3113
3113
  ]);
3114
- if (!t) return null;
3115
- const o = t.center.clone().addScaledVector(t.axis, t.halfLen), l = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3114
+ if (!n) return null;
3115
+ const o = n.center.clone().addScaledVector(n.axis, n.halfLen), s = n.center.clone().addScaledVector(n.axis, -n.halfLen);
3116
3116
  return i(de, {
3117
3117
  points: [
3118
- l,
3118
+ s,
3119
3119
  o
3120
3120
  ],
3121
3121
  color: "#666",
@@ -3186,10 +3186,10 @@ let __tla = (async () => {
3186
3186
  group: "Alignment"
3187
3187
  }
3188
3188
  ], ur = [
3189
- ...new Set(Pn.map((e) => e.group))
3189
+ ...new Set(Pn.map((t) => t.group))
3190
3190
  ];
3191
- function pr({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3192
- return k("div", {
3191
+ function pr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3192
+ return F("div", {
3193
3193
  style: {
3194
3194
  position: "absolute",
3195
3195
  top: 16,
@@ -3218,8 +3218,8 @@ let __tla = (async () => {
3218
3218
  children: "Debug Layers"
3219
3219
  }),
3220
3220
  ur.map((o) => {
3221
- const l = Pn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3222
- return l.length === 0 ? null : k("div", {
3221
+ const s = Pn.filter((a) => a.group === o && !(a.hideWhenDoubleShell && n));
3222
+ return s.length === 0 ? null : F("div", {
3223
3223
  children: [
3224
3224
  i("div", {
3225
3225
  style: {
@@ -3233,7 +3233,7 @@ let __tla = (async () => {
3233
3233
  },
3234
3234
  children: o
3235
3235
  }),
3236
- l.map(({ key: s, label: c, color: a }) => k("label", {
3236
+ s.map(({ key: a, label: c, color: l }) => F("label", {
3237
3237
  style: {
3238
3238
  display: "flex",
3239
3239
  alignItems: "center",
@@ -3245,10 +3245,10 @@ let __tla = (async () => {
3245
3245
  children: [
3246
3246
  i("input", {
3247
3247
  type: "checkbox",
3248
- checked: e[s],
3249
- onChange: () => r(s),
3248
+ checked: t[a],
3249
+ onChange: () => r(a),
3250
3250
  style: {
3251
- accentColor: a,
3251
+ accentColor: l,
3252
3252
  width: 14,
3253
3253
  height: 14,
3254
3254
  cursor: "pointer"
@@ -3259,29 +3259,29 @@ let __tla = (async () => {
3259
3259
  width: 8,
3260
3260
  height: 8,
3261
3261
  borderRadius: "50%",
3262
- backgroundColor: a,
3263
- opacity: e[s] ? 1 : 0.3,
3262
+ backgroundColor: l,
3263
+ opacity: t[a] ? 1 : 0.3,
3264
3264
  flexShrink: 0
3265
3265
  }
3266
3266
  }),
3267
3267
  i("span", {
3268
3268
  style: {
3269
- opacity: e[s] ? 1 : 0.5
3269
+ opacity: t[a] ? 1 : 0.5
3270
3270
  },
3271
3271
  children: c
3272
3272
  })
3273
3273
  ]
3274
- }, s))
3274
+ }, a))
3275
3275
  ]
3276
3276
  }, o);
3277
3277
  })
3278
3278
  ]
3279
3279
  });
3280
3280
  }
3281
- const hr = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3282
- const [n, m] = B(null), [d, f] = B(0), [u, x] = B(false), [S, p] = B(false), [g, b] = B(""), [A, L] = B("3D"), [z, P] = B(r === "AK" ? 2 : 1), [w, M] = B(false), [h, v] = B(null), [F, I] = B(r ?? null), [_, E] = B("mm"), [V, Y] = B(false), [q, ye] = B(""), [ae, fe] = B(false), [ie, ee] = B(false), [X, ue] = B(false), [Z, pe] = B(false), [me, he] = B(null), [$, ne] = B(null), [xe, Se] = B(null), [we, re] = B(false), [j, N] = B([]), [Ie, Pe] = B(null), [Ke, se] = B(null), [Ae, vt] = B(null), [Ct, Vt] = B(null), [In, jt] = B(false), [Mt, Nt] = B(null), [zt, De] = B(null), [We, Dn] = B(false), [Yt, _n] = B(qo), [Ve, Xt] = B("obj"), [ve, kt] = B(o), [Je, At] = B(true), [je, rt] = B(false), [it, Gt] = B(false), [ze, st] = B(false), [Rn, Ft] = B(false), [Qe, Wn] = B(null), [Bn, En] = B(void 0), [Tn, On] = B(void 0), [Zt] = B("#c8c8c8"), [$n] = B(1), [Te, Hn] = B(false), [Pt, Kt] = B([]), lt = le(null), Ne = le(null), at = le(false), Vn = le(null), Lt = le(null), It = le(null), qe = J(async () => {
3281
+ const hr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
3282
+ const [e, m] = B(null), [d, f] = B(0), [u, x] = B(false), [S, p] = B(false), [g, b] = B(""), [A, L] = B("3D"), [v, k] = B(r === "AK" ? 2 : 1), [w, z] = B(false), [h, C] = B(null), [P, I] = B(r ?? null), [_, E] = B("mm"), [V, Y] = B(false), [q, ye] = B(""), [ae, fe] = B(false), [ie, ee] = B(false), [X, ue] = B(false), [Z, pe] = B(false), [me, he] = B(null), [$, ne] = B(null), [xe, Se] = B(null), [we, re] = B(false), [j, N] = B([]), [Ie, Pe] = B(null), [Ke, se] = B(null), [ke, vt] = B(null), [Ct, Vt] = B(null), [In, jt] = B(false), [Mt, Nt] = B(null), [zt, De] = B(null), [We, Dn] = B(false), [Yt, _n] = B(qo), [Ve, Xt] = B("obj"), [ve, At] = B(o), [Je, kt] = B(true), [je, rt] = B(false), [it, Gt] = B(false), [ze, st] = B(false), [Rn, Ft] = B(false), [Qe, Wn] = B(null), [Bn, En] = B(void 0), [Tn, On] = B(void 0), [Zt] = B("#c8c8c8"), [$n] = B(1), [Te, Hn] = B(false), [Pt, Kt] = B([]), lt = le(null), Ne = le(null), at = le(false), Vn = le(null), Lt = le(null), It = le(null), qe = Q(async () => {
3283
3283
  if (It.current) try {
3284
- const y = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, D = It.current, R = 2, W = async (U = false) => {
3284
+ const y = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, D = It.current, R = 2, W = async (J = false) => {
3285
3285
  const oe = await y(D, {
3286
3286
  backgroundColor: null,
3287
3287
  useCORS: true,
@@ -3291,32 +3291,32 @@ let __tla = (async () => {
3291
3291
  return ((_a = nt.style) == null ? void 0 : _a.zIndex) === "10" || ((_b = nt.hasAttribute) == null ? void 0 : _b.call(nt, "data-finalizing-overlay"));
3292
3292
  }
3293
3293
  }), te = D.getBoundingClientRect(), Fe = te.width, Be = te.height;
3294
- let Me, ke, be, $e;
3295
- if (U) {
3294
+ let Me, Ae, be, $e;
3295
+ if (J) {
3296
3296
  const _e = oe.getContext("2d").getImageData(0, 0, oe.width, oe.height).data;
3297
3297
  let Re = oe.width, Ee = oe.height, ot = 0, pt = 0;
3298
3298
  for (let Ye = 0; Ye < oe.height; Ye++) for (let Xe = 0; Xe < oe.width; Xe++) {
3299
3299
  const no = (Ye * oe.width + Xe) * 4;
3300
3300
  _e[no + 3] > 20 && (Xe < Re && (Re = Xe), Xe > ot && (ot = Xe), Ye < Ee && (Ee = Ye), Ye > pt && (pt = Ye));
3301
3301
  }
3302
- ot <= Re && (Re = 0, Ee = 0, ot = oe.width, pt = oe.height), Me = Re / R, ke = Ee / R, be = ot / R, $e = pt / R;
3302
+ ot <= Re && (Re = 0, Ee = 0, ot = oe.width, pt = oe.height), Me = Re / R, Ae = Ee / R, be = ot / R, $e = pt / R;
3303
3303
  } else {
3304
3304
  const nt = D.querySelectorAll("[style*='pointer-events: none']");
3305
- Me = 1 / 0, ke = 1 / 0, be = -1 / 0, $e = -1 / 0, nt.forEach((Et) => {
3305
+ Me = 1 / 0, Ae = 1 / 0, be = -1 / 0, $e = -1 / 0, nt.forEach((Et) => {
3306
3306
  const _e = Et.getBoundingClientRect();
3307
3307
  if (_e.width === 0 || _e.height === 0) return;
3308
3308
  const Re = _e.left - te.left, Ee = _e.top - te.top;
3309
- Re < Me && (Me = Re), Ee < ke && (ke = Ee), Re + _e.width > be && (be = Re + _e.width), Ee + _e.height > $e && ($e = Ee + _e.height);
3310
- }), Me === 1 / 0 && (Me = 0, ke = 0, be = Fe, $e = Be);
3309
+ Re < Me && (Me = Re), Ee < Ae && (Ae = Ee), Re + _e.width > be && (be = Re + _e.width), Ee + _e.height > $e && ($e = Ee + _e.height);
3310
+ }), Me === 1 / 0 && (Me = 0, Ae = 0, be = Fe, $e = Be);
3311
3311
  }
3312
3312
  const on = Math.max(Fe, Be) * 0.03, rn = Math.max(Fe, Be) * 0.06;
3313
- Me = Math.max(0, Me - on), ke = Math.max(0, ke - rn), be = Math.min(Fe, be + on), $e = Math.min(Be, $e + rn);
3314
- const Wt = (be - Me) * R, Bt = ($e - ke) * R, eo = Math.max(0, Me * R), to = Math.max(0, ke * R), ut = document.createElement("canvas");
3313
+ Me = Math.max(0, Me - on), Ae = Math.max(0, Ae - rn), be = Math.min(Fe, be + on), $e = Math.min(Be, $e + rn);
3314
+ const Wt = (be - Me) * R, Bt = ($e - Ae) * R, eo = Math.max(0, Me * R), to = Math.max(0, Ae * R), ut = document.createElement("canvas");
3315
3315
  return ut.width = Math.round(Wt), ut.height = Math.round(Bt), ut.getContext("2d").drawImage(oe, Math.round(eo), Math.round(to), Math.round(Wt), Math.round(Bt), 0, 0, Math.round(Wt), Math.round(Bt)), ut.toDataURL("image/png");
3316
3316
  };
3317
- Lt.current && Lt.current(), await new Promise((U) => setTimeout(U, 100)), await new Promise((U) => requestAnimationFrame(() => requestAnimationFrame(U)));
3317
+ Lt.current && Lt.current(), await new Promise((J) => setTimeout(J, 100)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3318
3318
  const ge = await W();
3319
- L("2D"), await new Promise((U) => setTimeout(U, 200)), await new Promise((U) => requestAnimationFrame(() => requestAnimationFrame(U)));
3319
+ L("2D"), await new Promise((J) => setTimeout(J, 200)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3320
3320
  const G = await W(true);
3321
3321
  return L("3D"), {
3322
3322
  frontal_view_png: ge,
@@ -3325,40 +3325,40 @@ let __tla = (async () => {
3325
3325
  } catch {
3326
3326
  return;
3327
3327
  }
3328
- }, []), Ce = J((y) => {
3328
+ }, []), Ce = Q((y) => {
3329
3329
  const D = /* @__PURE__ */ new Date(), R = `${String(D.getHours()).padStart(2, "0")}:${String(D.getMinutes()).padStart(2, "0")}:${String(D.getSeconds()).padStart(2, "0")}.${String(D.getMilliseconds()).padStart(3, "0")}`;
3330
3330
  Kt((W) => [
3331
3331
  ...W.slice(-200),
3332
3332
  `[${R}] ${y}`
3333
3333
  ]);
3334
- }, []), { landmarkPoints: T, clearLandmarkPoints: jn, addLandmarkPoint: Ut, removeLandmarkPoint: Jt, updateLandmarkPositions: Qt, setAligned: qt, isAligned: K, setCut: en, isCut: Dt, reset: ct } = Ht();
3335
- Q(() => {
3334
+ }, []), { landmarkPoints: T, clearLandmarkPoints: jn, addLandmarkPoint: Ut, removeLandmarkPoint: Jt, updateLandmarkPositions: Qt, setAligned: qt, isAligned: U, setCut: en, isCut: Dt, reset: ct } = Ht();
3335
+ K(() => {
3336
3336
  ct();
3337
3337
  }, [
3338
3338
  ct
3339
3339
  ]);
3340
- const dt = z * xt;
3341
- Q(() => {
3342
- if (!s || T.length === 0) return;
3340
+ const dt = v * xt;
3341
+ K(() => {
3342
+ if (!a || T.length === 0) return;
3343
3343
  const y = T[T.length - 1];
3344
3344
  Ce(`LANDMARK[${T.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3345
3345
  }, [
3346
3346
  T.length,
3347
- s,
3347
+ a,
3348
3348
  Ce
3349
- ]), Q(() => {
3350
- s && K && Ce("STATE: mesh aligned");
3349
+ ]), K(() => {
3350
+ a && U && Ce("STATE: mesh aligned");
3351
3351
  }, [
3352
- K,
3353
- s,
3352
+ U,
3353
+ a,
3354
3354
  Ce
3355
- ]), Q(() => {
3356
- s && Dt && Ce("STATE: mesh cut");
3355
+ ]), K(() => {
3356
+ a && Dt && Ce("STATE: mesh cut");
3357
3357
  }, [
3358
3358
  Dt,
3359
- s,
3359
+ a,
3360
3360
  Ce
3361
- ]), Q(() => {
3361
+ ]), K(() => {
3362
3362
  lt.current && (lt.current.scrollTop = lt.current.scrollHeight);
3363
3363
  }, [
3364
3364
  Pt
@@ -3366,22 +3366,22 @@ let __tla = (async () => {
3366
3366
  const tn = H(() => xe ? new O.Mesh(xe) : null, [
3367
3367
  xe
3368
3368
  ]);
3369
- Q(() => {
3370
- o && kt(o);
3369
+ K(() => {
3370
+ o && At(o);
3371
3371
  }, [
3372
3372
  o
3373
- ]), Q(() => {
3374
- o || kt(void 0);
3373
+ ]), K(() => {
3374
+ o || At(void 0);
3375
3375
  }, [
3376
- z
3376
+ v
3377
3377
  ]);
3378
3378
  const ft = le(false);
3379
- Q(() => {
3380
- if (!K || j.length === 0 || ft.current || !c) return;
3379
+ K(() => {
3380
+ if (!U || j.length === 0 || ft.current || !c) return;
3381
3381
  ft.current = true;
3382
3382
  const y = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3383
3383
  c("dimensions_calculated", {
3384
- spacing_type: F,
3384
+ spacing_type: P,
3385
3385
  source_unit: "mm",
3386
3386
  file_format: Ve,
3387
3387
  measurement_source: "scan_derived",
@@ -3396,25 +3396,25 @@ let __tla = (async () => {
3396
3396
  frontal_height: y !== null ? +y.toFixed(1) : null
3397
3397
  });
3398
3398
  }, [
3399
- K,
3399
+ U,
3400
3400
  j
3401
- ]), Q(() => {
3402
- a !== void 0 && (Ne.current = a), Hn(true);
3401
+ ]), K(() => {
3402
+ l !== void 0 && (Ne.current = l), Hn(true);
3403
3403
  }, [
3404
- a
3404
+ l
3405
3405
  ]);
3406
- const et = J((y, D) => {
3406
+ const et = Q((y, D) => {
3407
3407
  y.computeBoundingBox();
3408
- const R = y.boundingBox, W = new C();
3408
+ const R = y.boundingBox, W = new M();
3409
3409
  R.getCenter(W), y.translate(-W.x, -W.y, -W.z), y.computeBoundingBox();
3410
- const ge = y.boundingBox, G = new C();
3410
+ const ge = y.boundingBox, G = new M();
3411
3411
  ge.getSize(G), f(Math.max(G.x, G.y, G.z));
3412
- const U = new O.Mesh(y, new O.MeshStandardMaterial({
3412
+ const J = new O.Mesh(y, new O.MeshStandardMaterial({
3413
3413
  color: 8947848,
3414
3414
  side: O.DoubleSide
3415
3415
  }));
3416
- m(U), fe(D), ee(true), pe(false), at.current = false;
3417
- }, []), Oe = J(async (y, D) => {
3416
+ m(J), fe(D), ee(true), pe(false), at.current = false;
3417
+ }, []), Oe = Q(async (y, D) => {
3418
3418
  De(null);
3419
3419
  const R = D.toLowerCase(), W = R.endsWith(".stl");
3420
3420
  if (!R.endsWith(".obj") && !W) {
@@ -3440,17 +3440,17 @@ let __tla = (async () => {
3440
3440
  G = await Tt(Fe);
3441
3441
  }
3442
3442
  else G = typeof y == "string" ? y : new TextDecoder().decode(y);
3443
- const U = performance.now(), oe = Ne.current ? await yo(G, Ne.current, (te) => {
3443
+ const J = performance.now(), oe = Ne.current ? await yo(G, Ne.current, (te) => {
3444
3444
  b(te), Ce(`PREPROCESS: ${te}`);
3445
3445
  }) : null;
3446
- if (oe) Ce(`PREPROCESS: done in ${(performance.now() - U).toFixed(0)}ms \u2014 unit=${oe.detectedUnit}, scaled=${oe.wasScaled}`), e.showAmputationModal && !r ? (v(oe), M(true)) : et(oe.geometry, oe.wasScaled);
3446
+ if (oe) Ce(`PREPROCESS: done in ${(performance.now() - J).toFixed(0)}ms \u2014 unit=${oe.detectedUnit}, scaled=${oe.wasScaled}`), t.showAmputationModal && !r ? (C(oe), z(true)) : et(oe.geometry, oe.wasScaled);
3447
3447
  else {
3448
3448
  b("Using fallback loader...");
3449
3449
  const te = wo(G);
3450
- te ? e.showAmputationModal && !r ? (v({
3450
+ te ? t.showAmputationModal && !r ? (C({
3451
3451
  geometry: te,
3452
3452
  wasScaled: false
3453
- }), M(true)) : et(te, false) : De("Failed to parse the mesh.");
3453
+ }), z(true)) : et(te, false) : De("Failed to parse the mesh.");
3454
3454
  }
3455
3455
  } catch (G) {
3456
3456
  De(G instanceof Error ? G.message : "Failed to process the mesh file.");
@@ -3459,18 +3459,18 @@ let __tla = (async () => {
3459
3459
  }
3460
3460
  }, [
3461
3461
  Te,
3462
- e.showAmputationModal,
3462
+ t.showAmputationModal,
3463
3463
  r,
3464
3464
  et
3465
3465
  ]);
3466
- Q(() => {
3467
- if (!t || !Te) return;
3466
+ K(() => {
3467
+ if (!n || !Te) return;
3468
3468
  (async () => {
3469
3469
  p(true), b("Loading scan...");
3470
3470
  try {
3471
- const D = await fetch(t);
3471
+ const D = await fetch(n);
3472
3472
  if (!D.ok) throw new Error(`Failed to download scan: ${D.status}`);
3473
- const W = new URL(t).pathname.split("/").pop() || "scan.obj";
3473
+ const W = new URL(n).pathname.split("/").pop() || "scan.obj";
3474
3474
  if (W.toLowerCase().endsWith(".stl")) {
3475
3475
  const G = await D.arrayBuffer();
3476
3476
  await Oe(G, W);
@@ -3483,14 +3483,14 @@ let __tla = (async () => {
3483
3483
  }
3484
3484
  })();
3485
3485
  }, [
3486
- t,
3486
+ n,
3487
3487
  Te
3488
3488
  ]);
3489
- const Nn = J((y) => {
3489
+ const Nn = Q((y) => {
3490
3490
  y.preventDefault(), x(true);
3491
- }, []), Yn = J((y) => {
3491
+ }, []), Yn = Q((y) => {
3492
3492
  y.preventDefault(), x(false);
3493
- }, []), Xn = J(async (y) => {
3493
+ }, []), Xn = Q(async (y) => {
3494
3494
  if (y.preventDefault(), x(false), !Te) {
3495
3495
  De("WASM module is still loading. Please wait.");
3496
3496
  return;
@@ -3517,8 +3517,8 @@ let __tla = (async () => {
3517
3517
  }, [
3518
3518
  Te,
3519
3519
  Oe
3520
- ]), Gn = J((y) => {
3521
- I(y), P(y === "AK" ? 2 : 1), M(false), h && (et(h.geometry, h.wasScaled), v(null)), c == null ? void 0 : c("file_loaded", {
3520
+ ]), Gn = Q((y) => {
3521
+ I(y), k(y === "AK" ? 2 : 1), z(false), h && (et(h.geometry, h.wasScaled), C(null)), c == null ? void 0 : c("file_loaded", {
3522
3522
  spacing_type: y,
3523
3523
  file_format: Ve,
3524
3524
  is_double_wall: false
@@ -3529,22 +3529,22 @@ let __tla = (async () => {
3529
3529
  c,
3530
3530
  Ve
3531
3531
  ]);
3532
- Q(() => {
3533
- if (!n || T.length !== 1 || !Ne.current || at.current) return;
3532
+ K(() => {
3533
+ if (!e || T.length !== 1 || !Ne.current || at.current) return;
3534
3534
  at.current = true;
3535
- const y = T[0], D = Ne.current, R = n.geometry, { positions: W, indices: ge } = bt(R), G = new Float32Array([
3535
+ const y = T[0], D = Ne.current, R = e.geometry, { positions: W, indices: ge } = bt(R), G = new Float32Array([
3536
3536
  y.position.x,
3537
3537
  y.position.y,
3538
3538
  y.position.z
3539
- ]), U = D.detect_shell(W, ge, G, 40), oe = U.details(), te = U.is_double_shell();
3540
- Ce(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${oe}`), te && (ue(true), re(true), Ce(`SHELL_DETECT: double shell, thickness=${U.thickness().toFixed(1)}mm`));
3539
+ ]), J = D.detect_shell(W, ge, G, 40), oe = J.details(), te = J.is_double_shell();
3540
+ Ce(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${oe}`), te && (ue(true), re(true), Ce(`SHELL_DETECT: double shell, thickness=${J.thickness().toFixed(1)}mm`));
3541
3541
  }, [
3542
- n,
3542
+ e,
3543
3543
  T,
3544
3544
  Ce
3545
3545
  ]);
3546
- const Zn = J(() => {
3547
- if (!n || T.length < 2) return;
3546
+ const Zn = Q(() => {
3547
+ if (!e || T.length < 2) return;
3548
3548
  Y(true), ye("Please wait..."), Ce("PIPELINE: starting processing pipeline...");
3549
3549
  const y = performance.now();
3550
3550
  setTimeout(() => {
@@ -3553,7 +3553,7 @@ let __tla = (async () => {
3553
3553
  T[0],
3554
3554
  ...T.slice(2)
3555
3555
  ];
3556
- zo(n, D, xt, {
3556
+ zo(e, D, xt, {
3557
3557
  onStatus: (R) => {
3558
3558
  ye(R), Ce(`PIPELINE: ${R}`);
3559
3559
  },
@@ -3587,7 +3587,7 @@ let __tla = (async () => {
3587
3587
  }), Ce(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), ft.current = false, Y(false);
3588
3588
  }, 50);
3589
3589
  }, [
3590
- n,
3590
+ e,
3591
3591
  T,
3592
3592
  Qt,
3593
3593
  qt,
@@ -3595,54 +3595,54 @@ let __tla = (async () => {
3595
3595
  Jt,
3596
3596
  en,
3597
3597
  Z
3598
- ]), _t = le(false), Kn = J(async () => {
3599
- if (ct(), N([]), Pe(null), Se(null), se(null), vt(null), Nt(null), Vt(null), rt(false), Gt(false), At(true), ue(false), pe(false), at.current = false, _t.current = false, ft.current = false, L("3D"), t && Te) {
3598
+ ]), _t = le(false), Kn = Q(async () => {
3599
+ if (ct(), N([]), Pe(null), Se(null), se(null), vt(null), Nt(null), Vt(null), rt(false), Gt(false), kt(true), ue(false), pe(false), at.current = false, _t.current = false, ft.current = false, L("3D"), n && Te) {
3600
3600
  m(null);
3601
3601
  try {
3602
- const y = await fetch(t);
3602
+ const y = await fetch(n);
3603
3603
  if (!y.ok) throw new Error(`Failed to download scan: ${y.status}`);
3604
- const R = new URL(t).pathname.split("/").pop() || "scan.obj";
3604
+ const R = new URL(n).pathname.split("/").pop() || "scan.obj";
3605
3605
  R.toLowerCase().endsWith(".stl") ? await Oe(await y.arrayBuffer(), R) : await Oe(await y.text(), R);
3606
3606
  } catch (y) {
3607
3607
  De(y instanceof Error ? y.message : "Failed to reload scan.");
3608
3608
  }
3609
3609
  }
3610
3610
  }, [
3611
- t,
3611
+ n,
3612
3612
  Te,
3613
3613
  Oe,
3614
3614
  ct
3615
3615
  ]);
3616
- Q(() => {
3617
- K && j.length > 0 && !_t.current && (_t.current = true, rt(true));
3616
+ K(() => {
3617
+ U && j.length > 0 && !_t.current && (_t.current = true, rt(true));
3618
3618
  }, [
3619
- K,
3619
+ U,
3620
3620
  j.length
3621
3621
  ]);
3622
3622
  const tt = H(() => {
3623
3623
  var _a;
3624
- if (!n || T.length < 3) return 0;
3624
+ if (!e || T.length < 3) return 0;
3625
3625
  if (X) return Math.abs(T[0].position.y - T[2].position.y);
3626
- const y = n.geometry;
3626
+ const y = e.geometry;
3627
3627
  y.computeBoundingBox();
3628
3628
  const D = ((_a = y.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3629
3629
  return Math.abs(T[0].position.y - D);
3630
3630
  }, [
3631
- n,
3631
+ e,
3632
3632
  T,
3633
3633
  X
3634
- ]), Un = J((y) => {
3635
- Wn(y), kt(y.circumferences), At(true), Gt(true);
3636
- }, []), nn = J(async (y) => {
3637
- if (!l) return;
3638
- const D = n ? await Promise.race([
3634
+ ]), Un = Q((y) => {
3635
+ Wn(y), At(y.circumferences), kt(true), Gt(true);
3636
+ }, []), nn = Q(async (y) => {
3637
+ if (!s) return;
3638
+ const D = e ? await Promise.race([
3639
3639
  qe(),
3640
3640
  new Promise((R) => setTimeout(() => R(void 0), 8e3))
3641
3641
  ]) : void 0;
3642
3642
  rt(false), Ft(false), st(true);
3643
3643
  try {
3644
- l({
3645
- spacingType: F ?? "BK",
3644
+ s({
3645
+ spacingType: P ?? "BK",
3646
3646
  sourceUnit: "mm",
3647
3647
  fileFormat: Ve,
3648
3648
  measurementSource: "form_provided",
@@ -3653,7 +3653,7 @@ let __tla = (async () => {
3653
3653
  frontalHeight: tt,
3654
3654
  transverseML: 0,
3655
3655
  transverseAP: 0,
3656
- scanUrl: t,
3656
+ scanUrl: n,
3657
3657
  decision: "skip",
3658
3658
  skipReason: y,
3659
3659
  screenshots: D
@@ -3662,18 +3662,18 @@ let __tla = (async () => {
3662
3662
  st(false);
3663
3663
  }
3664
3664
  }, [
3665
- l,
3666
- n,
3667
- F,
3665
+ s,
3666
+ e,
3667
+ P,
3668
3668
  Ve,
3669
3669
  X,
3670
3670
  ve,
3671
3671
  j,
3672
3672
  tt,
3673
- t,
3673
+ n,
3674
3674
  qe
3675
- ]), Rt = J(async (y) => {
3676
- if (!l || !n || j.length === 0 || !F) return;
3675
+ ]), Rt = Q(async (y) => {
3676
+ if (!s || !e || j.length === 0 || !P) return;
3677
3677
  const D = await Promise.race([
3678
3678
  qe(),
3679
3679
  new Promise((R) => setTimeout(() => R(void 0), 8e3))
@@ -3682,19 +3682,19 @@ let __tla = (async () => {
3682
3682
  try {
3683
3683
  let R = 0, W = 0;
3684
3684
  if (T.length >= 2) {
3685
- const ge = n.geometry, U = T[0].position.y;
3685
+ const ge = e.geometry, J = T[0].position.y;
3686
3686
  try {
3687
- const oe = Mn(ge), te = Ge(oe, ge, U);
3687
+ const oe = Mn(ge), te = Ge(oe, ge, J);
3688
3688
  if (te.linePoints.length >= 2) {
3689
- let Fe = te.linePoints[0], Be = te.linePoints[0], Me = te.linePoints[0], ke = te.linePoints[0];
3690
- for (const be of te.linePoints) be.x < Fe.x && (Fe = be), be.x > Be.x && (Be = be), be.z < Me.z && (Me = be), be.z > ke.z && (ke = be);
3691
- R = new C(Fe.x, U, Fe.z).distanceTo(new C(Be.x, U, Be.z)), W = new C(Me.x, U, Me.z).distanceTo(new C(ke.x, U, ke.z));
3689
+ let Fe = te.linePoints[0], Be = te.linePoints[0], Me = te.linePoints[0], Ae = te.linePoints[0];
3690
+ for (const be of te.linePoints) be.x < Fe.x && (Fe = be), be.x > Be.x && (Be = be), be.z < Me.z && (Me = be), be.z > Ae.z && (Ae = be);
3691
+ R = new M(Fe.x, J, Fe.z).distanceTo(new M(Be.x, J, Be.z)), W = new M(Me.x, J, Me.z).distanceTo(new M(Ae.x, J, Ae.z));
3692
3692
  }
3693
3693
  } catch {
3694
3694
  }
3695
3695
  }
3696
- l({
3697
- spacingType: F,
3696
+ s({
3697
+ spacingType: P,
3698
3698
  sourceUnit: "mm",
3699
3699
  fileFormat: Ve,
3700
3700
  measurementSource: y === "use_form_measurements" ? "form_provided" : "scan_derived",
@@ -3705,7 +3705,7 @@ let __tla = (async () => {
3705
3705
  frontalHeight: (Qe == null ? void 0 : Qe.frontalHeight) ?? tt,
3706
3706
  transverseML: R,
3707
3707
  transverseAP: W,
3708
- scanUrl: t,
3708
+ scanUrl: n,
3709
3709
  decision: y,
3710
3710
  userEnteredMeasurements: Qe ?? void 0,
3711
3711
  screenshots: D
@@ -3714,15 +3714,15 @@ let __tla = (async () => {
3714
3714
  st(false);
3715
3715
  }
3716
3716
  }, [
3717
- l,
3718
- n,
3717
+ s,
3718
+ e,
3719
3719
  j,
3720
- F,
3720
+ P,
3721
3721
  T,
3722
3722
  Ve,
3723
3723
  X,
3724
3724
  ve,
3725
- t,
3725
+ n,
3726
3726
  Qe,
3727
3727
  tt,
3728
3728
  qe
@@ -3740,13 +3740,13 @@ let __tla = (async () => {
3740
3740
  }, [
3741
3741
  ve,
3742
3742
  j
3743
- ]), Qn = it ? 5 : K && je || K ? 4 : n ? T.length === 0 ? 2 : 3 : 1, qn = [
3743
+ ]), Qn = it ? 5 : U && je || U ? 4 : e ? T.length === 0 ? 2 : 3 : 1, qn = [
3744
3744
  {
3745
3745
  label: "Load File",
3746
3746
  number: 1
3747
3747
  },
3748
3748
  {
3749
- label: F === "AK" ? "Set IT" : "Set MPT",
3749
+ label: P === "AK" ? "Set IT" : "Set MPT",
3750
3750
  number: 2
3751
3751
  },
3752
3752
  {
@@ -3762,10 +3762,10 @@ let __tla = (async () => {
3762
3762
  number: 5
3763
3763
  }
3764
3764
  ];
3765
- return k(ho.Provider, {
3766
- value: e,
3765
+ return F(ho.Provider, {
3766
+ value: t,
3767
3767
  children: [
3768
- k("div", {
3768
+ F("div", {
3769
3769
  style: {
3770
3770
  flex: 1,
3771
3771
  display: "flex",
@@ -3776,7 +3776,7 @@ let __tla = (async () => {
3776
3776
  height: "100%"
3777
3777
  },
3778
3778
  children: [
3779
- e.showToolbar && i("div", {
3779
+ t.showToolbar && i("div", {
3780
3780
  style: {
3781
3781
  height: 83,
3782
3782
  backgroundColor: "#9e9e9e",
@@ -3798,7 +3798,7 @@ let __tla = (async () => {
3798
3798
  steps: qn,
3799
3799
  currentStep: Qn
3800
3800
  }),
3801
- k("div", {
3801
+ F("div", {
3802
3802
  style: {
3803
3803
  flex: 1,
3804
3804
  display: "flex",
@@ -3806,7 +3806,7 @@ let __tla = (async () => {
3806
3806
  minHeight: 0
3807
3807
  },
3808
3808
  children: [
3809
- k("div", {
3809
+ F("div", {
3810
3810
  style: {
3811
3811
  flex: 1,
3812
3812
  display: "flex",
@@ -3814,7 +3814,7 @@ let __tla = (async () => {
3814
3814
  minHeight: 0
3815
3815
  },
3816
3816
  children: [
3817
- K && je && F && i("div", {
3817
+ U && je && P && i("div", {
3818
3818
  style: {
3819
3819
  width: 340,
3820
3820
  flexShrink: 0,
@@ -3822,8 +3822,8 @@ let __tla = (async () => {
3822
3822
  overflow: "hidden"
3823
3823
  },
3824
3824
  children: i(Qo, {
3825
- amputationType: F,
3826
- spacingInches: z,
3825
+ amputationType: P,
3826
+ spacingInches: v,
3827
3827
  scanMeasurements: j,
3828
3828
  scanFrontalHeight: tt,
3829
3829
  onSave: Un,
@@ -3834,7 +3834,7 @@ let __tla = (async () => {
3834
3834
  initialFrontalHeight: Qe == null ? void 0 : Qe.frontalHeight
3835
3835
  })
3836
3836
  }),
3837
- k("div", {
3837
+ F("div", {
3838
3838
  ref: It,
3839
3839
  style: {
3840
3840
  flex: 1,
@@ -3842,11 +3842,11 @@ let __tla = (async () => {
3842
3842
  minHeight: 0,
3843
3843
  overflow: "hidden"
3844
3844
  },
3845
- onDragOver: e.showDragDrop ? Nn : void 0,
3846
- onDragLeave: e.showDragDrop ? Yn : void 0,
3847
- onDrop: e.showDragDrop ? Xn : void 0,
3845
+ onDragOver: t.showDragDrop ? Nn : void 0,
3846
+ onDragLeave: t.showDragDrop ? Yn : void 0,
3847
+ onDrop: t.showDragDrop ? Xn : void 0,
3848
3848
  children: [
3849
- e.showDragDrop && !n && !S && i("div", {
3849
+ t.showDragDrop && !e && !S && i("div", {
3850
3850
  style: {
3851
3851
  position: "absolute",
3852
3852
  inset: 16,
@@ -3865,7 +3865,7 @@ let __tla = (async () => {
3865
3865
  fontFamily: "system-ui, sans-serif"
3866
3866
  },
3867
3867
  children: "Drag & Drop Files Here"
3868
- }) : k("div", {
3868
+ }) : F("div", {
3869
3869
  style: {
3870
3870
  textAlign: "center"
3871
3871
  },
@@ -3895,7 +3895,7 @@ let __tla = (async () => {
3895
3895
  ]
3896
3896
  })
3897
3897
  }),
3898
- !e.showDragDrop && !n && !S && !zt && i("div", {
3898
+ !t.showDragDrop && !e && !S && !zt && i("div", {
3899
3899
  style: {
3900
3900
  position: "absolute",
3901
3901
  inset: 0,
@@ -3903,7 +3903,7 @@ let __tla = (async () => {
3903
3903
  alignItems: "center",
3904
3904
  justifyContent: "center"
3905
3905
  },
3906
- children: k("div", {
3906
+ children: F("div", {
3907
3907
  style: {
3908
3908
  textAlign: "center"
3909
3909
  },
@@ -3933,7 +3933,7 @@ let __tla = (async () => {
3933
3933
  ]
3934
3934
  })
3935
3935
  }),
3936
- n && !K && T.length === 0 && k("div", {
3936
+ e && !U && T.length === 0 && F("div", {
3937
3937
  style: {
3938
3938
  position: "absolute",
3939
3939
  top: 16,
@@ -3962,10 +3962,10 @@ let __tla = (async () => {
3962
3962
  }
3963
3963
  }),
3964
3964
  "Click mesh to set ",
3965
- F === "AK" ? "IT" : "MPT"
3965
+ P === "AK" ? "IT" : "MPT"
3966
3966
  ]
3967
3967
  }),
3968
- n && !K && T.length === 1 && k("div", {
3968
+ e && !U && T.length === 1 && F("div", {
3969
3969
  style: {
3970
3970
  position: "absolute",
3971
3971
  top: 16,
@@ -4002,11 +4002,11 @@ let __tla = (async () => {
4002
4002
  V && i(cn, {
4003
4003
  message: q
4004
4004
  }),
4005
- zt && i(Ao, {
4005
+ zt && i(ko, {
4006
4006
  message: zt,
4007
4007
  onDismiss: () => De(null)
4008
4008
  }),
4009
- e.showAmputationModal && w && i("div", {
4009
+ t.showAmputationModal && w && i("div", {
4010
4010
  style: {
4011
4011
  position: "absolute",
4012
4012
  inset: 0,
@@ -4018,7 +4018,7 @@ let __tla = (async () => {
4018
4018
  justifyContent: "center",
4019
4019
  zIndex: 20
4020
4020
  },
4021
- children: k("div", {
4021
+ children: F("div", {
4022
4022
  style: {
4023
4023
  backgroundColor: "#fff",
4024
4024
  borderRadius: 4,
@@ -4027,7 +4027,7 @@ let __tla = (async () => {
4027
4027
  fontFamily: "system-ui, sans-serif"
4028
4028
  },
4029
4029
  children: [
4030
- k("div", {
4030
+ F("div", {
4031
4031
  style: {
4032
4032
  padding: "24px 24px 20px"
4033
4033
  },
@@ -4057,7 +4057,7 @@ let __tla = (async () => {
4057
4057
  children: [
4058
4058
  "AK",
4059
4059
  "BK"
4060
- ].map((y) => k("label", {
4060
+ ].map((y) => F("label", {
4061
4061
  onClick: () => I(y),
4062
4062
  style: {
4063
4063
  flex: 1,
@@ -4067,15 +4067,15 @@ let __tla = (async () => {
4067
4067
  border: "2px solid",
4068
4068
  borderRadius: 4,
4069
4069
  cursor: "pointer",
4070
- borderColor: F === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4071
- backgroundColor: F === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4070
+ borderColor: P === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4071
+ backgroundColor: P === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4072
4072
  transition: "border-color 0.15s, background-color 0.15s"
4073
4073
  },
4074
4074
  children: [
4075
4075
  i("input", {
4076
4076
  type: "radio",
4077
4077
  name: "ampType",
4078
- checked: F === y,
4078
+ checked: P === y,
4079
4079
  onChange: () => I(y),
4080
4080
  style: {
4081
4081
  accentColor: "rgb(12, 67, 173)",
@@ -4093,7 +4093,7 @@ let __tla = (async () => {
4093
4093
  },
4094
4094
  children: y
4095
4095
  }),
4096
- k("span", {
4096
+ F("span", {
4097
4097
  style: {
4098
4098
  fontSize: 13,
4099
4099
  color: "rgba(0,0,0,0.54)"
@@ -4108,7 +4108,7 @@ let __tla = (async () => {
4108
4108
  })
4109
4109
  ]
4110
4110
  }),
4111
- k("div", {
4111
+ F("div", {
4112
4112
  style: {
4113
4113
  display: "flex",
4114
4114
  justifyContent: "flex-end",
@@ -4119,7 +4119,7 @@ let __tla = (async () => {
4119
4119
  children: [
4120
4120
  i("button", {
4121
4121
  onClick: () => {
4122
- M(false), v(null);
4122
+ z(false), C(null);
4123
4123
  },
4124
4124
  style: {
4125
4125
  padding: "6px 16px",
@@ -4137,17 +4137,17 @@ let __tla = (async () => {
4137
4137
  children: "Cancel"
4138
4138
  }),
4139
4139
  i("button", {
4140
- onClick: () => F && Gn(F),
4141
- disabled: !F,
4140
+ onClick: () => P && Gn(P),
4141
+ disabled: !P,
4142
4142
  style: {
4143
4143
  padding: "6px 16px",
4144
4144
  borderRadius: 4,
4145
4145
  fontSize: 14,
4146
4146
  fontWeight: 500,
4147
- backgroundColor: F ? "rgb(12, 67, 173)" : "#e0e0e0",
4147
+ backgroundColor: P ? "rgb(12, 67, 173)" : "#e0e0e0",
4148
4148
  border: "none",
4149
- color: F ? "#fff" : "#9e9e9e",
4150
- cursor: F ? "pointer" : "not-allowed",
4149
+ color: P ? "#fff" : "#9e9e9e",
4150
+ cursor: P ? "pointer" : "not-allowed",
4151
4151
  fontFamily: "system-ui, sans-serif",
4152
4152
  lineHeight: "36px",
4153
4153
  letterSpacing: "0.4px"
@@ -4159,7 +4159,7 @@ let __tla = (async () => {
4159
4159
  ]
4160
4160
  })
4161
4161
  }),
4162
- e.showDragDrop && u && i("div", {
4162
+ t.showDragDrop && u && i("div", {
4163
4163
  style: {
4164
4164
  position: "absolute",
4165
4165
  inset: 0,
@@ -4169,8 +4169,8 @@ let __tla = (async () => {
4169
4169
  zIndex: 10
4170
4170
  }
4171
4171
  }),
4172
- i(ko, {
4173
- children: k(lo, {
4172
+ i(Ao, {
4173
+ children: F(lo, {
4174
4174
  camera: {
4175
4175
  position: [
4176
4176
  0,
@@ -4179,7 +4179,7 @@ let __tla = (async () => {
4179
4179
  ]
4180
4180
  },
4181
4181
  style: {
4182
- display: n ? "block" : "none",
4182
+ display: e ? "block" : "none",
4183
4183
  backgroundColor: We ? "#070611" : void 0
4184
4184
  },
4185
4185
  gl: {
@@ -4217,55 +4217,55 @@ let __tla = (async () => {
4217
4217
  ],
4218
4218
  intensity: 0.2
4219
4219
  }),
4220
- n && A === "3D" && i(Po, {
4221
- mesh: n,
4220
+ e && A === "3D" && i(Po, {
4221
+ mesh: e,
4222
4222
  maxPoints: 2,
4223
4223
  meshColor: Zt,
4224
4224
  meshOpacity: We ? 0.3 : $n,
4225
4225
  frontFaceOnly: Z,
4226
- doubleShellTransparency: X && K
4226
+ doubleShellTransparency: X && U
4227
4227
  }),
4228
- n && A === "3D" && i(Io, {
4228
+ e && A === "3D" && i(Io, {
4229
4229
  modelSize: d,
4230
4230
  labels: [
4231
- F === "AK" ? "IT" : "MPT",
4231
+ P === "AK" ? "IT" : "MPT",
4232
4232
  "Origin",
4233
4233
  "Cut Plane"
4234
4234
  ]
4235
4235
  }),
4236
4236
  i($o, {
4237
4237
  modelSize: d,
4238
- isAligned: K,
4238
+ isAligned: U,
4239
4239
  isCut: Dt,
4240
- mesh: n,
4240
+ mesh: e,
4241
4241
  viewMode: A,
4242
- sliceY: K && T.length >= 2 ? Ae ?? Ct ?? T[0].position.y : void 0,
4242
+ sliceY: U && T.length >= 2 ? ke ?? Ct ?? T[0].position.y : void 0,
4243
4243
  landmarkCount: T.length,
4244
4244
  measurementGeometry: xe,
4245
4245
  resetCameraToFrontRef: Lt
4246
4246
  }),
4247
- !K && i(mn, {
4247
+ !U && i(mn, {
4248
4248
  enableDamping: false
4249
4249
  }),
4250
- K && j.length > 0 && n && A === "3D" && i(Ho, {
4251
- mesh: n,
4250
+ U && j.length > 0 && e && A === "3D" && i(Ho, {
4251
+ mesh: e,
4252
4252
  isDragging: In
4253
4253
  }),
4254
- n && K && T.length >= 3 && (() => {
4255
- const D = n.geometry.getIndex();
4254
+ e && U && T.length >= 3 && (() => {
4255
+ const D = e.geometry.getIndex();
4256
4256
  if (!D || D.count < 30) return null;
4257
- const R = T[2], W = T[0], ge = Ke ?? R.position.y, G = Ae ?? Ct ?? W.position.y;
4257
+ const R = T[2], W = T[0], ge = Ke ?? R.position.y, G = ke ?? Ct ?? W.position.y;
4258
4258
  return A === "2D" ? i(Yo, {
4259
- mesh: tn ?? n,
4259
+ mesh: tn ?? e,
4260
4260
  upperY: G,
4261
4261
  originY: W.position.y,
4262
4262
  modelSize: d,
4263
4263
  meshColor: Zt,
4264
4264
  displayUnit: _
4265
- }) : k(He, {
4265
+ }) : F(He, {
4266
4266
  children: [
4267
4267
  i(Eo, {
4268
- mesh: tn ?? n,
4268
+ mesh: tn ?? e,
4269
4269
  startY: ge,
4270
4270
  endY: G,
4271
4271
  spacing: dt,
@@ -4279,7 +4279,7 @@ let __tla = (async () => {
4279
4279
  wasmSlices: Ie
4280
4280
  }),
4281
4281
  i(Oo, {
4282
- mesh: n,
4282
+ mesh: e,
4283
4283
  greenY: Mt ?? W.position.y,
4284
4284
  modelSize: d,
4285
4285
  displayUnit: _,
@@ -4287,11 +4287,11 @@ let __tla = (async () => {
4287
4287
  formHeight: je ? Tn : Je ? Qe == null ? void 0 : Qe.frontalHeight : void 0
4288
4288
  }),
4289
4289
  i(Xo, {
4290
- mesh: n,
4290
+ mesh: e,
4291
4291
  yPosition: Mt ?? W.position.y,
4292
- onYChange: (U) => {
4293
- Nt(U), Pe(null);
4294
- const oe = U - W.position.y;
4292
+ onYChange: (J) => {
4293
+ Nt(J), Pe(null);
4294
+ const oe = J - W.position.y;
4295
4295
  vt((Ct ?? W.position.y + dt * 2) + oe);
4296
4296
  },
4297
4297
  minY: W.position.y - dt,
@@ -4300,18 +4300,18 @@ let __tla = (async () => {
4300
4300
  color: "#44ff44",
4301
4301
  hoverColor: "#88ff88",
4302
4302
  dragColor: "#ffffff",
4303
- label: F === "AK" ? "IT" : "MPT",
4303
+ label: P === "AK" ? "IT" : "MPT",
4304
4304
  onDragStart: () => jt(true),
4305
4305
  onDragEnd: () => jt(false)
4306
4306
  })
4307
4307
  ]
4308
4308
  });
4309
4309
  })(),
4310
- n && K && A === "3D" && We && i(fr, {
4311
- mesh: n
4310
+ e && U && A === "3D" && We && i(fr, {
4311
+ mesh: e
4312
4312
  }),
4313
- n && e.showDebug && We && A === "3D" && i(dr, {
4314
- mesh: n,
4313
+ e && t.showDebug && We && A === "3D" && i(dr, {
4314
+ mesh: e,
4315
4315
  modelSize: d,
4316
4316
  layers: Yt,
4317
4317
  landmarkPoints: T,
@@ -4322,14 +4322,14 @@ let __tla = (async () => {
4322
4322
  }),
4323
4323
  i(gr, {
4324
4324
  screenshotFnRef: Vn,
4325
- mesh: n,
4325
+ mesh: e,
4326
4326
  modelSize: d,
4327
4327
  measurementGeometry: xe
4328
4328
  })
4329
4329
  ]
4330
4330
  })
4331
4331
  }),
4332
- n && k("div", {
4332
+ e && F("div", {
4333
4333
  style: {
4334
4334
  position: "absolute",
4335
4335
  top: 16,
@@ -4339,7 +4339,7 @@ let __tla = (async () => {
4339
4339
  gap: 8
4340
4340
  },
4341
4341
  children: [
4342
- e.showStartOver && i("button", {
4342
+ t.showStartOver && i("button", {
4343
4343
  onClick: () => window.location.reload(),
4344
4344
  style: {
4345
4345
  padding: "6px 16px",
@@ -4356,7 +4356,7 @@ let __tla = (async () => {
4356
4356
  },
4357
4357
  children: "Start Over"
4358
4358
  }),
4359
- !K && T.length >= 1 && i("button", {
4359
+ !U && T.length >= 1 && i("button", {
4360
4360
  onClick: jn,
4361
4361
  style: {
4362
4362
  padding: "6px 16px",
@@ -4373,7 +4373,7 @@ let __tla = (async () => {
4373
4373
  },
4374
4374
  children: "Reset Points"
4375
4375
  }),
4376
- K && !it && i("button", {
4376
+ U && !it && i("button", {
4377
4377
  onClick: Kn,
4378
4378
  style: {
4379
4379
  padding: "6px 16px",
@@ -4392,7 +4392,7 @@ let __tla = (async () => {
4392
4392
  })
4393
4393
  ]
4394
4394
  }),
4395
- e.showDebug && We && n && A === "3D" && i(pr, {
4395
+ t.showDebug && We && e && A === "3D" && i(pr, {
4396
4396
  layers: Yt,
4397
4397
  onToggleLayer: (y) => _n((D) => ({
4398
4398
  ...D,
@@ -4400,7 +4400,7 @@ let __tla = (async () => {
4400
4400
  })),
4401
4401
  isDoubleShell: X
4402
4402
  }),
4403
- K && j.length > 0 && k("div", {
4403
+ U && j.length > 0 && F("div", {
4404
4404
  style: {
4405
4405
  position: "absolute",
4406
4406
  top: 16,
@@ -4410,7 +4410,7 @@ let __tla = (async () => {
4410
4410
  zIndex: 10
4411
4411
  },
4412
4412
  children: [
4413
- k("div", {
4413
+ F("div", {
4414
4414
  style: {
4415
4415
  display: "flex",
4416
4416
  borderRadius: 6,
@@ -4450,7 +4450,7 @@ let __tla = (async () => {
4450
4450
  })
4451
4451
  ]
4452
4452
  }),
4453
- k("div", {
4453
+ F("div", {
4454
4454
  style: {
4455
4455
  display: "flex",
4456
4456
  borderRadius: 6,
@@ -4490,7 +4490,7 @@ let __tla = (async () => {
4490
4490
  })
4491
4491
  ]
4492
4492
  }),
4493
- e.showSpacingToggle && A === "3D" && k("div", {
4493
+ t.showSpacingToggle && A === "3D" && F("div", {
4494
4494
  style: {
4495
4495
  display: "flex",
4496
4496
  borderRadius: 6,
@@ -4500,13 +4500,13 @@ let __tla = (async () => {
4500
4500
  },
4501
4501
  children: [
4502
4502
  i("button", {
4503
- onClick: () => P(1),
4503
+ onClick: () => k(1),
4504
4504
  style: {
4505
4505
  padding: "6px 14px",
4506
4506
  fontSize: 13,
4507
- fontWeight: z === 1 ? 600 : 400,
4508
- backgroundColor: z === 1 ? "rgb(12, 67, 173)" : "#fff",
4509
- color: z === 1 ? "#fff" : "#666",
4507
+ fontWeight: v === 1 ? 600 : 400,
4508
+ backgroundColor: v === 1 ? "rgb(12, 67, 173)" : "#fff",
4509
+ color: v === 1 ? "#fff" : "#666",
4510
4510
  border: "none",
4511
4511
  cursor: "pointer",
4512
4512
  fontFamily: "system-ui, sans-serif"
@@ -4514,13 +4514,13 @@ let __tla = (async () => {
4514
4514
  children: '1"'
4515
4515
  }),
4516
4516
  i("button", {
4517
- onClick: () => P(2),
4517
+ onClick: () => k(2),
4518
4518
  style: {
4519
4519
  padding: "6px 14px",
4520
4520
  fontSize: 13,
4521
- fontWeight: z === 2 ? 600 : 400,
4522
- backgroundColor: z === 2 ? "rgb(12, 67, 173)" : "#fff",
4523
- color: z === 2 ? "#fff" : "#666",
4521
+ fontWeight: v === 2 ? 600 : 400,
4522
+ backgroundColor: v === 2 ? "rgb(12, 67, 173)" : "#fff",
4523
+ color: v === 2 ? "#fff" : "#666",
4524
4524
  border: "none",
4525
4525
  borderLeft: "1px solid #ccc",
4526
4526
  cursor: "pointer",
@@ -4539,7 +4539,7 @@ let __tla = (async () => {
4539
4539
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4540
4540
  },
4541
4541
  children: i("button", {
4542
- onClick: () => At((y) => !y),
4542
+ onClick: () => kt((y) => !y),
4543
4543
  style: {
4544
4544
  padding: "6px 14px",
4545
4545
  fontSize: 13,
@@ -4553,7 +4553,7 @@ let __tla = (async () => {
4553
4553
  children: "Measurement Overlay"
4554
4554
  })
4555
4555
  }),
4556
- e.showSaveButton && i("div", {
4556
+ t.showSaveButton && i("div", {
4557
4557
  style: {
4558
4558
  display: "flex",
4559
4559
  borderRadius: 6,
@@ -4584,7 +4584,7 @@ let __tla = (async () => {
4584
4584
  children: "Save"
4585
4585
  })
4586
4586
  }),
4587
- e.showDebug && s && i("div", {
4587
+ t.showDebug && a && i("div", {
4588
4588
  style: {
4589
4589
  display: "flex",
4590
4590
  borderRadius: 6,
@@ -4609,11 +4609,11 @@ let __tla = (async () => {
4609
4609
  })
4610
4610
  ]
4611
4611
  }),
4612
- n && ie && i(Vo, {
4612
+ e && ie && i(Vo, {
4613
4613
  wasAutoScaled: ae,
4614
4614
  onDismiss: () => ee(false)
4615
4615
  }),
4616
- n && we && K && i(jo, {
4616
+ e && we && U && i(jo, {
4617
4617
  isDoubleShell: X,
4618
4618
  onDismiss: () => re(false)
4619
4619
  })
@@ -4621,7 +4621,7 @@ let __tla = (async () => {
4621
4621
  })
4622
4622
  ]
4623
4623
  }),
4624
- ze && k("div", {
4624
+ ze && F("div", {
4625
4625
  "data-finalizing-overlay": true,
4626
4626
  style: {
4627
4627
  position: "absolute",
@@ -4658,7 +4658,7 @@ let __tla = (async () => {
4658
4658
  })
4659
4659
  ]
4660
4660
  }),
4661
- k("div", {
4661
+ F("div", {
4662
4662
  style: {
4663
4663
  padding: "12px 24px",
4664
4664
  backgroundColor: "#fff",
@@ -4670,7 +4670,7 @@ let __tla = (async () => {
4670
4670
  flexShrink: 0
4671
4671
  },
4672
4672
  children: [
4673
- !je && l && i("button", {
4673
+ !je && s && i("button", {
4674
4674
  disabled: ze,
4675
4675
  onClick: () => Ft(true),
4676
4676
  style: {
@@ -4689,13 +4689,13 @@ let __tla = (async () => {
4689
4689
  children: "Have Galileo Check My Measurements"
4690
4690
  }),
4691
4691
  je && i("div", {}),
4692
- k("div", {
4692
+ F("div", {
4693
4693
  style: {
4694
4694
  display: "flex",
4695
4695
  gap: 8
4696
4696
  },
4697
4697
  children: [
4698
- n && !K && T.length >= 2 && i("button", {
4698
+ e && !U && T.length >= 2 && i("button", {
4699
4699
  onClick: Zn,
4700
4700
  style: {
4701
4701
  padding: "6px 16px",
@@ -4712,7 +4712,7 @@ let __tla = (async () => {
4712
4712
  },
4713
4713
  children: "Next \xBB"
4714
4714
  }),
4715
- K && it && !je && i("button", {
4715
+ U && it && !je && i("button", {
4716
4716
  onClick: () => rt(true),
4717
4717
  style: {
4718
4718
  padding: "6px 16px",
@@ -4729,7 +4729,7 @@ let __tla = (async () => {
4729
4729
  },
4730
4730
  children: "Edit Measurements"
4731
4731
  }),
4732
- K && it && (Jn ? i("button", {
4732
+ U && it && (Jn ? i("button", {
4733
4733
  disabled: ze,
4734
4734
  onClick: () => Rt("continue"),
4735
4735
  style: {
@@ -4746,7 +4746,7 @@ let __tla = (async () => {
4746
4746
  lineHeight: "36px"
4747
4747
  },
4748
4748
  children: "Continue"
4749
- }) : k(He, {
4749
+ }) : F(He, {
4750
4750
  children: [
4751
4751
  i("button", {
4752
4752
  disabled: ze,
@@ -4792,7 +4792,7 @@ let __tla = (async () => {
4792
4792
  })
4793
4793
  ]
4794
4794
  }),
4795
- s && Pt.length > 0 && k("div", {
4795
+ a && Pt.length > 0 && F("div", {
4796
4796
  style: {
4797
4797
  height: 120,
4798
4798
  flexShrink: 0,
@@ -4805,7 +4805,7 @@ let __tla = (async () => {
4805
4805
  flexDirection: "column"
4806
4806
  },
4807
4807
  children: [
4808
- k("div", {
4808
+ F("div", {
4809
4809
  style: {
4810
4810
  display: "flex",
4811
4811
  alignItems: "center",
@@ -4825,14 +4825,14 @@ let __tla = (async () => {
4825
4825
  },
4826
4826
  children: "GALILEO DEBUG"
4827
4827
  }),
4828
- k("div", {
4828
+ F("div", {
4829
4829
  style: {
4830
4830
  display: "flex",
4831
4831
  gap: 8,
4832
4832
  alignItems: "center"
4833
4833
  },
4834
4834
  children: [
4835
- k("span", {
4835
+ F("span", {
4836
4836
  style: {
4837
4837
  color: "#484f58",
4838
4838
  fontSize: 9
@@ -4843,7 +4843,7 @@ let __tla = (async () => {
4843
4843
  " | ",
4844
4844
  T.length,
4845
4845
  " pts | ",
4846
- K ? "aligned" : "unaligned",
4846
+ U ? "aligned" : "unaligned",
4847
4847
  " | ",
4848
4848
  j.length,
4849
4849
  " slices"
@@ -4889,97 +4889,114 @@ let __tla = (async () => {
4889
4889
  })
4890
4890
  ]
4891
4891
  }),
4892
- Rn && i(kn, {
4892
+ Rn && i(An, {
4893
4893
  onSkip: nn,
4894
4894
  onCancel: () => Ft(false)
4895
4895
  })
4896
4896
  ]
4897
4897
  });
4898
4898
  };
4899
- function gr({ screenshotFnRef: e }) {
4900
- return Q(() => {
4901
- e.current = null;
4899
+ function gr({ screenshotFnRef: t }) {
4900
+ return K(() => {
4901
+ t.current = null;
4902
4902
  }, [
4903
- e
4903
+ t
4904
4904
  ]), null;
4905
4905
  }
4906
- Ln = function(e) {
4907
- const r = e === "AK" ? 2 : 1, t = [];
4908
- for (let o = 2; o >= 1; o -= r) t.push(`${o}_above`);
4909
- t.push("at_ref");
4910
- for (let o = r; o <= 9; o += r) t.push(`${o}_below`);
4911
- if (e === "BK") for (const o of [
4906
+ Ln = function(t) {
4907
+ const r = t === "AK" ? 2 : 1, n = [];
4908
+ for (let o = 2; o >= 1; o -= r) n.push(`${o}_above`);
4909
+ n.push("at_ref");
4910
+ for (let o = r; o <= 9; o += r) n.push(`${o}_below`);
4911
+ if (t === "BK") for (const o of [
4912
4912
  10,
4913
4913
  11,
4914
4914
  12
4915
- ]) t.push(`${o}_below`);
4915
+ ]) n.push(`${o}_below`);
4916
4916
  else for (const o of [
4917
4917
  10,
4918
4918
  12,
4919
4919
  14,
4920
4920
  16,
4921
4921
  18
4922
- ]) t.push(`${o}_below`);
4923
- return t;
4922
+ ]) n.push(`${o}_below`);
4923
+ return n;
4924
4924
  };
4925
- mt = function(e, r) {
4926
- const t = Ln(r), o = {};
4927
- for (let l = 0; l < Math.min(e.length, t.length); l++) {
4928
- const s = e[l];
4929
- s != null && !isNaN(s) && (o[t[l]] = s);
4925
+ mt = function(t, r) {
4926
+ const n = Ln(r), o = {};
4927
+ for (let s = 0; s < Math.min(t.length, n.length); s++) {
4928
+ const a = t[s];
4929
+ a != null && !isNaN(a) && (o[n[s]] = a);
4930
4930
  }
4931
4931
  return o;
4932
4932
  };
4933
- mr = function(e, r) {
4934
- if (!e) return;
4935
- const o = Ln(r).map((l) => {
4936
- const s = e[l];
4937
- return s ?? void 0;
4933
+ mr = function(t, r) {
4934
+ if (!t) return;
4935
+ const o = Ln(r).map((s) => {
4936
+ const a = t[s];
4937
+ return a ?? void 0;
4938
4938
  });
4939
- if (!o.every((l) => l == null)) return o;
4939
+ if (!o.every((s) => s == null)) return o;
4940
4940
  };
4941
- Ar = ({ request: e, onComplete: r, wasmModule: t }) => {
4942
- const o = H(() => mr(e.form_measurements, e.spacing_type), [
4943
- e.form_measurements,
4944
- e.spacing_type
4945
- ]), l = (s) => {
4941
+ kr = ({ request: t, onComplete: r, wasmModule: n }) => {
4942
+ const [o, s] = B(null);
4943
+ K(() => {
4944
+ if (n != null) return;
4945
+ let e = false;
4946
+ return (async () => {
4947
+ try {
4948
+ const m = await import("./geo_wasm-CDwm1q1Z.js");
4949
+ await m.default(), e || s(m);
4950
+ } catch (m) {
4951
+ console.error("[GirthManagerWidget] Failed to auto-load WASM:", m);
4952
+ }
4953
+ })(), () => {
4954
+ e = true;
4955
+ };
4956
+ }, [
4957
+ n
4958
+ ]);
4959
+ const a = n ?? o, c = H(() => mr(t.form_measurements, t.spacing_type), [
4960
+ t.form_measurements,
4961
+ t.spacing_type
4962
+ ]), l = (e) => {
4946
4963
  var _a, _b;
4947
- const c = s.scanMeasurements.map((p) => +(p.modifiedValue ?? p.originalValue).toFixed(1)), a = mt(c, e.spacing_type);
4948
- let n, m;
4949
- if (s.formMeasurements) {
4950
- n = mt(s.formMeasurements, e.spacing_type);
4951
- const p = s.scanMeasurements.map((g, b) => {
4964
+ const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = mt(m, t.spacing_type);
4965
+ let f, u;
4966
+ if (e.formMeasurements) {
4967
+ f = mt(e.formMeasurements, t.spacing_type);
4968
+ const A = e.scanMeasurements.map((L, v) => {
4952
4969
  var _a2;
4953
- const A = (_a2 = s.formMeasurements) == null ? void 0 : _a2[b];
4954
- return A == null || isNaN(A) ? null : +((g.modifiedValue ?? g.originalValue) - A).toFixed(1);
4970
+ const k = (_a2 = e.formMeasurements) == null ? void 0 : _a2[v];
4971
+ return k == null || isNaN(k) ? null : +((L.modifiedValue ?? L.originalValue) - k).toFixed(1);
4955
4972
  });
4956
- m = mt(p, e.spacing_type);
4973
+ u = mt(A, t.spacing_type);
4957
4974
  }
4958
- const d = s.userEnteredMeasurements ? mt(s.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, f = s.decision === "use_scan" || s.decision === "continue", u = f ? a : d ?? n ?? a, x = f ? +s.frontalHeight.toFixed(1) : +(((_a = s.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? s.frontalHeight).toFixed(1), S = {
4959
- spacing_type: e.spacing_type,
4975
+ const x = e.userEnteredMeasurements ? mt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, S = e.decision === "use_scan" || e.decision === "continue", p = S ? d : x ?? f ?? d, g = S ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1), b = {
4976
+ spacing_type: t.spacing_type,
4960
4977
  source_unit: "mm",
4961
- file_format: s.fileFormat,
4962
- measurement_source: s.formMeasurements ? "form_provided" : "scan_derived",
4963
- is_double_wall: s.isDoubleWall,
4978
+ file_format: e.fileFormat,
4979
+ measurement_source: e.formMeasurements ? "form_provided" : "scan_derived",
4980
+ is_double_wall: e.isDoubleWall,
4964
4981
  is_unit_converted: false,
4965
- form_measurements: n,
4966
- scan_measurements: a,
4967
- measurement_variance: m,
4968
- scan_url: e.scan_url,
4969
- frontal_height: +s.frontalHeight.toFixed(1),
4970
- transverse_ml: +s.transverseML.toFixed(1),
4971
- transverse_ap: +s.transverseAP.toFixed(1),
4972
- decision: s.decision,
4973
- skip_reason: s.skipReason,
4974
- user_measurements: d,
4975
- user_frontal_height: (_b = s.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
4976
- final_measurements: u,
4977
- final_frontal_height: x,
4978
- final_transverse_ml: +s.transverseML.toFixed(1),
4979
- final_transverse_ap: +s.transverseAP.toFixed(1),
4980
- screenshots: s.screenshots
4982
+ form_measurements: f,
4983
+ scan_measurements: d,
4984
+ measurement_variance: u,
4985
+ scan_url: t.scan_url,
4986
+ frontal_height: +e.frontalHeight.toFixed(1),
4987
+ transverse_ml: +e.transverseML.toFixed(1),
4988
+ transverse_ap: +e.transverseAP.toFixed(1),
4989
+ decision: e.decision,
4990
+ skip_reason: e.skipReason,
4991
+ user_measurements: x,
4992
+ user_frontal_height: (_b = e.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
4993
+ final_measurements: p,
4994
+ final_frontal_height: g,
4995
+ final_transverse_ml: +e.transverseML.toFixed(1),
4996
+ final_transverse_ap: +e.transverseAP.toFixed(1),
4997
+ screenshots: e.screenshots
4981
4998
  };
4982
- r == null ? void 0 : r(S);
4999
+ r == null ? void 0 : r(b);
4983
5000
  };
4984
5001
  return i("div", {
4985
5002
  style: {
@@ -4989,17 +5006,17 @@ let __tla = (async () => {
4989
5006
  },
4990
5007
  children: i(hr, {
4991
5008
  config: po,
4992
- spacingType: e.spacing_type,
4993
- scanUrl: e.scan_url,
4994
- formMeasurements: o,
5009
+ spacingType: t.spacing_type,
5010
+ scanUrl: t.scan_url,
5011
+ formMeasurements: c,
4995
5012
  onComplete: l,
4996
- wasmModule: t
5013
+ wasmModule: a
4997
5014
  })
4998
5015
  });
4999
5016
  };
5000
5017
  })();
5001
5018
  export {
5002
- Ar as G,
5019
+ kr as G,
5003
5020
  __tla,
5004
5021
  mt as a,
5005
5022
  mr as c,