@ssafy-mhk/e-ver 1.0.6 → 1.0.7

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.
package/dist/index.es.js CHANGED
@@ -62,7 +62,21 @@ var w = ({ children: t, showEnvironment: n = !0, useDefaultLights: r = !0, enabl
62
62
  }) : null
63
63
  ]
64
64
  })
65
- }), T = {
65
+ });
66
+ //#endregion
67
+ //#region src/math.ts
68
+ function T(e, t, n) {
69
+ return Math.max(t, Math.min(n, e));
70
+ }
71
+ function E(e) {
72
+ let t = e;
73
+ for (; t <= -Math.PI;) t += Math.PI * 2;
74
+ for (; t > Math.PI;) t -= Math.PI * 2;
75
+ return t;
76
+ }
77
+ //#endregion
78
+ //#region src/measurement/garmentScaler.ts
79
+ var D = {
66
80
  refShoulderWidthCm: 44,
67
81
  refHeightCm: 170,
68
82
  refArmLengthCm: 58,
@@ -78,37 +92,34 @@ var w = ({ children: t, showEnvironment: n = !0, useDefaultLights: r = !0, enabl
78
92
  armEaseCm: 2,
79
93
  fitEaseScale: 1.03
80
94
  };
81
- function E(e, t, n) {
95
+ function O(e, t, n) {
82
96
  return !e || t <= 0 ? 1 : (e + n) / t;
83
97
  }
84
- function D(e, t, n) {
85
- return Math.max(t, Math.min(n, e));
86
- }
87
- function O(e, t = T) {
88
- let n = E(e.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm), r = E(e.chestCircumferenceCm, t.refChestCircumferenceCm, t.chestEaseCm), i = E(e.waistCircumferenceCm, t.refWaistCircumferenceCm, t.waistEaseCm), a = E(e.hipWidthCm, t.refHipWidthCm, t.hipEaseCm), o = E(e.torsoLengthCm, t.refTorsoLengthCm, t.torsoEaseCm), s = t.refHeightCm > 0 ? e.heightCm / t.refHeightCm : 1, c = E(e.armLengthCm, t.refArmLengthCm, t.armEaseCm), l = Math.max(n, r, a), u = Math.max(r, i, a * .98), d = Math.max(s, o, l * .94);
98
+ function k(e, t = D) {
99
+ let n = O(e.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm), r = O(e.chestCircumferenceCm, t.refChestCircumferenceCm, t.chestEaseCm), i = O(e.waistCircumferenceCm, t.refWaistCircumferenceCm, t.waistEaseCm), a = O(e.hipWidthCm, t.refHipWidthCm, t.hipEaseCm), o = O(e.torsoLengthCm, t.refTorsoLengthCm, t.torsoEaseCm), s = t.refHeightCm > 0 ? e.heightCm / t.refHeightCm : 1, c = O(e.armLengthCm, t.refArmLengthCm, t.armEaseCm), l = Math.max(n, r, a), u = Math.max(r, i, a * .98), d = Math.max(s, o, l * .94);
89
100
  return {
90
- scaleX: D(l, .82, 1.85),
91
- scaleY: D(d, .85, 1.55),
92
- scaleZ: D(u, .84, 1.9),
93
- sleeveScale: D(c, .8, 1.55),
94
- fitEaseScale: D(t.fitEaseScale, 1, 1.2)
101
+ scaleX: T(l, .82, 1.85),
102
+ scaleY: T(d, .85, 1.55),
103
+ scaleZ: T(u, .84, 1.9),
104
+ sleeveScale: T(c, .8, 1.55),
105
+ fitEaseScale: T(t.fitEaseScale, 1, 1.2)
95
106
  };
96
107
  }
97
108
  //#endregion
98
109
  //#region src/fitting/bodyFirstFitting.ts
99
- var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, F = .8, I = 1.7, L = 1, R = 1.25, ee = {
110
+ var A = .82, j = 2.1, M = .85, N = 1.8, P = .84, ee = 2.1, F = .8, I = 1.7, L = 1, te = 1.25, ne = {
100
111
  scaleX: 1,
101
112
  scaleY: 1,
102
113
  scaleZ: 1,
103
114
  sleeveScale: 1,
104
115
  fitEaseScale: 1.02
105
- }, te = {
116
+ }, re = {
106
117
  scaleX: 1,
107
118
  scaleY: 1,
108
119
  scaleZ: 1,
109
120
  sleeveScale: 1,
110
121
  fitEaseScale: 1
111
- }, ne = {
122
+ }, ie = {
112
123
  slim: {
113
124
  x: .95,
114
125
  y: .95,
@@ -127,7 +138,7 @@ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, F = .8, I = 1.7, L = 1
127
138
  z: 1.02,
128
139
  ease: 1.03
129
140
  }
130
- }, re = {
141
+ }, ae = {
131
142
  narrow: {
132
143
  width: .97,
133
144
  shoulder: .97
@@ -140,7 +151,7 @@ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, F = .8, I = 1.7, L = 1
140
151
  width: 1.03,
141
152
  shoulder: 1.04
142
153
  }
143
- }, z = {
154
+ }, oe = {
144
155
  tapered: {
145
156
  depth: .98,
146
157
  vertical: .995,
@@ -157,114 +168,111 @@ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, F = .8, I = 1.7, L = 1
157
168
  hip: 1.03
158
169
  }
159
170
  };
160
- function B(e, t, n) {
161
- return Math.max(t, Math.min(n, e));
162
- }
163
- function V(e, t, n, r) {
164
- return !e || !t || t <= 0 ? 1 : B(e / t, n, r);
171
+ function R(e, t, n, r) {
172
+ return !e || !t || t <= 0 ? 1 : T(e / t, n, r);
165
173
  }
166
- function H(e, t, n, r, i) {
167
- return !e || t <= 0 ? 1 : B((e + n) / t, r, i);
174
+ function z(e, t, n, r, i) {
175
+ return !e || t <= 0 ? 1 : T((e + n) / t, r, i);
168
176
  }
169
- function ie(e) {
170
- return re[e?.taxonomy.upperBodySilhouette ?? "balanced"] ?? re.balanced;
177
+ function se(e) {
178
+ return ae[e?.taxonomy.upperBodySilhouette ?? "balanced"] ?? ae.balanced;
171
179
  }
172
- function ae(e) {
173
- return z[e?.taxonomy.torsoOrPelvisProfile ?? "balanced"] ?? z.balanced;
180
+ function ce(e) {
181
+ return oe[e?.taxonomy.torsoOrPelvisProfile ?? "balanced"] ?? oe.balanced;
174
182
  }
175
- function oe(e) {
183
+ function le(e) {
176
184
  if (!e) return !1;
177
185
  let { metrics: t } = e;
178
186
  return !!(t.heightCm || t.chestCm || t.waistCm || t.shoulderWidthCm || t.armLengthCm || t.torsoLengthCm || t.neckToHipCm);
179
187
  }
180
- function se(e, t) {
181
- let { metrics: n } = e, r = ie(e), i = ae(e), a = Math.max(H(n.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm * .55, .88, 1.3), H(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .35, .9, 1.34), H(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .3, .9, 1.3)) * r.width, o = Math.max(V(n.heightCm, t.refHeightCm, .9, 1.18), H(n.torsoLengthCm ?? n.neckToHipCm, t.refTorsoLengthCm, t.torsoEaseCm * .2, .9, 1.16)) * i.vertical, s = Math.max(H(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .15, .9, 1.34), H(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .1, .9, 1.28)) * i.depth;
188
+ function ue(e, t) {
189
+ let { metrics: n } = e, r = se(e), i = ce(e), a = Math.max(z(n.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm * .55, .88, 1.3), z(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .35, .9, 1.34), z(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .3, .9, 1.3)) * r.width, o = Math.max(R(n.heightCm, t.refHeightCm, .9, 1.18), z(n.torsoLengthCm ?? n.neckToHipCm, t.refTorsoLengthCm, t.torsoEaseCm * .2, .9, 1.16)) * i.vertical, s = Math.max(z(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .15, .9, 1.34), z(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .1, .9, 1.28)) * i.depth;
182
190
  return {
183
- scaleX: B(a, k, A),
184
- scaleY: B(o, j, M),
185
- scaleZ: B(s, N, P),
186
- sleeveScale: B(V(n.armLengthCm, t.refArmLengthCm, .9, 1.16), F, I),
187
- fitEaseScale: B(t.fitEaseScale * (r.width * .5 + i.depth * .5), L, R)
191
+ scaleX: T(a, A, j),
192
+ scaleY: T(o, M, N),
193
+ scaleZ: T(s, P, ee),
194
+ sleeveScale: T(R(n.armLengthCm, t.refArmLengthCm, .9, 1.16), F, I),
195
+ fitEaseScale: T(t.fitEaseScale * (r.width * .5 + i.depth * .5), L, te)
188
196
  };
189
197
  }
190
- function ce(e, t) {
191
- let { metrics: n } = t, r = ie(t), i = ae(t), a = V(e.shoulderWidthCm, n.shoulderWidthCm, .9, 1.14) * r.shoulder, o = V(e.chestCircumferenceCm, n.chestCm, .9, 1.15), s = V(e.waistCircumferenceCm, n.waistCm, .9, 1.15);
198
+ function de(e, t) {
199
+ let { metrics: n } = t, r = se(t), i = ce(t), a = R(e.shoulderWidthCm, n.shoulderWidthCm, .9, 1.14) * r.shoulder, o = R(e.chestCircumferenceCm, n.chestCm, .9, 1.15), s = R(e.waistCircumferenceCm, n.waistCm, .9, 1.15);
192
200
  return {
193
- torsoScale: V(e.torsoLengthCm, n.torsoLengthCm ?? n.neckToHipCm, .9, 1.14),
201
+ torsoScale: R(e.torsoLengthCm, n.torsoLengthCm ?? n.neckToHipCm, .9, 1.14),
194
202
  chestScale: o,
195
203
  waistScale: s,
196
- hipScale: B(s * .6 + i.hip * .4, .92, 1.14),
197
- shoulderAdjust: B(a - 1, -.12, .12),
204
+ hipScale: T(s * .6 + i.hip * .4, .92, 1.14),
205
+ shoulderAdjust: T(a - 1, -.12, .12),
198
206
  postureAdjust: "neutral"
199
207
  };
200
208
  }
201
- function le(e, t, n) {
202
- let r = ae(t), i = B(1 + n.shoulderAdjust, .92, 1.14) * .3 + n.chestScale * .45 + n.waistScale * .25, a = n.chestScale * .45 + n.waistScale * .25 + n.hipScale * .3, o = V(e.armLengthCm, t.metrics.armLengthCm, .9, 1.16), s = Math.max(n.chestScale, n.waistScale, n.hipScale);
209
+ function fe(e, t, n) {
210
+ let r = ce(t), i = T(1 + n.shoulderAdjust, .92, 1.14) * .3 + n.chestScale * .45 + n.waistScale * .25, a = n.chestScale * .45 + n.waistScale * .25 + n.hipScale * .3, o = R(e.armLengthCm, t.metrics.armLengthCm, .9, 1.16), s = Math.max(n.chestScale, n.waistScale, n.hipScale);
203
211
  return {
204
- scaleX: B(i, .92, 1.16),
205
- scaleY: B(n.torsoScale * r.vertical, .92, 1.14),
206
- scaleZ: B(a * r.depth, .92, 1.18),
207
- sleeveScale: B(o, F, I),
208
- fitEaseScale: B(1 + (s - 1) * .22, .99, 1.08)
212
+ scaleX: T(i, .92, 1.16),
213
+ scaleY: T(n.torsoScale * r.vertical, .92, 1.14),
214
+ scaleZ: T(a * r.depth, .92, 1.18),
215
+ sleeveScale: T(o, F, I),
216
+ fitEaseScale: T(1 + (s - 1) * .22, .99, 1.08)
209
217
  };
210
218
  }
211
- function ue(e, t) {
219
+ function pe(e, t) {
212
220
  if (!t || !Number.isFinite(t) || t <= 0) return e;
213
- let n = B(t, .88, 1.2), r = 1 + (n - 1) * .35;
221
+ let n = T(t, .88, 1.2), r = 1 + (n - 1) * .35;
214
222
  return {
215
- scaleX: B(e.scaleX * n, k, A),
216
- scaleY: B(e.scaleY * r, j, M),
217
- scaleZ: B(e.scaleZ * n, N, P),
218
- sleeveScale: B(e.sleeveScale * r, F, I),
219
- fitEaseScale: B(e.fitEaseScale * n, L, R)
223
+ scaleX: T(e.scaleX * n, A, j),
224
+ scaleY: T(e.scaleY * r, M, N),
225
+ scaleZ: T(e.scaleZ * n, P, ee),
226
+ sleeveScale: T(e.sleeveScale * r, F, I),
227
+ fitEaseScale: T(e.fitEaseScale * n, L, te)
220
228
  };
221
229
  }
222
- function de(e, t) {
223
- let n = ne[t];
230
+ function me(e, t) {
231
+ let n = ie[t];
224
232
  return {
225
- scaleX: B(e.scaleX * n.x, k, A),
226
- scaleY: B(e.scaleY * n.y, j, M),
227
- scaleZ: B(e.scaleZ * n.z, N, P),
233
+ scaleX: T(e.scaleX * n.x, A, j),
234
+ scaleY: T(e.scaleY * n.y, M, N),
235
+ scaleZ: T(e.scaleZ * n.z, P, ee),
228
236
  sleeveScale: e.sleeveScale,
229
- fitEaseScale: B(e.fitEaseScale * n.ease, L, R)
237
+ fitEaseScale: T(e.fitEaseScale * n.ease, L, te)
230
238
  };
231
239
  }
232
- function fe(e, t) {
240
+ function he(e, t) {
233
241
  return {
234
- scaleX: B(e.scaleX * t.scaleX, k, A),
235
- scaleY: B(e.scaleY * t.scaleY, j, M),
236
- scaleZ: B(e.scaleZ * t.scaleZ, N, P),
237
- sleeveScale: B(e.sleeveScale * t.sleeveScale, F, I),
238
- fitEaseScale: B(e.fitEaseScale * t.fitEaseScale, L, R)
242
+ scaleX: T(e.scaleX * t.scaleX, A, j),
243
+ scaleY: T(e.scaleY * t.scaleY, M, N),
244
+ scaleZ: T(e.scaleZ * t.scaleZ, P, ee),
245
+ sleeveScale: T(e.sleeveScale * t.sleeveScale, F, I),
246
+ fitEaseScale: T(e.fitEaseScale * t.fitEaseScale, L, te)
239
247
  };
240
248
  }
241
- function pe({ measurements: e, measurementScale: t, presetSelection: n, fitType: r = "regular", garmentScaleHint: i = null, spec: a = T }) {
242
- let o = oe(n), s = o && n ? se(n, a) : t ?? ee, c = o && n && e ? ce(e, n) : null;
249
+ function ge({ measurements: e, measurementScale: t, presetSelection: n, fitType: r = "regular", garmentScaleHint: i = null, spec: a = D }) {
250
+ let o = le(n), s = o && n ? ue(n, a) : t ?? ne, c = o && n && e ? de(e, n) : null;
243
251
  return {
244
- scale: de(ue(fe(s, e && n && c ? le(e, n, c) : te), i), r),
252
+ scale: me(pe(he(s, e && n && c ? fe(e, n, c) : re), i), r),
245
253
  morph: c
246
254
  };
247
255
  }
248
256
  //#endregion
249
257
  //#region src/api/EverClient.ts
250
- var me = "http://localhost:8000/api/v1";
251
- function he(e) {
258
+ var _e = "http://localhost:8000/api/v1";
259
+ function ve(e) {
252
260
  return e.replace(/\/+$/, "");
253
261
  }
254
- function ge(e) {
262
+ function ye(e) {
255
263
  try {
256
264
  return new URL(e).origin;
257
265
  } catch {
258
266
  return "";
259
267
  }
260
268
  }
261
- var _e = class {
269
+ var be = class {
262
270
  baseUrl;
263
271
  apiOrigin;
264
272
  apiKey;
265
273
  constructor(e) {
266
- let t = typeof e == "string" ? { baseUrl: e } : e ?? {}, n = he(t.baseUrl ?? "http://localhost:8000/api/v1");
267
- this.baseUrl = n, this.apiOrigin = ge(n), this.apiKey = t.apiKey;
274
+ let t = typeof e == "string" ? { baseUrl: e } : e ?? {}, n = ve(t.baseUrl ?? "http://localhost:8000/api/v1");
275
+ this.baseUrl = n, this.apiOrigin = ye(n), this.apiKey = t.apiKey;
268
276
  }
269
277
  resolveAssetUrl(e) {
270
278
  return e ? e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("/") ? this.apiOrigin ? `${this.apiOrigin}${e}` : e : this.apiOrigin ? `${this.apiOrigin}/${e}` : `/${e}` : null;
@@ -391,32 +399,32 @@ var _e = class {
391
399
  return `Request failed with status ${e.status}`;
392
400
  }
393
401
  }
394
- }, ve = "M", ye = "male-m-balanced-balanced", be = "female-m-balanced-balanced", xe = "rigged_avatar";
395
- function Se(e, t) {
402
+ }, xe = "M", Se = "male-m-balanced-balanced", Ce = "female-m-balanced-balanced", we = "rigged_avatar";
403
+ function Te(e, t) {
396
404
  if (!t) return "";
397
405
  if (/^https?:\/\//.test(t)) return t;
398
406
  let n = t.startsWith("/") ? t : `/${t}`;
399
407
  return n.startsWith("/assets/") || n.startsWith("/static/") ? n : e.resolveAssetUrl(n) ?? n;
400
408
  }
401
- function Ce(e) {
409
+ function Ee(e) {
402
410
  return e === "female" ? "female" : "male";
403
411
  }
404
- function we(e, t = {}) {
412
+ function De(e, t = {}) {
405
413
  let n = t.renderMode ?? "rigged_avatar", r = t.legacyPresetId ?? "rigged_avatar", i = `/assets/body-presets/${r}.glb`;
406
414
  return e === r || n !== "preset-native" ? i : `/assets/body-presets/archive/${e}.glb`;
407
415
  }
408
- function Te(e) {
409
- return e === "female" ? be : ye;
416
+ function Oe(e) {
417
+ return e === "female" ? Ce : Se;
410
418
  }
411
- function Ee(e, t) {
419
+ function ke(e, t) {
412
420
  return {
413
421
  id: e.id,
414
422
  presetId: e.preset_id,
415
- baseGender: Ce(e.base_gender),
423
+ baseGender: Ee(e.base_gender),
416
424
  sizeBand: e.size_band,
417
425
  upperBodySilhouette: e.upper_body_silhouette,
418
426
  torsoOrPelvisProfile: e.torso_or_pelvis_profile,
419
- modelUrl: Se(t, e.model_url),
427
+ modelUrl: Te(t, e.model_url),
420
428
  heightCm: e.height_cm ?? null,
421
429
  chestCm: e.chest_cm ?? null,
422
430
  waistCm: e.waist_cm ?? null,
@@ -428,26 +436,26 @@ function Ee(e, t) {
428
436
  neckToHipCm: e.neck_to_hip_cm ?? null
429
437
  };
430
438
  }
431
- function De(e, t = {}) {
439
+ function Ae(e, t = {}) {
432
440
  return {
433
441
  ...e,
434
- modelUrl: e.modelUrl || we(e.presetId, t)
442
+ modelUrl: e.modelUrl || De(e.presetId, t)
435
443
  };
436
444
  }
437
- function Oe(e, t = {}) {
438
- return e.length === 0 ? null : De(e.find((e) => e.sizeBand === ve) || e[Math.floor(e.length / 2)], t);
445
+ function je(e, t = {}) {
446
+ return e.length === 0 ? null : Ae(e.find((e) => e.sizeBand === xe) || e[Math.floor(e.length / 2)], t);
439
447
  }
440
- function ke(e, t = {}) {
441
- let n = Te(e);
448
+ function Me(e, t = {}) {
449
+ let n = Oe(e);
442
450
  return {
443
451
  id: null,
444
452
  presetId: n,
445
- label: `${e === "female" ? "여성" : "남성"} 기본 ${ve}`,
446
- modelUrl: we(n, t),
453
+ label: `${e === "female" ? "여성" : "남성"} 기본 ${xe}`,
454
+ modelUrl: De(n, t),
447
455
  gender: e,
448
456
  source: "fallback",
449
457
  taxonomy: {
450
- sizeBand: ve,
458
+ sizeBand: xe,
451
459
  upperBodySilhouette: "balanced",
452
460
  torsoOrPelvisProfile: "balanced"
453
461
  },
@@ -464,8 +472,8 @@ function ke(e, t = {}) {
464
472
  }
465
473
  };
466
474
  }
467
- function Ae(e, t, n = {}) {
468
- let r = De(e, n);
475
+ function Ne(e, t, n = {}) {
476
+ let r = Ae(e, n);
469
477
  return {
470
478
  id: r.id,
471
479
  presetId: r.presetId,
@@ -491,22 +499,22 @@ function Ae(e, t, n = {}) {
491
499
  }
492
500
  };
493
501
  }
494
- function je(e, t) {
502
+ function Pe(e, t) {
495
503
  let n = { gender: t };
496
504
  return Number.isFinite(e.heightCm) && (n.height_cm = e.heightCm), e.chestCircumferenceCm !== null && (n.chest_cm = e.chestCircumferenceCm), e.waistCircumferenceCm !== null && (n.waist_cm = e.waistCircumferenceCm), e.shoulderWidthCm !== null && (n.shoulder_width_cm = e.shoulderWidthCm), n;
497
505
  }
498
506
  //#endregion
499
507
  //#region src/hooks/useBodyPresetSelection.ts
500
- var Me = new _e();
501
- function Ne(e, t) {
508
+ var Fe = new be();
509
+ function Ie(e, t) {
502
510
  return {
503
- selection: ke(e, t),
511
+ selection: Me(e, t),
504
512
  loading: !0,
505
513
  error: null
506
514
  };
507
515
  }
508
- function Pe(e, t = {}) {
509
- let i = Ce(t.gender), o = t.renderMode, s = t.legacyPresetId, c = r(() => ({
516
+ function Le(e, t = {}) {
517
+ let i = Ee(t.gender), o = t.renderMode, s = t.legacyPresetId, c = r(() => ({
510
518
  gender: i,
511
519
  renderMode: o,
512
520
  legacyPresetId: s
@@ -514,7 +522,7 @@ function Pe(e, t = {}) {
514
522
  i,
515
523
  s,
516
524
  o
517
- ]), [l, u] = a(() => Ne(i, c));
525
+ ]), [l, u] = a(() => Ie(i, c));
518
526
  return n(() => {
519
527
  let t = new AbortController();
520
528
  async function n() {
@@ -525,7 +533,7 @@ function Pe(e, t = {}) {
525
533
  }));
526
534
  try {
527
535
  if (e) {
528
- let n = Ae(Ee(await Me.matchBodyPreset(je(e, c.gender)), Me), "match", c);
536
+ let n = Ne(ke(await Fe.matchBodyPreset(Pe(e, c.gender)), Fe), "match", c);
529
537
  if (t.signal.aborted) return;
530
538
  u({
531
539
  selection: n,
@@ -534,26 +542,26 @@ function Pe(e, t = {}) {
534
542
  });
535
543
  return;
536
544
  }
537
- let n = (await Me.listBodyPresets(c.gender)).map((e) => Ee(e, Me));
545
+ let n = (await Fe.listBodyPresets(c.gender)).map((e) => ke(e, Fe));
538
546
  if (t.signal.aborted) return;
539
- let r = Oe(n, c);
547
+ let r = je(n, c);
540
548
  if (r) {
541
549
  u({
542
- selection: Ae(r, "default", c),
550
+ selection: Ne(r, "default", c),
543
551
  loading: !1,
544
552
  error: null
545
553
  });
546
554
  return;
547
555
  }
548
556
  u({
549
- selection: ke(c.gender, c),
557
+ selection: Me(c.gender, c),
550
558
  loading: !1,
551
559
  error: "바디 프리셋 응답이 비어 있어 기본 프리셋으로 대체했습니다."
552
560
  });
553
561
  } catch (e) {
554
562
  if (t.signal.aborted) return;
555
563
  u({
556
- selection: ke(c.gender, c),
564
+ selection: Me(c.gender, c),
557
565
  loading: !1,
558
566
  error: e instanceof Error ? e.message : "바디 프리셋을 불러오지 못해 기본 프리셋으로 대체했습니다."
559
567
  });
@@ -566,7 +574,7 @@ function Pe(e, t = {}) {
566
574
  }
567
575
  //#endregion
568
576
  //#region src/types/pose.ts
569
- var U = {
577
+ var B = {
570
578
  NOSE: 0,
571
579
  LEFT_EYE_INNER: 1,
572
580
  LEFT_EYE: 2,
@@ -600,25 +608,25 @@ var U = {
600
608
  RIGHT_HEEL: 30,
601
609
  LEFT_FOOT_INDEX: 31,
602
610
  RIGHT_FOOT_INDEX: 32
603
- }, Fe = {
611
+ }, Re = {
604
612
  positionAlpha: .7,
605
613
  rotationAlpha: .6,
606
614
  visibilityThreshold: .5
607
- }, Ie = .5;
608
- function Le(e) {
609
- return e ? (e.visibility ?? 1) >= Ie : !1;
615
+ }, ze = .5;
616
+ function Be(e) {
617
+ return e ? (e.visibility ?? 1) >= ze : !1;
610
618
  }
611
- function Re(e, t) {
612
- let n = e[U.NOSE], r = e[U.LEFT_EYE], i = e[U.LEFT_ANKLE], a = e[U.RIGHT_ANKLE];
613
- if (!Le(n) || !Le(r) || !Le(i) || !Le(a)) return 0;
619
+ function Ve(e, t) {
620
+ let n = e[B.NOSE], r = e[B.LEFT_EYE], i = e[B.LEFT_ANKLE], a = e[B.RIGHT_ANKLE];
621
+ if (!Be(n) || !Be(r) || !Be(i) || !Be(a)) return 0;
614
622
  let o = n.y - (r.y - n.y) * 2, s = (Math.max(i.y, a.y) - o) * t;
615
623
  return Number.isFinite(s) && s > 0 ? s : 0;
616
624
  }
617
- function ze(e, t, n = 720) {
618
- let r = Re(e, n);
625
+ function He(e, t, n = 720) {
626
+ let r = Ve(e, n);
619
627
  return r <= 0 || t <= 0 ? 0 : t / r;
620
628
  }
621
- function Be(e) {
629
+ function Ue(e) {
622
630
  let t = [
623
631
  [15, .8],
624
632
  [18.5, .84],
@@ -635,39 +643,39 @@ function Be(e) {
635
643
  }
636
644
  return .88;
637
645
  }
638
- function W(e, t, n, r) {
639
- if (!Le(e) || !Le(t)) return null;
646
+ function V(e, t, n, r) {
647
+ if (!Be(e) || !Be(t)) return null;
640
648
  let i = (e.x - t.x) * n, a = (e.y - t.y) * r, o = Math.hypot(i, a);
641
649
  return Number.isFinite(o) && o > 0 ? o : null;
642
650
  }
643
- function Ve(e) {
651
+ function We(e) {
644
652
  return Math.round(e * 10) / 10;
645
653
  }
646
- function G(e) {
647
- return e === null || !Number.isFinite(e) || e <= 0 ? null : Ve(e);
654
+ function H(e) {
655
+ return e === null || !Number.isFinite(e) || e <= 0 ? null : We(e);
648
656
  }
649
- function He(e) {
657
+ function Ge(e) {
650
658
  let t = e.filter((e) => e !== null);
651
659
  return t.length === 0 ? null : t.reduce((e, t) => e + t, 0) / t.length;
652
660
  }
653
- function Ue(e, t) {
661
+ function Ke(e, t) {
654
662
  return e && t !== null && t > 0 ? "silhouette_bmi" : "keypoint";
655
663
  }
656
- function We(e, t, n) {
664
+ function qe(e, t, n) {
657
665
  return n && t > 0 && e / t >= .85 ? "standard" : "estimate";
658
666
  }
659
- function Ge(e, t, n, r) {
667
+ function Je(e, t, n, r) {
660
668
  if (t <= 0 || e <= 0) return 0;
661
669
  let i = e / t * .8, a = n ? .15 : 0, o = r !== null && r > 0 ? .05 : 0;
662
- return Math.min(.99, Ve((i + a + o) * 10) / 10);
670
+ return Math.min(.99, We((i + a + o) * 10) / 10);
663
671
  }
664
- function Ke(e, t) {
672
+ function Ye(e, t) {
665
673
  if (e <= 0 || t <= 0) return 0;
666
674
  let n = (e - t) ** 2 / (e + t) ** 2;
667
675
  return Math.PI * (e + t) * (1 + 3 * n / (10 + Math.sqrt(4 - 3 * n)));
668
676
  }
669
- function qe(e, t, n = null, r = null, i = 1280, a = 720) {
670
- let o = ze(e, t, a), s = Ue(r, n);
677
+ function Xe(e, t, n = null, r = null, i = 1280, a = 720) {
678
+ let o = He(e, t, a), s = Ke(r, n);
671
679
  if (o <= 0) return {
672
680
  heightCm: t,
673
681
  shoulderWidthCm: null,
@@ -682,14 +690,14 @@ function qe(e, t, n = null, r = null, i = 1280, a = 720) {
682
690
  measurementMethod: s,
683
691
  measuredAt: null
684
692
  };
685
- let c = W(e[U.LEFT_SHOULDER], e[U.RIGHT_SHOULDER], i, a), l = W(e[U.LEFT_HIP], e[U.RIGHT_HIP], i, a), u = W(e[U.LEFT_SHOULDER], e[U.LEFT_ELBOW], i, a), d = W(e[U.LEFT_ELBOW], e[U.LEFT_WRIST], i, a), f = W(e[U.RIGHT_SHOULDER], e[U.RIGHT_ELBOW], i, a), p = W(e[U.RIGHT_ELBOW], e[U.RIGHT_WRIST], i, a), m = u !== null && d !== null ? u + d : null, h = f !== null && p !== null ? f + p : null, g = W(e[U.LEFT_HIP], e[U.LEFT_KNEE], i, a), _ = W(e[U.LEFT_KNEE], e[U.LEFT_ANKLE], i, a), v = W(e[U.RIGHT_HIP], e[U.RIGHT_KNEE], i, a), y = W(e[U.RIGHT_KNEE], e[U.RIGHT_ANKLE], i, a), b = g !== null && _ !== null ? g + _ : null, x = v !== null && y !== null ? v + y : null, S = He([W(e[U.LEFT_SHOULDER], e[U.LEFT_HIP], i, a), W(e[U.RIGHT_SHOULDER], e[U.RIGHT_HIP], i, a)]), C = G(c === null ? null : c * o), w = G(l === null ? null : l * o), T = G(He([m === null ? null : m * o, h === null ? null : h * o])), E = G(He([b === null ? null : b * o, x === null ? null : x * o])), D = G(S === null ? null : S * o), O = C === null ? null : C * 2.2, k = w === null ? null : w * 2.1;
693
+ let c = V(e[B.LEFT_SHOULDER], e[B.RIGHT_SHOULDER], i, a), l = V(e[B.LEFT_HIP], e[B.RIGHT_HIP], i, a), u = V(e[B.LEFT_SHOULDER], e[B.LEFT_ELBOW], i, a), d = V(e[B.LEFT_ELBOW], e[B.LEFT_WRIST], i, a), f = V(e[B.RIGHT_SHOULDER], e[B.RIGHT_ELBOW], i, a), p = V(e[B.RIGHT_ELBOW], e[B.RIGHT_WRIST], i, a), m = u !== null && d !== null ? u + d : null, h = f !== null && p !== null ? f + p : null, g = V(e[B.LEFT_HIP], e[B.LEFT_KNEE], i, a), _ = V(e[B.LEFT_KNEE], e[B.LEFT_ANKLE], i, a), v = V(e[B.RIGHT_HIP], e[B.RIGHT_KNEE], i, a), y = V(e[B.RIGHT_KNEE], e[B.RIGHT_ANKLE], i, a), b = g !== null && _ !== null ? g + _ : null, x = v !== null && y !== null ? v + y : null, S = Ge([V(e[B.LEFT_SHOULDER], e[B.LEFT_HIP], i, a), V(e[B.RIGHT_SHOULDER], e[B.RIGHT_HIP], i, a)]), C = H(c === null ? null : c * o), w = H(l === null ? null : l * o), T = H(Ge([m === null ? null : m * o, h === null ? null : h * o])), E = H(Ge([b === null ? null : b * o, x === null ? null : x * o])), D = H(S === null ? null : S * o), O = C === null ? null : C * 2.2, k = w === null ? null : w * 2.1;
686
694
  if (r) {
687
695
  let e = r.shoulderWidthPx * o;
688
- if (O = G(Ke(Math.max(r.chestWidthPx * o / 2, 0), Math.max(e * .28 / 2, 0))), k = G(Ke(Math.max(r.waistWidthPx * o / 2, 0), Math.max(r.hipWidthPx * o * .26 / 2, 0))), n !== null && n > 0) {
689
- let e = Be(n / (t / 100) ** 2);
690
- O = G(O === null ? null : O / e), k = G(k === null ? null : k / e);
696
+ if (O = H(Ye(Math.max(r.chestWidthPx * o / 2, 0), Math.max(e * .28 / 2, 0))), k = H(Ye(Math.max(r.waistWidthPx * o / 2, 0), Math.max(r.hipWidthPx * o * .26 / 2, 0))), n !== null && n > 0) {
697
+ let e = Ue(n / (t / 100) ** 2);
698
+ O = H(O === null ? null : O / e), k = H(k === null ? null : k / e);
691
699
  }
692
- } else O = G(O), k = G(k);
700
+ } else O = H(O), k = H(k);
693
701
  let A = [
694
702
  C,
695
703
  O,
@@ -700,7 +708,7 @@ function qe(e, t, n = null, r = null, i = 1280, a = 720) {
700
708
  D
701
709
  ].filter((e) => e !== null).length;
702
710
  return {
703
- heightCm: Ve(t),
711
+ heightCm: We(t),
704
712
  shoulderWidthCm: C,
705
713
  chestCircumferenceCm: O,
706
714
  waistCircumferenceCm: k,
@@ -708,15 +716,15 @@ function qe(e, t, n = null, r = null, i = 1280, a = 720) {
708
716
  armLengthCm: T,
709
717
  legLengthCm: E,
710
718
  torsoLengthCm: D,
711
- accuracyGrade: We(A, 7, r),
712
- confidenceScore: Ge(A, 7, r, n),
719
+ accuracyGrade: qe(A, 7, r),
720
+ confidenceScore: Je(A, 7, r, n),
713
721
  measurementMethod: s,
714
722
  measuredAt: null
715
723
  };
716
724
  }
717
725
  //#endregion
718
726
  //#region src/measurement/sizeRecommender.ts
719
- var Je = {
727
+ var Ze = {
720
728
  S: {
721
729
  shoulder: [40, 42],
722
730
  chest: [86, 92],
@@ -743,7 +751,7 @@ var Je = {
743
751
  waist: [96, 104]
744
752
  }
745
753
  };
746
- function Ye(e) {
754
+ function Qe(e) {
747
755
  let t = [
748
756
  "S",
749
757
  "M",
@@ -752,7 +760,7 @@ function Ye(e) {
752
760
  "2XL"
753
761
  ], n = "M", r = -Infinity, i = !1;
754
762
  for (let a of t) {
755
- let t = Je[a], o = 0, s = 0;
763
+ let t = Ze[a], o = 0, s = 0;
756
764
  if (e.shoulderWidthCm !== null) {
757
765
  let n = (t.shoulder[0] + t.shoulder[1]) / 2;
758
766
  o -= Math.abs(e.shoulderWidthCm - n), s += 1, i = !0;
@@ -768,7 +776,7 @@ function Ye(e) {
768
776
  s > 0 && (o /= s), o > r && (r = o, n = a);
769
777
  }
770
778
  if (!i) return null;
771
- let a = Je[n], o = "true-to-size";
779
+ let a = Ze[n], o = "true-to-size";
772
780
  if (e.chestCircumferenceCm !== null) {
773
781
  let t = (a.chest[0] + a.chest[1]) / 2;
774
782
  e.chestCircumferenceCm > t + 3 ? o = "slim" : e.chestCircumferenceCm < t - 3 && (o = "relaxed");
@@ -781,7 +789,7 @@ function Ye(e) {
781
789
  }
782
790
  //#endregion
783
791
  //#region src/types/measurement.ts
784
- var Xe = {
792
+ var $e = {
785
793
  referenceHeightCm: 170,
786
794
  weightKg: null,
787
795
  stableFrameCount: 15,
@@ -789,10 +797,10 @@ var Xe = {
789
797
  };
790
798
  //#endregion
791
799
  //#region src/hooks/useMeasurement.ts
792
- function Ze(e) {
800
+ function et(e) {
793
801
  return e.map((e) => ({ ...e }));
794
802
  }
795
- function Qe(e, t) {
803
+ function tt(e, t) {
796
804
  let n = 0;
797
805
  for (let r = 0; r < 33; r += 1) {
798
806
  let i = e[r], a = t[r];
@@ -800,8 +808,8 @@ function Qe(e, t) {
800
808
  }
801
809
  return n / 33;
802
810
  }
803
- function $e() {
804
- let [e, n] = a(Xe), [r, o] = a(null), [s, c] = a(null), [l, u] = a(null), [d, f] = a(!1), p = i(0), m = i(null), h = t(() => {
811
+ function nt() {
812
+ let [e, n] = a($e), [r, o] = a(null), [s, c] = a(null), [l, u] = a(null), [d, f] = a(!1), p = i(0), m = i(null), h = t(() => {
805
813
  p.current = 0, m.current = null;
806
814
  }, []), g = t(() => {
807
815
  o(null), c(null), u(null);
@@ -811,13 +819,13 @@ function $e() {
811
819
  return {
812
820
  measure: t((t, n = {}) => {
813
821
  if (!d || t.length < 33) return;
814
- let r = Ze(t);
822
+ let r = et(t);
815
823
  if (!m.current) {
816
824
  m.current = r, p.current = 1;
817
825
  return;
818
826
  }
819
- if (p.current = Qe(m.current, r) < e.motionThreshold ? p.current + 1 : 1, m.current = r, p.current < e.stableFrameCount) return;
820
- let i = qe(t, e.referenceHeightCm, e.weightKg, n.silhouetteWidths ?? null, n.imageWidth ?? 1280, n.imageHeight ?? 720), a = (/* @__PURE__ */ new Date()).toISOString(), s = Ye(i), l = O(i);
827
+ if (p.current = tt(m.current, r) < e.motionThreshold ? p.current + 1 : 1, m.current = r, p.current < e.stableFrameCount) return;
828
+ let i = Xe(t, e.referenceHeightCm, e.weightKg, n.silhouetteWidths ?? null, n.imageWidth ?? 1280, n.imageHeight ?? 720), a = (/* @__PURE__ */ new Date()).toISOString(), s = Qe(i), l = k(i);
821
829
  o({
822
830
  ...i,
823
831
  measuredAt: a
@@ -843,7 +851,7 @@ function $e() {
843
851
  }
844
852
  //#endregion
845
853
  //#region src/compositing/videoCover.ts
846
- function et(e, t, n, r) {
854
+ function rt(e, t, n, r) {
847
855
  if (e <= 0 || t <= 0 || n <= 0 || r <= 0) return {
848
856
  x: 0,
849
857
  y: 0,
@@ -868,7 +876,7 @@ function et(e, t, n, r) {
868
876
  height: o
869
877
  };
870
878
  }
871
- function tt(e, t, n, r) {
879
+ function it(e, t, n, r) {
872
880
  if (e <= 0 || t <= 0 || n <= 0 || r <= 0) return {
873
881
  xMin: 0,
874
882
  xMax: 1,
@@ -895,8 +903,8 @@ function tt(e, t, n, r) {
895
903
  }
896
904
  //#endregion
897
905
  //#region src/measurement/silhouetteExtractor.ts
898
- var nt = 5, rt = .5;
899
- function it(e, t, n, r, i = nt, a = rt) {
906
+ var at = 5, ot = .5;
907
+ function st(e, t, n, r, i = at, a = ot) {
900
908
  if (t <= 0 || n <= 0 || e.length !== t * n) return null;
901
909
  let o = Math.round(r), s = Math.floor(i / 2), c = Math.max(0, o - s), l = Math.min(n - 1, o + s), u = 0, d = 0, f = 0;
902
910
  for (let n = c; n <= l; n += 1) {
@@ -908,11 +916,11 @@ function it(e, t, n, r, i = nt, a = rt) {
908
916
  let p = u / f;
909
917
  return d / f - p;
910
918
  }
911
- function at(e, t, n, r) {
919
+ function ct(e, t, n, r) {
912
920
  if (r.length < 33) return null;
913
- let i = r[U.LEFT_SHOULDER], a = r[U.RIGHT_SHOULDER], o = r[U.LEFT_HIP], s = r[U.RIGHT_HIP], c = r[U.LEFT_KNEE], l = r[U.RIGHT_KNEE];
921
+ let i = r[B.LEFT_SHOULDER], a = r[B.RIGHT_SHOULDER], o = r[B.LEFT_HIP], s = r[B.RIGHT_HIP], c = r[B.LEFT_KNEE], l = r[B.RIGHT_KNEE];
914
922
  if (!i || !a || !o || !s) return null;
915
- let u = (i.y + a.y) / 2 * n, d = (o.y + s.y) / 2 * n, f = u + (d - u) * .4, p = c && l ? d + ((c.y + l.y) / 2 * n - d) * .2 : d, m = it(e, t, n, u), h = it(e, t, n, f), g = it(e, t, n, d), _ = it(e, t, n, p);
923
+ let u = (i.y + a.y) / 2 * n, d = (o.y + s.y) / 2 * n, f = u + (d - u) * .4, p = c && l ? d + ((c.y + l.y) / 2 * n - d) * .2 : d, m = st(e, t, n, u), h = st(e, t, n, f), g = st(e, t, n, d), _ = st(e, t, n, p);
916
924
  return m === null || h === null || g === null || _ === null ? null : {
917
925
  shoulderWidthPx: m,
918
926
  chestWidthPx: h,
@@ -922,61 +930,61 @@ function at(e, t, n, r) {
922
930
  }
923
931
  //#endregion
924
932
  //#region src/pose/interpolation.ts
925
- function K(e, t, n) {
933
+ function U(e, t, n) {
926
934
  return e + (t - e) * n;
927
935
  }
928
- function ot(e, t, n) {
936
+ function lt(e, t, n) {
929
937
  return t ? !e || e.length !== t.length ? t : e.map((e, r) => {
930
938
  let i = t[r];
931
939
  return {
932
- x: K(e.x, i.x, n),
933
- y: K(e.y, i.y, n),
934
- z: K(e.z ?? 0, i.z ?? 0, n),
935
- visibility: K(e.visibility ?? 0, i.visibility ?? 0, n)
940
+ x: U(e.x, i.x, n),
941
+ y: U(e.y, i.y, n),
942
+ z: U(e.z ?? 0, i.z ?? 0, n),
943
+ visibility: U(e.visibility ?? 0, i.visibility ?? 0, n)
936
944
  };
937
945
  }) : null;
938
946
  }
939
- function q(e, t, n) {
947
+ function W(e, t, n) {
940
948
  return {
941
- x: K(e.x, t.x, n),
942
- y: K(e.y, t.y, n),
943
- z: K(e.z, t.z, n)
949
+ x: U(e.x, t.x, n),
950
+ y: U(e.y, t.y, n),
951
+ z: U(e.z, t.z, n)
944
952
  };
945
953
  }
946
- function st(e, t, n) {
947
- return !e || !t ? t ?? e : q(e, t, n);
954
+ function ut(e, t, n) {
955
+ return !e || !t ? t ?? e : W(e, t, n);
948
956
  }
949
- function ct(e, t, n) {
957
+ function dt(e, t, n) {
950
958
  return t ? e ? {
951
959
  hips: {
952
960
  position: {
953
- x: K(e.hips.position.x, t.hips.position.x, n),
954
- y: K(e.hips.position.y, t.hips.position.y, n),
955
- z: K(e.hips.position.z, t.hips.position.z, n)
961
+ x: U(e.hips.position.x, t.hips.position.x, n),
962
+ y: U(e.hips.position.y, t.hips.position.y, n),
963
+ z: U(e.hips.position.z, t.hips.position.z, n)
956
964
  },
957
- rotation: q(e.hips.rotation, t.hips.rotation, n)
965
+ rotation: W(e.hips.rotation, t.hips.rotation, n)
958
966
  },
959
- spine: q(e.spine, t.spine, n),
960
- chest: q(e.chest, t.chest, n),
961
- leftUpperArm: q(e.leftUpperArm, t.leftUpperArm, n),
962
- leftLowerArm: q(e.leftLowerArm, t.leftLowerArm, n),
963
- rightUpperArm: q(e.rightUpperArm, t.rightUpperArm, n),
964
- rightLowerArm: q(e.rightLowerArm, t.rightLowerArm, n),
965
- leftUpperLeg: st(e.leftUpperLeg, t.leftUpperLeg, n),
966
- leftLowerLeg: st(e.leftLowerLeg, t.leftLowerLeg, n),
967
- rightUpperLeg: st(e.rightUpperLeg, t.rightUpperLeg, n),
968
- rightLowerLeg: st(e.rightLowerLeg, t.rightLowerLeg, n)
967
+ spine: W(e.spine, t.spine, n),
968
+ chest: W(e.chest, t.chest, n),
969
+ leftUpperArm: W(e.leftUpperArm, t.leftUpperArm, n),
970
+ leftLowerArm: W(e.leftLowerArm, t.leftLowerArm, n),
971
+ rightUpperArm: W(e.rightUpperArm, t.rightUpperArm, n),
972
+ rightLowerArm: W(e.rightLowerArm, t.rightLowerArm, n),
973
+ leftUpperLeg: ut(e.leftUpperLeg, t.leftUpperLeg, n),
974
+ leftLowerLeg: ut(e.leftLowerLeg, t.leftLowerLeg, n),
975
+ rightUpperLeg: ut(e.rightUpperLeg, t.rightUpperLeg, n),
976
+ rightLowerLeg: ut(e.rightLowerLeg, t.rightLowerLeg, n)
969
977
  } : t : null;
970
978
  }
971
- function lt(e, t, n) {
979
+ function ft(e, t, n) {
972
980
  return t ? e ? {
973
- shoulderWidthPx: K(e.shoulderWidthPx, t.shoulderWidthPx, n),
974
- chestWidthPx: K(e.chestWidthPx, t.chestWidthPx, n),
975
- waistWidthPx: K(e.waistWidthPx, t.waistWidthPx, n),
976
- hipWidthPx: K(e.hipWidthPx, t.hipWidthPx, n)
981
+ shoulderWidthPx: U(e.shoulderWidthPx, t.shoulderWidthPx, n),
982
+ chestWidthPx: U(e.chestWidthPx, t.chestWidthPx, n),
983
+ waistWidthPx: U(e.waistWidthPx, t.waistWidthPx, n),
984
+ hipWidthPx: U(e.hipWidthPx, t.hipWidthPx, n)
977
985
  } : t : null;
978
986
  }
979
- function ut() {
987
+ function pt() {
980
988
  return {
981
989
  landmarks: null,
982
990
  worldLandmarks: null,
@@ -986,25 +994,25 @@ function ut() {
986
994
  silhouetteWidths: null
987
995
  };
988
996
  }
989
- function dt(e, t, n) {
997
+ function mt(e, t, n) {
990
998
  return !e || !e.isTracking || !t.isTracking || !t.landmarks ? t : {
991
- landmarks: ot(e.landmarks, t.landmarks, n),
992
- worldLandmarks: ot(e.worldLandmarks, t.worldLandmarks, n),
993
- poseRig: ct(e.poseRig, t.poseRig, n),
994
- confidence: K(e.confidence, t.confidence, n),
999
+ landmarks: lt(e.landmarks, t.landmarks, n),
1000
+ worldLandmarks: lt(e.worldLandmarks, t.worldLandmarks, n),
1001
+ poseRig: dt(e.poseRig, t.poseRig, n),
1002
+ confidence: U(e.confidence, t.confidence, n),
995
1003
  isTracking: t.isTracking,
996
- silhouetteWidths: lt(e.silhouetteWidths, t.silhouetteWidths, n)
1004
+ silhouetteWidths: ft(e.silhouetteWidths, t.silhouetteWidths, n)
997
1005
  };
998
1006
  }
999
1007
  //#endregion
1000
1008
  //#region src/pose/landmarkerFactory.ts
1001
- var ft = "0.10.32", pt = `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${ft}/wasm`, mt = 2, ht = 3, gt = .5, _t = {
1009
+ var ht = "0.10.32", gt = `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${ht}/wasm`, _t = 1, vt = 3, yt = .5, bt = {
1002
1010
  lite: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task",
1003
1011
  full: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/latest/pose_landmarker_full.task",
1004
1012
  heavy: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_heavy/float16/latest/pose_landmarker_heavy.task"
1005
1013
  };
1006
- async function vt(e, t, n, r, i = 3) {
1007
- let a = await v.forVisionTasks(pt), o = {
1014
+ async function xt(e, t, n, r, i = 3) {
1015
+ let a = await v.forVisionTasks(gt), o = {
1008
1016
  baseOptions: { modelAssetPath: e },
1009
1017
  runningMode: "VIDEO",
1010
1018
  numPoses: i,
@@ -1033,193 +1041,196 @@ async function vt(e, t, n, r, i = 3) {
1033
1041
  }
1034
1042
  //#endregion
1035
1043
  //#region src/pose/landmarkPoseSolver.ts
1036
- var yt = new b.Vector3(), bt = new b.Vector3(), xt = new b.Vector3(), St = new b.Quaternion(), Ct = new b.Vector3(), wt = new b.Vector3(), Tt = new b.Vector3(0, -1, 0), Et = new b.Vector3(1, 0, 0), Dt = new b.Vector3(-1, 0, 0), Ot = new b.Vector3(0, 1, 0), kt = [U.LEFT_SHOULDER, U.RIGHT_SHOULDER], At = [U.LEFT_HIP, U.RIGHT_HIP], jt = [U.LEFT_EAR, U.RIGHT_EAR], Mt = [U.LEFT_INDEX, U.LEFT_PINKY], Nt = [U.RIGHT_INDEX, U.RIGHT_PINKY], Pt = {
1044
+ var St = new b.Vector3(), Ct = new b.Vector3(), wt = new b.Vector3(), Tt = new b.Quaternion(), Et = new b.Vector3(), Dt = new b.Vector3(), Ot = new b.Vector3(0, -1, 0), kt = new b.Vector3(1, 0, 0), At = new b.Vector3(-1, 0, 0), jt = new b.Vector3(0, 1, 0), Mt = [B.LEFT_SHOULDER, B.RIGHT_SHOULDER], Nt = [B.LEFT_HIP, B.RIGHT_HIP], Pt = [B.LEFT_EAR, B.RIGHT_EAR], Ft = [B.LEFT_INDEX, B.LEFT_PINKY], It = [B.RIGHT_INDEX, B.RIGHT_PINKY], Lt = {
1037
1045
  Hips: {
1038
- from: At,
1039
- to: kt,
1040
- restDir: Ot,
1046
+ from: Nt,
1047
+ to: Mt,
1048
+ restDir: jt,
1041
1049
  influence: .35
1042
1050
  },
1043
1051
  Spine: {
1044
- from: At,
1045
- to: kt,
1046
- restDir: Ot,
1052
+ from: Nt,
1053
+ to: Mt,
1054
+ restDir: jt,
1047
1055
  influence: .55
1048
1056
  },
1049
1057
  Chest: {
1050
- from: kt,
1051
- to: jt,
1052
- restDir: Ot,
1058
+ from: Mt,
1059
+ to: Pt,
1060
+ restDir: jt,
1053
1061
  influence: .7
1054
1062
  },
1055
1063
  LeftShoulder: {
1056
- from: kt,
1057
- to: U.LEFT_SHOULDER,
1058
- restDir: Et,
1064
+ from: Mt,
1065
+ to: B.LEFT_SHOULDER,
1066
+ restDir: kt,
1059
1067
  influence: .45
1060
1068
  },
1061
1069
  LeftUpperArm: {
1062
- from: U.LEFT_SHOULDER,
1063
- to: U.LEFT_ELBOW,
1064
- restDir: Et
1070
+ from: B.LEFT_SHOULDER,
1071
+ to: B.LEFT_ELBOW,
1072
+ restDir: kt
1065
1073
  },
1066
1074
  LeftLowerArm: {
1067
- from: U.LEFT_ELBOW,
1068
- to: U.LEFT_WRIST,
1069
- restDir: Et
1075
+ from: B.LEFT_ELBOW,
1076
+ to: B.LEFT_WRIST,
1077
+ restDir: kt
1070
1078
  },
1071
1079
  LeftHand: {
1072
- from: U.LEFT_WRIST,
1073
- to: Mt,
1074
- restDir: Et,
1080
+ from: B.LEFT_WRIST,
1081
+ to: Ft,
1082
+ restDir: kt,
1075
1083
  influence: .65
1076
1084
  },
1077
1085
  RightShoulder: {
1078
- from: kt,
1079
- to: U.RIGHT_SHOULDER,
1080
- restDir: Dt,
1086
+ from: Mt,
1087
+ to: B.RIGHT_SHOULDER,
1088
+ restDir: At,
1081
1089
  influence: .45
1082
1090
  },
1083
1091
  RightUpperArm: {
1084
- from: U.RIGHT_SHOULDER,
1085
- to: U.RIGHT_ELBOW,
1086
- restDir: Dt
1092
+ from: B.RIGHT_SHOULDER,
1093
+ to: B.RIGHT_ELBOW,
1094
+ restDir: At
1087
1095
  },
1088
1096
  RightLowerArm: {
1089
- from: U.RIGHT_ELBOW,
1090
- to: U.RIGHT_WRIST,
1091
- restDir: Dt
1097
+ from: B.RIGHT_ELBOW,
1098
+ to: B.RIGHT_WRIST,
1099
+ restDir: At
1092
1100
  },
1093
1101
  RightHand: {
1094
- from: U.RIGHT_WRIST,
1095
- to: Nt,
1096
- restDir: Dt,
1102
+ from: B.RIGHT_WRIST,
1103
+ to: It,
1104
+ restDir: At,
1097
1105
  influence: .65
1098
1106
  },
1099
1107
  LeftUpperLeg: {
1100
- from: U.LEFT_HIP,
1101
- to: U.LEFT_KNEE,
1102
- restDir: Tt
1108
+ from: B.LEFT_HIP,
1109
+ to: B.LEFT_KNEE,
1110
+ restDir: Ot
1103
1111
  },
1104
1112
  LeftLowerLeg: {
1105
- from: U.LEFT_KNEE,
1106
- to: U.LEFT_ANKLE,
1107
- restDir: Tt
1113
+ from: B.LEFT_KNEE,
1114
+ to: B.LEFT_ANKLE,
1115
+ restDir: Ot
1108
1116
  },
1109
1117
  LeftFoot: {
1110
- from: U.LEFT_ANKLE,
1111
- to: U.LEFT_FOOT_INDEX,
1118
+ from: B.LEFT_ANKLE,
1119
+ to: B.LEFT_FOOT_INDEX,
1112
1120
  restDir: new b.Vector3(0, 0, 1)
1113
1121
  },
1114
1122
  RightUpperLeg: {
1115
- from: U.RIGHT_HIP,
1116
- to: U.RIGHT_KNEE,
1117
- restDir: Tt
1123
+ from: B.RIGHT_HIP,
1124
+ to: B.RIGHT_KNEE,
1125
+ restDir: Ot
1118
1126
  },
1119
1127
  RightLowerLeg: {
1120
- from: U.RIGHT_KNEE,
1121
- to: U.RIGHT_ANKLE,
1122
- restDir: Tt
1128
+ from: B.RIGHT_KNEE,
1129
+ to: B.RIGHT_ANKLE,
1130
+ restDir: Ot
1123
1131
  },
1124
1132
  RightFoot: {
1125
- from: U.RIGHT_ANKLE,
1126
- to: U.RIGHT_FOOT_INDEX,
1133
+ from: B.RIGHT_ANKLE,
1134
+ to: B.RIGHT_FOOT_INDEX,
1127
1135
  restDir: new b.Vector3(0, 0, 1)
1128
1136
  }
1129
1137
  };
1130
- function Ft(e, t, n) {
1138
+ function Rt(e, t, n) {
1131
1139
  return n === "world" ? (t.set(-e.x, -e.y, -(e.z ?? 0)), t) : (t.set(-(e.x - .5), -(e.y - .5), -(e.z ?? 0) * .5), t);
1132
1140
  }
1133
- function It(e, t, n, r) {
1141
+ function zt(e, t, n, r) {
1134
1142
  if (typeof e == "number") {
1135
1143
  let i = t[e];
1136
- return !i || (i.visibility ?? 0) < .4 ? !1 : (Ft(i, n, r), !0);
1144
+ return !i || (i.visibility ?? 0) < .4 ? !1 : (Rt(i, n, r), !0);
1137
1145
  }
1138
1146
  let i = t[e[0]], a = t[e[1]];
1139
- return !i || !a || (i.visibility ?? 0) < .4 || (a.visibility ?? 0) < .4 ? !1 : (Ft(i, Ct, r), Ft(a, wt, r), n.copy(Ct).add(wt).multiplyScalar(.5), !0);
1147
+ return !i || !a || (i.visibility ?? 0) < .4 || (a.visibility ?? 0) < .4 ? !1 : (Rt(i, Et, r), Rt(a, Dt, r), n.copy(Et).add(Dt).multiplyScalar(.5), !0);
1140
1148
  }
1141
- function Lt(e, t, n, r, i = "normalized") {
1142
- if (!It(e, n, yt, i) || !It(t, n, bt, i)) return !1;
1143
- r.subVectors(bt, yt);
1149
+ function Bt(e, t, n, r, i = "normalized") {
1150
+ if (!zt(e, n, St, i) || !zt(t, n, Ct, i)) return !1;
1151
+ r.subVectors(Ct, St);
1144
1152
  let a = r.length();
1145
1153
  return a < .001 ? !1 : (r.divideScalar(a), !0);
1146
1154
  }
1147
- function Rt(e, t, n, r = "normalized") {
1148
- let i = Pt[e];
1149
- return i ? Lt(i.from, i.to, t, n, r) : !1;
1155
+ function Vt(e, t, n, r = "normalized") {
1156
+ let i = Lt[e];
1157
+ return i ? Bt(i.from, i.to, t, n, r) : !1;
1150
1158
  }
1151
- function zt(e) {
1152
- return Pt[e]?.influence;
1159
+ function Ht(e) {
1160
+ return Lt[e]?.influence;
1153
1161
  }
1154
- function Bt(e, t, n, r = "normalized") {
1155
- let i = Pt[e];
1156
- return !i || !Rt(e, t, xt, r) ? !1 : (n.setFromUnitVectors(i.restDir, xt), i.influence !== void 0 && n.slerp(St.identity(), 1 - i.influence), !0);
1162
+ function Ut(e, t, n, r = "normalized") {
1163
+ let i = Lt[e];
1164
+ return !i || !Vt(e, t, wt, r) ? !1 : (n.setFromUnitVectors(i.restDir, wt), i.influence !== void 0 && n.slerp(Tt.identity(), 1 - i.influence), !0);
1157
1165
  }
1158
- function Vt(e) {
1159
- return e in Pt;
1166
+ function Wt(e) {
1167
+ return e in Lt;
1160
1168
  }
1161
1169
  //#endregion
1162
1170
  //#region src/pose/poseSolver.ts
1163
- var Ht = new b.Quaternion(), Ut = new b.Euler();
1164
- function Wt() {
1171
+ var Gt = new b.Quaternion(), Kt = new b.Euler(), qt = ["Hips", "Spine"];
1172
+ function Jt() {
1165
1173
  return {
1166
1174
  x: 0,
1167
1175
  y: 0,
1168
1176
  z: 0
1169
1177
  };
1170
1178
  }
1171
- function Gt(e) {
1172
- return Ut.setFromQuaternion(e, "XYZ"), {
1173
- x: Ut.x,
1174
- y: Ut.y,
1175
- z: Ut.z
1179
+ function Yt(e) {
1180
+ return Kt.setFromQuaternion(e, "XYZ"), {
1181
+ x: Kt.x,
1182
+ y: Kt.y,
1183
+ z: Kt.z
1176
1184
  };
1177
1185
  }
1178
- function Kt(e, t, n) {
1179
- return Bt(e, t, Ht, n) ? Gt(Ht) : Wt();
1186
+ function Xt(e, t, n) {
1187
+ return Ut(e, t, Gt, n) ? Yt(Gt) : Jt();
1180
1188
  }
1181
- function qt(e, t, n) {
1182
- if (Bt(e, t, Ht, n)) return Gt(Ht);
1189
+ function Zt(e, t, n) {
1190
+ if (Ut(e, t, Gt, n)) return Yt(Gt);
1183
1191
  }
1184
- function Jt(e) {
1185
- let t = e[U.LEFT_HIP], n = e[U.RIGHT_HIP];
1192
+ function Qt(e) {
1193
+ let t = e[B.LEFT_HIP], n = e[B.RIGHT_HIP];
1186
1194
  return {
1187
1195
  x: ((t?.x ?? 0) + (n?.x ?? 0)) * .5,
1188
1196
  y: ((t?.y ?? 0) + (n?.y ?? 0)) * .5,
1189
1197
  z: ((t?.z ?? 0) + (n?.z ?? 0)) * .5
1190
1198
  };
1191
1199
  }
1192
- function Yt(e, t) {
1200
+ function $t(e, t = "normalized") {
1201
+ return e.length < 33 ? !1 : qt.every((n) => Ut(n, e, Gt, t));
1202
+ }
1203
+ function en(e, t) {
1193
1204
  if (e.length < 33) return null;
1194
1205
  let n = t && t.length >= 33 ? t : e, r = t && t.length >= 33 ? "world" : "normalized";
1195
- return {
1206
+ return $t(n, r) ? {
1196
1207
  hips: {
1197
- position: Jt(e),
1198
- rotation: Kt("Hips", n, r)
1208
+ position: Qt(e),
1209
+ rotation: Xt("Hips", n, r)
1199
1210
  },
1200
- spine: Kt("Spine", n, r),
1201
- chest: Kt("Chest", n, r),
1202
- leftUpperArm: Kt("LeftUpperArm", n, r),
1203
- leftLowerArm: Kt("LeftLowerArm", n, r),
1204
- rightUpperArm: Kt("RightUpperArm", n, r),
1205
- rightLowerArm: Kt("RightLowerArm", n, r),
1206
- leftUpperLeg: qt("LeftUpperLeg", n, r),
1207
- leftLowerLeg: qt("LeftLowerLeg", n, r),
1208
- rightUpperLeg: qt("RightUpperLeg", n, r),
1209
- rightLowerLeg: qt("RightLowerLeg", n, r)
1210
- };
1211
+ spine: Xt("Spine", n, r),
1212
+ chest: Xt("Chest", n, r),
1213
+ leftUpperArm: Xt("LeftUpperArm", n, r),
1214
+ leftLowerArm: Xt("LeftLowerArm", n, r),
1215
+ rightUpperArm: Xt("RightUpperArm", n, r),
1216
+ rightLowerArm: Xt("RightLowerArm", n, r),
1217
+ leftUpperLeg: Zt("LeftUpperLeg", n, r),
1218
+ leftLowerLeg: Zt("LeftLowerLeg", n, r),
1219
+ rightUpperLeg: Zt("RightUpperLeg", n, r),
1220
+ rightLowerLeg: Zt("RightLowerLeg", n, r)
1221
+ } : null;
1211
1222
  }
1212
1223
  //#endregion
1213
1224
  //#region src/pose/segmentation.ts
1214
- function Xt(e) {
1225
+ function tn(e) {
1215
1226
  if (!e || typeof e != "object") return null;
1216
1227
  let t = e;
1217
1228
  return typeof t.width != "number" || typeof t.height != "number" || typeof t.getAsFloat32Array != "function" ? null : t;
1218
1229
  }
1219
- function Zt(e) {
1230
+ function nn(e) {
1220
1231
  if (e) for (let t of e) t && typeof t == "object" && "close" in t && typeof t.close == "function" && t.close();
1221
1232
  }
1222
- function Qt(e, t, n) {
1233
+ function rn(e, t, n) {
1223
1234
  let r = t / n;
1224
1235
  return {
1225
1236
  shoulderWidthPx: e.shoulderWidthPx * r,
@@ -1229,48 +1240,80 @@ function Qt(e, t, n) {
1229
1240
  };
1230
1241
  }
1231
1242
  //#endregion
1243
+ //#region src/pose/trackingConfidence.ts
1244
+ var an = [
1245
+ B.LEFT_SHOULDER,
1246
+ B.RIGHT_SHOULDER,
1247
+ B.LEFT_HIP,
1248
+ B.RIGHT_HIP
1249
+ ], on = [
1250
+ B.NOSE,
1251
+ B.LEFT_EAR,
1252
+ B.RIGHT_EAR,
1253
+ B.LEFT_ELBOW,
1254
+ B.RIGHT_ELBOW,
1255
+ B.LEFT_WRIST,
1256
+ B.RIGHT_WRIST
1257
+ ], sn = .35, cn = .05, ln = 2, un = .72, dn = .28;
1258
+ function fn(e) {
1259
+ return Number.isFinite(e) ? Math.max(0, Math.min(1, e)) : 0;
1260
+ }
1261
+ function pn(e, t, n) {
1262
+ let r = 0, i = 0;
1263
+ return t.forEach((t) => {
1264
+ let a = fn(e[t]?.visibility);
1265
+ a < n || (r += a, i += 1);
1266
+ }), i === 0 ? null : r / i;
1267
+ }
1268
+ function mn(e, t, n) {
1269
+ return t.reduce((t, r) => fn(e[r]?.visibility) >= n ? t + 1 : t, 0);
1270
+ }
1271
+ function hn(e) {
1272
+ if (!Array.isArray(e) || e.length < 33) return 0;
1273
+ let t = pn(e, an, 0);
1274
+ if (t === null) return 0;
1275
+ let n = pn(e, on, cn) ?? t, r = mn(e, an, sn), i = r >= ln ? 1 : r / ln;
1276
+ return (t * un + n * dn) * i;
1277
+ }
1278
+ //#endregion
1232
1279
  //#region src/types/tracking.ts
1233
- var $t = "pose-0";
1280
+ var gn = "pose-0";
1234
1281
  //#endregion
1235
1282
  //#region src/pose/smoothing.ts
1236
- function en(e) {
1283
+ function _n(e) {
1237
1284
  return typeof e == "number" ? e : 0;
1238
1285
  }
1239
- function tn(e) {
1286
+ function vn(e) {
1240
1287
  return {
1241
1288
  x: e.x,
1242
1289
  y: e.y,
1243
1290
  z: e.z,
1244
- visibility: en(e.visibility)
1291
+ visibility: _n(e.visibility)
1245
1292
  };
1246
1293
  }
1247
- function nn(e) {
1248
- return e.map(tn);
1249
- }
1250
- function rn(e) {
1251
- return tn(e);
1294
+ function yn(e) {
1295
+ return e.map(vn);
1252
1296
  }
1253
- function an(e) {
1254
- let t = Math.PI * 2, n = (e + Math.PI) % t;
1255
- return n < 0 && (n += t), n - Math.PI;
1297
+ function bn(e) {
1298
+ return vn(e);
1256
1299
  }
1257
- function on(e, t, n) {
1258
- return an(e + an(t - e) * n);
1300
+ function xn(e, t, n) {
1301
+ return E(e + E(t - e) * n);
1259
1302
  }
1260
- var sn = class {
1303
+ var Sn = class {
1261
1304
  prev = null;
1262
1305
  config;
1263
- constructor(e = Fe) {
1306
+ constructor(e = Re) {
1264
1307
  this.config = e;
1265
1308
  }
1266
1309
  smooth(e) {
1267
1310
  if (e.length === 0) return this.prev = null, [];
1268
- let t = nn(e);
1269
- if (!this.prev || this.prev.length !== t.length) return this.prev = t.map(rn), t.map(rn);
1311
+ let t = yn(e);
1312
+ if (!this.prev || this.prev.length !== t.length) return this.prev = t.map(bn), t.map(bn);
1270
1313
  let n = this.config.positionAlpha, r = t.map((e, t) => {
1271
1314
  let r = this.prev[t];
1272
1315
  return (e.visibility ?? 0) < this.config.visibilityThreshold ? {
1273
- ...rn(r),
1316
+ ...bn(r),
1274
1317
  visibility: e.visibility
1275
1318
  } : {
1276
1319
  x: r.x + n * (e.x - r.x),
@@ -1279,23 +1322,23 @@ var sn = class {
1279
1322
  visibility: e.visibility
1280
1323
  };
1281
1324
  });
1282
- return this.prev = r.map(rn), r;
1325
+ return this.prev = r.map(bn), r;
1283
1326
  }
1284
1327
  reset() {
1285
1328
  this.prev = null;
1286
1329
  }
1287
1330
  };
1288
- function J(e, t, n) {
1331
+ function G(e, t, n) {
1289
1332
  return {
1290
- x: on(e.x, t.x, n),
1291
- y: on(e.y, t.y, n),
1292
- z: on(e.z, t.z, n)
1333
+ x: xn(e.x, t.x, n),
1334
+ y: xn(e.y, t.y, n),
1335
+ z: xn(e.z, t.z, n)
1293
1336
  };
1294
1337
  }
1295
- function cn(e, t, n) {
1296
- return t ? e ? J(e, t, n) : t : e;
1338
+ function Cn(e, t, n) {
1339
+ return t ? e ? G(e, t, n) : t : e;
1297
1340
  }
1298
- function ln(e, t, n = Fe.rotationAlpha) {
1341
+ function wn(e, t, n = Re.rotationAlpha) {
1299
1342
  return e ? {
1300
1343
  hips: {
1301
1344
  position: {
@@ -1303,29 +1346,29 @@ function ln(e, t, n = Fe.rotationAlpha) {
1303
1346
  y: e.hips.position.y + n * (t.hips.position.y - e.hips.position.y),
1304
1347
  z: e.hips.position.z + n * (t.hips.position.z - e.hips.position.z)
1305
1348
  },
1306
- rotation: J(e.hips.rotation, t.hips.rotation, n)
1349
+ rotation: G(e.hips.rotation, t.hips.rotation, n)
1307
1350
  },
1308
- spine: J(e.spine, t.spine, n),
1309
- chest: J(e.chest, t.chest, n),
1310
- leftUpperArm: J(e.leftUpperArm, t.leftUpperArm, n),
1311
- leftLowerArm: J(e.leftLowerArm, t.leftLowerArm, n),
1312
- rightUpperArm: J(e.rightUpperArm, t.rightUpperArm, n),
1313
- rightLowerArm: J(e.rightLowerArm, t.rightLowerArm, n),
1314
- leftUpperLeg: cn(e.leftUpperLeg, t.leftUpperLeg, n),
1315
- leftLowerLeg: cn(e.leftLowerLeg, t.leftLowerLeg, n),
1316
- rightUpperLeg: cn(e.rightUpperLeg, t.rightUpperLeg, n),
1317
- rightLowerLeg: cn(e.rightLowerLeg, t.rightLowerLeg, n)
1351
+ spine: G(e.spine, t.spine, n),
1352
+ chest: G(e.chest, t.chest, n),
1353
+ leftUpperArm: G(e.leftUpperArm, t.leftUpperArm, n),
1354
+ leftLowerArm: G(e.leftLowerArm, t.leftLowerArm, n),
1355
+ rightUpperArm: G(e.rightUpperArm, t.rightUpperArm, n),
1356
+ rightLowerArm: G(e.rightLowerArm, t.rightLowerArm, n),
1357
+ leftUpperLeg: Cn(e.leftUpperLeg, t.leftUpperLeg, n),
1358
+ leftLowerLeg: Cn(e.leftLowerLeg, t.leftLowerLeg, n),
1359
+ rightUpperLeg: Cn(e.rightUpperLeg, t.rightUpperLeg, n),
1360
+ rightLowerLeg: Cn(e.rightLowerLeg, t.rightLowerLeg, n)
1318
1361
  } : t;
1319
1362
  }
1320
1363
  //#endregion
1321
1364
  //#region src/tracking/personLock.ts
1322
- var un = .12, dn = .35, fn = .05, pn = [
1365
+ var Tn = .12, En = .35, Dn = .05, On = [
1323
1366
  11,
1324
1367
  12,
1325
1368
  23,
1326
1369
  24
1327
- ], mn = 2, hn = .3;
1328
- function gn(e) {
1370
+ ], kn = 2, An = .3;
1371
+ function jn(e) {
1329
1372
  if (!e) return null;
1330
1373
  let t = Math.max(0, Math.min(1, e.x)), n = Math.max(0, Math.min(1, e.y));
1331
1374
  return {
@@ -1335,41 +1378,41 @@ function gn(e) {
1335
1378
  h: Math.max(.01, Math.min(1 - n, e.h))
1336
1379
  };
1337
1380
  }
1338
- function _n(e) {
1381
+ function Mn(e) {
1339
1382
  if (!Array.isArray(e) || e.length === 0) return null;
1340
1383
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity, a = 0;
1341
1384
  return e.forEach((e) => {
1342
- !e || typeof e.x != "number" || typeof e.y != "number" || (e.visibility ?? 0) < dn || (t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x), i = Math.max(i, e.y), a += 1);
1343
- }), a < 4 || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) ? null : gn({
1385
+ !e || typeof e.x != "number" || typeof e.y != "number" || (e.visibility ?? 0) < En || (t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x), i = Math.max(i, e.y), a += 1);
1386
+ }), a < 4 || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) ? null : jn({
1344
1387
  x: t,
1345
1388
  y: n,
1346
1389
  w: Math.max(.01, r - t),
1347
1390
  h: Math.max(.01, i - n)
1348
1391
  });
1349
1392
  }
1350
- function vn(e, t = un) {
1393
+ function Nn(e, t = Tn) {
1351
1394
  if (!e) return null;
1352
1395
  let n = e.w * t, r = e.h * t;
1353
- return gn({
1396
+ return jn({
1354
1397
  x: e.x - n / 2,
1355
1398
  y: e.y - r / 2,
1356
1399
  w: e.w + n,
1357
1400
  h: e.h + r
1358
1401
  });
1359
1402
  }
1360
- function yn(e, t) {
1403
+ function Pn(e, t) {
1361
1404
  if (!e || !t) return 0;
1362
1405
  let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y), i = Math.min(e.x + e.w, t.x + t.w), a = Math.min(e.y + e.h, t.y + t.h), o = Math.max(0, i - n) * Math.max(0, a - r);
1363
1406
  if (o <= 0) return 0;
1364
1407
  let s = e.w * e.h + t.w * t.h - o;
1365
1408
  return s <= 0 ? 0 : o / s;
1366
1409
  }
1367
- function bn(e) {
1410
+ function Fn(e) {
1368
1411
  return e.length === 0 ? 0 : e.reduce((e, t) => e + (t.visibility ?? 0), 0) / e.length;
1369
1412
  }
1370
- function xn(e, t = []) {
1413
+ function In(e, t = []) {
1371
1414
  return e.flatMap((e, n) => {
1372
- let r = _n(e), i = vn(r);
1415
+ let r = Mn(e), i = Nn(r);
1373
1416
  return !r || !i ? [] : [{
1374
1417
  poseIndex: n,
1375
1418
  personId: `pose-${n}`,
@@ -1377,43 +1420,43 @@ function xn(e, t = []) {
1377
1420
  worldLandmarks: t[n] ?? null,
1378
1421
  bounds: r,
1379
1422
  expandedBounds: i,
1380
- meanVisibility: bn(e),
1423
+ meanVisibility: Fn(e),
1381
1424
  area: i.w * i.h
1382
1425
  }];
1383
1426
  });
1384
1427
  }
1385
- function Sn(e, t) {
1386
- let n = yn(e.expandedBounds, t.expandedBounds);
1428
+ function Ln(e, t) {
1429
+ let n = Pn(e.expandedBounds, t.expandedBounds);
1387
1430
  return {
1388
1431
  iou: n,
1389
1432
  score: n * .75 + e.area * .25
1390
1433
  };
1391
1434
  }
1392
- function Cn(e, { previousCandidate: t, allowRelock: n = !1, minIouToKeep: r = fn }) {
1435
+ function Rn(e, { previousCandidate: t, allowRelock: n = !1, minIouToKeep: r = Dn }) {
1393
1436
  if (e.length === 0) return null;
1394
1437
  let i = [...e].sort((e, t) => t.area * t.meanVisibility - e.area * e.meanVisibility);
1395
1438
  if (!t) return i[0];
1396
1439
  let a = null, o = -Infinity, s = 0;
1397
1440
  return e.forEach((e) => {
1398
- let { iou: n, score: r } = Sn(e, t);
1441
+ let { iou: n, score: r } = Ln(e, t);
1399
1442
  r > o && (a = e, o = r, s = n);
1400
1443
  }), a && s >= r ? a : n ? i[0] : null;
1401
1444
  }
1402
- function wn(e, t) {
1445
+ function zn(e, t) {
1403
1446
  if (!t) return !0;
1404
1447
  let n = 0, r = 0, i = 0;
1405
- for (let t of pn) {
1448
+ for (let t of On) {
1406
1449
  let a = e.landmarks[t];
1407
- a && (a.visibility ?? 0) > hn && (n += a.x, r += a.y, i += 1);
1450
+ a && (a.visibility ?? 0) > An && (n += a.x, r += a.y, i += 1);
1408
1451
  }
1409
- if (i < mn) return !0;
1452
+ if (i < kn) return !0;
1410
1453
  let a = n / i, o = r / i;
1411
1454
  return a >= t.xMin && a <= t.xMax && o >= t.yMin && o <= t.yMax;
1412
1455
  }
1413
- function Tn(e, t) {
1414
- return t ? e.filter((e) => wn(e, t)) : e;
1456
+ function Bn(e, t) {
1457
+ return t ? e.filter((e) => zn(e, t)) : e;
1415
1458
  }
1416
- function En(e) {
1459
+ function Vn(e) {
1417
1460
  return e ? {
1418
1461
  poseIndex: e.poseIndex,
1419
1462
  personId: e.personId,
@@ -1423,18 +1466,18 @@ function En(e) {
1423
1466
  }
1424
1467
  //#endregion
1425
1468
  //#region src/tracking/trackingState.ts
1426
- var Dn = .55, On = 640, kn = 360;
1427
- function An(e = null) {
1469
+ var Hn = .55, Un = 640, Wn = 360;
1470
+ function Gn(e = null) {
1428
1471
  return {
1429
1472
  level: "idle",
1430
1473
  reasons: ["no_person_detected"],
1431
1474
  updatedAt: e
1432
1475
  };
1433
1476
  }
1434
- function jn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, meanVisibility: r = null, frameWidth: i = 0, frameHeight: a = 0, updatedAt: o = Date.now() }) {
1435
- if (e < 1) return An(o);
1477
+ function Kn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, meanVisibility: r = null, frameWidth: i = 0, frameHeight: a = 0, updatedAt: o = Date.now() }) {
1478
+ if (e < 1) return Gn(o);
1436
1479
  let s = [];
1437
- return e > 1 && s.push("multi_person_detected"), i > 0 && a > 0 && (i < On || a < kn) && s.push("resolution_too_low"), r !== null && r < Dn && s.push("low_visibility"), (!n || !t) && s.push("pose_not_locked"), s.length === 0 ? {
1480
+ return e > 1 && s.push("multi_person_detected"), i > 0 && a > 0 && (i < Un || a < Wn) && s.push("resolution_too_low"), r !== null && r < Hn && s.push("low_visibility"), (!n || !t) && s.push("pose_not_locked"), s.length === 0 ? {
1438
1481
  level: "good",
1439
1482
  reasons: [],
1440
1483
  updatedAt: o
@@ -1444,19 +1487,19 @@ function jn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, m
1444
1487
  updatedAt: o
1445
1488
  };
1446
1489
  }
1447
- function Mn() {
1490
+ function qn() {
1448
1491
  return {
1449
1492
  detectedPersonCount: 0,
1450
1493
  lockedPersonId: null,
1451
- trackingQuality: An()
1494
+ trackingQuality: Gn()
1452
1495
  };
1453
1496
  }
1454
- function Nn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisibility: r, frameWidth: i, frameHeight: a, updatedAt: o }) {
1497
+ function Jn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisibility: r, frameWidth: i, frameHeight: a, updatedAt: o }) {
1455
1498
  let s = n ?? (t && e > 0 ? "pose-0" : null);
1456
1499
  return {
1457
1500
  detectedPersonCount: e,
1458
1501
  lockedPersonId: s,
1459
- trackingQuality: jn({
1502
+ trackingQuality: Kn({
1460
1503
  detectedPersonCount: e,
1461
1504
  isTracking: t,
1462
1505
  lockedPersonId: s,
@@ -1469,17 +1512,17 @@ function Nn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisi
1469
1512
  }
1470
1513
  //#endregion
1471
1514
  //#region src/tracking/trackingStability.ts
1472
- var Pn = 180;
1473
- function Fn(e, t, n = 180) {
1515
+ var Yn = 180;
1516
+ function Xn(e, t, n = 180) {
1474
1517
  return e === null ? !1 : t - e <= n;
1475
1518
  }
1476
- function In(e) {
1519
+ function Zn(e) {
1477
1520
  return !e || !e.isTracking || !e.landmarks || !e.poseRig ? null : {
1478
1521
  ...e,
1479
1522
  isTracking: !0
1480
1523
  };
1481
1524
  }
1482
- function Ln(e, t, n = $t) {
1525
+ function Qn(e, t, n = gn) {
1483
1526
  return {
1484
1527
  detectedPersonCount: e,
1485
1528
  lockedPersonId: n,
@@ -1492,7 +1535,7 @@ function Ln(e, t, n = $t) {
1492
1535
  }
1493
1536
  //#endregion
1494
1537
  //#region src/hooks/usePoseTracker.ts
1495
- function Rn() {
1538
+ function $n() {
1496
1539
  return {
1497
1540
  landmarks: null,
1498
1541
  worldLandmarks: null,
@@ -1502,49 +1545,49 @@ function Rn() {
1502
1545
  isTracking: !1
1503
1546
  };
1504
1547
  }
1505
- var zn = (e, r = {}) => {
1506
- let { enabled: o = !0, modelComplexity: s = "lite", numPoses: c = 3, minDetectionConfidence: l = .5, minTrackingConfidence: u = .5, outputSegmentationMasks: d = !1, viewportWidth: f = 0, viewportHeight: p = 0 } = r, m = i(null), h = i(new sn(Fe)), g = i(null), v = i(null), b = i(null), x = i(-1), S = i({
1548
+ var er = (e, r = {}) => {
1549
+ let { enabled: o = !0, modelComplexity: s = "lite", numPoses: c = 3, minDetectionConfidence: l = .5, minTrackingConfidence: u = .5, outputSegmentationMasks: d = !1, viewportWidth: f = 0, viewportHeight: p = 0 } = r, m = i(null), h = i(new Sn(Re)), g = i(null), v = i(null), b = i(null), x = i(-1), S = i({
1507
1550
  width: 0,
1508
1551
  height: 0
1509
- }), C = i(0), w = i(null), T = i(null), E = i(null), D = i(null), O = i(null), k = i(Mn()), A = i({
1552
+ }), C = i(0), w = i(null), T = i(null), E = i(null), D = i(null), O = i(null), k = i(qn()), A = i({
1510
1553
  frames: 0,
1511
1554
  lastMeasuredAt: 0
1512
1555
  }), j = i(null), M = i({
1513
1556
  width: 0,
1514
1557
  height: 0
1515
- }), [N, P] = a(!1), [F, I] = a(Rn), [L, R] = a(null), [ee, te] = a({
1558
+ }), [N, P] = a(!1), [ee, F] = a($n), [I, L] = a(null), [te, ne] = a({
1516
1559
  width: 0,
1517
1560
  height: 0
1518
- }), [ne, re] = a(Mn()), z = t((e, t = k.current) => {
1519
- v.current = e.landmarks, k.current = t, I((t) => ({
1561
+ }), [re, ie] = a(qn()), ae = t((e, t = k.current) => {
1562
+ v.current = e.landmarks, k.current = t, F((t) => ({
1520
1563
  ...t,
1521
1564
  landmarks: e.landmarks,
1522
1565
  worldLandmarks: e.worldLandmarks,
1523
1566
  poseRig: e.poseRig,
1524
1567
  confidence: e.confidence,
1525
1568
  isTracking: e.isTracking
1526
- })), R(e.silhouetteWidths), re(t);
1527
- }, []), B = t(() => {
1569
+ })), L(e.silhouetteWidths), ie(t);
1570
+ }, []), oe = t(() => {
1528
1571
  h.current.reset(), g.current = null, v.current = null, x.current = -1, S.current = {
1529
1572
  width: 0,
1530
1573
  height: 0
1531
- }, C.current = 0, w.current = null, T.current = null, E.current = null, D.current = null, O.current = null, k.current = Mn(), A.current = {
1574
+ }, C.current = 0, w.current = null, T.current = null, E.current = null, D.current = null, O.current = null, k.current = qn(), A.current = {
1532
1575
  frames: 0,
1533
1576
  lastMeasuredAt: 0
1534
- }, I(Rn()), R(null), te({
1577
+ }, F($n()), L(null), ne({
1535
1578
  width: 0,
1536
1579
  height: 0
1537
- }), re(Mn());
1580
+ }), ie(qn());
1538
1581
  }, []);
1539
1582
  n(() => {
1540
1583
  if (!o) {
1541
- P(!1), B();
1584
+ P(!1), oe();
1542
1585
  return;
1543
1586
  }
1544
1587
  let e = !1;
1545
1588
  async function t() {
1546
1589
  try {
1547
- let t = await vt(_t[s], l, u, d, c);
1590
+ let t = await xt(bt[s], l, u, d, c);
1548
1591
  if (e) {
1549
1592
  t.close();
1550
1593
  return;
@@ -1555,7 +1598,7 @@ var zn = (e, r = {}) => {
1555
1598
  }
1556
1599
  }
1557
1600
  return t(), () => {
1558
- e = !0, P(!1), b.current !== null && (cancelAnimationFrame(b.current), b.current = null), m.current?.close(), m.current = null, B();
1601
+ e = !0, P(!1), b.current !== null && (cancelAnimationFrame(b.current), b.current = null), m.current?.close(), m.current = null, oe();
1559
1602
  };
1560
1603
  }, [
1561
1604
  o,
@@ -1564,7 +1607,7 @@ var zn = (e, r = {}) => {
1564
1607
  s,
1565
1608
  c,
1566
1609
  d,
1567
- B
1610
+ oe
1568
1611
  ]), M.current = {
1569
1612
  width: f,
1570
1613
  height: p
@@ -1585,30 +1628,30 @@ var zn = (e, r = {}) => {
1585
1628
  (i !== S.current.width || a !== S.current.height) && (S.current = {
1586
1629
  width: i,
1587
1630
  height: a
1588
- }, te({
1631
+ }, ne({
1589
1632
  width: i,
1590
1633
  height: a
1591
1634
  }));
1592
1635
  let o = M.current;
1593
- j.current = o.width > 0 && o.height > 0 ? tt(o.width, o.height, i, a) : null;
1636
+ j.current = o.width > 0 && o.height > 0 ? it(o.width, o.height, i, a) : null;
1594
1637
  let s = performance.now();
1595
1638
  try {
1596
1639
  let e = w.current === null || C.current === 0;
1597
- if (C.current = (C.current + 1) % 2, e) {
1640
+ if (C.current = (C.current + 1) % 1, e) {
1598
1641
  let e = r.detectForVideo(n, s);
1599
1642
  try {
1600
- let t = Tn(xn(e.landmarks, e.worldLandmarks), j.current), n = t.length, r = !Fn(D.current, s), o = Cn(t, {
1643
+ let t = Bn(In(e.landmarks, e.worldLandmarks), j.current), n = t.length, r = !Xn(D.current, s), o = Rn(t, {
1601
1644
  previousCandidate: O.current,
1602
1645
  allowRelock: r
1603
- }), c = o?.landmarks ?? null, l = o?.worldLandmarks ?? null, f = o || O.current ? $t : null, p = ut(), m = Nn({
1646
+ }), c = o?.landmarks ?? null, l = o?.worldLandmarks ?? null, f = o || O.current ? gn : null, p = pt(), m = Jn({
1604
1647
  detectedPersonCount: n,
1605
1648
  isTracking: !1,
1606
1649
  lockedPersonId: f,
1607
1650
  frameWidth: i,
1608
1651
  frameHeight: a,
1609
1652
  updatedAt: s
1610
- }), _ = Fn(D.current, s) ? In(E.current) : null;
1611
- if (!c) _ ? (p = _, m = Ln(n, s, f)) : (h.current.reset(), g.current = null, E.current = null, D.current = null, O.current = null, m = Nn({
1653
+ }), _ = Xn(D.current, s) ? Zn(E.current) : null;
1654
+ if (!c) _ ? (p = _, m = Qn(n, s, f)) : (h.current.reset(), g.current = null, E.current = null, D.current = null, O.current = null, m = Jn({
1612
1655
  detectedPersonCount: n,
1613
1656
  isTracking: !1,
1614
1657
  lockedPersonId: null,
@@ -1618,12 +1661,12 @@ var zn = (e, r = {}) => {
1618
1661
  }));
1619
1662
  else {
1620
1663
  r && o && (h.current.reset(), g.current = null);
1621
- let t = h.current.smooth(nn(c)), v = l ? nn(l) : null, y = Yt(t, v), b = t.reduce((e, t) => e + (t.visibility ?? 0), 0) / t.length, x = b >= u ? y ? ln(g.current, y, Fe.rotationAlpha) : g.current : null, S = x !== null, C = null;
1622
- if (O.current = o ? En(o) : O.current, d) {
1623
- let n = Xt(o ? e.segmentationMasks?.[o.poseIndex] : void 0);
1664
+ let t = h.current.smooth(c), v = l ? yn(l) : null, y = en(t, v), b = hn(t), x = b >= u && y ? wn(g.current, y, Re.rotationAlpha) : null, S = x !== null, C = null;
1665
+ if (O.current = o ? Vn(o) : O.current, d) {
1666
+ let n = tn(o ? e.segmentationMasks?.[o.poseIndex] : void 0);
1624
1667
  if (n) {
1625
- let e = at(new Float32Array(n.getAsFloat32Array()), n.width, n.height, t);
1626
- e && (C = Qt(e, i, n.width));
1668
+ let e = ct(new Float32Array(n.getAsFloat32Array()), n.width, n.height, t);
1669
+ e && (C = rn(e, i, n.width));
1627
1670
  }
1628
1671
  }
1629
1672
  S && x ? (g.current = x, p = {
@@ -1633,26 +1676,26 @@ var zn = (e, r = {}) => {
1633
1676
  confidence: b,
1634
1677
  isTracking: S,
1635
1678
  silhouetteWidths: C
1636
- }, E.current = p, D.current = s, m = Nn({
1679
+ }, E.current = p, D.current = s, m = Jn({
1637
1680
  detectedPersonCount: n,
1638
1681
  isTracking: S,
1639
- lockedPersonId: $t,
1640
- meanVisibility: o?.meanVisibility ?? b,
1682
+ lockedPersonId: gn,
1683
+ meanVisibility: b,
1641
1684
  frameWidth: i,
1642
1685
  frameHeight: a,
1643
1686
  updatedAt: s
1644
- })) : _ ? (p = _, m = Ln(n, s, f)) : (g.current = null, E.current = null, D.current = null, p = {
1687
+ })) : _ ? (p = _, m = Qn(n, s, f)) : (g.current = null, E.current = null, D.current = null, p = {
1645
1688
  landmarks: t,
1646
1689
  worldLandmarks: v,
1647
1690
  poseRig: null,
1648
1691
  confidence: b,
1649
1692
  isTracking: !1,
1650
1693
  silhouetteWidths: C
1651
- }, m = Nn({
1694
+ }, m = Jn({
1652
1695
  detectedPersonCount: n,
1653
1696
  isTracking: !1,
1654
- lockedPersonId: o ? $t : null,
1655
- meanVisibility: o?.meanVisibility ?? b,
1697
+ lockedPersonId: o ? gn : null,
1698
+ meanVisibility: b,
1656
1699
  frameWidth: i,
1657
1700
  frameHeight: a,
1658
1701
  updatedAt: s
@@ -1660,17 +1703,20 @@ var zn = (e, r = {}) => {
1660
1703
  }
1661
1704
  let v = w.current;
1662
1705
  w.current = p, k.current = m;
1663
- let y = dt(v, p, gt);
1664
- T.current = y, z(y, m);
1706
+ let y = mt(v, p, yt);
1707
+ T.current = y, ae(y, m);
1665
1708
  } finally {
1666
- Zt(e.segmentationMasks);
1709
+ nn(e.segmentationMasks);
1667
1710
  }
1668
- } else T.current && z(T.current, k.current);
1711
+ } else if (w.current && T.current) {
1712
+ let e = mt(T.current, w.current, yt);
1713
+ T.current = e, ae(e, k.current);
1714
+ }
1669
1715
  } catch {}
1670
1716
  let c = A.current;
1671
1717
  if (c.frames += 1, c.lastMeasuredAt === 0 && (c.lastMeasuredAt = s), s - c.lastMeasuredAt >= 1e3) {
1672
1718
  let e = c.frames;
1673
- c.frames = 0, c.lastMeasuredAt = s, I((t) => ({
1719
+ c.frames = 0, c.lastMeasuredAt = s, F((t) => ({
1674
1720
  ...t,
1675
1721
  fps: e
1676
1722
  }));
@@ -1685,16 +1731,16 @@ var zn = (e, r = {}) => {
1685
1731
  N,
1686
1732
  u,
1687
1733
  d,
1688
- z,
1734
+ ae,
1689
1735
  e
1690
1736
  ]);
1691
- let V = t((t) => {
1737
+ let R = t((t) => {
1692
1738
  let n = e.current, r = t.getContext("2d");
1693
1739
  if (!n || !r) return;
1694
1740
  t.width = n.videoWidth || t.clientWidth || 1280, t.height = n.videoHeight || t.clientHeight || 720, r.clearRect(0, 0, t.width, t.height);
1695
1741
  let i = v.current;
1696
1742
  if (!i) return;
1697
- let a = nn(i), o = new _(r);
1743
+ let a = yn(i), o = new _(r);
1698
1744
  o.drawLandmarks(a, {
1699
1745
  radius: 3,
1700
1746
  color: "#00FF88",
@@ -1705,20 +1751,20 @@ var zn = (e, r = {}) => {
1705
1751
  });
1706
1752
  }, [e]);
1707
1753
  return {
1708
- ...F,
1754
+ ...ee,
1709
1755
  isTrackerReady: N,
1710
- drawLandmarks: V,
1711
- silhouetteWidths: L,
1712
- poseFrameWidth: ee.width,
1713
- poseFrameHeight: ee.height,
1714
- detectedPersonCount: ne.detectedPersonCount,
1715
- lockedPersonId: ne.lockedPersonId,
1716
- trackingQuality: ne.trackingQuality
1756
+ drawLandmarks: R,
1757
+ silhouetteWidths: I,
1758
+ poseFrameWidth: te.width,
1759
+ poseFrameHeight: te.height,
1760
+ detectedPersonCount: re.detectedPersonCount,
1761
+ lockedPersonId: re.lockedPersonId,
1762
+ trackingQuality: re.trackingQuality
1717
1763
  };
1718
1764
  };
1719
1765
  //#endregion
1720
1766
  //#region src/hooks/useWebcam.ts
1721
- function Bn(e) {
1767
+ function tr(e) {
1722
1768
  if (!(e instanceof DOMException)) return "Failed to start the camera.";
1723
1769
  switch (e.name) {
1724
1770
  case "NotAllowedError": return "Camera permission was denied.";
@@ -1728,7 +1774,7 @@ function Bn(e) {
1728
1774
  default: return "Failed to start the camera.";
1729
1775
  }
1730
1776
  }
1731
- function Vn(e = {}) {
1777
+ function nr(e = {}) {
1732
1778
  let { width: o = 1280, height: s = 720, facingMode: c = "user", enabled: l = !0, mockMode: u = !1, videoRef: d, onReadyChange: f, onErrorChange: p } = e, m = i(null), h = r(() => ({
1733
1779
  get current() {
1734
1780
  return m.current;
@@ -1778,7 +1824,7 @@ function Vn(e = {}) {
1778
1824
  C(!0);
1779
1825
  } catch (t) {
1780
1826
  if (v.current !== e) return;
1781
- T(), w(Bn(t));
1827
+ T(), w(tr(t));
1782
1828
  }
1783
1829
  }, [
1784
1830
  D,
@@ -1814,14 +1860,14 @@ function Vn(e = {}) {
1814
1860
  }
1815
1861
  //#endregion
1816
1862
  //#region src/hooks/useEverFitting.ts
1817
- function Hn(e = {}) {
1818
- let { width: t = 1280, height: i = 720, facingMode: a = "user", enabled: o = !0, mockMode: s = !1, modelComplexity: c = "lite", numPoses: l, minDetectionConfidence: u, minTrackingConfidence: d, outputSegmentationMasks: f = !0, viewportWidth: p = 0, viewportHeight: m = 0, measurementEnabled: h = !0, autoStartMeasurement: g = !1, measurementConfig: _, bodyPresetOptions: v, fitType: y = "regular", garmentScaleHint: b = null } = e, x = Vn({
1863
+ function rr(e = {}) {
1864
+ let { width: t = 1280, height: i = 720, facingMode: a = "user", enabled: o = !0, mockMode: s = !1, modelComplexity: c = "lite", numPoses: l, minDetectionConfidence: u, minTrackingConfidence: d, outputSegmentationMasks: f = !0, viewportWidth: p = 0, viewportHeight: m = 0, measurementEnabled: h = !0, autoStartMeasurement: g = !1, measurementConfig: _, bodyPresetOptions: v, fitType: y = "regular", garmentScaleHint: b = null } = e, x = nr({
1819
1865
  width: t,
1820
1866
  height: i,
1821
1867
  facingMode: a,
1822
1868
  enabled: o,
1823
1869
  mockMode: s
1824
- }), S = zn(x.videoRef, {
1870
+ }), S = er(x.videoRef, {
1825
1871
  enabled: o,
1826
1872
  modelComplexity: c,
1827
1873
  numPoses: l,
@@ -1830,7 +1876,7 @@ function Hn(e = {}) {
1830
1876
  outputSegmentationMasks: f,
1831
1877
  viewportWidth: p,
1832
1878
  viewportHeight: m
1833
- }), { config: C, measurements: w, sizeRecommendation: T, garmentScale: E, isMeasuring: D, measure: O, startMeasurement: k, updateConfig: A } = $e(), j = o && x.isReady && S.isTracking, M = Pe(w, v), N = r(() => pe({
1879
+ }), { config: C, measurements: w, sizeRecommendation: T, garmentScale: E, isMeasuring: D, measure: O, startMeasurement: k, updateConfig: A } = nt(), j = o && x.isReady && S.isTracking, M = Le(w, v), N = r(() => ge({
1834
1880
  measurements: w,
1835
1881
  measurementScale: E,
1836
1882
  presetSelection: M.selection,
@@ -1940,7 +1986,7 @@ function Hn(e = {}) {
1940
1986
  }
1941
1987
  //#endregion
1942
1988
  //#region src/garment/garmentFitProfile.ts
1943
- function Un(e) {
1989
+ function ir(e) {
1944
1990
  let t = new b.Vector3(), n = new b.Quaternion(), r = new b.Quaternion();
1945
1991
  return e.updateWorldMatrix(!0, !1), e.getWorldPosition(t), e.getWorldQuaternion(n), e.parent ? e.parent.getWorldQuaternion(r) : r.identity(), {
1946
1992
  bone: e,
@@ -1951,7 +1997,7 @@ function Un(e) {
1951
1997
  restParentWorldQuaternion: r
1952
1998
  };
1953
1999
  }
1954
- function Wn(e) {
2000
+ function ar(e) {
1955
2001
  let t = new b.Box3(), n = { current: !1 }, r = new b.Vector3(), i = new b.Box3();
1956
2002
  return e.updateMatrixWorld(!0), e.traverse((e) => {
1957
2003
  if (!(e instanceof b.Mesh) || e.name.startsWith("Collision") || !e.visible) return;
@@ -2014,23 +2060,23 @@ function Wn(e) {
2014
2060
  });
2015
2061
  }), n.current || t.makeEmpty(), t;
2016
2062
  }
2017
- function Gn(e) {
2063
+ function or(e) {
2018
2064
  if (!e || e.length === 0) return null;
2019
2065
  let t = new b.Vector3(), n = new b.Vector3();
2020
2066
  return e.forEach(({ bone: e }) => {
2021
2067
  e.getWorldPosition(n), t.add(n);
2022
2068
  }), t.multiplyScalar(1 / e.length);
2023
2069
  }
2024
- function Kn(e, t) {
2070
+ function sr(e, t) {
2025
2071
  for (let n = 0; n < t.length; n += 1) {
2026
- let r = Gn(e.get(t[n]));
2072
+ let r = or(e.get(t[n]));
2027
2073
  if (r) return r;
2028
2074
  }
2029
2075
  return null;
2030
2076
  }
2031
- function qn(e, t, n = 1) {
2077
+ function cr(e, t, n = 1) {
2032
2078
  e.updateMatrixWorld(!0);
2033
- let r = Wn(e), i = r.getCenter(new b.Vector3()), a = r.getSize(new b.Vector3()), o = new b.Vector3(i.x, r.min.y + a.y * .74, i.z), s = new b.Vector3(i.x, r.min.y + a.y * .42, i.z), c = Kn(t, ["LeftUpperArm", "LeftShoulder"]), l = Kn(t, ["RightUpperArm", "RightShoulder"]), u = Kn(t, ["Hips"]), d = Kn(t, ["LeftUpperLeg"]), f = Kn(t, ["RightUpperLeg"]), p = c ?? o.clone().setX(i.x + a.x * .18), m = l ?? o.clone().setX(i.x - a.x * .18), h = u ?? s, g = p.clone().add(m).multiplyScalar(.5), _ = d && f ? d.clone().add(f).multiplyScalar(.5) : h.clone(), v = !!(c && l), y = v && !!(u || d && f), x = p.distanceTo(m), S = g.distanceTo(_), C = v ? Math.max(x, 1e-4) : Math.max(x, a.x * .3, n), w = y ? Math.max(S, 1e-4) : Math.max(S, a.y * .28, 1e-4), T = y ? g.clone().add(_).multiplyScalar(.5) : i.clone(), E = r.clone();
2079
+ let r = ar(e), i = r.getCenter(new b.Vector3()), a = r.getSize(new b.Vector3()), o = new b.Vector3(i.x, r.min.y + a.y * .74, i.z), s = new b.Vector3(i.x, r.min.y + a.y * .42, i.z), c = sr(t, ["LeftUpperArm", "LeftShoulder"]), l = sr(t, ["RightUpperArm", "RightShoulder"]), u = sr(t, ["Hips"]), d = sr(t, ["LeftUpperLeg"]), f = sr(t, ["RightUpperLeg"]), p = c ?? o.clone().setX(i.x + a.x * .18), m = l ?? o.clone().setX(i.x - a.x * .18), h = u ?? s, g = p.clone().add(m).multiplyScalar(.5), _ = d && f ? d.clone().add(f).multiplyScalar(.5) : h.clone(), v = !!(c && l), y = v && !!(u || d && f), x = p.distanceTo(m), S = g.distanceTo(_), C = v ? Math.max(x, 1e-4) : Math.max(x, a.x * .3, n), w = y ? Math.max(S, 1e-4) : Math.max(S, a.y * .28, 1e-4), T = y ? g.clone().add(_).multiplyScalar(.5) : i.clone(), E = r.clone();
2034
2080
  if (y) {
2035
2081
  let e = Math.min(g.y, _.y), t = Math.max(g.y, _.y);
2036
2082
  E.min.y = Math.max(E.min.y, e), E.max.y = Math.min(E.max.y, t), E.max.y <= E.min.y && E.copy(r);
@@ -2048,47 +2094,47 @@ function qn(e, t, n = 1) {
2048
2094
  hasBoneAnchors: y
2049
2095
  };
2050
2096
  }
2051
- function Jn(e) {
2097
+ function lr(e) {
2052
2098
  for (let t of e.values()) t.forEach(({ bone: e, restQuaternion: t, restScale: n }) => {
2053
2099
  e.quaternion.copy(t), e.scale.copy(n);
2054
2100
  });
2055
2101
  }
2056
2102
  //#endregion
2057
2103
  //#region src/avatar/avatarLoader.ts
2058
- var Yn = "__nativeVRMPrepared";
2059
- function Xn(e) {
2104
+ var ur = "__nativeVRMPrepared";
2105
+ function dr(e) {
2060
2106
  try {
2061
2107
  return new URL(e, "https://avatar.local").pathname;
2062
2108
  } catch {
2063
2109
  return e;
2064
2110
  }
2065
2111
  }
2066
- function Zn(e) {
2067
- return Xn(e).toLowerCase().endsWith(".vrm");
2112
+ function fr(e) {
2113
+ return dr(e).toLowerCase().endsWith(".vrm");
2068
2114
  }
2069
- function Qn(e) {
2070
- return Zn(e) ? "vrm" : "gltf";
2115
+ function pr(e) {
2116
+ return fr(e) ? "vrm" : "gltf";
2071
2117
  }
2072
- function $n(e, t) {
2073
- Zn(t) && e.register((e) => new S(e));
2118
+ function mr(e, t) {
2119
+ fr(t) && e.register((e) => new S(e));
2074
2120
  }
2075
- function er(e) {
2076
- if (Zn(e)) return (t) => {
2077
- $n(t, e);
2121
+ function hr(e) {
2122
+ if (fr(e)) return (t) => {
2123
+ mr(t, e);
2078
2124
  };
2079
2125
  }
2080
- function tr(e) {
2126
+ function gr(e) {
2081
2127
  e.traverse((e) => {
2082
2128
  e.frustumCulled = !1;
2083
2129
  });
2084
2130
  }
2085
- function nr(e) {
2131
+ function _r(e) {
2086
2132
  let t = e.scene.userData;
2087
- t[Yn] || (C.rotateVRM0(e), t[Yn] = !0), tr(e.scene);
2133
+ t[ur] || (C.rotateVRM0(e), t[ur] = !0), gr(e.scene);
2088
2134
  }
2089
2135
  //#endregion
2090
2136
  //#region src/avatar/humanoidBindings.ts
2091
- var rr = {
2137
+ var vr = {
2092
2138
  Hips: ["hips"],
2093
2139
  Spine: ["spine"],
2094
2140
  Chest: ["chest", "upperChest"],
@@ -2109,146 +2155,36 @@ var rr = {
2109
2155
  RightLowerLeg: ["rightLowerLeg"],
2110
2156
  RightFoot: ["rightFoot"]
2111
2157
  };
2112
- function ir(e) {
2158
+ function yr(e) {
2113
2159
  let t = /* @__PURE__ */ new Map();
2114
- return Object.entries(rr).forEach(([n, r]) => {
2160
+ return Object.entries(vr).forEach(([n, r]) => {
2115
2161
  for (let i = 0; i < r.length; i += 1) {
2116
2162
  let a = e.getNormalizedBoneNode(r[i]);
2117
2163
  if (a) {
2118
- t.set(n, [Un(a)]);
2164
+ t.set(n, [ir(a)]);
2119
2165
  break;
2120
2166
  }
2121
2167
  }
2122
2168
  }), t;
2123
2169
  }
2124
2170
  //#endregion
2125
- //#region src/avatar/VRMCompat.ts
2126
- var ar = {
2127
- root: "hips",
2128
- c_spine0: "spine",
2129
- c_spine1: "spine",
2130
- c_spine2: "chest",
2131
- c_spine3: "upperChest",
2132
- c_neck: "neck",
2133
- c_head: "head",
2134
- l_clavicle: "leftShoulder",
2135
- l_uparm: "leftUpperArm",
2136
- l_lowarm: "leftLowerArm",
2137
- l_wrist: "leftHand",
2138
- r_clavicle: "rightShoulder",
2139
- r_uparm: "rightUpperArm",
2140
- r_lowarm: "rightLowerArm",
2141
- r_wrist: "rightHand",
2142
- l_upleg: "leftUpperLeg",
2143
- l_lowleg: "leftLowerLeg",
2144
- l_foot: "leftFoot",
2145
- r_upleg: "rightUpperLeg",
2146
- r_lowleg: "rightLowerLeg",
2147
- r_foot: "rightFoot"
2148
- }, or = {
2149
- bone_0: "hips",
2150
- bone_1: "spine",
2151
- bone_2: "chest",
2152
- bone_3: "upperChest",
2153
- bone_4: "neck",
2154
- bone_5: "head",
2155
- bone_6: "leftShoulder",
2156
- bone_7: "leftUpperArm",
2157
- bone_8: "leftLowerArm",
2158
- bone_9: "leftHand",
2159
- bone_25: "rightShoulder",
2160
- bone_26: "rightUpperArm",
2161
- bone_27: "rightLowerArm",
2162
- bone_28: "rightHand",
2163
- bone_44: "leftUpperLeg",
2164
- bone_45: "leftLowerLeg",
2165
- bone_46: "leftFoot",
2166
- bone_48: "rightUpperLeg",
2167
- bone_49: "rightLowerLeg",
2168
- bone_50: "rightFoot"
2169
- }, sr = {
2170
- Root: "hips",
2171
- Hips: "hips",
2172
- Spine: "spine",
2173
- Chest: "chest",
2174
- Neck: "neck",
2175
- Head: "head",
2176
- LeftShoulder: "leftShoulder",
2177
- LeftUpperArm: "leftUpperArm",
2178
- LeftLowerArm: "leftLowerArm",
2179
- LeftHand: "leftHand",
2180
- RightShoulder: "rightShoulder",
2181
- RightUpperArm: "rightUpperArm",
2182
- RightLowerArm: "rightLowerArm",
2183
- RightHand: "rightHand",
2184
- LeftUpperLeg: "leftUpperLeg",
2185
- LeftLowerLeg: "leftLowerLeg",
2186
- LeftFoot: "leftFoot",
2187
- RightUpperLeg: "rightUpperLeg",
2188
- RightLowerLeg: "rightLowerLeg",
2189
- RightFoot: "rightFoot"
2190
- };
2191
- function cr(e, t) {
2192
- if (t?.humanoid) return {
2193
- getNormalizedBoneNode: (e) => t.humanoid.getNormalizedBoneNode(e) ?? null,
2194
- update: (e) => t.update(e),
2195
- vrm: t
2196
- };
2197
- let n = /* @__PURE__ */ new Map();
2198
- return e.traverse((e) => {
2199
- if (!(e instanceof b.Bone)) return;
2200
- let t = e.name, r = ar[t];
2201
- r && !n.has(r) && n.set(r, e);
2202
- let i = sr[t];
2203
- i && !n.has(i) && n.set(i, e);
2204
- let a = or[t];
2205
- a && !n.has(a) && n.set(a, e);
2206
- }), {
2207
- getNormalizedBoneNode: (e) => n.get(e) ?? null,
2208
- update: () => {},
2209
- vrm: null
2210
- };
2211
- }
2212
- //#endregion
2213
- //#region src/hooks/useAvatarVariant.ts
2214
- function lr(e) {
2215
- let t = x(e);
2216
- return tr(t), t.traverse((e) => {
2217
- if (e instanceof b.Mesh) {
2218
- if (Array.isArray(e.material)) {
2219
- e.material = e.material.map((e) => e.clone());
2220
- return;
2221
- }
2222
- e.material = e.material.clone();
2223
- }
2224
- }), t;
2225
- }
2226
- function ur({ url: e }) {
2227
- let t = p(e, "/draco/", !0, r(() => er(e), [e])), n = t.userData?.vrm ?? null, i = r(() => n ? (nr(n), n.scene) : lr(t.scene), [t.scene, n]), a = r(() => cr(i, n), [i, n]);
2228
- return {
2229
- scene: i,
2230
- humanoid: a,
2231
- bones: r(() => ir(a), [a])
2232
- };
2233
- }
2234
- //#endregion
2235
2171
  //#region src/pose/boneMapping.ts
2236
- var Y = Math.PI / 180, dr = {
2237
- min: -70 * Y,
2238
- max: 70 * Y
2239
- }, fr = {
2240
- min: -45 * Y,
2241
- max: 45 * Y
2242
- }, pr = {
2243
- min: -150 * Y,
2244
- max: 150 * Y
2245
- }, mr = {
2246
- min: -90 * Y,
2247
- max: 90 * Y
2248
- }, hr = {
2172
+ var K = Math.PI / 180, br = {
2173
+ min: -70 * K,
2174
+ max: 70 * K
2175
+ }, xr = {
2176
+ min: -45 * K,
2177
+ max: 45 * K
2178
+ }, Sr = {
2179
+ min: -150 * K,
2180
+ max: 150 * K
2181
+ }, Cr = {
2182
+ min: -90 * K,
2183
+ max: 90 * K
2184
+ }, wr = {
2249
2185
  min: 0,
2250
- max: 150 * Y
2251
- }, gr = {
2186
+ max: 150 * K
2187
+ }, Tr = {
2252
2188
  Hips: {
2253
2189
  rigKey: "hips",
2254
2190
  rotationScale: {
@@ -2279,22 +2215,22 @@ var Y = Math.PI / 180, dr = {
2279
2215
  rigKey: "leftUpperArm",
2280
2216
  rotationScale: .45,
2281
2217
  rotationLimits: {
2282
- x: dr,
2283
- z: fr
2218
+ x: br,
2219
+ z: xr
2284
2220
  }
2285
2221
  },
2286
2222
  LeftUpperArm: {
2287
2223
  rigKey: "leftUpperArm",
2288
2224
  rotationScale: 1,
2289
2225
  rotationLimits: {
2290
- x: pr,
2291
- z: mr
2226
+ x: Sr,
2227
+ z: Cr
2292
2228
  }
2293
2229
  },
2294
2230
  LeftLowerArm: {
2295
2231
  rigKey: "leftLowerArm",
2296
2232
  rotationScale: 1,
2297
- rotationLimits: { x: hr }
2233
+ rotationLimits: { x: wr }
2298
2234
  },
2299
2235
  LeftHand: {
2300
2236
  rigKey: "leftLowerArm",
@@ -2304,22 +2240,22 @@ var Y = Math.PI / 180, dr = {
2304
2240
  rigKey: "rightUpperArm",
2305
2241
  rotationScale: .45,
2306
2242
  rotationLimits: {
2307
- x: dr,
2308
- z: fr
2243
+ x: br,
2244
+ z: xr
2309
2245
  }
2310
2246
  },
2311
2247
  RightUpperArm: {
2312
2248
  rigKey: "rightUpperArm",
2313
2249
  rotationScale: 1,
2314
2250
  rotationLimits: {
2315
- x: pr,
2316
- z: mr
2251
+ x: Sr,
2252
+ z: Cr
2317
2253
  }
2318
2254
  },
2319
2255
  RightLowerArm: {
2320
2256
  rigKey: "rightLowerArm",
2321
2257
  rotationScale: 1,
2322
- rotationLimits: { x: hr }
2258
+ rotationLimits: { x: wr }
2323
2259
  },
2324
2260
  RightHand: {
2325
2261
  rigKey: "rightLowerArm",
@@ -2343,7 +2279,7 @@ var Y = Math.PI / 180, dr = {
2343
2279
  rotationScale: .9
2344
2280
  },
2345
2281
  RightFoot: { rigKey: null }
2346
- }, _r = {
2282
+ }, Er = {
2347
2283
  Root: "Hips",
2348
2284
  root: "Hips",
2349
2285
  c_spine0: "Spine",
@@ -2386,22 +2322,22 @@ var Y = Math.PI / 180, dr = {
2386
2322
  mixamorig_RightLeg: "RightLowerLeg",
2387
2323
  mixamorig_RightFoot: "RightFoot"
2388
2324
  };
2389
- function vr(e) {
2390
- return gr[e] ? e : _r[e] ?? e;
2325
+ function Dr(e) {
2326
+ return Tr[e] ? e : Er[e] ?? e;
2391
2327
  }
2392
- function yr(e, t) {
2393
- let n = gr[vr(e)];
2328
+ function Or(e, t) {
2329
+ let n = Tr[Dr(e)];
2394
2330
  if (!n || !n.rigKey) return null;
2395
2331
  let r = t[n.rigKey];
2396
2332
  if (!r) return null;
2397
- let i = br(n.rigKey === "hips" && "rotation" in r ? r.rotation : r, n.rotationScale);
2333
+ let i = kr(n.rigKey === "hips" && "rotation" in r ? r.rotation : r, n.rotationScale);
2398
2334
  return {
2399
- x: xr(i.x, n.rotationLimits?.x),
2400
- y: xr(i.y, n.rotationLimits?.y),
2401
- z: xr(i.z, n.rotationLimits?.z)
2335
+ x: Ar(i.x, n.rotationLimits?.x),
2336
+ y: Ar(i.y, n.rotationLimits?.y),
2337
+ z: Ar(i.z, n.rotationLimits?.z)
2402
2338
  };
2403
2339
  }
2404
- function br(e, t = 1) {
2340
+ function kr(e, t = 1) {
2405
2341
  return typeof t == "number" ? {
2406
2342
  x: e.x * t,
2407
2343
  y: e.y * t,
@@ -2412,12 +2348,241 @@ function br(e, t = 1) {
2412
2348
  z: e.z * (t.z ?? 1)
2413
2349
  };
2414
2350
  }
2415
- function xr(e, t) {
2351
+ function Ar(e, t) {
2416
2352
  return t ? Math.min(t.max, Math.max(t.min, e)) : e;
2417
2353
  }
2418
2354
  //#endregion
2355
+ //#region src/humanoid/numberedBoneAliases.ts
2356
+ var jr = /^bone_\d+$/, Mr = 1e-4, Nr = 12, Pr = 8;
2357
+ function q(e, t) {
2358
+ return e.children.filter((e) => e instanceof b.Bone && t.has(e));
2359
+ }
2360
+ function J(e, t) {
2361
+ let n = t.get(e);
2362
+ if (n) return n;
2363
+ let r = new b.Vector3();
2364
+ return e.getWorldPosition(r), t.set(e, r), r;
2365
+ }
2366
+ function Fr(e, t, n) {
2367
+ let r = n.get(e);
2368
+ if (r !== void 0) return r;
2369
+ let i = q(e, t).reduce((e, r) => e + 1 + Fr(r, t, n), 0);
2370
+ return n.set(e, i), i;
2371
+ }
2372
+ function Y(e, t, n) {
2373
+ !t || e.has(t) || e.set(t, n);
2374
+ }
2375
+ function Ir(e, t, n, r, i) {
2376
+ let a = J(e, r), o = null, s = -Infinity;
2377
+ return q(e, n).forEach((e) => {
2378
+ let c = J(e, r).clone().sub(a), l = Fr(e, n, i) * .4;
2379
+ t === "up" ? l += c.y * 6 - Math.abs(c.x) * 1.5 - Math.abs(c.z) * .8 : t === "positiveX" ? l += c.x * 5 - Math.max(c.y, 0) * .5 - Math.abs(c.z) * .5 : l += -c.x * 5 - Math.max(c.y, 0) * .5 - Math.abs(c.z) * .5, !(l <= s) && (o = e, s = l);
2380
+ }), o;
2381
+ }
2382
+ function Lr(e, t, n, r) {
2383
+ let i = null, a = -Infinity;
2384
+ return e.bones.forEach((e) => {
2385
+ let o = J(e, n), s = q(e, t);
2386
+ if (s.length < 2) return;
2387
+ let c = 0, l = 0, u = 0, d = 0;
2388
+ s.forEach((e) => {
2389
+ let t = J(e, n).clone().sub(o);
2390
+ t.y > Mr && (c += 1), t.y < -Mr && (d += 1), t.x > Mr && (u += 1), t.x < -Mr && (l += 1);
2391
+ });
2392
+ let f = e.parent instanceof b.Bone && t.has(e.parent) ? 0 : 2.5, p = (c > 0 ? 6 : 0) + (d >= 2 ? 6 : 0) + (l > 0 ? 2 : 0) + (u > 0 ? 2 : 0) + s.length * .6 + Fr(e, t, r) * .12 + f;
2393
+ p <= a || (i = e, a = p);
2394
+ }), i;
2395
+ }
2396
+ function Rr(e, t, n) {
2397
+ if (!e) return [];
2398
+ let r = [e];
2399
+ for (; r.length < Pr;) {
2400
+ let e = r[r.length - 1], i = q(e, t);
2401
+ if (i.length !== 1) break;
2402
+ let a = i[0], o = J(e, n);
2403
+ if (J(a, n).y <= o.y + Mr) break;
2404
+ r.push(a);
2405
+ }
2406
+ return r;
2407
+ }
2408
+ function zr(e, t, n, r) {
2409
+ if (!e) return null;
2410
+ let i = J(e, r), a = null, o = -Infinity;
2411
+ return q(e, n).forEach((e) => {
2412
+ if (t.has(e)) return;
2413
+ let n = J(e, r).clone().sub(i), s = n.y * 3 - Math.abs(n.x) * 12 - Math.abs(n.z) * 4;
2414
+ s <= o || (a = e, o = s);
2415
+ }), a;
2416
+ }
2417
+ function Br(e, t, n, r, i, a) {
2418
+ if (!e) return null;
2419
+ let o = J(e, i), s = null, c = -Infinity, l = t === "Left" ? 1 : -1;
2420
+ return q(e, r).forEach((e) => {
2421
+ if (n.has(e)) return;
2422
+ let t = J(e, i).clone().sub(o), u = Fr(e, r, a), d = t.x * l * 6 + Math.max(t.y, 0) * 1.5 - Math.abs(t.z) * .8 + u * .25;
2423
+ d <= c || (s = e, c = d);
2424
+ }), s;
2425
+ }
2426
+ function Vr(e, t, n, r, i) {
2427
+ let a = q(e, n);
2428
+ if (a.length === 0 || a.length >= 3) return null;
2429
+ let o = J(e, r), s = null, c = -Infinity;
2430
+ return a.forEach((e) => {
2431
+ let a = J(e, r).clone().sub(o), l = Fr(e, n, i) * 12;
2432
+ t === "positiveX" ? l += a.x * 5 - Math.abs(a.y) * .8 - Math.abs(a.z) * .8 : t === "negativeX" ? l += -a.x * 5 - Math.abs(a.y) * .8 - Math.abs(a.z) * .8 : t === "up" ? l += a.y * 6 - Math.abs(a.x) * 1.2 - Math.abs(a.z) * .8 : l += -a.y * 6 + Math.abs(a.x) * .8 - Math.abs(a.z) * .8, !(l <= c) && (s = e, c = l);
2433
+ }), s;
2434
+ }
2435
+ function Hr(e, t, n, r, i) {
2436
+ if (!e) return [];
2437
+ let a = [e], o = new Set(a);
2438
+ for (; a.length < Pr;) {
2439
+ let e = a[a.length - 1], s = Vr(e, t, n, r, i);
2440
+ if (!s || o.has(s)) break;
2441
+ a.push(s), o.add(s);
2442
+ }
2443
+ return a;
2444
+ }
2445
+ function Ur(e, t, n, r, i, a) {
2446
+ if (!e) return null;
2447
+ let o = J(e, i), s = null, c = -Infinity, l = t === "Left" ? 1 : -1;
2448
+ return q(e, r).forEach((e) => {
2449
+ if (n.has(e)) return;
2450
+ let t = J(e, i).clone().sub(o), u = Fr(e, r, a), d = -t.y * 6 + t.x * l * 4 - Math.abs(t.z) * .6 + u * .2;
2451
+ d <= c || (s = e, c = d);
2452
+ }), s;
2453
+ }
2454
+ function Wr(e, t, n) {
2455
+ if (t.length === 0) return;
2456
+ let r = `${n}Shoulder`, i = `${n}UpperArm`, a = `${n}LowerArm`, o = `${n}Hand`;
2457
+ if (t.length >= 4) {
2458
+ Y(e, t[0], r), Y(e, t[1], i), Y(e, t[2], a), Y(e, t[3], o);
2459
+ return;
2460
+ }
2461
+ if (t.length === 3) {
2462
+ Y(e, t[0], i), Y(e, t[1], a), Y(e, t[2], o);
2463
+ return;
2464
+ }
2465
+ if (t.length === 2) {
2466
+ Y(e, t[0], i), Y(e, t[1], a);
2467
+ return;
2468
+ }
2469
+ Y(e, t[0], i);
2470
+ }
2471
+ function Gr(e, t, n) {
2472
+ t.length !== 0 && (Y(e, t[0], `${n}UpperLeg`), t.length >= 2 && Y(e, t[1], `${n}LowerLeg`), t.length >= 3 && Y(e, t[2], `${n}Foot`));
2473
+ }
2474
+ function Kr(e) {
2475
+ let t = e.bones.reduce((e, t) => jr.test(t.name) ? e + 1 : e, 0);
2476
+ return t >= Nr && t / Math.max(e.bones.length, 1) >= .6;
2477
+ }
2478
+ function qr(e) {
2479
+ if (!Kr(e)) return /* @__PURE__ */ new Map();
2480
+ let t = /* @__PURE__ */ new Map(), n = new Set(e.bones), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = Lr(e, n, r, i), o = a ? Ir(a, "up", n, r, i) : null, s = Rr(o, n, r), c = s[s.length - 1] ?? null, l = /* @__PURE__ */ new Set(), u = zr(c, l, n, r);
2481
+ u && l.add(u);
2482
+ let d = Br(c, "Left", l, n, r, i);
2483
+ d && l.add(d);
2484
+ let f = Br(c, "Right", l, n, r, i), p = Hr(u, "up", n, r, i), m = Hr(d, "positiveX", n, r, i), h = Hr(f, "negativeX", n, r, i), g = /* @__PURE__ */ new Set();
2485
+ o && g.add(o);
2486
+ let _ = Ur(a, "Left", g, n, r, i);
2487
+ _ && g.add(_);
2488
+ let v = Ur(a, "Right", g, n, r, i), y = Hr(_, "down", n, r, i), b = Hr(v, "down", n, r, i);
2489
+ return Y(t, a, "Hips"), s.length >= 2 ? (Y(t, s[0], "Spine"), Y(t, c, "Chest")) : s.length === 1 && Y(t, c, "Chest"), p.length >= 1 && Y(t, p[0], "Neck"), p.length >= 2 && Y(t, p[1], "Head"), Wr(t, m, "Left"), Wr(t, h, "Right"), Gr(t, y, "Left"), Gr(t, b, "Right"), t;
2490
+ }
2491
+ //#endregion
2492
+ //#region src/avatar/VRMCompat.ts
2493
+ var Jr = {
2494
+ root: "hips",
2495
+ c_spine0: "spine",
2496
+ c_spine1: "spine",
2497
+ c_spine2: "chest",
2498
+ c_spine3: "upperChest",
2499
+ c_neck: "neck",
2500
+ c_head: "head",
2501
+ l_clavicle: "leftShoulder",
2502
+ l_uparm: "leftUpperArm",
2503
+ l_lowarm: "leftLowerArm",
2504
+ l_wrist: "leftHand",
2505
+ r_clavicle: "rightShoulder",
2506
+ r_uparm: "rightUpperArm",
2507
+ r_lowarm: "rightLowerArm",
2508
+ r_wrist: "rightHand",
2509
+ l_upleg: "leftUpperLeg",
2510
+ l_lowleg: "leftLowerLeg",
2511
+ l_foot: "leftFoot",
2512
+ r_upleg: "rightUpperLeg",
2513
+ r_lowleg: "rightLowerLeg",
2514
+ r_foot: "rightFoot"
2515
+ }, Yr = {
2516
+ Root: "hips",
2517
+ Hips: "hips",
2518
+ Spine: "spine",
2519
+ Chest: "chest",
2520
+ Neck: "neck",
2521
+ Head: "head",
2522
+ LeftShoulder: "leftShoulder",
2523
+ LeftUpperArm: "leftUpperArm",
2524
+ LeftLowerArm: "leftLowerArm",
2525
+ LeftHand: "leftHand",
2526
+ RightShoulder: "rightShoulder",
2527
+ RightUpperArm: "rightUpperArm",
2528
+ RightLowerArm: "rightLowerArm",
2529
+ RightHand: "rightHand",
2530
+ LeftUpperLeg: "leftUpperLeg",
2531
+ LeftLowerLeg: "leftLowerLeg",
2532
+ LeftFoot: "leftFoot",
2533
+ RightUpperLeg: "rightUpperLeg",
2534
+ RightLowerLeg: "rightLowerLeg",
2535
+ RightFoot: "rightFoot"
2536
+ };
2537
+ function Xr(e, t) {
2538
+ if (t?.humanoid) return {
2539
+ getNormalizedBoneNode: (e) => t.humanoid.getNormalizedBoneNode(e) ?? null,
2540
+ update: (e) => t.update(e),
2541
+ vrm: t
2542
+ };
2543
+ let n = /* @__PURE__ */ new Map(), r = [];
2544
+ return e.traverse((e) => {
2545
+ if (e instanceof b.SkinnedMesh && r.push(e.skeleton), !(e instanceof b.Bone)) return;
2546
+ let t = e.name, i = Jr[t];
2547
+ i && !n.has(i) && n.set(i, e);
2548
+ let a = Yr[t];
2549
+ a && !n.has(a) && n.set(a, e);
2550
+ }), r.forEach((e) => {
2551
+ qr(e).forEach((e, t) => {
2552
+ let r = Yr[e];
2553
+ r && !n.has(r) && n.set(r, t);
2554
+ });
2555
+ }), {
2556
+ getNormalizedBoneNode: (e) => n.get(e) ?? null,
2557
+ update: () => {},
2558
+ vrm: null
2559
+ };
2560
+ }
2561
+ //#endregion
2562
+ //#region src/hooks/useAvatarVariant.ts
2563
+ function Zr(e) {
2564
+ let t = x(e);
2565
+ return gr(t), t.traverse((e) => {
2566
+ if (e instanceof b.Mesh) {
2567
+ if (Array.isArray(e.material)) {
2568
+ e.material = e.material.map((e) => e.clone());
2569
+ return;
2570
+ }
2571
+ e.material = e.material.clone();
2572
+ }
2573
+ }), t;
2574
+ }
2575
+ function Qr({ url: e }) {
2576
+ let t = p(e, "/draco/", !0, r(() => hr(e), [e])), n = t.userData?.vrm ?? null, i = r(() => n ? (_r(n), n.scene) : Zr(t.scene), [t.scene, n]), a = r(() => Xr(i, n), [i, n]);
2577
+ return {
2578
+ scene: i,
2579
+ humanoid: a,
2580
+ bones: r(() => yr(a), [a])
2581
+ };
2582
+ }
2583
+ //#endregion
2419
2584
  //#region src/garment/poseApplication.ts
2420
- var Sr = 12, Cr = new b.Quaternion(), X = new b.Quaternion(), wr = new b.Quaternion(), Tr = new b.Vector3(), Er = new b.Vector3(), Dr = new b.Vector3(), Or = new b.Vector3(), kr = new b.Vector3(), Ar = new b.Vector3(), jr = new b.Vector3(), Mr = new b.Vector3(), Nr = new b.Vector3(), Pr = new b.Quaternion(), Fr = new b.Quaternion(), Ir = new b.Quaternion(), Lr = new b.Quaternion(), Rr = {
2585
+ var $r = 12, ei = new b.Quaternion(), X = new b.Quaternion(), ti = new b.Quaternion(), ni = new b.Vector3(), ri = new b.Vector3(), ii = new b.Vector3(), ai = new b.Vector3(), oi = new b.Vector3(), si = new b.Vector3(), ci = new b.Vector3(), li = new b.Vector3(), ui = new b.Vector3(), di = new b.Quaternion(), fi = new b.Quaternion(), pi = new b.Quaternion(), mi = new b.Quaternion(), hi = {
2421
2586
  Hips: [
2422
2587
  "Spine",
2423
2588
  "Chest",
@@ -2436,7 +2601,7 @@ var Sr = 12, Cr = new b.Quaternion(), X = new b.Quaternion(), wr = new b.Quatern
2436
2601
  LeftLowerLeg: ["LeftFoot"],
2437
2602
  RightUpperLeg: ["RightLowerLeg"],
2438
2603
  RightLowerLeg: ["RightFoot"]
2439
- }, zr = {
2604
+ }, gi = {
2440
2605
  Hips: [
2441
2606
  ["LeftUpperLeg", "RightUpperLeg"],
2442
2607
  ["LeftShoulder", "RightShoulder"],
@@ -2452,104 +2617,116 @@ var Sr = 12, Cr = new b.Quaternion(), X = new b.Quaternion(), wr = new b.Quatern
2452
2617
  ["LeftUpperArm", "RightUpperArm"],
2453
2618
  ["LeftUpperLeg", "RightUpperLeg"]
2454
2619
  ]
2455
- }, Br = {
2456
- Hips: [U.RIGHT_HIP, U.LEFT_HIP],
2457
- Spine: [U.RIGHT_SHOULDER, U.LEFT_SHOULDER],
2458
- Chest: [U.RIGHT_SHOULDER, U.LEFT_SHOULDER]
2620
+ }, _i = {
2621
+ Hips: [B.RIGHT_HIP, B.LEFT_HIP],
2622
+ Spine: [B.RIGHT_SHOULDER, B.LEFT_SHOULDER],
2623
+ Chest: [B.RIGHT_SHOULDER, B.LEFT_SHOULDER]
2459
2624
  };
2460
- function Vr(e) {
2625
+ function vi(e) {
2461
2626
  return e.startsWith("Left") ? `Right${e.slice(4)}` : e.startsWith("Right") ? `Left${e.slice(5)}` : e;
2462
2627
  }
2463
- function Hr(e, t, n, r) {
2464
- let i = Rr[e];
2628
+ function yi(e, t, n, r) {
2629
+ let i = hi[e];
2465
2630
  if (!i) return !1;
2466
2631
  for (let e = 0; e < i.length; e += 1) {
2467
2632
  let a = n.get(i[e])?.[0];
2468
- if (!(!a || a.bone === t.bone || !t.restWorldPosition || !t.restParentWorldQuaternion || !a.restWorldPosition) && (r.copy(a.restWorldPosition).sub(t.restWorldPosition), !(r.lengthSq() < 1e-6))) return r.applyQuaternion(Pr.copy(t.restParentWorldQuaternion).invert()).normalize(), !0;
2633
+ if (!(!a || a.bone === t.bone || !t.restWorldPosition || !t.restParentWorldQuaternion || !a.restWorldPosition) && (r.copy(a.restWorldPosition).sub(t.restWorldPosition), !(r.lengthSq() < 1e-6))) return r.applyQuaternion(di.copy(t.restParentWorldQuaternion).invert()).normalize(), !0;
2469
2634
  }
2470
2635
  return !1;
2471
2636
  }
2472
- function Ur(e) {
2473
- return e in zr;
2637
+ function bi(e) {
2638
+ return e in gi;
2474
2639
  }
2475
- function Wr(e, t, n, r) {
2476
- let i = zr[e];
2640
+ function xi(e, t, n, r) {
2641
+ let i = gi[e];
2477
2642
  if (!i || !t.restParentWorldQuaternion) return !1;
2478
2643
  for (let e = 0; e < i.length; e += 1) {
2479
2644
  let [a, o] = i[e], s = n.get(a)?.[0], c = n.get(o)?.[0];
2480
- if (!(!s?.restWorldPosition || !c?.restWorldPosition) && (r.copy(c.restWorldPosition).sub(s.restWorldPosition).applyQuaternion(Pr.copy(t.restParentWorldQuaternion).invert()), !(r.lengthSq() < 1e-6))) return r.normalize(), !0;
2645
+ if (!(!s?.restWorldPosition || !c?.restWorldPosition) && (r.copy(c.restWorldPosition).sub(s.restWorldPosition).applyQuaternion(di.copy(t.restParentWorldQuaternion).invert()), !(r.lengthSq() < 1e-6))) return r.normalize(), !0;
2481
2646
  }
2482
2647
  return !1;
2483
2648
  }
2484
- function Gr(e, t, n, r, i) {
2485
- let a = Br[e];
2486
- return !a || !Lt(a[0], a[1], t, i, n) ? !1 : (i.applyQuaternion(Ir.copy(r).invert()).normalize(), i.lengthSq() >= 1e-6);
2649
+ function Si(e, t, n, r, i) {
2650
+ let a = _i[e];
2651
+ return !a || !Bt(a[0], a[1], t, i, n) ? !1 : (i.applyQuaternion(pi.copy(r).invert()).normalize(), i.lengthSq() >= 1e-6);
2487
2652
  }
2488
- function Kr(e, t, n, r, i, a, o, s) {
2489
- if (!Wr(e, t, n, Or) || !Gr(e, r, i, a, kr) || (Ar.copy(Or).applyQuaternion(X), jr.copy(Ar).projectOnPlane(Dr).normalize(), Mr.copy(kr).projectOnPlane(Dr).normalize(), jr.lengthSq() < 1e-6 || Mr.lengthSq() < 1e-6)) return s.copy(X), !1;
2490
- Nr.crossVectors(jr, Mr);
2491
- let c = Math.atan2(Dr.dot(Nr), jr.dot(Mr));
2492
- return Lr.setFromAxisAngle(Dr, c), s.copy(Lr).multiply(X), o !== void 0 && s.slerp(wr, 1 - o), !0;
2653
+ function Ci(e, t, n, r, i, a, o, s) {
2654
+ if (!xi(e, t, n, ai) || !Si(e, r, i, a, oi) || (si.copy(ai).applyQuaternion(X), ci.copy(si).projectOnPlane(ii).normalize(), li.copy(oi).projectOnPlane(ii).normalize(), ci.lengthSq() < 1e-6 || li.lengthSq() < 1e-6)) return s.copy(X), !1;
2655
+ ui.crossVectors(ci, li);
2656
+ let c = Math.atan2(ii.dot(ui), ci.dot(li));
2657
+ return mi.setFromAxisAngle(ii, c), s.copy(mi).multiply(X), o !== void 0 && s.slerp(ti, 1 - o), !0;
2493
2658
  }
2494
- function qr() {
2659
+ function wi() {
2495
2660
  let e = i(new b.Timer()), t = i(/* @__PURE__ */ new Map());
2496
2661
  return r(() => ({
2497
2662
  clockRef: e,
2498
2663
  prevRotationsRef: t
2499
2664
  }), []);
2500
2665
  }
2501
- function Jr(e, t, n, r = {}) {
2666
+ function Ti(e, t, n, r = {}) {
2502
2667
  if (t.size === 0) return;
2503
2668
  let { coordinateSpace: i = "normalized", excludeBones: a } = r;
2504
2669
  n.clockRef.current.update();
2505
- let o = n.clockRef.current.getDelta(), s = Math.min(1, o * Sr);
2670
+ let o = n.clockRef.current.getDelta(), s = Math.min(1, o * $r);
2506
2671
  for (let [n, r] of t) {
2507
- let o = vr(n);
2672
+ let o = Dr(n);
2508
2673
  if (a?.has(o)) continue;
2509
- let c = Vr(o);
2674
+ let c = vi(o);
2510
2675
  if (o !== n && t.has(o)) continue;
2511
- let l = Vt(c);
2676
+ let l = Wt(c);
2512
2677
  if (!l) continue;
2513
- let u = l && Rt(c, e, Tr, i);
2678
+ let u = l && Vt(c, e, ni, i);
2514
2679
  if (!u) continue;
2515
- let d = !1, f = zt(c);
2680
+ let d = !1, f = Ht(c);
2516
2681
  for (let n of r) {
2517
2682
  let { bone: r, restQuaternion: a } = n;
2518
- if (u && Hr(o, n, t, Er)) r.parent ? (r.parent.updateWorldMatrix(!0, !1), r.parent.getWorldQuaternion(Fr)) : (r.updateWorldMatrix(!0, !1), Fr.identity()), Dr.copy(Tr).applyQuaternion(Ir.copy(Fr).invert()).normalize(), X.setFromUnitVectors(Er, Dr), Ur(o) && Kr(o, n, t, e, i, Fr, f, X) || f !== void 0 && X.slerp(wr, 1 - f), Cr.copy(X).multiply(a);
2683
+ if (u && yi(o, n, t, ri)) r.parent ? (r.parent.updateWorldMatrix(!0, !1), r.parent.getWorldQuaternion(fi)) : (r.updateWorldMatrix(!0, !1), fi.identity()), ii.copy(ni).applyQuaternion(pi.copy(fi).invert()).normalize(), X.setFromUnitVectors(ri, ii), bi(o) && Ci(o, n, t, e, i, fi, f, X) || f !== void 0 && X.slerp(ti, 1 - f), ei.copy(X).multiply(a);
2519
2684
  else {
2520
- if (d ||= Bt(c, e, X, i), !d) continue;
2521
- Cr.copy(a).multiply(X);
2685
+ if (d ||= Ut(c, e, X, i), !d) continue;
2686
+ ei.copy(a).multiply(X);
2522
2687
  }
2523
- r.quaternion.slerp(Cr, s), r.updateWorldMatrix(!1, !0);
2688
+ r.quaternion.slerp(ei, s), r.updateWorldMatrix(!1, !0);
2524
2689
  }
2525
2690
  }
2526
2691
  }
2527
- function Yr(e, t) {
2528
- Jn(e), t.prevRotationsRef.current.clear();
2692
+ function Ei(e, t) {
2693
+ lr(e), t.prevRotationsRef.current.clear();
2529
2694
  }
2530
- function Xr(e, t, n, r) {
2531
- let i = Math.min(1, n * Sr);
2695
+ function Di(e, t, n, r) {
2696
+ let i = Math.min(1, n * $r);
2532
2697
  for (let [n, a] of e) {
2533
- let e = vr(n);
2698
+ let e = Dr(n);
2534
2699
  if (!(r && !r.has(e))) for (let { bone: e, restQuaternion: n } of a) e.quaternion.slerp(n, t * i);
2535
2700
  }
2536
2701
  }
2537
2702
  //#endregion
2703
+ //#region src/pose/frameSmoothing.ts
2704
+ var Oi = 1 / 60, ki = 1 / 240, Ai = 1 / 12;
2705
+ function ji(e) {
2706
+ return Number.isFinite(e) ? T(e, ki, Ai) : Oi;
2707
+ }
2708
+ function Z(e, t) {
2709
+ let n = T(e, 0, 1);
2710
+ if (n === 0 || n === 1) return n;
2711
+ let r = ji(t) / Oi;
2712
+ return 1 - (1 - n) ** r;
2713
+ }
2714
+ //#endregion
2538
2715
  //#region src/pose/yawDirectionStabilizer.ts
2539
- var Zr = 50 * Math.PI / 180, Qr = 30 * Math.PI / 180, $r = 3;
2540
- function ei(e) {
2541
- return Math.abs(e) < Zr ? "unknown" : e >= 0 ? "positive" : "negative";
2716
+ var Mi = 50 * Math.PI / 180, Ni = 30 * Math.PI / 180, Pi = 3;
2717
+ function Fi(e) {
2718
+ return Math.abs(e) < Mi ? "unknown" : e >= 0 ? "positive" : "negative";
2542
2719
  }
2543
- function ti(e) {
2720
+ function Ii(e) {
2544
2721
  return e === "positive" ? 1 : e === "negative" ? -1 : 0;
2545
2722
  }
2546
- var ni = class {
2723
+ var Li = class {
2547
2724
  _committedYawDirection = "unknown";
2548
2725
  _pendingYawDirection = "unknown";
2549
2726
  _pendingCount = 0;
2550
2727
  update(e, t) {
2551
- let n = Math.abs(t), r = ei(t);
2552
- return e === "back" || n < Qr ? (this.reset(), this._buildState(r, "unknown", t)) : this._committedYawDirection === "unknown" ? r === "unknown" ? (this._clearPending(), this._buildState(r, "unknown", t)) : (this._pendingYawDirection === r ? this._pendingCount += 1 : (this._pendingYawDirection = r, this._pendingCount = 1), this._pendingCount >= $r ? (this._committedYawDirection = this._pendingYawDirection, this._clearPending(), this._buildState(r, this._committedYawDirection, n * ti(this._committedYawDirection))) : this._buildState(r, r, t)) : this._buildState(r, this._committedYawDirection, n * ti(this._committedYawDirection));
2728
+ let n = Math.abs(t), r = Fi(t);
2729
+ return e === "back" || n < Ni ? (this.reset(), this._buildState(r, "unknown", t)) : this._committedYawDirection === "unknown" ? r === "unknown" ? (this._clearPending(), this._buildState(r, "unknown", t)) : (this._pendingYawDirection === r ? this._pendingCount += 1 : (this._pendingYawDirection = r, this._pendingCount = 1), this._pendingCount >= Pi ? (this._committedYawDirection = this._pendingYawDirection, this._clearPending(), this._buildState(r, this._committedYawDirection, n * Ii(this._committedYawDirection))) : this._buildState(r, r, t)) : this._buildState(r, this._committedYawDirection, n * Ii(this._committedYawDirection));
2553
2730
  }
2554
2731
  reset() {
2555
2732
  this._committedYawDirection = "unknown", this._clearPending();
@@ -2567,41 +2744,41 @@ var ni = class {
2567
2744
  _clearPending() {
2568
2745
  this._pendingYawDirection = "unknown", this._pendingCount = 0;
2569
2746
  }
2570
- }, ri = 80 * Math.PI / 180, ii = 100 * Math.PI / 180, ai = 25 * Math.PI / 180, oi = 8, si = 5, ci = 5, li = 5, ui = .5, di = .3, fi = .2, pi = 5, mi = 8;
2571
- function hi(e) {
2747
+ }, Ri = 80 * Math.PI / 180, zi = 100 * Math.PI / 180, Bi = 25 * Math.PI / 180, Vi = 8, Hi = 5, Ui = 5, Wi = 5, Gi = .5, Ki = .3, qi = .2, Ji = 5, Yi = 8;
2748
+ function Xi(e) {
2572
2749
  return e?.visibility ?? 0;
2573
2750
  }
2574
- function gi(e) {
2751
+ function Zi(e) {
2575
2752
  if (!e || e.length < 33) return {
2576
2753
  shoulderOrder: !1,
2577
2754
  noseVisible: !1,
2578
2755
  earSymmetry: !1
2579
2756
  };
2580
- let t = e[U.LEFT_SHOULDER], n = e[U.RIGHT_SHOULDER], r = e[U.NOSE], i = e[U.LEFT_EAR], a = e[U.RIGHT_EAR], o = t.x < n.x, s = hi(r) > ui, c = hi(i), l = hi(a);
2757
+ let t = e[B.LEFT_SHOULDER], n = e[B.RIGHT_SHOULDER], r = e[B.NOSE], i = e[B.LEFT_EAR], a = e[B.RIGHT_EAR], o = t.x < n.x, s = Xi(r) > Gi, c = Xi(i), l = Xi(a);
2581
2758
  return {
2582
2759
  shoulderOrder: o,
2583
2760
  noseVisible: s,
2584
- earSymmetry: Math.abs(c - l) < di && Math.max(c, l) > fi
2761
+ earSymmetry: Math.abs(c - l) < Ki && Math.max(c, l) > qi
2585
2762
  };
2586
2763
  }
2587
- function _i(e) {
2764
+ function Qi(e) {
2588
2765
  let t = 0;
2589
2766
  return e.shoulderOrder && (t += 1), e.noseVisible && (t += 1), e.earSymmetry && (t += 1), t >= 2;
2590
2767
  }
2591
- function vi(e) {
2592
- return e < ri ? "front" : e < ii ? "side" : "back";
2768
+ function $i(e) {
2769
+ return e < Ri ? "front" : e < zi ? "side" : "back";
2593
2770
  }
2594
- var yi = class {
2771
+ var ea = class {
2595
2772
  _zone = "front";
2596
2773
  _consecutiveCount = 0;
2597
2774
  _lastRawZone = "front";
2598
2775
  _2dFrontCount = 0;
2599
2776
  _2dBackCount = 0;
2600
2777
  _2dIsFront = !0;
2601
- _yawDirectionStabilizer = new ni();
2778
+ _yawDirectionStabilizer = new Li();
2602
2779
  update(e, t, n) {
2603
- let r = t ?? 0, i = n ?? 0, a = Math.abs(i) > ai, o;
2604
- t === void 0 ? o = this._resolve2dFallback(e) : (o = vi(Math.abs(t)), o === "front" && this._zone !== "front" && (_i(gi(e)) || (o = "back"))), this._applyHysteresis(o);
2780
+ let r = t ?? 0, i = n ?? 0, a = Math.abs(i) > Bi, o;
2781
+ t === void 0 ? o = this._resolve2dFallback(e) : (o = $i(Math.abs(t)), o === "front" && this._zone !== "front" && (Qi(Zi(e)) || (o = "back"))), this._applyHysteresis(o);
2605
2782
  let s = t === void 0 ? null : this._yawDirectionStabilizer.update(this._zone, r);
2606
2783
  return t === void 0 && this._yawDirectionStabilizer.reset(), {
2607
2784
  zone: this._zone,
@@ -2619,7 +2796,7 @@ var yi = class {
2619
2796
  this._zone = "front", this._consecutiveCount = 0, this._lastRawZone = "front", this._2dFrontCount = 0, this._2dBackCount = 0, this._2dIsFront = !0, this._yawDirectionStabilizer.reset();
2620
2797
  }
2621
2798
  _resolve2dFallback(e) {
2622
- return _i(gi(e)) ? (this._2dFrontCount += 1, this._2dBackCount = 0) : (this._2dBackCount += 1, this._2dFrontCount = 0), this._2dIsFront ? this._2dBackCount >= pi && (this._2dIsFront = !1) : this._2dFrontCount >= mi && (this._2dIsFront = !0), this._2dIsFront ? "front" : "back";
2799
+ return Qi(Zi(e)) ? (this._2dFrontCount += 1, this._2dBackCount = 0) : (this._2dBackCount += 1, this._2dFrontCount = 0), this._2dIsFront ? this._2dBackCount >= Ji && (this._2dIsFront = !1) : this._2dFrontCount >= Yi && (this._2dIsFront = !0), this._2dIsFront ? "front" : "back";
2623
2800
  }
2624
2801
  _applyHysteresis(e) {
2625
2802
  e === this._lastRawZone ? this._consecutiveCount += 1 : (this._lastRawZone = e, this._consecutiveCount = 1);
@@ -2627,18 +2804,18 @@ var yi = class {
2627
2804
  t !== null && this._consecutiveCount >= t && (this._zone = e);
2628
2805
  }
2629
2806
  _getTransitionThreshold(e, t) {
2630
- return e === t ? null : e === "front" && t === "side" || e === "front" && t === "back" ? oi : e === "side" && t === "back" ? si : e === "back" && t === "side" ? ci : e === "side" && t === "front" ? li : e === "back" && t === "front" ? ci : oi;
2807
+ return e === t ? null : e === "front" && t === "side" || e === "front" && t === "back" ? Vi : e === "side" && t === "back" ? Hi : e === "back" && t === "side" ? Ui : e === "side" && t === "front" ? Wi : e === "back" && t === "front" ? Ui : Vi;
2631
2808
  }
2632
- }, bi = Math.PI / 2;
2633
- function xi(e) {
2634
- return e >= 0 ? bi : -bi;
2809
+ }, ta = Math.PI / 2;
2810
+ function na(e) {
2811
+ return e >= 0 ? ta : -ta;
2635
2812
  }
2636
- var Si = class {
2813
+ var ra = class {
2637
2814
  _isFrozen = !1;
2638
2815
  _frozenYaw = null;
2639
2816
  update(e, t) {
2640
2817
  let n = Math.abs(t);
2641
- return this._isFrozen ? e !== "back" && n < bi && this.reset() : e !== "front" && n >= bi && (this._isFrozen = !0, this._frozenYaw = xi(t)), {
2818
+ return this._isFrozen ? e !== "back" && n < ta && this.reset() : e !== "front" && n >= ta && (this._isFrozen = !0, this._frozenYaw = na(t)), {
2642
2819
  isFrozen: this._isFrozen,
2643
2820
  frozenYaw: this._frozenYaw
2644
2821
  };
@@ -2649,7 +2826,7 @@ var Si = class {
2649
2826
  };
2650
2827
  //#endregion
2651
2828
  //#region src/pose/coordinateTransform.ts
2652
- function Ci(e, t) {
2829
+ function ia(e, t) {
2653
2830
  return typeof e == "boolean" ? {
2654
2831
  mirrorX: e,
2655
2832
  sourceWidth: 0,
@@ -2662,83 +2839,77 @@ function Ci(e, t) {
2662
2839
  target: e.target ?? t ?? new b.Vector3()
2663
2840
  };
2664
2841
  }
2665
- function Z(e, t, n, r = !1, i) {
2666
- let a = Ci(r, i), o = et(t, n, a.sourceWidth || t, a.sourceHeight || n), s = a.mirrorX ? 1 - e.x : e.x, c = o.x + s * o.width, l = o.y + e.y * o.height, u = c - t * .5, d = n * .5 - l, f = -(e.z ?? 0) * o.width * .5;
2842
+ function Q(e, t, n, r = !1, i) {
2843
+ let a = ia(r, i), o = rt(t, n, a.sourceWidth || t, a.sourceHeight || n), s = a.mirrorX ? 1 - e.x : e.x, c = o.x + s * o.width, l = o.y + e.y * o.height, u = c - t * .5, d = n * .5 - l, f = -(e.z ?? 0) * o.width * .5;
2667
2844
  return a.target.set(u, d, f);
2668
2845
  }
2669
- function wi(e, t, n, r, i = !1, a) {
2670
- return Z({
2846
+ function aa(e, t, n, r, i = !1, a) {
2847
+ return Q({
2671
2848
  x: (e.x + t.x) / 2,
2672
2849
  y: (e.y + t.y) / 2,
2673
2850
  z: ((e.z ?? 0) + (t.z ?? 0)) / 2,
2674
2851
  visibility: Math.min(e.visibility ?? 0, t.visibility ?? 0)
2675
2852
  }, n, r, i, a);
2676
2853
  }
2677
- function Ti(e, t, n, r) {
2854
+ function oa(e, t, n, r) {
2678
2855
  let i = (e.x - t.x) * n, a = (e.y - t.y) * r;
2679
2856
  return Math.sqrt(i * i + a * a);
2680
2857
  }
2681
2858
  //#endregion
2682
2859
  //#region src/garment/fitMotion.ts
2683
- var Ei = .45, Di = .72, Oi = 1.02, ki = 1.1, Ai = Math.PI / 6, ji = 1e-4, Mi = ji * ji, Ni = .35, Pi = .6, Fi = new b.Vector3(), Ii = new b.Vector3(), Q = new b.Vector3(), $ = new b.Vector3(), Li = new b.Vector3(), Ri = new b.Vector3(), zi = new b.Matrix4();
2684
- function Bi(e, t, n) {
2685
- let r = Math.min(Math.abs(n), ki), i = 1 / Math.max(Math.cos(r), Ei) * e, a = t * Di;
2860
+ var sa = .45, ca = .72, la = 1.02, ua = 1.1, da = Math.PI / 6, fa = 1e-4, pa = fa * fa, ma = .35, ha = .6, ga = new b.Vector3(), _a = new b.Vector3(), va = new b.Vector3(), ya = new b.Vector3(), ba = new b.Vector3(), xa = new b.Vector3(), Sa = new b.Matrix4();
2861
+ function Ca(e, t, n) {
2862
+ let r = Math.min(Math.abs(n), ua), i = 1 / Math.max(Math.cos(r), sa) * e, a = t * ca;
2686
2863
  return Math.max(i, a, e);
2687
2864
  }
2688
- function Vi({ projectedShoulderWidth: e, projectedTorsoHeight: t, bodyYaw: n, worldLandmarks: r }) {
2689
- let i = Bi(e, t, n), a = Gi(t, r);
2865
+ function wa({ projectedShoulderWidth: e, projectedTorsoHeight: t, bodyYaw: n, worldLandmarks: r }) {
2866
+ let i = Ca(e, t, n), a = Oa(t, r);
2690
2867
  if (!a) return i;
2691
- let o = Ji((Math.abs(n) - Ni) / Pi, 0, 1);
2868
+ let o = T((Math.abs(n) - ma) / ha, 0, 1);
2692
2869
  return i + (Math.max(i, a) - i) * o;
2693
2870
  }
2694
- function Hi(e) {
2695
- return e ? Ji(e.hips.rotation.y * .85 + e.chest.y * .15, -ki, ki) : 0;
2871
+ function Ta(e) {
2872
+ return e ? T(e.hips.rotation.y * .85 + e.chest.y * .15, -ua, ua) : 0;
2696
2873
  }
2697
- function Ui(e, t, n) {
2874
+ function Ea(e, t, n) {
2698
2875
  let r = e.x <= t.x ? e : t, i = e.x <= t.x ? t : e, a = i.x - r.x;
2699
- if (a <= ji) return 0;
2876
+ if (a <= fa) return 0;
2700
2877
  let o = -(i.y - r.y);
2701
- return Ji(Math.atan2(o, a) * Ji(1 - Math.abs(n) / ki, 0, 1), -Ai, Ai);
2878
+ return T(Math.atan2(o, a) * T(1 - Math.abs(n) / ua, 0, 1), -da, da);
2702
2879
  }
2703
- function Wi({ leftShoulder: e, rightShoulder: t, leftHip: n, rightHip: r }, i = new b.Quaternion()) {
2704
- return Fi.copy(e).add(t).multiplyScalar(.5), Ii.copy(n).add(r).multiplyScalar(.5), Q.copy(t).sub(e), Q.lengthSq() <= Mi || (Q.normalize(), $.copy(Fi).sub(Ii), Li.copy(Q).multiplyScalar($.dot(Q)), $.sub(Li), $.lengthSq() <= Mi) || ($.normalize(), Ri.crossVectors(Q, $), Ri.lengthSq() <= Mi) ? null : (Ri.normalize(), $.crossVectors(Ri, Q).normalize(), zi.makeBasis(Q, $, Ri), i.setFromRotationMatrix(zi));
2880
+ function Da({ leftShoulder: e, rightShoulder: t, leftHip: n, rightHip: r }, i = new b.Quaternion()) {
2881
+ return ga.copy(e).add(t).multiplyScalar(.5), _a.copy(n).add(r).multiplyScalar(.5), va.copy(t).sub(e), va.lengthSq() <= pa || (va.normalize(), ya.copy(ga).sub(_a), ba.copy(va).multiplyScalar(ya.dot(va)), ya.sub(ba), ya.lengthSq() <= pa) || (ya.normalize(), xa.crossVectors(va, ya), xa.lengthSq() <= pa) ? null : (xa.normalize(), ya.crossVectors(xa, va).normalize(), Sa.makeBasis(va, ya, xa), i.setFromRotationMatrix(Sa));
2705
2882
  }
2706
- function Gi(e, t) {
2707
- if (!t || t.length <= U.RIGHT_HIP || e <= ji) return null;
2708
- let n = t[U.LEFT_SHOULDER], r = t[U.RIGHT_SHOULDER], i = t[U.LEFT_HIP], a = t[U.RIGHT_HIP];
2883
+ function Oa(e, t) {
2884
+ if (!t || t.length <= B.RIGHT_HIP || e <= fa) return null;
2885
+ let n = t[B.LEFT_SHOULDER], r = t[B.RIGHT_SHOULDER], i = t[B.LEFT_HIP], a = t[B.RIGHT_HIP];
2709
2886
  if (!n || !r || !i || !a) return null;
2710
- let o = qi(n, r), s = qi(Ki(n, r), Ki(i, a));
2711
- return o <= ji || s <= ji ? null : e * Ji(o / s, Di, Oi);
2887
+ let o = Aa(n, r), s = Aa(ka(n, r), ka(i, a));
2888
+ return o <= fa || s <= fa ? null : e * T(o / s, ca, la);
2712
2889
  }
2713
- function Ki(e, t) {
2890
+ function ka(e, t) {
2714
2891
  return {
2715
2892
  x: (e.x + t.x) * .5,
2716
2893
  y: (e.y + t.y) * .5,
2717
2894
  z: ((e.z ?? 0) + (t.z ?? 0)) * .5
2718
2895
  };
2719
2896
  }
2720
- function qi(e, t) {
2897
+ function Aa(e, t) {
2721
2898
  let n = e.x - t.x, r = e.y - t.y, i = (e.z ?? 0) - (t.z ?? 0);
2722
2899
  return Math.sqrt(n * n + r * r + i * i);
2723
2900
  }
2724
- function Ji(e, t, n) {
2725
- return Math.max(t, Math.min(n, e));
2726
- }
2727
2901
  //#endregion
2728
2902
  //#region src/garment/trackedModelTransform.ts
2729
- var Yi = 1e-4, Xi = .15, Zi = 8, Qi = 1e-4, $i = 1.45, ea = .35, ta = 10, na = .18, ra = .55, ia = 6, aa = .3, oa = .08, sa = .05, ca = 1.35, la = .7, ua = new b.Quaternion(), da = new b.Vector3(), fa = [
2730
- [U.LEFT_EAR, U.RIGHT_EAR],
2731
- U.NOSE,
2732
- [U.LEFT_SHOULDER, U.RIGHT_SHOULDER]
2733
- ], pa = [
2734
- [U.LEFT_ANKLE, U.RIGHT_ANKLE],
2735
- [U.LEFT_HEEL, U.RIGHT_HEEL],
2736
- [U.LEFT_FOOT_INDEX, U.RIGHT_FOOT_INDEX]
2903
+ var $ = 1e-4, ja = .15, Ma = 8, Na = 1e-4, Pa = 1.45, Fa = .35, Ia = 10, La = .08, Ra = .42, za = .82, Ba = Math.PI / 4, Va = .76, Ha = .88, Ua = 1.32, Wa = .2, Ga = 1.3, Ka = .08, qa = .14, Ja = .55, Ya = .2, Xa = .18, Za = .55, Qa = 6, $a = .3, eo = .08, to = .05, no = 1.35, ro = .7, io = new b.Vector3(0, 1, 0), ao = new b.Quaternion(), oo = new b.Vector3(), so = new b.Quaternion(), co = new b.Euler(0, 0, 0, "YXZ"), lo = [
2904
+ [B.LEFT_EAR, B.RIGHT_EAR],
2905
+ B.NOSE,
2906
+ [B.LEFT_SHOULDER, B.RIGHT_SHOULDER]
2907
+ ], uo = [
2908
+ [B.LEFT_ANKLE, B.RIGHT_ANKLE],
2909
+ [B.LEFT_HEEL, B.RIGHT_HEEL],
2910
+ [B.LEFT_FOOT_INDEX, B.RIGHT_FOOT_INDEX]
2737
2911
  ];
2738
- function ma(e, t, n) {
2739
- return Math.max(t, Math.min(n, e));
2740
- }
2741
- function ha() {
2912
+ function fo() {
2742
2913
  return {
2743
2914
  leftShoulder: new b.Vector3(),
2744
2915
  rightShoulder: new b.Vector3(),
@@ -2752,8 +2923,12 @@ function ha() {
2752
2923
  scaledAnchor: new b.Vector3(),
2753
2924
  position: new b.Vector3(),
2754
2925
  scale: new b.Vector3(1, 1, 1),
2926
+ rootQuaternion: new b.Quaternion(),
2927
+ bodyPitch: 0,
2928
+ bodyRoll: 0,
2755
2929
  stabilizedBodyHeightScale: null,
2756
2930
  missingBodyHeightFrames: 0,
2931
+ stableTorsoHeightToShoulderRatio: null,
2757
2932
  smoothedGlobalScale: 1,
2758
2933
  hasSmoothedGlobalScale: !1,
2759
2934
  effectiveYaw: 0,
@@ -2764,84 +2939,128 @@ function ha() {
2764
2939
  hasSmoothedAnchor: !1
2765
2940
  };
2766
2941
  }
2767
- function ga(e, t, n, r, i, a = {}) {
2942
+ function po(e, t, n, r, i, a = {}) {
2768
2943
  if (t.length < 33) return !1;
2769
- Z(t[U.LEFT_SHOULDER], n, r, {
2944
+ let o = a.deltaSeconds;
2945
+ Q(t[B.LEFT_SHOULDER], n, r, {
2770
2946
  mirrorX: !0,
2771
2947
  sourceWidth: a.sourceWidth,
2772
2948
  sourceHeight: a.sourceHeight,
2773
2949
  target: i.leftShoulder
2774
- }), Z(t[U.RIGHT_SHOULDER], n, r, {
2950
+ }), Q(t[B.RIGHT_SHOULDER], n, r, {
2775
2951
  mirrorX: !0,
2776
2952
  sourceWidth: a.sourceWidth,
2777
2953
  sourceHeight: a.sourceHeight,
2778
2954
  target: i.rightShoulder
2779
- }), Z(t[U.LEFT_HIP], n, r, {
2955
+ }), Q(t[B.LEFT_HIP], n, r, {
2780
2956
  mirrorX: !0,
2781
2957
  sourceWidth: a.sourceWidth,
2782
2958
  sourceHeight: a.sourceHeight,
2783
2959
  target: i.leftHip
2784
- }), Z(t[U.RIGHT_HIP], n, r, {
2960
+ }), Q(t[B.RIGHT_HIP], n, r, {
2785
2961
  mirrorX: !0,
2786
2962
  sourceWidth: a.sourceWidth,
2787
2963
  sourceHeight: a.sourceHeight,
2788
2964
  target: i.rightHip
2789
2965
  }), i.shoulderCenter.copy(i.leftShoulder).add(i.rightShoulder).multiplyScalar(.5), i.hipCenter.copy(i.leftHip).add(i.rightHip).multiplyScalar(.5);
2790
- let o = Wi({
2966
+ let s = Da({
2791
2967
  leftShoulder: i.rightShoulder,
2792
2968
  rightShoulder: i.leftShoulder,
2793
2969
  leftHip: i.rightHip,
2794
2970
  rightHip: i.leftHip
2795
- }, ua), s = o ? va(o) : 0, c = xa(a.bodyYaw, s);
2796
- i.effectiveYaw = c;
2797
- let l = Ca(i.leftShoulder, i.rightShoulder), u = Ca(i.shoulderCenter, i.hipCenter), d = Vi({
2798
- projectedShoulderWidth: l,
2799
- projectedTorsoHeight: u,
2800
- bodyYaw: c,
2971
+ }, ao), c = s ? ho(s) : 0, l = wo(a.bodyYaw, c);
2972
+ s ? (i.rootQuaternion.copy(s), go(i.rootQuaternion, i)) : (i.rootQuaternion.identity(), i.bodyPitch = 0, i.bodyRoll = 0), i.effectiveYaw = l;
2973
+ let u = Eo(i.leftShoulder, i.rightShoulder), d = bo(Eo(i.shoulderCenter, i.hipCenter), i.shoulderCenter.distanceTo(i.hipCenter), i.bodyPitch), f = wa({
2974
+ projectedShoulderWidth: u,
2975
+ projectedTorsoHeight: d,
2976
+ bodyYaw: l,
2801
2977
  worldLandmarks: a.worldLandmarks
2802
- }), f = u / Math.max(e.referenceTorsoHeight, Yi), p = Sa(t, n, r, u, i, a), m = ya(p === null ? null : p / Math.max(e.trackingHeight, Yi), i), h = m !== null && f > Yi ? ma(m, f * la, f * ca) : m, g = ba(ma(h === null ? f : f * .55 + h * .45, Xi, Zi) * (a.scaleMultiplier ?? 1), i, u), _ = .1, v = e.referenceWidth / Math.max(e.referenceTorsoHeight, Yi), y = u > Yi ? d / u : v, x = ma(v > Yi ? y / v : 1, 1 - _, 1 + _);
2803
- return i.smoothedXDeviation = b.MathUtils.lerp(i.smoothedXDeviation, x, .35), i.scale.set(g * i.smoothedXDeviation * (a.scaleX ?? 1), g * (a.scaleY ?? 1), g * (a.scaleZ ?? 1)), i.anchor.copy(i.shoulderCenter).add(i.hipCenter).multiplyScalar(.5), i.hasSmoothedAnchor ? i.smoothedAnchor.lerp(i.anchor, .4) : (i.smoothedAnchor.copy(i.anchor), i.hasSmoothedAnchor = !0), i.scaledAnchor.set(e.anchor.x * g, e.anchor.y * g, e.anchor.z * g), i.position.copy(i.smoothedAnchor).sub(i.scaledAnchor), i.position.z += a.depthOffset ?? 0, !0;
2978
+ }), { torsoHeight: p, leanInfluence: m } = xo(d, f, e, i, o), h = p / Math.max(e.referenceTorsoHeight, $), g = To(t, n, r, p, i, a), _ = So(g === null ? null : g / Math.max(e.trackingHeight, $), i, o), v = _ !== null && h > $ ? T(_, h * ro, h * no) : _, y = v === null ? 1 : T(Ja + m * Ya, Ja, Ja + Ya), x = 1 - y, S = Co(T(v === null ? h : h * y + v * x, ja, Ma) * (a.scaleMultiplier ?? 1), i, p, o), C = .1, w = e.referenceWidth / Math.max(e.referenceTorsoHeight, $), E = p > $ ? f / p : w, D = T(w > $ ? E / w : 1, 1 - C, 1 + C), O = Z(.35, o);
2979
+ i.smoothedXDeviation = b.MathUtils.lerp(i.smoothedXDeviation, D, O), i.scale.set(S * i.smoothedXDeviation * (a.scaleX ?? 1), S * (a.scaleY ?? 1), S * (a.scaleZ ?? 1)), i.anchor.copy(i.shoulderCenter).add(i.hipCenter).multiplyScalar(.5);
2980
+ let k = Z(.4, o);
2981
+ return i.hasSmoothedAnchor ? i.smoothedAnchor.lerp(i.anchor, k) : (i.smoothedAnchor.copy(i.anchor), i.hasSmoothedAnchor = !0), i.scaledAnchor.set(e.anchor.x * S, e.anchor.y * S, e.anchor.z * S), i.position.copy(i.smoothedAnchor).sub(i.scaledAnchor), i.position.z += a.depthOffset ?? 0, !0;
2804
2982
  }
2805
- function _a(e, t) {
2983
+ function mo(e, t) {
2806
2984
  e.position.copy(t.position), e.scale.copy(t.scale);
2807
2985
  }
2808
- function va(e) {
2809
- return da.set(0, 0, 1).applyQuaternion(e), da.y = 0, da.lengthSq() <= Qi ? 0 : (da.normalize(), Math.atan2(da.x, da.z));
2986
+ function ho(e) {
2987
+ return oo.set(0, 0, 1).applyQuaternion(e), oo.y = 0, oo.lengthSq() <= Na ? 0 : (oo.normalize(), Math.atan2(oo.x, oo.z));
2810
2988
  }
2811
- function ya(e, t) {
2812
- return e === null ? t.stabilizedBodyHeightScale === null ? (t.missingBodyHeightFrames = 0, null) : (t.missingBodyHeightFrames += 1, t.missingBodyHeightFrames > ta ? (t.stabilizedBodyHeightScale = null, null) : t.stabilizedBodyHeightScale) : (t.missingBodyHeightFrames = 0, t.stabilizedBodyHeightScale = t.stabilizedBodyHeightScale === null ? e : b.MathUtils.lerp(t.stabilizedBodyHeightScale, e, ea), t.stabilizedBodyHeightScale);
2989
+ function go(e, t) {
2990
+ so.copy(e).premultiply(ao.setFromAxisAngle(io, -Math.PI)), co.setFromQuaternion(so, "YXZ"), t.bodyPitch = -E(co.x), t.bodyRoll = -E(co.z);
2813
2991
  }
2814
- function ba(e, t, n) {
2992
+ function _o(e, t) {
2993
+ if (e <= $) return e;
2994
+ let n = Math.min(Math.abs(t), Ba), r = vo(n);
2995
+ if (r <= 0) return e;
2996
+ let i = 1 / Math.max(Math.cos(n), Va);
2997
+ return e * b.MathUtils.lerp(1, i, r * za);
2998
+ }
2999
+ function vo(e) {
3000
+ return T((e - La) / Ra, 0, 1);
3001
+ }
3002
+ function yo(e, t) {
3003
+ if (e <= $ || !Number.isFinite(t) || t <= e) return e;
3004
+ let n = T(t, e, e * Ua);
3005
+ return b.MathUtils.lerp(e, n, Ha);
3006
+ }
3007
+ function bo(e, t, n) {
3008
+ return Math.max(e, _o(e, n), yo(e, t));
3009
+ }
3010
+ function xo(e, t, n, r, i) {
3011
+ if (e <= $ || t <= $) return {
3012
+ torsoHeight: e,
3013
+ leanInfluence: 0
3014
+ };
3015
+ let a = n.referenceWidth > $ ? n.referenceTorsoHeight / n.referenceWidth : 1, o = e / t, s = vo(Math.abs(r.bodyPitch));
3016
+ r.stableTorsoHeightToShoulderRatio === null && (r.stableTorsoHeightToShoulderRatio = a);
3017
+ let c = Z(Wa, i), l = s > .18 ? Math.max(r.stableTorsoHeightToShoulderRatio, o) : o;
3018
+ r.stableTorsoHeightToShoulderRatio = b.MathUtils.lerp(r.stableTorsoHeightToShoulderRatio, l, c);
3019
+ let u = T(t * r.stableTorsoHeightToShoulderRatio, e, e * Ga), d = T((u / Math.max(e, $) - 1 - Ka) / qa, 0, 1), f = Math.max(s, d);
3020
+ return {
3021
+ torsoHeight: b.MathUtils.lerp(e, u, f),
3022
+ leanInfluence: f
3023
+ };
3024
+ }
3025
+ function So(e, t, n) {
3026
+ if (e !== null) {
3027
+ t.missingBodyHeightFrames = 0;
3028
+ let r = Z(Fa, n);
3029
+ return t.stabilizedBodyHeightScale = t.stabilizedBodyHeightScale === null ? e : b.MathUtils.lerp(t.stabilizedBodyHeightScale, e, r), t.stabilizedBodyHeightScale;
3030
+ }
3031
+ return t.stabilizedBodyHeightScale === null ? (t.missingBodyHeightFrames = 0, null) : (t.missingBodyHeightFrames += 1, t.missingBodyHeightFrames > Ia ? (t.stabilizedBodyHeightScale = null, null) : t.stabilizedBodyHeightScale);
3032
+ }
3033
+ function Co(e, t, n, r) {
2815
3034
  if (!t.hasSmoothedGlobalScale) return t.smoothedGlobalScale = e, t.previousDepthProxy = n, t.scaleVelocity = 0, t.hasSmoothedGlobalScale = !0, e;
2816
- let r = t.previousDepthProxy, i = 1;
2817
- r > sa && n > sa && (i = ma(n / r, 1 - oa, 1 + oa)), t.previousDepthProxy = n;
2818
- let a = t.smoothedGlobalScale * i, o = a > 0 ? Math.abs(e - a) / a : 0;
2819
- t.scaleVelocity = b.MathUtils.lerp(t.scaleVelocity, o, aa);
2820
- let s = ma(na + t.scaleVelocity * ia, na, ra);
2821
- return t.smoothedGlobalScale = b.MathUtils.lerp(a, e, s), t.smoothedGlobalScale;
2822
- }
2823
- function xa(e, t) {
3035
+ let i = t.previousDepthProxy, a = 1;
3036
+ i > to && n > to && (a = T(n / i, 1 - eo, 1 + eo)), t.previousDepthProxy = n;
3037
+ let o = t.smoothedGlobalScale * a, s = o > 0 ? Math.abs(e - o) / o : 0, c = Z($a, r);
3038
+ t.scaleVelocity = b.MathUtils.lerp(t.scaleVelocity, s, c);
3039
+ let l = Z(T(Xa + t.scaleVelocity * Qa, Xa, Za), r);
3040
+ return t.smoothedGlobalScale = b.MathUtils.lerp(o, e, l), t.smoothedGlobalScale;
3041
+ }
3042
+ function wo(e, t) {
2824
3043
  let n = e ?? 0;
2825
3044
  return Math.abs(n) >= Math.abs(t) ? n : t;
2826
3045
  }
2827
- function Sa(e, t, n, r, i, a) {
2828
- let o = wa(fa, e, t, n, i.bodyTop, a), s = wa(pa, e, t, n, i.bodyBottom, a);
3046
+ function To(e, t, n, r, i, a) {
3047
+ let o = Do(lo, e, t, n, i.bodyTop, a), s = Do(uo, e, t, n, i.bodyBottom, a);
2829
3048
  if (!o || !s) return null;
2830
- let c = Ca(i.bodyTop, i.bodyBottom);
2831
- return c <= r * $i ? null : c;
3049
+ let c = bo(Eo(i.bodyTop, i.bodyBottom), i.bodyTop.distanceTo(i.bodyBottom), i.bodyPitch);
3050
+ return c <= r * Pa ? null : c;
2832
3051
  }
2833
- function Ca(e, t) {
3052
+ function Eo(e, t) {
2834
3053
  let n = e.x - t.x, r = e.y - t.y;
2835
3054
  return Math.sqrt(n * n + r * r);
2836
3055
  }
2837
- function wa(e, t, n, r, i, a) {
2838
- for (let o = 0; o < e.length; o += 1) if (Ta(e[o], t, n, r, i, a)) return !0;
3056
+ function Do(e, t, n, r, i, a) {
3057
+ for (let o = 0; o < e.length; o += 1) if (Oo(e[o], t, n, r, i, a)) return !0;
2839
3058
  return !1;
2840
3059
  }
2841
- function Ta(e, t, n, r, i, a) {
3060
+ function Oo(e, t, n, r, i, a) {
2842
3061
  if (typeof e == "number") {
2843
3062
  let o = t[e];
2844
- return !o || (o.visibility ?? 0) < .4 ? !1 : (Z(o, n, r, {
3063
+ return !o || (o.visibility ?? 0) < .4 ? !1 : (Q(o, n, r, {
2845
3064
  mirrorX: !0,
2846
3065
  sourceWidth: a.sourceWidth,
2847
3066
  sourceHeight: a.sourceHeight,
@@ -2850,13 +3069,13 @@ function Ta(e, t, n, r, i, a) {
2850
3069
  }
2851
3070
  let o = t[e[0]], s = t[e[1]];
2852
3071
  if (!o || !s || (o.visibility ?? 0) < .4 || (s.visibility ?? 0) < .4) return !1;
2853
- Z(o, n, r, {
3072
+ Q(o, n, r, {
2854
3073
  mirrorX: !0,
2855
3074
  sourceWidth: a.sourceWidth,
2856
3075
  sourceHeight: a.sourceHeight,
2857
3076
  target: i
2858
3077
  });
2859
- let c = Z(s, n, r, {
3078
+ let c = Q(s, n, r, {
2860
3079
  mirrorX: !0,
2861
3080
  sourceWidth: a.sourceWidth,
2862
3081
  sourceHeight: a.sourceHeight
@@ -2865,62 +3084,64 @@ function Ta(e, t, n, r, i, a) {
2865
3084
  }
2866
3085
  //#endregion
2867
3086
  //#region src/garment/trackedGarmentMotion.ts
2868
- var Ea = new b.Vector3(0, 1, 0), Da = new Set(["LeftHand", "RightHand"]), Oa = new Set([
3087
+ var ko = new Set(["LeftHand", "RightHand"]), Ao = new Set([
2869
3088
  "Hips",
2870
3089
  "Spine",
2871
3090
  "Chest"
2872
- ]), ka = 20, Aa = .436, ja = .175, Ma = 1.396, Na = .349, Pa = .35;
2873
- function Fa(e, t, n) {
2874
- return Math.max(t, Math.min(n, e));
2875
- }
2876
- function Ia(e) {
2877
- let t = e;
2878
- for (; t <= -Math.PI;) t += Math.PI * 2;
2879
- for (; t > Math.PI;) t -= Math.PI * 2;
2880
- return t;
2881
- }
2882
- function La(e, t, n) {
2883
- let r = Ia(t - e);
2884
- return Ia(Math.abs(r) <= n ? t : e + Math.sign(r) * n);
3091
+ ]), jo = 20, Mo = .436, No = .175, Po = 1.396, Fo = .349, Io = .28, Lo = .55, Ro = .7, zo = 24 * Math.PI / 180, Bo = 22 * Math.PI / 180, Vo = .35, Ho = new b.Euler(0, 0, 0, "YXZ");
3092
+ function Uo(e, t, n) {
3093
+ let r = E(t - e);
3094
+ return E(Math.abs(r) <= n ? t : e + Math.sign(r) * n);
2885
3095
  }
2886
- function Ra() {
3096
+ function Wo() {
2887
3097
  return {
2888
- transformScratch: ha(),
2889
- facingDetector: new yi(),
2890
- yawFreezeController: new Si(),
3098
+ transformScratch: fo(),
3099
+ facingDetector: new ea(),
3100
+ yawFreezeController: new ra(),
2891
3101
  displayYaw: null,
3102
+ displayPitch: null,
3103
+ displayRoll: null,
2892
3104
  lastFacingState: null,
2893
3105
  hasInitialPosition: !1
2894
3106
  };
2895
3107
  }
2896
- function za(e) {
2897
- e.transformScratch = ha(), e.facingDetector.reset(), e.yawFreezeController.reset(), e.displayYaw = null, e.lastFacingState = null, e.hasInitialPosition = !1;
3108
+ function Go(e) {
3109
+ e.transformScratch = fo(), e.facingDetector.reset(), e.yawFreezeController.reset(), e.displayYaw = null, e.displayPitch = null, e.displayRoll = null, e.lastFacingState = null, e.hasInitialPosition = !1;
2898
3110
  }
2899
- function Ba({ fitProfile: e, garmentRoot: t, boneBindingMap: n, poseRefs: r, motionState: i, landmarks: a, worldLandmarks: o = null, viewportWidth: s, viewportHeight: c, poseFrameWidth: l, poseFrameHeight: u, delta: d }) {
3111
+ function Ko({ fitProfile: e, garmentRoot: t, boneBindingMap: n, poseRefs: r, motionState: i, landmarks: a, worldLandmarks: o = null, viewportWidth: s, viewportHeight: c, poseFrameWidth: l, poseFrameHeight: u, delta: d }) {
2900
3112
  if (!a || a.length < 33) return null;
2901
3113
  let f = i.transformScratch;
2902
- ga(e, a, s, c, f, {
3114
+ po(e, a, s, c, f, {
2903
3115
  sourceWidth: l,
2904
3116
  sourceHeight: u,
2905
- worldLandmarks: o
3117
+ worldLandmarks: o,
3118
+ deltaSeconds: d
2906
3119
  });
2907
- let p = f.shoulderCenter.y - f.hipCenter.y, m = f.shoulderCenter.distanceTo(f.hipCenter), h = Math.acos(Fa(Math.abs(p) / Math.max(m, .001), 0, 1)), g = f.effectiveYaw, _ = g > 0 ? g - Math.PI : g + Math.PI, v = i.facingDetector.update(a, _, h), y = v.bodyYaw, b = i.displayYaw === null ? y : La(i.displayYaw, y, ka * d), x = i.yawFreezeController.update(v.zone, y), S = x.isFrozen, C = S ? x.frozenYaw ?? b : b;
2908
- return i.displayYaw = C, i.lastFacingState = v, v.zone !== "back" && (S || (t.scale.copy(f.scale), i.hasInitialPosition ? t.position.lerp(f.position, Pa) : (t.position.copy(f.position), i.hasInitialPosition = !0)), t.quaternion.setFromAxisAngle(Ea, C)), v.zone === "front" && !S ? (Jr(a, n, r, {
3120
+ let p = f.shoulderCenter.y - f.hipCenter.y, m = f.shoulderCenter.distanceTo(f.hipCenter), h = Math.acos(T(Math.abs(p) / Math.max(m, .001), 0, 1)), g = f.effectiveYaw, _ = g > 0 ? g - Math.PI : g + Math.PI, v = i.facingDetector.update(a, _, h), y = v.bodyYaw, x = i.displayYaw === null ? y : Uo(i.displayYaw, y, jo * d), S = i.yawFreezeController.update(v.zone, y), C = S.isFrozen, w = C ? S.frozenYaw ?? x : x, E = v.zone === "side" ? .6 : 1, D = T(f.bodyPitch * Lo, -zo, zo), O = T(f.bodyRoll * Ro * E, -Bo, Bo);
3121
+ if (i.displayYaw = w, i.lastFacingState = v, v.zone !== "back") {
3122
+ if (!C) {
3123
+ t.scale.copy(f.scale), i.hasInitialPosition ? t.position.lerp(f.position, Z(Vo, d)) : (t.position.copy(f.position), i.hasInitialPosition = !0);
3124
+ let e = Z(Io, d);
3125
+ i.displayPitch = i.displayPitch === null ? D : b.MathUtils.lerp(i.displayPitch, D, e), i.displayRoll = i.displayRoll === null ? O : b.MathUtils.lerp(i.displayRoll, O, e);
3126
+ }
3127
+ t.quaternion.setFromEuler(Ho.set(i.displayPitch ?? 0, w, i.displayRoll ?? 0));
3128
+ }
3129
+ return v.zone === "front" && !C ? (Ti(a, n, r, {
2909
3130
  coordinateSpace: "normalized",
2910
- excludeBones: Da
2911
- }), v.pitchClamped && Xr(n, Fa((Math.abs(h) - Aa) / ja, 0, 1), d, Oa)) : v.zone === "side" && !S && (Jr(a, n, r, {
3131
+ excludeBones: ko
3132
+ }), v.pitchClamped && Di(n, T((Math.abs(h) - Mo) / No, 0, 1), d, Ao)) : v.zone === "side" && !C && (Ti(a, n, r, {
2912
3133
  coordinateSpace: "normalized",
2913
- excludeBones: Da
2914
- }), Xr(n, Fa((Math.abs(y) - Ma) / Na, 0, 1), d)), v;
3134
+ excludeBones: ko
3135
+ }), Di(n, T((Math.abs(y) - Po) / Fo, 0, 1), d)), v;
2915
3136
  }
2916
3137
  //#endregion
2917
3138
  //#region src/components/TrackedGarmentPoseDriver.tsx
2918
- function Va({ garmentRootRef: e, boneBindingMap: t, fitProfile: r, landmarks: a, worldLandmarks: o, poseFrameWidth: l, poseFrameHeight: u }) {
2919
- let { viewport: d } = c(), f = qr(), p = i(Ra());
3139
+ function qo({ garmentRootRef: e, boneBindingMap: t, fitProfile: r, landmarks: a, worldLandmarks: o, poseFrameWidth: l, poseFrameHeight: u }) {
3140
+ let { viewport: d } = c(), f = wi(), p = i(Wo());
2920
3141
  return n(() => {
2921
3142
  let n = e.current, r = p.current;
2922
- return n && (n.position.set(0, 0, 0), n.scale.set(1, 1, 1), n.quaternion.identity()), Yr(t, f), za(r), () => {
2923
- Yr(t, f), za(r);
3143
+ return n && (n.position.set(0, 0, 0), n.scale.set(1, 1, 1), n.quaternion.identity()), Ei(t, f), Go(r), () => {
3144
+ Ei(t, f), Go(r);
2924
3145
  };
2925
3146
  }, [
2926
3147
  t,
@@ -2929,7 +3150,7 @@ function Va({ garmentRootRef: e, boneBindingMap: t, fitProfile: r, landmarks: a,
2929
3150
  f
2930
3151
  ]), s((n, i) => {
2931
3152
  let s = e.current;
2932
- !s || !r || Ba({
3153
+ !s || !r || Ko({
2933
3154
  fitProfile: r,
2934
3155
  garmentRoot: s,
2935
3156
  boneBindingMap: t,
@@ -2947,7 +3168,7 @@ function Va({ garmentRootRef: e, boneBindingMap: t, fitProfile: r, landmarks: a,
2947
3168
  }
2948
3169
  //#endregion
2949
3170
  //#region src/components/EverTrackedGarment.tsx
2950
- function Ha(e) {
3171
+ function Jo(e) {
2951
3172
  return e ? e.map((e) => ({
2952
3173
  x: e.x,
2953
3174
  y: e.y,
@@ -2955,8 +3176,8 @@ function Ha(e) {
2955
3176
  visibility: typeof e.visibility == "number" ? e.visibility : 0
2956
3177
  })) : null;
2957
3178
  }
2958
- function Ua({ url: e, landmarks: t, worldLandmarks: a, poseFrameWidth: o, poseFrameHeight: s, debugMaterials: c = !1, onLoadStateChange: l }) {
2959
- let u = i(null), { scene: d, bones: f } = ur({ url: e }), p = r(() => Ha(t), [t]), m = r(() => Ha(a), [a]), _ = r(() => (d.updateMatrixWorld(!0), qn(d, f, 1)), [f, d]);
3179
+ function Yo({ url: e, landmarks: t, worldLandmarks: a, poseFrameWidth: o, poseFrameHeight: s, debugMaterials: c = !1, onLoadStateChange: l }) {
3180
+ let u = i(null), { scene: d, bones: f } = Qr({ url: e }), p = r(() => Jo(t), [t]), m = r(() => Jo(a), [a]), _ = r(() => (d.updateMatrixWorld(!0), cr(d, f, 1)), [f, d]);
2960
3181
  return n(() => {
2961
3182
  d.traverse((e) => {
2962
3183
  if (e instanceof b.Mesh) {
@@ -2979,7 +3200,7 @@ function Ua({ url: e, landmarks: t, worldLandmarks: a, poseFrameWidth: o, poseFr
2979
3200
  });
2980
3201
  }), [l, e]), /* @__PURE__ */ g("group", {
2981
3202
  ref: u,
2982
- children: [/* @__PURE__ */ h("primitive", { object: d }), /* @__PURE__ */ h(Va, {
3203
+ children: [/* @__PURE__ */ h("primitive", { object: d }), /* @__PURE__ */ h(qo, {
2983
3204
  garmentRootRef: u,
2984
3205
  boneBindingMap: f,
2985
3206
  fitProfile: _,
@@ -2992,17 +3213,17 @@ function Ua({ url: e, landmarks: t, worldLandmarks: a, poseFrameWidth: o, poseFr
2992
3213
  }
2993
3214
  //#endregion
2994
3215
  //#region src/components/WebcamPlaneBackground.tsx
2995
- var Wa = 1;
2996
- function Ga(e) {
3216
+ var Xo = 1;
3217
+ function Zo(e) {
2997
3218
  let t = new b.VideoTexture(e);
2998
3219
  return t.minFilter = b.NearestFilter, t.magFilter = b.NearestFilter, t.generateMipmaps = !1, t.colorSpace = b.SRGBColorSpace, t.needsUpdate = !0, t;
2999
3220
  }
3000
- function Ka(e, t, n) {
3221
+ function Qo(e, t, n) {
3001
3222
  if (!n || n.width === 0 || n.height === 0) return [e, t];
3002
3223
  let r = e / t, i = n.width / n.height;
3003
3224
  return r > i ? [e, e / i] : [t * i, t];
3004
3225
  }
3005
- function qa({ videoElement: e, webcamReady: t }) {
3226
+ function $o({ videoElement: e, webcamReady: t }) {
3006
3227
  let { viewport: o } = c(), [l, u] = a(null), [d, f] = a(null), p = i(null), m = i(null), _ = i(0);
3007
3228
  n(() => {
3008
3229
  let n = e;
@@ -3016,7 +3237,7 @@ function qa({ videoElement: e, webcamReady: t }) {
3016
3237
  m.current = setTimeout(i, 100);
3017
3238
  return;
3018
3239
  }
3019
- let e = Ga(n);
3240
+ let e = Zo(n);
3020
3241
  p.current = e, _.current = 0, f({
3021
3242
  width: n.videoWidth,
3022
3243
  height: n.videoHeight
@@ -3026,9 +3247,9 @@ function qa({ videoElement: e, webcamReady: t }) {
3026
3247
  r = !0, m.current !== null && (clearTimeout(m.current), m.current = null), n.removeEventListener("loadeddata", i), n.removeEventListener("loadedmetadata", i), n.removeEventListener("playing", i), p.current &&= (p.current.dispose(), null), _.current = 0, u(null), f(null);
3027
3248
  };
3028
3249
  }, [e, t]), s(() => {
3029
- !p.current || !p.current.image || (_.current = (_.current + 1) % Wa, _.current === 0 && (p.current.needsUpdate = !0));
3250
+ !p.current || !p.current.image || (_.current = (_.current + 1) % Xo, _.current === 0 && (p.current.needsUpdate = !0));
3030
3251
  });
3031
- let [v, y] = r(() => Ka(o.width, o.height, d), [
3252
+ let [v, y] = r(() => Qo(o.width, o.height, d), [
3032
3253
  d,
3033
3254
  o.height,
3034
3255
  o.width
@@ -3055,86 +3276,83 @@ function qa({ videoElement: e, webcamReady: t }) {
3055
3276
  }
3056
3277
  //#endregion
3057
3278
  //#region src/components/EverFittingScene.tsx
3058
- function Ja({ onReady: e }) {
3279
+ function es({ onReady: e }) {
3059
3280
  return n(() => (e?.(!0), () => {
3060
3281
  e?.(!1);
3061
3282
  }), [e]), null;
3062
3283
  }
3063
- function Ya() {
3284
+ function ts() {
3064
3285
  return /* @__PURE__ */ h("color", {
3065
3286
  attach: "background",
3066
3287
  args: ["#000000"]
3067
3288
  });
3068
3289
  }
3069
- function Xa({ garmentUrl: e, enabled: i = !0, width: o = 1280, height: s = 720, facingMode: c = "user", mockMode: l = !1, viewportWidth: u = 0, viewportHeight: p = 0, measurementEnabled: m = !0, autoStartMeasurement: _ = !1, measurementConfig: v, fitType: y = "regular", garmentScaleHint: b = null, bodyPresetOptions: x, className: S, style: C, debugMaterials: T = !1, showEnvironment: E = !1, showStats: D = !1, showWebcamBackground: O = !0, onCanvasReadyChange: k, onRuntimeStateChange: A, onGarmentLoadStateChange: j }) {
3070
- let { videoRef: M, webcamReady: N, webcamError: P, startWebcam: F, stopWebcam: I, isTrackerReady: L, landmarks: R, worldLandmarks: ee, poseRig: te, confidence: ne, fps: re, isTracking: z, drawLandmarks: B, silhouetteWidths: V, poseFrameWidth: H, poseFrameHeight: ie, detectedPersonCount: ae, lockedPersonId: oe, trackingQuality: se, config: ce, measurements: le, sizeRecommendation: ue, garmentScale: de, finalGarmentScale: fe, bodyMorphResult: pe, isMeasuring: me, canMeasure: he, startMeasurement: ge, updateConfig: _e, bodyPresetSelection: ve, bodyPresetLoading: ye, bodyPresetError: be } = Hn({
3290
+ function ns({ garmentUrl: e, enabled: i = !0, width: o = 1280, height: s = 720, facingMode: c = "user", mockMode: l = !1, modelComplexity: u, numPoses: p, minDetectionConfidence: m, minTrackingConfidence: _, outputSegmentationMasks: v, viewportWidth: y = 0, viewportHeight: b = 0, measurementEnabled: x = !0, autoStartMeasurement: S = !1, measurementConfig: C, fitType: T = "regular", garmentScaleHint: E = null, bodyPresetOptions: D, className: O, style: k, debugMaterials: A = !1, showEnvironment: j = !1, showStats: M = !1, showWebcamBackground: N = !0, onCanvasReadyChange: P, onRuntimeStateChange: ee, onGarmentLoadStateChange: F }) {
3291
+ let { videoRef: I, webcamReady: L, webcamError: te, startWebcam: ne, stopWebcam: re, isTrackerReady: ie, landmarks: ae, worldLandmarks: oe, poseRig: R, confidence: z, fps: se, isTracking: ce, drawLandmarks: le, silhouetteWidths: ue, poseFrameWidth: de, poseFrameHeight: fe, detectedPersonCount: pe, lockedPersonId: me, trackingQuality: he, config: ge, measurements: _e, sizeRecommendation: ve, garmentScale: ye, finalGarmentScale: be, bodyMorphResult: xe, isMeasuring: Se, canMeasure: Ce, startMeasurement: we, updateConfig: Te, bodyPresetSelection: Ee, bodyPresetLoading: De, bodyPresetError: Oe } = rr({
3071
3292
  enabled: i,
3072
3293
  width: o,
3073
3294
  height: s,
3074
3295
  facingMode: c,
3075
3296
  mockMode: l,
3076
- viewportWidth: u,
3077
- viewportHeight: p,
3078
- measurementEnabled: m,
3079
- autoStartMeasurement: _,
3080
- measurementConfig: v,
3081
- bodyPresetOptions: x,
3082
- fitType: y,
3083
- garmentScaleHint: b
3084
- }), [xe, Se] = a(null), Ce = t((e) => {
3085
- M.current = e, Se(e);
3086
- }, [M]), we = r(() => ({
3087
- videoRef: M,
3088
- webcamReady: N,
3089
- webcamError: P,
3090
- startWebcam: F,
3091
- stopWebcam: I,
3092
- isTrackerReady: L,
3093
- landmarks: R,
3094
- worldLandmarks: ee,
3095
- poseRig: te,
3096
- confidence: ne,
3097
- fps: re,
3098
- isTracking: z,
3099
- drawLandmarks: B,
3100
- silhouetteWidths: V,
3101
- poseFrameWidth: H,
3102
- poseFrameHeight: ie,
3103
- detectedPersonCount: ae,
3104
- lockedPersonId: oe,
3105
- trackingQuality: se,
3106
- config: ce,
3107
- measurements: le,
3108
- sizeRecommendation: ue,
3109
- garmentScale: de,
3110
- finalGarmentScale: fe,
3111
- bodyMorphResult: pe,
3112
- isMeasuring: me,
3113
- canMeasure: he,
3114
- startMeasurement: ge,
3115
- updateConfig: _e,
3116
- bodyPresetSelection: ve,
3117
- bodyPresetLoading: ye,
3118
- bodyPresetError: be
3297
+ modelComplexity: u,
3298
+ numPoses: p,
3299
+ minDetectionConfidence: m,
3300
+ minTrackingConfidence: _,
3301
+ outputSegmentationMasks: v,
3302
+ viewportWidth: y,
3303
+ viewportHeight: b,
3304
+ measurementEnabled: x,
3305
+ autoStartMeasurement: S,
3306
+ measurementConfig: C,
3307
+ bodyPresetOptions: D,
3308
+ fitType: T,
3309
+ garmentScaleHint: E
3310
+ }), [ke, Ae] = a(null), je = t((e) => {
3311
+ I.current = e, Ae(e);
3312
+ }, [I]), Me = r(() => ({
3313
+ videoRef: I,
3314
+ webcamReady: L,
3315
+ webcamError: te,
3316
+ startWebcam: ne,
3317
+ stopWebcam: re,
3318
+ isTrackerReady: ie,
3319
+ landmarks: ae,
3320
+ worldLandmarks: oe,
3321
+ poseRig: R,
3322
+ confidence: z,
3323
+ fps: se,
3324
+ isTracking: ce,
3325
+ drawLandmarks: le,
3326
+ silhouetteWidths: ue,
3327
+ poseFrameWidth: de,
3328
+ poseFrameHeight: fe,
3329
+ detectedPersonCount: pe,
3330
+ lockedPersonId: me,
3331
+ trackingQuality: he,
3332
+ config: ge,
3333
+ measurements: _e,
3334
+ sizeRecommendation: ve,
3335
+ garmentScale: ye,
3336
+ finalGarmentScale: be,
3337
+ bodyMorphResult: xe,
3338
+ isMeasuring: Se,
3339
+ canMeasure: Ce,
3340
+ startMeasurement: we,
3341
+ updateConfig: Te,
3342
+ bodyPresetSelection: Ee,
3343
+ bodyPresetLoading: De,
3344
+ bodyPresetError: Oe
3119
3345
  }), [
3120
- M,
3121
- N,
3122
- P,
3123
- F,
3124
3346
  I,
3125
3347
  L,
3126
- R,
3127
- ee,
3128
3348
  te,
3129
3349
  ne,
3130
3350
  re,
3131
- z,
3132
- B,
3133
- V,
3134
- H,
3135
3351
  ie,
3136
3352
  ae,
3137
3353
  oe,
3354
+ R,
3355
+ z,
3138
3356
  se,
3139
3357
  ce,
3140
3358
  le,
@@ -3148,32 +3366,40 @@ function Xa({ garmentUrl: e, enabled: i = !0, width: o = 1280, height: s = 720,
3148
3366
  _e,
3149
3367
  ve,
3150
3368
  ye,
3151
- be
3369
+ be,
3370
+ xe,
3371
+ Se,
3372
+ Ce,
3373
+ we,
3374
+ Te,
3375
+ Ee,
3376
+ De,
3377
+ Oe
3152
3378
  ]);
3153
3379
  return n(() => {
3154
- A?.(we);
3155
- }, [A, we]), /* @__PURE__ */ g("div", {
3156
- className: S,
3380
+ ee?.(Me);
3381
+ }, [ee, Me]), /* @__PURE__ */ g("div", {
3382
+ className: O,
3157
3383
  style: {
3158
3384
  position: "relative",
3159
3385
  width: "100%",
3160
3386
  height: "100%",
3161
3387
  overflow: "hidden",
3162
- ...C
3388
+ ...k
3163
3389
  },
3164
3390
  children: [/* @__PURE__ */ h("video", {
3165
- ref: Ce,
3391
+ ref: je,
3166
3392
  autoPlay: !0,
3167
3393
  playsInline: !0,
3168
3394
  muted: !0,
3169
3395
  style: { display: "none" }
3170
3396
  }), /* @__PURE__ */ g(w, {
3171
- showEnvironment: E,
3397
+ showEnvironment: j,
3172
3398
  useDefaultLights: !1,
3173
3399
  enableOrbitControls: !1,
3174
3400
  children: [
3175
- /* @__PURE__ */ h(Ja, { onReady: k }),
3176
- /* @__PURE__ */ h(Ya, {}),
3401
+ /* @__PURE__ */ h(es, { onReady: P }),
3402
+ /* @__PURE__ */ h(ts, {}),
3177
3403
  /* @__PURE__ */ h(d, {
3178
3404
  makeDefault: !0,
3179
3405
  position: [
@@ -3207,44 +3433,44 @@ function Xa({ garmentUrl: e, enabled: i = !0, width: o = 1280, height: s = 720,
3207
3433
  "#7d8aa6",
3208
3434
  .35
3209
3435
  ] }),
3210
- O ? /* @__PURE__ */ h(qa, {
3211
- videoElement: xe,
3212
- webcamReady: N
3436
+ N ? /* @__PURE__ */ h($o, {
3437
+ videoElement: ke,
3438
+ webcamReady: L
3213
3439
  }) : null,
3214
- i && e ? /* @__PURE__ */ h(Ua, {
3440
+ i && e ? /* @__PURE__ */ h(Yo, {
3215
3441
  url: e,
3216
- landmarks: R,
3217
- worldLandmarks: ee,
3218
- poseFrameWidth: H,
3219
- poseFrameHeight: ie,
3220
- debugMaterials: T,
3221
- onLoadStateChange: j
3442
+ landmarks: ae,
3443
+ worldLandmarks: oe,
3444
+ poseFrameWidth: de,
3445
+ poseFrameHeight: fe,
3446
+ debugMaterials: A,
3447
+ onLoadStateChange: F
3222
3448
  }) : null,
3223
- D ? /* @__PURE__ */ h(f, {}) : null
3449
+ M ? /* @__PURE__ */ h(f, {}) : null
3224
3450
  ]
3225
3451
  })]
3226
3452
  });
3227
3453
  }
3228
3454
  //#endregion
3229
3455
  //#region src/hooks/useEverGeneration.ts
3230
- var Za = { gender: "female" };
3231
- function Qa(e, t) {
3456
+ var rs = { gender: "female" };
3457
+ function is(e, t) {
3232
3458
  return e instanceof Error && e.message ? e.message : t;
3233
3459
  }
3234
- function $a(e) {
3235
- let n = r(() => new _e(e), [e]), [i, o] = a("idle"), [s, c] = a(null), [l, u] = a(null);
3460
+ function as(e) {
3461
+ let n = r(() => new be(e), [e]), [i, o] = a("idle"), [s, c] = a(null), [l, u] = a(null);
3236
3462
  return {
3237
3463
  status: i,
3238
3464
  resultUrl: s,
3239
3465
  error: l,
3240
- generateAvatar: t(async (e = Za) => {
3466
+ generateAvatar: t(async (e = rs) => {
3241
3467
  o("processing"), u(null);
3242
3468
  try {
3243
- let t = e instanceof Blob ? Za : e, r = await n.matchBodyPreset(t);
3469
+ let t = e instanceof Blob ? rs : e, r = await n.matchBodyPreset(t);
3244
3470
  if (!r.model_url) throw Error("Matched body preset does not have a 3D model URL.");
3245
3471
  return c(r.model_url), o("ready"), r.model_url;
3246
3472
  } catch (e) {
3247
- throw u(Qa(e, "Failed to load avatar model")), o("error"), e;
3473
+ throw u(is(e, "Failed to load avatar model")), o("error"), e;
3248
3474
  }
3249
3475
  }, [n]),
3250
3476
  createGarment: t(async (e, t, r, i) => {
@@ -3259,7 +3485,7 @@ function $a(e) {
3259
3485
  if (!l) throw Error("Backend did not return a garment 3D model URL.");
3260
3486
  return c(l), o("ready"), l;
3261
3487
  } catch (e) {
3262
- throw u(Qa(e, "Failed to generate garment")), o("error"), e;
3488
+ throw u(is(e, "Failed to generate garment")), o("error"), e;
3263
3489
  }
3264
3490
  }, [n]),
3265
3491
  reset: () => {
@@ -3269,25 +3495,43 @@ function $a(e) {
3269
3495
  }
3270
3496
  //#endregion
3271
3497
  //#region src/garment/constants.ts
3272
- var eo = {
3273
- Hips: [U.LEFT_HIP, U.RIGHT_HIP],
3498
+ var os = {
3499
+ Hips: [B.LEFT_HIP, B.RIGHT_HIP],
3274
3500
  Spine: [
3275
- U.LEFT_SHOULDER,
3276
- U.RIGHT_SHOULDER,
3277
- U.LEFT_HIP,
3278
- U.RIGHT_HIP
3501
+ B.LEFT_SHOULDER,
3502
+ B.RIGHT_SHOULDER,
3503
+ B.LEFT_HIP,
3504
+ B.RIGHT_HIP
3279
3505
  ],
3280
- Chest: [U.LEFT_SHOULDER, U.RIGHT_SHOULDER],
3281
- LeftShoulder: [U.LEFT_SHOULDER, U.LEFT_ELBOW],
3282
- LeftUpperArm: [U.LEFT_SHOULDER, U.LEFT_ELBOW],
3283
- LeftLowerArm: [U.LEFT_ELBOW, U.LEFT_WRIST],
3284
- RightShoulder: [U.RIGHT_SHOULDER, U.RIGHT_ELBOW],
3285
- RightUpperArm: [U.RIGHT_SHOULDER, U.RIGHT_ELBOW],
3286
- RightLowerArm: [U.RIGHT_ELBOW, U.RIGHT_WRIST],
3287
- LeftUpperLeg: [U.LEFT_HIP, U.LEFT_KNEE],
3288
- LeftLowerLeg: [U.LEFT_KNEE, U.LEFT_ANKLE],
3289
- RightUpperLeg: [U.RIGHT_HIP, U.RIGHT_KNEE],
3290
- RightLowerLeg: [U.RIGHT_KNEE, U.RIGHT_ANKLE]
3291
- };
3506
+ Chest: [B.LEFT_SHOULDER, B.RIGHT_SHOULDER],
3507
+ LeftShoulder: [B.LEFT_SHOULDER, B.LEFT_ELBOW],
3508
+ LeftUpperArm: [B.LEFT_SHOULDER, B.LEFT_ELBOW],
3509
+ LeftLowerArm: [B.LEFT_ELBOW, B.LEFT_WRIST],
3510
+ RightShoulder: [B.RIGHT_SHOULDER, B.RIGHT_ELBOW],
3511
+ RightUpperArm: [B.RIGHT_SHOULDER, B.RIGHT_ELBOW],
3512
+ RightLowerArm: [B.RIGHT_ELBOW, B.RIGHT_WRIST],
3513
+ LeftUpperLeg: [B.LEFT_HIP, B.LEFT_KNEE],
3514
+ LeftLowerLeg: [B.LEFT_KNEE, B.LEFT_ANKLE],
3515
+ RightUpperLeg: [B.RIGHT_HIP, B.RIGHT_KNEE],
3516
+ RightLowerLeg: [B.RIGHT_KNEE, B.RIGHT_ANKLE]
3517
+ }, ss = 2, cs = .2, ls = 26, us = 18;
3518
+ function ds(e) {
3519
+ return {
3520
+ interval: Math.max(1, e),
3521
+ averageDetectionDurationMs: 0,
3522
+ framesUntilNextDetection: 0
3523
+ };
3524
+ }
3525
+ function fs(e, t) {
3526
+ return !t || e.framesUntilNextDetection <= 0 ? (e.framesUntilNextDetection = Math.max(e.interval - 1, 0), !0) : (--e.framesUntilNextDetection, !1);
3527
+ }
3528
+ function ps(e, t, n, r = 2) {
3529
+ let i = Math.max(1, n), a = Math.max(i, r), o = Number.isFinite(t) ? Math.max(0, t) : 0;
3530
+ if (e.averageDetectionDurationMs = e.averageDetectionDurationMs === 0 ? o : e.averageDetectionDurationMs + (o - e.averageDetectionDurationMs) * cs, e.averageDetectionDurationMs >= ls) {
3531
+ e.interval = a, e.framesUntilNextDetection = Math.min(e.framesUntilNextDetection, Math.max(e.interval - 1, 0));
3532
+ return;
3533
+ }
3534
+ e.averageDetectionDurationMs <= us && (e.interval = i, e.framesUntilNextDetection = Math.min(e.framesUntilNextDetection, Math.max(e.interval - 1, 0)));
3535
+ }
3292
3536
  //#endregion
3293
- export { gr as BONE_MAPPING, eo as BONE_VISIBILITY_MAP, me as DEFAULT_EVER_API_BASE_URL, be as DEFAULT_FEMALE_BODY_PRESET_ID, T as DEFAULT_GARMENT_SPEC, $t as DEFAULT_LOCKED_PERSON_ID, ye as DEFAULT_MALE_BODY_PRESET_ID, Xe as DEFAULT_MEASUREMENT_CONFIG, ht as DEFAULT_NUM_POSES, Fe as DEFAULT_SMOOTHING, w as EverCanvas, _e as EverClient, Xa as EverFittingScene, Ua as EverTrackedGarment, yi as FacingDetector, gt as INTERPOLATION_ALPHA, U as LANDMARK, xe as LEGACY_RIGGED_BODY_PRESET_ID, sn as LandmarkSmoother, ft as MEDIAPIPE_TASKS_VISION_VERSION, _t as MODEL_ASSET_PATHS, mt as POSE_DETECTION_INTERVAL, Pn as TRACKING_SNAPSHOT_HOLD_MS, Va as TrackedGarmentPoseDriver, pt as WASM_FILES_URL, qa as WebcamPlaneBackground, ni as YawDirectionStabilizer, Si as YawFreezeController, Jr as applyLandmarkPoseToGarment, _a as applyTrackedModelTransform, Xr as blendBonesToRest, we as buildBodyPresetAssetUrl, je as buildBodyPresetMatchRequest, yn as calcRectIoU, Un as captureBoneBinding, gn as clampNormalizedRect, Zt as closeSegmentationMasks, Be as computeBmiCorrectionFactor, pe as computeBodyFirstFitting, Rt as computeBoneDirectionFromLandmarks, Bt as computeBoneRotationFromLandmarks, et as computeCoverRect, Bi as computeFacingAwareShoulderWidth, qn as computeGarmentFitProfile, Ui as computeGarmentGroupRoll, Hi as computeGarmentGroupYaw, Wi as computeGarmentRootQuaternion, O as computeGarmentScale, _n as computeLandmarkBoundsNormalized, Lt as computeLandmarkSegmentDirection, ze as computeScale, Vi as computeStableShoulderWidth, tt as computeVisibleNormalizedRegion, $n as configureAvatarLoader, er as createAvatarLoaderExtension, ke as createFallbackBodyPresetSelection, In as createHeldTrackingSnapshot, ir as createHumanoidBoneBindings, An as createIdleTrackingQuality, ut as createInitialPoseSnapshot, Mn as createInitialTrackingRuntimeState, xn as createPoseCandidates, vt as createPoseLandmarker, Ra as createTrackedGarmentMotionState, ha as createTrackedModelTransformScratch, Ln as createTrackingLostRuntimeState, jn as createTrackingQuality, Nn as createTrackingRuntimeState, cr as createVRMCompat, ce as deriveBodyMorphResult, De as ensureBodyPresetModelUrl, vn as expandNormalizedRect, gi as extractFacingSignals, at as extractSilhouetteWidths, Tn as filterCandidatesByVisibleRegion, Qn as getAvatarAssetKind, zt as getBoneLandmarkInfluence, yr as getBoneRotation, Te as getDefaultBodyPresetId, Xt as getSegmentationMaskData, Vt as hasLandmarkMapping, ot as interpolateLandmarks, ct as interpolatePoseRig, dt as interpolatePoseSnapshot, lt as interpolateSilhouetteWidths, wn as isCandidateInVisibleRegion, _i as isRawFrontFacing, Zn as isVRMAssetUrl, Ti as landmarkDistance, Z as landmarkToThreePosition, J as lerpRotation, K as lerpValue, qe as measureBody, wi as midpointToThree, Ce as normalizeBodyPresetGender, vr as normalizeBoneName, tn as normalizeLandmark, nn as normalizeLandmarks, Oe as pickDefaultBodyPreset, tr as prepareAvatarScene, nr as prepareNativeVRM, Ye as recommendSize, Jn as resetBoneRotations, Yr as resetPoseState, za as resetTrackedGarmentMotionState, Qt as scaleSilhouetteWidths, Cn as selectLockedPoseCandidate, Fn as shouldHoldTrackingSnapshot, ln as smoothPoseRig, Yt as solvePose, Ae as toBodyPresetSelection, Ee as toBodyPresetSummary, En as toLockedPoseCandidate, Ba as updateTrackedGarmentMotion, ga as updateTrackedModelTransform, ur as useAvatarVariant, Pe as useBodyPresetSelection, Hn as useEverFitting, $a as useEverGeneration, $e as useMeasurement, qr as usePoseApplicationRefs, zn as usePoseTracker, Vn as useWebcam };
3537
+ export { Tr as BONE_MAPPING, os as BONE_VISIBILITY_MAP, _e as DEFAULT_EVER_API_BASE_URL, Ce as DEFAULT_FEMALE_BODY_PRESET_ID, D as DEFAULT_GARMENT_SPEC, gn as DEFAULT_LOCKED_PERSON_ID, Se as DEFAULT_MALE_BODY_PRESET_ID, $e as DEFAULT_MEASUREMENT_CONFIG, vt as DEFAULT_NUM_POSES, Re as DEFAULT_SMOOTHING, w as EverCanvas, be as EverClient, ns as EverFittingScene, Yo as EverTrackedGarment, ea as FacingDetector, yt as INTERPOLATION_ALPHA, B as LANDMARK, we as LEGACY_RIGGED_BODY_PRESET_ID, Sn as LandmarkSmoother, ht as MEDIAPIPE_TASKS_VISION_VERSION, bt as MODEL_ASSET_PATHS, _t as POSE_DETECTION_INTERVAL, ss as POSE_DETECTION_INTERVAL_FALLBACK, Yn as TRACKING_SNAPSHOT_HOLD_MS, qo as TrackedGarmentPoseDriver, gt as WASM_FILES_URL, $o as WebcamPlaneBackground, Li as YawDirectionStabilizer, ra as YawFreezeController, Ti as applyLandmarkPoseToGarment, mo as applyTrackedModelTransform, Di as blendBonesToRest, De as buildBodyPresetAssetUrl, Pe as buildBodyPresetMatchRequest, Pn as calcRectIoU, $t as canSolvePoseTorso, ir as captureBoneBinding, jn as clampNormalizedRect, nn as closeSegmentationMasks, Ue as computeBmiCorrectionFactor, ge as computeBodyFirstFitting, Vt as computeBoneDirectionFromLandmarks, Ut as computeBoneRotationFromLandmarks, rt as computeCoverRect, Ca as computeFacingAwareShoulderWidth, Z as computeFrameRateIndependentBlendFactor, cr as computeGarmentFitProfile, Ea as computeGarmentGroupRoll, Ta as computeGarmentGroupYaw, Da as computeGarmentRootQuaternion, k as computeGarmentScale, Mn as computeLandmarkBoundsNormalized, Bt as computeLandmarkSegmentDirection, He as computeScale, wa as computeStableShoulderWidth, it as computeVisibleNormalizedRegion, mr as configureAvatarLoader, hr as createAvatarLoaderExtension, Me as createFallbackBodyPresetSelection, Zn as createHeldTrackingSnapshot, yr as createHumanoidBoneBindings, Gn as createIdleTrackingQuality, pt as createInitialPoseSnapshot, qn as createInitialTrackingRuntimeState, In as createPoseCandidates, ds as createPoseDetectionCadenceState, xt as createPoseLandmarker, Wo as createTrackedGarmentMotionState, fo as createTrackedModelTransformScratch, Qn as createTrackingLostRuntimeState, Kn as createTrackingQuality, Jn as createTrackingRuntimeState, Xr as createVRMCompat, de as deriveBodyMorphResult, Ae as ensureBodyPresetModelUrl, Nn as expandNormalizedRect, Zi as extractFacingSignals, ct as extractSilhouetteWidths, Bn as filterCandidatesByVisibleRegion, pr as getAvatarAssetKind, Ht as getBoneLandmarkInfluence, Or as getBoneRotation, Oe as getDefaultBodyPresetId, tn as getSegmentationMaskData, Wt as hasLandmarkMapping, qr as inferNumberedHumanoidBoneAliases, lt as interpolateLandmarks, dt as interpolatePoseRig, mt as interpolatePoseSnapshot, ft as interpolateSilhouetteWidths, zn as isCandidateInVisibleRegion, Kr as isLikelyNumberedHumanoidSkeleton, Qi as isRawFrontFacing, fr as isVRMAssetUrl, oa as landmarkDistance, Q as landmarkToThreePosition, G as lerpRotation, U as lerpValue, Xe as measureBody, aa as midpointToThree, Ee as normalizeBodyPresetGender, Dr as normalizeBoneName, vn as normalizeLandmark, yn as normalizeLandmarks, je as pickDefaultBodyPreset, gr as prepareAvatarScene, _r as prepareNativeVRM, Qe as recommendSize, lr as resetBoneRotations, Ei as resetPoseState, Go as resetTrackedGarmentMotionState, hn as resolvePoseTrackingConfidence, ji as resolveSmoothingDeltaSeconds, rn as scaleSilhouetteWidths, Rn as selectLockedPoseCandidate, Xn as shouldHoldTrackingSnapshot, fs as shouldRunPoseDetection, wn as smoothPoseRig, en as solvePose, Ne as toBodyPresetSelection, ke as toBodyPresetSummary, Vn as toLockedPoseCandidate, ps as updatePoseDetectionCadence, Ko as updateTrackedGarmentMotion, po as updateTrackedModelTransform, Qr as useAvatarVariant, Le as useBodyPresetSelection, rr as useEverFitting, as as useEverGeneration, nt as useMeasurement, wi as usePoseApplicationRefs, er as usePoseTracker, nr as useWebcam };